//
// GJSmartTemplate::dataLoaded from 0x100414d30 to 0x100414ffc (716 bytes)
//
// 1 xrefs:
// > GJSmartTemplate::createWithCoder @ 0x100414d07
//
// 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 12:30:10 +0000
//
__int64 __fastcall GJSmartTemplate::dataLoaded(__int64 a1, _QWORD *a2, double a3)
{
__int64 v3; // r13
__int64 DictForKey; // rax
__int64 v5; // rdi
__int64 v6; // rbx
__int64 v7; // r14
__int64 result; // rax
unsigned int v9; // r15d
__int64 v10; // rax
const char *CString; // rbx
size_t v12; // rax
std::string::size_type v13; // r12
char *data; // r14
size_t v15; // r13
__int64 v16; // rax
unsigned int *v17; // rax
unsigned __int64 v18; // rbx
unsigned __int64 v19; // r14
__int64 v20; // [rsp+0h] [rbp-70h]
__int64 v21; // [rsp+8h] [rbp-68h]
__int128 v22; // [rsp+10h] [rbp-60h] BYREF
void *__p; // [rsp+20h] [rbp-50h]
std::string __dst[2]; // [rsp+30h] [rbp-40h] BYREF
v3 = a1;
*(_DWORD *)(a1 + 192) = DS_Dictionary::getIntegerForKey((__int64)a2, "1");
DS_Dictionary::getStringForKey(__dst, (__int64)a2, "2", a3);
if ( (*(_BYTE *)(a1 + 144) & 1) != 0 )
operator delete(*(void **)(a1 + 160));
*(std::string *)(a1 + 144) = __dst[0];
*(_BYTE *)(a1 + 138) = (unsigned int)DS_Dictionary::getIntegerForKey((__int64)a2, "4") != 0;
*(_BYTE *)(a1 + 136) = (unsigned int)DS_Dictionary::getIntegerForKey((__int64)a2, "5") != 0;
*(_BYTE *)(a1 + 137) = (unsigned int)DS_Dictionary::getIntegerForKey((__int64)a2, "6") != 0;
*(_BYTE *)(a1 + 139) = (unsigned int)DS_Dictionary::getIntegerForKey((__int64)a2, "7") != 0;
DictForKey = DS_Dictionary::getDictForKey(a2, "3", 0);
v5 = *(_QWORD *)(a1 + 56);
if ( v5 == DictForKey )
{
v6 = *(_QWORD *)(v3 + 56);
}
else
{
v6 = DictForKey;
if ( DictForKey )
{
cocos2d::CCObject::retain(DictForKey);
v5 = *(_QWORD *)(v3 + 56);
}
if ( v5 )
cocos2d::CCObject::release(v5);
*(_QWORD *)(v3 + 56) = v6;
}
v7 = cocos2d::CCDictionary::allKeys(v6);
result = sub_1007FEF90(v7);
if ( (_DWORD)result )
{
v9 = 0;
v21 = v3;
v20 = v7;
do
{
v10 = cocos2d::CCArray::stringAtIndex(v7, v9);
CString = (const char *)cocos2d::CCString::getCString(v10);
v12 = strlen(CString);
if ( v12 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v13 = v12;
if ( v12 >= 0x17 )
{
v15 = (v12 | 7) + 1;
if ( (v12 | 7) == 0x17 )
v15 = 26;
data = (char *)operator new(v15);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst[0].__r_.__value_.__r.__words[0] = v15 + 1;
v3 = v21;
__dst[0].__r_.__value_.__l.__size_ = v13;
}
else
{
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v12);
data = __dst[0].__r_.__value_.__s.__data_;
if ( !v12 )
{
__dst[0].__r_.__value_.__s.__data_[0] = 0;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_22;
goto LABEL_17;
}
}
memmove(data, CString, v13);
data[v13] = 0;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
{
LABEL_22:
sub_10001AD30(&v22, __dst[0].__r_.__value_.__l.__data_, __dst[0].__r_.__value_.__l.__size_);
goto LABEL_23;
}
LABEL_17:
__p = __dst[0].__r_.__value_.__l.__data_;
v22 = *(_OWORD *)&__dst[0].__r_.__value_.__l.0;
LABEL_23:
GJSmartTemplate::saveRemap(v3, &v22);
if ( (v22 & 1) != 0 )
operator delete(__p);
v16 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(v3 + 56), (char *)__dst);
if ( v16 )
{
v17 = *(unsigned int **)(v16 + 56);
if ( *v17 )
{
v18 = *((_QWORD *)v17 + 2);
v19 = v18 + 8LL * *v17 - 8;
do
{
if ( !*(_QWORD *)v18 )
break;
std::string::operator=((std::string *)(*(_QWORD *)v18 + 56LL), __dst);
v18 += 8LL;
}
while ( v18 <= v19 );
}
}
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
++v9;
v7 = v20;
result = sub_1007FEF90(v20);
}
while ( v9 < (unsigned int)result );
}
return result;
}