//
// PurchaseItemPopup::init from 0x613c7c to 0x6143fe (1922 bytes)
//
// 1 xrefs:
// > PurchaseItemPopup::create @ 0x61451c
//
// 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:54:54 +0000
//
int __fastcall PurchaseItemPopup::init(PurchaseItemPopup *this, GJStoreItem *a2)
{
float v4; // s18
cocos2d::CCDirector *v5; // r0
cocos2d::CCLayer *WinSize; // r0
int v7; // r0
int v8; // r3
int v9; // r0
int v10; // r5
void (__fastcall *v11)(int, _DWORD *); // r6
void (__fastcall *v12)(int, _DWORD *); // r6
const char *v13; // r2
int v14; // r5
void (__fastcall *v15)(int, _DWORD *); // r6
_DWORD *v16; // r3
int v17; // r5
int v18; // r6
int *StoreItem; // r11
float v20; // s17
void (__fastcall *v21)(int *, _DWORD *); // r7
unsigned int v22; // r3
const char *v23; // r7
size_t v24; // r0
char *v25; // r1
_BYTE *v26; // r2
char *v27; // r0
char *v28; // r3
cocos2d::CCString *v29; // r0
char *CString; // r0
const char *v31; // r10
size_t v32; // r0
int v33; // r9
int (__fastcall *v34)(int, _DWORD *); // r10
cocos2d::CCMenu *v35; // r0
int v36; // r0
cocos2d::CCArray *v37; // r0
cocos2d::CCArray *v38; // r10
ButtonSprite *v39; // r0
cocos2d::CCObject *v40; // r8
ButtonSprite *v41; // r0
cocos2d::CCObject *v42; // r8
const cocos2d::CCPoint *v43; // r11
float v44; // s20
float v45; // s17
int v46; // r0
int v48; // r9
char *v49; // r1
int v50; // r3
int v51; // r6
const cocos2d::CCPoint *v52; // r4
void (__fastcall *v53)(int, _BYTE *); // r5
float v54; // [sp+10h] [bp-B4h]
int v55; // [sp+10h] [bp-B4h]
int v56; // [sp+18h] [bp-ACh]
float v57; // [sp+20h] [bp-A4h] BYREF
float v58; // [sp+24h] [bp-A0h]
_BYTE v59[8]; // [sp+28h] [bp-9Ch] BYREF
_BYTE v60[8]; // [sp+30h] [bp-94h] BYREF
int (__fastcall *v61)(PurchaseItemPopup *, cocos2d::CCObject *); // [sp+38h] [bp-8Ch]
int v62; // [sp+3Ch] [bp-88h]
int v63[3]; // [sp+40h] [bp-84h] BYREF
int v64; // [sp+4Ch] [bp-78h] BYREF
unsigned int v65; // [sp+50h] [bp-74h]
char *v66; // [sp+54h] [bp-70h]
int v67; // [sp+58h] [bp-6Ch] BYREF
unsigned int v68; // [sp+5Ch] [bp-68h]
char *v69; // [sp+60h] [bp-64h]
int v70[2]; // [sp+64h] [bp-60h] BYREF
char *v71; // [sp+6Ch] [bp-58h]
unsigned __int8 v72; // [sp+70h] [bp-54h] BYREF
_BYTE v73[7]; // [sp+71h] [bp-53h] BYREF
_BYTE *v74; // [sp+78h] [bp-4Ch]
char v75[4]; // [sp+7Ch] [bp-48h] BYREF
int v76; // [sp+80h] [bp-44h]
const char *v77; // [sp+84h] [bp-40h]
int v78; // [sp+88h] [bp-3Ch] BYREF
int v79; // [sp+8Ch] [bp-38h]
int v80; // [sp+90h] [bp-34h]
int v81[3]; // [sp+94h] [bp-30h] BYREF
int v82[3]; // [sp+A0h] [bp-24h] BYREF
_DWORD v83[4]; // [sp+ACh] [bp-18h] BYREF
v83[0] = 1258291200;
v56 = cocos2d::CCLayerColor::initWithColor(this, v83);
if ( v56 )
{
*((_DWORD *)this + 130) = a2;
cocos2d::CCObject::retain(a2);
FLAlertLayer::incrementForcePrio(this);
v4 = 280.0;
(*(void (__fastcall **)(PurchaseItemPopup *, int))(*(_DWORD *)this + 500))(this, 1);
v5 = (cocos2d::CCDirector *)(*(int (__fastcall **)(PurchaseItemPopup *, int))(*(_DWORD *)this + 536))(this, 1);
cocos2d::CCDirector::sharedDirector(v5);
WinSize = (cocos2d::CCLayer *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v57);
v7 = cocos2d::CCLayer::create(WinSize);
v8 = *(_DWORD *)this;
*((_DWORD *)this + 115) = v7;
(*(void (__fastcall **)(PurchaseItemPopup *, int))(v8 + 228))(this, v7);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v83, 0.0, 0.0, 80.0, 80.0);
v9 = cocos2d::extension::CCScale9Sprite::create("GJ_square02.png", v83);
if ( *(_DWORD *)(*((_DWORD *)this + 130) + 288) - *(_DWORD *)(*((_DWORD *)this + 130) + 292) != 11 )
v4 = 260.0;
v10 = v9;
v11 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v9 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v83, v4, 190.0);
v11(v10, v83);
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v10, -1);
v12 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v10 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v83, v57 * 0.5, v58 * 0.5);
v12(v10, v83);
v14 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Buy Item", "bigFont.fnt", v13);
v15 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v14 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v83, v57 * 0.5, (float)((float)(v58 * 0.5) + 95.0) - 16.0);
v15(v14, v83);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 115) + 228))(*((_DWORD *)this + 115), v14);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v14 + 80))(v14, 1058642330);
v16 = *((_DWORD **)this + 130);
v17 = v16[69] - v16[70];
v18 = v16[72] - v16[73];
StoreItem = GJItemIcon::createStoreItem(v18, v17, 0);
(*(void (__fastcall **)(int *, int))(*StoreItem + 80))(StoreItem, 1067030938);
if ( v18 == 6 )
{
v20 = -8.0;
}
else
{
if ( v18 == 12 && (unsigned int)(v17 - 6) <= 9 )
{
v48 = 1;
switch ( v17 )
{
case 7:
v20 = 12.0;
break;
case 8:
case 10:
case 12:
v20 = 15.0;
break;
case 9:
case 13:
case 14:
case 15:
v20 = 10.0;
break;
case 11:
v20 = 5.0;
break;
default:
v20 = 0.0;
break;
}
LABEL_9:
(*(void (__fastcall **)(_DWORD, int *, int))(**((_DWORD **)this + 115) + 232))(
*((_DWORD *)this + 115),
StoreItem,
1);
v21 = *(void (__fastcall **)(int *, _DWORD *))(*StoreItem + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v83, v57 * 0.5, (float)((float)(v58 * 0.5) + 22.0) + v20);
v21(StoreItem, v83);
ItemInfoPopup::nameForUnlockType(v63, v17, v18);
std::string::basic_string(&v64, (int)v63);
if ( (v64 & 1) != 0 )
v22 = v65;
else
v22 = (int)(unsigned __int8)v64 >> 1;
if ( v22 > 7 )
{
std::operator+(&v67, "\n", (unsigned __int8 *)&v64);
if ( (v64 & 1) != 0 )
{
*v66 = 0;
v65 = 0;
}
else
{
LOWORD(v64) = 0;
}
std::string::reserve(&v64, 0);
v64 = v67;
v65 = v68;
v66 = v69;
v67 = 0;
v68 = 0;
v69 = nullptr;
std::string::~string((int)&v67);
}
if ( *((_DWORD *)a2 + 78) == 4 )
v23 = "Diamond Shards";
else
v23 = "Mana Orbs";
v70[0] = 0;
v70[1] = 0;
v71 = nullptr;
v24 = strlen(v23);
std::string::__init(v70, v23, v24);
GameToolbox::pointsToString(
(GameToolbox *)&v72,
*(_DWORD *)(*((_DWORD *)this + 130) + 300) - *(_DWORD *)(*((_DWORD *)this + 130) + 304));
*(_DWORD *)v75 = 0;
v76 = 0;
v77 = nullptr;
std::string::__init((int *)v75, &unk_B6B226, 0);
if ( v48 )
{
if ( (v64 & 1) != 0 )
v25 = v66;
else
v25 = (char *)&v64 + 1;
v26 = (_BYTE *)(v72 << 31);
if ( (v72 & 1) == 0 )
v26 = v73;
v27 = "Do you want to unlock%s\nfor %s %s?";
if ( (v72 & 1) != 0 )
v26 = v74;
if ( (v70[0] & 1) != 0 )
v28 = v71;
else
v28 = (char *)v70 + 1;
}
else
{
if ( (v64 & 1) != 0 )
v25 = v66;
else
v25 = (char *)&v64 + 1;
if ( (v72 & 1) != 0 )
v26 = v74;
else
v26 = v73;
if ( (v70[0] & 1) != 0 )
v28 = v71;
else
v28 = (char *)v70 + 1;
v27 = "Do you want to buy this %s\nfor %s %s?";
}
v29 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)v27, v25, v26, v28);
CString = (char *)cocos2d::CCString::getCString(v29);
std::string::assign((int *)v75, CString);
if ( (v75[0] & 1) != 0 )
v31 = v77;
else
v31 = &v75[1];
v78 = 0;
v79 = 0;
v80 = 0;
v32 = strlen(v31);
std::string::__init(&v78, v31, v32);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v83, 0.5, 1.0);
v33 = TextArea::create(
(int)&v78,
"bigFont.fnt",
1065353216,
1148829696,
(const cocos2d::CCPoint *)v83,
1108082688,
0,
0);
std::string::~string((int)&v78);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v33 + 80))(v33, 1053609165);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 115) + 228))(*((_DWORD *)this + 115), v33);
v34 = *(int (__fastcall **)(int, _DWORD *))(*(_DWORD *)v33 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v83, v57 * 0.5, (float)(v58 * 0.5) - 20.0);
v35 = (cocos2d::CCMenu *)v34(v33, v83);
*((_DWORD *)this + 125) = -1;
v36 = cocos2d::CCMenu::create(v35);
*((_DWORD *)this + 111) = v36;
v37 = (cocos2d::CCArray *)(*(int (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(
*((_DWORD *)this + 115),
v36,
10);
v38 = (cocos2d::CCArray *)cocos2d::CCArray::create(v37);
v39 = ButtonSprite::create(
(ButtonSprite *)"Cancel",
(const char *)&word_32,
0,
0.6,
1,
"bigFont.fnt",
"GJ_button_06.png",
(const char *)0x41F00000,
COERCE_FLOAT(&v72));
v62 = 0;
v61 = PurchaseItemPopup::onClose;
v40 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
(int)v39,
0,
(int)this,
(int)PurchaseItemPopup::onClose,
0);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(**((_DWORD **)this + 111) + 228))(
*((_DWORD *)this + 111),
v40);
cocos2d::CCArray::addObject(v38, v40);
v41 = ButtonSprite::create(
(ButtonSprite *)"Buy",
(const char *)&word_32,
0,
0.6,
1,
"bigFont.fnt",
"GJ_button_01.png",
(const char *)0x41F00000,
v54);
v83[1] = 0;
v83[0] = PurchaseItemPopup::onPurchase;
v42 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
(int)v41,
0,
(int)this,
(int)PurchaseItemPopup::onPurchase,
0);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(**((_DWORD **)this + 111) + 228))(
*((_DWORD *)this + 111),
v42);
cocos2d::CCArray::addObject(v38, v42);
v43 = *((const cocos2d::CCPoint **)this + 111);
v44 = (float)(v58 * 0.5) - 95.0;
v45 = v57 * 0.5;
v46 = (*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 115) + 96))(*((_DWORD *)this + 115));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v59, v45, (float)(v44 + 22.0) + *(float *)(v46 + 4));
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v60, v43);
GameToolbox::alignItemsHorisontally(*(float *)&v38, 15.0, (int)v60, 0);
if ( v18 != 12 )
goto LABEL_29;
v78 = 0;
v79 = 0;
v80 = 0;
if ( v17 == 16 )
{
v49 = "This item lets you customize Practice and Menu music.\n"
"After purchasing this item you will be able to change practice and menu music from the more info page on custom songs.";
}
else
{
if ( v17 != 17 )
{
LABEL_55:
if ( (unsigned int)(v17 - 6) <= 9 )
std::string::assign(
&v78,
"When you activate a path, Stars and Moons you collect will level up your Pat"
"h.\n"
"You can unlock multiple paths, but only one can be active at a time.");
if ( (v78 & 1) != 0 )
v50 = v79;
else
v50 = (int)(unsigned __int8)v78 >> 1;
if ( v50 )
{
std::string::basic_string(v81, (int)v63);
std::string::basic_string(v82, (int)&v78);
v51 = InfoAlertButton::create((char *)v81, (int)v82, 1065353216);
std::string::~string((int)v82);
std::string::~string((int)v81);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v51);
v52 = *((const cocos2d::CCPoint **)this + 111);
v53 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v51 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v59,
(float)((float)(v4 * 0.5) + (float)(v57 * 0.5)) - 20.0,
(float)((float)(v58 * 0.5) + 95.0) - 18.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v60, v52);
v53(v51, v60);
}
std::string::~string((int)&v78);
LABEL_29:
std::string::~string((int)v75);
std::string::~string(v55);
std::string::~string((int)v70);
std::string::~string((int)&v64);
std::string::~string((int)v63);
return v56;
}
v49 = "This item lets you play\n"
"Normal mode music in sync in Practice mode.\n"
"After purchasing this item you will be able to toggle the option in the game menu.";
}
std::string::assign(&v78, v49);
goto LABEL_55;
}
v20 = 0.0;
}
v48 = 0;
goto LABEL_9;
}
return v56;
}