//
// GameOptionsLayer::setupOptions from 0x8dbca4 to 0x8dc430 (1932 bytes)
//
// 2 xrefs:
// > ??> @ 0xa5db0
// > ??> @ 0x119d8e0
//
// 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 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::CCArray *v22; // x0
cocos2d::CCArray *v23; // x25
GameStatsManager *v24; // x0
cocos2d::CCMenu *m_buttonMenu; // x27
float m_maxLabelScale; // s10
float m_maxLabelWidth; // s9
cocos2d::CCLayer *m_mainLayer; // x26
CCMenuItemToggler *v29; // x26
void *v30; // x0
GameStatsManager *v31; // x0
cocos2d::CCMenu *v32; // x23
const char *v33; // x1
__int64 v34; // x2
__int64 v35; // x3
bool v36; // w4
__int64 v37; // x5
const char *v38; // x6
cocos2d::CCNode *v39; // x23
CCMenuItemSpriteExtra *v40; // x23
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
const char *v42; // x1
__int64 v43; // x2
__int64 v44; // x3
bool v45; // w4
__int64 v46; // x5
const char *v47; // x6
cocos2d::CCNode *v48; // x23
CCMenuItemSpriteExtra *v49; // x23
void (__fastcall *v50)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x19
cocos2d::CCLayer *v51; // x25
GameManager *v52; // x0
bool v53; // w27
cocos2d::CCMenu *v54; // x24
float v55; // s9
CCMenuItemToggler *v56; // x24
void *v57; // x0
cocos2d::CCArray *v58; // x0
__int64 v59; // x25
CCMenuItemSpriteExtra *v60; // x0
__int64 v61; // x0
unsigned int *v62; // x1
int v63; // w2
unsigned int *v64; // x1
int v65; // w2
__int64 v66; // [xsp+30h] [xbp+0h] BYREF
bool isItemEnabled; // [xsp+BFh] [xbp+8Fh]
float v68; // [xsp+C8h] [xbp+98h]
float v69; // [xsp+CCh] [xbp+9Ch]
cocos2d::CCPoint v70; // [xsp+D0h] [xbp+A0h] BYREF
cocos2d::CCPoint v71; // [xsp+D8h] [xbp+A8h] BYREF
cocos2d::CCPoint v72; // [xsp+E0h] [xbp+B0h] BYREF
cocos2d::CCPoint v73; // [xsp+E8h] [xbp+B8h] BYREF
cocos2d::CCPoint v74; // [xsp+F0h] [xbp+C0h] BYREF
cocos2d::SEL_MenuHandler v75; // 0:x2.16
cocos2d::SEL_MenuHandler v76; // 0:x2.16
v2 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v2);
a1->m_togglesPerPage = 12;
a1->m_offset = 32.0;
a1->m_gap = 37.0;
v3 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v3, "0026");
GJOptionsLayer::addToggle(a1, "Auto-Retry", 1, GameVariable, &byte_F288A0);
v5 = GameManager::sharedState();
v6 = GameManager::getGameVariable(v5, "0027");
GJOptionsLayer::addToggle(a1, "Auto-Checkpoints", 2, v6, &byte_F288A0);
v7 = GameManager::sharedState();
GJOptionsLayer::addToggle(a1, "Show Progress Bar", 3, v7->m_showProgressBar, &byte_F288A0);
v8 = GameManager::sharedState();
v9 = GameManager::getGameVariable(v8, "0040");
GJOptionsLayer::addToggle(a1, "Show Percentage", 4, v9, &byte_F288A0);
v10 = GameManager::sharedState();
v11 = GameManager::getGameVariable(v10, "0145");
GJOptionsLayer::addToggle(a1, "Show Time", 7, v11, &byte_F288A0);
v12 = GameManager::sharedState();
v13 = GameManager::getGameVariable(v12, "0144");
GJOptionsLayer::addToggle(a1, "Audio Visualizer", 5, v13, &byte_F288A0);
v14 = GameManager::sharedState();
v15 = GameManager::getGameVariable(v14, "0109");
GJOptionsLayer::addToggle(a1, "Show Info Label", 6, v15, &byte_F288A0);
v16 = GameManager::sharedState();
v17 = GameManager::getGameVariable(v16, "0146");
GJOptionsLayer::addToggle(a1, "Disable Checkpoints", 8, v17, &byte_F288A0);
v18 = GameManager::sharedState();
v19 = GameManager::getGameVariable(v18, "0166");
GJOptionsLayer::addToggle(a1, "Show Hitboxes", 9, v19, "Shows hitboxes while in practice mode.");
v20 = GameManager::sharedState();
v21 = GameManager::getGameVariable(v20, "0179");
GJOptionsLayer::addToggle(
a1,
"Hitbox On Death",
11,
v21,
"Shows hitboxes upon death in both normal and practice mode.");
v23 = (cocos2d::CCArray *)cocos2d::CCArray::create(v22);
GJOptionsLayer::nextPosition(a1, 0);
sub_D153B8((unsigned int)&v66 + 184, "Practice Music Sync");
v24 = GameStatsManager::sharedState();
isItemEnabled = GameStatsManager::isItemEnabled(v24, GJItem, 17);
m_buttonMenu = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v74, &v70);
m_maxLabelScale = a1->m_maxLabelScale;
m_maxLabelWidth = a1->m_maxLabelWidth;
m_mainLayer = a1->m_mainLayer;
cocos2d::CCPoint::CCPoint(&v72, 8.0, 0.0);
v29 = GameToolbox::createToggleButton(
0.8,
m_maxLabelScale,
m_maxLabelWidth,
(__int64)&v73,
(void (__cdecl *)(cocos2d::CCObject *))GameOptionsLayer::onPracticeMusicSync,
0,
isItemEnabled,
m_buttonMenu,
&v74,
a1,
m_mainLayer,
(float *)&v72,
(__int64)"bigFont.fnt",
0,
0,
v23);
v30 = (void *)(*(_QWORD *)&v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v73 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v62 = (unsigned int *)(*(_QWORD *)&v73 - 8LL);
do
v63 = __ldaxr(v62);
while ( __stlxr(v63 - 1, v62) );
}
else
{
v63 = *(_DWORD *)(*(_QWORD *)&v73 - 8LL);
*(_DWORD *)(*(_QWORD *)&v73 - 8LL) = v63 - 1;
}
if ( v63 <= 0 )
operator delete(v30);
}
v31 = GameStatsManager::sharedState();
if ( !GameStatsManager::isItemUnlocked(v31, GJItem, 17) )
{
v59 = cocos2d::CCArray::objectAtIndex(v23, 1u);
v29->m_notClickable = 1;
LOWORD(v74.x) = -26986;
BYTE2(v74.x) = -106;
v60 = CCMenuItemToggler::activeItem(v29);
v61 = (__int64)v60->getNormalImage(v60);
(*(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v61 + 944LL))(v61, &v74);
(*(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v59 + 1056LL))(v59, &v74);
}
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);
v51 = GJOptionsLayer::layerForPage(a1, 0);
GJOptionsLayer::nextPosition(a1, 0);
sub_D153B8((int)&v73, "Ignore Damage");
v52 = GameManager::sharedState();
v53 = GameManager::getGameVariable(v52, "0173");
v54 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v74, &v71);
v55 = a1->m_maxLabelWidth;
cocos2d::CCPoint::CCPoint(&v72, 8.0, 0.0);
v56 = GameToolbox::createToggleButton(
0.8,
0.5,
v55,
(__int64)&v73,
(void (__cdecl *)(cocos2d::CCObject *))GJOptionsLayer::onToggle,
0,
v53,
v54,
&v74,
a1,
v51,
(float *)&v72,
(__int64)"goldFont.fnt",
0,
0,
nullptr);
v57 = (void *)(*(_QWORD *)&v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v73 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v64 = (unsigned int *)(*(_QWORD *)&v73 - 8LL);
do
v65 = __ldaxr(v64);
while ( __stlxr(v65 - 1, v64) );
}
else
{
v65 = *(_DWORD *)(*(_QWORD *)&v73 - 8LL);
*(_DWORD *)(*(_QWORD *)&v73 - 8LL) = v65 - 1;
}
if ( v65 <= 0 )
operator delete(v57);
}
v56->setTag(v56, 10);
CCMenuItemToggler::setSizeMult(v56, 1.0);
v58 = GJOptionsLayer::objectsForPage(a1, 0);
cocos2d::CCArray::addObject(v58, v56);
v56->setVisible(v56, 0);
v51->setVisible(v51, 0);
}
v32 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v74, v68 * 0.5, 26.0 - (float)((float)(a1->m_height * 0.5) - (float)(v69 * 0.5)));
cocos2d::CCNode::convertToNodeSpace(v32, &v74);
v39 = (cocos2d::CCNode *)ButtonSprite::create((ButtonSprite *)"Platformer UI", v33, v34, v35, v36, v37, v38);
v39->setScale(v39, 0.7);
v75.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v75.adj = (size_t)GameOptionsLayer::onUIOptions;
v40 = CCMenuItemSpriteExtra::create(v39, nullptr, v75);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v40);
setPosition = v40->setPosition;
cocos2d::CCPoint::CCPoint(&v73, -80.0, 0.0);
cocos2d::CCPoint::operator+(&v74, &v72, &v73);
setPosition(v40, &v74);
v48 = (cocos2d::CCNode *)ButtonSprite::create((ButtonSprite *)"Practice UI", v42, v43, v44, v45, v46, v47);
v48->setScale(v48, 0.7);
v76.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v76.adj = (size_t)GameOptionsLayer::onUIPOptions;
v49 = CCMenuItemSpriteExtra::create(v48, nullptr, v76);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v49);
v50 = v49->setPosition;
cocos2d::CCPoint::CCPoint(&v73, 80.0, 0.0);
cocos2d::CCPoint::operator+(&v74, &v72, &v73);
v50(v49, &v74);
}