Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions decompile/General/DecalGlobal/DecalGlobal_3_FindInLEV.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <common.h>

struct IconGroup* DECOMP_DecalGlobal_FindInLEV(struct Level* level, char* str)
{
struct LevTexLookup* levTexLookup = level->levTexLookup;

if (levTexLookup == NULL)
{
return NULL;
}

for (int i = 0; i < levTexLookup->numIconGroup; i++)
{
struct IconGroup* iconGroupPtr = levTexLookup->firstIconGroupPtr[i];
if (((*(int*)(iconGroupPtr->name + 0)) == (*(int*)(str + 0))) &&
Copy link
Contributor Author

@TheUbMunster TheUbMunster Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"efficient string comparison", the same way ND did it. do we have memcmp? (strcmp wouldn't behave the same because memcmp will check beyond the nullterm (like original impl), but strcmp won't).

((*(int*)(iconGroupPtr->name + 4)) == (*(int*)(str + 4))) &&
((*(int*)(iconGroupPtr->name + 8)) == (*(int*)(str + 8))) &&
((*(int*)(iconGroupPtr->name + 12)) == (*(int*)(str + 12))))
{
return iconGroupPtr;
}
}
}
2 changes: 1 addition & 1 deletion decompile/buildList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ common, exe, DecalFont_DrawMultiLine, 0x0, General/DecalFont/DecalFo
//common, exe, DecalGlobal_EmptyFunc_MainFrame_ResetDB General/DecalGlobal/DecalGlobal_0_EmptyFunc_MainFrame_ResetDB.c //TODO
common, exe, DecalGlobal_Clear, 0x0, General/DecalGlobal/DecalGlobal_1_Clear.c
common, exe, DecalGlobal_Store, 0x0, General/DecalGlobal/DecalGlobal_2_Store.c
//common, exe, DecalGlobal_FindInLEV, 0x0, General/DecalGlobal/DecalGlobal_3_FindInLEV.c //TODO
common, exe, DecalGlobal_FindInLEV, 0x0, General/DecalGlobal/DecalGlobal_3_FindInLEV.c
//common, exe, DecalGlobal_FindInMPK, 0x0, General/DecalGlobal/DecalGlobal_4_FindInMPK.c //TODO

// ====================================================================================================================
Expand Down