//
// GJEffectManager::playerButton from 0x140262190 to 0x1402623eb (603 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::handleButton @ 0x140233ac2
// > ??> @ 0x1406d00c8
//
// 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
//
// Hidden C++ exception states: #wind=1
void GJEffectManager::playerButton(GJEffectManager *a1, bool a2, bool a3)
{
int v6; // r12d
std::_Vector_val>::pointer Myfirst; // rsi
__int64 v8; // r14
TouchTriggerControl m_touchTriggerControl; // eax
int m_targetGroupID; // r8d
int v11; // eax
std::_Vector_val>::pointer v12; // r9
bool v13; // bl
TouchTriggerType m_touchTriggerType; // ecx
TouchTriggerType v15; // eax
int v16; // eax
int *v17; // rdx
char v18; // cl
int v19; // eax
char v20[16]; // [rsp+30h] [rbp-58h] BYREF
_QWORD v21[4]; // [rsp+40h] [rbp-48h] BYREF
int v22; // [rsp+90h] [rbp+8h] BYREF
v6 = 0;
Myfirst = a1->m_unkVector1e0._Mypair._Myval2._Myfirst;
if ( a1->m_unkVector1e0._Mypair._Myval2._Mylast - Myfirst )
{
v8 = 0;
do
{
if ( !Myfirst[v8].m_disabled
&& (!Myfirst[v8].m_dualMode || !a3)
&& ((m_touchTriggerControl = Myfirst[v8].m_touchTriggerControl) == 0
|| m_touchTriggerControl == Player1 && a3
|| m_touchTriggerControl == Player2 && !a3)
&& (a2 || Myfirst[v8].m_holdMode) )
{
m_targetGroupID = Myfirst[v8].m_targetGroupID;
v11 = m_targetGroupID;
if ( m_targetGroupID < 0 )
v11 = 0;
if ( v11 > 9999 )
v11 = 9999;
v12 = a1->m_unkVector438._Myvec._Mypair._Myval2._Myfirst;
v13 = ((1 << (v11 & 0x1F)) & v12[(unsigned __int64)v11 >> 5]) == 0;
if ( Myfirst[v8].m_holdMode )
{
m_touchTriggerType = Myfirst[v8].m_touchTriggerType;
if ( m_touchTriggerType )
{
v13 = a2;
if ( m_touchTriggerType != ToggleOn )
v13 = !a2;
}
}
else
{
v15 = Myfirst[v8].m_touchTriggerType;
if ( v15 )
v13 = v15 == ToggleOn;
}
if ( a1->m_triggerEffectDelegate )
{
sub_14024B270(v21, (__int64)&Myfirst[v8].m_remapKeys);
a1->m_triggerEffectDelegate->toggleGroupTriggered(
a1->m_triggerEffectDelegate,
Myfirst[v8].m_targetGroupID,
v13,
(const std::vector *)v21,
Myfirst[v8].m_triggerUniqueID,
Myfirst[v8].m_controlID);
sub_14005E430((__int64)v21);
}
else
{
v16 = Myfirst[v8].m_targetGroupID;
if ( m_targetGroupID < 0 )
v16 = 0;
if ( v16 <= 9999 )
{
if ( m_targetGroupID < 0 )
m_targetGroupID = 0;
}
else
{
m_targetGroupID = 9999;
}
v22 = m_targetGroupID;
v17 = (int *)&v12[(unsigned __int64)m_targetGroupID >> 5];
v18 = m_targetGroupID & 0x1F;
v19 = *v17;
if ( v13 )
{
*v17 = v19 | (1 << v18);
sub_14005D780(&a1->m_unkMap460._Traitsobj._Mypair._Myval2._Myval2, (unsigned __int8 *)&v22);
}
else
{
*v17 = v19 & ~(1 << v18);
sub_140060D70((__int64)&a1->m_unkMap460, (__int64)v20, (unsigned __int8 *)&v22);
}
}
}
++v6;
++v8;
Myfirst = a1->m_unkVector1e0._Mypair._Myval2._Myfirst;
}
while ( v6 < (unsigned __int64)(a1->m_unkVector1e0._Mypair._Myval2._Mylast - Myfirst) );
}
}