Skip to content

Commit

Permalink
Fix ExitGame
Browse files Browse the repository at this point in the history
  • Loading branch information
doyaGu committed Jun 20, 2024
1 parent e3973d6 commit 5233521
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/ModManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,6 @@ CKERROR ModManager::PostProcess() {

Overlay::ImGuiRender();

if (m_Exiting)
m_MessageManager->SendMessageBroadcast(m_MessageManager->AddMessageType((CKSTRING) "Exit Game"));

m_InputHook->Process();

return CK_OK;
Expand Down Expand Up @@ -792,6 +789,12 @@ void ModManager::AddTimerLoop(float delay, std::function<bool()> callback) {
m_Timers.emplace_back(delay, callback, m_TimeManager->GetMainTickCount(), m_TimeManager->GetAbsoluteTime());
}

void ModManager::ExitGame() {
AddTimer(1ul, [this]() {
::PostMessage((HWND) m_Context->GetMainWindow(), 0x5FA, 0, 0);
});
}

void ModManager::OpenModsMenu() {
m_Logger->Info("Open Mods Menu");
m_BMLMod->OpenModsMenu();
Expand Down
3 changes: 1 addition & 2 deletions src/ModManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class ModManager : public CKBaseManager, public IBML {
void AddTimer(float delay, std::function<void()> callback) override;
void AddTimerLoop(float delay, std::function<bool()> callback) override;

void ExitGame() override { m_Exiting = true; }
void ExitGame() override;

bool IsIngame() override { return m_Ingame; }
bool IsPaused() override { return m_Paused; }
Expand Down Expand Up @@ -347,7 +347,6 @@ class ModManager : public CKBaseManager, public IBML {
bool m_ModsInited = false;
bool m_ModsDown = false;

bool m_Exiting = false;
bool m_Ingame = false;
bool m_InLevel = false;
bool m_Paused = false;
Expand Down

0 comments on commit 5233521

Please sign in to comment.