//
// GJGameLevel::copyLevelInfo from 0x1000ad774 to 0x1000ad9d4 (608 bytes)
//
// 2 xrefs:
// > LevelInfoLayer::onClone @ 0x10002aa40
// > EditLevelLayer::onClone @ 0x1000ec388
//
// 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 __fastcall GJGameLevel::copyLevelInfo(GJGameLevel *a1)
{
__int64 v1; // x1
__int64 v2; // x20
int v4; // w21
std::string __p; // [xsp+0h] [xbp-D0h] BYREF
std::string v6; // [xsp+20h] [xbp-B0h] BYREF
__int64 v7; // [xsp+38h] [xbp-98h] BYREF
std::string v8; // [xsp+40h] [xbp-90h] BYREF
std::string __str; // [xsp+60h] [xbp-70h] BYREF
std::string __dst; // [xsp+80h] [xbp-50h] BYREF
std::string v11; // [xsp+98h] [xbp-38h] BYREF
v2 = v1;
GameLevelManager::sharedState();
if ( *(char *)(v2 + 367) < 0 )
sub_1000097D0(&__dst, *(void **)(v2 + 344), *(_QWORD *)(v2 + 352));
else
__dst = *(std::string *)(v2 + 344);
GameLevelManager::getNextLevelName(&__dst, (__int64)&v11);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
v4 = SHIBYTE(v11.__r_.__value_.__r.__words[2]);
if ( SHIBYTE(v11.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__str, v11.__r_.__value_.__l.__data_, v11.__r_.__value_.__l.__size_);
else
__str = v11;
std::string::operator=((std::string *)&a1->m_levelName, &__str);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
if ( *(char *)(v2 + 415) < 0 )
sub_1000097D0(&v8, *(void **)(v2 + 392), *(_QWORD *)(v2 + 400));
else
v8 = *(std::string *)(v2 + 392);
std::string::operator=((std::string *)&a1->m_levelString, &v8);
if ( SHIBYTE(v8.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v8.__r_.__value_.__l.__data_);
a1->m_audioTrack = *(_DWORD *)(v2 + 596);
a1->m_songID = *(_DWORD *)(v2 + 600);
a1->m_twoPlayerMode = *(_BYTE *)(v2 + 884);
a1->m_levelLength = *(_DWORD *)(v2 + 784);
a1->m_timestamp = *(_DWORD *)(v2 + 1120);
a1->m_coins = *(_DWORD *)(v2 + 848);
GJGameLevel::unverifyCoins(a1);
*(_QWORD *)&a1->m_lastBuildTab = *(_QWORD *)(v2 + 1016);
a1->m_lastEditorZoom = *(float *)(v2 + 1012);
sub_1000229B8(&v7, (__int64 *)(v2 + 1004));
sub_1000229D0(&a1->m_lastCameraPos, (double *)&v7);
a1->m_lastBuildGroupID = *(_DWORD *)(v2 + 1024);
a1->m_workingTime2 = *(_DWORD *)(v2 + 648) + *(_DWORD *)(v2 + 644);
a1->m_workingTime = 0;
if ( *(char *)(v2 + 559) < 0 )
sub_1000097D0(&v6, *(void **)(v2 + 536), *(_QWORD *)(v2 + 544));
else
v6 = *(std::string *)(v2 + 536);
std::string::operator=((std::string *)&a1->m_savedCameraPositions, &v6);
if ( SHIBYTE(v6.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v6.__r_.__value_.__l.__data_);
sub_1000229B8(&v7, (__int64 *)(v2 + 560));
sub_1000229D0(&a1->m_previewLock, (double *)&v7);
if ( *(char *)(v2 + 535) < 0 )
sub_1000097D0(&__p, *(void **)(v2 + 512), *(_QWORD *)(v2 + 520));
else
__p = *(std::string *)(v2 + 512);
std::string::operator=((std::string *)&a1->m_lockedEditorLayers, &__p);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
std::string::operator=((std::string *)&a1->m_sfxIDs, (const std::string *)(v2 + 1152));
std::string::operator=((std::string *)&a1->m_songIDs, (const std::string *)(v2 + 1128));
a1->m_songSize = *(_DWORD *)(v2 + 1176);
if ( v4 < 0 )
operator delete(v11.__r_.__value_.__l.__data_);
}