//
// GJBaseGameLayer::createBackground from 0x9994fc to 0x999740 (580 bytes)
//
// 6 xrefs:
// > PlayLayer::setupHasCompleted @ 0x707adc
// > LevelEditorLayer::init @ 0x7af220
// > GJBaseGameLayer::asyncBGLoaded @ 0x99a578
// > GJBaseGameLayer::syncBGTextures @ 0x9a911c
// > LevelSettingsLayer::selectArtClosed @ 0xb61b14
// > ??> @ 0xf0838
//
// This function is hookable on this platform (idp: arm, 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 12:58:03 +0000
//
__int64 __fastcall GJBaseGameLayer::createBackground(GJBaseGameLayer *this, int a2)
{
__int64 v3; // x0
int v4; // w0
unsigned int v5; // w21
GameManager *v6; // x0
GameManager *v7; // x0
cocos2d::CCSprite *v8; // x0
const char *v9; // x1
__int64 v10; // x0
int v11; // w0
__int64 v12; // x1
__int64 v13; // x0
long double v14; // q0
__int64 v15; // x22
void (__fastcall *v16)(__int64, _BYTE *); // x23
AppDelegate **v17; // x22
void (__fastcall *v18)(AppDelegate **); // x23
AppDelegate *v19; // x0
__int64 v20; // x0
void (__fastcall *v21)(__int64, _BYTE *); // x2
float v22; // s8
GameManager *v24; // x0
cocos2d::CCSprite *BGTexture; // x0
const char *v26; // x1
__int64 v27; // x0
int v28; // [xsp+48h] [xbp+48h]
int v29; // [xsp+58h] [xbp+58h] BYREF
int v30; // [xsp+5Ch] [xbp+5Ch]
int v31; // [xsp+60h] [xbp+60h]
int v32; // [xsp+64h] [xbp+64h]
_BYTE v33[8]; // [xsp+68h] [xbp+68h] BYREF
float v34; // [xsp+70h] [xbp+70h]
v3 = *((_QWORD *)this + 493);
if ( v3 )
{
v28 = a2;
v4 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v3 + 64LL))(v3);
a2 = v28;
if ( v4 == v28 )
return _stack_chk_guard;
if ( *((_QWORD *)this + 493) )
{
GJBaseGameLayer::removeBackground((__int64)this);
a2 = v28;
}
}
if ( a2 > 59 )
v5 = 59;
else
v5 = a2;
v6 = (GameManager *)(v5 - 16);
switch ( v5 )
{
case 0x10u:
case 0x23u:
case 0x25u:
case 0x28u:
case 0x29u:
case 0x2Au:
case 0x2Bu:
case 0x2Cu:
case 0x2Du:
case 0x2Eu:
case 0x2Fu:
case 0x30u:
case 0x31u:
case 0x32u:
case 0x33u:
case 0x35u:
case 0x36u:
case 0x37u:
case 0x38u:
case 0x39u:
case 0x3Au:
case 0x3Bu:
v24 = (GameManager *)GameManager::sharedState(v6);
BGTexture = (cocos2d::CCSprite *)GameManager::getBGTexture(v24, v5);
v27 = cocos2d::CCSprite::create(BGTexture, v26);
*((_QWORD *)this + 493) = v27;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v27 + 72LL))(v27, v5);
v11 = 10497;
v29 = 9729;
v31 = 10497;
v30 = 9729;
break;
default:
v7 = (GameManager *)GameManager::sharedState(v6);
v8 = (cocos2d::CCSprite *)GameManager::getBGTexture(v7, v5);
v10 = cocos2d::CCSprite::create(v8, v9);
*((_QWORD *)this + 493) = v10;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v10 + 72LL))(v10, v5);
v29 = 9729;
v30 = 9729;
v11 = 33648;
v31 = 10497;
break;
}
v12 = *((_QWORD *)this + 493);
v32 = v11;
v13 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v12 + 1072LL))(v12);
*(__n128 *)&v14 = cocos2d::CCTexture2D::setTexParameters(v13, &v29);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64, long double))(**((_QWORD **)this + 487) + 464LL))(
*((_QWORD *)this + 487),
*((_QWORD *)this + 493),
4294967236LL,
v14);
v15 = *((_QWORD *)this + 493);
v16 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v15 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v33, 0.0, 0.0);
v16(v15, v33);
v17 = *((AppDelegate ***)this + 493);
v18 = *((void (__fastcall **)(AppDelegate **))*v17 + 20);
v19 = (AppDelegate *)AppDelegate::get(*v17);
AppDelegate::bgScale(v19);
v18(v17);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 493) + 1080LL))(*((_QWORD *)this + 493), 1);
v20 = *((_QWORD *)this + 493);
v21 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v20 + 960LL);
qmemcpy(v33, "(}", 2);
v33[2] = -1;
v21(v20, v33);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v33, (const cocos2d::CCRect *)(*((_QWORD *)this + 493) + 424LL));
v22 = v34;
*((float *)this + 289) = v22
* (*(float (__fastcall **)(_QWORD))(**((_QWORD **)this + 493) + 168LL))(*((_QWORD *)this + 493));
return _stack_chk_guard;
}