🚨 Fix DB_EnumXAssetEntries ⚡
This commit is contained in:
parent
c31f5b15ce
commit
7a33fe42e8
@ -257,7 +257,10 @@ namespace Assets
|
|||||||
|
|
||||||
if (header.material->techniqueSet == iw4TechSet->asset.header.techniqueSet)
|
if (header.material->techniqueSet == iw4TechSet->asset.header.techniqueSet)
|
||||||
{
|
{
|
||||||
Components::Logger::Print("Material %s with techset %s has been mapped to %s (last chance!), taking the sort key of material %s\n", asset->info.name, asset->techniqueSet->name, header.material->techniqueSet->name, header.material->info.name);
|
Components::Logger::Print("Material %s with techset %s has been mapped to %s (last chance!), taking the sort key of material %s\n",
|
||||||
|
asset->info.name, asset->techniqueSet->name,
|
||||||
|
header.material->techniqueSet->name, header.material->info.name);
|
||||||
|
|
||||||
asset->info.sortKey = header.material->info.sortKey;
|
asset->info.sortKey = header.material->info.sortKey;
|
||||||
asset->techniqueSet = iw4TechSet->asset.header.techniqueSet;
|
asset->techniqueSet = iw4TechSet->asset.header.techniqueSet;
|
||||||
|
|
||||||
|
@ -336,6 +336,9 @@ namespace Game
|
|||||||
Sys_SuspendOtherThreads_t Sys_SuspendOtherThreads = Sys_SuspendOtherThreads_t(0x45A190);
|
Sys_SuspendOtherThreads_t Sys_SuspendOtherThreads = Sys_SuspendOtherThreads_t(0x45A190);
|
||||||
Sys_ListFiles_t Sys_ListFiles = Sys_ListFiles_t(0x45A660);
|
Sys_ListFiles_t Sys_ListFiles = Sys_ListFiles_t(0x45A660);
|
||||||
Sys_Milliseconds_t Sys_Milliseconds = Sys_Milliseconds_t(0x42A660);
|
Sys_Milliseconds_t Sys_Milliseconds = Sys_Milliseconds_t(0x42A660);
|
||||||
|
Sys_LockWrite_t Sys_LockWrite = Sys_LockWrite_t(0x435880);
|
||||||
|
Sys_TempPriorityAtLeastNormalBegin_t Sys_TempPriorityAtLeastNormalBegin = Sys_TempPriorityAtLeastNormalBegin_t(0x478680);
|
||||||
|
Sys_TempPriorityEnd_t Sys_TempPriorityEnd = Sys_TempPriorityEnd_t(0x4DCF00);
|
||||||
|
|
||||||
TeleportPlayer_t TeleportPlayer = TeleportPlayer_t(0x496850);
|
TeleportPlayer_t TeleportPlayer = TeleportPlayer_t(0x496850);
|
||||||
|
|
||||||
@ -493,6 +496,16 @@ namespace Game
|
|||||||
|
|
||||||
GraphFloat* aaInputGraph = reinterpret_cast<GraphFloat*>(0x7A2FC0);
|
GraphFloat* aaInputGraph = reinterpret_cast<GraphFloat*>(0x7A2FC0);
|
||||||
|
|
||||||
|
FastCriticalSection* db_hashCritSect = reinterpret_cast<FastCriticalSection*>(0x16B8A54);
|
||||||
|
|
||||||
|
void Sys_UnlockWrite(FastCriticalSection* critSect)
|
||||||
|
{
|
||||||
|
assert(critSect->writeCount > 0);
|
||||||
|
|
||||||
|
InterlockedDecrement(&critSect->writeCount);
|
||||||
|
Sys_TempPriorityEnd(&critSect->tempPriority);
|
||||||
|
}
|
||||||
|
|
||||||
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize)
|
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize)
|
||||||
{
|
{
|
||||||
int elSize = DB_GetXAssetSizeHandlers[type]();
|
int elSize = DB_GetXAssetSizeHandlers[type]();
|
||||||
@ -609,10 +622,8 @@ namespace Game
|
|||||||
|
|
||||||
void DB_EnumXAssetEntries(XAssetType type, std::function<void(XAssetEntry*)> callback, bool overrides, bool lock)
|
void DB_EnumXAssetEntries(XAssetType type, std::function<void(XAssetEntry*)> callback, bool overrides, bool lock)
|
||||||
{
|
{
|
||||||
volatile long* lockVar = reinterpret_cast<volatile long*>(0x16B8A54);
|
if (lock)
|
||||||
if (lock) InterlockedIncrement(lockVar);
|
Sys_LockWrite(db_hashCritSect);
|
||||||
|
|
||||||
while (lock && *reinterpret_cast<volatile long*>(0x16B8A58)) std::this_thread::sleep_for(1ms);
|
|
||||||
|
|
||||||
const auto pool = Components::Maps::GetAssetEntryPool();
|
const auto pool = Components::Maps::GetAssetEntryPool();
|
||||||
for(auto hash = 0; hash < 37000; hash++)
|
for(auto hash = 0; hash < 37000; hash++)
|
||||||
@ -641,7 +652,8 @@ namespace Game
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(lock) InterlockedDecrement(lockVar);
|
if(lock)
|
||||||
|
Sys_UnlockWrite(db_hashCritSect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this cant be MessageBox because windows.h has a define that converts it to MessageBoxW. which is just stupid
|
// this cant be MessageBox because windows.h has a define that converts it to MessageBoxW. which is just stupid
|
||||||
|
@ -804,6 +804,15 @@ namespace Game
|
|||||||
typedef int(__cdecl * Sys_Milliseconds_t)();
|
typedef int(__cdecl * Sys_Milliseconds_t)();
|
||||||
extern Sys_Milliseconds_t Sys_Milliseconds;
|
extern Sys_Milliseconds_t Sys_Milliseconds;
|
||||||
|
|
||||||
|
typedef void(__cdecl * Sys_LockWrite_t)(FastCriticalSection* critSect);
|
||||||
|
extern Sys_LockWrite_t Sys_LockWrite;
|
||||||
|
|
||||||
|
typedef void(__cdecl * Sys_TempPriorityAtLeastNormalBegin_t)(TempPriority*);
|
||||||
|
extern Sys_TempPriorityAtLeastNormalBegin_t Sys_TempPriorityAtLeastNormalBegin;
|
||||||
|
|
||||||
|
typedef void(__cdecl * Sys_TempPriorityEnd_t)(TempPriority*);
|
||||||
|
extern Sys_TempPriorityEnd_t Sys_TempPriorityEnd;
|
||||||
|
|
||||||
typedef void(__cdecl * TeleportPlayer_t)(gentity_t* entity, float* pos, float* orientation);
|
typedef void(__cdecl * TeleportPlayer_t)(gentity_t* entity, float* pos, float* orientation);
|
||||||
extern TeleportPlayer_t TeleportPlayer;
|
extern TeleportPlayer_t TeleportPlayer;
|
||||||
|
|
||||||
@ -1013,6 +1022,8 @@ namespace Game
|
|||||||
constexpr auto AIM_ASSIST_GRAPH_COUNT = 4u;
|
constexpr auto AIM_ASSIST_GRAPH_COUNT = 4u;
|
||||||
extern GraphFloat* aaInputGraph;
|
extern GraphFloat* aaInputGraph;
|
||||||
|
|
||||||
|
void Sys_UnlockWrite(FastCriticalSection*);
|
||||||
|
|
||||||
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize);
|
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize);
|
||||||
void Menu_FreeItemMemory(Game::itemDef_s* item);
|
void Menu_FreeItemMemory(Game::itemDef_s* item);
|
||||||
void Menu_SetNextCursorItem(Game::UiContext* ctx, Game::menuDef_t* currentMenu, int unk = 1);
|
void Menu_SetNextCursorItem(Game::UiContext* ctx, Game::menuDef_t* currentMenu, int unk = 1);
|
||||||
|
@ -6961,6 +6961,19 @@ namespace Game
|
|||||||
PM_EFF_STANCE_COUNT = 4
|
PM_EFF_STANCE_COUNT = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct TempPriority
|
||||||
|
{
|
||||||
|
void* threadHandle;
|
||||||
|
int oldPriority;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FastCriticalSection
|
||||||
|
{
|
||||||
|
volatile long readCount;
|
||||||
|
volatile long writeCount;
|
||||||
|
TempPriority tempPriority;
|
||||||
|
};
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#ifndef IDA
|
#ifndef IDA
|
||||||
|
Loading…
Reference in New Issue
Block a user