//
// ItemInfoPopup::init from 0x404c28 to 0x4057c6 (2974 bytes)
//
// 1 xrefs:
// > ItemInfoPopup::create @ 0x4058a4
//
// 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
//
bool ItemInfoPopup::init(ItemInfoPopup *a1, int a2, UnlockType a3)
{
cocos2d::CCDirector *v6; // r0
cocos2d::CCNode *v7; // r7
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r8
cocos2d::CCNode *v9; // r10
void (__fastcall *v10)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r9
cocos2d::CCString *v11; // r0
char *CString; // r0
cocos2d::CCLabelBMFont *v13; // r7
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
AchievementManager *v15; // r0
AchievementManager *v16; // r10
stl::StringData::Internal *v17; // r2
stl::StringData::Internal *v18; // r3
int v19; // r10
char *v20; // r1
cocos2d::CCSprite *v21; // r7
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r9
void (__fastcall *v23)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
GJItemIcon *BrowserItem; // r7
void (__fastcall *v25)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCMenu *v26; // r0
const char *v27; // r1
ButtonSprite *v28; // r0
CCMenuItemSpriteExtra *v29; // r0
cocos2d::CCMenu *m_buttonMenu; // r7
void (__fastcall *v31)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
GameStatsManager *v32; // r0
int ItemUnlockState; // r6
GameManager *v34; // r7
GameManager *v35; // r0
IconType v36; // r0
char *v37; // r0
cocos2d::CCString *v38; // r0
char *v39; // r1
cocos2d::CCLabelBMFont **v40; // r0
cocos2d::CCString *v41; // r0
char *v42; // r0
unsigned int v43; // s15
cocos2d::CCString *v44; // r0
char *v45; // r0
unsigned int v46; // s15
cocos2d::CCString *v47; // r0
char *v48; // r0
GameStatsManager *v49; // r0
cocos2d::CCString *v50; // r0
char *v51; // r0
cocos2d::CCNode *v52; // r8
void (__fastcall *v53)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCLabelBMFont *v54; // r7
int v55; // r10
GameStatsManager *v56; // r0
int v57; // r0
cocos2d::CCLabelBMFont *v58; // r7
void (__fastcall *v59)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
GameStatsManager *v60; // r0
cocos2d::CCString *v61; // r0
cocos2d::CCLabelBMFont *v62; // r6
CCMenuItemSpriteExtra *v63; // r5
void (__fastcall *v64)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
void (__fastcall *setColor)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::ccColor3B *); // r2
char *v67; // r0
char *v68; // r1
cocos2d::CCString *v69; // r0
char *v70; // r0
float v71; // r2
float v72; // r3
int v73; // [sp+10h] [bp-74h]
_BOOL4 isIconUnlocked; // [sp+14h] [bp-70h]
void (__fastcall *v75)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+14h] [bp-70h]
void (__fastcall *v76)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+14h] [bp-70h]
char *v77; // [sp+20h] [bp-64h] BYREF
cocos2d::CCLabelBMFont *v78; // [sp+24h] [bp-60h] BYREF
int v79; // [sp+28h] [bp-5Ch] BYREF
int v80; // [sp+2Ch] [bp-58h] BYREF
cocos2d::CCLabelBMFont *v81; // [sp+30h] [bp-54h] BYREF
GameStatsManager *v82; // [sp+34h] [bp-50h] BYREF
char *v83; // [sp+38h] [bp-4Ch] BYREF
cocos2d::CCSize v84; // [sp+3Ch] [bp-48h] BYREF
cocos2d::CCPoint v85; // [sp+44h] [bp-40h] BYREF
cocos2d::CCPoint v86; // [sp+4Ch] [bp-38h] BYREF
cocos2d::CCPoint v87; // [sp+54h] [bp-30h] BYREF
cocos2d::CCPoint v88; // [sp+5Ch] [bp-28h] BYREF
cocos2d::CCPoint v89; // [sp+64h] [bp-20h] BYREF
cocos2d::CCRect v90; // [sp+6Ch] [bp-18h] BYREF
cocos2d::CCSize v91; // 0:^0.8
cocos2d::CCRect v92; // 0:kr00_16.16
cocos2d::CCRect v93; // 0:r2.8,8:^0.8
v73 = FLAlertLayer::init(a1, (cocos2d::_ccColor4B)150);
if ( !v73 )
return v73;
a1->setKeypadEnabled(a1, 1);
a1->setTouchEnabled(a1, 1);
a1->m_itemID = a2;
a1->m_unlockType = a3;
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v84, v6);
cocos2d::CCRect::CCRect(&v90, 0.0, 0.0, 80.0, 80.0);
v92.origin.x = v71;
v92.origin.y = v72;
v92.size = v91;
v7 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square01.png",
(const char *)&v90,
v92);
setContentSize = v7->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v90, 300.0, 230.0);
setContentSize(v7, (const cocos2d::CCSize *)&v90);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v7, -2);
cocos2d::CCPoint::CCPoint(&v85, v84.width * 0.5, v84.height * 0.5);
v7->setPosition(v7, &v85);
cocos2d::CCPoint::CCPoint(&v90.origin, 0.0, -22.0);
cocos2d::CCPoint::operator+(&v86, &v85, &v90);
cocos2d::CCRect::CCRect(&v90, 0.0, 0.0, 80.0, 80.0);
v9 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square01.png",
(const char *)&v90,
v93);
((void (__fastcall *)(cocos2d::CCNode *, void *))v9->__vftable[1].getTag)(v9, &unk_9AB29B);
((void (__fastcall *)(cocos2d::CCNode *, int))v9->__vftable[1].~CCNode_0)(v9, 60);
v10 = v9->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v90, 260.0, 90.0);
v10(v9, (const cocos2d::CCSize *)&v90);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v9, -1);
v9->setPosition(v9, &v86);
ItemInfoPopup::nameForUnlockType((int)&v77, a2, a3);
v11 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s %i", v77, a2);
CString = (char *)cocos2d::CCString::getCString(v11);
sub_776584((int)&v78, CString);
v13 = cocos2d::CCLabelBMFont::create();
setPosition = v13->setPosition;
cocos2d::CCPoint::CCPoint(&v90.origin, v85.x, (float)(v85.y + 115.0) - 16.0);
setPosition(v13, &v90.origin);
a1->m_mainLayer->addChild(a1->m_mainLayer, v13);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v13->setScale)(v13, 1061997773);
v15 = AchievementManager::sharedState();
AchievementManager::achievementForUnlock((int)&v79, (int)v15, a2, a3);
if ( *(_DWORD *)(v79 - 12) )
{
v16 = AchievementManager::sharedState();
sub_775C20(&v83);
v19 = AchievementManager::limitForAchievement(v16, (const char **)&v83, v17, v18);
sub_774008(&v83);
}
else
{
v19 = 0;
}
if ( (unsigned int)(v19 - 2) <= 2 )
{
sub_776584((int)&v88, "gj_subzeroLogo_001.png");
if ( v19 == 2 )
{
v20 = "gj_worldLogo_001.png";
}
else
{
if ( v19 != 4 )
goto LABEL_9;
v20 = "GJ_md_001.png";
}
sub_7753D4((int)&v88, v20);
LABEL_9:
v21 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)LODWORD(v88.x));
a1->m_mainLayer->addChild(a1->m_mainLayer, v21);
setAnchorPoint = v21->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v90.origin, 0.0, 1.0);
setAnchorPoint(v21, &v90.origin);
((void (__fastcall *)(cocos2d::CCSprite *, int))v21->setScale)(v21, 1053609165);
v23 = v21->setPosition;
cocos2d::CCPoint::CCPoint(&v89, -140.0, 105.0);
cocos2d::CCPoint::operator+(&v90, &v85, &v89);
v23(v21, &v90.origin);
sub_774008(&v88);
}
BrowserItem = GJItemIcon::createBrowserItem(a3, a2);
((void (__fastcall *)(GJItemIcon *, int))BrowserItem->setScale)(BrowserItem, 1067450368);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, BrowserItem, 12);
v25 = BrowserItem->setPosition;
cocos2d::CCPoint::CCPoint(&v89, 0.0, 56.0);
cocos2d::CCPoint::operator+(&v90, &v85, &v89);
v25(BrowserItem, &v90.origin);
v26 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v26;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v26, 10);
v28 = ButtonSprite::create((ButtonSprite *)"OK", v27);
v89.y = 0.0;
LODWORD(v89.x) = ItemInfoPopup::onClose;
v29 = CCMenuItemSpriteExtra::create(
v28,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(ItemInfoPopup::onClose, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v29);
m_buttonMenu = a1->m_buttonMenu;
v31 = m_buttonMenu->setPosition;
cocos2d::CCPoint::CCPoint(&v90.origin, v84.width * 0.5, (float)((float)(v84.height * 0.5) - 115.0) + 25.0);
v31(m_buttonMenu, &v90.origin);
v32 = GameStatsManager::sharedState();
ItemUnlockState = GameStatsManager::getItemUnlockState(v32, a2, a3);
v34 = GameManager::sharedState();
v35 = GameManager::sharedState();
v36 = GameManager::unlockTypeToIconType(v35, a3);
isIconUnlocked = GameManager::isIconUnlocked(v34, a2, v36);
sub_776584((int)&v80, (char *)&unk_939830);
sub_776584((int)&v81, (char *)&unk_939830);
sub_776584((int)&v82, (char *)&unk_939830);
switch ( ItemUnlockState )
{
case 5:
sub_7753D4((int)&v82, "Secret Shop");
v37 = "There may or may not exist a shop where you can buy this %s.";
LABEL_22:
v38 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)v37, v77);
v39 = (char *)cocos2d::CCString::getCString(v38);
v40 = (cocos2d::CCLabelBMFont **)&v80;
LABEL_49:
sub_7753D4((int)v40, v39);
break;
case 6:
sub_7753D4((int)&v82, "Community Shop");
v37 = "You can buy this %s in the community shop!";
goto LABEL_22;
case 7:
sub_7753D4((int)&v82, "Mechanic Shop");
v37 = "You can buy this %s at the Mechanic!";
goto LABEL_22;
case 8:
sub_7753D4((int)&v82, "Diamond Shop");
v37 = "You can buy this %s in the diamond shop!";
goto LABEL_22;
case 4:
sub_7753D4((int)&v82, "Shop");
v37 = "You can buy this %s in the shop!";
goto LABEL_22;
case 2:
sub_7753D4((int)&v82, "Secret Chest");
v41 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"You can find this %s in a secret chest!",
v77);
v42 = (char *)cocos2d::CCString::getCString(v41);
sub_7753D4((int)&v80, v42);
sub_7753D4((int)&v81, (char *)&unk_939830);
v43 = rand();
v40 = &v81;
switch ( (int)(float)(vcvts_n_f32_s32(v43, 0x1Fu) * 10.0) )
{
case 1:
v39 = "Nothing happened.";
break;
case 2:
v39 = "Without a key, it cannot be.";
break;
case 3:
v39 = "Why you click?";
break;
case 4:
v39 = "You are not yet ready.";
break;
case 5:
v39 = "A key, you must have.";
break;
case 6:
v39 = "The lock wont budge.";
break;
case 7:
v39 = "A demon guards it. Find him.";
break;
case 8:
v39 = "You have no power here.";
break;
case 9:
v39 = "Forget about this one.";
break;
default:
v39 = "A key... My kingdom for a key...";
break;
}
goto LABEL_49;
case 3:
sub_7753D4((int)&v82, "Special Chest");
v44 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"You can find this %s in a special chest!",
v77);
v45 = (char *)cocos2d::CCString::getCString(v44);
sub_7753D4((int)&v80, v45);
sub_7753D4((int)&v81, (char *)&unk_939830);
v46 = rand();
v40 = &v81;
switch ( (int)(float)(vcvts_n_f32_s32(v46, 0x1Fu) * 10.0) )
{
case 1:
v39 = "That wont work.";
break;
case 2:
v39 = "You must do something.";
break;
case 3:
v39 = "It cannot be done.";
break;
case 4:
v39 = "Prove that you are worthy.";
break;
case 5:
v39 = "Need. More. Power.";
break;
case 6:
v39 = "Player used tap.\nIt's not very effective.";
break;
case 7:
v39 = "A wild lock appeared!";
break;
case 8:
v39 = "You are not ready.";
break;
case 9:
v39 = "ehehehehehe...";
break;
default:
v39 = "IMPOSSIBRU!";
break;
}
goto LABEL_49;
case 1:
GJGarageLayer::titleForUnlock((int)&v87, a2, a3);
sub_774794(&v82, &v87);
sub_774008(&v87);
GJGarageLayer::descriptionForUnlock((int)&v90, a2, a3);
v47 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s to unlock this %s!",
(const char *)LODWORD(v90.origin.x),
v77);
v48 = (char *)cocos2d::CCString::getCString(v47);
sub_7753D4((int)&v80, v48);
sub_774008(&v90);
goto LABEL_58;
}
v49 = GameStatsManager::sharedState();
GameStatsManager::getSpecialUnlockDescription((GameStatsManager *)&v90, (int)v49, (UnlockType)a2, a3);
if ( *(_DWORD *)(LODWORD(v90.origin.x) - 12) )
{
v50 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s to unlock this %s!",
(const char *)LODWORD(v90.origin.x),
v77);
v51 = (char *)cocos2d::CCString::getCString(v50);
sub_7753D4((int)&v80, v51);
sub_7753D4((int)&v81, (char *)&unk_939830);
}
sub_774008(&v90);
if ( isIconUnlocked )
{
if ( ItemUnlockState || !ItemInfoPopup::isUnlockedByDefault(a1, a2, a3) )
goto LABEL_58;
sub_7753D4((int)&v82, "Default");
v67 = "This %s is unlocked by default.";
}
else
{
if ( ItemUnlockState || *(_DWORD *)(v80 - 12) )
goto LABEL_58;
rand();
switch ( lroundf() )
{
case 0:
v68 = "Soon...";
break;
case 1:
v68 = "Not yet";
break;
case 2:
v68 = "Huh?";
break;
case 3:
v68 = "Stay tuned!";
break;
case 4:
v68 = "Coming soon!";
break;
case 5:
v68 = "In the oven";
break;
case 6:
v68 = "It's cooking";
break;
case 7:
v68 = "Wait for it";
break;
case 8:
v68 = "Not now";
break;
case 9:
v68 = "Unavailable";
break;
case 10:
v68 = "Almost there";
break;
default:
v68 = "Soon...";
break;
}
sub_7753D4((int)&v82, v68);
v67 = "This %s can be unlocked in update 2.21.";
}
v69 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)v67, v77);
v70 = (char *)cocos2d::CCString::getCString(v69);
sub_7753D4((int)&v80, v70);
LABEL_58:
if ( *(_DWORD *)(v80 - 12) )
{
sub_775C20(&v88);
cocos2d::CCPoint::CCPoint(&v90.origin, 0.5, 1.0);
v52 = (cocos2d::CCNode *)TextArea::create(
(TextArea *)&v88,
(std::string)"bigFont.fnt",
(const char *)0x3F800000,
1142292480,
&v90.origin,
(cocos2d::CCPoint)1109917696LL);
sub_774008(&v88);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v52, 10);
v53 = v52->setPosition;
cocos2d::CCPoint::CCPoint(&v88, 0.0, -2.0);
cocos2d::CCPoint::operator+(&v90, &v86, &v88);
v53(v52, &v90.origin);
((void (__fastcall *)(cocos2d::CCNode *, int))v52->setScale)(v52, 1053609165);
if ( v81[-1].m_pTargetArray )
{
v54 = cocos2d::CCLabelBMFont::create();
v75 = v54->setPosition;
cocos2d::CCPoint::CCPoint(&v88, 0.0, -35.0);
cocos2d::CCPoint::operator+(&v90, &v86, &v88);
v75(v54, &v90.origin);
a1->m_mainLayer->addChild(a1->m_mainLayer, v54);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v54->setScale)(v54, 1058642330);
v54->setColor(v54, (const cocos2d::ccColor3B *)&unk_9AB29B);
v54->setOpacity(v54, 75);
v76 = v52->setPosition;
v55 = (int)v52->getPosition(v52);
cocos2d::CCPoint::CCPoint(&v88, 0.0, 5.0);
cocos2d::CCPoint::operator+(&v90, v55, &v88);
v76(v52, &v90.origin);
}
}
if ( v82[-1].m_wraithIcons._M_t._M_impl._M_node_count )
{
v58 = cocos2d::CCLabelBMFont::create();
v59 = v58->setPosition;
cocos2d::CCPoint::CCPoint(&v88, 0.0, 30.0);
cocos2d::CCPoint::operator+(&v90, &v86, &v88);
v59(v58, &v90.origin);
a1->m_mainLayer->addChild(a1->m_mainLayer, v58);
cocos2d::CCLabelBMFont::limitLabelWidth(v58, 180.0, 0.55, 0.0);
if ( ItemUnlockState == 4 )
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v58->setScale)(v58, 1058642330);
}
v56 = GameStatsManager::sharedState();
v57 = GameStatsManager::accountIDForIcon(v56, a2, a3);
a1->m_accountID = v57;
if ( v57 )
{
v60 = GameStatsManager::sharedState();
GameStatsManager::usernameForAccountID((GameStatsManager *)&v83, (int)v60);
if ( *((_DWORD *)v83 - 3) )
{
v61 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"By %s", v83);
cocos2d::CCString::getCString(v61);
v62 = cocos2d::CCLabelBMFont::create();
cocos2d::CCPoint::CCPoint(
&v87,
(float)((float)(v84.width * 0.5) + 150.0) - 60.0,
(float)((float)(v84.height * 0.5) - 115.0) + 21.0);
cocos2d::CCLabelBMFont::limitLabelWidth(v62, 100.0, 0.5, 0.0);
LODWORD(v90.origin.x) = ItemInfoPopup::onCredit;
v90.origin.y = 0.0;
v63 = CCMenuItemSpriteExtra::create(
v62,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(ItemInfoPopup::onCredit, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v63);
v64 = v63->setPosition;
cocos2d::CCNode::convertToNodeSpace(&v88, a1->m_buttonMenu, &v87);
v64(v63, &v88);
if ( a1->m_accountID <= 0 )
{
setColor = v62->setColor;
LOWORD(v88.x) = -166;
BYTE2(v88.x) = -1;
setColor(v62, (const cocos2d::ccColor3B *)&v88);
v63->setEnabled(v63, 0);
}
}
sub_774008(&v83);
}
sub_774008(&v82);
sub_774008(&v81);
sub_774008(&v80);
sub_774008(&v79);
sub_774008(&v78);
sub_774008(&v77);
return v73;
}