//
// GJGameLevel::encodeWithCoder from 0x3c7cc0 to 0x3c8522 (2146 bytes)
//
// 0 xrefs:
//
// 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::encodeWithCoder(GJGameLevel *a1, DS_Dictionary *a2)
{
int NormalPercent; // r0
int v5; // r2
int m_levelFolder; // r2
int m_bestTime; // r2
std::string *p_m_levelName; // r0
int v9; // r6
float x; // s15
int m_workingTime; // r2
int m_workingTime2; // r2
std::string v13; // [sp+8h] [bp-8h] BYREF
DS_Dictionary::setIntegerForKey(a2, "kCEK", 4);
DS_Dictionary::setIntegerForKey(a2, "k1", a1->m_levelID.random - a1->m_levelID.seed);
DS_Dictionary::setBoolForKey(a2, "k35", a1->m_levelNotDownloaded);
DS_Dictionary::setIntegerForKey(a2, "k18", a1->m_attempts.random - a1->m_attempts.seed);
DS_Dictionary::setIntegerForKey(a2, "k36", a1->m_jumps.random - a1->m_jumps.seed);
DS_Dictionary::setIntegerForKey(a2, "k85", a1->m_clicks.random - a1->m_clicks.seed);
DS_Dictionary::setIntegerForKey(a2, "k86", a1->m_attemptTime.random - a1->m_attemptTime.seed);
DS_Dictionary::setIntegerForKey(a2, "k87", a1->m_chk);
sub_775C20(&v13, &a1->m_personalBests);
DS_Dictionary::setStringForKey(a2, "k88", &v13);
sub_774008(&v13);
DS_Dictionary::setBoolForKey(a2, "k89", a1->m_isChkValid);
DS_Dictionary::setIntegerForKey(a2, "k23", a1->m_levelLength);
NormalPercent = GJGameLevel::getNormalPercent(a1);
DS_Dictionary::setIntegerForKey(a2, "k19", NormalPercent);
DS_Dictionary::setIntegerForKey(a2, "k71", a1->m_orbCompletion.random - a1->m_orbCompletion.seed);
DS_Dictionary::setIntegerForKey(a2, "k90", a1->m_newNormalPercent2.random - a1->m_newNormalPercent2.seed);
DS_Dictionary::setIntegerForKey(a2, "k20", a1->m_practicePercent);
if ( a1->m_demon.random - a1->m_demon.seed == 1 )
{
DS_Dictionary::setBoolForKey(a2, "k25", 1);
DS_Dictionary::setIntegerForKey(a2, "k76", a1->m_demonDifficulty);
}
v5 = a1->m_stars.random - a1->m_stars.seed;
if ( v5 > 0 )
DS_Dictionary::setIntegerForKey(a2, "k26", v5);
if ( a1->m_isCompletionLegitimate )
DS_Dictionary::setBoolForKey(a2, "k68", 1);
DS_Dictionary::setIntegerForKey(a2, "k74", a1->m_dailyID.random - a1->m_dailyID.seed);
DS_Dictionary::setBoolForKey(a2, "k77", a1->m_gauntletLevel);
DS_Dictionary::setBoolForKey(a2, "k78", a1->m_gauntletLevel2);
if ( a1->m_levelFavorited )
DS_Dictionary::setBoolForKey(a2, "k82", 1);
m_levelFolder = a1->m_levelFolder;
if ( m_levelFolder > 0 )
DS_Dictionary::setIntegerForKey(a2, "k84", m_levelFolder);
m_bestTime = a1->m_bestTime;
if ( m_bestTime > 0 || a1->m_bestPoints )
{
DS_Dictionary::setIntegerForKey(a2, "k107", m_bestTime);
DS_Dictionary::setIntegerForKey(a2, "k115", a1->m_ticksTime);
DS_Dictionary::setIntegerForKey(a2, "k117", a1->m_clicksTime);
DS_Dictionary::setIntegerForKey(a2, "k121", a1->m_coinsTime);
if ( a1->m_savedTime )
DS_Dictionary::setStringForKey(a2, "k119", &a1->m_inputsTime);
DS_Dictionary::setIntegerForKey(a2, "k108", a1->m_bestPoints);
DS_Dictionary::setIntegerForKey(a2, "k116", a1->m_ticksPoints);
DS_Dictionary::setIntegerForKey(a2, "k118", a1->m_clicksPoints);
DS_Dictionary::setIntegerForKey(a2, "k122", a1->m_coinsPoints);
if ( a1->m_savedPoints )
DS_Dictionary::setStringForKey(a2, "k120", &a1->m_inputsPoints);
DS_Dictionary::setIntegerForKey(a2, "k111", a1->m_platformerSeed);
DS_Dictionary::setBoolForKey(a2, "k123", a1->m_savedTime);
DS_Dictionary::setBoolForKey(a2, "k124", a1->m_savedPoints);
}
if ( *((_DWORD *)a1->m_localBestTimes.m_data.m_data - 3) )
DS_Dictionary::setStringForKey(a2, "k109", &a1->m_localBestTimes);
if ( *((_DWORD *)a1->m_localBestPoints.m_data.m_data - 3) )
DS_Dictionary::setStringForKey(a2, "k110", &a1->m_localBestPoints);
if ( !a1->m_levelNotDownloaded )
{
if ( !*((_DWORD *)a1->m_levelName.m_data.m_data - 3) )
{
p_m_levelName = &a1->m_levelName;
if ( *((_DWORD *)a1->m_tempName.m_data.m_data - 3) )
sub_775D40(p_m_levelName, &a1->m_tempName);
else
sub_7753D4((int)p_m_levelName, "Unknown");
}
DS_Dictionary::setStringForKey(a2, "k2", &a1->m_levelName);
if ( (a1->m_levelNotDownloaded
|| a1->m_dontSave
|| a1->m_levelType == Main
|| a1->m_dailyID.random - a1->m_dailyID.seed > 0
|| GameManager::sharedState()->m_quickSave)
&& a1->m_levelType != Editor
&& (a1->m_dailyID.random - a1->m_dailyID.seed <= 0 || a1->m_dontSave) )
{
sub_776584((int)&v13, (char *)&unk_939830);
DS_Dictionary::setStringForKey(a2, "k4", &v13);
v9 = 0;
sub_774008(&v13);
}
else
{
v9 = 1;
DS_Dictionary::setStringForKey(a2, "k4", &a1->m_levelString);
DS_Dictionary::setStringForKey(a2, "k3", &a1->m_levelDesc);
}
DS_Dictionary::setStringForKey(a2, "k5", &a1->m_creatorName);
DS_Dictionary::setIntegerForKey(a2, "k95", a1->m_timestamp);
DS_Dictionary::setStringForKey(a2, "k91", &a1->m_lockedEditorLayers);
DS_Dictionary::setStringForKey(a2, "k101", &a1->m_savedCameraPositions);
DS_Dictionary::setIntegerForKey(a2, "k125", a1->m_cbsOverride);
x = a1->m_previewLock.x;
if ( x != 0.0 || a1->m_previewLock.y != 0.0 )
{
DS_Dictionary::setIntegerForKey(a2, "k102", (int)x);
DS_Dictionary::setIntegerForKey(a2, "k103", (int)a1->m_previewLock.y);
}
if ( v9 )
DS_Dictionary::setIntegerForKey(a2, "k6", a1->m_userID.random - a1->m_userID.seed);
DS_Dictionary::setIntegerForKey(a2, "k60", a1->m_accountID.random - a1->m_accountID.seed);
DS_Dictionary::setIntegerForKey(a2, "k7", a1->m_difficulty);
DS_Dictionary::setIntegerForKey(a2, "k8", a1->m_audioTrack);
DS_Dictionary::setIntegerForKey(a2, "k9", a1->m_ratings);
DS_Dictionary::setIntegerForKey(a2, "k10", a1->m_ratingsSum);
DS_Dictionary::setIntegerForKey(a2, "k11", a1->m_downloads);
DS_Dictionary::setBoolForKey(a2, "k13", a1->m_isEditable);
DS_Dictionary::setBoolForKey(a2, "k14", a1->m_isVerified.random - a1->m_isVerified.seed == 1);
DS_Dictionary::setBoolForKey(a2, "k15", a1->m_isUploaded);
DS_Dictionary::setIntegerForKey(a2, "k22", a1->m_likes);
DS_Dictionary::setIntegerForKey(a2, "k24", a1->m_dislikes);
DS_Dictionary::setIntegerForKey(a2, "k21", a1->m_levelType);
DS_Dictionary::setIntegerForKey(a2, "k16", a1->m_levelVersion);
if ( v9 )
DS_Dictionary::setIntegerForKey(a2, "k17", a1->m_gameVersion);
DS_Dictionary::setBoolForKey(a2, "k69", a1->m_highObjectsEnabled);
DS_Dictionary::setBoolForKey(a2, "k93", a1->m_unlimitedObjectsEnabled);
m_workingTime = a1->m_workingTime;
if ( m_workingTime > 0 )
DS_Dictionary::setIntegerForKey(a2, "k80", m_workingTime);
m_workingTime2 = a1->m_workingTime2;
if ( m_workingTime2 > 0 )
DS_Dictionary::setIntegerForKey(a2, "k81", m_workingTime2);
if ( v9 )
DS_Dictionary::setBoolForKey(a2, "k72", a1->m_lowDetailMode);
DS_Dictionary::setBoolForKey(a2, "k73", a1->m_lowDetailModeToggled);
DS_Dictionary::setBoolForKey(a2, "k112", a1->m_disableShakeToggled);
DS_Dictionary::setIntegerForKey(a2, "k83", a1->m_levelIndex);
DS_Dictionary::setIntegerForKey(a2, "k64", a1->m_coins);
DS_Dictionary::setBoolForKey(a2, "k65", a1->m_coinsVerified.random - a1->m_coinsVerified.seed == 1);
DS_Dictionary::setIntegerForKey(a2, "k27", a1->m_featured);
DS_Dictionary::setIntegerForKey(a2, "k75", a1->m_isEpic);
DS_Dictionary::setBoolForKey(a2, "k33", a1->m_autoLevel);
DS_Dictionary::setBoolForKey(a2, "k79", a1->m_unlisted);
DS_Dictionary::setBoolForKey(a2, "k94", a1->m_friendsOnly);
if ( v9 )
{
DS_Dictionary::setIntegerForKey(a2, "k41", a1->m_password.random - a1->m_password.seed);
DS_Dictionary::setIntegerForKey(a2, "k42", a1->m_originalLevel.random - a1->m_originalLevel.seed);
}
DS_Dictionary::setBoolForKey(a2, "k43", a1->m_twoPlayerMode);
DS_Dictionary::setIntegerForKey(a2, "k45", a1->m_songID);
DS_Dictionary::setIntegerForKey(a2, "k50", 48);
DS_Dictionary::setIntegerForKey(a2, "k46", a1->m_levelRev);
DS_Dictionary::setBoolForKey(a2, "k47", a1->m_hasBeenModified);
DS_Dictionary::setIntegerForKey(a2, "k48", a1->m_objectCount.random - a1->m_objectCount.seed);
if ( v9 )
DS_Dictionary::setStringForKey(a2, "k67", &a1->m_capacityString);
DS_Dictionary::setStringForKey(a2, "k104", &a1->m_songIDs);
DS_Dictionary::setStringForKey(a2, "k105", &a1->m_sfxIDs);
DS_Dictionary::setIntegerForKey(a2, "k106", a1->m_songSize);
DS_Dictionary::setIntegerForKey(a2, "k66", a1->m_starsRequested);
if ( a1->m_levelType == Main )
{
DS_Dictionary::setBoolForKey(a2, "k38", a1->m_isUnlocked);
DS_Dictionary::setIntegerForKey(a2, "k37", a1->m_requiredCoins);
}
if ( a1->m_levelType == Editor )
{
DS_Dictionary::setFloatForKey(a2, "kI1", a1->m_lastCameraPos.x);
DS_Dictionary::setFloatForKey(a2, "kI2", a1->m_lastCameraPos.y);
DS_Dictionary::setFloatForKey(a2, "kI3", a1->m_lastEditorZoom);
DS_Dictionary::setIntegerForKey(a2, "kI4", a1->m_lastBuildPage);
DS_Dictionary::setIntegerForKey(a2, "kI5", a1->m_lastBuildTab);
DS_Dictionary::setIntegerForKey(a2, "kI7", a1->m_lastBuildGroupID);
DS_Dictionary::setDictForKey(a2, "kI6", a1->m_lastBuildSave);
DS_Dictionary::setBoolForKey(
a2,
"k61",
LOBYTE(a1->m_firstCoinVerified.random)
- LOBYTE(a1->m_firstCoinVerified.seed)
+ (a1->m_firstCoinVerified.random - a1->m_firstCoinVerified.seed == 1)
+ LOBYTE(a1->m_firstCoinVerified.seed)
- LOBYTE(a1->m_firstCoinVerified.random));
DS_Dictionary::setBoolForKey(a2, "k62", a1->m_secondCoinVerified.random - a1->m_secondCoinVerified.seed == 1);
DS_Dictionary::setBoolForKey(a2, "k63", a1->m_thirdCoinVerified.random - a1->m_thirdCoinVerified.seed == 1);
DS_Dictionary::setStringForKey(a2, "k34", &a1->m_recordString);
}
}
}