//
// MoreOptionsLayer::layerForPage from 0x10079dce0 to 0x10079dea6 (454 bytes)
//
// 1 xrefs:
// > MoreOptionsLayer::addToggle @ 0x10079cc9b
//
// 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
//
cocos2d::CCLayer *__fastcall MoreOptionsLayer::layerForPage(MoreOptionsLayer *a1, int a2)
{
double v2; // xmm0_8
cocos2d::CCDictionary *m_variables; // r15
cocos2d::CCString *v4; // rax
const char *CString; // r13
size_t v6; // rax
size_t v7; // r12
char *v8; // r14
size_t v9; // rbx
cocos2d::CCLayer *v10; // rbx
cocos2d::CCDictionary *v11; // r15
cocos2d::CCString *v12; // rax
const char *v13; // r12
size_t v14; // rax
size_t v15; // r14
char *v16; // r13
size_t v17; // r15
char v19; // [rsp+0h] [rbp-50h]
char v20; // [rsp+0h] [rbp-50h]
cocos2d::CCDictionary *v21; // [rsp+8h] [rbp-48h]
size_t __dst; // [rsp+10h] [rbp-40h] BYREF
size_t v23; // [rsp+18h] [rbp-38h]
void *__p; // [rsp+20h] [rbp-30h]
m_variables = a1->m_variables;
v4 = (cocos2d::CCString *)sub_1007AB580("layer_%i", v19);
CString = cocos2d::CCString::getCString(v4);
v6 = strlen(CString);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_23;
v7 = v6;
if ( v6 >= 0x17 )
{
v9 = 26;
if ( (v6 | 7) != 0x17 )
v9 = (v6 | 7) + 1;
v8 = (char *)operator new(v9);
__p = v8;
__dst = v9 + 1;
v23 = v7;
goto LABEL_8;
}
LOBYTE(__dst) = 2 * v6;
v8 = (char *)&__dst + 1;
if ( v6 )
LABEL_8:
memmove(v8, CString, v7);
v8[v7] = 0;
v10 = (cocos2d::CCLayer *)cocos2d::CCDictionary::objectForKey_1((__int64)m_variables, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( !v10 )
{
v10 = cocos2d::CCLayer::create();
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLayer *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v10);
v11 = a1->m_variables;
v12 = (cocos2d::CCString *)sub_1007AB580("layer_%i", v20);
v13 = cocos2d::CCString::getCString(v12);
v14 = strlen(v13);
if ( v14 < 0xFFFFFFFFFFFFFFF8LL )
{
v15 = v14;
if ( v14 >= 0x17 )
{
v21 = v11;
v17 = 26;
if ( (v14 | 7) != 0x17 )
v17 = (v14 | 7) + 1;
v16 = (char *)operator new(v17);
__p = v16;
__dst = v17 + 1;
v11 = v21;
v23 = v15;
}
else
{
LOBYTE(__dst) = 2 * v14;
v16 = (char *)&__dst + 1;
if ( !v14 )
{
LABEL_20:
v16[v15] = 0;
cocos2d::CCDictionary::setObject_1((__int64)v11, v10, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
return v10;
}
}
memmove(v16, v13, v15);
goto LABEL_20;
}
LABEL_23:
sub_100006BF0(v2);
}
return v10;
}