//
// GJShopLayer::didPurchaseItem from 0x1403b28d0 to 0x1403b30b4 (2020 bytes)
//
// 2 xrefs:
// > ??> @ 0x140781030
// > ??> @ 0x140923c18
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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:31:23 +0000
//
// Hidden C++ exception states: #wind=5
__int64 __fastcall GJShopLayer::didPurchaseItem(__int64 a1, _DWORD *a2)
{
int v4; // ecx
__int16 *v5; // rdx
size_t v6; // r8
void **v7; // rdi
__int64 v8; // rcx
__int64 v9; // rbx
int Stat; // eax
void *v11; // rcx
struct cocos2d::CCObject *v12; // rax
__int64 v13; // rcx
struct cocos2d::CCObject *v14; // rdi
__int64 v15; // rbx
cocos2d::CCArray *v16; // rax
cocos2d::CCArray *v17; // rsi
unsigned int v18; // edi
struct cocos2d::CCObject *v19; // rbx
__int64 result; // rax
cocos2d::CCArray *v21; // rbx
void **v22; // rax
void **v23; // rax
void **v24; // rax
void **v25; // rax
void **v26; // rax
cocos2d::CCLayerColor *DialogLayer; // rsi
__int64 v28; // rcx
__int64 v29; // rax
__int64 v30; // rdi
__int64 v31; // rbx
__int64 v32; // rax
_QWORD v33[2]; // [rsp+38h] [rbp-39h] BYREF
__int128 *v34; // [rsp+48h] [rbp-29h] BYREF
__int128 v35; // [rsp+50h] [rbp-21h] BYREF
__int64 v36; // [rsp+60h] [rbp-11h]
__int64 v37; // [rsp+68h] [rbp-9h]
void *Block[2]; // [rsp+70h] [rbp-1h] BYREF
__int64 v39; // [rsp+80h] [rbp+Fh]
unsigned __int64 v40; // [rsp+88h] [rbp+17h]
v33[0] = Block;
v39 = 13;
v40 = 15;
strcpy((char *)Block, "buyItem03.ogg");
HIWORD(Block[1]) = 0;
v4 = qword_14090BF60;
if ( !qword_14090BF60 )
{
v34 = (__int128 *)operator new(0x8A8u);
qword_14090BF60 = FMODAudioEngine::FMODAudioEngine((__int64)v34);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BF60 + 72LL))(qword_14090BF60);
v4 = qword_14090BF60;
}
FMODAudioEngine::playEffect_1(v4, (__int64)Block);
v5 = &word_140737D98;
if ( a2[92] == 4 )
v5 = &word_14075A858;
*(_OWORD *)Block = 0;
v39 = 0;
v40 = 0;
v6 = -1;
do
++v6;
while ( *((_BYTE *)v5 + v6) );
sub_14003D230(Block, v5, v6);
v7 = Block;
if ( v40 > 0xF )
v7 = (void **)Block[0];
v8 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v34 = (__int128 *)operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v34);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v8 = qword_14090BFE0;
}
v9 = *(_QWORD *)(a1 + 32);
Stat = GameStatsManager::getStat(v8, v7);
CCCounterLabel::setTargetCount(v9, Stat);
if ( v40 > 0xF )
{
v11 = Block[0];
if ( v40 + 1 >= 0x1000 )
{
v11 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v11 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v11);
}
v12 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 40), a2[80] - a2[81]);
v14 = v12;
if ( v12 )
{
v15 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v12 + 952LL))(v12);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v14 + 936LL))(v14, 0);
GJItemIcon::darkenStoreItem_1(v15, *(_DWORD *)(a1 + 48));
v16 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v15 + 480LL))(v15);
v17 = v16;
if ( v16 )
{
v18 = 0;
if ( cocos2d::CCArray::count(v16) )
{
do
{
v19 = cocos2d::CCArray::objectAtIndex(v17, v18);
if ( (*(unsigned int (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v19 + 56LL))(v19) == 1234 )
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v19 + 336LL))(v19, 0);
++v18;
}
while ( v18 < cocos2d::CCArray::count(v17) );
}
}
}
result = (unsigned int)(a2[86] - a2[87]);
if ( (_DWORD)result == 12 )
{
result = (unsigned int)(a2[83] - a2[84]);
if ( (_DWORD)result == 4 )
{
v21 = (cocos2d::CCArray *)cocos2d::CCArray::create(v13);
v34 = &v35;
LOWORD(v33[0]) = -1;
BYTE2(v33[0]) = -1;
v35 = 0;
v36 = 0;
v37 = 0;
*(_QWORD *)&v35 = sub_14003D460(0x30u);
v36 = 45;
v37 = 47;
strcpy((char *)v35, "Ah the shiny thing, excellent choice.");
Block[1] = nullptr;
v39 = 7;
v40 = 15;
Block[0] = (void *)0x68637461726353LL;
v22 = DialogObject::create((__int64)Block, (__int64)&v35, 10, 1.0, 0, (__int64)v33);
cocos2d::CCArray::addObject(v21, (struct cocos2d::CCObject *)v22);
v34 = &v35;
LOWORD(v33[0]) = -1;
BYTE2(v33[0]) = -1;
v35 = 0;
v36 = 0;
v37 = 0;
*(_QWORD *)&v35 = sub_14003D460(0x60u);
v36 = 80;
v37 = 95;
strcpy((char *)v35, "I found it a while ago.\nYea... 'Found' is a good word...");
Block[1] = nullptr;
v39 = 7;
v40 = 15;
Block[0] = (void *)0x68637461726353LL;
v23 = DialogObject::create((__int64)Block, (__int64)&v35, 13, 1.0, 0, (__int64)v33);
cocos2d::CCArray::addObject(v21, (struct cocos2d::CCObject *)v23);
v34 = &v35;
LOWORD(v33[0]) = -1;
BYTE2(v33[0]) = -1;
v35 = 0;
v36 = 0;
v37 = 0;
*(_QWORD *)&v35 = sub_14003D460(0x50u);
v36 = 66;
v37 = 79;
strcpy((char *)v35, "Not sure what it does. If anyone asks you didnt buy it here.");
Block[1] = nullptr;
v39 = 7;
v40 = 15;
Block[0] = (void *)0x68637461726353LL;
v24 = DialogObject::create((__int64)Block, (__int64)&v35, 11, 1.0, 0, (__int64)v33);
cocos2d::CCArray::addObject(v21, (struct cocos2d::CCObject *)v24);
v34 = &v35;
LOWORD(v33[0]) = -1;
BYTE2(v33[0]) = -1;
v35 = 0;
v36 = 0;
v37 = 0;
*(_QWORD *)&v35 = sub_14003D460(0x20u);
v36 = 27;
v37 = 31;
strcpy((char *)v35, "I mean, buy it where?");
Block[1] = nullptr;
v39 = 7;
v40 = 15;
Block[0] = (void *)0x68637461726353LL;
v25 = DialogObject::create((__int64)Block, (__int64)&v35, 13, 1.0, 0, (__int64)v33);
cocos2d::CCArray::addObject(v21, (struct cocos2d::CCObject *)v25);
v34 = &v35;
LOWORD(v33[0]) = -1;
BYTE2(v33[0]) = -1;
v35 = 0;
v36 = 0;
v37 = 0;
*(_QWORD *)&v35 = sub_14003D460(0x20u);
v36 = 21;
v37 = 31;
strcpy((char *)v35, "...");
Block[1] = nullptr;
v39 = 7;
v40 = 15;
Block[0] = (void *)0x68637461726353LL;
v26 = DialogObject::create((__int64)Block, (__int64)&v35, 8, 1.0, 0, (__int64)v33);
cocos2d::CCArray::addObject(v21, (struct cocos2d::CCObject *)v26);
DialogLayer = DialogLayer::createDialogLayer(0, (__int64)v21, 2u);
(*(void (__fastcall **)(__int64, cocos2d::CCLayerColor *, __int64))(*(_QWORD *)(a1 - 408) + 456LL))(
a1 - 408,
DialogLayer,
100);
v29 = cocos2d::CCDirector::sharedDirector(v28);
cocos2d::CCDirector::getWinSize(v29, v33);
v30 = **((_QWORD **)DialogLayer + 70);
v31 = *((_QWORD *)DialogLayer + 70);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v34, *(float *)v33 * 0.5, *((float *)v33 + 1) * 0.5);
(*(void (__fastcall **)(__int64, __int64))(v30 + 184))(v31, v32);
return DialogLayer::animateInRandomSide(DialogLayer);
}
}
return result;
}