//
// LevelSettingsObject::setIDName from 0x46f7d4 to 0x46f8a8 (212 bytes)
//
// 2 xrefs:
// > IDNameBrowserPopup::onDeleteRow @ 0x7933de
// > IDNameBrowserPopup::onFormAdd @ 0x79357a
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:49:03 +0000
//
int __fastcall LevelSettingsObject::setIDName(unsigned int a1, int a2, unsigned __int8 *a3, int a4)
{
int v5; // r3
unsigned int v6; // r6
unsigned int v7; // r10
unsigned int v8; // r9
_DWORD *v9; // r2
_DWORD *i; // r4
unsigned int v11; // r0
int v12; // r1
_DWORD *v14; // r0
unsigned __int8 *v15; // r0
int v16; // [sp+8h] [bp-1Ch] BYREF
int v17; // [sp+Ch] [bp-18h] BYREF
int v18[3]; // [sp+10h] [bp-14h] BYREF
v16 = a4;
v17 = a2;
LevelSettingsObject::sanitizeIDName(v18, a3, (char *)a3, _stack_chk_guard);
if ( (v18[0] & 1) != 0 )
v5 = v18[1];
else
v5 = (int)LOBYTE(v18[0]) >> 1;
if ( v5 )
{
v14 = std::unordered_map>::operator[](a1 + 412, (unsigned int *)&v16);
v15 = (unsigned __int8 *)std::unordered_map::operator[]((int)v14, (unsigned int *)&v17);
std::string::operator=(v15, (unsigned __int8 *)v18);
}
else
{
v6 = *(_DWORD *)(a1 + 416);
if ( v6 )
{
v7 = v6 - 1;
v8 = ((v6 - 1) & v6) != 0 ? v16 % v6 : v7 & v16;
v9 = *(_DWORD **)(*(_DWORD *)(a1 + 412) + 4 * v8);
if ( v9 )
{
for ( i = (_DWORD *)*v9; i; i = (_DWORD *)*i )
{
v11 = i[1];
v12 = ((v6 - 1) & v6) != 0 ? v11 % v6 : v7 & v11;
if ( v12 != v8 )
break;
if ( i[2] == v16 )
{
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::__erase_unique(
i + 3,
(unsigned int *)&v17);
break;
}
}
}
}
LevelSettingsObject::removeFromIDUseOrder(a1, v17, v16);
}
return std::string::~string((int)v18);
}