//
// GJBaseGameLayer::syncBGTextures from 0x1001383e0 to 0x1001384eb (267 bytes)
//
// 3 xrefs:
// > PlayLayer::resetLevel @ 0x10008d40e
// > LevelEditorLayer::onPlaytest @ 0x1000c6041
// > LevelEditorLayer::onStopPlaytest @ 0x1000c6d26
//
// 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 12:24:51 +0000
//
__int64 __fastcall GJBaseGameLayer::syncBGTextures(__int64 a1, double a2)
{
int v3; // eax
__int64 v4; // rdx
__int64 v5; // rsi
__int64 result; // rax
int v7; // esi
__int64 v8; // rdi
int v9; // r15d
__int64 v10; // rdi
unsigned int v11; // r14d
__int64 v12; // rax
v3 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3944) + 64LL))(*(_QWORD *)(a1 + 3944));
v5 = *(unsigned int *)(a1 + 1900);
if ( v3 != (_DWORD)v5 )
GJBaseGameLayer::createBackground(a1, v5, v4);
result = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3960) + 64LL))(*(_QWORD *)(a1 + 3960));
v7 = *(_DWORD *)(a1 + 1904);
if ( (_DWORD)result != v7 )
result = GJBaseGameLayer::createGroundLayer(a1, v7, *(_DWORD *)(*(_QWORD *)(a1 + 3272) + 424LL));
v8 = *(_QWORD *)(a1 + 3976);
if ( v8 )
{
result = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v8 + 64LL))(v8);
v9 = *(_DWORD *)(a1 + 1908);
v10 = *(_QWORD *)(a1 + 3976);
if ( (_DWORD)result == v9 )
{
if ( v10 )
return result;
v9 = result;
}
else if ( v10 )
{
result = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v10 + 520LL))(v10);
*(_QWORD *)(a1 + 3976) = 0;
}
}
else
{
v9 = *(_DWORD *)(a1 + 1908);
}
if ( v9 > 0 )
{
v11 = 3;
if ( (unsigned int)v9 < 3 )
v11 = v9;
v12 = GJMGLayer::create(v11, a2);
*(_QWORD *)(a1 + 3976) = v12;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v12 + 72LL))(v12, v11);
return (*(__int64 (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 3896) + 464LL))(
*(_QWORD *)(a1 + 3896),
*(_QWORD *)(a1 + 3976),
4294967257LL);
}
return result;
}