game closing and code cleanup
This commit is contained in:
@@ -35,11 +35,16 @@ void CGame::init() {
|
||||
}
|
||||
} while (base_client.base == 0 || base_engine.base == 0);
|
||||
|
||||
GetClientRect(g_game.process->hwnd_, &game_bounds);
|
||||
GetClientRect(process->hwnd_, &game_bounds);
|
||||
|
||||
buildNumber = process->read<uintptr_t>(base_engine.base + updater::offsets::dwBuildNumber);
|
||||
}
|
||||
|
||||
void CGame::close() {
|
||||
std::cout << "[cs2] Deatachig from process" << std::endl;
|
||||
process->Close();
|
||||
}
|
||||
|
||||
void CGame::loop() {
|
||||
inGame = false;
|
||||
isC4Planted = false;
|
||||
@@ -60,7 +65,7 @@ void CGame::loop() {
|
||||
|
||||
localTeam = process->read<int>(localPlayer + updater::offsets::m_iTeamNum);
|
||||
localOrigin = process->read<Vector3>(localpCSPlayerPawn + updater::offsets::m_vecOrigin);
|
||||
isC4Planted = process->read<bool>(g_game.base_client.base + updater::offsets::dwPlantedC4 - 0x8);
|
||||
isC4Planted = process->read<bool>(base_client.base + updater::offsets::dwPlantedC4 - 0x8);
|
||||
|
||||
inGame = true;
|
||||
int playerIndex = 0;
|
||||
@@ -143,7 +148,7 @@ void CGame::loop() {
|
||||
}
|
||||
|
||||
std::string CGame::read_string(uintptr_t addr) {
|
||||
const DWORD64 address = g_game.process->read<DWORD64>(addr);
|
||||
const DWORD64 address = process->read<DWORD64>(addr);
|
||||
if (address) {
|
||||
char buffer[256];
|
||||
process->read_raw(address, buffer, sizeof(buffer));
|
||||
|
||||
@@ -50,6 +50,7 @@ public:
|
||||
std::vector<CPlayer> players = {};
|
||||
void init();
|
||||
void loop();
|
||||
void close();
|
||||
Vector3 world_to_screen(Vector3* v);
|
||||
private:
|
||||
view_matrix_t view_matrix;
|
||||
|
||||
@@ -177,8 +177,7 @@ int main() {
|
||||
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
std::cout << "[cs2] Deataching from process" << std::endl;
|
||||
g_game.process->Close();
|
||||
g_game.close();
|
||||
|
||||
#ifdef NDEBUG
|
||||
std::cout << "[cs2] Press any key to close" << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user