//
// GJChallengeItem::createFromString from 0x10008f450 to 0x10008f60d (445 bytes)
//
// 3 xrefs:
// > GameLevelManager::onGetGJChallengesCompleted @ 0x100527f55
// > GameLevelManager::onGetGJChallengesCompleted @ 0x100528085
// > GameLevelManager::onGetGJChallengesCompleted @ 0x1005281b5
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall GJChallengeItem::createFromString(unsigned __int8 *a1, double a2)
{
cocos2d::CCArray *v2; // r13
__int64 result; // rax
cocos2d::CCString *v4; // rax
int v5; // r12d
cocos2d::CCString *v6; // rax
int v7; // r14d
cocos2d::CCString *v8; // rax
int v9; // r15d
cocos2d::CCString *v10; // rax
cocos2d::CCString *v11; // rax
const char *CString; // rbx
size_t v13; // rax
size_t v14; // r13
unsigned int v15; // r12d
char *v16; // r14
char v17; // r15
size_t v18; // r15
__int64 v19; // rbx
__int64 v20; // rbx
__int128 v21; // [rsp+0h] [rbp-70h] BYREF
void *__p; // [rsp+10h] [rbp-60h]
unsigned int v23; // [rsp+24h] [rbp-4Ch]
unsigned int v24; // [rsp+28h] [rbp-48h]
unsigned int v25; // [rsp+2Ch] [rbp-44h]
__int128 __dst; // [rsp+30h] [rbp-40h] BYREF
void *v27; // [rsp+40h] [rbp-30h]
v2 = (cocos2d::CCArray *)sub_10006EE30(a1, ",", a2);
if ( (unsigned int)sub_100720070(v2) < 5 )
return 0;
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);
v9 = cocos2d::CCString::intValue(v8);
v10 = cocos2d::CCArray::stringAtIndex(v2, 3u);
v23 = cocos2d::CCString::intValue(v10);
v11 = cocos2d::CCArray::stringAtIndex(v2, 4u);
CString = cocos2d::CCString::getCString(v11);
v13 = strlen(CString);
if ( v13 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a2);
v14 = v13;
v24 = v7;
v25 = v5;
v15 = v9;
if ( v13 >= 0x17 )
{
v18 = 26;
if ( (v13 | 7) != 0x17 )
v18 = (v13 | 7) + 1;
v16 = (char *)operator new(v18);
v27 = v16;
*(_QWORD *)&__dst = v18 + 1;
*((_QWORD *)&__dst + 1) = v14;
LABEL_11:
memmove(v16, CString, v14);
v16[v14] = 0;
v17 = __dst;
if ( (__dst & 1) == 0 )
goto LABEL_7;
LABEL_12:
sub_100006B70(&v21, v27, *((unsigned __int64 *)&__dst + 1), a2);
goto LABEL_13;
}
LOBYTE(__dst) = 2 * v13;
v16 = (char *)&__dst + 1;
if ( v13 )
goto LABEL_11;
BYTE1(__dst) = 0;
v17 = __dst;
if ( (__dst & 1) != 0 )
goto LABEL_12;
LABEL_7:
__p = v27;
v21 = __dst;
LABEL_13:
result = GJChallengeItem::create(v24, v15, v23, v25, &v21);
if ( (v21 & 1) != 0 )
{
v19 = result;
operator delete(__p);
result = v19;
}
if ( (v17 & 1) != 0 )
{
v20 = result;
operator delete(v27);
return v20;
}
return result;
}