//
// GJGameLevel::getListSnapshot from 0x709afc to 0x709e60 (868 bytes)
//
// 3 xrefs:
// > GJLevelList::getListLevelsArray @ 0x730eb4
// > GJLevelList::addLevelToList @ 0x7365e8
// > ??> @ 0x70c68
//
// 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
//
GJGameLevel *GJGameLevel::getListSnapshot(GJGameLevel *a1)
{
__int64 v2; // x19
int v3; // w22
int v4; // w2
void *v5; // x0
int v6; // w24
int v7; // w2
void *v8; // x0
GJLevelType m_levelType; // w0
int v10; // w22
int v11; // w0
int m_demonDifficulty; // w1
float v13; // s0
int v14; // w22
float v15; // s0
int v16; // w22
float v17; // s0
_BOOL4 v18; // w22
float v19; // s0
int v20; // w22
float v21; // s0
float v23; // s0
unsigned int *v24; // x1
int v25; // w2
unsigned int *v26; // x2
int v27; // w1
__int64 v28; // [xsp+60h] [xbp+60h] BYREF
v2 = GJGameLevel::create(_stack_chk_guard);
v3 = a1->m_levelID.random - a1->m_levelID.seed;
*(_DWORD *)(v2 + 336) = v3;
v4 = (int)(float)((float)((float)rand() * 4.6566e-10) * 1000.0);
*(_DWORD *)(v2 + 332) = v4;
*(_DWORD *)(v2 + 328) = v3 + v4;
sub_D18D28(&v28, &a1->m_levelName);
sub_D18EA8(v2 + 344, &v28);
v5 = (void *)(v28 - 24);
if ( (__int64 *)(v28 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v28 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *(_DWORD *)(v28 - 8);
*(_DWORD *)(v28 - 8) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v5);
}
*(_DWORD *)(v2 + 640) = a1->m_levelLength;
*(_DWORD *)(v2 + 912) = a1->m_timestamp;
v6 = a1->m_accountID.random - a1->m_accountID.seed;
*(_DWORD *)(v2 + 444) = v6;
v7 = (int)(float)((float)((float)rand() * 4.6566e-10) * 1000.0);
*(_DWORD *)(v2 + 440) = v7;
*(_DWORD *)(v2 + 436) = v6 + v7;
sub_D18D28(&v28, &a1->m_creatorName);
sub_D18EA8(v2 + 368, &v28);
v8 = (void *)(v28 - 24);
if ( (__int64 *)(v28 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)(v28 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *(_DWORD *)(v28 - 8);
*(_DWORD *)(v28 - 8) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v8);
}
*(_DWORD *)(v2 + 632) = a1->m_likes;
m_levelType = a1->m_levelType;
*(_DWORD *)(v2 + 492) = a1->m_downloads;
*(_DWORD *)(v2 + 452) = a1->m_audioTrack;
*(_DWORD *)(v2 + 456) = a1->m_songID;
*(_DWORD *)(v2 + 868) = m_levelType;
*(_DWORD *)(v2 + 484) = a1->m_ratings;
*(_DWORD *)(v2 + 488) = a1->m_ratingsSum;
v10 = a1->m_demon.random - a1->m_demon.seed;
*(_DWORD *)(v2 + 680) = v10;
v11 = rand();
m_demonDifficulty = a1->m_demonDifficulty;
*(_BYTE *)(v2 + 700) = a1->m_autoLevel;
*(_DWORD *)(v2 + 684) = m_demonDifficulty;
v13 = (float)((float)v11 * 4.6566e-10) * 1000.0;
*(_DWORD *)(v2 + 676) = (int)v13;
*(_DWORD *)(v2 + 672) = v10 + (int)v13;
*(_DWORD *)(v2 + 644) = a1->m_featured;
*(_DWORD *)(v2 + 648) = a1->m_isEpic;
v14 = a1->m_stars.random - a1->m_stars.seed;
*(_DWORD *)(v2 + 696) = v14;
v15 = (float)((float)rand() * 4.6566e-10) * 1000.0;
*(_DWORD *)(v2 + 692) = (int)v15;
*(_DWORD *)(v2 + 688) = v14 + (int)v15;
*(_DWORD *)(v2 + 704) = a1->m_coins;
v16 = a1->m_coinsVerified.random - a1->m_coinsVerified.seed;
*(_DWORD *)(v2 + 716) = v16;
v17 = (float)((float)rand() * 4.6566e-10) * 1000.0;
*(_DWORD *)(v2 + 712) = (int)v17;
*(_DWORD *)(v2 + 708) = v16 + (int)v17;
v18 = a1->m_originalLevel.random != a1->m_originalLevel.seed;
*(_DWORD *)(v2 + 736) = v18;
v19 = (float)((float)rand() * 4.6566e-10) * 1000.0;
*(_DWORD *)(v2 + 732) = (int)v19;
*(_DWORD *)(v2 + 728) = v18 + (int)v19;
v20 = a1->m_objectCount.random - a1->m_objectCount.seed;
*(_DWORD *)(v2 + 476) = v20;
v21 = (float)rand();
v23 = (float)(v21 * 4.6566e-10) * 1000.0;
*(_DWORD *)(v2 + 472) = (int)v23;
*(_DWORD *)(v2 + 468) = v20 + (int)v23;
return (GJGameLevel *)v2;
}