//
// GJEffectManager::playerButton from 0x1002d43e0 to 0x1002d4649 (617 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::handleButton @ 0x10012907c
//
// 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:28:14 +0000
//
void __fastcall GJEffectManager::playerButton(_QWORD *a1, int a2, unsigned __int8 a3, __m128 a4)
{
__int64 v4; // r12
unsigned __int8 v5; // r14
__int64 v7; // r13
unsigned __int64 v8; // rbx
char v9; // r8
char v10; // di
unsigned __int64 v11; // rcx
int v12; // r9d
__int64 v13; // rsi
__int64 v14; // rdx
__int64 v15; // r11
__int64 v16; // rax
bool v17; // r10
unsigned __int8 v18; // r8
void (__fastcall ***v19)(_QWORD, _QWORD, _QWORD, void **, _QWORD, _QWORD); // rdi
signed __int64 v20; // r14
void *__src; // [rsp+10h] [rbp-70h]
char *v22; // [rsp+18h] [rbp-68h]
__int64 *v23; // [rsp+20h] [rbp-60h]
void *__p[2]; // [rsp+30h] [rbp-50h] BYREF
char *v26; // [rsp+40h] [rbp-40h]
int v27; // [rsp+50h] [rbp-30h]
unsigned __int8 v28; // [rsp+57h] [rbp-29h]
v4 = a1[56];
if ( a1[57] != v4 )
{
v5 = a3;
v23 = a1 + 129;
v7 = 0;
v8 = 0;
v27 = a2;
do
{
if ( *(_BYTE *)(v4 + v7) )
goto LABEL_5;
if ( (v5 & *(_BYTE *)(v4 + v7 + 28)) != 0 )
goto LABEL_5;
if ( ((*(_DWORD *)(v4 + v7 + 16) == 0) | v5 & (*(_DWORD *)(v4 + v7 + 16) == 1)) != (v5
| (*(_DWORD *)(v4 + v7 + 16) != 2)) )
goto LABEL_5;
v9 = *(_BYTE *)(v4 + v7 + 8);
if ( !(_BYTE)a2 && (v9 & 1) == 0 )
goto LABEL_5;
v10 = a2;
v11 = *(unsigned int *)(v4 + v7 + 4);
if ( (int)v11 <= 0 )
v11 = 0;
v12 = *(_DWORD *)(v4 + v7 + 12);
if ( (int)v11 >= 9999 )
v11 = 9999;
v13 = a1[126];
v14 = (unsigned int)v11 >> 6;
v15 = 1LL << v11;
v16 = *(_QWORD *)(v13 + 8 * v14);
v17 = !_bittest64(&v16, v11);
if ( (v9 & 1) != 0 )
{
if ( v12 )
{
v18 = v10 ^ (v12 != 1);
v19 = (void (__fastcall ***)(_QWORD, _QWORD, _QWORD, void **, _QWORD, _QWORD))a1[40];
if ( v19 )
goto LABEL_21;
goto LABEL_27;
}
}
else
{
v18 = v12 == 1;
if ( v12 )
{
v19 = (void (__fastcall ***)(_QWORD, _QWORD, _QWORD, void **, _QWORD, _QWORD))a1[40];
if ( v19 )
goto LABEL_21;
goto LABEL_27;
}
}
v18 = v17;
v19 = (void (__fastcall ***)(_QWORD, _QWORD, _QWORD, void **, _QWORD, _QWORD))a1[40];
if ( v19 )
{
LABEL_21:
v28 = v18;
a4 = 0;
*(_OWORD *)__p = 0;
v26 = nullptr;
v20 = *(_QWORD *)(v4 + v7 + 40) - *(_QWORD *)(v4 + v7 + 32);
if ( v20 )
{
__src = *(void **)(v4 + v7 + 32);
if ( v20 < 0 )
sub_100093980();
__p[0] = operator new(v20);
__p[1] = __p[0];
v22 = (char *)__p[0] + v20;
v26 = (char *)__p[0] + v20;
memcpy(__p[0], __src, v20);
__p[1] = v22;
}
(**v19)(
v19,
*(unsigned int *)(v4 + v7 + 4),
v28,
__p,
*(unsigned int *)(v4 + v7 + 20),
*(unsigned int *)(v4 + v7 + 24));
v5 = a3;
if ( __p[0] )
{
__p[1] = __p[0];
operator delete(__p[0]);
}
goto LABEL_4;
}
LABEL_27:
LODWORD(__p[0]) = v11;
if ( v18 )
{
*(_QWORD *)(v13 + 8 * v14) = v16 | v15;
sub_10001C120(v23, (int *)__p);
}
else
{
*(_QWORD *)(v13 + 8 * v14) = ~v15 & v16;
sub_10001B800((float *)v23, (int *)__p, __p, a4);
}
LABEL_4:
LOBYTE(a2) = v27;
LABEL_5:
++v8;
v4 = a1[56];
v7 += 56;
}
while ( 0x6DB6DB6DB6DB6DB7LL * ((a1[57] - v4) >> 3) > v8 );
}
}