text: #include "Offsets.hpp"
  
  size_t csgo::cs_gamerules_data = 0x0;
  size_t csgo::m_ArmorValue = 0x0;
  size_t csgo::m_Collision = 0x0;
  size_t csgo::m_CollisionGroup = 0x0;
  size_t csgo::m_Local = 0x0;
  size_t csgo::m_MoveType = 0x0;
  size_t csgo::m_OriginalOwnerXuidHigh = 0x0;
  size_t csgo::m_OriginalOwnerXuidLow = 0x0;
  size_t csgo::m_SurvivalGameRuleDecisionTypes = 0x0;
  size_t csgo::m_SurvivalRules = 0x0;
  size_t csgo::m_aimPunchAngle = 0x0;
  size_t csgo::m_aimPunchAngleVel = 0x0;
  size_t csgo::m_angEyeAnglesX = 0x0;
  size_t csgo::m_angEyeAnglesY = 0x0;
  size_t csgo::m_bBombDefused = 0x0;
  size_t csgo::m_bBombPlanted = 0x0;
  size_t csgo::m_bBombTicking = 0x0;
  size_t csgo::m_bFreezePeriod = 0x0;
  size_t csgo::m_bGunGameImmunity = 0x0;
  size_t csgo::m_bHasDefuser = 0x0;
  size_t csgo::m_bHasHelmet = 0x0;
  size_t csgo::m_bInReload = 0x0;
  size_t csgo::m_bIsDefusing = 0x0;
  size_t csgo::m_bIsQueuedMatchmaking = 0x0;
  size_t csgo::m_bIsScoped = 0x0;
  size_t csgo::m_bIsValveDS = 0x0;
  size_t csgo::m_bSpotted = 0x0;
  size_t csgo::m_bSpottedByMask = 0x0;
  size_t csgo::m_bStartedArming = 0x0;
  size_t csgo::m_bUseCustomAutoExposureMax = 0x0;
  size_t csgo::m_bUseCustomAutoExposureMin = 0x0;
  size_t csgo::m_bUseCustomBloomScale = 0x0;
  size_t csgo::m_clrRender = 0x0;
  size_t csgo::m_dwBoneMatrix = 0x0;
  size_t csgo::m_fAccuracyPenalty = 0x0;
  size_t csgo::m_fFlags = 0x0;
  size_t csgo::m_flC4Blow = 0x0;
  size_t csgo::m_flCustomAutoExposureMax = 0x0;
  size_t csgo::m_flCustomAutoExposureMin = 0x0;
  size_t csgo::m_flCustomBloomScale = 0x0;
  size_t csgo::m_flDefuseCountDown = 0x0;
  size_t csgo::m_flDefuseLength = 0x0;
  size_t csgo::m_flFallbackWear = 0x0;
  size_t csgo::m_flFlashDuration = 0x0;
  size_t csgo::m_flFlashMaxAlpha = 0x0;
  size_t csgo::m_flLastBoneSetupTime = 0x0;
  size_t csgo::m_flLowerBodyYawTarget = 0x0;
  size_t csgo::m_flNextAttack = 0x0;
  size_t csgo::m_flNextPrimaryAttack = 0x0;
  size_t csgo::m_flSimulationTime = 0x0;
  size_t csgo::m_flTimerLength = 0x0;
  size_t csgo::m_hActiveWeapon = 0x0;
  size_t csgo::m_hBombDefuser = 0x0;
  size_t csgo::m_hMyWeapons = 0x0;
  size_t csgo::m_hObserverTarget = 0x0;
  size_t csgo::m_hOwner = 0x0;
  size_t csgo::m_hOwnerEntity = 0x0;
  size_t csgo::m_hViewModel = 0x0;
  size_t csgo::m_iAccountID = 0x0;
  size_t csgo::m_iClip1 = 0x0;
  size_t csgo::m_iCompetitiveRanking = 0x0;
  size_t csgo::m_iCompetitiveWins = 0x0;
  size_t csgo::m_iCrosshairId = 0x0;
  size_t csgo::m_iDefaultFOV = 0x0;
  size_t csgo::m_iEntityQuality = 0x0;
  size_t csgo::m_iFOVStart = 0x0;
  size_t csgo::m_iGlowIndex = 0x0;
  size_t csgo::m_iHealth = 0x0;
  size_t csgo::m_iItemDefinitionIndex = 0x0;
  size_t csgo::m_iItemIDHigh = 0x0;
  size_t csgo::m_iMostRecentModelBoneCounter = 0x0;
  size_t csgo::m_iObserverMode = 0x0;
  size_t csgo::m_iShotsFired = 0x0;
  size_t csgo::m_iState = 0x0;
  size_t csgo::m_iTeamNum = 0x0;
  size_t csgo::m_lifeState = 0x0;
  size_t csgo::m_nBombSite = 0x0;
  size_t csgo::m_nFallbackPaintKit = 0x0;
  size_t csgo::m_nFallbackSeed = 0x0;
  size_t csgo::m_nFallbackStatTrak = 0x0;
  size_t csgo::m_nForceBone = 0x0;
  size_t csgo::m_nTickBase = 0x0;
  size_t csgo::m_nViewModelIndex = 0x0;
  size_t csgo::m_rgflCoordinateFrame = 0x0;
  size_t csgo::m_szCustomName = 0x0;
  size_t csgo::m_szLastPlaceName = 0x0;
  size_t csgo::m_thirdPersonViewAngles = 0x0;
  size_t csgo::m_vecOrigin = 0x0;
  size_t csgo::m_vecVelocity = 0x0;
  size_t csgo::m_vecViewOffset = 0x0;
  size_t csgo::m_viewPunchAngle = 0x0;
  size_t csgo::m_zoomLevel = 0x0;
  size_t csgo::anim_overlays = 0x0;
  size_t csgo::clientstate_choked_commands = 0x0;
  size_t csgo::clientstate_delta_ticks = 0x0;
  size_t csgo::clientstate_last_outgoing_command = 0x0;
  size_t csgo::clientstate_net_channel = 0x0;
  size_t csgo::convar_name_hash_table = 0x0;
  size_t csgo::dwClientState = 0x0;
  size_t csgo::dwClientState_GetLocalPlayer = 0x0;
  size_t csgo::dwClientState_IsHLTV = 0x0;
  size_t csgo::dwClientState_Map = 0x0;
  size_t csgo::dwClientState_MapDirectory = 0x0;
  size_t csgo::dwClientState_MaxPlayer = 0x0;
  size_t csgo::dwClientState_PlayerInfo = 0x0;
  size_t csgo::dwClientState_State = 0x0;
  size_t csgo::dwClientState_ViewAngles = 0x0;
  size_t csgo::dwEntityList = 0x0;
  size_t csgo::dwForceAttack = 0x0;
  size_t csgo::dwForceAttack2 = 0x0;
  size_t csgo::dwForceBackward = 0x0;
  size_t csgo::dwForceForward = 0x0;
  size_t csgo::dwForceJump = 0x0;
  size_t csgo::dwForceLeft = 0x0;
  size_t csgo::dwForceRight = 0x0;
  size_t csgo::dwGameDir = 0x0;
  size_t csgo::dwGameRulesProxy = 0x0;
  size_t csgo::dwGetAllClasses = 0x0;
  size_t csgo::dwGlobalVars = 0x0;
  size_t csgo::dwGlowObjectManager = 0x0;
  size_t csgo::dwInput = 0x0;
  size_t csgo::dwInterfaceLinkList = 0x0;
  size_t csgo::dwLocalPlayer = 0x0;
  size_t csgo::dwMouseEnable = 0x0;
  size_t csgo::dwMouseEnablePtr = 0x0;
  size_t csgo::dwPlayerResource = 0x0;
  size_t csgo::dwRadarBase = 0x0;
  size_t csgo::dwSensitivity = 0x0;
  size_t csgo::dwSensitivityPtr = 0x0;
  size_t csgo::dwSetClanTag = 0x0;
  size_t csgo::dwViewMatrix = 0x0;
  size_t csgo::dwWeaponTable = 0x0;
  size_t csgo::dwWeaponTableIndex = 0x0;
  size_t csgo::dwYawPtr = 0x0;
  size_t csgo::dwZoomSensitivityRatioPtr = 0x0;
  size_t csgo::dwbSendPackets = 0x0;
  size_t csgo::dwppDirect3DDevice9 = 0x0;
  size_t csgo::find_hud_element = 0x0;
  size_t csgo::force_update_spectator_glow = 0x0;
  size_t csgo::interface_engine_cvar = 0x0;
  size_t csgo::is_c4_owner = 0x0;
  size_t csgo::m_bDormant = 0x0;
  size_t csgo::m_flSpawnTime = 0x0;
  size_t csgo::m_pStudioHdr = 0x0;
  size_t csgo::m_pitchClassPtr = 0x0;
  size_t csgo::m_yawClassPtr = 0x0;
  size_t csgo::model_ambient_min = 0x0;
  size_t csgo::set_abs_angles = 0x0;
  size_t csgo::set_abs_origin = 0x0;
  int csgo::success_rate = 0;
  int csgo::total_items = 92;
  
  void csgo::findOffsets(DWORD pid, HANDLE process) {
  #if 1
  	csgo::cs_gamerules_data = 0x0;
  	csgo::m_ArmorValue = 0xB37C;
  	csgo::m_Collision = 0x320;
  	csgo::m_CollisionGroup = 0x474;
  	csgo::m_Local = 0x2FBC;
  	csgo::m_MoveType = 0x25C;
  	csgo::m_OriginalOwnerXuidHigh = 0x31C4;
  	csgo::m_OriginalOwnerXuidLow = 0x31C0;
  	csgo::m_SurvivalGameRuleDecisionTypes = 0x1328;
  	csgo::m_SurvivalRules = 0xD00;
  	csgo::m_aimPunchAngle = 0x302C;
  	csgo::m_aimPunchAngleVel = 0x3038;
  	csgo::m_angEyeAnglesX = 0xB380;
  	csgo::m_angEyeAnglesY = 0xB384;
  	csgo::m_bBombDefused = 0x29B0;
  	csgo::m_bBombPlanted = 0x9A5;
  	csgo::m_bBombTicking = 0x2980;
  	csgo::m_bFreezePeriod = 0x20;
  	csgo::m_bGunGameImmunity = 0x3944;
  	csgo::m_bHasDefuser = 0xB38C;
  	csgo::m_bHasHelmet = 0xB370;
  	csgo::m_bInReload = 0x32A5;
  	csgo::m_bIsDefusing = 0x3930;
  	csgo::m_bIsQueuedMatchmaking = 0x74;
  	csgo::m_bIsScoped = 0x3928;
  	csgo::m_bIsValveDS = 0x7C;
  	csgo::m_bSpotted = 0x93D;
  	csgo::m_bSpottedByMask = 0x980;
  	csgo::m_bStartedArming = 0x33F0;
  	csgo::m_bUseCustomAutoExposureMax = 0x9D9;
  	csgo::m_bUseCustomAutoExposureMin = 0x9D8;
  	csgo::m_bUseCustomBloomScale = 0x9DA;
  	csgo::m_clrRender = 0x70;
  	csgo::m_dwBoneMatrix = 0x26A8;
  	csgo::m_fAccuracyPenalty = 0x3330;
  	csgo::m_fFlags = 0x104;
  	csgo::m_flC4Blow = 0x2990;
  	csgo::m_flCustomAutoExposureMax = 0x9E0;
  	csgo::m_flCustomAutoExposureMin = 0x9DC;
  	csgo::m_flCustomBloomScale = 0x9E4;
  	csgo::m_flDefuseCountDown = 0x29AC;
  	csgo::m_flDefuseLength = 0x29A8;
  	csgo::m_flFallbackWear = 0x31D0;
  	csgo::m_flFlashDuration = 0xA420;
  	csgo::m_flFlashMaxAlpha = 0xA41C;
  	csgo::m_flLastBoneSetupTime = 0x2924;
  	csgo::m_flLowerBodyYawTarget = 0x3A90;
  	csgo::m_flNextAttack = 0x2D70;
  	csgo::m_flNextPrimaryAttack = 0x3238;
  	csgo::m_flSimulationTime = 0x268;
  	csgo::m_flTimerLength = 0x2994;
  	csgo::m_hActiveWeapon = 0x2EF8;
  	csgo::m_hBombDefuser = 0x29B4;
  	csgo::m_hMyWeapons = 0x2DF8;
  	csgo::m_hObserverTarget = 0x338C;
  	csgo::m_hOwner = 0x29CC;
  	csgo::m_hOwnerEntity = 0x14C;
  	csgo::m_hViewModel = 0x32F8;
  	csgo::m_iAccountID = 0x2FC8;
  	csgo::m_iClip1 = 0x3264;
  	csgo::m_iCompetitiveRanking = 0x1A84;
  	csgo::m_iCompetitiveWins = 0x1B88;
  	csgo::m_iCrosshairId = 0xB3E8;
  	csgo::m_iDefaultFOV = 0x332C;
  	csgo::m_iEntityQuality = 0x2FAC;
  	csgo::m_iFOVStart = 0x31E8;
  	csgo::m_iGlowIndex = 0xA438;
  	csgo::m_iHealth = 0x100;
  	csgo::m_iItemDefinitionIndex = 0x2FAA;
  	csgo::m_iItemIDHigh = 0x2FC0;
  	csgo::m_iMostRecentModelBoneCounter = 0x2690;
  	csgo::m_iObserverMode = 0x3378;
  	csgo::m_iShotsFired = 0xA390;
  	csgo::m_iState = 0x3258;
  	csgo::m_iTeamNum = 0xF4;
  	csgo::m_lifeState = 0x25F;
  	csgo::m_nBombSite = 0x2984;
  	csgo::m_nFallbackPaintKit = 0x31C8;
  	csgo::m_nFallbackSeed = 0x31CC;
  	csgo::m_nFallbackStatTrak = 0x31D4;
  	csgo::m_nForceBone = 0x268C;
  	csgo::m_nTickBase = 0x3430;
  	csgo::m_nViewModelIndex = 0x29C0;
  	csgo::m_rgflCoordinateFrame = 0x444;
  	csgo::m_szCustomName = 0x303C;
  	csgo::m_szLastPlaceName = 0x35B4;
  	csgo::m_thirdPersonViewAngles = 0x31D8;
  	csgo::m_vecOrigin = 0x138;
  	csgo::m_vecVelocity = 0x114;
  	csgo::m_vecViewOffset = 0x108;
  	csgo::m_viewPunchAngle = 0x3020;
  	csgo::m_zoomLevel = 0x33D0;
  	csgo::anim_overlays = 0x2980;
  	csgo::clientstate_choked_commands = 0x4D30;
  	csgo::clientstate_delta_ticks = 0x174;
  	csgo::clientstate_last_outgoing_command = 0x4D2C;
  	csgo::clientstate_net_channel = 0x9C;
  	csgo::convar_name_hash_table = 0x2F0F8;
  	csgo::dwClientState = 0x588FEC;
  	csgo::dwClientState_GetLocalPlayer = 0x180;
  	csgo::dwClientState_IsHLTV = 0x4D48;
  	csgo::dwClientState_Map = 0x28C;
  	csgo::dwClientState_MapDirectory = 0x188;
  	csgo::dwClientState_MaxPlayer = 0x388;
  	csgo::dwClientState_PlayerInfo = 0x52C0;
  	csgo::dwClientState_State = 0x108;
  	csgo::dwClientState_ViewAngles = 0x4D90;
  	csgo::dwEntityList = 0x4DA31BC;
  	csgo::dwForceAttack = 0x31D36E4;
  	csgo::dwForceAttack2 = 0x31D36F0;
  	csgo::dwForceBackward = 0x31D372C;
  	csgo::dwForceForward = 0x31D3738;
  	csgo::dwForceJump = 0x524CFAC;
  	csgo::dwForceLeft = 0x31D3750;
  	csgo::dwForceRight = 0x31D3744;
  	csgo::dwGameDir = 0x627780;
  	csgo::dwGameRulesProxy = 0x52C029C;
  	csgo::dwGetAllClasses = 0xDB201C;
  	csgo::dwGlobalVars = 0x588CF0;
  	csgo::dwGlowObjectManager = 0x52EB640;
  	csgo::dwInput = 0x51F4780;
  	csgo::dwInterfaceLinkList = 0x944E34;
  	csgo::dwLocalPlayer = 0xD8A2CC;
  	csgo::dwMouseEnable = 0xD8FE18;
  	csgo::dwMouseEnablePtr = 0xD8FDE8;
  	csgo::dwPlayerResource = 0x31D1A70;
  	csgo::dwRadarBase = 0x51D7F34;
  	csgo::dwSensitivity = 0xD8FCB4;
  	csgo::dwSensitivityPtr = 0xD8FC88;
  	csgo::dwSetClanTag = 0x8A1B0;
  	csgo::dwViewMatrix = 0x4D94AD4;
  	csgo::dwWeaponTable = 0x51F5240;
  	csgo::dwWeaponTableIndex = 0x325C;
  	csgo::dwYawPtr = 0xD8FA78;
  	csgo::dwZoomSensitivityRatioPtr = 0xD94D18;
  	csgo::dwbSendPackets = 0xD779A;
  	csgo::dwppDirect3DDevice9 = 0xA7050;
  	csgo::find_hud_element = 0x2E7EF720;
  	csgo::force_update_spectator_glow = 0x3AF66A;
  	csgo::interface_engine_cvar = 0x3E9EC;
  	csgo::is_c4_owner = 0x3BC2C0;
  	csgo::m_bDormant = 0xED;
  	csgo::m_flSpawnTime = 0xA370;
  	csgo::m_pStudioHdr = 0x294C;
  	csgo::m_pitchClassPtr = 0x51D81D0;
  	csgo::m_yawClassPtr = 0xD8FA78;
  	csgo::model_ambient_min = 0x58C064;
  	csgo::set_abs_angles = 0x1E0AC0;
  	csgo::set_abs_origin = 0x1E0900;
  #endif
  
  #if 0
  	// Prepare modules
  	MODULEENTRY32 client;
  	MODULEENTRY32 engine;
  
  	getModule(CLIENT, pid, &client);
  	getModule(ENGINE, pid, &engine);
  
  	// Prepare module memory
  	uint8_t* client_mem = new uint8_t[client.modBaseSize];
  	uint8_t* engine_mem = new uint8_t[engine.modBaseSize];
  
  	std::cout << "Reading memory..." << std::endl;
  	ReadProcessMemory(process, client.modBaseAddr, (LPVOID)client_mem, client.modBaseSize, 0);
  	ReadProcessMemory(process, engine.modBaseAddr, (LPVOID)engine_mem, engine.modBaseSize, 0);
  
  	// Structs
  	ModuleInfo C;
  	C.data = client_mem;
  	C.base_address = reinterpret_cast<size_t>(client.modBaseAddr);
  	C.base_size = client.modBaseSize;
  	C.process = process;
  
  	ModuleInfo E;
  	E.data = engine_mem;
  	E.base_address = reinterpret_cast<size_t>(engine.modBaseAddr);
  	E.base_size = engine.modBaseSize;
  	E.process = process;
  
  	// Pattern scanning
  	std::cout << "Pattern scanning..." << std::endl;
  
  	dwClientState = findOffset("A1 ? ? ? ? 33 D2 6A 00 6A 00 33 C9 89 B0", 1, 0, E);
  	dwClientState_GetLocalPlayer = findOffset("8B 80 ? ? ? ? 40 C3", 2, 0, E);
  	dwClientState_IsHLTV = findOffset("8B 80 ? ? ? ? 40 C3", 2, 0, E);
  	dwClientState_Map = findOffset("05 ? ? ? ? C3 CC CC CC CC CC CC CC A1", 2, 0, E);
  	dwClientState_MapDirectory = findOffset("B8 ? ? ? ? C3 05 ? ? ? ? C3", 7, 0, E);
  	dwClientState_MaxPlayer = findOffset("A1 ? ? ? ? 8B 80 ? ? ? ? C3 CC CC CC CC 55 8B EC 8A 45 08", 7, 0, E);
  	dwClientState_PlayerInfo = findOffset("8B 89 ? ? ? ? 85 C9 0F 84 ? ? ? ? 8B 01", 2, 0, E);
  
  	std::cout << "Done" << std::endl;
  #endif
  }
  
  
  size_t csgo::findOffset(const char* str_pattern, size_t offset, uint8_t extra, ModuleInfo info) {
  	// Determine amount of tokens in the pattern string
  	size_t len = strlen(str_pattern);
  	int tokens = 0;
  	for (size_t i = 0; i < len; i++) {
  		if (tokens == 0) {
  			tokens = 1;
  		}
  		if (str_pattern[i] == ' ') {
  			tokens++;
  		}
  	}
  
  	// Allocate resources accordingly
  	int* bytes = new int[tokens];
  	int bytes_length = tokens;
  
  	// Parse hex tokens into integers and '?'s as -1
  	size_t str_index = 0;
  	for (int i = 0; i < bytes_length; i++) {
  	beginning:
  		char current = str_pattern[str_index];
  		if (current == '?') {
  			bytes[i] = -1;
  			str_index++;
  		}
  		else if (current == ' ') {
  			str_index++;
  			goto beginning;
  		}
  		else {
  			char str_hex[3];
  			str_hex[0] = str_pattern[str_index];
  			str_hex[1] = str_pattern[str_index + 1];
  			str_hex[2] = 0;
  
  			uint8_t result = 0;
  			char* p;
  
  			long n = strtoul(str_hex, &p, 16);
  			result = n;
  
  			bytes[i] = result;
  
  			str_index += 2;
  		}
  	}
  
  	// Scan process memory for pattern
  	for (size_t i = 0; i < info.base_size; i++) {
  		bool fail = false;
  		for (size_t j = 0; j < bytes_length; j++) {
  			int pattern_byte = bytes[j];
  			uint8_t val = info.data[i + j];
  			int memory_byte = (int)val;
  			if (pattern_byte != -1 && pattern_byte != memory_byte) {
  				fail = true;
  				break;
  			}
  		}
  		if (!fail) {
  			// Pattern found, read and do some calculations before returning
  			size_t address = read_mem<size_t>(&info.process, info.base_address + i + offset);
  			address -= info.base_address;
  			address += extra;
  			success_rate++;
  			std::cout << success_rate << "/" << total_items << std::endl;
  			return address;
  		}
  	}
  	std::cout << "Couldn't find offset" << std::endl;
  	return 0;
  }