//
// GJGameLevel::encodeWithCoder from 0x14016ef00 to 0x14016fb54 (3156 bytes)
//
// 2 xrefs:
// > ??> @ 0x14055c378
// > ??> @ 0x1406cae48
//
// 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
//
// Hidden C++ exception states: #wind=2
void GJGameLevel::encodeWithCoder(GJGameLevel *a1, DS_Dictionary *a2)
{
bool m_isCompletionLegitimate; // r8
bool m_levelFavorited; // r8
int m_levelFolder; // r8d
int m_bestTime; // r8d
std::string *p_m_levelName; // rcx
std::string *p_m_tempName; // rdx
std::size_t m_size; // r8
char v11; // si
__int64 v12; // rax
float x; // xmm2_4
int m_workingTime; // r8d
int m_workingTime2; // r8d
void *v16; // [rsp+20h] [rbp-38h]
__int128 v17; // [rsp+28h] [rbp-30h] BYREF
__int64 v18; // [rsp+38h] [rbp-20h]
__int64 v19; // [rsp+40h] [rbp-18h]
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_14003BDB0((__int64)&v17, (__int64)&a1->m_personalBests);
DS_Dictionary::setStringForKey(a2, "k88", &v17);
sub_14003A830((__int64)&v17);
DS_Dictionary::setBoolForKey(a2, "k89", a1->m_isChkValid);
DS_Dictionary::setIntegerForKey(a2, "k23", a1->m_levelLength);
DS_Dictionary::setIntegerForKey(a2, "k19", a1->m_normalPercent.random - a1->m_normalPercent.seed);
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);
}
if ( a1->m_stars.random - a1->m_stars.seed > 0 )
DS_Dictionary::setIntegerForKey(a2, "k26", a1->m_stars.random - a1->m_stars.seed);
m_isCompletionLegitimate = a1->m_isCompletionLegitimate;
if ( m_isCompletionLegitimate )
DS_Dictionary::setBoolForKey(a2, "k68", m_isCompletionLegitimate);
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);
m_levelFavorited = a1->m_levelFavorited;
if ( m_levelFavorited )
DS_Dictionary::setBoolForKey(a2, "k82", m_levelFavorited);
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 ( a1->m_localBestTimes.m_data.m_size )
DS_Dictionary::setStringForKey(a2, "k109", &a1->m_localBestTimes);
if ( a1->m_localBestPoints.m_data.m_size )
DS_Dictionary::setStringForKey(a2, "k110", &a1->m_localBestPoints);
if ( !a1->m_levelNotDownloaded )
{
if ( a1->m_levelName.m_data.m_size )
goto LABEL_31;
p_m_levelName = &a1->m_levelName;
if ( a1->m_tempName.m_data.m_size )
{
if ( p_m_levelName == &a1->m_tempName )
goto LABEL_31;
p_m_tempName = &a1->m_tempName;
if ( a1->m_tempName.m_data.m_capacity > 0xF )
p_m_tempName = (std::string *)a1->m_tempName.m_data.m_bigStorage;
m_size = a1->m_tempName.m_data.m_size;
}
else
{
m_size = 7;
p_m_tempName = (std::string *)&qword_1405515B8;
}
sub_14003CCE0((void **)p_m_levelName, p_m_tempName, m_size);
LABEL_31:
DS_Dictionary::setStringForKey(a2, "k2", &a1->m_levelName);
v11 = 0;
if ( !a1->m_levelNotDownloaded
&& !a1->m_dontSave
&& a1->m_levelType != Main
&& a1->m_dailyID.random - a1->m_dailyID.seed <= 0 )
{
v12 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v16 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v12 = qword_1406C2ED8;
}
if ( !*(_BYTE *)(v12 + 354) )
goto LABEL_42;
}
if ( a1->m_levelType != Editor && (a1->m_dailyID.random - a1->m_dailyID.seed <= 0 || a1->m_dontSave) )
{
v17 = 0;
v18 = 0;
v19 = 15;
LOBYTE(v17) = 0;
DS_Dictionary::setStringForKey(a2, "k4", &v17);
sub_14003A830((__int64)&v17);
}
else
{
LABEL_42:
DS_Dictionary::setStringForKey(a2, "k4", &a1->m_levelString);
v11 = 1;
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);
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 ( v11 )
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 ( v11 )
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 ( v11 )
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 ( v11 )
{
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", 47);
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 ( v11 )
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", a1->m_firstCoinVerified.random - a1->m_firstCoinVerified.seed == 1);
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);
}
}
}