//
// GameManager::encodeDataTo from 0x10038af20 to 0x10038ba31 (2833 bytes)
//
// 1 xrefs:
// > ??> @ 0x10091edc0
//
// 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 GameManager::encodeDataTo(GameManager *a1, DS_Dictionary *a2)
{
FMODAudioEngine *v3; // rax
float BackgroundMusicVolume; // xmm0_4
FMODAudioEngine *v5; // rax
float EffectsVolume; // xmm0_4
FMODAudioEngine *v7; // rax
AchievementManager *v8; // rax
GameLevelManager *v9; // rax
GameStatsManager *v10; // rax
MusicDownloadManager *v11; // rax
GJAccountManager *v12; // rax
GJMultiplayerManager *v13; // rax
KeybindingsManager *v14; // rax
double v15; // xmm0_8
std::array *longStorage; // r15
size_t v17; // rax
size_t v18; // r12
char *v19; // r13
size_t v20; // r15
std::array *p_shortStorage; // r15
size_t v22; // rax
size_t v23; // r12
char *v24; // r13
size_t v25; // r15
std::array *v26; // r15
size_t v27; // rax
size_t v28; // r12
char *v29; // r13
size_t v30; // r15
std::array *v31; // r15
size_t v32; // rax
size_t v33; // r12
char *v34; // r13
size_t v35; // r15
std::array *v36; // r15
size_t v37; // rax
size_t v38; // r12
char *v39; // r13
size_t v40; // r15
std::array *v41; // r15
size_t v42; // rax
size_t v43; // r12
char *v44; // r13
size_t v45; // r15
std::array *v46; // [rsp+8h] [rbp-48h]
std::array *v47; // [rsp+8h] [rbp-48h]
std::array *v48; // [rsp+8h] [rbp-48h]
std::array *v49; // [rsp+8h] [rbp-48h]
std::array *v50; // [rsp+8h] [rbp-48h]
std::array *v51; // [rsp+8h] [rbp-48h]
size_t __dst; // [rsp+10h] [rbp-40h] BYREF
size_t v53; // [rsp+18h] [rbp-38h]
void *__p; // [rsp+20h] [rbp-30h]
DS_Dictionary::setDictForKey(a2, "valueKeeper", a1->m_valueKeeper);
DS_Dictionary::setDictForKey(a2, "unlockValueKeeper", a1->m_unlockValueKeeper);
DS_Dictionary::setDictForKey(a2, "customObjectDict", a1->m_customObjectDict);
v3 = FMODAudioEngine::sharedEngine();
BackgroundMusicVolume = FMODAudioEngine::getBackgroundMusicVolume(v3);
DS_Dictionary::setFloatForKey_1(a2, "bgVolume", BackgroundMusicVolume);
v5 = FMODAudioEngine::sharedEngine();
EffectsVolume = FMODAudioEngine::getEffectsVolume(v5);
DS_Dictionary::setFloatForKey_1(a2, "sfxVolume", EffectsVolume);
v7 = FMODAudioEngine::sharedEngine();
DS_Dictionary::setIntegerForKey_1(a2, "timeOffset", v7->m_musicOffset);
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"playerUDID", (__int64)&a1->m_playerUDID);
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"playerName", (__int64)&a1->m_playerName);
DS_Dictionary::setIntegerForKey_1(a2, "playerUserID", a1->m_playerUserID.random - a1->m_playerUserID.seed);
DS_Dictionary::setIntegerForKey_1(a2, "playerFrame", a1->m_playerFrame.random - a1->m_playerFrame.seed);
DS_Dictionary::setIntegerForKey_1(a2, "playerShip", a1->m_playerShip.random - a1->m_playerShip.seed);
DS_Dictionary::setIntegerForKey_1(a2, "playerBall", a1->m_playerBall.random - a1->m_playerBall.seed);
DS_Dictionary::setIntegerForKey_1(a2, "playerBird", a1->m_playerBird.random - a1->m_playerBird.seed);
DS_Dictionary::setIntegerForKey_1(a2, "playerDart", a1->m_playerDart.random - a1->m_playerDart.seed);
DS_Dictionary::setIntegerForKey_1(a2, "playerRobot", a1->m_playerRobot.random - a1->m_playerRobot.seed);
DS_Dictionary::setIntegerForKey_1(a2, "playerSpider", a1->m_playerSpider.random - a1->m_playerSpider.seed);
DS_Dictionary::setIntegerForKey_1(a2, "playerSwing", a1->m_playerSwing.random - a1->m_playerSwing.seed);
DS_Dictionary::setIntegerForKey_1(a2, "playerColor", a1->m_playerColor.random - a1->m_playerColor.seed);
DS_Dictionary::setIntegerForKey_1(a2, "playerColor2", a1->m_playerColor2.random - a1->m_playerColor2.seed);
DS_Dictionary::setIntegerForKey_1(a2, "playerColor3", a1->m_playerGlowColor.random - a1->m_playerGlowColor.seed);
DS_Dictionary::setIntegerForKey_1(a2, "playerStreak", a1->m_playerStreak.random - a1->m_playerStreak.seed);
DS_Dictionary::setIntegerForKey_1(a2, "playerShipStreak", a1->m_playerShipFire.random - a1->m_playerShipFire.seed);
DS_Dictionary::setIntegerForKey_1(
a2,
"playerDeathEffect",
a1->m_playerDeathEffect.random - a1->m_playerDeathEffect.seed);
DS_Dictionary::setIntegerForKey_1(a2, "playerJetpack", a1->m_playerJetpack.random - a1->m_playerJetpack.seed);
DS_Dictionary::setIntegerForKey_1(a2, "playerIconType", a1->m_playerIconType);
DS_Dictionary::setBoolForKey_1(a2, "playerGlow", a1->m_playerGlow);
DS_Dictionary::setIntegerForKey_1(a2, "secretNumber", a1->m_secretNumber.seed - a1->m_secretNumber.random);
DS_Dictionary::setIntegerForKey_1(a2, "hasRP", a1->m_hasRP.random - a1->m_hasRP.seed);
DS_Dictionary::setBoolForKey_1(a2, "hasDRP", a1->m_hasDRP);
v8 = AchievementManager::sharedState();
AchievementManager::encodeDataTo(v8, a2);
v9 = GameLevelManager::sharedState();
GameLevelManager::encodeDataTo(v9, a2);
v10 = GameStatsManager::sharedState();
GameStatsManager::encodeDataTo(v10, a2);
v11 = MusicDownloadManager::sharedState();
MusicDownloadManager::encodeDataTo(v11, a2);
v12 = GJAccountManager::sharedState();
GJAccountManager::encodeDataTo(v12, a2);
v13 = GJMultiplayerManager::sharedState();
GJMultiplayerManager::encodeDataTo(v13, a2);
v14 = KeybindingsManager::sharedState();
KeybindingsManager::encodeDataTo(v14, a2);
DS_Dictionary::setBoolForKey_1(a2, "showSongMarkers", a1->m_showSongMarkers);
DS_Dictionary::setBoolForKey_1(a2, "showBPMMarkers", a1->m_showBPMMarkers);
DS_Dictionary::setBoolForKey_1(a2, "recordGameplay", a1->m_recordGameplay);
DS_Dictionary::setBoolForKey_1(a2, "showProgressBar", a1->m_showProgressBar);
DS_Dictionary::setBoolForKey_1(a2, "performanceMode", a1->m_performanceMode);
DS_Dictionary::setBoolForKey_1(a2, "clickedGarage", a1->m_clickedGarage);
DS_Dictionary::setBoolForKey_1(a2, "clickedEditor", a1->m_clickedEditor);
DS_Dictionary::setBoolForKey_1(a2, "clickedName", a1->m_clickedName);
DS_Dictionary::setBoolForKey_1(a2, "clickedPractice", a1->m_clickedPractice);
DS_Dictionary::setBoolForKey_1(a2, "showedEditorGuide", a1->m_showedEditorGuide);
DS_Dictionary::setBoolForKey_1(a2, "showedRateDiffDialog", a1->m_showedRateDiffDialog);
DS_Dictionary::setBoolForKey_1(a2, "showedRateStarDialog", a1->m_showedRateStarDialog);
DS_Dictionary::setBoolForKey_1(a2, "showedLowDetailDialog", a1->m_showedLowDetailDialog);
DS_Dictionary::setIntegerForKey_1(a2, "bootups", a1->m_bootups);
DS_Dictionary::setBoolForKey_1(a2, "hasRatedGame", a1->m_hasRatedGame);
DS_Dictionary::setIntegerForKey_1(a2, "binaryVersion", 47);
DS_Dictionary::setIntegerForKey_1(a2, "resolution", a1->m_resolution);
DS_Dictionary::setIntegerForKey_1(a2, "texQuality", a1->m_texQuality);
*(_QWORD *)&v15 = LODWORD(a1->m_customFPSTarget);
DS_Dictionary::setFloatForKey_1(a2, "customFPSTarget", *(float *)&v15);
DS_Dictionary::setIntegerForKey_1(a2, "customMenuSongID", a1->m_customMenuSongID);
DS_Dictionary::setIntegerForKey_1(a2, "customPracticeSongID", a1->m_customPracticeSongID);
GameManager::dpadConfigToString(&__dst, (__int64)"customPracticeSongID", (__int64)&a1->m_dpad1);
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"dpad01", (__int64)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
GameManager::dpadConfigToString(&__dst, (__int64)"dpad01", (__int64)&a1->m_dpad2);
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"dpad02", (__int64)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
GameManager::dpadConfigToString(&__dst, (__int64)"dpad02", (__int64)&a1->m_dpad3);
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"dpad03", (__int64)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
GameManager::dpadConfigToString(&__dst, (__int64)"dpad03", (__int64)&a1->m_dpad4);
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"dpad04", (__int64)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
GameManager::dpadConfigToString(&__dst, (__int64)"dpad04", (__int64)&a1->m_dpad5);
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"dpad05", (__int64)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( (a1->m_dpadLayout1.m_data.m_short.sizex2 & 1) != 0 )
longStorage = (std::array *)a1->m_dpadLayout1.m_data.m_long.longStorage;
else
longStorage = &a1->m_dpadLayout1.m_data.m_short.shortStorage;
v17 = strlen(longStorage->__elems_);
if ( v17 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_90:
sub_100006BF0(v15);
v18 = v17;
if ( v17 >= 0x17 )
{
v46 = longStorage;
v20 = 26;
if ( (v17 | 7) != 0x17 )
v20 = (v17 | 7) + 1;
v19 = (char *)operator new(v20);
__p = v19;
__dst = v20 + 1;
longStorage = v46;
v53 = v18;
goto LABEL_21;
}
LOBYTE(__dst) = 2 * v17;
v19 = (char *)&__dst + 1;
if ( v17 )
LABEL_21:
memmove(v19, longStorage, v18);
v19[v18] = 0;
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"dpadLayout01", (__int64)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( (a1->m_dpadLayout2.m_data.m_short.sizex2 & 1) != 0 )
p_shortStorage = (std::array *)a1->m_dpadLayout2.m_data.m_long.longStorage;
else
p_shortStorage = &a1->m_dpadLayout2.m_data.m_short.shortStorage;
v22 = strlen(p_shortStorage->__elems_);
if ( v22 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_90;
v23 = v22;
if ( v22 >= 0x17 )
{
v47 = p_shortStorage;
v25 = 26;
if ( (v22 | 7) != 0x17 )
v25 = (v22 | 7) + 1;
v24 = (char *)operator new(v25);
__p = v24;
__dst = v25 + 1;
p_shortStorage = v47;
v53 = v23;
goto LABEL_34;
}
LOBYTE(__dst) = 2 * v22;
v24 = (char *)&__dst + 1;
if ( v22 )
LABEL_34:
memmove(v24, p_shortStorage, v23);
v24[v23] = 0;
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"dpadLayout02", (__int64)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( (a1->m_dpadLayout3.m_data.m_short.sizex2 & 1) != 0 )
v26 = (std::array *)a1->m_dpadLayout3.m_data.m_long.longStorage;
else
v26 = &a1->m_dpadLayout3.m_data.m_short.shortStorage;
v27 = strlen(v26->__elems_);
if ( v27 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_90;
v28 = v27;
if ( v27 >= 0x17 )
{
v48 = v26;
v30 = 26;
if ( (v27 | 7) != 0x17 )
v30 = (v27 | 7) + 1;
v29 = (char *)operator new(v30);
__p = v29;
__dst = v30 + 1;
v26 = v48;
v53 = v28;
goto LABEL_47;
}
LOBYTE(__dst) = 2 * v27;
v29 = (char *)&__dst + 1;
if ( v27 )
LABEL_47:
memmove(v29, v26, v28);
v29[v28] = 0;
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"dpadLayout03", (__int64)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( (a1->m_dpadLayoutDual1.m_data.m_short.sizex2 & 1) != 0 )
v31 = (std::array *)a1->m_dpadLayoutDual1.m_data.m_long.longStorage;
else
v31 = &a1->m_dpadLayoutDual1.m_data.m_short.shortStorage;
v32 = strlen(v31->__elems_);
if ( v32 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_90;
v33 = v32;
if ( v32 >= 0x17 )
{
v49 = v31;
v35 = 26;
if ( (v32 | 7) != 0x17 )
v35 = (v32 | 7) + 1;
v34 = (char *)operator new(v35);
__p = v34;
__dst = v35 + 1;
v31 = v49;
v53 = v33;
goto LABEL_60;
}
LOBYTE(__dst) = 2 * v32;
v34 = (char *)&__dst + 1;
if ( v32 )
LABEL_60:
memmove(v34, v31, v33);
v34[v33] = 0;
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"dpadLayoutDual01", (__int64)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( (a1->m_dpadLayoutDual2.m_data.m_short.sizex2 & 1) != 0 )
v36 = (std::array *)a1->m_dpadLayoutDual2.m_data.m_long.longStorage;
else
v36 = &a1->m_dpadLayoutDual2.m_data.m_short.shortStorage;
v37 = strlen(v36->__elems_);
if ( v37 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_90;
v38 = v37;
if ( v37 >= 0x17 )
{
v50 = v36;
v40 = 26;
if ( (v37 | 7) != 0x17 )
v40 = (v37 | 7) + 1;
v39 = (char *)operator new(v40);
__p = v39;
__dst = v40 + 1;
v36 = v50;
v53 = v38;
goto LABEL_73;
}
LOBYTE(__dst) = 2 * v37;
v39 = (char *)&__dst + 1;
if ( v37 )
LABEL_73:
memmove(v39, v36, v38);
v39[v38] = 0;
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"dpadLayoutDual02", (__int64)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( (a1->m_dpadLayoutDual3.m_data.m_short.sizex2 & 1) != 0 )
v41 = (std::array *)a1->m_dpadLayoutDual3.m_data.m_long.longStorage;
else
v41 = &a1->m_dpadLayoutDual3.m_data.m_short.shortStorage;
v42 = strlen(v41->__elems_);
if ( v42 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_90;
v43 = v42;
if ( v42 >= 0x17 )
{
v51 = v41;
v45 = 26;
if ( (v42 | 7) != 0x17 )
v45 = (v42 | 7) + 1;
v44 = (char *)operator new(v45);
__p = v44;
__dst = v45 + 1;
v41 = v51;
v53 = v43;
goto LABEL_86;
}
LOBYTE(__dst) = 2 * v42;
v44 = (char *)&__dst + 1;
if ( v42 )
LABEL_86:
memmove(v44, v41, v43);
v44[v43] = 0;
DS_Dictionary::setStringForKey_1((__int64)a2, (__int64)"dpadLayoutDual03", (__int64)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
DS_Dictionary::setFloatForKey_1(a2, "practiceOpacity", a1->m_practiceOpacity);
DS_Dictionary::setFloatForKey_1(a2, "practicePosX", a1->m_practicePos.x);
DS_Dictionary::setFloatForKey_1(a2, "practicePosY", a1->m_practicePos.y);
}