RTech: rename pak fifo lock state pointer

Should be called g_bPakFifoLockAcquiredInMainThread, as the system has to account for the lock depth if the lock was acquired in the main thread.
This commit is contained in:
Kawe Mazidjatari 2024-11-17 02:19:54 +01:00
parent 35c6655e20
commit 3eea52b199
2 changed files with 5 additions and 6 deletions

View File

@ -417,9 +417,9 @@ void Mod_QueuedPakCacheFrame()
if (ThreadInMainThread())
{
if (*g_bPakFifoLockAcquired)
if (*g_bPakFifoLockAcquiredInMainThread)
{
*g_bPakFifoLockAcquired = 0;
*g_bPakFifoLockAcquiredInMainThread = 0;
JT_ReleaseFifoLock(pakFifoLock);
}
}

View File

@ -52,11 +52,10 @@ extern PakLoadFuncs_s* g_pakLoadApi;
inline JobHelpCallback_t g_pPakFifoLockWrapper; // Pointer to functor that takes the global pak fifolock as argument.
// TODO: rename to 'g_bPakFifoLockAcquiredInMainThread'
// if this is set, JT_ReleaseFifoLock has to be called
// twice as the depth goes up to the thread that
// acquired the lock + the main thread
inline bool* g_bPakFifoLockAcquired;
inline bool* g_bPakFifoLockAcquiredInMainThread;
///////////////////////////////////////////////////////////////////////////////
class V_PakState : public IDetour
@ -67,7 +66,7 @@ class V_PakState : public IDetour
LogVarAdr("g_pakLoadApi", g_pakLoadApi);
LogVarAdr("g_pakFifoLockWrapper", g_pPakFifoLockWrapper);
LogVarAdr("g_pakFifoLockAcquired", g_bPakFifoLockAcquired);
LogVarAdr("g_bPakFifoLockAcquiredInMainThread", g_bPakFifoLockAcquiredInMainThread);
}
virtual void GetFun(void) const { }
virtual void GetVar(void) const
@ -78,7 +77,7 @@ class V_PakState : public IDetour
const CMemory jtBase(JT_HelpWithAnything);
g_pPakFifoLockWrapper = jtBase.Offset(0x1BC).FindPatternSelf("48 8D 0D").ResolveRelativeAddressSelf(0x3, 0x7).RCast<JobHelpCallback_t>();
g_bPakFifoLockAcquired = jtBase.Offset(0x50).FindPatternSelf("C6 05").ResolveRelativeAddressSelf(0x2, 0x7).RCast<bool*>();
g_bPakFifoLockAcquiredInMainThread = jtBase.Offset(0x50).FindPatternSelf("C6 05").ResolveRelativeAddressSelf(0x2, 0x7).RCast<bool*>();
}
virtual void GetCon(void) const { }
virtual void Detour(const bool bAttach) const { };