//
// FMODAudioEngine::setup from 0x5b4d54 to 0x5b52b0 (1372 bytes)
//
// 2 xrefs:
// > LoadingLayer::init @ 0x5c589c
// > ??> @ 0xbaa80
//
// 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 FMODAudioEngine::setup(FMODAudioEngine *a1)
{
const std::string *v2; // x1
cocos2d::CCArray *v3; // x22
const std::string *v4; // x1
cocos2d::CCObject *v5; // x25
const std::string *v6; // x1
__int64 v7; // x28
const std::string *v8; // x1
__int64 v9; // x21
const std::string *v10; // x1
__int64 v11; // x19
const std::string *v12; // x1
__int64 v13; // x0
cocos2d::CCArray *v14; // x21
char *v15; // x0
void *v16; // x0
void *v17; // x0
void *v18; // x0
void *v19; // x0
void *v20; // x0
unsigned int i; // w19
cocos2d::CCString *v22; // x0
char *CString; // x0
char *v24; // x2
char *v25; // x0
unsigned int *v26; // x1
int v27; // w3
unsigned int *v28; // x1
int v29; // w2
unsigned int *v30; // x1
int v31; // w2
unsigned int *v32; // x1
int v33; // w2
unsigned int *v34; // x1
int v35; // w2
unsigned int *v36; // x1
int v37; // w2
unsigned int *v38; // x1
int v39; // w2
char *v40; // [xsp+68h] [xbp+68h]
__int64 v41; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v42; // [xsp+B0h] [xbp+B0h] BYREF
__int64 v43; // [xsp+B8h] [xbp+B8h] BYREF
__int64 v44; // [xsp+C0h] [xbp+C0h] BYREF
__int64 v45; // [xsp+C8h] [xbp+C8h] BYREF
_DWORD *v46; // [xsp+D0h] [xbp+D0h] BYREF
FMODAudioEngine::setupAudioEngine(a1);
a1->m_sfxVolume = 1.0;
a1->m_musicVolume = 1.0;
sub_D153B8((int)&v41, "achievement_01.ogg");
v3 = (cocos2d::CCArray *)cocos2d::CCString::create((cocos2d::CCString *)&v41, v2);
sub_D153B8((int)&v42, "playSound_01.ogg");
v5 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v42, v4);
sub_D153B8((int)&v43, "quitSound_01.ogg");
v7 = cocos2d::CCString::create((cocos2d::CCString *)&v43, v6);
sub_D153B8((int)&v44, "explode_11.ogg");
v9 = cocos2d::CCString::create((cocos2d::CCString *)&v44, v8);
sub_D153B8((int)&v45, "endStart_02.ogg");
v11 = cocos2d::CCString::create((cocos2d::CCString *)&v45, v10);
sub_D153B8((int)&v46, "highscoreGet02.ogg");
v13 = cocos2d::CCString::create((cocos2d::CCString *)&v46, v12);
v14 = (cocos2d::CCArray *)cocos2d::CCArray::create(v3, v5, v7, v9, v11, v13, 0);
v15 = (char *)(v46 - 6);
if ( v46 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = v46 - 2;
do
v31 = __ldaxr(v30);
while ( __stlxr(v31 - 1, v30) );
}
else
{
v31 = *(v46 - 2);
*(v46 - 2) = v31 - 1;
}
if ( v31 <= 0 )
operator delete(v15);
}
v16 = (void *)(v45 - 24);
if ( (__int64 *)(v45 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v32 = (unsigned int *)(v45 - 8);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *(_DWORD *)(v45 - 8);
*(_DWORD *)(v45 - 8) = v33 - 1;
}
if ( v33 <= 0 )
operator delete(v16);
}
v17 = (void *)(v44 - 24);
if ( (__int64 *)(v44 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v34 = (unsigned int *)(v44 - 8);
do
v35 = __ldaxr(v34);
while ( __stlxr(v35 - 1, v34) );
}
else
{
v35 = *(_DWORD *)(v44 - 8);
*(_DWORD *)(v44 - 8) = v35 - 1;
}
if ( v35 <= 0 )
operator delete(v17);
}
v18 = (void *)(v43 - 24);
if ( (__int64 *)(v43 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v36 = (unsigned int *)(v43 - 8);
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = *(_DWORD *)(v43 - 8);
*(_DWORD *)(v43 - 8) = v37 - 1;
}
if ( v37 <= 0 )
operator delete(v18);
}
v19 = (void *)(v42 - 24);
if ( (__int64 *)(v42 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v38 = (unsigned int *)(v42 - 8);
do
v39 = __ldaxr(v38);
while ( __stlxr(v39 - 1, v38) );
}
else
{
v39 = *(_DWORD *)(v42 - 8);
*(_DWORD *)(v42 - 8) = v39 - 1;
}
if ( v39 <= 0 )
operator delete(v19);
}
v20 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)(v41 - 8);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v20);
}
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(v14); ++i )
{
v22 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v14, i);
CString = (char *)cocos2d::CCString::getCString(v22);
sub_D153B8((int)&v46, CString);
v24 = FMODAudioEngine::preloadEffect((__int64)a1, (const void **)&v46);
v25 = (char *)(v46 - 6);
if ( v46 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = v46 - 2;
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *(v46 - 2);
*(v46 - 2) = v27 - 1;
}
if ( v27 <= 0 )
{
v40 = v24;
operator delete(v25);
v24 = v40;
}
}
if ( v24 )
v24[28] = 1;
}
}