//
// GJPromoPopup::init from 0x5dedcc to 0x5defa6 (474 bytes)
//
// 1 xrefs:
// > GJPromoPopup::create @ 0x5df03e
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:54:14 +0000
//
int __fastcall GJPromoPopup::init(int a1, unsigned __int8 *a2)
{
unsigned __int8 *v3; // r0
cocos2d::CCTextureCache *v4; // r0
const char *v5; // r1
int v6; // r9
cocos2d::CCDirector *v7; // r0
cocos2d::CCLayer *WinSize; // r0
int v9; // r0
int v10; // r3
const char *v11; // r1
cocos2d::CCSprite *v12; // r0
int v13; // r5
void (__fastcall *v14)(int, _BYTE *); // r7
const char *v15; // r1
int v16; // r0
cocos2d::CCMenu *v17; // r10
int v18; // r0
float v19; // s18
int v20; // r7
void (__fastcall *v21)(int, _BYTE *); // r10
float v22; // s20
int v23; // r0
float v24; // s17
float v25; // s21
float v26; // s19
float v27; // r0
float v29; // [sp+Ch] [bp-1Ch] BYREF
float v30; // [sp+10h] [bp-18h]
int (__fastcall *v31)(GJPromoPopup *, cocos2d::CCObject *); // [sp+14h] [bp-14h]
int v32; // [sp+18h] [bp-10h]
_BYTE v33[8]; // [sp+1Ch] [bp-Ch] BYREF
v3 = std::string::operator=((unsigned __int8 *)(a1 + 520), a2);
v4 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache((cocos2d::CCTextureCache *)v3);
if ( (*(_BYTE *)(a1 + 520) & 1) != 0 )
v5 = *(const char **)(a1 + 528);
else
v5 = (const char *)(a1 + 521);
cocos2d::CCTextureCache::addImage(v4, v5, 0);
FLAlertLayer::incrementForcePrio((cocos2d::CCObject *)a1);
v33[0] = 0;
v33[1] = 0;
v33[2] = 0;
v33[3] = -81;
v6 = cocos2d::CCLayerColor::initWithColor(a1, v33);
if ( v6 )
{
(*(void (__fastcall **)(int, int))(*(_DWORD *)a1 + 500))(a1, 1);
v7 = (cocos2d::CCDirector *)(*(int (__fastcall **)(int, int))(*(_DWORD *)a1 + 536))(a1, 1);
cocos2d::CCDirector::sharedDirector(v7);
WinSize = (cocos2d::CCLayer *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v29);
v9 = cocos2d::CCLayer::create(WinSize);
v10 = *(_DWORD *)a1;
*(_DWORD *)(a1 + 460) = v9;
(*(void (__fastcall **)(int, int))(v10 + 228))(a1, v9);
if ( (*(_BYTE *)(a1 + 520) & 1) != 0 )
v12 = *(cocos2d::CCSprite **)(a1 + 528);
else
v12 = (cocos2d::CCSprite *)(a1 + 521);
v13 = cocos2d::CCSprite::create(v12, v11);
(*(void (__fastcall **)(_DWORD, int, int))(**(_DWORD **)(a1 + 460) + 232))(*(_DWORD *)(a1 + 460), v13, -1);
v14 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v13 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v33, v29 * 0.5, v30 * 0.5);
v14(v13, v33);
*(_DWORD *)(a1 + 500) = -1;
v16 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v15);
v31 = GJPromoPopup::onClose;
v32 = 0;
v17 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(v16, 0, a1, (int)GJPromoPopup::onClose, 0);
CCMenuItemSpriteExtra::setSizeMult((int)v17, 1.6);
v18 = cocos2d::CCMenu::create(v17, nullptr);
v19 = v29 * 0.5;
*(_DWORD *)(a1 + 444) = v18;
v20 = v18;
v21 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v18 + 92);
v22 = *(float *)(*(int (__fastcall **)(int))(*(_DWORD *)v13 + 164))(v13);
v23 = (*(int (__fastcall **)(int))(*(_DWORD *)v13 + 84))(v13);
v24 = v30 * 0.5;
v25 = *(float *)&v23;
v26 = *(float *)((*(int (__fastcall **)(int))(*(_DWORD *)v13 + 164))(v13) + 4);
v27 = (*(float (__fastcall **)(int))(*(_DWORD *)v13 + 84))(v13);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v33,
(float)(v19 - (float)((float)(v22 * v25) * 0.5)) + 12.0,
(float)(v24 + (float)((float)(v26 * v27) * 0.5)) - 12.0);
v21(v20, v33);
(*(void (__fastcall **)(_DWORD, _DWORD, int))(**(_DWORD **)(a1 + 460) + 232))(
*(_DWORD *)(a1 + 460),
*(_DWORD *)(a1 + 444),
10);
}
return v6;
}