//
// AchievementsLayer::customSetup from 0x422480 to 0x42268e (526 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:48:02 +0000
//
int __fastcall AchievementsLayer::customSetup(GameToolbox **this)
{
PlatformToolbox *WinSize; // r0
cocos2d::CCMenu *isControllerConnected; // r8
const cocos2d::CCPoint *v4; // r0
const char *v5; // r1
float v6; // s17
const cocos2d::CCPoint *v7; // r6
char *v8; // r0
int v9; // r0
int v10; // r0
cocos2d::CCDirector *v11; // r0
int v12; // r10
void (__fastcall *v13)(int, _DWORD *); // r11
cocos2d::CCDirector *v14; // r0
float v15; // r0
const char *v16; // r1
char *v17; // r0
cocos2d::CCSprite *v18; // r0
int v19; // r10
int v20; // r0
cocos2d::CCDirector *v21; // r0
int v22; // r11
cocos2d::CCDirector *v23; // r0
float v24; // r0
const char *v25; // r2
GameToolbox *v26; // r0
cocos2d::CCDirector *v27; // r0
int v28; // r6
void (__fastcall *v29)(int, _BYTE *); // r10
cocos2d::CCDirector *v30; // r0
float v31; // s16
cocos2d::CCDirector *v32; // r0
float v33; // r0
int v34; // r6
void (__fastcall *v35)(int, _BYTE *); // r10
int result; // r0
cocos2d::CCLayer *v37; // r1
void (__fastcall *v38)(int, _BYTE *); // [sp+Ch] [bp-38h]
_BYTE v39[4]; // [sp+14h] [bp-30h] BYREF
float v40; // [sp+18h] [bp-2Ch]
_BYTE v41[8]; // [sp+1Ch] [bp-28h] BYREF
_BYTE v42[8]; // [sp+24h] [bp-20h] BYREF
_DWORD (*v43)(AchievementsLayer *__hidden, cocos2d::CCObject *); // [sp+2Ch] [bp-18h]
int v44; // [sp+30h] [bp-14h]
_DWORD v45[2]; // [sp+34h] [bp-10h] BYREF
cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)this);
WinSize = (PlatformToolbox *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v39);
isControllerConnected = (cocos2d::CCMenu *)PlatformToolbox::isControllerConnected(WinSize);
v4 = (const cocos2d::CCPoint *)cocos2d::CCMenu::create(isControllerConnected);
v6 = v40 * 0.5;
v7 = v4;
if ( isControllerConnected )
v8 = "controllerBtn_DPad_Left_001.png";
else
v8 = "GJ_arrow_01_001.png";
v9 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)v8, v5);
v43 = AchievementsLayer::onPrevPage;
v44 = 0;
v10 = CCMenuItemSpriteExtra::create(v9, 0, (int)this, (int)AchievementsLayer::onPrevPage, 0);
*(this + 122) = (GameToolbox *)v10;
v11 = (cocos2d::CCDirector *)(*(int (__fastcall **)(const cocos2d::CCPoint *, int))(*(_DWORD *)v7 + 228))(v7, v10);
v12 = (int)*(this + 122);
v13 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v12 + 92);
v14 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v11);
v15 = COERCE_FLOAT(cocos2d::CCDirector::getScreenLeft(v14));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v42, v15 + 24.0, v6);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v45, v7);
v13(v12, v45);
if ( isControllerConnected )
v17 = "controllerBtn_DPad_Right_001.png";
else
v17 = "GJ_arrow_01_001.png";
v18 = (cocos2d::CCSprite *)cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)v17, v16);
v19 = (int)v18;
if ( !isControllerConnected )
cocos2d::CCSprite::setFlipX(v18, 1);
v45[0] = AchievementsLayer::onNextPage;
v45[1] = 0;
v20 = CCMenuItemSpriteExtra::create(v19, 0, (int)this, (int)AchievementsLayer::onNextPage, 0);
*(this + 121) = (GameToolbox *)v20;
v21 = (cocos2d::CCDirector *)(*(int (__fastcall **)(const cocos2d::CCPoint *, int))(*(_DWORD *)v7 + 228))(v7, v20);
v22 = (int)*(this + 121);
v38 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v22 + 92);
v23 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v21);
v24 = COERCE_FLOAT(cocos2d::CCDirector::getScreenRight(v23));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v41, v24 - 24.0, v6);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v42, v7);
v38(v22, v42);
(*(void (__fastcall **)(_DWORD, const cocos2d::CCPoint *, int))(*(_DWORD *)*(this + 116) + 232))(
*(this + 116),
v7,
10);
v26 = (GameToolbox *)cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)" ", "goldFont.fnt", v25);
*(this + 123) = v26;
v27 = (cocos2d::CCDirector *)(*(int (__fastcall **)(_DWORD, GameToolbox *))(*(_DWORD *)*(this + 116) + 228))(
*(this + 116),
v26);
v28 = (int)*(this + 123);
v29 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v28 + 92);
v30 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v27);
v31 = COERCE_FLOAT(cocos2d::CCDirector::getScreenRight(v30));
v32 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)LODWORD(v31));
v33 = COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v32));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v42, v31 - 7.0, v33 - 4.0);
v29(v28, v42);
v34 = (int)*(this + 123);
v35 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v34 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v42, 1.0, 1.0);
v35(v34, v42);
(*(void (__fastcall **)(_DWORD, int))(*(_DWORD *)*(this + 123) + 80))(*(this + 123), 1058642330);
result = AchievementsLayer::loadPage((AchievementsLayer *)this, 0);
if ( isControllerConnected )
return GameToolbox::addRThumbScrollButton(*(this + 116), v37);
return result;
}