//
// GJBaseGameLayer::parseRecording from 0x9dde38 to 0x9ded34 (3836 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::setupReplay @ 0x9ded9c
// > GJBaseGameLayer::restoreRecording @ 0x9dee74
// > ??> @ 0xc8d40
//
// 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:58:54 +0000
//
__int64 __fastcall GJBaseGameLayer::parseRecording(__int64 a1, __int64 a2, unsigned __int8 a3)
{
__int64 v3; // x0
__int64 v4; // x23
__int64 v5; // x0
__int64 v6; // x2
const char *v7; // x1
size_t v8; // x0
cocos2d::CCString *v9; // x0
const char *CString; // x0
size_t v11; // x0
cocos2d::CCArray *v12; // x27
unsigned int v13; // w22
int v14; // w25
cocos2d::CCString *v15; // x0
const char *v16; // x0
size_t v17; // x0
cocos2d::CCArray *v18; // x26
cocos2d::CCString *v19; // x0
const char *v20; // x0
size_t v21; // x0
int v22; // w0
int v23; // w24
bool v24; // w1
_BYTE *v25; // x2
int v26; // w2
cocos2d::CCString *v27; // x0
const char *v28; // x0
int v29; // w26
_QWORD *v30; // x0
__int64 v31; // x3
cocos2d::CCString *v32; // x0
size_t v33; // x0
void *v34; // x0
unsigned __int64 v35; // x19
__int64 v36; // x21
void *v37; // x22
const char *v38; // x0
int v39; // w20
size_t v40; // x1
__int64 *v41; // x0
char *v42; // x19
char *v43; // x0
int v45; // w0
cocos2d::CCArray *v46; // x26
cocos2d::CCString *v47; // x0
size_t v48; // x0
__int64 *v49; // x0
const char *v50; // x1
__int64 *v51; // x0
const char *v52; // x1
__int64 *v53; // x0
const char *v54; // x1
__int64 *v55; // x0
const char *v56; // x1
__int64 *v57; // x0
const void *v58; // x1
size_t v59; // x2
__int64 v60; // x0
char *v61; // x1
size_t v62; // x2
int v63; // w20
__int64 v64; // x19
__int64 *v65; // x0
const char *v66; // x1
size_t v67; // x0
__int64 *v68; // x0
const char *v69; // x1
size_t v70; // x0
char *v71; // [xsp+68h] [xbp+68h]
__int64 v72; // [xsp+88h] [xbp+88h]
char *v73; // [xsp+90h] [xbp+90h]
char *v74; // [xsp+90h] [xbp+90h]
cocos2d::CCArray *v75; // [xsp+98h] [xbp+98h]
int v76; // [xsp+BCh] [xbp+BCh]
char *v78; // [xsp+C8h] [xbp+C8h]
char *v79; // [xsp+C8h] [xbp+C8h]
char *v80; // [xsp+C8h] [xbp+C8h]
char *v81; // [xsp+C8h] [xbp+C8h]
_BYTE *v82; // [xsp+C8h] [xbp+C8h]
char *v83; // [xsp+C8h] [xbp+C8h]
int v84; // [xsp+C8h] [xbp+C8h]
__int64 *v85; // [xsp+108h] [xbp+108h] BYREF
__int64 *v86; // [xsp+110h] [xbp+110h] BYREF
__int64 *v87; // [xsp+118h] [xbp+118h] BYREF
__int64 *v88; // [xsp+120h] [xbp+120h] BYREF
__int64 *v89; // [xsp+128h] [xbp+128h] BYREF
__int64 *v90; // [xsp+130h] [xbp+130h] BYREF
__int64 *v91; // [xsp+138h] [xbp+138h] BYREF
__int64 v92; // [xsp+140h] [xbp+140h] BYREF
__int64 v93; // [xsp+148h] [xbp+148h] BYREF
__int64 v94[2]; // [xsp+150h] [xbp+150h] BYREF
void *v95; // [xsp+160h] [xbp+160h]
__int64 v96; // [xsp+168h] [xbp+168h] BYREF
__int64 v97; // [xsp+170h] [xbp+170h]
void *v98; // [xsp+178h] [xbp+178h]
__int64 v99[2]; // [xsp+180h] [xbp+180h] BYREF
void *v100; // [xsp+190h] [xbp+190h]
__int64 v101[2]; // [xsp+198h] [xbp+198h] BYREF
void *v102; // [xsp+1A8h] [xbp+1A8h]
__int64 v103[2]; // [xsp+1B0h] [xbp+1B0h] BYREF
void *v104; // [xsp+1C0h] [xbp+1C0h]
__int64 v105[2]; // [xsp+1C8h] [xbp+1C8h] BYREF
void *v106; // [xsp+1D8h] [xbp+1D8h]
__int64 v107[2]; // [xsp+1E0h] [xbp+1E0h] BYREF
void *v108; // [xsp+1F0h] [xbp+1F0h]
__int64 v109[2]; // [xsp+1F8h] [xbp+1F8h] BYREF
void *v110; // [xsp+208h] [xbp+208h]
__int64 v111[2]; // [xsp+210h] [xbp+210h] BYREF
void *v112; // [xsp+220h] [xbp+220h]
__int64 v113[2]; // [xsp+228h] [xbp+228h] BYREF
void *v114; // [xsp+238h] [xbp+238h]
__int64 v115[2]; // [xsp+240h] [xbp+240h] BYREF
void *v116; // [xsp+250h] [xbp+250h]
__int64 v117[2]; // [xsp+258h] [xbp+258h] BYREF
void *v118; // [xsp+268h] [xbp+268h]
void *v119; // [xsp+270h] [xbp+270h] BYREF
char *v120; // [xsp+278h] [xbp+278h] BYREF
__int64 v121; // [xsp+280h] [xbp+280h]
__int64 v122; // [xsp+288h] [xbp+288h] BYREF
__int64 v123; // [xsp+290h] [xbp+290h]
void *v124; // [xsp+298h] [xbp+298h]
__int64 v125; // [xsp+2A0h] [xbp+2A0h] BYREF
size_t v126; // [xsp+2A8h] [xbp+2A8h]
void *v127; // [xsp+2B0h] [xbp+2B0h]
__int64 v128; // [xsp+2B8h] [xbp+2B8h] BYREF
__int64 v129; // [xsp+2C0h] [xbp+2C0h]
void *v130; // [xsp+2C8h] [xbp+2C8h]
__int64 v131; // [xsp+2D0h] [xbp+2D0h]
int v132; // [xsp+2D8h] [xbp+2D8h]
int v133; // [xsp+2DCh] [xbp+2DCh]
__int64 v134; // [xsp+2E0h] [xbp+2E0h] BYREF
size_t v135; // [xsp+2E8h] [xbp+2E8h]
void *v136; // [xsp+2F0h] [xbp+2F0h]
v76 = a3;
v3 = a1 + 12288;
if ( a3 )
{
v4 = v3 + 560;
v5 = v3 + 584;
}
else
{
v4 = v3 + 632;
v5 = v3 + 656;
}
v72 = v5;
v6 = *(_QWORD *)(v4 + 8);
if ( *(_QWORD *)v4 != v6 )
*(_QWORD *)(v4 + 8) = v6 + 16 * ~((unsigned __int64)(v6 - 16 - *(_QWORD *)v4) >> 4);
if ( (*(_BYTE *)a2 & 1) != 0 )
v7 = *(const char **)(a2 + 16);
else
v7 = (const char *)(a2 + 1);
v78 = (char *)v7;
v128 = 0;
v129 = 0;
v130 = nullptr;
v8 = strlen(v7);
std::string::__init(&v128, v78, v8);
v75 = sub_9AF870((unsigned __int8 *)&v128, "#");
if ( (v128 & 1) != 0 )
operator delete(v130);
if ( (unsigned int)cocos2d::CCArray::count(v75) > 1 )
{
v9 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v75, 0);
CString = (const char *)cocos2d::CCString::getCString(v9);
v128 = 0;
v79 = (char *)CString;
v129 = 0;
v130 = nullptr;
v11 = strlen(CString);
std::string::__init(&v128, v79, v11);
v12 = sub_9AF870((unsigned __int8 *)&v128, ";");
if ( (v128 & 1) != 0 )
operator delete(v130);
v13 = 0;
v14 = 0;
if ( (unsigned int)cocos2d::CCArray::count(v12) )
{
while ( 1 )
{
v15 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v12, v13);
v16 = (const char *)cocos2d::CCString::getCString(v15);
v94[0] = 0;
v94[1] = 0;
v95 = nullptr;
v80 = (char *)v16;
v17 = strlen(v16);
std::string::__init(v94, v80, v17);
v18 = sub_9AF870((unsigned __int8 *)v94, &byte_1169BE0);
LODWORD(v92) = 0;
WORD2(v92) = 0;
v93 = 0;
v19 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v18, 0);
v20 = (const char *)cocos2d::CCString::getCString(v19);
v96 = 0;
v97 = 0;
v98 = nullptr;
v81 = (char *)v20;
v21 = strlen(v20);
std::string::__init(&v96, v81, v21);
if ( (v96 & 1) != 0 )
break;
v84 = (unsigned __int8)v96;
v45 = atoi((const char *)&v96 + 1);
v23 = abs(v45);
v24 = 1;
LODWORD(v92) = 1;
v14 += v23;
if ( v84 >> 1 )
{
v25 = (char *)&v96 + 1;
LABEL_15:
v24 = *v25 != 45;
}
LABEL_16:
BYTE4(v92) = v24;
if ( v76 )
v26 = v23;
else
v26 = v14;
LODWORD(v93) = v26;
if ( (unsigned int)cocos2d::CCArray::count(v18) <= 1 )
goto LABEL_21;
v27 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v18, 1u);
v28 = (const char *)cocos2d::CCString::getCString(v27);
v29 = atoi(v28);
LODWORD(v92) = GJBaseGameLayer::buttonIDToButton((GJBaseGameLayer *)a1, v29);
BYTE5(v92) = GJBaseGameLayer::isPlayer2Button((GJBaseGameLayer *)a1, v29);
if ( (unsigned int)(v92 - 98) > 1
|| (HIDWORD(v93) = *(_DWORD *)(a1 + 12912),
*(_DWORD *)(a1 + 12912) = HIDWORD(v93) + 1,
v46 = sub_9AF870((unsigned __int8 *)v94, ":"),
(unsigned int)cocos2d::CCArray::count(v46) <= 1) )
{
LABEL_21:
v30 = *(_QWORD **)(v4 + 8);
if ( v30 != *(_QWORD **)(v4 + 16) )
goto LABEL_22;
}
else
{
v47 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v46, 1u);
v73 = (char *)cocos2d::CCString::getCString(v47);
v99[0] = 0;
v99[1] = 0;
v100 = nullptr;
v48 = strlen(v73);
std::string::__init(v99, v73, v48);
v120 = nullptr;
v121 = 0;
v119 = &v120;
GameToolbox::stringSetupToMap((unsigned __int8 *)v99, &byte_1169BE0, (__int64)&v119);
v101[0] = 0;
v101[1] = 0;
v102 = nullptr;
v129 = 0;
v130 = nullptr;
v131 = 0;
v132 = 0;
v133 = 0;
v134 = 0;
v135 = 0;
v136 = nullptr;
v128 = HIDWORD(v93);
std::string::__init(v101, "1", 1u);
if ( std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::__count_unique(
(__int64)&v119,
(__int64)v101) )
{
v103[0] = 0;
v103[1] = 0;
v104 = nullptr;
std::string::__init(v103, "1", 1u);
v85 = v103;
v65 = std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::__emplace_unique_key_args,std::tuple<>>(
(__int64)&v119,
(__int64)v103,
(__int64)&unk_116CF80,
&v85);
v66 = (char *)v65 + 57;
if ( (v65[7] & 1) != 0 )
v66 = (const char *)v65[9];
v105[0] = 0;
v105[1] = 0;
v106 = nullptr;
v74 = (char *)v66;
v67 = strlen(v66);
std::string::__init(v105, v74, v67);
v129 = std::stoull(v105, 0, 10);
if ( (v105[0] & 1) != 0 )
operator delete(v106);
if ( (v103[0] & 1) != 0 )
operator delete(v104);
}
else
{
v129 = 0;
}
if ( (v101[0] & 1) != 0 )
operator delete(v102);
v107[0] = 0;
v107[1] = 0;
v108 = nullptr;
std::string::__init(v107, "3", 1u);
v86 = v107;
v49 = std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::__emplace_unique_key_args,std::tuple<>>(
(__int64)&v119,
(__int64)v107,
(__int64)&unk_116CF80,
&v86);
v50 = (char *)v49 + 57;
if ( (v49[7] & 1) != 0 )
v50 = (const char *)v49[9];
LODWORD(v130) = atoi(v50);
if ( (v107[0] & 1) != 0 )
operator delete(v108);
v109[0] = 0;
v109[1] = 0;
v110 = nullptr;
std::string::__init(v109, &byte_11BCA00, 1u);
v87 = v109;
v51 = std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::__emplace_unique_key_args,std::tuple<>>(
(__int64)&v119,
(__int64)v109,
(__int64)&unk_116CF80,
&v87);
v52 = (char *)v51 + 57;
if ( (v51[7] & 1) != 0 )
v52 = (const char *)v51[9];
HIDWORD(v130) = atoi(v52);
if ( (v109[0] & 1) != 0 )
operator delete(v110);
v111[0] = 0;
v111[1] = 0;
v112 = nullptr;
std::string::__init(v111, "5", 1u);
v88 = v111;
v53 = std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::__emplace_unique_key_args,std::tuple<>>(
(__int64)&v119,
(__int64)v111,
(__int64)&unk_116CF80,
&v88);
v54 = (char *)v53 + 57;
if ( (v53[7] & 1) != 0 )
v54 = (const char *)v53[9];
v132 = atoi(v54);
if ( (v111[0] & 1) != 0 )
operator delete(v112);
v113[0] = 0;
v113[1] = 0;
v114 = nullptr;
std::string::__init(v113, "6", 1u);
v89 = v113;
v55 = std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::__emplace_unique_key_args,std::tuple<>>(
(__int64)&v119,
(__int64)v113,
(__int64)&unk_116CF80,
&v89);
v56 = (char *)v55 + 57;
if ( (v55[7] & 1) != 0 )
v56 = (const char *)v55[9];
v133 = atoi(v56);
if ( (v113[0] & 1) != 0 )
operator delete(v114);
v115[0] = 0;
v115[1] = 0;
v116 = nullptr;
std::string::__init(v115, "7", 1u);
if ( std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::__count_unique(
(__int64)&v119,
(__int64)v115) )
{
v117[0] = 0;
v117[1] = 0;
v118 = nullptr;
std::string::__init(v117, "7", 1u);
v90 = v117;
v68 = std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::__emplace_unique_key_args,std::tuple<>>(
(__int64)&v119,
(__int64)v117,
(__int64)&unk_116CF80,
&v90);
v69 = (char *)v68 + 57;
if ( (v68[7] & 1) != 0 )
v69 = (const char *)v68[9];
v71 = (char *)v69;
v122 = 0;
v123 = 0;
v124 = nullptr;
v70 = strlen(v69);
std::string::__init(&v122, v71, v70);
v131 = std::stoull(&v122, 0, 10);
if ( (v122 & 1) != 0 )
operator delete(v124);
if ( (v117[0] & 1) != 0 )
operator delete(v118);
}
else
{
v131 = 0;
}
if ( (v115[0] & 1) != 0 )
operator delete(v116);
v125 = 0;
v126 = 0;
v127 = nullptr;
std::string::__init(&v125, "8", 1u);
v91 = &v125;
v57 = std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::__emplace_unique_key_args,std::tuple<>>(
(__int64)&v119,
(__int64)&v125,
(__int64)&unk_116CF80,
&v91);
if ( &v134 != v57 + 7 )
{
if ( (v57[7] & 1) != 0 )
{
v58 = (const void *)v57[9];
v59 = v57[8];
}
else
{
v58 = (char *)v57 + 57;
v59 = *((_BYTE *)v57 + 56) >> 1;
}
std::string::assign(&v134, v58, v59);
}
if ( (v125 & 1) != 0 )
operator delete(v127);
v60 = std::unordered_map::operator[](v72, (int *)&v93 + 1);
*(_QWORD *)v60 = v128;
*(_QWORD *)(v60 + 8) = v129;
*(_QWORD *)(v60 + 16) = v130;
*(_QWORD *)(v60 + 24) = v131;
*(_DWORD *)(v60 + 32) = v132;
*(_DWORD *)(v60 + 36) = v133;
if ( (__int64 *)(v60 + 40) != &v134 )
{
if ( (v134 & 1) != 0 )
{
v61 = (char *)v136;
v62 = v135;
}
else
{
v62 = (unsigned __int8)v134 >> 1;
v61 = (char *)&v134 + 1;
}
std::string::assign((__int64 *)(v60 + 40), v61, v62);
}
LODWORD(v93) = v23;
if ( (v134 & 1) != 0 )
operator delete(v136);
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::~__tree((__int64)&v119);
v14 = v23;
if ( (v99[0] & 1) != 0 )
operator delete(v100);
v30 = *(_QWORD **)(v4 + 8);
if ( v30 != *(_QWORD **)(v4 + 16) )
{
LABEL_22:
if ( v30 )
{
v31 = v93;
*v30 = v92;
v30[1] = v31;
v30 = *(_QWORD **)(v4 + 8);
}
*(_QWORD *)(v4 + 8) = v30 + 2;
goto LABEL_25;
}
}
std::vector::__push_back_slow_path((__int16 **)v4, &v92);
LABEL_25:
if ( (v96 & 1) != 0 )
operator delete(v98);
++v13;
if ( (v94[0] & 1) != 0 )
operator delete(v95);
if ( v13 >= (unsigned int)cocos2d::CCArray::count(v12) )
goto LABEL_30;
}
v82 = v98;
v22 = atoi((const char *)v98);
v23 = abs(v22);
v24 = 1;
LODWORD(v92) = 1;
v14 += v23;
v25 = v82;
if ( !v97 )
goto LABEL_16;
goto LABEL_15;
}
LABEL_30:
v119 = nullptr;
v120 = nullptr;
v121 = 0;
v32 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v75, 1u);
v83 = (char *)cocos2d::CCString::getCString(v32);
v122 = 0;
v123 = 0;
v124 = nullptr;
v33 = strlen(v83);
std::string::__init(&v122, v83, v33);
sub_9B9238((unsigned __int8 *)&v122, (__int64 *)&v119);
if ( (v122 & 1) != 0 )
{
operator delete(v124);
v34 = v119;
v35 = 0xAAAAAAAAAAAAAAABLL * ((v120 - (_BYTE *)v119) >> 3);
if ( (int)v35 > 0 )
{
LABEL_32:
v36 = std::stoull(v34, 0, 10);
if ( (_DWORD)v35 != 1 )
{
v37 = v119;
v38 = (char *)v119 + 25;
if ( (*((_BYTE *)v119 + 24) & 1) != 0 )
v38 = *((const char **)v119 + 5);
v39 = atoi(v38);
if ( (int)v35 > 5 )
{
v125 = 0;
v126 = 0;
v127 = nullptr;
if ( (*((_BYTE *)v37 + 120) & 1) != 0 )
{
std::string::__init(&v125, *((void **)v37 + 17), *((_QWORD *)v37 + 16));
}
else
{
v40 = *((_QWORD *)v37 + 16);
v125 = *((_QWORD *)v37 + 15);
v126 = v40;
v127 = *((void **)v37 + 17);
}
if ( v76 )
{
LABEL_39:
v41 = (__int64 *)(a1 + 13064);
*(_QWORD *)(a1 + 12800) = v36;
*(_DWORD *)(a1 + 13088) = v39;
if ( (__int64 *)(a1 + 13064) != &v125 )
{
if ( (v125 & 1) != 0 )
std::string::assign(v41, v127, v126);
else
std::string::assign(v41, (char *)&v125 + 1, (unsigned __int8)v125 >> 1);
}
LABEL_42:
if ( (v125 & 1) != 0 )
operator delete(v127);
v42 = (char *)v119;
if ( v119 )
{
v43 = v120;
if ( v119 != v120 )
{
do
{
v120 = v43 - 24;
std::string::~string((__int64)(v43 - 24));
v43 = v120;
}
while ( v42 != v120 );
v43 = (char *)v119;
}
operator delete(v43);
}
return _stack_chk_guard;
}
LABEL_100:
*(_QWORD *)(a1 + 12808) = v36;
if ( v39 <= 1 )
v63 = 0;
else
v63 = v39 - 1;
*(_DWORD *)(a1 + 12212) = v63;
GameToolbox::fast_srand(v36);
v128 = 0;
v129 = 0;
v130 = nullptr;
v64 = *(_QWORD *)(a1 + 2152);
if ( (v125 & 1) != 0 )
{
std::string::__init(&v128, v127, v126);
}
else
{
v130 = v127;
v128 = v125;
v129 = v126;
}
GJEffectManager::loadPersistentStateString(v64, &v128);
if ( (v128 & 1) != 0 )
operator delete(v130);
goto LABEL_42;
}
LABEL_99:
v125 = 0;
v126 = 0;
v127 = nullptr;
std::string::__init(&v125, &byte_11B8890, 0);
if ( v76 )
goto LABEL_39;
goto LABEL_100;
}
LABEL_98:
v39 = 0;
goto LABEL_99;
}
}
else
{
v34 = v119;
v35 = 0xAAAAAAAAAAAAAAABLL * ((v120 - (_BYTE *)v119) >> 3);
if ( (int)v35 > 0 )
goto LABEL_32;
}
v36 = 0;
goto LABEL_98;
}
return _stack_chk_guard;
}