//
// GameManager::encodeDataTo from 0x100375300 to 0x100376239 (3897 bytes)
//
// 1 xrefs:
// > ??> @ 0x100b270b8
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:29:04 +0000
//
__int64 __fastcall GameManager::encodeDataTo(__int64 a1, __int64 a2, __int64 a3, double a4)
{
__int64 v4; // r15
__int64 v6; // rax
void *v7; // r15
__int64 v8; // rdi
__int64 v9; // rax
__int64 v10; // rax
double v11; // xmm0_8
__int64 v12; // rax
__int64 v13; // rax
double v14; // xmm0_8
__int64 v15; // rax
__int64 v16; // rdi
__int64 v17; // rdi
__int64 v18; // rdi
__int64 v19; // rax
__int64 v20; // rdi
__int64 v21; // rax
_QWORD *v22; // r14
_QWORD *v23; // rbx
unsigned int v24; // r12d
_QWORD *v25; // rcx
_QWORD *v26; // rax
bool v27; // zf
const char *v28; // r14
size_t v29; // rax
size_t v30; // r12
char *v31; // r13
size_t v32; // r15
const char *v33; // r14
size_t v34; // rax
size_t v35; // r12
char *v36; // r13
size_t v37; // r15
const char *v38; // r14
size_t v39; // rax
size_t v40; // r12
char *v41; // r13
size_t v42; // r15
const char *v43; // r14
size_t v44; // rax
size_t v45; // r12
char *v46; // r13
size_t v47; // r15
const char *v48; // r14
size_t v49; // rax
size_t v50; // r12
char *v51; // r13
size_t v52; // r15
const char *v53; // r14
size_t v54; // rax
size_t v55; // r12
char *v56; // r13
size_t v57; // r15
const char *v58; // r14
size_t v59; // rax
size_t v60; // r12
char *v61; // r13
size_t v62; // r15
_QWORD *v64; // [rsp+8h] [rbp-68h]
__int64 v65; // [rsp+18h] [rbp-58h]
char __str[8]; // [rsp+20h] [rbp-50h] BYREF
size_t v67; // [rsp+28h] [rbp-48h]
void *__p; // [rsp+30h] [rbp-40h]
v4 = a2;
v6 = qword_100BE3098;
if ( !qword_100BE3098 )
{
v7 = operator new(0x6B8u);
sub_100377960(v7);
qword_100BE3098 = (__int64)v7;
(*(void (__fastcall **)(void *))(*(_QWORD *)v7 + 80LL))(v7);
v6 = qword_100BE3098;
v4 = a2;
}
v8 = *(_QWORD *)(v6 + 544);
if ( v8 )
PlayLayer::writePersistentSave(v8, a2, a3);
DS_Dictionary::setDictForKey(v4, "valueKeeper", *(_QWORD *)(a1 + 424));
if ( !*(_BYTE *)(a1 + 440) )
DS_Dictionary::setDictForKey(v4, "localKeeper", *(_QWORD *)(a1 + 432));
DS_Dictionary::setDictForKey(v4, "unlockValueKeeper", *(_QWORD *)(a1 + 448));
DS_Dictionary::setDictForKey(v4, "customObjectDict", *(_QWORD *)(a1 + 456));
v9 = FMODAudioEngine::sharedEngine(a4);
*(float *)&a4 = FMODAudioEngine::getBackgroundMusicVolume(v9);
DS_Dictionary::setFloatForKey_1(v4, (__int64)"bgVolume");
v10 = FMODAudioEngine::sharedEngine(a4);
v11 = sub_1003D3F10(v10);
DS_Dictionary::setFloatForKey_1(v4, (__int64)"sfxVolume");
v12 = FMODAudioEngine::sharedEngine(v11);
DS_Dictionary::setIntegerForKey_1(v4, (__int64)"timeOffset", *(unsigned int *)(v12 + 548));
DS_Dictionary::setStringForKey_1(v4, (__int64)"playerUDID", a1 + 608);
DS_Dictionary::setStringForKey_1(v4, (__int64)"playerName", a1 + 632);
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"playerUserID",
(unsigned int)(*(_DWORD *)(a1 + 660) - *(_DWORD *)(a1 + 664)));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"playerFrame",
(unsigned int)(*(_DWORD *)(a1 + 716) - *(_DWORD *)(a1 + 720)));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"playerShip",
(unsigned int)(*(_DWORD *)(a1 + 728) - *(_DWORD *)(a1 + 732)));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"playerBall",
(unsigned int)(*(_DWORD *)(a1 + 740) - *(_DWORD *)(a1 + 744)));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"playerBird",
(unsigned int)(*(_DWORD *)(a1 + 752) - *(_DWORD *)(a1 + 756)));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"playerDart",
(unsigned int)(*(_DWORD *)(a1 + 764) - *(_DWORD *)(a1 + 768)));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"playerRobot",
(unsigned int)(*(_DWORD *)(a1 + 776) - *(_DWORD *)(a1 + 780)));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"playerSpider",
(unsigned int)(*(_DWORD *)(a1 + 788) - *(_DWORD *)(a1 + 792)));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"playerSwing",
(unsigned int)(*(_DWORD *)(a1 + 800) - *(_DWORD *)(a1 + 804)));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"playerColor",
(unsigned int)(*(_DWORD *)(a1 + 812) - *(_DWORD *)(a1 + 816)));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"playerColor2",
(unsigned int)(*(_DWORD *)(a1 + 824) - *(_DWORD *)(a1 + 828)));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"playerColor3",
(unsigned int)(*(_DWORD *)(a1 + 836) - *(_DWORD *)(a1 + 840)));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"playerStreak",
(unsigned int)(*(_DWORD *)(a1 + 848) - *(_DWORD *)(a1 + 852)));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"playerShipStreak",
(unsigned int)(*(_DWORD *)(a1 + 860) - *(_DWORD *)(a1 + 864)));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"playerDeathEffect",
(unsigned int)(*(_DWORD *)(a1 + 872) - *(_DWORD *)(a1 + 876)));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"playerJetpack",
(unsigned int)(*(_DWORD *)(a1 + 884) - *(_DWORD *)(a1 + 888)));
DS_Dictionary::setIntegerForKey_1(v4, (__int64)"playerIconType", *(unsigned int *)(a1 + 916));
DS_Dictionary::setBoolForKey_1(v4, (__int64)"playerGlow", *(unsigned __int8 *)(a1 + 912));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"secretNumber",
(unsigned int)(*(_DWORD *)(a1 + 904) - *(_DWORD *)(a1 + 908)));
DS_Dictionary::setIntegerForKey_1(
v4,
(__int64)"hasRP",
(unsigned int)(*(_DWORD *)(a1 + 1032) - *(_DWORD *)(a1 + 1036)));
DS_Dictionary::setBoolForKey_1(v4, (__int64)"hasDRP", *(unsigned __int8 *)(a1 + 1044));
DS_Dictionary::setIntegerForKey_1(v4, (__int64)"specialPermKey", *(unsigned int *)(a1 + 1048));
v13 = AchievementManager::sharedState(v4, "specialPermKey");
v14 = AchievementManager::encodeDataTo(v13, v4);
v15 = GameLevelManager::sharedState(v14);
GameLevelManager::encodeDataTo(v15, v4);
v16 = GameStatsManager::sharedState();
GameStatsManager::encodeDataTo(v16, v4);
v17 = MusicDownloadManager::sharedState(v16);
MusicDownloadManager::encodeDataTo(v17, v4);
v18 = GJAccountManager::sharedState(v17, v4);
GJAccountManager::encodeDataTo(v18, v4);
v19 = GJMultiplayerManager::sharedState(v18);
GJMultiplayerManager::encodeDataTo(v19, v4);
v20 = GJKeybindManager::sharedState();
GJKeybindManager::encodeDataTo(v20, v4);
v21 = EditorSFXManager::sharedState(v20);
EditorSFXManager::encodeDataTo(v21, v4);
DS_Dictionary::setBoolForKey_1(v4, (__int64)"showSongMarkers", *(unsigned __int8 *)(a1 + 921));
DS_Dictionary::setBoolForKey_1(v4, (__int64)"showBPMMarkers", *(unsigned __int8 *)(a1 + 922));
DS_Dictionary::setBoolForKey_1(v4, (__int64)"recordGameplay", *(unsigned __int8 *)(a1 + 923));
DS_Dictionary::setBoolForKey_1(v4, (__int64)"showProgressBar", *(unsigned __int8 *)(a1 + 924));
DS_Dictionary::setBoolForKey_1(v4, (__int64)"performanceMode", *(unsigned __int8 *)(a1 + 925));
DS_Dictionary::setBoolForKey_1(v4, (__int64)"clickedGarage", *(unsigned __int8 *)(a1 + 927));
DS_Dictionary::setBoolForKey_1(v4, (__int64)"clickedEditor", *(unsigned __int8 *)(a1 + 928));
DS_Dictionary::setBoolForKey_1(v4, (__int64)"clickedName", *(unsigned __int8 *)(a1 + 929));
DS_Dictionary::setBoolForKey_1(v4, (__int64)"clickedPractice", *(unsigned __int8 *)(a1 + 930));
DS_Dictionary::setBoolForKey_1(v4, (__int64)"showedEditorGuide", *(unsigned __int8 *)(a1 + 931));
DS_Dictionary::setBoolForKey_1(v4, (__int64)"showedRateDiffDialog", *(unsigned __int8 *)(a1 + 932));
DS_Dictionary::setBoolForKey_1(v4, (__int64)"showedRateStarDialog", *(unsigned __int8 *)(a1 + 933));
DS_Dictionary::setBoolForKey_1(v4, (__int64)"showedLowDetailDialog", *(unsigned __int8 *)(a1 + 934));
DS_Dictionary::setIntegerForKey_1(v4, (__int64)"bootups", *(unsigned int *)(a1 + 1020));
DS_Dictionary::setBoolForKey_1(v4, (__int64)"hasRatedGame", *(unsigned __int8 *)(a1 + 1024));
DS_Dictionary::setIntegerForKey_1(v4, (__int64)"binaryVersion", 51);
DS_Dictionary::setIntegerForKey_1(v4, (__int64)"resolution", *(unsigned int *)(a1 + 1056));
DS_Dictionary::setIntegerForKey_1(v4, (__int64)"texQuality", *(unsigned int *)(a1 + 1060));
DS_Dictionary::setFloatForKey_1(v4, (__int64)"customFPSTarget");
DS_Dictionary::setFloatForKey_1(v4, (__int64)"scrollSensitivity");
v22 = *(_QWORD **)(a1 + 1112);
v65 = a1;
v23 = (_QWORD *)(a1 + 1120);
if ( v22 == (_QWORD *)(a1 + 1120) )
{
v24 = 0;
}
else
{
v24 = 0;
v64 = v23;
do
{
if ( !*((_BYTE *)v22 + 60) )
{
snprintf(__str, 0x20u, "ws_%d_k", v24);
DS_Dictionary::setIntegerForKey_1(v4, (__int64)__str, *((unsigned int *)v22 + 7));
snprintf(__str, 0x20u, "ws_%d_cx", v24);
DS_Dictionary::setFloatForKey_1(v4, (__int64)__str);
snprintf(__str, 0x20u, "ws_%d_cy", v24);
DS_Dictionary::setFloatForKey_1(v4, (__int64)__str);
snprintf(__str, 0x20u, "ws_%d_w", v24);
DS_Dictionary::setFloatForKey_1(v4, (__int64)__str);
snprintf(__str, 0x20u, "ws_%d_h", v24);
DS_Dictionary::setFloatForKey_1(v4, (__int64)__str);
snprintf(__str, 0x20u, "ws_%d_s", v24);
DS_Dictionary::setFloatForKey_1(v4, (__int64)__str);
snprintf(__str, 0x20u, "ws_%d_so", v24);
DS_Dictionary::setFloatForKey_1(v4, (__int64)__str);
snprintf(__str, 0x20u, "ws_%d_v", v24);
DS_Dictionary::setIntegerForKey_1(v4, (__int64)__str, *((unsigned int *)v22 + 14));
++v24;
v23 = v64;
}
v25 = (_QWORD *)v22[1];
if ( v25 )
{
do
{
v26 = v25;
v25 = (_QWORD *)*v25;
}
while ( v25 );
}
else
{
do
{
v26 = (_QWORD *)v22[2];
v27 = *v26 == (_QWORD)v22;
v22 = v26;
}
while ( !v27 );
}
v22 = v26;
}
while ( v26 != v23 );
}
DS_Dictionary::setIntegerForKey_1(v4, (__int64)"winStateCount", v24);
DS_Dictionary::setIntegerForKey_1(v4, (__int64)"customMenuSongID", *(unsigned int *)(v65 + 1140));
DS_Dictionary::setIntegerForKey_1(v4, (__int64)"customPracticeSongID", *(unsigned int *)(v65 + 1144));
DS_Dictionary::setIntegerForKey_1(v4, (__int64)"idNameSortMode", *(unsigned int *)(v65 + 1148));
DS_Dictionary::setIntegerForKey_1(v4, (__int64)"newsLastReadID", *(unsigned int *)(v65 + 1152));
GameManager::dpadConfigToString((size_t *)__str, (__int64)"newsLastReadID", v65 + 1316);
DS_Dictionary::setStringForKey_1(v4, (__int64)"dpad01", (__int64)__str);
if ( (__str[0] & 1) != 0 )
operator delete(__p);
GameManager::dpadConfigToString((size_t *)__str, (__int64)"dpad01", v65 + 1356);
DS_Dictionary::setStringForKey_1(a2, (__int64)"dpad02", (__int64)__str);
if ( (__str[0] & 1) != 0 )
operator delete(__p);
GameManager::dpadConfigToString((size_t *)__str, (__int64)"dpad02", v65 + 1396);
DS_Dictionary::setStringForKey_1(a2, (__int64)"dpad03", (__int64)__str);
if ( (__str[0] & 1) != 0 )
operator delete(__p);
GameManager::dpadConfigToString((size_t *)__str, (__int64)"dpad03", v65 + 1436);
DS_Dictionary::setStringForKey_1(a2, (__int64)"dpad04", (__int64)__str);
if ( (__str[0] & 1) != 0 )
operator delete(__p);
GameManager::dpadConfigToString((size_t *)__str, (__int64)"dpad04", v65 + 1476);
DS_Dictionary::setStringForKey_1(a2, (__int64)"dpad05", (__int64)__str);
if ( (__str[0] & 1) != 0 )
operator delete(__p);
if ( (*(_BYTE *)(v65 + 1520) & 1) != 0 )
v28 = *(const char **)(v65 + 1536);
else
v28 = (const char *)(v65 + 1521);
v29 = strlen(v28);
if ( v29 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v30 = v29;
if ( v29 >= 0x17 )
{
v32 = 26;
if ( (v29 | 7) != 0x17 )
v32 = (v29 | 7) + 1;
v31 = (char *)operator new(v32);
__p = v31;
*(_QWORD *)__str = v32 | 1;
v67 = v30;
goto LABEL_38;
}
__str[0] = 2 * v29;
v31 = &__str[1];
if ( v29 )
LABEL_38:
memmove(v31, v28, v30);
v31[v30] = 0;
DS_Dictionary::setStringForKey_1(a2, (__int64)"dpadLayout01", (__int64)__str);
if ( (__str[0] & 1) != 0 )
operator delete(__p);
if ( (*(_BYTE *)(v65 + 1544) & 1) != 0 )
v33 = *(const char **)(v65 + 1560);
else
v33 = (const char *)(v65 + 1545);
v34 = strlen(v33);
if ( v34 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v35 = v34;
if ( v34 >= 0x17 )
{
v37 = 26;
if ( (v34 | 7) != 0x17 )
v37 = (v34 | 7) + 1;
v36 = (char *)operator new(v37);
__p = v36;
*(_QWORD *)__str = v37 | 1;
v67 = v35;
goto LABEL_51;
}
__str[0] = 2 * v34;
v36 = &__str[1];
if ( v34 )
LABEL_51:
memmove(v36, v33, v35);
v36[v35] = 0;
DS_Dictionary::setStringForKey_1(a2, (__int64)"dpadLayout02", (__int64)__str);
if ( (__str[0] & 1) != 0 )
operator delete(__p);
if ( (*(_BYTE *)(v65 + 1568) & 1) != 0 )
v38 = *(const char **)(v65 + 1584);
else
v38 = (const char *)(v65 + 1569);
v39 = strlen(v38);
if ( v39 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v40 = v39;
if ( v39 >= 0x17 )
{
v42 = 26;
if ( (v39 | 7) != 0x17 )
v42 = (v39 | 7) + 1;
v41 = (char *)operator new(v42);
__p = v41;
*(_QWORD *)__str = v42 | 1;
v67 = v40;
goto LABEL_64;
}
__str[0] = 2 * v39;
v41 = &__str[1];
if ( v39 )
LABEL_64:
memmove(v41, v38, v40);
v41[v40] = 0;
DS_Dictionary::setStringForKey_1(a2, (__int64)"dpadLayout03", (__int64)__str);
if ( (__str[0] & 1) != 0 )
operator delete(__p);
if ( (*(_BYTE *)(v65 + 1592) & 1) != 0 )
v43 = *(const char **)(v65 + 1608);
else
v43 = (const char *)(v65 + 1593);
v44 = strlen(v43);
if ( v44 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v45 = v44;
if ( v44 >= 0x17 )
{
v47 = 26;
if ( (v44 | 7) != 0x17 )
v47 = (v44 | 7) + 1;
v46 = (char *)operator new(v47);
__p = v46;
*(_QWORD *)__str = v47 | 1;
v67 = v45;
goto LABEL_77;
}
__str[0] = 2 * v44;
v46 = &__str[1];
if ( v44 )
LABEL_77:
memmove(v46, v43, v45);
v46[v45] = 0;
DS_Dictionary::setStringForKey_1(a2, (__int64)"dpadLayoutDual01", (__int64)__str);
if ( (__str[0] & 1) != 0 )
operator delete(__p);
if ( (*(_BYTE *)(v65 + 1616) & 1) != 0 )
v48 = *(const char **)(v65 + 1632);
else
v48 = (const char *)(v65 + 1617);
v49 = strlen(v48);
if ( v49 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v50 = v49;
if ( v49 >= 0x17 )
{
v52 = 26;
if ( (v49 | 7) != 0x17 )
v52 = (v49 | 7) + 1;
v51 = (char *)operator new(v52);
__p = v51;
*(_QWORD *)__str = v52 | 1;
v67 = v50;
goto LABEL_90;
}
__str[0] = 2 * v49;
v51 = &__str[1];
if ( v49 )
LABEL_90:
memmove(v51, v48, v50);
v51[v50] = 0;
DS_Dictionary::setStringForKey_1(a2, (__int64)"dpadLayoutDual02", (__int64)__str);
if ( (__str[0] & 1) != 0 )
operator delete(__p);
if ( (*(_BYTE *)(v65 + 1640) & 1) != 0 )
v53 = *(const char **)(v65 + 1656);
else
v53 = (const char *)(v65 + 1641);
v54 = strlen(v53);
if ( v54 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v55 = v54;
if ( v54 >= 0x17 )
{
v57 = 26;
if ( (v54 | 7) != 0x17 )
v57 = (v54 | 7) + 1;
v56 = (char *)operator new(v57);
__p = v56;
*(_QWORD *)__str = v57 | 1;
v67 = v55;
goto LABEL_103;
}
__str[0] = 2 * v54;
v56 = &__str[1];
if ( v54 )
LABEL_103:
memmove(v56, v53, v55);
v56[v55] = 0;
DS_Dictionary::setStringForKey_1(a2, (__int64)"dpadLayoutDual03", (__int64)__str);
if ( (__str[0] & 1) != 0 )
operator delete(__p);
if ( (*(_BYTE *)(v65 + 1664) & 1) != 0 )
v58 = *(const char **)(v65 + 1680);
else
v58 = (const char *)(v65 + 1665);
v59 = strlen(v58);
if ( v59 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v60 = v59;
if ( v59 >= 0x17 )
{
v62 = 26;
if ( (v59 | 7) != 0x17 )
v62 = (v59 | 7) + 1;
v61 = (char *)operator new(v62);
__p = v61;
*(_QWORD *)__str = v62 | 1;
v67 = v60;
goto LABEL_116;
}
__str[0] = 2 * v59;
v61 = &__str[1];
if ( v59 )
LABEL_116:
memmove(v61, v58, v60);
v61[v60] = 0;
DS_Dictionary::setStringForKey_1(a2, (__int64)"recentEmotes", (__int64)__str);
if ( (__str[0] & 1) != 0 )
operator delete(__p);
DS_Dictionary::setFloatForKey_1(a2, (__int64)"practiceOpacity");
DS_Dictionary::setFloatForKey_1(a2, (__int64)"practicePosX");
DS_Dictionary::setFloatForKey_1(a2, (__int64)"practicePosY");
return __stack_chk_guard;
}