//
// GameManager::firstLoad from 0x10031c5f8 to 0x10031cad0 (1240 bytes)
//
// 1 xrefs:
// > ??> @ 0x1007eefa8
//
// 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::firstLoad(GameManager *a1)
{
int v2; // w25
cocos2d::CCDictionary *v3; // x20
cocos2d::CCString *v4; // x0
char *CString; // x23
GameManager *v6; // x0
int IntGameVariable; // w0
cocos2d::CCString *v8; // x0
char *v9; // x0
cocos2d::CCObject *v10; // x24
bool UGV; // w21
cocos2d::CCDictionary *v12; // x0
cocos2d::CCDictionary *v13; // x0
cocos2d::CCDictionary *v14; // x0
void **p_m_playerUDID; // x22
int v16; // w8
float v17; // s0
FMODAudioEngine *v18; // x0
FMODAudioEngine *v19; // x0
AchievementManager *v20; // x0
GameLevelManager *v21; // x0
GameStatsManager *v22; // x0
MusicDownloadManager *v23; // x0
GJAccountManager *v24; // x0
GJMultiplayerManager *v25; // x0
KeybindingsManager *v26; // x0
cocos2d::CCArray *v27; // x22
unsigned int v28; // w23
cocos2d::CCString *v29; // x0
char *v30; // x24
cocos2d::CCString *v31; // x0
int v32; // w25
void *__p[2]; // [xsp+10h] [xbp-80h] BYREF
char v34; // [xsp+27h] [xbp-69h]
void *v35[2]; // [xsp+28h] [xbp-68h] BYREF
char *v36; // [xsp+38h] [xbp-58h]
a1->m_socialsDuration = 0.0;
*(_DWORD *)&a1->m_clickedFacebook = 0;
*(_WORD *)&a1->m_clickedDiscord = 0;
UIButtonConfig::reset(&a1->m_dpad1);
GameManager::resetDPadSettings(a1, 1);
if ( a1->m_shouldLoadUnlockValueKeeper )
{
if ( a1->m_valueKeeper )
{
v2 = 1;
v3 = cocos2d::CCDictionary::create();
do
{
v4 = (cocos2d::CCString *)sub_100268F4C("%04i", v2);
CString = (char *)cocos2d::CCString::getCString(v4);
v6 = GameManager::sharedState();
IntGameVariable = GameManager::getIntGameVariable(v6, CString);
if ( IntGameVariable >= 1 )
{
v8 = (cocos2d::CCString *)sub_100268F4C("%i", IntGameVariable);
v9 = (char *)cocos2d::CCString::getCString(v8);
sub_100009900(v35, v9);
v10 = sub_100268E48((__int128 *)v35);
sub_100009900(__p, CString);
cocos2d::CCDictionary::setObject_1(v3, v10, __p);
if ( v34 < 0 )
operator delete(__p[0]);
if ( SHIBYTE(v36) < 0 )
operator delete(v35[0]);
}
++v2;
}
while ( v2 != 182 );
if ( !a1->m_shouldLoadUnlockValueKeeper )
goto LABEL_16;
}
else
{
v3 = nullptr;
}
if ( a1->m_unlockValueKeeper )
{
UGV = GameManager::getUGV(a1, "30");
goto LABEL_17;
}
}
else
{
v3 = nullptr;
}
LABEL_16:
UGV = 0;
LABEL_17:
v12 = cocos2d::CCDictionary::create();
sub_10009AB48((__int64)a1, v12);
v13 = cocos2d::CCDictionary::create();
sub_10009AA70((__int64)a1, v13);
if ( !a1->m_customObjectDict )
{
v14 = cocos2d::CCDictionary::create();
sub_10009AAB8((__int64)a1, v14);
}
if ( !a1->m_shouldLoadUnlockValueKeeper )
{
PlatformToolbox::getUserID(v35);
p_m_playerUDID = (void **)&a1->m_playerUDID;
if ( a1->m_playerUDID.m_data.m_short.shortStorage.__elems_[22] < 0 )
operator delete(*p_m_playerUDID);
*(_OWORD *)p_m_playerUDID = *(_OWORD *)v35;
a1->m_playerUDID.m_data.m_long.longStorage = v36;
}
std::string::assign((std::string *)&a1->m_playerName, "Player");
a1->m_playerUserID.value = 0;
v16 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
a1->m_playerUserID.seed = v16;
a1->m_playerUserID.random = v16;
a1->m_hasRP.value = 0;
v17 = vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0;
a1->m_hasRP.seed = (int)v17;
a1->m_hasRP.random = (int)v17;
a1->m_hasDRP = 0;
if ( !a1->m_shouldLoadUnlockValueKeeper )
{
*(_WORD *)&a1->m_firstSetup = 257;
a1->m_unknownBool4 = 1;
}
GameManager::resetAllIcons(a1);
if ( !a1->m_shouldLoadUnlockValueKeeper )
{
v18 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::setBackgroundMusicVolume(v18, 1.0);
v19 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::setEffectsVolume(v19, 1.0);
}
v20 = AchievementManager::sharedState();
AchievementManager::firstSetup(v20);
v21 = GameLevelManager::sharedState();
GameLevelManager::firstSetup(v21);
v22 = GameStatsManager::sharedState();
GameStatsManager::firstSetup(v22);
v23 = MusicDownloadManager::sharedState();
MusicDownloadManager::firstSetup(v23);
v24 = GJAccountManager::sharedState();
GJAccountManager::firstSetup(v24);
v25 = GJMultiplayerManager::sharedState();
GJMultiplayerManager::firstSetup(v25);
v26 = KeybindingsManager::sharedState();
KeybindingsManager::firstSetup(v26);
if ( a1->m_shouldLoadUnlockValueKeeper )
{
if ( v3 )
{
v27 = cocos2d::CCDictionary::allKeys(v3);
if ( (unsigned int)sub_10024A36C((__int64)v27) )
{
v28 = 0;
do
{
v29 = cocos2d::CCArray::stringAtIndex(v27, v28);
v30 = (char *)cocos2d::CCString::getCString(v29);
sub_100009900(v35, v30);
v31 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(v3, v35);
v32 = cocos2d::CCString::intValue(v31);
if ( SHIBYTE(v36) < 0 )
operator delete(v35[0]);
GameManager::setIntGameVariable(a1, v30, v32);
++v28;
}
while ( v28 < (unsigned int)sub_10024A36C((__int64)v27) );
}
}
}
else
{
a1->m_resolution = -1;
a1->m_performanceMode = 0;
a1->m_vsyncEnabled = 1;
*(_WORD *)&a1->m_showedRateDiffDialog = 0;
a1->m_showedLowDetailDialog = 0;
*(_DWORD *)&a1->m_showSongMarkers = 1;
GameManager::setGameVariable(a1, "0002", 1);
GameManager::setGameVariable(a1, "0001", 1);
GameManager::setGameVariable(a1, "0026", 1);
GameManager::setGameVariable(a1, "0027", 1);
GameManager::setGameVariable(a1, "0038", 1);
GameManager::setGameVariable(a1, "0043", 1);
GameManager::setGameVariable(a1, "0044", 1);
GameManager::setIntGameVariable(a1, "0050", 2);
GameManager::setIntGameVariable(a1, "0049", 6);
GameManager::setGameVariable(a1, "0046", 1);
GameManager::setGameVariable(a1, "0044", 1);
GameManager::setGameVariable(a1, "0036", 1);
GameManager::setGameVariable(a1, "0118", 1);
GameManager::setGameVariable(a1, "0117", 1);
GameManager::setGameVariable(a1, "0158", 1);
GameManager::setGameVariable(a1, "0121", 1);
GameManager::setGameVariable(a1, "0037", 1);
}
if ( a1->m_shouldLoadUnlockValueKeeper && UGV )
GameManager::setUGV(a1, "30", 1);
a1->m_loaded = 1;
}