//
// GJBaseGameLayer::createBackground from 0x1403119b0 to 0x140311c68 (696 bytes)
//
// 7 xrefs:
// > GameManager::finishedLoadingBGAsync @ 0x14027de00
// > GJBaseGameLayer::syncBGTextures @ 0x140344f23
// > LevelEditorLayer::init @ 0x1403eeada
// > LevelSettingsLayer::selectArtClosed @ 0x14045b182
// > PlayLayer::setupHasCompleted @ 0x140504d5b
// > ArtTriggerGameObject::triggerObject @ 0x140663357
// > ??> @ 0x14091e7e8
//
// This function is hookable on this platform (idp: pc, 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:30:16 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall GJBaseGameLayer::createBackground(__int64 a1, int a2)
{
int v2; // edi
__int64 v4; // rcx
__int64 v5; // rcx
int v6; // ebp
char v7; // r14
__int64 v8; // rcx
int v9; // ebx
cocos2d::CCString *v10; // rax
const char *CString; // rax
struct cocos2d::CCSprite *v12; // rax
int v13; // eax
cocos2d::CCTexture2D *v14; // rax
__int64 v15; // rdi
__int64 v16; // rbx
__int64 v17; // rax
__int64 v18; // rcx
__int64 v19; // rcx
cocos2d::CCDirector *v20; // rax
float v21; // xmm0_4
__int16 v22; // [rsp+20h] [rbp-58h] BYREF
char v23; // [rsp+22h] [rbp-56h]
__int64 v24; // [rsp+28h] [rbp-50h] BYREF
_BYTE v25[8]; // [rsp+30h] [rbp-48h] BYREF
float v26; // [rsp+38h] [rbp-40h]
_DWORD v27[4]; // [rsp+40h] [rbp-38h] BYREF
v2 = a2;
v4 = *(_QWORD *)(a1 + 4320);
if ( !v4 || (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v4 + 56LL))(v4) != a2 )
{
v5 = *(_QWORD *)(a1 + 4320);
if ( v5 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v5 + 512LL))(v5);
*(_QWORD *)(a1 + 4320) = 0;
}
v6 = 59;
if ( v2 > 59 )
v2 = 59;
v7 = 1;
switch ( v2 )
{
case 16:
case 35:
case 37:
case 40:
case 41:
case 42:
case 43:
case 44:
case 45:
case 46:
case 47:
case 48:
case 49:
case 50:
case 51:
case 53:
case 54:
case 55:
case 56:
case 57:
case 58:
case 59:
v7 = 0;
break;
default:
break;
}
v8 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v24 = (__int64)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v24);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v8 = qword_14090BFD0;
}
if ( v2 < 59 )
v6 = v2;
v9 = 1;
if ( v6 > 1 )
v9 = v6;
GameManager::loadBackground(v8, v9);
v10 = cocos2d::CCString::createWithFormat("game_bg_%02d_001.png", v9);
CString = cocos2d::CCString::getCString(v10);
v12 = cocos2d::CCSprite::create(CString);
*(_QWORD *)(a1 + 4320) = v12;
(*(void (__fastcall **)(struct cocos2d::CCSprite *, _QWORD))(*(_QWORD *)v12 + 64LL))(v12, (unsigned int)v2);
v27[0] = 9729;
v27[1] = 9729;
v13 = 10497;
v27[2] = 10497;
if ( v7 )
v13 = 33648;
v27[3] = v13;
v14 = (cocos2d::CCTexture2D *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(*(_QWORD *)(a1 + 4320) + 344LL) + 16LL))(*(_QWORD *)(a1 + 4320) + 344LL);
cocos2d::CCTexture2D::setTexParameters(v14, (struct cocos2d::_ccTexParams *)v27);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 4272) + 456LL))(
*(_QWORD *)(a1 + 4272),
*(_QWORD *)(a1 + 4320),
4294967236LL);
v15 = **(_QWORD **)(a1 + 4320);
v16 = *(_QWORD *)(a1 + 4320);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v24, 0.0, 0.0);
(*(void (__fastcall **)(__int64, __int64))(v15 + 288))(v16, v17);
cocos2d::CCApplication::sharedApplication(v18);
v20 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v19);
cocos2d::CCDirector::getScreenScaleFactorMax(v20);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 4320) + 160LL))(*(_QWORD *)(a1 + 4320));
v24 = 1;
(**(void (__fastcall ***)(__int64, __int64))(*(_QWORD *)(a1 + 4320) + 344LL))(*(_QWORD *)(a1 + 4320) + 344LL, 1);
v22 = 32040;
v23 = -1;
(**(void (__fastcall ***)(__int64, __int16 *))(*(_QWORD *)(a1 + 4320) + 320LL))(
*(_QWORD *)(a1 + 4320) + 320LL,
&v22);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v25, (const struct cocos2d::CCRect *)(*(_QWORD *)(a1 + 4320) + 424LL));
v21 = (*(float (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 4320) + 168LL))(*(_QWORD *)(a1 + 4320));
*(float *)(a1 + 1252) = v21 * v26;
}
}