//
// GJShopLayer::onSelectItem from 0x614554 to 0x61460c (184 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:54:54 +0000
//
int __fastcall GJShopLayer::onSelectItem(int this, cocos2d::CCObject *a2)
{
GJShopLayer *v2; // r6
GameStatsManager *v3; // r4
GameStatsManager *v4; // r0
cocos2d::CCDictionary **v5; // r0
GameStatsManager *StoreItem; // r4
int v7; // r8
GameStatsManager *v8; // r9
char *v9; // r1
int Stat; // r9
GJStoreItem *v11; // r1
int *v12; // r0
char v13; // [sp+0h] [bp-14h] BYREF
char v14; // [sp+1h] [bp-13h] BYREF
char *v15; // [sp+8h] [bp-Ch]
v2 = (GJShopLayer *)this;
if ( !*(_BYTE *)(this + 328) )
{
v3 = (GameStatsManager *)(*(int (__fastcall **)(cocos2d::CCObject *))(*(_DWORD *)a2 + 32))(a2);
v4 = (GameStatsManager *)GameStatsManager::sharedState(v3);
this = GameStatsManager::isStoreItemUnlocked(v4, (const char *)v3);
if ( !this )
{
v5 = (cocos2d::CCDictionary **)GameStatsManager::sharedState(nullptr);
StoreItem = (GameStatsManager *)GameStatsManager::getStoreItem(v5, (int)v3);
v7 = *((_DWORD *)StoreItem + 75) - *((_DWORD *)StoreItem + 76);
v8 = (GameStatsManager *)GameStatsManager::sharedState(StoreItem);
GJStoreItem::getCurrencyKey((GJStoreItem *)&v13, (int)StoreItem);
if ( (v13 & 1) != 0 )
v9 = v15;
else
v9 = &v14;
Stat = GameStatsManager::getStat(v8, v9);
std::string::~string((int)&v13);
if ( v7 <= Stat )
{
v12 = PurchaseItemPopup::create(StoreItem, v11);
v12[131] = (int)v2 + 316;
return (*(int (__fastcall **)(int *))(*v12 + 656))(v12);
}
else
{
return GJShopLayer::showCantAffordMessage(v2, StoreItem);
}
}
}
return this;
}