//
// GJBaseGameLayer::createBackground from 0x100278110 to 0x1002782b8 (424 bytes)
//
// 6 xrefs:
// > PlayLayer::setupHasCompleted @ 0x10013f714
// > LevelSettingsLayer::selectArtClosed @ 0x10020d8b0
// > GJBaseGameLayer::swapBackground @ 0x100278334
// > GJBaseGameLayer::asyncBGLoaded @ 0x10027836c
// > GJBaseGameLayer::syncBGTextures @ 0x10029eee8
// > LevelEditorLayer::init @ 0x1003f7108
//
// 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 11:01:51 +0000
//
void __fastcall GJBaseGameLayer::createBackground(__int64 a1, int a2)
{
__int64 v2; // x20
__int64 v4; // x0
int v5; // w21
__int64 v6; // x0
__int64 BGTexture; // x0
__int64 v8; // x0
unsigned int *v9; // x0
__int64 v10; // x20
__int64 v11; // x0
__int64 v12; // x20
__int64 v13; // x0
__int64 v14; // x0
double v15; // d0
float v16; // s8
__int64 v17; // [xsp+0h] [xbp-50h] BYREF
float v18; // [xsp+8h] [xbp-48h]
int32x2_t v19; // [xsp+10h] [xbp-40h] BYREF
int v20; // [xsp+18h] [xbp-38h]
int v21; // [xsp+1Ch] [xbp-34h]
LODWORD(v2) = a2;
v4 = *(_QWORD *)(a1 + 3944);
if ( v4 )
{
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v4 + 64LL))(v4) == a2 )
return;
v4 = *(_QWORD *)(a1 + 3944);
if ( v4 )
{
v4 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 520LL))(v4);
*(_QWORD *)(a1 + 3944) = 0;
}
}
if ( (int)v2 >= 59 )
v2 = 59;
else
v2 = (unsigned int)v2;
if ( (unsigned int)(v2 - 16) > 0x2B )
v5 = 33648;
else
v5 = dword_100763018[(unsigned int)(v2 - 16)];
v6 = GameManager::sharedState(v4);
BGTexture = GameManager::getBGTexture(v6, v2);
v8 = cocos2d::CCSprite::create(BGTexture);
*(_QWORD *)(a1 + 3944) = v8;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v8 + 72LL))(v8, v2);
v19 = vdup_n_s32(0x2601u);
v20 = 10497;
v21 = v5;
v9 = (unsigned int *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3944) + 1072LL))(*(_QWORD *)(a1 + 3944));
cocos2d::CCTexture2D::setTexParameters(v9, (GLint *)&v19);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 3896) + 464LL))(
*(_QWORD *)(a1 + 3896),
*(_QWORD *)(a1 + 3944),
4294967236LL);
v10 = *(_QWORD *)(a1 + 3944);
sub_1000262BC((float *)&v17, 0.0, 0.0);
v11 = (*(__int64 (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v10 + 296LL))(v10, &v17);
v12 = *(_QWORD *)(a1 + 3944);
v13 = AppDelegate::get(v11);
AppDelegate::bgScale(v13);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v12 + 160LL))(v12);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 3944) + 1080LL))(*(_QWORD *)(a1 + 3944), 1);
v14 = *(_QWORD *)(a1 + 3944);
BYTE2(v17) = -1;
LOWORD(v17) = 32040;
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v14 + 960LL))(v14, &v17);
v15 = sub_1000264D4(&v17, *(_QWORD *)(a1 + 3944) + 424LL);
v16 = v18;
*(float *)(a1 + 1156) = v16
* (*(float (__fastcall **)(_QWORD, double))(**(_QWORD **)(a1 + 3944) + 168LL))(
*(_QWORD *)(a1 + 3944),
v15);
}