Implemented safer way to check if the game is loaded

This commit is contained in:
Hyper 2024-12-04 01:19:03 +00:00
parent 56153cb60a
commit 8fe163e7c2
3 changed files with 6 additions and 3 deletions

View file

@ -3,12 +3,14 @@
#include <ui/window.h>
#include <patches/audio_patches.h>
bool g_isGameLoaded = false;
double g_deltaTime;
// CApplication::Update
PPC_FUNC_IMPL(__imp__sub_822C1130);
PPC_FUNC(sub_822C1130)
{
g_isGameLoaded = true;
g_deltaTime = ctx.f1.f64;
SDL_PumpEvents();

View file

@ -1,3 +1,4 @@
#pragma once
extern bool g_isGameLoaded;
extern double g_deltaTime;

View file

@ -2,7 +2,7 @@
#include "imgui_utils.h"
#include <api/SWA.h>
#include <gpu/video.h>
#include <ui/installer_wizard.h>
#include <app.h>
#include <exports.h>
#include <res/images/common/general_window.dds.h>
#include <res/images/common/select_fade.dds.h>
@ -149,7 +149,7 @@ void MessageWindow::Draw()
if (!s_isVisible)
return;
auto pInputState = InstallerWizard::s_isVisible ? nullptr : SWA::CInputState::GetInstance();
auto pInputState = g_isGameLoaded ? SWA::CInputState::GetInstance() : nullptr;
auto drawList = ImGui::GetForegroundDrawList();
auto& res = ImGui::GetIO().DisplaySize;
@ -299,7 +299,7 @@ bool MessageWindow::Open(std::string text, int* result, std::span<std::string> b
g_text = text;
g_buttons = std::vector(buttons.begin(), buttons.end());
g_defaultButtonIndex = defaultButtonIndex;
g_defaultButtonIndex = g_isGameLoaded ? defaultButtonIndex : -1;
ResetSelection();