//
// GJBaseGameLayer::createBackground from 0x58bc04 to 0x58bd78 (372 bytes)
//
// 5 xrefs:
// > PlayLayer::setupHasCompleted @ 0x40a13e
// > LevelEditorLayer::init @ 0x47642c
// > GJBaseGameLayer::asyncBGLoaded @ 0x58c788
// > GJBaseGameLayer::syncBGTextures @ 0x5964c4
// > LevelSettingsLayer::selectArtClosed @ 0x6a8c0e
//
// 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:53:02 +0000
//
float __fastcall GJBaseGameLayer::createBackground(GJBaseGameLayer *this, const char *a2)
{
float result; // r0
int v5; // r7
GameManager *v6; // r0
cocos2d::CCSprite *BGTexture; // r0
const char *v8; // r1
int v9; // r0
int v10; // r0
int v11; // r3
int v12; // r0
int v13; // r7
int (__fastcall *v14)(int, _BYTE *); // r8
AppDelegate *v15; // r0
int v16; // r7
void (__fastcall *v17)(int, int); // r8
AppDelegate *v18; // r0
int v19; // r0
int v20; // r0
void (__fastcall *v21)(int, _BYTE *); // r3
float v22; // s16
_DWORD v23[4]; // [sp+Ch] [bp-24h] BYREF
_BYTE v24[8]; // [sp+1Ch] [bp-14h] BYREF
float v25; // [sp+24h] [bp-Ch]
result = *((float *)this + 612);
if ( result != 0.0 )
{
result = COERCE_FLOAT((*(int (__fastcall **)(float))(*(_DWORD *)LODWORD(result) + 32))(COERCE_FLOAT(LODWORD(result))));
if ( (const char *)LODWORD(result) == a2 )
return result;
}
if ( *((_DWORD *)this + 612) )
result = COERCE_FLOAT(GJBaseGameLayer::removeBackground(this));
if ( (int)a2 >= 59 )
a2 = (_BYTE *)(&dword_38 + 3);
if ( (int)a2 > 51 )
{
if ( (unsigned int)(a2 - 53) <= 6 )
{
LABEL_15:
v5 = 0;
goto LABEL_16;
}
}
else if ( (int)a2 >= 40
|| a2 == (_BYTE *)&dword_20 + 3
|| a2 == (_BYTE *)&dword_24 + 1
|| a2 == (const char *)&word_10 )
{
goto LABEL_15;
}
v5 = 1;
LABEL_16:
v6 = (GameManager *)GameManager::sharedState((GameManager *)LODWORD(result));
BGTexture = (cocos2d::CCSprite *)GameManager::getBGTexture(v6, a2);
v9 = cocos2d::CCSprite::create(BGTexture, v8);
*((_DWORD *)this + 612) = v9;
(*(void (__fastcall **)(int, const char *))(*(_DWORD *)v9 + 36))(v9, a2);
memset(v23, 0, sizeof(v23));
v10 = *((_DWORD *)this + 612);
v23[0] = 9729;
v23[1] = 9729;
v11 = 10497;
v23[2] = 10497;
if ( v5 )
v11 = 33648;
v23[3] = v11;
v12 = (*(int (__fastcall **)(int))(*(_DWORD *)v10 + 536))(v10);
cocos2d::CCTexture2D::setTexParameters(v12, v23);
(*(void (__fastcall **)(_DWORD, _DWORD, int))(**((_DWORD **)this + 606) + 232))(
*((_DWORD *)this + 606),
*((_DWORD *)this + 612),
-60);
v13 = *((_DWORD *)this + 612);
v14 = *(int (__fastcall **)(int, _BYTE *))(*(_DWORD *)v13 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v24, 0.0, 0.0);
v15 = (AppDelegate *)v14(v13, v24);
v16 = *((_DWORD *)this + 612);
v17 = *(void (__fastcall **)(int, int))(*(_DWORD *)v16 + 80);
v18 = (AppDelegate *)AppDelegate::get(v15);
v19 = AppDelegate::bgScale(v18);
v17(v16, v19);
(*(void (__fastcall **)(_DWORD, int, _DWORD))(**((_DWORD **)this + 612) + 540))(*((_DWORD *)this + 612), 1, 0);
v20 = *((_DWORD *)this + 612);
v21 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v20 + 480);
qmemcpy(v24, "(}", 2);
v24[2] = -1;
v21(v20, v24);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v24, (const cocos2d::CCRect *)(*((_DWORD *)this + 612) + 336));
v22 = v25;
result = (*(float (__fastcall **)(_DWORD))(**((_DWORD **)this + 612) + 84))(*((_DWORD *)this + 612));
*((float *)this + 240) = v22 * result;
return result;
}