//
// GJPathPage::onUnlock from 0xa71e58 to 0xa71fb8 (352 bytes)
//
// 3 xrefs:
// > ??> @ 0x453d8
// > GJPathPage::init @ 0xa7031c
// > ??> @ 0x122a368
//
// 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 GJPathPage::onUnlock(GJPathPage *a1, cocos2d::CCObject *a2)
{
GameStatsManager *v3; // x0
GJStoreItem *StoreItem; // x20
int v5; // w22
GameStatsManager *v6; // x23
int Stat; // w23
char *v8; // x0
PurchaseItemPopup *v9; // x0
PurchaseItemPopup_vtbl *v10; // x2
unsigned int *v11; // x2
int v12; // w1
int v13; // [xsp+48h] [xbp+48h]
char *v14; // [xsp+60h] [xbp+60h] BYREF
v13 = a1->m_pathNumber + 5;
v3 = GameStatsManager::sharedState();
StoreItem = GameStatsManager::getStoreItem(v3, v13);
v5 = StoreItem->m_price.random - StoreItem->m_price.seed;
v6 = GameStatsManager::sharedState();
GJStoreItem::getCurrencyKey(StoreItem, (__int64)&v14);
Stat = GameStatsManager::getStat(v6, v14);
v8 = v14 - 24;
if ( v14 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(v14 - 8);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *((_DWORD *)v14 - 2);
*((_DWORD *)v14 - 2) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v8);
}
if ( Stat < v5 )
{
GJPathPage::showCantAffordMessage(a1, StoreItem);
}
else
{
v9 = PurchaseItemPopup::create(StoreItem);
v10 = v9->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v9->m_delegate = &a1->GJPurchaseDelegate;
((void (*)(void))v10->show)();
}
}