//
// GJPromoPopup::init from 0x4b38b4 to 0x4b3a6e (442 bytes)
//
// 1 xrefs:
// > GJPromoPopup::create @ 0x4b3afa
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall GJPromoPopup::init(int *a1, int a2)
{
cocos2d::CCTextureCache *v3; // r0
int v4; // r9
cocos2d::CCDirector *v5; // r0
cocos2d::CCLayer *v6; // r0
int v7; // r3
const char *v8; // r1
int v9; // r5
void (__fastcall *v10)(int, cocos2d::CCPoint *); // r10
cocos2d::CCSprite *v11; // r0
CCMenuItemSpriteExtra *v12; // r10
_DWORD *v13; // r0
float v14; // s18
int v15; // r3
_DWORD *v16; // r6
void (__fastcall *v17)(_DWORD *, cocos2d::CCPoint *); // r10
float v18; // s20
int v19; // r0
float v20; // s17
float v21; // s21
float v22; // s19
float v23; // r0
cocos2d::CCSize v25; // [sp+Ch] [bp-1Ch] BYREF
void (*v26)(GJPromoPopup *, cocos2d::CCObject *); // [sp+14h] [bp-14h]
int v27; // [sp+18h] [bp-10h]
cocos2d::CCPoint v28; // [sp+1Ch] [bp-Ch] BYREF
sub_775D40(a1 + 124, a2);
v3 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v3, (const char *)a1[124], 0);
FLAlertLayer::incrementForcePrio((FLAlertLayer *)a1);
v28.x = -1.1642e-10;
v4 = cocos2d::CCLayerColor::initWithColor((cocos2d::CCLayerColor *)a1, (const cocos2d::_ccColor4B *)&v28);
if ( v4 )
{
(*(void (__fastcall **)(int *, int))(*a1 + 492))(a1, 1);
(*(void (__fastcall **)(int *, int))(*a1 + 528))(a1, 1);
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v25, v5);
v6 = cocos2d::CCLayer::create();
v7 = *a1;
a1[114] = (int)v6;
(*(void (__fastcall **)(int *, cocos2d::CCLayer *))(v7 + 220))(a1, v6);
v9 = cocos2d::CCSprite::create((cocos2d::CCSprite *)a1[124], v8);
(*(void (__fastcall **)(int, int, int))(*(_DWORD *)a1[114] + 224))(a1[114], v9, -1);
v10 = *(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v9 + 92);
cocos2d::CCPoint::CCPoint(&v28, v25.width * 0.5, v25.height * 0.5);
v10(v9, &v28);
a1[122] = -1;
v11 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v26 = GJPromoPopup::onClose;
v27 = 0;
v12 = CCMenuItemSpriteExtra::create(
v11,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(GJPromoPopup::onClose, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v12, 1.6);
v13 = (_DWORD *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v12, nullptr);
v14 = v25.width * 0.5;
v15 = *v13;
v16 = v13;
a1[110] = (int)v13;
v17 = *(void (__fastcall **)(_DWORD *, cocos2d::CCPoint *))(v15 + 92);
v18 = *(float *)(*(int (__fastcall **)(int))(*(_DWORD *)v9 + 156))(v9);
v19 = (*(int (__fastcall **)(int))(*(_DWORD *)v9 + 84))(v9);
v20 = v25.height * 0.5;
v21 = *(float *)&v19;
v22 = *(float *)((*(int (__fastcall **)(int))(*(_DWORD *)v9 + 156))(v9) + 4);
v23 = (*(float (__fastcall **)(int))(*(_DWORD *)v9 + 84))(v9);
cocos2d::CCPoint::CCPoint(
&v28,
(float)(v14 - (float)((float)(v18 * v21) * 0.5)) + 12.0,
(float)(v20 + (float)((float)(v22 * v23) * 0.5)) - 12.0);
v17(v16, &v28);
(*(void (__fastcall **)(int, int, int))(*(_DWORD *)a1[114] + 224))(a1[114], a1[110], 10);
}
return v4;
}