//
// GJBaseGameLayer::resetRecord from 0x5b05f8 to 0x5b0878 (640 bytes)
//
// 2 xrefs:
// > PlayLayer::resetLevel @ 0x412714
// > PlayLayer::resetLevel @ 0x41273c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:53:30 +0000
//
void __fastcall GJBaseGameLayer::resetRecord(GJBaseGameLayer *this, int a2, int a3)
{
_DWORD *v5; // r0
char *v6; // r1
_DWORD *v7; // lr
char *v8; // r3
int v9; // t1
int v10; // r3
int v11; // r5
int v12; // r2
int v13; // r3
signed int v14; // r9
int v15; // r1
signed int v16; // r5
int i; // r8
int v18; // r0
unsigned int v19; // r3
float v20; // s15
_DWORD *v21; // r1
int v22; // r3
_DWORD *v23; // lr
_DWORD *v24; // r3
int v25; // r1
int v26; // r2
int v27; // r3
__int64 v28; // r0
unsigned __int8 *v29; // r0
_DWORD v30[4]; // [sp+0h] [bp-50h] BYREF
_QWORD v31[7]; // [sp+10h] [bp-40h] BYREF
if ( !*((_BYTE *)this + 10936) || *((_BYTE *)this + 10728) )
return;
v5 = *((_DWORD **)this + 2753);
v6 = *((char **)this + 2754);
v7 = v5;
v8 = (char *)v5;
while ( v6 != v8 )
{
v9 = *(_DWORD *)v8;
v8 += 16;
if ( v9 == 98 )
{
v10 = 1;
goto LABEL_8;
}
}
v10 = 0;
LABEL_8:
if ( a2 > 0 )
{
if ( !a3 )
{
LABEL_14:
v12 = v6 - (char *)v5;
v13 = 1;
v14 = 0;
v15 = (v6 - (char *)v5) >> 4;
do
{
if ( v13 - 1 >= v15 )
break;
v14 = v15 - v13++;
}
while ( *(_DWORD *)((char *)v5 + v12 - 16 * v13 + 16) != 98 );
v16 = 0;
for ( i = 0; v16 != v15; i = (int)v20 )
{
v18 = v7[2];
v19 = *v7 - 98;
if ( v19 > 1 )
v18 += i;
v20 = (float)v18;
if ( v16 >= v14 && (v20 > (float)a2 || v20 == (float)a2 && v19 <= 1) )
break;
++v16;
v7 += 4;
}
v21 = *((_DWORD **)this + 2758);
while ( v21 )
{
if ( v21[5] <= a2 )
v21 = (_DWORD *)*v21;
else
v21 = (_DWORD *)std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::erase(
(_DWORD *)this + 2756,
v21);
}
std::vector::resize((int *)this + 2753, v16);
*((_DWORD *)this + 2776) = v16;
if ( !*((_BYTE *)this + 10614) )
*((_DWORD *)this + 2749) = i;
if ( v16 )
{
if ( v16 == v14 )
v11 = 98;
else
v11 = 99;
}
else
{
v11 = 99;
}
goto LABEL_31;
}
}
else if ( !a3 )
{
if ( !v10 )
{
GJBaseGameLayer::resetRecordFull(this);
return;
}
goto LABEL_14;
}
v11 = 98;
LABEL_31:
if ( *((_BYTE *)this + 10936) )
{
memset(v30, 0, sizeof(v30));
v22 = *((_DWORD *)this + 2761);
v30[0] = v11;
v30[3] = v22;
*((_DWORD *)this + 2761) = v22 + 1;
v23 = *((_DWORD **)this + 2754);
v24 = *((_DWORD **)this + 2755);
v30[2] = a2;
if ( v23 == v24 )
{
std::vector::__push_back_slow_path((int *)this + 2753, v30);
}
else
{
if ( v23 )
{
v25 = v30[1];
v26 = v30[2];
v27 = v30[3];
*v23 = v30[0];
v23[1] = v25;
v23[2] = v26;
v23[3] = v27;
}
*((_DWORD *)this + 2754) += 16;
}
memset(v31, 0, sizeof(v31));
v31[0] = __PAIR64__(a2, v30[3]);
v31[1] = *((_QWORD *)this + 1371);
LODWORD(v31[2]) = *((_DWORD *)this + 2647);
HIDWORD(v31[2]) = *((_DWORD *)this + 2816);
LODWORD(v31[4]) = *((_DWORD *)this + 2817);
HIDWORD(v31[4]) = *((_DWORD *)this + 348);
LODWORD(v28) = llround();
v31[3] = v28;
std::string::operator=((unsigned __int8 *)&v31[5], (unsigned __int8 *)this + 11108);
v29 = (unsigned __int8 *)(std::unordered_map::operator[](
(int)this + 11024,
(unsigned int *)v31)
+ 10);
*((_QWORD *)v29 - 5) = v31[0];
*((_QWORD *)v29 - 4) = v31[1];
*((_QWORD *)v29 - 3) = v31[2];
*((_QWORD *)v29 - 2) = v31[3];
*((_QWORD *)v29 - 1) = v31[4];
std::string::operator=(v29, (unsigned __int8 *)&v31[5]);
*((_DWORD *)this + 2749) = a2;
++*((_DWORD *)this + 2776);
std::string::~string((int)&v31[5]);
}
}