//
// GJBaseGameLayer::removeReleasedButtons from 0x10014a7b0 to 0x10014a8f9 (329 bytes)
//
// 1 xrefs:
// > PlayLayer::resetLevel @ 0x1000bed8d
//
// 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 __fastcall GJBaseGameLayer::removeReleasedButtons(GJBaseGameLayer *a1)
{
std::__vector_base
::pointer begin; // rax
PlayerButtonCommand *end; // r14
unsigned __int64 v3; // rcx
unsigned __int64 v4; // rbx
int v5; // edx
unsigned __int64 v6; // rsi
PlayerButtonCommand *v7; // r15
size_t v8; // r12
PlayerButtonCommand *v9; // r15
PlayerButtonCommand *v10; // r14
size_t v11; // r15
GJBaseGameLayer *v12; // [rsp+0h] [rbp-30h]
begin = a1->m_queuedButtons.__begin_;
end = a1->m_queuedButtons.__end_;
if ( end != begin )
{
v3 = 0xAAAAAAAAAAAAAAABLL * (((char *)end - (char *)begin) >> 3);
v4 = 0;
v12 = a1;
do
{
v5 = v4 + 1;
if ( begin[v4].m_isPush && (v6 = v5, v3 > v5) )
{
v7 = &begin[v5];
v8 = (char *)end - (char *)begin - 24LL * v5 - 24;
while ( begin[v4].m_button != v7->m_button || v7->m_isPush )
{
++v6;
++v7;
v8 -= 24LL;
if ( v3 <= v6 )
goto LABEL_14;
}
if ( &v7[1] != end )
{
memmove(v7, &v7[1], v8);
a1 = v12;
begin = v12->m_queuedButtons.__begin_;
}
v9 = (PlayerButtonCommand *)((char *)v7 + v8);
a1->m_queuedButtons.__end_ = v9;
v10 = &begin[v4];
v11 = (char *)v9 - (char *)&v10[1];
if ( v11 )
{
memmove(&begin[v4], &v10[1], v11);
a1 = v12;
begin = v12->m_queuedButtons.__begin_;
}
end = (PlayerButtonCommand *)((char *)v10 + v11);
a1->m_queuedButtons.__end_ = end;
}
else
{
LABEL_14:
++v4;
}
v3 = 0xAAAAAAAAAAAAAAABLL * (((char *)end - (char *)begin) >> 3);
}
while ( v4 < v3 );
}
}