r5sdk/r5dev/tier0/jobthread.cpp
Kawe Mazidjatari fe2a95e4ec RTech: major pak system overhaul and rebuild
* split rtech_game and rtech_utils cpp files into multiple files
* rebuilt several large pak load routines for debugging and custom implementations
* moved rson code to rtech_game
* reworked and improved engine and sdk pak precache system
* reversed more of the jobthreads system
2024-04-05 17:51:19 +02:00

42 lines
1.4 KiB
C++

#include "engine/host_cmd.h"
#include "tier0/jobthread.h"
bool JT_IsJobDone(const JobID_t jobId)
{
return (job_JT_Context[jobId & 0xFFF].field_24 ^ jobId) & 0xFFFFC000;
}
// TODO: confirm this actually returns a JobID_t and not some other int
JobID_t JTGuts_AddJob(JobTypeID_t jobTypeId, JobID_t jobId, void* callbackFunc, void* callbackArg)
{
const unsigned int jobIndex = JT_AllocateJob();
return JTGuts_AddJob_Internal(jobTypeId, jobId, callbackFunc, callbackArg, jobIndex, &job_JT_Context[jobIndex]);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void* HJT_HelpWithAnything(bool bShouldLoadPak)
{
// !! Uncomment if needed !!
// !! Consider initializing this in idetour iface if enabled !!
//static void* const retaddr = g_GameDll.FindPatternSIMD("48 8B C4 ?? 41 54 41 55 48 81 EC 70 04 ?? ?? F2 0F 10 05 ?? ?? ?? 0B")
// .Offset(0x4A0).FindPatternSelf("48 8B ?? ?? ?? ?? 01", CMemory::Direction::DOWN).RCast<void*>();
void* const results = JT_HelpWithAnything(bShouldLoadPak);
//if (retaddr != _ReturnAddress()) // Check if this is called after 'PakFile_Init()'.
//{
// return results;
//}
// Do stuff here after 'PakFile_Init()'.
return results;
}
void VJobThread::Detour(const bool bAttach) const
{
//DetourSetup(&JT_HelpWithAnything, &HJT_HelpWithAnything, bAttach);
}