//
// sub_10038CC88 from 0x10038cc88 to 0x10038d4fc (2164 bytes)
//
// 10 xrefs:
// > CustomSFXWidget::init @ 0x10038c2a8
// > sub_10038CA58 @ 0x10038caa8
// > sub_10038CACC @ 0x10038cb04
// > sub_10038CC34 @ 0x10038cc84
// > sub_10038D590 @ 0x10038d5dc
// > sub_10038D8A0 @ 0x10038d8f0
// > sub_10038D908 @ 0x10038d940
// > CustomSFXWidget::songStateChanged @ 0x10038d944
// > sub_10038D948 @ 0x10038d94c
// > sub_10038D950 @ 0x10038d954
//
// This function is hookable on this platform (idp: arm, 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 11:03:36 +0000
//
__int64 __fastcall sub_10038CC88(__int64 a1)
{
__int64 v2; // x8
__int64 v3; // x0
_QWORD *v4; // x1
__int64 v5; // x8
void *v6; // x0
int v7; // w20
const std::string::value_type *v8; // x0
int v9; // w8
float v10; // s1
float v11; // s2
std::string *v12; // x8
void *v13; // x0
const std::string::value_type *v14; // x0
std::string *v15; // x1
__int64 v16; // x8
void (*v17)(void); // x8
__int64 v18; // x0
__int64 v19; // x20
int v20; // w21
__int64 v21; // x0
__int64 v22; // x8
_BOOL8 v23; // x0
__int64 v24; // x21
__int64 v25; // x0
__int64 v26; // x20
__int64 v27; // x0
__int64 v28; // x0
const char *v29; // x1
void **v30; // x8
void *v31; // x0
const std::string::value_type *CString; // x0
__int64 v33; // x0
char v34; // w8
__int64 v35; // x0
_BOOL4 v36; // w21
__int64 v37; // x0
const char *v38; // x1
__int64 v39; // x0
__int64 v40; // x0
__int64 v41; // x20
__int64 v42; // x21
__int64 v43; // x0
const char *v44; // x22
__int64 v45; // x0
int v46; // w8
int v47; // w9
__int64 v48; // x10
int v49; // w11
unsigned int v50; // w22
_BOOL4 v51; // w9
unsigned int v52; // w10
float v53; // s0
__n128 v54; // q0
__int64 v55; // x20
float32x2_t *v56; // x21
float v57; // s9
float v58; // s0
double v59; // d0
__int64 v60; // x20
__int64 v61; // x0
float v62; // s9
__int64 v63; // x20
__n128 v64; // q0
float v65; // s0
__int64 v66; // x0
float v67; // s2
int v68; // w8
float v69; // s0
unsigned int v70; // w8
__int64 v71; // x8
__n128 v72; // q0
__int64 v73; // x20
__n128 v74; // q0
float v75; // s8
float v76; // s8
float32x2_t *v77; // x20
__n128 v78; // q0
float v79; // s0
__int64 v80; // x20
__int64 v81; // x21
int v83; // w20
char v84; // w8
__int64 v85; // x0
__int64 v86; // x0
__int64 v87; // [xsp+18h] [xbp-68h] BYREF
void *__p[2]; // [xsp+20h] [xbp-60h] BYREF
char v89; // [xsp+37h] [xbp-49h]
std::string v90; // [xsp+38h] [xbp-48h] BYREF
v2 = *(_QWORD *)(a1 + 336);
v3 = *(_QWORD *)(a1 + 352);
if ( !v2 )
{
(*(void (__fastcall **)(__int64, const char *))(*(_QWORD *)v3 + 928LL))(v3, "No SFX loaded");
(*(void (__fastcall **)(_QWORD, const char *))(**(_QWORD **)(a1 + 360) + 928LL))(*(_QWORD *)(a1 + 360), "");
goto LABEL_23;
}
v4 = (_QWORD *)(v2 + 80);
if ( *(char *)(v2 + 103) < 0 )
v4 = (_QWORD *)*v4;
(*(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v3 + 928LL))(v3, v4);
memset(&v90, 0, sizeof(v90));
v5 = *(_QWORD *)(a1 + 336);
if ( *(_BYTE *)(v5 + 72) == 1 )
{
sub_1002E757C(*(_QWORD *)(v5 + 152));
v6 = sub_1003065B0("Files: %i");
}
else
{
v7 = *(_DWORD *)(v5 + 56);
if ( *(_BYTE *)(a1 + 492) != 1 )
{
sub_1001D1978(*(_DWORD *)(v5 + 64), __p);
if ( v89 >= 0 )
v30 = __p;
else
v30 = (void **)__p[0];
v31 = sub_1003065B0("ID: %i Size: %s", v7, (const char *)v30);
CString = (const std::string::value_type *)cocos2d::CCString::getCString((__int64)v31);
std::string::assign(&v90, CString);
if ( v89 < 0 )
operator delete(__p[0]);
goto LABEL_10;
}
v6 = sub_1003065B0("%i");
}
v8 = (const std::string::value_type *)cocos2d::CCString::getCString((__int64)v6);
std::string::assign(&v90, v8);
LABEL_10:
v9 = *(_DWORD *)(*(_QWORD *)(a1 + 336) + 68LL);
if ( v9 >= 1 )
{
v10 = (float)(unsigned int)v9 / 100.0;
v11 = *(float *)(a1 + 500);
v12 = &v90;
if ( (v90.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v12 = (std::string *)v90.__r_.__value_.__r.__words[0];
if ( v11 <= 0.0 || v11 == 1.0 )
v13 = sub_1003065B0("%s (%.2f s)", (const char *)v12, v10);
else
v13 = sub_1003065B0("%s (%.2f s) (%.2f s)", (const char *)v12, v10, (float)(v10 / v11));
v14 = (const std::string::value_type *)cocos2d::CCString::getCString((__int64)v13);
std::string::assign(&v90, v14);
}
if ( (v90.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v15 = &v90;
else
v15 = (std::string *)v90.__r_.__value_.__r.__words[0];
(*(void (__fastcall **)(_QWORD, std::string *))(**(_QWORD **)(a1 + 360) + 928LL))(*(_QWORD *)(a1 + 360), v15);
if ( SHIBYTE(v90.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v90.__r_.__value_.__l.__data_);
LABEL_23:
v16 = *(_QWORD *)(a1 + 336);
if ( !v16 || (*(_BYTE *)(v16 + 72) & 1) != 0 )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 376) + 344LL))(*(_QWORD *)(a1 + 376), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 384) + 344LL))(*(_QWORD *)(a1 + 384), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 392) + 344LL))(*(_QWORD *)(a1 + 392), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 400) + 344LL))(*(_QWORD *)(a1 + 400), 0);
v17 = *(void (**)(void))(**(_QWORD **)(a1 + 408) + 344LL);
LABEL_26:
v17();
sub_10038CBA4(a1);
goto LABEL_27;
}
v24 = *(unsigned int *)(v16 + 56);
v25 = MusicDownloadManager::sharedState();
if ( (unsigned int)MusicDownloadManager::isSFXDownloaded(v25, v24) )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 376) + 344LL))(*(_QWORD *)(a1 + 376), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 384) + 344LL))(*(_QWORD *)(a1 + 384), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 408) + 344LL))(
*(_QWORD *)(a1 + 408),
*(unsigned __int8 *)(a1 + 488));
if ( *(_BYTE *)(a1 + 488) == 1 && *(_QWORD *)(a1 + 480) )
{
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 392) + 344LL))(*(_QWORD *)(a1 + 392), 1);
v26 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 392) + 1072LL))(*(_QWORD *)(a1 + 392));
if ( (*(unsigned int (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 480) + 8LL))(*(_QWORD *)(a1 + 480)) == (_DWORD)v24
&& (*(unsigned int (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 480) + 16LL))(*(_QWORD *)(a1 + 480)) == *(_DWORD *)(*(_QWORD *)(a1 + 336) + 76LL) )
{
v27 = (*(__int64 (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 392) + 1056LL))(*(_QWORD *)(a1 + 392), 0);
v28 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v27);
v29 = "GJ_selectSongOnBtn_001.png";
}
else
{
v85 = (*(__int64 (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 392) + 1056LL))(*(_QWORD *)(a1 + 392), 1);
v28 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v85);
v29 = "GJ_selectSongBtn_001.png";
}
v86 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v28, v29);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v26 + 1160LL))(v26, v86);
}
else
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 392) + 344LL))(*(_QWORD *)(a1 + 392), 0);
}
v17 = *(void (**)(void))(**(_QWORD **)(a1 + 400) + 344LL);
goto LABEL_26;
}
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 392) + 344LL))(*(_QWORD *)(a1 + 392), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 400) + 344LL))(*(_QWORD *)(a1 + 400), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 408) + 344LL))(*(_QWORD *)(a1 + 408), 0);
v33 = MusicDownloadManager::sharedState();
if ( MusicDownloadManager::isRunningActionForSongID(v33, *(_DWORD *)(a1 + 496)) )
{
v34 = 0;
v35 = *(_QWORD *)(a1 + 376);
}
else
{
v35 = *(_QWORD *)(a1 + 376);
if ( (*(_BYTE *)(a1 + 491) & 1) == 0 )
{
v83 = 0;
v34 = *(_BYTE *)(a1 + 490);
goto LABEL_98;
}
v34 = 0;
}
v83 = 1;
LABEL_98:
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v35 + 344LL))(v35, v34 & 1);
if ( v83 )
v84 = *(_BYTE *)(a1 + 490);
else
v84 = 0;
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 384) + 344LL))(*(_QWORD *)(a1 + 384), v84 & 1);
LABEL_27:
v18 = *(_QWORD *)(a1 + 416);
if ( v18 && *(_QWORD *)(a1 + 336) )
{
v19 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v18 + 1072LL))(v18);
v20 = *(_DWORD *)(*(_QWORD *)(a1 + 336) + 76LL);
v21 = MusicDownloadManager::sharedState();
v22 = *(_QWORD *)(a1 + 336);
if ( v20 < 1 )
v23 = sub_1001D5B1C(v21, *(_DWORD *)(v22 + 56));
else
v23 = sub_1001D5B9C(v21, *(_DWORD *)(v22 + 76));
v36 = v23;
v37 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v23);
if ( v36 )
v38 = "gj_heartOn_001.png";
else
v38 = "gj_heartOff_001.png";
v39 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v37, v38);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v19 + 1160LL))(v19, v39);
}
v40 = *(_QWORD *)(a1 + 440);
if ( v40 && *(_QWORD *)(a1 + 336) )
{
v41 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v40 + 1072LL))(v40);
v42 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v41);
v43 = *(_QWORD *)(a1 + 480);
v44 = "GJ_checkOff_001.png";
if ( v43
&& (*(unsigned int (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v43 + 56LL))(
v43,
*(unsigned int *)(*(_QWORD *)(a1 + 336) + 76LL)) )
{
v44 = "GJ_checkOn_001.png";
}
v45 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v42, v44);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v41 + 1160LL))(v41, v45);
}
v46 = *(unsigned __int8 *)(a1 + 493);
if ( (v46 & 1) != 0 || *(_QWORD *)(a1 + 432) )
v47 = 2;
else
v47 = 1;
if ( *(_QWORD *)(a1 + 424) || *(_QWORD *)(a1 + 432) && *(_BYTE *)(a1 + 493) )
v47 = 3;
v48 = *(_QWORD *)(a1 + 440);
if ( *(_BYTE *)(a1 + 493) )
v49 = 4;
else
v49 = 3;
if ( v48 )
v50 = v49;
else
v50 = v47;
if ( (*(_BYTE *)(a1 + 492) & 1) != 0 )
{
v51 = v48 != 0;
if ( v50 == 3 )
v52 = 150;
else
v52 = 200;
v53 = (float)v52;
if ( (v51 & v46) != 0 )
v53 = 130.0;
v54 = cocos2d::CCLabelBMFont::limitLabelWidth(*(_QWORD *)(a1 + 352), v53, 0.4, 0.0);
v55 = *(_QWORD *)(a1 + 360);
v56 = (float32x2_t *)(*(__int64 (__fastcall **)(_QWORD, __n128))(**(_QWORD **)(a1 + 352) + 192LL))(
*(_QWORD *)(a1 + 352),
v54);
v57 = *(float *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 352) + 328LL))(*(_QWORD *)(a1 + 352));
v58 = (*(float (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 352) + 168LL))(*(_QWORD *)(a1 + 352));
sub_1000262BC((float *)__p, (float)(v57 * v58) + 5.0, 0.0);
*(float32x2_t *)&v59 = sub_100026318(v56, (float32x2_t *)__p, (float32x2_t *)&v90);
(*(void (__fastcall **)(__int64, std::string *, double))(*(_QWORD *)v55 + 184LL))(v55, &v90, v59);
v60 = *(_QWORD *)(a1 + 368);
v61 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 360) + 192LL))(*(_QWORD *)(a1 + 360));
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v60 + 184LL))(v60, v61);
v62 = (float)(*(float *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 376) + 192LL))(*(_QWORD *)(a1 + 376))
+ (float)((float)v50 * -20.0))
+ -10.0;
v63 = *(_QWORD *)(a1 + 360);
v64.n128_f32[0] = (*(float (__fastcall **)(__int64))(*(_QWORD *)v63 + 224LL))(v63);
v65 = (float)(v62 - v64.n128_f32[0]) - sub_10038D808(a1, v64);
v66 = v63;
v67 = 0.4;
goto LABEL_90;
}
if ( v48 && (v46 & 1) != 0 )
{
*(float *)&v68 = 155.0;
}
else
{
if ( v50 != 3 )
{
if ( v50 == 2 )
v70 = 210;
else
v70 = 240;
v69 = (float)v70;
goto LABEL_86;
}
*(float *)&v68 = 185.0;
}
v69 = *(float *)&v68;
LABEL_86:
v71 = *(_QWORD *)(a1 + 336);
if ( v71 && *(_BYTE *)(v71 + 72) )
v69 = v69 + -50.0;
v72 = cocos2d::CCLabelBMFont::limitLabelWidth(*(_QWORD *)(a1 + 352), v69, 0.5, 0.0);
v73 = *(_QWORD *)(a1 + 360);
v65 = 255.0 - sub_10038D808(a1, v72);
v67 = 0.45;
v66 = v73;
LABEL_90:
v74 = cocos2d::CCLabelBMFont::limitLabelWidth(v66, v65, 0.6, v67);
if ( *(_QWORD *)(a1 + 448) )
{
v75 = *(float *)(*(__int64 (__fastcall **)(_QWORD, __n128))(**(_QWORD **)(a1 + 360) + 328LL))(
*(_QWORD *)(a1 + 360),
v74);
v76 = v75 * (*(float (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 360) + 168LL))(*(_QWORD *)(a1 + 360));
v77 = (float32x2_t *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 360) + 192LL))(*(_QWORD *)(a1 + 360));
v79 = sub_10038D808(a1, v78);
sub_1000262BC((float *)__p, (float)(v76 + (float)(v79 * 0.5)) + 2.0, 0.0);
sub_100026318(v77, (float32x2_t *)__p, (float32x2_t *)&v90);
v80 = *(_QWORD *)(a1 + 448);
v81 = *(_QWORD *)(a1 + 344);
cocos2d::CCNode::convertToWorldSpace(a1, (__int64)&v90, &v87);
cocos2d::CCNode::convertToNodeSpace(v81, (__int64)&v87, __p);
(*(void (__fastcall **)(__int64, void **))(*(_QWORD *)v80 + 184LL))(v80, __p);
}
return (*(__int64 (__fastcall **)(_QWORD, _QWORD, __n128))(**(_QWORD **)(a1 + 408) + 344LL))(
*(_QWORD *)(a1 + 408),
0,
v74);
}