//
// GameSettingsLayer::onClose from 0x1402c7e80 to 0x1402c841f (1439 bytes)
//
// 2 xrefs:
// > ??> @ 0x140766238
// > ??> @ 0x14091dc18
//
// This function is hookable on this platform (idp: pc, 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 11:29:22 +0000
//
// Hidden C++ exception states: #wind=10
__int64 __fastcall GameSettingsLayer::onClose(__int64 a1, __int64 a2)
{
__int64 v4; // rbx
cocos2d::CCString *v5; // rax
int v6; // r15d
void *v7; // r8
__int64 v8; // rbx
cocos2d::CCString *v9; // rax
int v10; // edi
void *v11; // r8
__int64 v12; // rcx
char v13; // bl
__int64 v14; // rcx
char v15; // bl
char v16; // al
__int64 v17; // rbx
unsigned int v18; // edi
__int64 v19; // rbx
struct cocos2d::CCString *v20; // rax
void *v21; // rcx
__int64 v22; // rbx
unsigned int v23; // edi
__int64 v24; // rbx
struct cocos2d::CCString *v25; // rax
void *v26; // rcx
__int64 v27; // rax
__int64 v28; // rax
void *v30; // [rsp+30h] [rbp-50h]
void *v31; // [rsp+30h] [rbp-50h]
void *v32; // [rsp+30h] [rbp-50h]
void *v33; // [rsp+30h] [rbp-50h]
void *v34; // [rsp+30h] [rbp-50h]
void *v35; // [rsp+30h] [rbp-50h]
void *v36; // [rsp+30h] [rbp-50h]
void *Block[2]; // [rsp+38h] [rbp-48h] BYREF
__int64 v38; // [rsp+48h] [rbp-38h]
unsigned __int64 v39; // [rsp+50h] [rbp-30h]
void *Src[2]; // [rsp+58h] [rbp-28h] BYREF
__int64 v41; // [rsp+68h] [rbp-18h]
unsigned __int64 v42; // [rsp+70h] [rbp-10h]
v4 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v30 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v30);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v4 = qword_14090BFD0;
}
*(_OWORD *)Block = 0;
v38 = 3;
v39 = 15;
LODWORD(Block[0]) = 6256231;
sub_140044D80(Block, "0049", 4u);
v5 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v4 + 432), Block);
v6 = cocos2d::CCString::intValue(v5);
if ( v39 > 0xF )
{
v7 = Block[0];
if ( v39 + 1 >= 0x1000 )
{
v7 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v7 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v7);
}
v38 = 0;
v39 = 15;
LOBYTE(Block[0]) = 0;
v8 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v31 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v31);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v8 = qword_14090BFD0;
}
*(_OWORD *)Src = 0;
v41 = 3;
v42 = 15;
LODWORD(Src[0]) = 6256231;
sub_140044D80(Src, "0050", 4u);
v9 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v8 + 432), Src);
v10 = cocos2d::CCString::intValue(v9);
if ( v42 > 0xF )
{
v11 = Src[0];
if ( v42 + 1 >= 0x1000 )
{
v11 = *((void **)Src[0] - 1);
if ( (unsigned __int64)((char *)Src[0] - (char *)v11 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v11);
}
v41 = 0;
v42 = 15;
LOBYTE(Src[0]) = 0;
v12 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v32 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v32);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v12 = qword_14090BFD0;
}
v13 = *(_BYTE *)(a1 + 1184);
if ( GameManager::getGameVariable(v12, "0191") != v13 )
goto LABEL_22;
v14 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v33 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v33);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v14 = qword_14090BFD0;
}
v15 = *(_BYTE *)(a1 + 1185);
if ( GameManager::getGameVariable(v14, "0247") == v15 )
v16 = 0;
else
LABEL_22:
v16 = 1;
if ( *(_DWORD *)(a1 + 1156) != v6 || *(_DWORD *)(a1 + 1160) != v10 || v16 )
{
v17 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v34 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v34);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v17 = qword_14090BFD0;
}
v18 = *(_DWORD *)(a1 + 1156);
*(_OWORD *)Src = 0;
v41 = 3;
v42 = 15;
LODWORD(Src[0]) = 6256231;
sub_140044D80(Src, "0049", 4u);
v19 = *(_QWORD *)(v17 + 432);
v20 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, v18);
cocos2d::CCDictionary::setObject(v19, v20, Src);
if ( v42 > 0xF )
{
v21 = Src[0];
if ( v42 + 1 >= 0x1000 )
{
v21 = *((void **)Src[0] - 1);
if ( (unsigned __int64)((char *)Src[0] - (char *)v21 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v21);
}
v41 = 0;
v42 = 15;
LOBYTE(Src[0]) = 0;
v22 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v35 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v35);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v22 = qword_14090BFD0;
}
v23 = *(_DWORD *)(a1 + 1160);
*(_OWORD *)Block = 0;
v38 = 3;
v39 = 15;
LODWORD(Block[0]) = 6256231;
sub_140044D80(Block, "0050", 4u);
v24 = *(_QWORD *)(v22 + 432);
v25 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, v23);
cocos2d::CCDictionary::setObject(v24, v25, Block);
if ( v39 > 0xF )
{
v26 = Block[0];
if ( v39 + 1 >= 0x1000 )
{
v26 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v26 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v26);
}
v38 = 0;
v39 = 15;
LOBYTE(Block[0]) = 0;
v27 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v36 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v27 = qword_14090BFD0;
}
v28 = *(_QWORD *)(v27 + 568);
if ( v28 )
*(_BYTE *)(*(_QWORD *)(v28 + 14904) + 1663LL) = 1;
}
return SetupTriggerPopup::onClose(a1, a2);
}