Merge pull request #400 from diamante0018/addimagetolist
fix nullptr check
This commit is contained in:
commit
a4c0d7c582
@ -397,9 +397,7 @@ namespace Components
|
||||
{
|
||||
// execute our hook
|
||||
pushad
|
||||
|
||||
call Script::StoreScriptBaseProgramNum
|
||||
|
||||
popad
|
||||
|
||||
// execute overwritten code caused by the jump hook
|
||||
|
@ -228,6 +228,18 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
void QuickPatch::R_AddImageToList_Hk(Game::XAssetHeader header, void* data)
|
||||
{
|
||||
auto* imageList = static_cast<Game::ImageList*>(data);
|
||||
|
||||
assert(imageList->count < ARRAY_SIZE(imageList->image));
|
||||
|
||||
if (header.image->texture.basemap)
|
||||
{
|
||||
imageList->image[imageList->count++] = header.image;
|
||||
}
|
||||
}
|
||||
|
||||
Game::dvar_t* QuickPatch::Dvar_RegisterConMinicon(const char* dvarName, [[maybe_unused]] bool value, unsigned __int16 flags, const char* description)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
@ -262,6 +274,8 @@ namespace Components
|
||||
|
||||
Utils::Hook(0x4FA448, QuickPatch::Dvar_RegisterConMinicon, HOOK_CALL).install()->quick();
|
||||
|
||||
Utils::Hook::Set<void(*)(Game::XAssetHeader, void*)>(0x51FCDD, R_AddImageToList_Hk);
|
||||
|
||||
// protocol version (workaround for hacks)
|
||||
Utils::Hook::Set<int>(0x4FB501, PROTOCOL);
|
||||
|
||||
@ -349,7 +363,7 @@ namespace Components
|
||||
// spawn upnp thread when UPNP_init returns
|
||||
Utils::Hook::Hook(0x47982B, []()
|
||||
{
|
||||
std::thread([]()
|
||||
std::thread([]
|
||||
{
|
||||
// check natpmpstate
|
||||
// state 4 is no more devices to query
|
||||
|
@ -28,6 +28,8 @@ namespace Components
|
||||
static void CL_KeyEvent_OnEscape();
|
||||
static void CL_KeyEvent_ConsoleEscape_Stub();
|
||||
|
||||
static void R_AddImageToList_Hk(Game::XAssetHeader header, void* data);
|
||||
|
||||
static Game::dvar_t* Dvar_RegisterConMinicon(const char* dvarName, bool value, unsigned __int16 flags, const char* description);
|
||||
};
|
||||
}
|
||||
|
@ -8787,6 +8787,12 @@ namespace Game
|
||||
LOCMSG_NOERR = 0x1,
|
||||
};
|
||||
|
||||
struct ImageList
|
||||
{
|
||||
unsigned int count;
|
||||
GfxImage* image[8192];
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#ifndef IDA
|
||||
|
Loading…
Reference in New Issue
Block a user