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);
|
} 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);
|
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() {
|
void CGame::loop() {
|
||||||
inGame = false;
|
inGame = false;
|
||||||
isC4Planted = false;
|
isC4Planted = false;
|
||||||
@@ -60,7 +65,7 @@ void CGame::loop() {
|
|||||||
|
|
||||||
localTeam = process->read<int>(localPlayer + updater::offsets::m_iTeamNum);
|
localTeam = process->read<int>(localPlayer + updater::offsets::m_iTeamNum);
|
||||||
localOrigin = process->read<Vector3>(localpCSPlayerPawn + updater::offsets::m_vecOrigin);
|
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;
|
inGame = true;
|
||||||
int playerIndex = 0;
|
int playerIndex = 0;
|
||||||
@@ -143,7 +148,7 @@ void CGame::loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string CGame::read_string(uintptr_t addr) {
|
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) {
|
if (address) {
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
process->read_raw(address, buffer, sizeof(buffer));
|
process->read_raw(address, buffer, sizeof(buffer));
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public:
|
|||||||
std::vector<CPlayer> players = {};
|
std::vector<CPlayer> players = {};
|
||||||
void init();
|
void init();
|
||||||
void loop();
|
void loop();
|
||||||
|
void close();
|
||||||
Vector3 world_to_screen(Vector3* v);
|
Vector3 world_to_screen(Vector3* v);
|
||||||
private:
|
private:
|
||||||
view_matrix_t view_matrix;
|
view_matrix_t view_matrix;
|
||||||
|
|||||||
@@ -177,8 +177,7 @@ int main() {
|
|||||||
|
|
||||||
DestroyWindow(hWnd);
|
DestroyWindow(hWnd);
|
||||||
|
|
||||||
std::cout << "[cs2] Deataching from process" << std::endl;
|
g_game.close();
|
||||||
g_game.process->Close();
|
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
std::cout << "[cs2] Press any key to close" << std::endl;
|
std::cout << "[cs2] Press any key to close" << std::endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user