//
// GJBaseGameLayer::removeReleasedButtons from 0x863f10 to 0x864054 (324 bytes)
//
// 3 xrefs:
// > PlayLayer::resetLevel @ 0x5e5704
// > PlayLayer::resetLevel @ 0x5e5924
// > ??> @ 0xbbaa0
//
// 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
//
void GJBaseGameLayer::removeReleasedButtons(GJBaseGameLayer *a1)
{
PlayerButtonCommand *m_start; // x8
PlayerButtonCommand *m_finish; // x6
unsigned __int64 v4; // x19
__int64 v5; // x9
unsigned __int64 i; // x4
PlayerButtonCommand *v7; // x7
unsigned __int64 v8; // x2
PlayerButtonCommand *v9; // x0
PlayerButtonCommand *v10; // x1
float *v11; // x23
PlayerButtonCommand *v12; // x0
PlayerButtonCommand *v13; // x1
m_start = a1->m_queuedButtons.m_start;
m_finish = a1->m_queuedButtons.m_finish;
v4 = 0;
v5 = (char *)m_finish - (char *)m_start;
LABEL_2:
for ( i = 0xAAAAAAAAAAAAAAABLL * (v5 >> 3); v4 < i; i = 0xAAAAAAAAAAAAAAABLL * (v5 >> 3) )
{
v7 = &m_start[v4];
if ( !v7->m_isPush || (v8 = (int)v4 + 1, i <= v8) )
{
LABEL_18:
++v4;
goto LABEL_2;
}
v9 = &m_start[v8];
while ( 1 )
{
++v8;
if ( v9->m_button == v7->m_button && !v9->m_isPush )
break;
++v9;
if ( v8 >= i )
goto LABEL_18;
}
v10 = v9 + 1;
if ( &v9[1] != m_finish )
{
if ( 0xAAAAAAAAAAAAAAABLL * (((char *)m_finish - (char *)v10) >> 3) )
{
memmove(v9, v10, (char *)m_finish - (char *)v10);
v11 = &a1->m_varianceValues.__elems_[1975];
m_start = a1->m_queuedButtons.m_start;
v10 = a1->m_queuedButtons.m_finish;
v7 = &m_start[v4];
goto LABEL_13;
}
v10 = m_finish;
}
v11 = &a1->m_varianceValues.__elems_[1975];
LABEL_13:
v12 = v10 - 1;
v13 = v7 + 1;
*((_QWORD *)v11 + 106) = v12;
if ( v12 != &v7[1] )
{
if ( 0xAAAAAAAAAAAAAAABLL * (((char *)v12 - (char *)v13) >> 3) )
{
memmove(v7, v13, (char *)v12 - (char *)v13);
v12 = *((PlayerButtonCommand **)v11 + 106);
m_start = a1->m_queuedButtons.m_start;
}
}
m_finish = v12 - 1;
*((_QWORD *)v11 + 106) = v12 - 1;
v5 = (char *)&v12[-1] - (char *)m_start;
}
}