Preliminary mid-asm hook for gracefully exiting the game

This commit is contained in:
Hyper 2024-10-17 16:08:53 +01:00
parent b7b18f7476
commit f68f720b17
5 changed files with 28 additions and 0 deletions

View file

@ -46,6 +46,7 @@ set(SWA_UI_CXX_SOURCES
)
set(SWA_CXX_SOURCES
"game.cpp"
"main.cpp"
"misc_impl.cpp"

12
UnleashedRecomp/game.cpp Normal file
View file

@ -0,0 +1,12 @@
#include "game.h"
void Game::Exit()
{
s_isSignalExit = true;
}
bool GracefulLoopExitMidAsmHook()
{
// TODO (Sajid): investigate XAM handle closing causing assertion failure here.
return Game::s_isSignalExit;
}

9
UnleashedRecomp/game.h Normal file
View file

@ -0,0 +1,9 @@
#pragma once
class Game
{
public:
inline static bool s_isSignalExit = false;
static void Exit();
};

View file

@ -2541,3 +2541,4 @@ GUEST_FUNCTION_STUB(sub_82BEA018);
GUEST_FUNCTION_STUB(sub_82BEA7C0);
GUEST_FUNCTION_STUB(sub_82BFFF88); // D3DXFilterTexture
GUEST_FUNCTION_STUB(sub_82E9EF90); // D3DXFillTexture
GUEST_FUNCTION_STUB(sub_82BD96D0);

View file

@ -103,3 +103,8 @@ registers = ["f13"]
name = "Primitive2DHalfPixelOffsetMidAsmHook"
address = 0x830D213C
registers = ["f13"]
[[midasm_hook]]
name = "GracefulLoopExitMidAsmHook"
address = 0x822C1018
return_on_true = true