//
// GJGameLevel::encodeWithCoder from 0x10055ea40 to 0x10055f5d5 (2965 bytes)
//
// 1 xrefs:
// > ??> @ 0x100960c40
//
// 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)
{
double v2; // xmm0_8
int random; // edx
bool v5; // cc
int v6; // edx
int m_levelFolder; // edx
int m_bestTime; // edx
unsigned int sizex2; // eax
unsigned int v10; // eax
unsigned int v11; // eax
std::string *p_m_levelName; // r15
unsigned int v13; // eax
char v14; // r15
float x; // xmm0_4
int m_workingTime; // edx
int m_workingTime2; // edx
GJLevelType m_levelType; // eax
__int128 v19; // [rsp+0h] [rbp-30h] BYREF
void *__p; // [rsp+10h] [rbp-20h]
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.sizex2 & 1) != 0 )
{
sub_100006B70(&v19, a1->m_personalBests.m_data.m_long.longStorage, a1->m_personalBests.m_data.m_long.size, v2);
}
else
{
__p = a1->m_personalBests.m_data.m_long.longStorage;
v19 = *(_OWORD *)&a1->m_personalBests.m_data.m_short.sizex2;
}
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"k88", (__int64)&v19);
if ( (v19 & 1) != 0 )
operator delete(__p);
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);
}
random = a1->m_stars.random;
v5 = random <= a1->m_stars.seed;
v6 = random - a1->m_stars.seed;
if ( !v5 )
DS_Dictionary::setIntegerForKey_1(a2, "k26", v6);
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 > 0 )
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((__int64)a2, (__int64)"k119", (__int64)&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((__int64)a2, (__int64)"k120", (__int64)&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);
}
sizex2 = a1->m_localBestTimes.m_data.m_short.sizex2;
if ( (sizex2 & 1) != 0 )
{
if ( !a1->m_localBestTimes.m_data.m_long.size )
goto LABEL_28;
goto LABEL_27;
}
if ( sizex2 >> 1 )
LABEL_27:
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"k109", (__int64)&a1->m_localBestTimes);
LABEL_28:
v10 = a1->m_localBestPoints.m_data.m_short.sizex2;
if ( (v10 & 1) != 0 )
{
if ( !a1->m_localBestPoints.m_data.m_long.size )
goto LABEL_33;
goto LABEL_32;
}
if ( v10 >> 1 )
LABEL_32:
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"k110", (__int64)&a1->m_localBestPoints);
LABEL_33:
if ( a1->m_levelNotDownloaded )
return;
v11 = a1->m_levelName.m_data.m_short.sizex2;
if ( (v11 & 1) != 0 )
{
p_m_levelName = (std::string *)&a1->m_levelName;
if ( !a1->m_levelName.m_data.m_long.size )
goto LABEL_38;
}
else
{
p_m_levelName = (std::string *)&a1->m_levelName;
if ( !(v11 >> 1) )
{
LABEL_38:
v13 = a1->m_tempName.m_data.m_short.sizex2;
if ( (v13 & 1) != 0 )
{
if ( a1->m_tempName.m_data.m_long.size )
goto LABEL_40;
}
else if ( v13 >> 1 )
{
LABEL_40:
std::string::operator=(p_m_levelName, (const std::string *)&a1->m_tempName);
goto LABEL_43;
}
std::string::assign(p_m_levelName, "Unknown");
}
}
LABEL_43:
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"k2", (__int64)p_m_levelName);
if ( (*(_WORD *)&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) )
{
LOWORD(v19) = 0;
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"k4", (__int64)&v19);
if ( (v19 & 1) != 0 )
operator delete(__p);
v14 = 0;
}
else
{
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"k4", (__int64)&a1->m_levelString);
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"k3", (__int64)&a1->m_levelDesc);
v14 = 1;
}
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"k5", (__int64)&a1->m_creatorName);
DS_Dictionary::setIntegerForKey_1(a2, "k95", a1->m_timestamp);
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"k91", (__int64)&a1->m_lockedEditorLayers);
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"k101", (__int64)&a1->m_savedCameraPositions);
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 ( v14 )
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 ( v14 )
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 > 0 )
DS_Dictionary::setIntegerForKey_1(a2, "k80", m_workingTime);
m_workingTime2 = a1->m_workingTime2;
if ( m_workingTime2 > 0 )
DS_Dictionary::setIntegerForKey_1(a2, "k81", m_workingTime2);
if ( v14 )
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 ( v14 )
{
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", 47);
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 ( v14 )
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"k67", (__int64)&a1->m_capacityString);
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"k104", (__int64)&a1->m_songIDs);
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"k105", (__int64)&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((__int64)a2, (__int64)"k34", (__int64)&a1->m_recordString);
}
}