//
// GJPromoPopup::init from 0x1403aabf0 to 0x1403aaec7 (727 bytes)
//
// 2 xrefs:
// > CreatorLayer::onAdventureMap @ 0x140138258
// > ??> @ 0x1409239fc
//
// 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:20 +0000
//
// Hidden C++ exception states: #wind=1
char __fastcall GJPromoPopup::init(__int64 a1, _QWORD *a2)
{
__int64 v2; // rbp
const char *v4; // rbx
const char *v5; // rdi
cocos2d::CCTextureCache *v6; // rax
__int64 v7; // rdx
__int64 v9; // rdx
__int64 v10; // rcx
__int64 v11; // rax
__int64 v12; // rax
struct cocos2d::CCSprite *v13; // r14
__int64 v14; // rbx
__int64 v15; // rax
int v16; // eax
cocos2d::CCObject *v17; // rax
struct cocos2d::CCMenu *v18; // rbx
float *v19; // rdi
__int64 v20; // rsi
float v21; // xmm6_4
float v22; // xmm0_4
float v23; // xmm9_4
float v24; // xmm8_4
float v25; // xmm6_4
float v26; // xmm8_4
__int64 v27; // rbx
__int64 v28; // rax
float v29; // [rsp+20h] [rbp-88h] BYREF
float v30; // [rsp+24h] [rbp-84h]
int v31; // [rsp+28h] [rbp-80h] BYREF
_QWORD *v32; // [rsp+30h] [rbp-78h]
v2 = (__int64)a2;
v32 = a2;
v4 = (const char *)(a1 + 664);
if ( (_QWORD *)(a1 + 664) != a2 )
{
if ( a2[3] > 0xFu )
a2 = (_QWORD *)*a2;
sub_1400405A0((void **)(a1 + 664), a2, *(_QWORD *)(v2 + 16));
}
v5 = v4;
if ( *((_QWORD *)v4 + 3) > 0xFu )
v5 = *(const char **)v4;
v6 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v6, v5, 0);
FLAlertLayer::incrementForcePrio((struct cocos2d::CCObject *)a1);
v31 = -1358954496;
if ( cocos2d::CCLayerColor::initWithColor((cocos2d::CCLayerColor *)a1, (const struct cocos2d::_ccColor4B *)&v31) )
{
LOBYTE(v7) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 920LL))(a1, v7);
LOBYTE(v9) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 992LL))(a1, v9);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, &v29);
v12 = cocos2d::CCLayer::create();
*(_QWORD *)(a1 + 584) = v12;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v12);
if ( *((_QWORD *)v4 + 3) > 0xFu )
v4 = *(const char **)v4;
v13 = cocos2d::CCSprite::create(v4);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCSprite *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v13,
0xFFFFFFFFLL);
v14 = *(_QWORD *)v13;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, v29 * 0.5, v30 * 0.5);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v14 + 184))(v13, v15);
*(_DWORD *)(a1 + 640) = -1;
v16 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v17 = CCMenuItemSpriteExtra::create(v16, 0, a1, (__int64)GJPathRewardPopup::closePopup);
*((_DWORD *)v17 + 93) = 1070386381;
v18 = cocos2d::CCMenu::create(v17, 0);
*(_QWORD *)(a1 + 552) = v18;
v19 = (float *)(*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v13 + 320LL))(v13);
v20 = *(_QWORD *)v18;
v21 = *(float *)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v13 + 320LL))(v13) + 4);
v22 = (*(float (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v13 + 168LL))(v13);
v23 = (float)((float)(v30 * 0.5) + (float)((float)(v22 * v21) * 0.5)) - 12.0;
v24 = v29 * 0.5;
v25 = *v19;
v26 = (float)(v24
- (float)((float)((*(float (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v13 + 168LL))(v13)
* v25)
* 0.5))
+ 12.0;
v27 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, v26, v23);
(*(void (__fastcall **)(__int64, __int64))(v20 + 184))(v27, v28);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 552),
10);
sub_14003D310(v2);
return 1;
}
else
{
sub_14003D310(v2);
return 0;
}
}