//
// GJChallengeItem::createFromString from 0x1402f9690 to 0x1402f98fe (622 bytes)
//
// 2 xrefs:
// > GameLevelManager::onGetGJChallengesCompleted @ 0x14025f287
// > ??> @ 0x14091e254
//
// This function is hookable on this platform (idp: pc, 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 11:30:05 +0000
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall GJChallengeItem::createFromString(__int64 *a1)
{
cocos2d::CCArray *v2; // rbx
cocos2d::CCString *v4; // rax
int v5; // r12d
cocos2d::CCString *v6; // rax
int v7; // r13d
cocos2d::CCString *v8; // rax
cocos2d::CCString *v9; // rax
cocos2d::CCString *v10; // rax
const char *CString; // rax
size_t v12; // r8
__int64 v13; // rcx
void **v14; // r14
char *v15; // rbp
unsigned __int64 v16; // r15
__int64 v17; // rbx
unsigned __int64 v18; // rsi
__int64 v19; // rbx
char *v20; // rcx
int v21; // [rsp+30h] [rbp-88h]
int v22; // [rsp+34h] [rbp-84h]
__int128 v23; // [rsp+38h] [rbp-80h] BYREF
unsigned __int64 v24; // [rsp+48h] [rbp-70h]
__int64 v25; // [rsp+50h] [rbp-68h]
__int64 *v26; // [rsp+60h] [rbp-58h]
void *Src[2]; // [rsp+68h] [rbp-50h] BYREF
unsigned __int64 v28; // [rsp+78h] [rbp-40h]
unsigned __int64 v29; // [rsp+80h] [rbp-38h]
v26 = a1;
v2 = sub_1400D2840(a1, byte_14070ECF8);
if ( cocos2d::CCArray::count(v2) >= 5 )
{
v4 = cocos2d::CCArray::stringAtIndex(v2, 0);
v5 = cocos2d::CCString::intValue(v4);
v6 = cocos2d::CCArray::stringAtIndex(v2, 1u);
v7 = cocos2d::CCString::intValue(v6);
v8 = cocos2d::CCArray::stringAtIndex(v2, 2u);
v22 = cocos2d::CCString::intValue(v8);
v9 = cocos2d::CCArray::stringAtIndex(v2, 3u);
v21 = cocos2d::CCString::intValue(v9);
v10 = cocos2d::CCArray::stringAtIndex(v2, 4u);
CString = cocos2d::CCString::getCString(v10);
*(_OWORD *)Src = 0;
v28 = 0;
v29 = 0;
v12 = -1;
do
++v12;
while ( CString[v12] );
sub_14003D230(Src, CString, v12);
v23 = 0;
v24 = 0;
v25 = 0;
v14 = Src;
v15 = (char *)Src[0];
v16 = v29;
if ( v29 > 0xF )
v14 = (void **)Src[0];
v17 = 0x7FFFFFFFFFFFFFFFLL;
v18 = v28;
if ( v28 > 0x7FFFFFFFFFFFFFFFLL )
sub_140009D90(v13);
if ( v28 > 0xF )
{
if ( (v28 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
v17 = v28 | 0xF;
if ( (v28 | 0xF) < 0x16 )
v17 = 22;
}
*(_QWORD *)&v23 = sub_14003D460(v17 + 1);
v24 = v18;
v25 = v17;
memcpy((void *)v23, v14, v18 + 1);
}
else
{
v24 = v28;
v25 = 15;
v23 = *(_OWORD *)v14;
}
v19 = GJChallengeItem::create(v7, v22, v21, v5, (__int64)&v23);
if ( v16 > 0xF )
{
v20 = v15;
if ( v16 + 1 >= 0x1000 )
{
v15 = *((char **)v15 - 1);
if ( (unsigned __int64)(v20 - v15 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v15);
}
sub_14003D310((__int64)a1);
return v19;
}
else
{
sub_14003D310((__int64)a1);
return 0;
}
}