//
// IDNameBrowserPopup::onFormAdd from 0x793458 to 0x79360e (438 bytes)
//
// 0 xrefs:
//
// 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:59:43 +0000
//
GameManager *__fastcall IDNameBrowserPopup::onFormAdd(IDNameBrowserPopup *this, cocos2d::CCObject *a2)
{
GameManager *result; // r0
int v4; // r1
const char *v5; // r2
int v6; // r3
int FormID; // r8
char *v8; // r2
int v9; // r3
int *v10; // r0
int v11; // r3
int v12; // r0
unsigned __int8 *v13; // r2
int v14; // r3
unsigned __int8 *v15; // r3
unsigned __int8 *v16; // r1
unsigned __int8 *v17; // r4
int v18; // lr
const char *v19; // r1
LevelSettingsObject *v20; // r9
int IDByName; // r0
int v22; // r9
int v23; // [sp+0h] [bp-6Ch] BYREF
int v24; // [sp+4h] [bp-68h]
char *v25; // [sp+8h] [bp-64h]
int v26[3]; // [sp+Ch] [bp-60h] BYREF
int v27[3]; // [sp+18h] [bp-54h] BYREF
_BYTE v28[64]; // [sp+24h] [bp-48h] BYREF
result = (GameManager *)GameManager::sharedState(this);
if ( *((_DWORD *)result + 102) )
{
result = (GameManager *)GameManager::sharedState(result);
v6 = *(_DWORD *)(*((_DWORD *)result + 102) + 2084);
if ( v6 )
{
FormID = IDNameBrowserPopup::getFormID(this, v4, v5, v6);
if ( FormID > 0 )
{
if ( *((_DWORD *)this + 138) )
{
CCTextInputNode::getString((CCTextInputNode *)&v23, *((_DWORD *)this + 138));
}
else
{
v23 = 0;
v24 = 0;
v25 = nullptr;
std::string::__init(&v23, &unk_B6B226, 0);
}
v10 = LevelSettingsObject::sanitizeIDName(v26, (unsigned __int8 *)&v23, v8, v9);
if ( (v26[0] & 1) != 0 )
v11 = v26[1];
else
v11 = (int)LOBYTE(v26[0]) >> 1;
if ( v11 )
{
v20 = *(LevelSettingsObject **)(*(_DWORD *)(GameManager::sharedState((GameManager *)v10) + 408) + 2084);
IDByName = LevelSettingsObject::findIDByName(v20, (int)v26, *((_DWORD *)this + 132));
if ( IDByName <= 0 || IDByName == FormID )
{
LevelSettingsObject::setIDName((unsigned int)v20, FormID, (unsigned __int8 *)v26, *((_DWORD *)this + 132));
LevelSettingsObject::touchIDUsage((char *)v20, FormID, *((_DWORD *)this + 132));
v22 = *((_DWORD *)this + 138);
if ( v22 )
{
memset(v27, 0, sizeof(v27));
std::string::__init(v27, &unk_B6B226, 0);
CCTextInputNode::setString(v22, (int)v27);
std::string::~string((int)v27);
}
IDNameBrowserPopup::setFormID((int)this, 0);
IDNameBrowserPopup::rebuildList(this);
IDNameBrowserPopup::updateConflictLabel(this);
}
else
{
sub_993B88(v28, 64, "Name used by ID %d", IDByName);
(*(void (__fastcall **)(_DWORD, _BYTE *))(**((_DWORD **)this + 139) + 464))(*((_DWORD *)this + 139), v28);
}
}
else
{
v12 = *((_DWORD *)this + 139);
if ( (v23 & 1) != 0 )
{
v13 = (unsigned __int8 *)v25;
v14 = v24;
}
else
{
v14 = (int)(unsigned __int8)v23 >> 1;
v13 = (unsigned __int8 *)&v23 + 1;
}
if ( v14 )
{
v15 = &v13[v14];
v16 = v13;
do
{
v17 = v16;
if ( v16 == v15 )
{
v19 = "Enter a name";
goto LABEL_23;
}
v18 = *v16++;
}
while ( v18 == 32 );
if ( v17 - v13 == -1 )
v19 = "Enter a name";
else
v19 = "Name needs a letter";
}
else
{
v19 = "Enter a name";
}
LABEL_23:
(*(void (__fastcall **)(int, const char *))(*(_DWORD *)v12 + 464))(v12, v19);
}
std::string::~string((int)v26);
return (GameManager *)std::string::~string((int)&v23);
}
else
{
return (GameManager *)(*(int (__fastcall **)(_DWORD, const char *))(**((_DWORD **)this + 139) + 464))(
*((_DWORD *)this + 139),
"Enter a valid ID");
}
}
}
return result;
}