Skip to content

Commit

Permalink
repo: removed merged 64x fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelIT7 committed Nov 12, 2024
1 parent 3b69fdc commit 19974a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions source/modules/threadpoolfix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ static int hook_CThreadPool_ExecuteToPriority(IThreadPool* pool, void* idx, void
}
#endif

#if ARCHITECTURE_IS_X86_64
#define FILESYSTEM_FIX 0 // This fix was added to Gmod -> https://github.com/Facepunch/garrysmod-issues/issues/6031
#if ARCHITECTURE_IS_X86_64 && FILESYSTEM_FIX
static Detouring::Hook detour_CThreadPool_Start;
Symbols::CBaseFileSystem_InitAsync func_CBaseFileSystem_InitAsync = NULL;
Symbols::CBaseFileSystem_ShutdownAsync func_CBaseFileSystem_ShutdownAsync = NULL;
Expand Down Expand Up @@ -62,6 +63,7 @@ void CThreadPoolFixModule::Init(CreateInterfaceFn* appfn, CreateInterfaceFn* gam
Util::StartThreadPool(g_pThreadPool, startParams);
}

#if FILESYSTEM_FIX
if (func_CBaseFileSystem_InitAsync && func_CBaseFileSystem_ShutdownAsync && !g_pModuleManager.IsUsingGhostInj()) // Restart the threadpool to fix it.
{
if (g_pThreadPoolFixModule.InDebug())
Expand All @@ -71,14 +73,15 @@ void CThreadPoolFixModule::Init(CreateInterfaceFn* appfn, CreateInterfaceFn* gam
func_CBaseFileSystem_InitAsync(g_pFullFileSystem);
}
#endif
#endif
}

void CThreadPoolFixModule::InitDetour(bool bPreServer)
{
SourceSDK::ModuleLoader libvstdlib_loader("vstdlib");
if (bPreServer)
{
#if ARCHITECTURE_IS_X86_64
#if ARCHITECTURE_IS_X86_64 && FILESYSTEM_FIX
Detour::Create(
&detour_CThreadPool_Start, "CThreadPool::Start",
libvstdlib_loader.GetModule(), Symbols::CThreadPool_StartSym,
Expand Down
4 changes: 3 additions & 1 deletion source/modules/vprof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ static void* hook_lj_BC_FUNCC(void* arg) // Find out the luajit function later.
}
#endif

#ifdef ARCHITECTURE_X86_64
#if defined(ARCHITECTURE_X86_64) && 0
Detouring::Hook detour_ThreadGetCurrentId;
ThreadId_t hook_ThreadGetCurrentId()
{
Expand Down Expand Up @@ -726,6 +726,7 @@ void CVProfModule::InitDetour(bool bPreServer)
#endif

#ifdef ARCHITECTURE_X86_64
#if 0 // This bug was fixed in Gmod itself -> https://github.com/Facepunch/garrysmod-issues/issues/6019
Detour::Create(
&detour_ThreadGetCurrentId, "ThreadGetCurrentId",
tier0_loader.GetModule(), Symbols::ThreadGetCurrentIdSym,
Expand All @@ -738,6 +739,7 @@ void CVProfModule::InitDetour(bool bPreServer)
unsigned long int pthread_Id = ThreadGetCurrentId();
if (m_TargetThreadId != pthread_Id)
Warning("[holylib - vprof] Failed to fix ThreadGetCurrentId! (vprof most likely won't work)\n");
#endif

Detour::Create(
&detour_Msg, "Msg",
Expand Down

0 comments on commit 19974a5

Please sign in to comment.