//
// GameManager::firstLoad from 0x100374800 to 0x10037524c (2636 bytes)
//
// 1 xrefs:
// > ??> @ 0x100b270d8
//
// 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
//
void __fastcall GameManager::firstLoad(__int64 a1)
{
__int64 v1; // r15
char v2; // al
std::string::value_type *data; // r12
unsigned int v4; // r15d
std::string *p_dst; // r13
__int64 v6; // rsi
__int64 v7; // rax
__int64 CString; // rax
std::string::value_type *v9; // r14
__int64 v10; // rbx
std::string *v11; // r15
std::string::value_type *v12; // r13
std::string::value_type *v13; // r12
void *v14; // r14
void *v15; // rax
int v16; // ebx
__int64 v17; // rax
const char *v18; // r13
size_t v19; // rax
std::string::size_type v20; // r14
_BYTE *v21; // rbx
__int64 v22; // rax
size_t v23; // r12
__int64 v24; // r14
size_t v25; // rax
size_t v26; // r13
char *v27; // rbx
__int64 v28; // rax
size_t v29; // r12
int UGV; // r12d
_QWORD *v31; // rax
_QWORD *v32; // rdi
_QWORD *v33; // r14
_QWORD *v34; // rax
_QWORD *v35; // rdi
_QWORD *v36; // r14
_QWORD *v37; // rax
_QWORD *v38; // rdi
_QWORD *v39; // r14
_QWORD *v40; // rax
_QWORD *v41; // rdi
_QWORD *v42; // r14
int v43; // eax
double v44; // xmm0_8
__int64 v45; // rdi
__int64 v46; // rax
__int64 v47; // rax
double Setup; // xmm0_8
__int64 v49; // rax
__int64 v50; // rdi
__int64 v51; // rdi
__int64 v52; // rdi
__int64 v53; // rdi
__int64 v54; // rax
bool v55; // zf
char *v56; // r12
unsigned int v57; // r15d
__int64 v58; // rax
const char *v59; // r14
size_t v60; // rax
std::string::size_type v61; // r13
char *v62; // rbx
__int64 v63; // rax
size_t v64; // r12
void *v65; // rax
__int64 v66; // rbx
__int64 v67; // rax
__int64 v68; // rbx
__int64 v69; // rax
__int64 v70; // rbx
__int64 v71; // rax
__int64 v72; // rbx
char v73; // [rsp+0h] [rbp-80h]
char v74; // [rsp+0h] [rbp-80h]
_QWORD v75[2]; // [rsp+8h] [rbp-78h] BYREF
void *__p; // [rsp+18h] [rbp-68h]
int v77; // [rsp+24h] [rbp-5Ch]
__int64 v78; // [rsp+28h] [rbp-58h]
char *__s; // [rsp+30h] [rbp-50h]
_QWORD *v80; // [rsp+38h] [rbp-48h]
std::string __dst; // [rsp+40h] [rbp-40h] BYREF
v1 = a1;
*(_QWORD *)(a1 + 696) = 0;
*(_DWORD *)(a1 + 685) = 0;
*(_DWORD *)(a1 + 688) = 0;
*(_QWORD *)(a1 + 1316) = 0x7800000118LL;
*(_QWORD *)(a1 + 1324) = 0x3F80000000000000LL;
*(_QWORD *)(a1 + 1332) = 0x41200000000000FFLL;
*(_BYTE *)(a1 + 1340) = 0;
sub_100278250((float *)&__dst, 95.0, 36.0);
sub_100278300((_QWORD *)(a1 + 1344), &__dst);
*(_WORD *)(a1 + 1352) = 0;
*(_BYTE *)(a1 + 1341) = 0;
*(_BYTE *)(a1 + 1354) = 0;
GameManager::resetDPadSettings(a1, 1);
v2 = *(_BYTE *)(a1 + 1026);
v78 = a1;
if ( v2 != 1 || !*(_QWORD *)(a1 + 424) )
{
v80 = nullptr;
if ( (v2 & 1) != 0 )
goto LABEL_33;
goto LABEL_36;
}
v80 = cocos2d::CCDictionary::create();
data = __dst.__r_.__value_.__s.__data_;
v4 = 1;
p_dst = &__dst;
do
{
v6 = v4;
v7 = sub_10088E820("%04i", v73);
CString = cocos2d::CCString::getCString(v7);
v9 = (std::string::value_type *)CString;
v10 = qword_100BE3098;
if ( !qword_100BE3098 )
{
LODWORD(__s) = v4;
v11 = p_dst;
v12 = data;
v13 = (std::string::value_type *)CString;
v14 = operator new(0x6B8u);
sub_100377960(v14);
qword_100BE3098 = (__int64)v14;
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v14 + 80LL))(v14, v6);
v10 = qword_100BE3098;
v9 = v13;
data = v12;
p_dst = v11;
v4 = (unsigned int)__s;
}
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)6;
data[2] = 95;
*(_WORD *)data = 30311;
__dst.__r_.__value_.__s.__data_[3] = 0;
std::string::append(p_dst, v9);
v15 = cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v10 + 424), (__int64)p_dst);
v16 = cocos2d::CCString::intValue(v15);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( v16 > 0 )
{
__s = v9;
v17 = sub_10088E820("%i", v73);
v18 = (const char *)cocos2d::CCString::getCString(v17);
v19 = strlen(v18);
if ( v19 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_94:
sub_100003630();
v20 = v19;
if ( v19 >= 0x17 )
{
v22 = v19 | 7;
v23 = 26;
if ( (v20 | 7) != 0x17 )
v23 = v22 + 1;
v21 = operator new(v23);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)v21;
__dst.__r_.__value_.__r.__words[0] = v23 + 1;
__dst.__r_.__value_.__l.__size_ = v20;
data = __dst.__r_.__value_.__s.__data_;
}
else
{
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v19);
v21 = data;
if ( !v19 )
{
LABEL_18:
v21[v20] = 0;
v24 = sub_10088E600(&__dst);
v25 = strlen(__s);
if ( v25 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v26 = v25;
if ( v25 >= 0x17 )
{
v28 = v25 | 7;
v29 = 26;
if ( (v26 | 7) != 0x17 )
v29 = v28 + 1;
v27 = (char *)operator new(v29);
__p = v27;
v75[0] = v29 | 1;
v75[1] = v26;
data = __dst.__r_.__value_.__s.__data_;
}
else
{
LOBYTE(v75[0]) = 2 * v25;
v27 = (char *)v75 + 1;
if ( !v25 )
goto LABEL_26;
}
memmove(v27, __s, v26);
LABEL_26:
v27[v26] = 0;
cocos2d::CCDictionary::setObject((__int64)v80, v24, (char *)v75);
p_dst = &__dst;
if ( (v75[0] & 1) != 0 )
operator delete(__p);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
goto LABEL_4;
}
}
memmove(v21, v18, v20);
goto LABEL_18;
}
LABEL_4:
++v4;
}
while ( v4 != 250 );
v1 = v78;
if ( (*(_BYTE *)(v78 + 1026) & 1) != 0 )
{
LABEL_33:
if ( *(_QWORD *)(v1 + 448) )
{
UGV = GameManager::getUGV(v1, "30");
v31 = cocos2d::CCDictionary::create();
v32 = *(_QWORD **)(v1 + 424);
if ( v32 == v31 )
goto LABEL_42;
goto LABEL_37;
}
}
LABEL_36:
UGV = 0;
v31 = cocos2d::CCDictionary::create();
v32 = *(_QWORD **)(v1 + 424);
if ( v32 == v31 )
goto LABEL_42;
LABEL_37:
v33 = v31;
if ( v31 )
{
cocos2d::CCObject::retain(v31);
v32 = *(_QWORD **)(v1 + 424);
}
if ( v32 )
cocos2d::CCObject::release(v32);
*(_QWORD *)(v1 + 424) = v33;
LABEL_42:
v34 = cocos2d::CCDictionary::create();
v35 = *(_QWORD **)(v1 + 432);
if ( v35 != v34 )
{
v36 = v34;
if ( v34 )
{
cocos2d::CCObject::retain(v34);
v35 = *(_QWORD **)(v1 + 432);
}
if ( v35 )
cocos2d::CCObject::release(v35);
*(_QWORD *)(v1 + 432) = v36;
}
v37 = cocos2d::CCDictionary::create();
v38 = *(_QWORD **)(v1 + 448);
if ( v38 != v37 )
{
v39 = v37;
if ( v37 )
{
cocos2d::CCObject::retain(v37);
v38 = *(_QWORD **)(v1 + 448);
}
if ( v38 )
cocos2d::CCObject::release(v38);
*(_QWORD *)(v1 + 448) = v39;
}
if ( !*(_QWORD *)(v1 + 456) )
{
v40 = cocos2d::CCDictionary::create();
v41 = *(_QWORD **)(v1 + 456);
if ( v41 != v40 )
{
v42 = v40;
if ( v40 )
{
cocos2d::CCObject::retain(v40);
v41 = *(_QWORD **)(v1 + 456);
}
if ( v41 )
cocos2d::CCObject::release(v41);
*(_QWORD *)(v1 + 456) = v42;
}
}
if ( !*(_BYTE *)(v1 + 1026) )
{
PlatformToolbox::getUserID(&__dst);
if ( (*(_BYTE *)(v1 + 608) & 1) != 0 )
operator delete(*(void **)(v1 + 624));
*(std::string *)(v1 + 608) = __dst;
}
std::string::assign((std::string *)(v1 + 632), "Player");
*(_DWORD *)(v1 + 668) = 0;
v43 = (int)(float)((float)((float)rand() * 4.6566129e-10) * 1000.0);
*(_DWORD *)(v1 + 664) = v43;
*(_DWORD *)(v1 + 660) = v43;
*(_DWORD *)(v1 + 1040) = 0;
HIDWORD(v44) = 0;
*(float *)&v44 = (float)((float)rand() * 4.6566129e-10) * 1000.0;
*(_DWORD *)(v1 + 1036) = (int)*(float *)&v44;
*(_DWORD *)(v1 + 1032) = (int)*(float *)&v44;
*(_BYTE *)(v1 + 1044) = 0;
*(_DWORD *)(v1 + 1048) = 0;
if ( !*(_BYTE *)(v1 + 1026) )
{
*(_WORD *)(v1 + 600) = 257;
*(_BYTE *)(v1 + 602) = 1;
}
v45 = v1;
GameManager::resetAllIcons(v1);
if ( !*(_BYTE *)(v1 + 1026) )
{
v46 = FMODAudioEngine::sharedEngine(v44);
FMODAudioEngine::setBackgroundMusicVolume(v46, COERCE_DOUBLE(1065353216));
v45 = FMODAudioEngine::sharedEngine(COERCE_DOUBLE(1065353216));
FMODAudioEngine::setEffectsVolume(v45, COERCE_DOUBLE(1065353216));
}
v47 = AchievementManager::sharedState(v45, "Player");
Setup = AchievementManager::firstSetup(v47);
v49 = GameLevelManager::sharedState(Setup);
GameLevelManager::firstSetup(v49);
v50 = GameStatsManager::sharedState();
GameStatsManager::firstSetup(v50, (__int64)"Player");
v51 = MusicDownloadManager::sharedState(v50);
MusicDownloadManager::firstSetup(v51);
v52 = GJAccountManager::sharedState(v51, (__int64)"Player");
GJAccountManager::firstSetup();
v53 = GJMultiplayerManager::sharedState(v52);
GJMultiplayerManager::firstSetup(v53);
v54 = EditorSFXManager::sharedState(v53);
EditorSFXManager::firstSetup(v54);
v55 = *(_BYTE *)(v1 + 1026) == 0;
v77 = UGV;
if ( v55 )
{
*(_DWORD *)(v1 + 1056) = -1;
*(_BYTE *)(v1 + 925) = 0;
*(_BYTE *)(v1 + 423) = 1;
*(_WORD *)(v1 + 932) = 0;
*(_BYTE *)(v1 + 934) = 0;
*(_DWORD *)(v1 + 921) = 1;
GameManager::setGameVariable(v1, (std::string::value_type *)"0002");
GameManager::setGameVariable(v1, "0001");
GameManager::setGameVariable(v1, "0026");
GameManager::setGameVariable(v1, "0027");
GameManager::setGameVariable(v1, "0200");
GameManager::setGameVariable(v1, "0202");
GameManager::setGameVariable(v1, "0038");
GameManager::setGameVariable(v1, (std::string::value_type *)"0043");
GameManager::setGameVariable(v1, (std::string::value_type *)"0044");
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)6;
*(_DWORD *)((char *)&__dst.__r_.__value_.__l.0 + 1) = 6256231;
std::string::append(&__dst, "0050");
v68 = *(_QWORD *)(v1 + 424);
v69 = sub_10088E820("%i", v73);
cocos2d::CCDictionary::setObject(v68, v69, (char *)&__dst);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)6;
*(_DWORD *)((char *)&__dst.__r_.__value_.__l.0 + 1) = 6256231;
std::string::append(&__dst, "0049");
v70 = *(_QWORD *)(v1 + 424);
v71 = sub_10088E820("%i", v74);
cocos2d::CCDictionary::setObject(v70, v71, (char *)&__dst);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
GameManager::setGameVariable(v1, (std::string::value_type *)"0046");
GameManager::setGameVariable(v1, (std::string::value_type *)"0044");
GameManager::setGameVariable(v1, "0036");
GameManager::setGameVariable(v1, "0118");
GameManager::setGameVariable(v1, "0117");
GameManager::setGameVariable(v1, "0158");
GameManager::setGameVariable(v1, "0121");
GameManager::setGameVariable(v1, "0037");
GameManager::setGameVariable(v1, "0184");
GameManager::setGameVariable(v1, "0030");
GameManager::setGameVariable(v1, (std::string::value_type *)"0013");
GameManager::setGameVariable(v1, "0018");
}
else if ( v80 )
{
v56 = (char *)cocos2d::CCDictionary::allKeys((__int64)v80);
if ( (unsigned int)sub_1007FEF90(v56) )
{
v57 = 0;
__s = v56;
do
{
v58 = cocos2d::CCArray::stringAtIndex(v56, v57);
v59 = (const char *)cocos2d::CCString::getCString(v58);
v60 = strlen(v59);
if ( v60 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_94;
v61 = v60;
if ( v60 >= 0x17 )
{
v63 = v60 | 7;
v64 = 26;
if ( (v61 | 7) != 0x17 )
v64 = v63 + 1;
v62 = (char *)operator new(v64);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)v62;
__dst.__r_.__value_.__r.__words[0] = v64 + 1;
__dst.__r_.__value_.__l.__size_ = v61;
v56 = __s;
}
else
{
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v60);
v62 = __dst.__r_.__value_.__s.__data_;
if ( !v60 )
goto LABEL_82;
}
memmove(v62, v59, v61);
LABEL_82:
v62[v61] = 0;
v65 = cocos2d::CCDictionary::valueForKey((__int64)v80, (__int64)&__dst);
cocos2d::CCString::intValue(v65);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)6;
*(_DWORD *)((char *)&__dst.__r_.__value_.__l.0 + 1) = 6256231;
std::string::append(&__dst, v59);
v66 = *(_QWORD *)(v78 + 424);
v67 = sub_10088E820("%i", v73);
cocos2d::CCDictionary::setObject(v66, v67, (char *)&__dst);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
++v57;
}
while ( v57 < (unsigned int)sub_1007FEF90(v56) );
}
}
v72 = v78;
if ( (*(_BYTE *)(v78 + 1026) & (unsigned __int8)v77) == 1 )
GameManager::setUGV(v78, "30");
*(_BYTE *)(v72 + 504) = 1;
}