//
// GJShopLayer::dialogClosed from 0x1403b49c0 to 0x1403b4cfb (827 bytes)
//
// 3 xrefs:
// > ??> @ 0x140780a08
// > ??> @ 0x140923c30
// > ??> @ 0x140923c3c
//
// 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:24 +0000
//
// Hidden C++ exception states: #wind=5
char __fastcall GJShopLayer::dialogClosed(__int64 a1, __int64 a2)
{
__int64 v4; // r8
__int64 v5; // r9
int v6; // ecx
struct cocos2d::CCLayerColor *v7; // rax
_QWORD *v8; // rbx
__int64 v9; // rcx
__int64 v10; // rcx
__int64 v11; // rax
cocos2d::CCTouchDispatcher *v12; // rax
__int64 v13; // rdx
__int64 v14; // rcx
__int64 v15; // r8
__int64 v16; // r9
struct cocos2d::CCScene *v17; // rax
struct cocos2d::CCScene *v18; // rbx
__int64 v19; // rcx
cocos2d::CCDirector *v20; // rax
__int64 v21; // rax
__int64 v22; // rcx
__int64 v23; // rdi
__int64 v24; // rbx
cocos2d::CCObject *v25; // rcx
__int128 v27; // [rsp+30h] [rbp-28h] BYREF
__int64 v28; // [rsp+40h] [rbp-18h]
__int64 v29; // [rsp+48h] [rbp-10h]
__int128 *v30; // [rsp+68h] [rbp+10h] BYREF
void *v31; // [rsp+70h] [rbp+18h]
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a2 + 56LL))(a2) == 1 )
{
v30 = &v27;
v28 = 11;
v29 = 15;
*(_QWORD *)&v27 = 0x2E313030726F6F64LL;
*((_QWORD *)&v27 + 1) = 6776687;
v6 = qword_14090BF60;
if ( !qword_14090BF60 )
{
v31 = operator new(0x8A8u);
qword_14090BF60 = FMODAudioEngine::FMODAudioEngine((__int64)v31);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BF60 + 72LL))(qword_14090BF60);
v6 = qword_14090BF60;
}
FMODAudioEngine::playEffect(v6, (__int64)&v27, v4, v5, 1061997773);
LODWORD(v30) = -16777216;
v7 = cocos2d::CCLayerColor::create((const struct cocos2d::_ccColor4B *)&v30);
(*(void (__fastcall **)(__int64, struct cocos2d::CCLayerColor *, __int64))(*(_QWORD *)(a1 - 416) + 456LL))(
a1 - 416,
v7,
1000);
v8 = (_QWORD *)qword_14090BF60;
if ( !qword_14090BF60 )
{
v30 = (__int128 *)operator new(0x8A8u);
qword_14090BF60 = FMODAudioEngine::FMODAudioEngine((__int64)v30);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BF60 + 72LL))(qword_14090BF60);
v8 = (_QWORD *)qword_14090BF60;
}
v9 = v8[69];
if ( v9 )
FMOD::ChannelControl::stop(v9);
sub_14003EB60(v8 + 137);
sub_14003EB60(v8 + 145);
sub_14003EB60(v8 + 153);
v11 = cocos2d::CCDirector::sharedDirector(v10);
v12 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v11 + 144LL))(v11);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v12, (struct cocos2d::CCObject *)(a1 - 416));
v17 = (struct cocos2d::CCScene *)GJGarageLayer::scene(v14, v13, v15, v16);
v18 = cocos2d::CCTransitionFade::create(1.0, v17);
v20 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v19);
LOBYTE(v21) = cocos2d::CCDirector::replaceScene(v20, v18);
}
else
{
LODWORD(v21) = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 56LL))(a2);
if ( (_DWORD)v21 == 2 )
{
v30 = &v27;
v27 = 0;
v28 = 4;
v29 = 15;
strcpy((char *)&v27, "0022");
v22 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v31 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v31);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v22 = qword_14090BFE0;
}
v21 = GameStatsManager::unlockSpecialChest(v22, (__int64)&v27);
v23 = v21;
if ( v21 )
{
v24 = RewardUnlockLayer::create(*(unsigned int *)(v21 + 64), 0);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)(a1 - 416) + 456LL))(a1 - 416, v24, 100);
v25 = *(cocos2d::CCObject **)(v24 + 704);
if ( v25 )
cocos2d::CCObject::release(v25);
*(_QWORD *)(v24 + 704) = v23;
cocos2d::CCObject::retain((cocos2d::CCObject *)v23);
if ( !*(_BYTE *)(v23 + 80) || (LODWORD(v21) = *(_DWORD *)(v24 + 696), *(_DWORD *)(v23 + 64) == (_DWORD)v21) )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v24 + 720) + 336LL))(*(_QWORD *)(v24 + 720), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v24 + 720) + 936LL))(*(_QWORD *)(v24 + 720), 0);
LOBYTE(v21) = (*(__int64 (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v24 + 712) + 336LL))(
*(_QWORD *)(v24 + 712),
0);
*(_BYTE *)(v24 + 700) = 1;
if ( *(_BYTE *)(v24 + 701) )
LOBYTE(v21) = RewardUnlockLayer::playRewardEffect(v24);
}
}
}
}
return v21;
}