//
// RetryLevelLayer::customSetup from 0x1004f85e0 to 0x1004f8ca2 (1730 bytes)
//
// 1 xrefs:
// > ??> @ 0x100958478
//
// 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 RetryLevelLayer::customSetup(RetryLevelLayer *a1)
{
GJGameLevel *m_level; // rax
std::string *p_m_levelName; // rax
const char *v4; // rdi
cocos2d::CCLabelBMFont *v5; // r14
cocos2d::CCString *v6; // rax
const char *CString; // rax
cocos2d::CCLabelBMFont *v8; // r15
cocos2d::CCString *v9; // rax
cocos2d::CCString *v10; // rax
const char *v11; // rax
cocos2d::CCLabelBMFont *v12; // r12
unsigned __int64 *v13; // r15
cocos2d::CCMenu *v14; // rax
cocos2d::CCMenu *m_mainMenu; // r14
cocos2d::CCLayer *m_mainLayer; // r15
cocos2d::CCSprite *v17; // rax
CCMenuItemSpriteExtra *v18; // r12
cocos2d::CCSprite *v19; // rax
CCMenuItemSpriteExtra *v20; // r15
cocos2d::CCSprite *v21; // r13
const cocos2d::CCPoint *v22; // r14
cocos2d::CCSprite *v23; // r12
cocos2d::CCLayer *v24; // rbx
const cocos2d::CCPoint *v25; // r14
char v26; // [rsp+0h] [rbp-90h]
char v27; // [rsp+0h] [rbp-90h]
char v28; // [rsp+0h] [rbp-90h]
unsigned __int64 v29; // [rsp+8h] [rbp-88h] BYREF
char v30; // [rsp+10h] [rbp-80h]
_BYTE v31[23]; // [rsp+11h] [rbp-7Fh] BYREF
const cocos2d::CCPoint *p_m_endPosition; // [rsp+28h] [rbp-68h]
__int128 v33; // [rsp+30h] [rbp-60h] BYREF
void *__p; // [rsp+40h] [rbp-50h]
unsigned __int64 v35; // [rsp+48h] [rbp-48h] BYREF
float v36; // [rsp+50h] [rbp-40h] BYREF
float v37; // [rsp+54h] [rbp-3Ch]
unsigned __int64 v38; // [rsp+58h] [rbp-38h] BYREF
unsigned __int64 v39[6]; // [rsp+60h] [rbp-30h] BYREF
double v40; // 0:xmm0_8.8
double v41; // 0:xmm0_8.8
cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v40 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v36);
m_level = GameManager::sharedState()->m_playLayer->m_level;
if ( (m_level->m_levelName.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(&v33, m_level->m_levelName.m_data.m_long.longStorage, m_level->m_levelName.m_data.m_long.size, v40);
if ( (v33 & 1) == 0 )
goto LABEL_3;
}
else
{
p_m_levelName = &m_level->m_levelName;
__p = p_m_levelName->m_data.m_long.longStorage;
v33 = *(_OWORD *)&p_m_levelName->m_data.m_short.sizex2;
if ( (v33 & 1) == 0 )
{
LABEL_3:
v4 = (char *)&v33 + 1;
goto LABEL_6;
}
}
v4 = (const char *)__p;
LABEL_6:
v5 = cocos2d::CCLabelBMFont::create_3(v4, "bigFont.fnt");
if ( (v33 & 1) != 0 )
operator delete(__p);
sub_10028CBE0((float *)&v33, v36 * 0.5, (float)((float)(v37 * 0.5) + 80.0) + -15.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int128 *))v5->setPosition)(v5, &v33);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v5);
cocos2d::CCLabelBMFont::limitLabelWidth(v5, 320.0, 0.0, 0.0);
RetryLevelLayer::setupLastProgress(a1);
((void (__fastcall *)(cocos2d::CCLayer *, _QWORD, __int64))a1->m_mainLayer->removeChildByTag_0)(a1->m_mainLayer, 0, 1);
((void (__fastcall *)(cocos2d::CCLayer *, __int64, __int64))a1->m_mainLayer->removeChildByTag_0)(
a1->m_mainLayer,
1,
1);
((void (__fastcall *)(cocos2d::CCMenu *, _QWORD))a1->m_buttonMenu->setVisible)(a1->m_buttonMenu, 0);
sub_10028CBE0((float *)&v35, 0.0, 5.0);
sub_10028CCE0((double *)&v33, (unsigned __int64 *)&a1->m_endPosition, &v35);
p_m_endPosition = &a1->m_endPosition;
sub_10028CC90(&a1->m_endPosition, (double *)&v33);
sub_10028CBE0((float *)&v33, v36 * 0.5, (float)((float)(v37 * 0.5) + -10.0) + -15.0);
GameManager::sharedState();
v6 = (cocos2d::CCString *)sub_1007AB580("Jumps: %i", v26);
CString = cocos2d::CCString::getCString(v6);
v8 = cocos2d::CCLabelBMFont::create_3(CString, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v8,
3);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int128 *))v8->setPosition)(v8, &v33);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v8->setScale)(v8, 0.80000001);
if ( (unsigned int)((int)GameManager::sharedState()->m_playLayer->m_gameState.m_totalTime + 3599) > 0x1C1E )
v9 = (cocos2d::CCString *)sub_1007AB580("%02d:%02d:%02d", v27);
else
v9 = (cocos2d::CCString *)sub_1007AB580("%02d:%02d", v27);
cocos2d::CCString::getCString(v9);
v10 = (cocos2d::CCString *)sub_1007AB580("Time: %s", v28);
v11 = cocos2d::CCString::getCString(v10);
v12 = cocos2d::CCLabelBMFont::create_3(v11, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v12,
3);
v13 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v8->getPosition)(v8);
sub_10028CBE0((float *)&v38, 0.0, -24.0);
sub_10028CCE0((double *)&v35, v13, &v38);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, unsigned __int64 *))v12->setPosition)(v12, &v35);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v12->setScale)(v12, 0.80000001);
v14 = cocos2d::CCMenu::create();
a1->m_mainMenu = v14;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v14,
1);
m_mainMenu = a1->m_mainMenu;
m_mainLayer = a1->m_mainLayer;
sub_10028CBE0((float *)v39, 0.5 * v36, (float)((float)(v37 * 0.5) + -115.0) + -10.0);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v38, (const cocos2d::CCPoint *)m_mainLayer);
*(cocos2d::CCPoint *)&v41 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)&v35,
(const cocos2d::CCPoint *)m_mainMenu);
v17 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_replayBtn_001.png");
v18 = CCMenuItemSpriteExtra::create(
v17,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)RetryLevelLayer::onReplay);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *, double))a1->m_mainMenu->addChild)(
a1->m_mainMenu,
v18,
v41);
sub_10028CBE0((float *)v39, -100.0, 0.0);
sub_10028CCE0((double *)&v38, &v35, v39);
((void (__fastcall *)(CCMenuItemSpriteExtra *, unsigned __int64 *))v18->setPosition)(v18, &v38);
v19 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_menuBtn_001.png");
v20 = CCMenuItemSpriteExtra::create(
v19,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)RetryLevelLayer::onMenu);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_mainMenu->addChild)(a1->m_mainMenu, v20);
sub_10028CBE0((float *)v39, 100.0, 0.0);
sub_10028CCE0((double *)&v38, &v35, v39);
((void (__fastcall *)(CCMenuItemSpriteExtra *, unsigned __int64 *))v20->setPosition)(v20, &v38);
((void (__fastcall *)(cocos2d::CCLayer *, const cocos2d::CCPoint *))a1->m_mainLayer->setPosition)(
a1->m_mainLayer,
p_m_endPosition);
if ( PlatformToolbox::isControllerConnected() )
{
v21 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_Start_001.png");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v21,
10);
p_m_endPosition = (const cocos2d::CCPoint *)a1->m_mainLayer;
v22 = (const cocos2d::CCPoint *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v18->getParent)(v18);
((void (__fastcall *)(CCMenuItemSpriteExtra *))v18->getPosition)(v18);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)v39, v22);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v38, p_m_endPosition);
sub_10028CBE0((float *)&v29, 0.0, -25.0);
sub_10028CCE0((double *)v39, &v38, &v29);
((void (__fastcall *)(cocos2d::CCSprite *, unsigned __int64 *))v21->setPosition)(v21, v39);
v23 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_B_001.png");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v23,
10);
v24 = a1->m_mainLayer;
v25 = (const cocos2d::CCPoint *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v20->getParent)(v20);
((void (__fastcall *)(CCMenuItemSpriteExtra *))v20->getPosition)(v20);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v29, v25);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v39, (const cocos2d::CCPoint *)v24);
sub_10028CC90(&v38, (double *)v39);
sub_10028CBE0((float *)&v29, 0.0, -25.0);
sub_10028CCE0((double *)v39, &v38, &v29);
((void (__fastcall *)(cocos2d::CCSprite *, unsigned __int64 *))v23->setPosition)(v23, v39);
((void (__fastcall *)(cocos2d::CCSprite *, float))v23->setScale)(v23, 0.80000001);
}
v30 = 26;
strcpy(v31, "Geometry Dash");
PlatformToolbox::tryShowRateDialog();
if ( (v30 & 1) != 0 )
operator delete(*(void **)&v31[15]);
}