//
// GJGameLevel::copyLevelInfo from 0x70ba0c to 0x70bea8 (1180 bytes)
//
// 3 xrefs:
// > LevelInfoLayer::onClone @ 0x6d9374
// > EditLevelLayer::onClone @ 0x6e2eb8
// > ??> @ 0x9d680
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void GJGameLevel::copyLevelInfo(GJGameLevel *a1)
{
__int64 v1; // x1
__int64 v3; // x20
void *v4; // x0
void *v5; // x0
void *v6; // x0
char v7; // w1
float v8; // w2
float v9; // s0
float v10; // s1
int v11; // w3
int v12; // w2
void *v13; // x0
float v14; // s0
float v15; // s1
void *v16; // x0
char *v17; // x20
unsigned int *v18; // x1
int v19; // w2
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x1
int v23; // w2
unsigned int *v24; // x1
int v25; // w2
unsigned int *v26; // x1
int v27; // w2
unsigned int *v28; // x19
int v29; // w0
const char *v30; // [xsp+60h] [xbp+60h] BYREF
__int64 v31; // [xsp+68h] [xbp+68h] BYREF
__int64 v32; // [xsp+70h] [xbp+70h] BYREF
__int64 v33; // [xsp+78h] [xbp+78h] BYREF
cocos2d::CCPoint v34; // [xsp+80h] [xbp+80h] BYREF
v3 = v1;
GameLevelManager::sharedState();
sub_D18D28(&v34, v3 + 344);
GameLevelManager::getNextLevelName((const char **)&v34, &v30);
v4 = (void *)(*(_QWORD *)&v34 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v34 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(*(_QWORD *)&v34 - 8LL);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(*(_QWORD *)&v34 - 8LL);
*(_DWORD *)(*(_QWORD *)&v34 - 8LL) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v4);
}
sub_D18D28(&v31, &v30);
sub_D18EA8(&a1->m_levelName, &v31);
v5 = (void *)(v31 - 24);
if ( (__int64 *)(v31 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v31 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *(_DWORD *)(v31 - 8);
*(_DWORD *)(v31 - 8) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v5);
}
sub_D18D28(&v32, v3 + 360);
sub_D18EA8(&a1->m_levelString, &v32);
v6 = (void *)(v32 - 24);
if ( (__int64 *)(v32 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v32 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *(_DWORD *)(v32 - 8);
*(_DWORD *)(v32 - 8) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v6);
}
a1->m_audioTrack = *(_DWORD *)(v3 + 452);
v7 = *(_BYTE *)(v3 + 740);
a1->m_songID = *(_DWORD *)(v3 + 456);
a1->m_twoPlayerMode = v7;
a1->m_levelLength = *(_DWORD *)(v3 + 640);
a1->m_timestamp = *(_DWORD *)(v3 + 912);
a1->m_coins = *(_DWORD *)(v3 + 704);
GJGameLevel::unverifyCoins(a1);
a1->m_lastBuildTab = *(_DWORD *)(v3 + 856);
v8 = *(float *)(v3 + 852);
a1->m_lastBuildPage = *(_DWORD *)(v3 + 860);
a1->m_lastEditorZoom = v8;
cocos2d::CCPoint::CCPoint(&v34, (const cocos2d::CCPoint *)(v3 + 844));
cocos2d::CCPoint::operator=(&a1->m_lastCameraPos, v9, v10);
a1->m_lastBuildGroupID = *(_DWORD *)(v3 + 864);
v11 = *(_DWORD *)(v3 + 500);
v12 = *(_DWORD *)(v3 + 504);
a1->m_workingTime = 0;
a1->m_workingTime2 = v11 + v12;
sub_D18D28(&v33, v3 + 408);
sub_D18EA8(&a1->m_savedCameraPositions, &v33);
v13 = (void *)(v33 - 24);
if ( (__int64 *)(v33 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v33 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *(_DWORD *)(v33 - 8);
*(_DWORD *)(v33 - 8) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v13);
}
cocos2d::CCPoint::CCPoint(&v34, (const cocos2d::CCPoint *)(v3 + 416));
cocos2d::CCPoint::operator=(&a1->m_previewLock, v14, v15);
sub_D18D28(&v34, v3 + 400);
sub_D18EA8(&a1->m_lockedEditorLayers, &v34);
v16 = (void *)(*(_QWORD *)&v34 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v34 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)(*(_QWORD *)&v34 - 8LL);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *(_DWORD *)(*(_QWORD *)&v34 - 8LL);
*(_DWORD *)(*(_QWORD *)&v34 - 8LL) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v16);
}
sub_D18EA8(&a1->m_sfxIDs, v3 + 928);
sub_D18EA8(&a1->m_songIDs, v3 + 920);
a1->m_songSize = *(_DWORD *)(v3 + 936);
v17 = (char *)(v30 - 24);
if ( v30 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)(v30 - 8);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *((_DWORD *)v30 - 2);
*((_DWORD *)v30 - 2) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v17);
}
}