//
// GJKeybindManager::handleGlobalAudioAction from 0x1006156b0 to 0x10061596f (703 bytes)
//
// 1 xrefs:
// > GJKeybindManager::handleGlobalAction @ 0x100619cc9
//
// 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:34:36 +0000
//
__int64 __fastcall GJKeybindManager::handleGlobalAudioAction(int a1, char a2)
{
unsigned int v3; // r15d
unsigned int v4; // ebx
__int64 v5; // rdi
float BackgroundMusicVolume; // xmm0_4
int v7; // ecx
int v8; // ecx
int v9; // eax
int v10; // r14d
float v11; // xmm0_4
__int64 v12; // rdi
__int64 v13; // rax
__int64 v14; // r14
__int64 v15; // rax
const char *CString; // r12
size_t v17; // rax
size_t v18; // r15
char *v19; // r13
char v20; // r14
size_t v21; // r14
char *v22; // rax
__int128 v24; // [rsp+0h] [rbp-80h] BYREF
void *v25; // [rsp+10h] [rbp-70h]
__int64 v26; // [rsp+18h] [rbp-68h]
__int128 v27; // [rsp+20h] [rbp-60h] BYREF
void *v28; // [rsp+30h] [rbp-50h]
float v29; // [rsp+3Ch] [rbp-44h]
__int128 __dst; // [rsp+40h] [rbp-40h] BYREF
void *__p; // [rsp+50h] [rbp-30h]
v3 = a1 - 1001;
v4 = 0;
if ( (unsigned int)(a1 - 1001) > 4 )
return v4;
if ( a1 == 1003 )
return v4;
LOBYTE(v4) = 1;
if ( !a2 )
return v4;
v5 = FMODAudioEngine::sharedEngine();
if ( v3 > 1 )
BackgroundMusicVolume = sub_1003D3F10(v5);
else
BackgroundMusicVolume = FMODAudioEngine::getBackgroundMusicVolume(v5);
v7 = -10;
if ( a1 == 1004 )
v7 = 10;
if ( a1 == 1001 )
v7 = 10;
v8 = (int)(float)((float)(BackgroundMusicVolume * 100.0) + 0.5) + v7;
v9 = 0;
if ( v8 > 0 )
v9 = v8;
v10 = 100;
if ( v9 < 100 )
v10 = v9;
v11 = (float)(v10 + 5 - (unsigned __int8)(v10 + 5 - 5 * (((unsigned int)(205 * (v10 + 5)) >> 10) & 0x3E))) / 100.0;
v29 = v11;
v12 = FMODAudioEngine::sharedEngine();
if ( v3 > 1 )
{
FMODAudioEngine::setEffectsVolume(v12, v11);
if ( !*(_QWORD *)(GameManager::sharedState() + 952) )
goto LABEL_20;
goto LABEL_19;
}
FMODAudioEngine::setBackgroundMusicVolume(v12, v11);
if ( *(_QWORD *)(GameManager::sharedState() + 952) )
{
LABEL_19:
v13 = GameManager::sharedState();
(***(void (__fastcall ****)(_QWORD))(v13 + 952))(*(_QWORD *)(v13 + 952));
}
LABEL_20:
v14 = *(_QWORD *)(cocos2d::CCDirector::sharedDirector() + 272);
if ( !v14 )
return v4;
v15 = sub_10088E820("%s Volume: %d%%", v24);
CString = (const char *)cocos2d::CCString::getCString(v15);
v17 = strlen(CString);
if ( v17 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v18 = v17;
v26 = v14;
if ( v17 >= 0x17 )
{
v21 = 26;
if ( (v17 | 7) != 0x17 )
v21 = (v17 | 7) + 1;
v19 = (char *)operator new(v21);
__p = v19;
*(_QWORD *)&__dst = v21 + 1;
*((_QWORD *)&__dst + 1) = v18;
LABEL_29:
memmove(v19, CString, v18);
v19[v18] = 0;
v20 = __dst;
if ( (__dst & 1) == 0 )
goto LABEL_25;
goto LABEL_30;
}
LOBYTE(__dst) = 2 * v17;
v19 = (char *)&__dst + 1;
if ( v17 )
goto LABEL_29;
BYTE1(__dst) = 0;
v20 = __dst;
if ( (__dst & 1) == 0 )
{
LABEL_25:
v28 = __p;
v27 = __dst;
goto LABEL_31;
}
LABEL_30:
sub_10001AD30(&v27, __p, *((unsigned __int64 *)&__dst + 1));
LABEL_31:
LOWORD(v24) = 0;
v22 = TextAlertPopup::create(&v27, 0x96u, &v24, 0.5, 0.60000002);
TextAlertPopup::replaceIn(v26, 0x564F4Cu, (__int64)v22, 0x3E8u);
if ( (v24 & 1) == 0 )
{
if ( (v27 & 1) == 0 )
goto LABEL_33;
LABEL_37:
operator delete(v28);
if ( (v20 & 1) == 0 )
return v4;
goto LABEL_34;
}
operator delete(v25);
if ( (v27 & 1) != 0 )
goto LABEL_37;
LABEL_33:
if ( (v20 & 1) != 0 )
LABEL_34:
operator delete(__p);
return v4;
}