//
// GJOptionsLayer::getToggleButton from 0x5d4724 to 0x5d4786 (98 bytes)
//
// 3 xrefs:
// > GameLevelOptionsLayer::toggleLDM @ 0x5d56d4
// > GameLevelOptionsLayer::didToggle @ 0x5d873c
// > GameLevelOptionsLayer::didToggle @ 0x5d8750
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:54:07 +0000
//
_DWORD *__fastcall GJOptionsLayer::getToggleButton(GJOptionsLayer *this, unsigned int a2)
{
unsigned int v2; // r5
unsigned int v4; // r6
unsigned int v5; // r9
_DWORD *result; // r0
_DWORD *i; // r4
unsigned int v8; // r0
int v9; // r1
v2 = *((_DWORD *)this + 191);
if ( !v2 )
return nullptr;
v4 = v2 - 1;
if ( ((v2 - 1) & v2) != 0 )
v5 = a2 % v2;
else
v5 = v4 & a2;
result = *(_DWORD **)(*((_DWORD *)this + 190) + 4 * v5);
if ( result )
{
for ( i = (_DWORD *)*result; i; i = (_DWORD *)*i )
{
v8 = i[1];
v9 = ((v2 - 1) & v2) != 0 ? v8 % v2 : v4 & v8;
if ( v9 != v5 )
break;
if ( i[2] == a2 )
return (_DWORD *)i[3];
}
return nullptr;
}
return result;
}