//
// cocos2d::JniHelper::jstring2string from 0xd81350 to 0xd8160c (700 bytes)
//
// 10 xrefs:
// > PlatformToolbox::getClipboardString @ 0x642064
// > Java_com_customRobTop_JniToCpp_filesPicked @ 0x642aac
// > localStorageGetItem @ 0xd20ad8
// > Java_org_cocos2dx_lib_Cocos2dxHelper_nativeSetApkPath @ 0xd7ffe8
// > getPackageNameJNI @ 0xd80108
// > getFileDirectoryJNI @ 0xd8021c
// > getCurrentLanguageJNI @ 0xd80330
// > getStringForKeyJNI @ 0xd80464
// > Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInsertText @ 0xd80748
// > ??> @ 0xdff78
//
// 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:08:10 +0000
//
__int64 *__usercall cocos2d::JniHelper::jstring2string@(__int64 a1@, __int64 *a2@)
{
signed __int64 v4; // x22
__int64 v5; // x0
_WORD *v6; // x21
cocos2d *v7; // x0
cocos2d *v8; // x22
_WORD *v9; // x1
int *v10; // x2
const char *v11; // x0
char *v12; // x21
size_t v13; // x0
__int64 v14; // x2
__int64 v15; // x3
cocos2d *v16; // x0
size_t v18; // x0
const char *v19; // x0
_WORD *v20; // [xsp+48h] [xbp+48h]
__int64 v21; // [xsp+50h] [xbp+50h] BYREF
_QWORD v22[2]; // [xsp+58h] [xbp+58h] BYREF
cocos2d *v23; // [xsp+68h] [xbp+68h] BYREF
cocos2d *v24; // [xsp+70h] [xbp+70h]
unsigned __int64 v25; // [xsp+78h] [xbp+78h]
__int64 v26; // [xsp+80h] [xbp+80h] BYREF
__int64 v27; // [xsp+88h] [xbp+88h]
__int64 v28; // [xsp+90h] [xbp+90h]
if ( !a1 )
{
*a2 = 0;
a2[1] = 0;
a2[2] = 0;
std::string::__init(a2, &byte_11B8890, 0);
return a2;
}
v21 = 0;
if ( !(unsigned __int8)sub_D80B8C((cocos2d::JniHelper *)&v21) )
{
*a2 = 0;
a2[1] = 0;
a2[2] = 0;
v18 = strlen(nullptr);
std::string::__init(a2, nullptr, v18);
return a2;
}
v4 = 2LL * (*(int (__fastcall **)(__int64, __int64))(*(_QWORD *)v21 + 1312LL))(v21, a1);
v5 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD))(*(_QWORD *)v21 + 1320LL))(v21, a1, 0);
v23 = nullptr;
v24 = nullptr;
v25 = 0;
if ( v4 >> 1 )
{
if ( v4 >> 1 < 0 )
{
std::logic_error::logic_error(
(std::logic_error *)v22,
"allocator::allocate(size_t n) 'n' exceeds maximum supported size");
v22[0] = off_1536D28;
v19 = (const char *)std::logic_error::what((std::logic_error *)v22);
fprintf((FILE *)((char *)&_sF + 304), "%s\n", v19);
abort();
}
v6 = (_WORD *)(v5 + v4);
v20 = (_WORD *)v5;
v7 = (cocos2d *)operator new(v4);
v8 = (cocos2d *)((char *)v7 + v4);
v24 = v7;
v23 = v7;
v25 = (unsigned __int64)v8;
if ( v20 == v6 )
{
LOWORD(v22[0]) = 0;
if ( v7 < v8 )
goto LABEL_12;
}
else
{
v9 = v20;
do
{
if ( v7 )
{
*(_WORD *)v7 = *v9;
v7 = v24;
}
++v9;
v7 = (cocos2d *)((char *)v7 + 2);
v24 = v7;
}
while ( v6 != v9 );
LOWORD(v22[0]) = 0;
if ( (unsigned __int64)v7 < v25 )
{
if ( !v7 )
{
LABEL_13:
v24 = (cocos2d *)((char *)v7 + 2);
goto LABEL_14;
}
LABEL_12:
*(_WORD *)v7 = 0;
v7 = v24;
goto LABEL_13;
}
}
}
else
{
LOWORD(v22[0]) = 0;
}
std::vector::__push_back_slow_path((void **)&v23, v22);
LABEL_14:
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v21 + 1328LL))(v21, a1);
v11 = (const char *)cocos2d::cc_utf16_to_utf8(v23, nullptr, v10);
v12 = (char *)v11;
v26 = 0;
v27 = 0;
v28 = 0;
if ( v11 )
{
v13 = strlen(v11);
std::string::__init(&v26, v12, v13);
operator delete[](v12);
}
else
{
std::string::__init(&v26, &byte_11B8890, 0);
}
v14 = v26;
v15 = v27;
v16 = v23;
a2[2] = v28;
*a2 = v14;
a2[1] = v15;
if ( v16 )
{
if ( v16 != v24 )
v24 = (cocos2d *)((char *)v24 + 2 * ~((unsigned __int64)((cocos2d *)((char *)v24 - 2) - v16) >> 1));
operator delete(v16);
}
return a2;
}