//
// GJGameLevel::storeNewLocalScore from 0x85f50c to 0x85f6d8 (460 bytes)
//
// 2 xrefs:
// > GJGameLevel::saveNewScore @ 0x85f744
// > ??> @ 0xa6078
//
// This function is hookable on this platform (idp: arm, 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:55:35 +0000
//
__int64 __fastcall GJGameLevel::storeNewLocalScore(GJGameLevel *this, int a2, int a3)
{
char *v4; // x20
int *v5; // x2
int *v6; // x0
int v7; // t1
__int64 v8; // x2
__int64 v9; // x3
int *v10; // x0
_DWORD v12[3]; // [xsp+4Ch] [xbp+4Ch] BYREF
void *v13; // [xsp+58h] [xbp+58h] BYREF
int *v14; // [xsp+60h] [xbp+60h]
int *v15; // [xsp+68h] [xbp+68h]
__int64 v16[3]; // [xsp+70h] [xbp+70h] BYREF
v4 = (char *)this + 1384;
if ( a3 == 1 )
v4 = (char *)this + 1408;
v12[0] = a2;
v13 = nullptr;
v14 = nullptr;
v15 = nullptr;
GJGameLevel::scoreStringToVector((__int64)this, v4, (__int64)&v13);
v5 = v14;
if ( v13 != v14 )
{
if ( *(_DWORD *)v13 == v12[0] )
{
LABEL_19:
v10 = (int *)v13;
v14 += ~((unsigned __int64)((char *)(v14 - 1) - (_BYTE *)v13) >> 2);
LABEL_17:
operator delete(v10);
return _stack_chk_guard;
}
v6 = (int *)((char *)v13 + 4);
while ( v14 != v6 )
{
v7 = *v6++;
if ( v7 == v12[0] )
goto LABEL_19;
}
}
if ( v14 == v15 )
{
std::vector::__push_back_slow_path((__int64)&v13, v12);
}
else
{
if ( v14 )
{
*v14 = v12[0];
v5 = v14;
}
v14 = v5 + 1;
}
GJGameLevel::scoreVectorToString((__int64 *)&v13, a3, v16);
if ( (*v4 & 1) != 0 )
{
**((_BYTE **)v4 + 2) = 0;
*((_QWORD *)v4 + 1) = 0;
}
else
{
v4[1] = 0;
*v4 = 0;
}
std::string::reserve((__int64 *)v4, 0);
v8 = v16[0];
v9 = v16[1];
v10 = (int *)v13;
*((_QWORD *)v4 + 2) = v16[2];
*(_QWORD *)v4 = v8;
*((_QWORD *)v4 + 1) = v9;
if ( v10 )
{
if ( v10 != v14 )
v14 += ~((unsigned __int64)((char *)(v14 - 1) - (char *)v10) >> 2);
goto LABEL_17;
}
return _stack_chk_guard;
}