//
// cocos2d::JniHelper::jstring2string from 0x7edce4 to 0x7ede5a (374 bytes)
//
// 9 xrefs:
// > PlatformToolbox::getClipboardString @ 0x3955a4
// > Java_com_customRobTop_JniToCpp_filesPicked @ 0x395bf0
// > localStorageGetItem @ 0x7b3906
// > Java_org_cocos2dx_lib_Cocos2dxHelper_nativeSetApkPath @ 0x7ed154
// > getPackageNameJNI @ 0x7ed1fc
// > getFileDirectoryJNI @ 0x7ed2b4
// > getCurrentLanguageJNI @ 0x7ed36c
// > getStringForKeyJNI @ 0x7ed440
// > Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInsertText @ 0x7ed610
//
// 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:01:01 +0000
//
int *__fastcall cocos2d::JniHelper::jstring2string(int *a1, int a2)
{
int *v2; // r4
size_t v4; // r2
const void *v5; // r1
size_t v6; // r0
signed int v7; // r5
int v8; // r0
__int16 *v9; // r9
const char *v10; // r0
cocos2d *v11; // r0
__int16 *v12; // r3
char *v13; // r0
__int16 *v14; // r5
__int16 v15; // r1
__int16 v16; // t1
int *v17; // r2
void *v18; // r0
void *v19; // r6
const char *v20; // r8
size_t v21; // r0
int v22; // r1
int v23; // r2
int v25; // [sp+0h] [bp-2Ch] BYREF
_DWORD v26[2]; // [sp+4h] [bp-28h] BYREF
cocos2d *v27; // [sp+Ch] [bp-20h] BYREF
char *v28; // [sp+10h] [bp-1Ch]
unsigned int v29; // [sp+14h] [bp-18h]
int v30; // [sp+18h] [bp-14h] BYREF
int v31; // [sp+1Ch] [bp-10h]
int v32; // [sp+20h] [bp-Ch]
v2 = a1;
if ( !a2 )
{
*a1 = 0;
v4 = 0;
a1[1] = 0;
a1[2] = 0;
v5 = &unk_B6B226;
LABEL_5:
std::string::__init(a1, v5, v4);
return v2;
}
v25 = 0;
if ( !sub_7ED87C((cocos2d::JniHelper *)&v25) )
{
*v2 = 0;
v2[1] = 0;
v2[2] = 0;
v6 = strlen(nullptr);
v5 = nullptr;
v4 = v6;
a1 = v2;
goto LABEL_5;
}
v7 = 2 * (*(int (__fastcall **)(int, int))(*(_DWORD *)v25 + 656))(v25, a2);
v8 = (*(int (__fastcall **)(int, int, _DWORD))(*(_DWORD *)v25 + 660))(v25, a2, 0);
v27 = nullptr;
v28 = nullptr;
v29 = 0;
v9 = (__int16 *)v8;
if ( v7 )
{
if ( (unsigned int)(v7 >> 1) >= 0x80000000 )
{
std::logic_error::logic_error(
(std::logic_error *)v26,
"allocator::allocate(size_t n) 'n' exceeds maximum supported size");
v26[0] = &off_D1546C;
v10 = (const char *)std::logic_error::what((std::logic_error *)v26);
fprintf((FILE *)((char *)&_sF + 168), "%s\n", v10);
abort();
}
v11 = (cocos2d *)operator new(v7);
v12 = v9;
v28 = (char *)v11;
v27 = v11;
v13 = (char *)v11 + v7;
v14 = &v9[v7 / 2u];
v29 = (unsigned int)v13;
while ( v12 != v14 )
{
v16 = *v12++;
v15 = v16;
if ( v28 )
*(_WORD *)v28 = v15;
v28 += 2;
}
}
LOWORD(v26[0]) = 0;
if ( (unsigned int)v28 < v29 )
{
if ( v28 )
*(_WORD *)v28 = 0;
v28 += 2;
}
else
{
std::vector::__push_back_slow_path((int *)&v27, v26);
}
(*(void (__fastcall **)(int, int, __int16 *))(*(_DWORD *)v25 + 664))(v25, a2, v9);
v18 = (void *)cocos2d::cc_utf16_to_utf8(v27, nullptr, v17);
v19 = v18;
if ( v18 )
v20 = (const char *)v18;
else
v20 = (const char *)&unk_B6B226;
v30 = 0;
v31 = 0;
v32 = 0;
v21 = strlen(v20);
std::string::__init(&v30, v20, v21);
if ( v19 )
operator delete[](v19);
v22 = v31;
v23 = v32;
*v2 = v30;
v2[1] = v22;
v2[2] = v23;
if ( v27 )
{
v28 -= 2 * ((unsigned int)(v28 - (char *)v27) >> 1);
operator delete(v27);
}
return v2;
}