//
// GJGameLevel::encodeWithCoder from 0x1000aec20 to 0x1000af760 (2880 bytes)
//
// 1 xrefs:
// > ??> @ 0x10077f5b0
//
// 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::encodeWithCoder(GJGameLevel *a1, DS_Dictionary *a2)
{
int v4; // w2
int m_levelFolder; // w2
int m_bestTime; // w2
std::size_t size; // x8
std::size_t v8; // x8
int v9; // w21
float x; // s0
int m_workingTime; // w2
int m_workingTime2; // w2
GJLevelType m_levelType; // w8
void *__p[2]; // [xsp+0h] [xbp-40h] BYREF
char *longStorage; // [xsp+10h] [xbp-30h]
DS_Dictionary::setIntegerForKey_1(a2, "kCEK", 4);
DS_Dictionary::setIntegerForKey_1(a2, "k1", a1->m_levelID.random - a1->m_levelID.seed);
DS_Dictionary::setBoolForKey_1(a2, "k35", a1->m_levelNotDownloaded);
DS_Dictionary::setIntegerForKey_1(a2, "k18", a1->m_attempts.random - a1->m_attempts.seed);
DS_Dictionary::setIntegerForKey_1(a2, "k36", a1->m_jumps.random - a1->m_jumps.seed);
DS_Dictionary::setIntegerForKey_1(a2, "k85", a1->m_clicks.random - a1->m_clicks.seed);
DS_Dictionary::setIntegerForKey_1(a2, "k86", a1->m_attemptTime.random - a1->m_attemptTime.seed);
DS_Dictionary::setIntegerForKey_1(a2, "k87", a1->m_chk);
if ( a1->m_personalBests.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(__p, (void *)a1->m_personalBests.m_data.m_long.capacitym1, a1->m_personalBests.m_data.m_long.size);
}
else
{
*(_OWORD *)__p = *(_OWORD *)&a1->m_personalBests.m_data.m_short.sizex2;
longStorage = a1->m_personalBests.m_data.m_long.longStorage;
}
DS_Dictionary::setStringForKey_1(a2, "k88", __p);
if ( SHIBYTE(longStorage) < 0 )
operator delete(__p[0]);
DS_Dictionary::setBoolForKey_1(a2, "k89", a1->m_isChkValid);
DS_Dictionary::setIntegerForKey_1(a2, "k23", a1->m_levelLength);
DS_Dictionary::setIntegerForKey_1(a2, "k19", a1->m_normalPercent.random - a1->m_normalPercent.seed);
DS_Dictionary::setIntegerForKey_1(a2, "k71", a1->m_orbCompletion.random - a1->m_orbCompletion.seed);
DS_Dictionary::setIntegerForKey_1(a2, "k90", a1->m_newNormalPercent2.random - a1->m_newNormalPercent2.seed);
DS_Dictionary::setIntegerForKey_1(a2, "k20", a1->m_practicePercent);
if ( a1->m_demon.random - a1->m_demon.seed == 1 )
{
DS_Dictionary::setBoolForKey_1(a2, "k25", 1);
DS_Dictionary::setIntegerForKey_1(a2, "k76", a1->m_demonDifficulty);
}
v4 = a1->m_stars.random - a1->m_stars.seed;
if ( v4 >= 1 )
DS_Dictionary::setIntegerForKey_1(a2, "k26", v4);
if ( a1->m_isCompletionLegitimate )
DS_Dictionary::setBoolForKey_1(a2, "k68", 1);
DS_Dictionary::setIntegerForKey_1(a2, "k74", a1->m_dailyID.random - a1->m_dailyID.seed);
DS_Dictionary::setBoolForKey_1(a2, "k77", a1->m_gauntletLevel);
DS_Dictionary::setBoolForKey_1(a2, "k78", a1->m_gauntletLevel2);
if ( a1->m_levelFavorited )
DS_Dictionary::setBoolForKey_1(a2, "k82", 1);
m_levelFolder = a1->m_levelFolder;
if ( m_levelFolder >= 1 )
DS_Dictionary::setIntegerForKey_1(a2, "k84", m_levelFolder);
m_bestTime = a1->m_bestTime;
if ( m_bestTime > 0 || a1->m_bestPoints )
{
DS_Dictionary::setIntegerForKey_1(a2, "k107", m_bestTime);
DS_Dictionary::setIntegerForKey_1(a2, "k115", a1->m_ticksTime);
DS_Dictionary::setIntegerForKey_1(a2, "k117", a1->m_clicksTime);
DS_Dictionary::setIntegerForKey_1(a2, "k121", a1->m_coinsTime);
if ( a1->m_savedTime )
DS_Dictionary::setStringForKey_1(a2, "k119", &a1->m_inputsTime);
DS_Dictionary::setIntegerForKey_1(a2, "k108", a1->m_bestPoints);
DS_Dictionary::setIntegerForKey_1(a2, "k116", a1->m_ticksPoints);
DS_Dictionary::setIntegerForKey_1(a2, "k118", a1->m_clicksPoints);
DS_Dictionary::setIntegerForKey_1(a2, "k122", a1->m_coinsPoints);
if ( a1->m_savedPoints )
DS_Dictionary::setStringForKey_1(a2, "k120", &a1->m_inputsPoints);
DS_Dictionary::setIntegerForKey_1(a2, "k111", a1->m_platformerSeed);
DS_Dictionary::setBoolForKey_1(a2, "k123", a1->m_savedTime);
DS_Dictionary::setBoolForKey_1(a2, "k124", a1->m_savedPoints);
}
size = a1->m_localBestTimes.m_data.m_short.shortStorage.__elems_[22];
if ( (size & 0x8000000000000000LL) != 0 )
size = a1->m_localBestTimes.m_data.m_long.size;
if ( size )
DS_Dictionary::setStringForKey_1(a2, "k109", &a1->m_localBestTimes);
v8 = a1->m_localBestPoints.m_data.m_short.shortStorage.__elems_[22];
if ( (v8 & 0x8000000000000000LL) != 0 )
v8 = a1->m_localBestPoints.m_data.m_long.size;
if ( v8 )
DS_Dictionary::setStringForKey_1(a2, "k110", &a1->m_localBestPoints);
if ( !a1->m_levelNotDownloaded )
{
if ( (a1->m_levelName.m_data.m_short.shortStorage.__elems_[22] & 0x8000000000000000LL) != 0 )
{
if ( !a1->m_levelName.m_data.m_long.size )
goto LABEL_36;
}
else if ( !a1->m_levelName.m_data.m_short.shortStorage.__elems_[22] )
{
LABEL_36:
if ( (a1->m_tempName.m_data.m_short.shortStorage.__elems_[22] & 0x8000000000000000LL) != 0 )
{
if ( a1->m_tempName.m_data.m_long.size )
goto LABEL_38;
}
else if ( a1->m_tempName.m_data.m_short.shortStorage.__elems_[22] )
{
LABEL_38:
std::string::operator=((std::string *)&a1->m_levelName, (const std::string *)&a1->m_tempName);
goto LABEL_41;
}
std::string::assign((std::string *)&a1->m_levelName, "Unknown");
}
LABEL_41:
DS_Dictionary::setStringForKey_1(a2, "k2", &a1->m_levelName);
if ( (a1->m_levelNotDownloaded
|| a1->m_dontSave
|| a1->m_levelType == Main
|| a1->m_dailyID.random > a1->m_dailyID.seed
|| GameManager::sharedState()->m_quickSave)
&& a1->m_levelType != Editor
&& (a1->m_dailyID.random <= a1->m_dailyID.seed || a1->m_dontSave) )
{
sub_100009900(__p, "");
DS_Dictionary::setStringForKey_1(a2, "k4", __p);
if ( SHIBYTE(longStorage) < 0 )
operator delete(__p[0]);
v9 = 0;
}
else
{
DS_Dictionary::setStringForKey_1(a2, "k4", &a1->m_levelString);
DS_Dictionary::setStringForKey_1(a2, "k3", &a1->m_levelDesc);
v9 = 1;
}
DS_Dictionary::setStringForKey_1(a2, "k5", &a1->m_creatorName);
DS_Dictionary::setIntegerForKey_1(a2, "k95", a1->m_timestamp);
DS_Dictionary::setStringForKey_1(a2, "k91", &a1->m_lockedEditorLayers);
DS_Dictionary::setStringForKey_1(a2, "k101", &a1->m_savedCameraPositions);
DS_Dictionary::setIntegerForKey_1(a2, "k125", a1->m_cbsOverride);
x = a1->m_previewLock.x;
if ( x != 0.0 || a1->m_previewLock.y != 0.0 )
{
DS_Dictionary::setIntegerForKey_1(a2, "k102", (int)x);
DS_Dictionary::setIntegerForKey_1(a2, "k103", (int)a1->m_previewLock.y);
}
if ( v9 )
DS_Dictionary::setIntegerForKey_1(a2, "k6", a1->m_userID.random - a1->m_userID.seed);
DS_Dictionary::setIntegerForKey_1(a2, "k60", a1->m_accountID.random - a1->m_accountID.seed);
DS_Dictionary::setIntegerForKey_1(a2, "k7", a1->m_difficulty);
DS_Dictionary::setIntegerForKey_1(a2, "k8", a1->m_audioTrack);
DS_Dictionary::setIntegerForKey_1(a2, "k9", a1->m_ratings);
DS_Dictionary::setIntegerForKey_1(a2, "k10", a1->m_ratingsSum);
DS_Dictionary::setIntegerForKey_1(a2, "k11", a1->m_downloads);
DS_Dictionary::setBoolForKey_1(a2, "k13", a1->m_isEditable);
DS_Dictionary::setBoolForKey_1(a2, "k14", a1->m_isVerified.random - a1->m_isVerified.seed == 1);
DS_Dictionary::setBoolForKey_1(a2, "k15", a1->m_isUploaded);
DS_Dictionary::setIntegerForKey_1(a2, "k22", a1->m_likes);
DS_Dictionary::setIntegerForKey_1(a2, "k24", a1->m_dislikes);
DS_Dictionary::setIntegerForKey_1(a2, "k21", a1->m_levelType);
DS_Dictionary::setIntegerForKey_1(a2, "k16", a1->m_levelVersion);
if ( v9 )
DS_Dictionary::setIntegerForKey_1(a2, "k17", a1->m_gameVersion);
DS_Dictionary::setBoolForKey_1(a2, "k69", a1->m_highObjectsEnabled);
DS_Dictionary::setBoolForKey_1(a2, "k93", a1->m_unlimitedObjectsEnabled);
m_workingTime = a1->m_workingTime;
if ( m_workingTime >= 1 )
DS_Dictionary::setIntegerForKey_1(a2, "k80", m_workingTime);
m_workingTime2 = a1->m_workingTime2;
if ( m_workingTime2 >= 1 )
DS_Dictionary::setIntegerForKey_1(a2, "k81", m_workingTime2);
if ( v9 )
DS_Dictionary::setBoolForKey_1(a2, "k72", a1->m_lowDetailMode);
DS_Dictionary::setBoolForKey_1(a2, "k73", a1->m_lowDetailModeToggled);
DS_Dictionary::setBoolForKey_1(a2, "k112", a1->m_disableShakeToggled);
DS_Dictionary::setIntegerForKey_1(a2, "k83", a1->m_levelIndex);
DS_Dictionary::setIntegerForKey_1(a2, "k64", a1->m_coins);
DS_Dictionary::setBoolForKey_1(a2, "k65", a1->m_coinsVerified.random - a1->m_coinsVerified.seed == 1);
DS_Dictionary::setIntegerForKey_1(a2, "k27", a1->m_featured);
DS_Dictionary::setIntegerForKey_1(a2, "k75", a1->m_isEpic);
DS_Dictionary::setBoolForKey_1(a2, "k33", a1->m_autoLevel);
DS_Dictionary::setBoolForKey_1(a2, "k79", a1->m_unlisted);
DS_Dictionary::setBoolForKey_1(a2, "k94", a1->m_friendsOnly);
if ( v9 )
{
DS_Dictionary::setIntegerForKey_1(a2, "k41", a1->m_password.random - a1->m_password.seed);
DS_Dictionary::setIntegerForKey_1(a2, "k42", a1->m_originalLevel.random - a1->m_originalLevel.seed);
}
DS_Dictionary::setBoolForKey_1(a2, "k43", a1->m_twoPlayerMode);
DS_Dictionary::setIntegerForKey_1(a2, "k45", a1->m_songID);
DS_Dictionary::setIntegerForKey_1(a2, "k50", 48);
DS_Dictionary::setIntegerForKey_1(a2, "k46", a1->m_levelRev);
DS_Dictionary::setBoolForKey_1(a2, "k47", a1->m_hasBeenModified);
DS_Dictionary::setIntegerForKey_1(a2, "k48", a1->m_objectCount.random - a1->m_objectCount.seed);
if ( v9 )
DS_Dictionary::setStringForKey_1(a2, "k67", &a1->m_capacityString);
DS_Dictionary::setStringForKey_1(a2, "k104", &a1->m_songIDs);
DS_Dictionary::setStringForKey_1(a2, "k105", &a1->m_sfxIDs);
DS_Dictionary::setIntegerForKey_1(a2, "k106", a1->m_songSize);
DS_Dictionary::setIntegerForKey_1(a2, "k66", a1->m_starsRequested);
m_levelType = a1->m_levelType;
if ( m_levelType == Main )
{
DS_Dictionary::setBoolForKey_1(a2, "k38", a1->m_isUnlocked);
DS_Dictionary::setIntegerForKey_1(a2, "k37", a1->m_requiredCoins);
m_levelType = a1->m_levelType;
}
if ( m_levelType == Editor )
{
DS_Dictionary::setFloatForKey_1(a2, "kI1", a1->m_lastCameraPos.x);
DS_Dictionary::setFloatForKey_1(a2, "kI2", a1->m_lastCameraPos.y);
DS_Dictionary::setFloatForKey_1(a2, "kI3", a1->m_lastEditorZoom);
DS_Dictionary::setIntegerForKey_1(a2, "kI4", a1->m_lastBuildPage);
DS_Dictionary::setIntegerForKey_1(a2, "kI5", a1->m_lastBuildTab);
DS_Dictionary::setIntegerForKey_1(a2, "kI7", a1->m_lastBuildGroupID);
DS_Dictionary::setDictForKey(a2, "kI6", a1->m_lastBuildSave);
DS_Dictionary::setBoolForKey_1(a2, "k61", a1->m_firstCoinVerified.random - a1->m_firstCoinVerified.seed == 1);
DS_Dictionary::setBoolForKey_1(a2, "k62", a1->m_secondCoinVerified.random - a1->m_secondCoinVerified.seed == 1);
DS_Dictionary::setBoolForKey_1(a2, "k63", a1->m_thirdCoinVerified.random - a1->m_thirdCoinVerified.seed == 1);
DS_Dictionary::setStringForKey_1(a2, "k34", &a1->m_recordString);
}
}
}