//
// localStorageInit from 0x7b3968 to 0x7b3ba8 (576 bytes)
//
// 0 xrefs:
//
// 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 12:00:09 +0000
//
const char *__fastcall localStorageInit(const char *result)
{
const char *v1; // r4
size_t v2; // r0
int v3; // r7
int v4; // r9
char *v5; // r8
int v6; // r4
char *v7; // r4
int v8; // t1
int v9; // r4
unsigned int v10; // r2
unsigned int v11; // r7
std::logic_error *exception; // r4
char *v13; // r1
bool v14; // zf
int v15; // r3
int v16; // r4
unsigned int v17; // r3
unsigned int v18; // r0
char *v19; // r7
int v20; // r4
char *v21; // r0
int v22; // r2
size_t v23; // r2
int v24; // r0
unsigned int v25; // r1
char *v26; // r2
char *v27; // r1
jstring v28; // r7
int v29; // r8
_JNIEnv *v30[3]; // [sp+8h] [bp-28h] BYREF
int v31; // [sp+14h] [bp-1Ch] BYREF
unsigned int v32; // [sp+18h] [bp-18h]
char *v33; // [sp+1Ch] [bp-14h]
int v34; // [sp+20h] [bp-10h] BYREF
unsigned int v35; // [sp+24h] [bp-Ch]
char *v36; // [sp+28h] [bp-8h]
v1 = result;
if ( !result )
return result;
if ( !*result )
return result;
if ( dword_D2EC38 )
return result;
result = (const char *)cocos2d::JniHelper::getStaticMethodInfo(
v30,
"org/cocos2dx/lib/Cocos2dxLocalStorage",
"init",
"(Ljava/lang/String;Ljava/lang/String;)Z");
if ( !result )
return result;
v31 = 0;
v32 = 0;
v33 = nullptr;
v2 = strlen(v1);
std::string::__init(&v31, v1, v2);
v3 = (unsigned __int8)v31;
v4 = v31 & 1;
if ( v4 )
{
v5 = v33;
v6 = v32;
}
else
{
v6 = (int)(unsigned __int8)v31 >> 1;
v5 = (char *)&v31 + 1;
}
v7 = &v5[v6];
do
{
if ( v7 == v5 )
goto LABEL_42;
v8 = (unsigned __int8)*--v7;
}
while ( !memchr("/\\", v8, 2u) );
v9 = v7 - v5;
if ( v9 != -1 )
{
v10 = v9 + 1;
v34 = 0;
v35 = 0;
v36 = nullptr;
if ( v4 )
{
v11 = v32;
if ( v10 > v32 )
{
LABEL_15:
exception = (std::logic_error *)_cxa_allocate_exception(8u);
std::logic_error::logic_error(exception, "basic_string");
*(_DWORD *)exception = &off_D1548C;
_cxa_throw(
exception,
(struct type_info *)&`typeinfo for'std::out_of_range,
(void (*)(void *))std::length_error::~length_error);
}
v13 = v33;
}
else
{
v11 = v3 >> 1;
if ( v10 > v11 )
goto LABEL_15;
v13 = (char *)&v31 + 1;
}
std::string::__init(&v34, &v13[v10], v11 - v10);
v15 = v31 & 1;
v14 = v15 == 0;
if ( (v31 & 1) != 0 )
{
v15 = 0;
*v33 = 0;
}
else
{
LOBYTE(v31) = v15;
BYTE1(v31) = v15;
}
if ( !v14 )
v32 = v15;
if ( (v31 & 1) != 0 )
{
v16 = v32;
v17 = (v31 & 0xFFFFFFFE) - 1;
if ( v32 <= 0xA )
{
if ( (v31 & 0xFFFFFFFE) != 0xB )
goto LABEL_30;
goto LABEL_41;
}
}
else
{
v16 = (int)(unsigned __int8)v31 >> 1;
if ( v16 <= 10 )
goto LABEL_41;
v17 = 10;
}
v18 = (v16 + 16) & 0xFFFFFFF0;
if ( v18 - 1 != v17 )
{
if ( v18 != 11 )
{
v21 = (char *)operator new(v18);
v20 = v31 & 1;
if ( (v31 & 1) != 0 )
v19 = v33;
else
v19 = (char *)&v31 + 1;
LABEL_34:
if ( (v31 & 1) != 0 )
v22 = v32;
else
v22 = (int)(unsigned __int8)v31 >> 1;
v23 = v22 + 1;
if ( v23 )
memcpy(v21, v19, v23);
if ( v20 )
operator delete(v19);
goto LABEL_41;
}
LABEL_30:
v19 = v33;
v20 = 1;
v21 = (char *)&v31 + 1;
goto LABEL_34;
}
LABEL_41:
v24 = v34;
v25 = v35;
v26 = v36;
v34 = 0;
v35 = 0;
v36 = nullptr;
v31 = v24;
v32 = v25;
v33 = v26;
std::string::~string((int)&v34);
}
LABEL_42:
if ( (v31 & 1) != 0 )
v27 = v33;
else
v27 = (char *)&v31 + 1;
v28 = _JNIEnv::NewStringUTF(v30[0], v27);
_JNIEnv::NewStringUTF(v30[0], "data");
v29 = _JNIEnv::CallStaticBooleanMethod((int)v30[0], (int)v30[1], (int)v30[2], (int)v28);
_JNIEnv::DeleteLocalRef((int)v30[0]);
_JNIEnv::DeleteLocalRef((int)v30[0]);
_JNIEnv::DeleteLocalRef((int)v30[0]);
if ( v29 )
dword_D2EC38 = 1;
return (const char *)std::string::~string((int)&v31);
}