//
// GJOptionsLayer::getToggleButton from 0xa1f748 to 0xa1f7c8 (128 bytes)
//
// 4 xrefs:
// > GameLevelOptionsLayer::toggleLDM @ 0xa2156c
// > GameLevelOptionsLayer::didToggle @ 0xa2612c
// > GameLevelOptionsLayer::didToggle @ 0xa26148
// > ??> @ 0xbdb68
//
// 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 12:59:39 +0000
//
__int64 __fastcall GJOptionsLayer::getToggleButton(GJOptionsLayer *this, int a2)
{
__int64 result; // x0
unsigned __int64 v4; // x4
unsigned __int64 v5; // x7
unsigned __int64 v6; // x5
unsigned __int64 v7; // x2
unsigned __int64 v8; // x2
result = 0;
v4 = *((_QWORD *)this + 136);
if ( v4 )
{
v5 = v4 - 1;
if ( ((v4 - 1) & v4) != 0 )
v6 = a2 % v4;
else
v6 = v5 & a2;
result = *(_QWORD *)(*((_QWORD *)this + 135) + 8 * v6);
if ( result )
{
while ( 1 )
{
result = *(_QWORD *)result;
if ( !result )
break;
v7 = *(_QWORD *)(result + 8);
if ( ((v4 - 1) & v4) != 0 )
v8 = v7 % v4;
else
v8 = v5 & v7;
if ( v6 != v8 )
return 0;
if ( *(_DWORD *)(result + 16) == a2 )
return *(_QWORD *)(result + 24);
}
}
else
{
return 0;
}
}
return result;
}