//
// GJOptionsLayer::layerForPage from 0xa233a4 to 0xa23550 (428 bytes)
//
// 3 xrefs:
// > GJOptionsLayer::addToggleInternal @ 0xa34e94
// > GameOptionsLayer::setupOptions @ 0xa3621c
// > ??> @ 0xb35c0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 12:59:41 +0000
//
cocos2d::CCObject *__fastcall GJOptionsLayer::layerForPage(GJOptionsLayer *this, const char *a2)
{
unsigned int v2; // w25
__int64 v4; // x24
const char *v5; // x26
size_t v6; // x0
size_t v7; // x19
unsigned __int64 v8; // x0
char *v9; // x3
cocos2d::CCObject *v10; // x19
cocos2d::CCLayer *v11; // x0
__int64 v13; // x22
const char *v14; // x0
size_t v15; // x0
char *v16; // [xsp+58h] [xbp+58h]
unsigned __int64 v17; // [xsp+60h] [xbp+60h] BYREF
size_t v18; // [xsp+68h] [xbp+68h]
void *v19; // [xsp+70h] [xbp+70h]
v2 = (unsigned int)a2;
v4 = *((_QWORD *)this + 130);
v17 = 0;
v5 = (const char *)GJOptionsLayer::layerKey(this, a2);
v18 = 0;
v19 = nullptr;
v6 = strlen(v5);
v7 = v6;
if ( v6 > 0xFFFFFFFFFFFFFFEFLL )
sub_62D99C();
if ( v6 > 0x16 )
{
v8 = (v6 + 16) & 0xFFFFFFFFFFFFFFF0LL;
v17 = v8 | 1;
v9 = (char *)operator new(v8);
v19 = v9;
v18 = v7;
LABEL_4:
v9 = (char *)memcpy(v9, v5, v7);
goto LABEL_5;
}
LOBYTE(v17) = 2 * v6;
v9 = (char *)&v17 + 1;
if ( v6 )
goto LABEL_4;
LABEL_5:
v9[v7] = 0;
v10 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(v4, &v17);
v11 = (cocos2d::CCLayer *)(unsigned __int8)v17;
if ( (v17 & 1) != 0 )
{
operator delete(v19);
if ( v10 )
return v10;
}
else if ( v10 )
{
return v10;
}
v10 = (cocos2d::CCObject *)cocos2d::CCLayer::create(v11);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**((_QWORD **)this + 73) + 456LL))(*((_QWORD *)this + 73), v10);
v13 = *((_QWORD *)this + 130);
v14 = (const char *)GJOptionsLayer::layerKey(this, (const char *)v2);
v17 = 0;
v16 = (char *)v14;
v18 = 0;
v19 = nullptr;
v15 = strlen(v14);
std::string::__init((__int64 *)&v17, v16, v15);
cocos2d::CCDictionary::setObject(v13, v10);
if ( (v17 & 1) != 0 )
operator delete(v19);
return v10;
}