//
// GameManager::sheetNameForIcon from 0x5fbf04 to 0x5fc2d4 (976 bytes)
//
// 4 xrefs:
// > GameManager::unloadIcon @ 0x5fcaa8
// > GameManager::loadIcon @ 0x5fd250
// > GameManager::loadIconAsync @ 0x5fe5c0
// > ??> @ 0xae8b8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __usercall GameManager::sheetNameForIcon@(
GameManager *this@,
signed int a2@,
int a3@,
__int64 a4@)
{
char *v6; // x20
char *v7; // x0
size_t v9; // x24
size_t v10; // x26
char *v11; // x28
size_t v12; // x24
size_t v13; // x27
unsigned __int64 v14; // x26
char *v15; // x0
size_t v16; // x0
size_t v17; // x26
size_t v18; // x24
size_t v19; // x25
unsigned int *v20; // x20
int v21; // w1
char *v22; // [xsp+70h] [xbp+70h] BYREF
size_t v23; // [xsp+78h] [xbp+78h] BYREF
unsigned __int64 v24; // [xsp+80h] [xbp+80h]
char *v25; // [xsp+88h] [xbp+88h]
_BYTE v26[504]; // [xsp+90h] [xbp+90h] BYREF
v23 = 0;
v24 = 500;
v25 = v26;
v22 = &byte_124B6C8;
switch ( a3 )
{
case 0:
sub_D1798C(&v22, "player_", 7);
goto LABEL_8;
case 1:
sub_D1798C(&v22, (const char *)&dword_E9EBC8, 5);
goto LABEL_8;
case 2:
sub_D1798C(&v22, "player_ball_", 12);
goto LABEL_8;
case 3:
sub_D1798C(&v22, (const char *)&dword_E9EBD8, 5);
goto LABEL_8;
case 4:
sub_D1798C(&v22, (const char *)&dword_E9EBE0, 5);
goto LABEL_8;
case 5:
sub_D1798C(&v22, (const char *)&dword_E9EBE8, 6);
goto LABEL_8;
case 6:
sub_D1798C(&v22, (const char *)&dword_E9EBF0, 7);
goto LABEL_8;
case 7:
sub_D1798C(&v22, (const char *)&dword_E9EC10, 6);
goto LABEL_8;
case 8:
sub_D1798C(&v22, "jetpack_", 8);
LABEL_8:
if ( !*((_QWORD *)v22 - 3) )
goto LABEL_2;
v9 = v23;
v10 = v23 + 6;
if ( v23 + 6 > v24 )
fmt::internal::Array::grow(&v23, v23 + 6);
v23 = v10;
qmemcpy(&v25[v9], "icons/", 6);
v11 = v22;
v12 = *((_QWORD *)v22 - 3);
if ( v12 )
{
v13 = v23;
v14 = v23 + v12;
if ( v24 >= v23 + v12 )
{
v23 += v12;
v15 = &v25[v13];
goto LABEL_37;
}
}
else
{
v16 = strlen(v22);
v13 = v23;
v12 = v16;
v14 = v16 + v23;
if ( v16 + v23 <= v24 )
goto LABEL_23;
}
fmt::internal::Array::grow(&v23, v14);
LABEL_23:
v23 = v14;
if ( !v12 )
goto LABEL_24;
v15 = &v25[v13];
LABEL_37:
memmove(v15, v11, v12);
LABEL_24:
if ( a2 <= 9 )
{
v17 = v23;
v18 = v23 + 1;
if ( v23 + 1 > v24 )
fmt::internal::Array::grow(&v23, v23 + 1);
v23 = v18;
v25[v17] = aAssertionFaile_0[72];
}
fmt::BasicWriter::FormatInt,char>>(&v23, a2);
v19 = v23;
if ( v23 + 1 > v24 )
fmt::internal::Array::grow(&v23, v23 + 1);
v25[v19] = 0;
sub_D153B8(a4, v25);
v6 = v22;
v7 = v22 - 24;
if ( v22 - 24 != (char *)&qword_124B6B0 )
{
LABEL_31:
if ( &pthread_create )
{
v20 = (unsigned int *)(v6 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v6 - 2);
*((_DWORD *)v6 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v7);
}
LABEL_3:
if ( v25 != v26 && v25 )
operator delete[](v25);
return a4;
default:
LABEL_2:
sub_D153B8(a4, &byte_F288A0);
v6 = v22;
v7 = v22 - 24;
if ( v22 - 24 == (char *)&qword_124B6B0 )
goto LABEL_3;
goto LABEL_31;
}
}