//
// GJPathsLayer::onPath from 0x140392ec0 to 0x140393112 (594 bytes)
//
// 3 xrefs:
// > GJPathsLayer::init @ 0x140392cf5
// > ??> @ 0x14092306c
// > ??> @ 0x140923078
//
// 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:11 +0000
//
// Hidden C++ exception states: #wind=5
void __fastcall GJPathsLayer::onPath(__int64 a1, __int64 a2)
{
__int64 v3; // rdi
_BYTE *v4; // rax
__int64 v5; // rbx
_QWORD *v6; // rax
int Stat; // ebx
__int64 v8; // rcx
__int64 v9; // rbx
_QWORD *v10; // rax
bool isSpecialChestUnlocked; // bl
_QWORD *v12; // rbx
__int64 (__fastcall *v13)(__int64); // rdx
void *v14; // [rsp+20h] [rbp-78h]
void *v15; // [rsp+20h] [rbp-78h]
_BYTE v16[32]; // [rsp+28h] [rbp-70h] BYREF
_QWORD v17[4]; // [rsp+48h] [rbp-50h] BYREF
_QWORD v18[4]; // [rsp+68h] [rbp-30h] BYREF
v3 = (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a2 + 56LL))(a2);
v4 = (_BYTE *)GJPathPage::create(v3, a1);
v4[596] = 1;
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)v4 + 1064LL))(v4);
v5 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v14 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v5 = qword_14090BFE0;
}
v6 = GameToolbox::intToString(v18, (int)v3 + 29);
if ( v6[3] > 0xFu )
v6 = (_QWORD *)*v6;
Stat = GameStatsManager::getStat(v5, v6);
sub_14003D310((__int64)v18);
if ( Stat >= 1000 )
{
v9 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v15 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v9 = qword_14090BFE0;
}
GameStatsManager::getPathRewardKey(v8, v17, v3);
v10 = (_QWORD *)sub_14003F4F0((__int64)v16, (__int64)v17);
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v9, v10);
sub_14003D310((__int64)v17);
if ( !isSpecialChestUnlocked )
{
v12 = operator new(0x2A0u);
FLAlertLayer::FLAlertLayer((__int64)v12);
*v12 = &GJPathRewardPopup::`vftable';
v12[40] = &GJPathRewardPopup::`vftable';
v12[41] = &GJPathRewardPopup::`vftable';
v12[42] = &GJPathRewardPopup::`vftable';
v12[43] = &GJPathRewardPopup::`vftable';
v12[44] = &GJPathRewardPopup::`vftable';
v12[51] = &GJPathRewardPopup::`vftable';
v12[54] = &GJPathRewardPopup::`vftable';
v12[68] = &GJPathRewardPopup::`vftable';
*((_DWORD *)v12 + 166) = 0;
if ( (unsigned __int8)GJPathRewardPopup::init(v12, (unsigned int)v3) )
{
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v12);
}
else
{
(*(void (__fastcall **)(_QWORD *, __int64))(*v12 + 8LL))(v12, 1);
v12 = nullptr;
}
v13 = *(__int64 (__fastcall **)(__int64))(*v12 + 1064LL);
if ( v13 == FLAlertLayer::show )
FLAlertLayer::show((__int64)v12);
else
v13((__int64)v12);
}
}
}