//
// GameOptionsLayer::setupOptions from 0x1002e1644 to 0x1002e1c84 (1600 bytes)
//
// 1 xrefs:
// > ??> @ 0x1007e2b80
//
// 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
//
void __fastcall GameOptionsLayer::setupOptions(GameOptionsLayer *a1)
{
cocos2d::CCDirector *v2; // x0
GameManager *v3; // x0
bool GameVariable; // w0
GameManager *v5; // x0
bool v6; // w0
GameManager *v7; // x0
GameManager *v8; // x0
bool v9; // w0
GameManager *v10; // x0
bool v11; // w0
GameManager *v12; // x0
bool v13; // w0
GameManager *v14; // x0
bool v15; // w0
GameManager *v16; // x0
bool v17; // w0
GameManager *v18; // x0
bool v19; // w0
GameManager *v20; // x0
bool v21; // w0
cocos2d::CCObject *v22; // x20
GameStatsManager *v23; // x0
bool isItemEnabled; // w21
cocos2d::CCMenu *m_buttonMenu; // x22
cocos2d::CCLayer *m_mainLayer; // x23
float m_maxLabelScale; // s9
float m_maxLabelWidth; // s10
__n128 v29; // q0
__n128 v30; // q1
CCMenuItemToggler *v31; // x21
GameStatsManager *v32; // x0
__int64 v33; // x20
CCMenuItemSpriteExtra *v34; // x0
__int64 v35; // x0
__n128 v36; // q0
__n128 v37; // q1
cocos2d::CCLayer *v38; // x20
GameManager *v39; // x0
bool v40; // w21
cocos2d::CCMenu *v41; // x22
float v42; // s9
__n128 v43; // q0
__n128 v44; // q1
CCMenuItemToggler *v45; // x21
cocos2d::CCArray *v46; // x0
cocos2d::CCMenu *v47; // x20
ButtonSprite *v48; // x20
CCMenuItemSpriteExtra *v49; // x20
__n128 v50; // q0
__n128 v51; // q1
double v52; // d0
ButtonSprite *v53; // x20
CCMenuItemSpriteExtra *v54; // x20
__n128 v55; // q0
__n128 v56; // q1
double v57; // d0
float32x2_t v58; // [xsp+28h] [xbp-A8h] BYREF
void *v59[2]; // [xsp+30h] [xbp-A0h] BYREF
char v60; // [xsp+47h] [xbp-89h]
cocos2d::CCPoint v61; // [xsp+48h] [xbp-88h] BYREF
cocos2d::CCPoint v62; // [xsp+50h] [xbp-80h] BYREF
void *__p[2]; // [xsp+58h] [xbp-78h] BYREF
char v64; // [xsp+6Fh] [xbp-61h]
__int64 v65; // [xsp+70h] [xbp-60h] BYREF
float v66; // [xsp+78h] [xbp-58h]
float v67; // [xsp+7Ch] [xbp-54h]
cocos2d::SEL_MenuHandler v68; // 0:x3.16
cocos2d::SEL_MenuHandler v69; // 0:x3.16
v2 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v2);
a1->m_offset = 32.0;
a1->m_gap = 37.0;
a1->m_togglesPerPage = 12;
v3 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v3, "0026");
GJOptionsLayer::addToggleInternal(a1, "Auto-Retry", 1, GameVariable, "");
v5 = GameManager::sharedState();
v6 = GameManager::getGameVariable(v5, "0027");
GJOptionsLayer::addToggleInternal(a1, "Auto-Checkpoints", 2, v6, "");
v7 = GameManager::sharedState();
GJOptionsLayer::addToggleInternal(a1, "Show Progress Bar", 3, v7->m_showProgressBar, "");
v8 = GameManager::sharedState();
v9 = GameManager::getGameVariable(v8, "0040");
GJOptionsLayer::addToggleInternal(a1, "Show Percentage", 4, v9, "");
v10 = GameManager::sharedState();
v11 = GameManager::getGameVariable(v10, "0145");
GJOptionsLayer::addToggleInternal(a1, "Show Time", 7, v11, "");
v12 = GameManager::sharedState();
v13 = GameManager::getGameVariable(v12, "0144");
GJOptionsLayer::addToggleInternal(a1, "Audio Visualizer", 5, v13, "");
v14 = GameManager::sharedState();
v15 = GameManager::getGameVariable(v14, "0109");
GJOptionsLayer::addToggleInternal(a1, "Show Info Label", 6, v15, "");
v16 = GameManager::sharedState();
v17 = GameManager::getGameVariable(v16, "0146");
GJOptionsLayer::addToggleInternal(a1, "Disable Checkpoints", 8, v17, "");
v18 = GameManager::sharedState();
v19 = GameManager::getGameVariable(v18, "0166");
GJOptionsLayer::addToggleInternal(a1, "Show Hitboxes", 9, v19, "Shows hitboxes while in practice mode.");
v20 = GameManager::sharedState();
v21 = GameManager::getGameVariable(v20, "0179");
GJOptionsLayer::addToggleInternal(
a1,
"Hitbox On Death",
11,
v21,
"Shows hitboxes upon death in both normal and practice mode.");
v22 = sub_10024A15C();
GJOptionsLayer::nextPosition(a1, 0);
sub_100009900(__p, "Practice Music Sync");
v23 = GameStatsManager::sharedState();
isItemEnabled = GameStatsManager::isItemEnabled(v23, GJItem, 17);
m_buttonMenu = a1->m_buttonMenu;
sub_1000229B8((__int64 *)&v62, &v65);
m_mainLayer = a1->m_mainLayer;
m_maxLabelScale = a1->m_maxLabelScale;
m_maxLabelWidth = a1->m_maxLabelWidth;
v29.n128_u32[0] = 8.0;
v30.n128_u32[0] = 0;
sub_100022980(v29, v30, &v61);
v31 = GameToolbox::createToggleButton(
(const char *)__p,
(void (__cdecl *)(cocos2d::CCObject *))GameOptionsLayer::onPracticeMusicSync,
0,
isItemEnabled,
m_buttonMenu,
&v62,
a1,
m_mainLayer,
0.8,
m_maxLabelScale,
m_maxLabelWidth,
(float *)&v61,
"bigFont.fnt",
0,
0,
(__int64)v22);
if ( v64 < 0 )
operator delete(__p[0]);
v32 = GameStatsManager::sharedState();
if ( !GameStatsManager::isItemUnlocked(v32, GJItem, 17) )
{
v33 = sub_10024A388((__int64)v22, 1u);
v31->m_notClickable = 1;
BYTE2(v62.x) = -106;
LOWORD(v62.x) = -26986;
v34 = CCMenuItemToggler::activeItem(v31);
v35 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v34->getNormalImage)(v34);
(*(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v35 + 944LL))(v35, &v62);
(*(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v33 + 1056LL))(v33, &v62);
}
if ( GameManager::sharedState()->m_playLayer
&& GameManager::sharedState()->m_playLayer->m_level
&& GameManager::sharedState()->m_playLayer->m_level->m_levelType == Editor )
{
++a1->m_toggleCount;
GJOptionsLayer::incrementCountForPage(a1, 0);
v38 = GJOptionsLayer::layerForPage(a1, 0);
GJOptionsLayer::nextPosition(a1, 0);
sub_100009900(v59, "Ignore Damage");
v39 = GameManager::sharedState();
v40 = GameManager::getGameVariable(v39, "0173");
v41 = a1->m_buttonMenu;
sub_1000229B8((__int64 *)&v61, (__int64 *)&v62);
v42 = a1->m_maxLabelWidth;
v43.n128_u32[0] = 8.0;
v44.n128_u32[0] = 0;
sub_100022980(v43, v44, &v58);
v45 = GameToolbox::createToggleButton(
(const char *)v59,
(void (__cdecl *)(cocos2d::CCObject *))GJOptionsLayer::onToggle,
0,
v40,
v41,
&v61,
a1,
v38,
0.8,
0.5,
v42,
(float *)&v58,
"goldFont.fnt",
0,
0,
0);
if ( v60 < 0 )
operator delete(v59[0]);
((void (__fastcall *)(CCMenuItemToggler *, __int64))v45->setTag)(v45, 10);
CCMenuItemToggler::setSizeMult(v45, 1.0);
v46 = GJOptionsLayer::objectsForPage(a1, 0);
sub_10024A2D0((__int64)v46);
((void (__fastcall *)(CCMenuItemToggler *, _QWORD))v45->setVisible)(v45, 0);
v36 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, _QWORD))v38->setVisible)(v38, 0);
}
v47 = a1->m_buttonMenu;
v36.n128_f32[0] = v66 * 0.5;
v37.n128_f32[0] = (float)((float)(v67 * 0.5) - (float)(a1->m_height * 0.5)) + 26.0;
sub_100022980(v36, v37, &v61);
cocos2d::CCNode::convertToNodeSpace(v47, &v61);
v48 = sub_10005F294("Platformer UI");
((void (__fastcall *)(ButtonSprite *, float))v48->setScale)(v48, 0.7);
v68.ptr = (void (__cdecl *)(cocos2d::CCObject *))GameOptionsLayer::onUIOptions;
v68.adj = 0;
v49 = CCMenuItemSpriteExtra::create(v48, nullptr, a1, v68);
v50 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v49);
v50.n128_u32[0] = -1029701632;
v51.n128_u32[0] = 0;
sub_100022980(v50, v51, &v58);
*(float32x2_t *)&v52 = sub_1000229DC((float32x2_t *)&v62, &v58, (float32x2_t *)&v61);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, double))v49->setPosition)(v49, &v61, v52);
v53 = sub_10005F294("Practice UI");
((void (__fastcall *)(ButtonSprite *, float))v53->setScale)(v53, 0.7);
v69.ptr = (void (__cdecl *)(cocos2d::CCObject *))GameOptionsLayer::onUIPOptions;
v69.adj = 0;
v54 = CCMenuItemSpriteExtra::create(v53, nullptr, a1, v69);
v55 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v54);
v55.n128_u32[0] = 1117782016;
v56.n128_u32[0] = 0;
sub_100022980(v55, v56, &v58);
*(float32x2_t *)&v57 = sub_1000229DC((float32x2_t *)&v62, &v58, (float32x2_t *)&v61);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, double))v54->setPosition)(v54, &v61, v57);
}