//
// GJSmartTemplate::savePrefab from 0xb10190 to 0xb10354 (452 bytes)
//
// 2 xrefs:
// > EditorUI::addObjectsToSmartTemplate @ 0x7cc5f0
// > ??> @ 0x93f58
//
// 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:01:28 +0000
//
__int64 __fastcall GJSmartTemplate::savePrefab(__int64 *a1, char *a2, __int64 a3)
{
cocos2d::CCObject *v6; // x20
unsigned int i; // w19
__int64 v8; // x0
GJSmartPrefab *v9; // x0
cocos2d::CCObject *v10; // x19
__int64 *v11; // x0
__int64 *v12; // x0
char v13; // w0
__int64 v14; // x0
__int64 v15; // x1
__int64 v17; // [xsp+40h] [xbp+40h] BYREF
__int64 v18; // [xsp+48h] [xbp+48h]
void *v19; // [xsp+50h] [xbp+50h]
std::string::assign(a1 + 21, &byte_11B8890);
v6 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(a1[7], a2);
if ( !v6 )
{
v6 = (cocos2d::CCObject *)cocos2d::CCArray::create(nullptr);
cocos2d::CCDictionary::setObject(a1[7], v6);
}
for ( i = 0; ; ++i )
{
v9 = (GJSmartPrefab *)cocos2d::CCArray::count(v6);
if ( i >= (unsigned int)v9 )
break;
v8 = cocos2d::CCArray::objectAtIndex(v6, i);
if ( sub_B0BDB0(v8 + 80, a3) )
return _stack_chk_guard;
}
v10 = (cocos2d::CCObject *)GJSmartPrefab::create(v9);
v11 = (__int64 *)((char *)v10 + 80);
if ( (cocos2d::CCObject *)a3 != (cocos2d::CCObject *)((char *)v10 + 80) )
{
if ( (*(_BYTE *)a3 & 1) != 0 )
std::string::assign(v11, *(const void **)(a3 + 16), *(_QWORD *)(a3 + 8));
else
std::string::assign(v11, (const void *)(a3 + 1), *(_BYTE *)a3 >> 1);
}
v12 = (__int64 *)((char *)v10 + 56);
if ( a2 != (char *)v10 + 56 )
{
if ( (*a2 & 1) != 0 )
std::string::assign(v12, *((const void **)a2 + 2), *((_QWORD *)a2 + 1));
else
std::string::assign(v12, a2 + 1, (unsigned __int8)*a2 >> 1);
}
cocos2d::CCArray::addObject(v6, v10);
v17 = 0;
v13 = *a2;
v18 = 0;
v19 = nullptr;
if ( (v13 & 1) != 0 )
{
std::string::__init(&v17, *((void **)a2 + 2), *((_QWORD *)a2 + 1));
}
else
{
v14 = *(_QWORD *)a2;
v15 = *((_QWORD *)a2 + 1);
v19 = *((void **)a2 + 2);
v17 = v14;
v18 = v15;
}
GJSmartTemplate::saveRemap(a1, (char *)&v17);
if ( (v17 & 1) != 0 )
operator delete(v19);
return _stack_chk_guard;
}