//
// GameOptionsLayer::setupOptions from 0x14029ef40 to 0x14029fa08 (2760 bytes)
//
// 2 xrefs:
// > ??> @ 0x140578fe0
// > ??> @ 0x1406d1f28
//
// 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
//
// Hidden C++ exception states: #wind=19
void GameOptionsLayer::setupOptions(GameOptionsLayer *a1)
{
cocos2d::CCDirector *v2; // rax
GameManager *v3; // rcx
bool GameVariable; // al
GameManager *v5; // rcx
bool v6; // al
__int64 v7; // r9
GameManager *v8; // rcx
bool v9; // al
GameManager *v10; // rcx
bool v11; // al
GameManager *v12; // rcx
bool v13; // al
GameManager *v14; // rcx
bool v15; // al
GameManager *v16; // rcx
bool v17; // al
GameManager *v18; // rcx
bool v19; // al
GameManager *v20; // rcx
bool v21; // al
__int64 v22; // rcx
cocos2d::CCArray *v23; // r14
__int64 v24; // rcx
__int64 v25; // rbx
__int64 v26; // rcx
bool v27; // di
cocos2d::CCString *v28; // rax
float *v29; // rax
float *v30; // rbx
struct cocos2d::CCPoint v31; // rax
GameStatsManager *v32; // rcx
CCMenuItemToggler *ToggleButton; // rbx
struct cocos2d::CCObject *v34; // rdi
CCMenuItemSpriteExtra *m_offButton; // rcx
__int64 v36; // rax
__int64 v37; // rax
__int64 v38; // rax
__int64 v39; // rax
cocos2d::CCLayer *v40; // r15
GameManager *v41; // r14
float *v42; // rax
float *v43; // rbx
struct cocos2d::CCPoint v44; // rax
struct cocos2d::CCPoint v45; // rdi
bool v46; // al
CCMenuItemToggler *v47; // rbx
cocos2d::CCArray *v48; // rax
ButtonSprite *v49; // rbx
CCMenuItemSpriteExtra *v50; // rbx
float v51; // xmm0_4
ButtonSprite *v52; // rbx
CCMenuItemSpriteExtra *v53; // rbx
float v54; // xmm0_4
__int128 *v55; // [rsp+88h] [rbp-80h] BYREF
__int16 v56; // [rsp+90h] [rbp-78h] BYREF
char v57; // [rsp+92h] [rbp-76h]
__int16 v58; // [rsp+94h] [rbp-74h]
__int128 v59; // [rsp+98h] [rbp-70h] BYREF
__int64 v60; // [rsp+A8h] [rbp-60h]
__int64 v61; // [rsp+B0h] [rbp-58h]
cocos2d::CCPoint v62; // [rsp+B8h] [rbp-50h] BYREF
float v63; // [rsp+C0h] [rbp-48h]
struct cocos2d::CCPoint v64; // [rsp+C8h] [rbp-40h] BYREF
void *v65; // [rsp+D0h] [rbp-38h]
__int128 *v66; // [rsp+D8h] [rbp-30h] BYREF
cocos2d::CCPoint v67; // [rsp+E0h] [rbp-28h] BYREF
void *v68; // [rsp+E8h] [rbp-20h]
_QWORD v69[4]; // [rsp+F0h] [rbp-18h] BYREF
v2 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v2);
a1->m_offset = 32.0;
a1->m_gap = 37.0;
a1->m_togglesPerPage = 12;
v3 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v55 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v3 = (GameManager *)qword_1406C2ED8;
}
GameVariable = GameManager::getGameVariable(v3, "0026");
GJOptionsLayer::addToggleInternal(a1, "Auto-Retry", 1, GameVariable, byte_140518980);
v5 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v55 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v5 = (GameManager *)qword_1406C2ED8;
}
v6 = GameManager::getGameVariable(v5, "0027");
GJOptionsLayer::addToggleInternal(a1, "Auto-Checkpoints", 2, v6, byte_140518980);
v7 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v55 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v7 = qword_1406C2ED8;
}
GJOptionsLayer::addToggleInternal(a1, "Show Progress Bar", 3, *(_BYTE *)(v7 + 916), byte_140518980);
v8 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v55 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v8 = (GameManager *)qword_1406C2ED8;
}
v9 = GameManager::getGameVariable(v8, "0040");
GJOptionsLayer::addToggleInternal(a1, "Show Percentage", 4, v9, byte_140518980);
v10 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v55 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v10 = (GameManager *)qword_1406C2ED8;
}
v11 = GameManager::getGameVariable(v10, "0145");
GJOptionsLayer::addToggleInternal(a1, "Show Time", 7, v11, byte_140518980);
v12 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v55 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v12 = (GameManager *)qword_1406C2ED8;
}
v13 = GameManager::getGameVariable(v12, "0144");
GJOptionsLayer::addToggleInternal(a1, "Audio Visualizer", 5, v13, byte_140518980);
v14 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v55 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v14 = (GameManager *)qword_1406C2ED8;
}
v15 = GameManager::getGameVariable(v14, "0109");
GJOptionsLayer::addToggleInternal(a1, "Show Info Label", 6, v15, byte_140518980);
v16 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v55 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v16 = (GameManager *)qword_1406C2ED8;
}
v17 = GameManager::getGameVariable(v16, "0146");
GJOptionsLayer::addToggleInternal(a1, "Disable Checkpoints", 8, v17, byte_140518980);
v18 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v55 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v18 = (GameManager *)qword_1406C2ED8;
}
v19 = GameManager::getGameVariable(v18, "0166");
GJOptionsLayer::addToggleInternal(
a1,
(const char *)&qword_140551EB8,
9,
v19,
"Shows hitboxes while in practice mode.");
v20 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v55 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v20 = (GameManager *)qword_1406C2ED8;
}
v21 = GameManager::getGameVariable(v20, "0179");
GJOptionsLayer::addToggleInternal(
a1,
"Hitbox On Death",
11,
v21,
"Shows hitboxes upon death in both normal and practice mode.");
v23 = (cocos2d::CCArray *)cocos2d::CCArray::create(v22);
sub_140290310(a1, &v67, 0);
v55 = &v59;
v59 = 0;
v60 = 0;
v61 = 15;
*(_QWORD *)&v59 = sub_14003AA10(0x20u);
v60 = 19;
v61 = 31;
strcpy((char *)v59, "Practice Music Sync");
v24 = 99;
v25 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v65 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v65);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v25 = qword_1406C2EE8;
}
if ( GameStatsManager::isItemUnlocked((GameStatsManager *)v24, GJItem, 17) )
{
GameStatsManager::getItemKey(v26, v69, 0x11u, 0xCu);
v28 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v25 + 888), v69);
v27 = cocos2d::CCString::boolValue(v28);
sub_14003A830((__int64)v69);
}
else
{
v27 = 0;
}
cocos2d::CCPoint::CCPoint(4.1587545e21, 8.0);
v30 = v29;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v66);
ToggleButton = GameToolbox::createToggleButton(
(const char *)&v59,
(cocos2d::SEL_MenuHandler *)GameOptionsLayer::onPracticeMusicSync,
v27,
a1->m_buttonMenu,
v31,
a1,
a1->m_mainLayer,
0.80000001,
a1->m_maxLabelScale,
a1->m_maxLabelWidth,
v30,
(const char *)&qword_14052A4D8,
0,
0,
v23);
if ( !qword_1406C2EE8 )
{
v65 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v65);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
}
if ( !GameStatsManager::isItemUnlocked(v32, GJItem, 17) )
{
v34 = cocos2d::CCArray::objectAtIndex(v23, 1u);
BYTE1(ToggleButton->m_onButton) = 1;
v58 = -26986;
v56 = -26986;
v57 = -106;
if ( LOBYTE(ToggleButton->m_onButton) )
m_offButton = ToggleButton->m_offButton;
else
m_offButton = *(CCMenuItemSpriteExtra **)&ToggleButton->m_nScriptTapHandler;
v36 = (__int64)m_offButton->getNormalImage(m_offButton);
(**(void (__fastcall ***)(__int64, __int16 *))(v36 + 320))(v36 + 320, &v56);
(**(void (__fastcall ***)(__int64, __int16 *))&v34[6].m_uIndexInArray)((__int64)&v34[6].m_uIndexInArray, &v56);
}
v37 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v66 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v66);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v37 = qword_1406C2ED8;
}
v38 = *(_QWORD *)(v37 + 520);
if ( v38 )
{
v39 = *(_QWORD *)(v38 + 2168);
if ( v39 )
{
if ( *(_DWORD *)(v39 + 1108) == 2 )
{
++a1->m_toggleCount;
GJOptionsLayer::incrementCountForPage(a1, 0);
v40 = GJOptionsLayer::layerForPage(a1, 0);
sub_140290310(a1, (cocos2d::CCPoint *)&v55, 0);
v66 = &v59;
v60 = 13;
v61 = 15;
strcpy((char *)&v59, "Ignore Damage");
HIWORD(v59) = 0;
v41 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v68 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v68);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v41 = (GameManager *)qword_1406C2ED8;
}
cocos2d::CCPoint::CCPoint(7.3782296e28, 8.0);
v43 = v42;
cocos2d::CCPoint::CCPoint(&v62);
v45 = v44;
v46 = GameManager::getGameVariable(v41, "0173");
v47 = GameToolbox::createToggleButton(
(const char *)&v59,
(cocos2d::SEL_MenuHandler *)GJOptionsLayer::onToggle,
v46,
a1->m_buttonMenu,
v45,
a1,
v40,
0.80000001,
0.5,
a1->m_maxLabelWidth,
v43,
"goldFont.fnt",
0,
0,
nullptr);
v47->setTag(v47, 10);
*(_DWORD *)(*(_QWORD *)&v47->m_nScriptTapHandler + 372LL) = 1065353216;
HIDWORD(v47->m_offButton->m_pfnSelector.adj) = 1065353216;
CCMenuItemToggler::toggle(v47, (bool)v47->m_onButton);
v48 = GJOptionsLayer::objectsForPage(a1, 0);
cocos2d::CCArray::addObject(v48, v47);
v47->setVisible(v47, 0);
v40->setVisible(v40, 0);
}
}
}
cocos2d::CCPoint::CCPoint(a1->m_height * 0.5, v63 * 0.5);
cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v64);
v49 = ButtonSprite::create_1("Platformer UI", 0, 0, 1.0, 0, "goldFont.fnt", "GJ_button_01.png", 0.0);
((void (__fastcall *)(ButtonSprite *))v49->setScale_0)(v49);
v50 = CCMenuItemSpriteExtra::create(v49, nullptr, a1, (cocos2d::SEL_MenuHandler *)GameOptionsLayer::onUIOptions);
v51 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild_1)(
a1->m_buttonMenu,
v50);
cocos2d::CCPoint::CCPoint(v51, -80.0);
cocos2d::CCPoint::operator+(&v64, &v55);
v50->setPosition_0(v50, (const cocos2d::CCPoint *)&v55);
v52 = ButtonSprite::create_1("Practice UI", 0, 0, 1.0, 0, "goldFont.fnt", "GJ_button_01.png", 0.0);
((void (__fastcall *)(ButtonSprite *))v52->setScale_0)(v52);
v53 = CCMenuItemSpriteExtra::create(v52, nullptr, a1, (cocos2d::SEL_MenuHandler *)GameOptionsLayer::onUIPOptions);
v54 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild_1)(
a1->m_buttonMenu,
v53);
cocos2d::CCPoint::CCPoint(v54, 80.0);
cocos2d::CCPoint::operator+(&v64, &v55);
v53->setPosition_0(v53, (const cocos2d::CCPoint *)&v55);
}