[AssetHandler] 'Properly' reset bypass state

This commit is contained in:
momo5502 2017-02-14 11:38:24 +01:00
parent 3825f8fba7
commit d8ab3ab422
4 changed files with 19 additions and 0 deletions

View File

@ -74,6 +74,15 @@ namespace Components
return AssetHandler::BypassState > 0;
}
void AssetHandler::ResetBypassState()
{
if(AssetHandler::HasThreadBypass())
{
// Maybe just decrement it?
AssetHandler::BypassState = 0;
}
}
__declspec(naked) void AssetHandler::FindAssetStub()
{
__asm

View File

@ -41,6 +41,8 @@ namespace Components
static void ClearTemporaryAssets();
static void StoreTemporaryAsset(Game::XAssetType type, Game::XAssetHeader asset);
static void ResetBypassState();
private:
static thread_local int BypassState;

View File

@ -15,6 +15,12 @@ namespace Components
longjmp(_Buf, _Value);
}
__declspec(noreturn) void Exception::LongJmp(jmp_buf _Buf, int _Value)
{
AssetHandler::ResetBypassState();
longjmp(_Buf, _Value);
}
void Exception::SuspendProcess()
{
FreeConsole();
@ -162,6 +168,7 @@ namespace Components
#endif
//Utils::Hook(0x4B241F, Exception::ErrorLongJmp, HOOK_CALL).install()->quick();
Utils::Hook(0x6B8898, Exception::LongJmp, HOOK_JUMP).install()->quick();
Command::Add("mapTest", [](Command::Params* params)
{

View File

@ -20,6 +20,7 @@ namespace Components
static LONG WINAPI ExceptionFilter(LPEXCEPTION_POINTERS ExceptionInfo);
static LPTOP_LEVEL_EXCEPTION_FILTER WINAPI SetUnhandledExceptionFilterStub(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter);
static __declspec(noreturn) void ErrorLongJmp(jmp_buf _Buf, int _Value);
static __declspec(noreturn) void LongJmp(jmp_buf _Buf, int _Value);
static int MiniDumpType;
static Utils::Hook SetFilterHook;