//
// localStorageInit from 0xd20c40 to 0xd20fc8 (904 bytes)
//
// 1 xrefs:
// > ??> @ 0xf2a88
//
// 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 13:07:11 +0000
//
__int64 __fastcall localStorageInit(char *a1)
{
size_t v3; // x0
unsigned __int8 v4; // w22
int v5; // w24
__int64 *v6; // x26
__int64 *v7; // x20
__int64 v8; // x0
__int64 v9; // x22
__int64 v10; // x20
int v11; // w23
int v12; // t1
signed __int64 v13; // x20
unsigned __int64 v14; // x20
unsigned __int64 v15; // x2
char *v16; // x1
char *v17; // x22
int v18; // w20
char *v19; // x0
unsigned __int64 v20; // x2
size_t v21; // x2
std::logic_error *exception; // x20
unsigned __int64 v23; // x0
unsigned __int64 v24; // x0
__int64 v25; // [xsp+50h] [xbp+50h] BYREF
__int64 v26; // [xsp+58h] [xbp+58h]
__int64 v27; // [xsp+60h] [xbp+60h]
__int64 v28; // [xsp+68h] [xbp+68h] BYREF
unsigned __int64 v29; // [xsp+70h] [xbp+70h]
void *v30; // [xsp+78h] [xbp+78h]
__int64 v31; // [xsp+80h] [xbp+80h] BYREF
unsigned __int64 v32; // [xsp+88h] [xbp+88h]
void *v33; // [xsp+90h] [xbp+90h]
if ( !a1
|| !*a1
|| dword_155FBB0
|| !(unsigned __int8)cocos2d::JniHelper::getStaticMethodInfo(
&v25,
"org/cocos2dx/lib/Cocos2dxLocalStorage",
"init",
"(Ljava/lang/String;Ljava/lang/String;)Z") )
{
return _stack_chk_guard;
}
v28 = 0;
v29 = 0;
v30 = nullptr;
v3 = strlen(a1);
std::string::__init(&v28, a1, v3);
v4 = v28;
v5 = v28 & 1;
if ( v5 )
{
v6 = (__int64 *)v30;
v7 = (__int64 *)((char *)v30 + v29);
if ( v30 != (char *)v30 + v29 )
goto LABEL_16;
v8 = v25;
goto LABEL_9;
}
v6 = (__int64 *)((char *)&v28 + 1);
v7 = (__int64 *)((char *)&v28 + ((unsigned __int8)v28 >> 1) + 1);
if ( v7 == (__int64 *)((char *)&v28 + 1) )
{
v8 = v25;
goto LABEL_9;
}
LABEL_16:
while ( 1 )
{
v12 = *((unsigned __int8 *)v7 - 1);
v7 = (__int64 *)((char *)v7 - 1);
if ( memchr("/\\", v12, 2u) )
break;
if ( v7 == v6 )
goto LABEL_30;
}
v13 = (char *)v7 - (char *)v6;
if ( v13 != -1 )
{
v31 = 0;
v14 = v13 + 1;
v32 = 0;
v33 = nullptr;
if ( v5 )
{
v15 = v29;
if ( v14 <= v29 )
{
v16 = (char *)v30;
goto LABEL_21;
}
}
else
{
v15 = v4 >> 1;
v16 = (char *)&v28 + 1;
if ( v14 <= v15 )
{
LABEL_21:
std::string::__init(&v31, &v16[v14], v15 - v14);
if ( (v28 & 1) != 0 )
{
*(_BYTE *)v30 = 0;
v29 = 0;
if ( (v28 & 1) != 0 )
{
v17 = (char *)v30;
v18 = 1;
v19 = (char *)&v28 + 1;
goto LABEL_24;
}
v23 = (unsigned __int8)v28 >> 1;
if ( v23 > 0x16 )
{
v24 = (v23 + 16) & 0xFFFFFFFFFFFFFFF0LL;
if ( v24 != 23 )
{
v19 = (char *)operator new(v24);
v18 = v28 & 1;
if ( (v28 & 1) == 0 )
{
v17 = (char *)&v28 + 1;
v20 = (unsigned __int8)v28 >> 1;
goto LABEL_25;
}
v17 = (char *)v30;
LABEL_24:
v20 = v29;
LABEL_25:
v21 = v20 + 1;
if ( v21 )
memcpy(v19, v17, v21);
if ( v18 )
operator delete(v17);
}
}
}
v28 = v31;
v29 = v32;
v30 = v33;
goto LABEL_30;
}
}
exception = (std::logic_error *)_cxa_allocate_exception(0x10u);
std::logic_error::logic_error(exception, "basic_string");
*(_QWORD *)exception = off_1536D68;
_cxa_throw(
exception,
(struct type_info *)&`typeinfo for'std::out_of_range,
(void (*)(void *))std::logic_error::~logic_error);
}
LABEL_30:
v8 = v25;
LABEL_9:
v9 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v8 + 1336LL))(v8);
v10 = (*(__int64 (__fastcall **)(__int64, char *))(*(_QWORD *)v25 + 1336LL))(v25, "data");
v11 = (unsigned __int8)_JNIEnv::CallStaticBooleanMethod(v25, v26, v27, v9, v10);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v25 + 184LL))(v25, v9);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v25 + 184LL))(v25, v10);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v25 + 184LL))(v25, v26);
if ( v11 )
dword_155FBB0 = 1;
if ( (v28 & 1) != 0 )
operator delete(v30);
return _stack_chk_guard;
}