//
// GJSmartTemplate::getTemplateState from 0x53ca04 to 0x53cbbe (442 bytes)
//
// 1 xrefs:
// > BrowseSmartTemplateLayer::init @ 0x53ffba
//
// 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
//
void GJSmartTemplate::getTemplateState(GJSmartTemplate *a1, std::vector *a2)
{
unsigned int v3; // r11
cocos2d::CCDictionary *v4; // r5
cocos2d::CCNode *v5; // r0
cocos2d::CCString *v6; // r0
char *CString; // r0
cocos2d::CCArray *v8; // r5
int v9; // r0
SmartPrefabResult *m_finish; // r0
cocos2d::CCArray *v12; // [sp+10h] [bp-84h]
_BYTE v13[4]; // [sp+20h] [bp-74h] BYREF
std::string v14; // [sp+24h] [bp-70h] BYREF
_BYTE v15[4]; // [sp+28h] [bp-6Ch] BYREF
_BYTE v16[4]; // [sp+2Ch] [bp-68h] BYREF
_BYTE v17[4]; // [sp+30h] [bp-64h] BYREF
SmartPrefabResult v18; // [sp+34h] [bp-60h] BYREF
SmartPrefabResult v19; // [sp+50h] [bp-44h] BYREF
int v20[8]; // [sp+6Ch] [bp-28h] BYREF
v3 = 0;
v4 = cocos2d::CCDictionary::create();
v5 = cocos2d::CCNode::create();
generateAllBinaryStrings(8, v20, 0, v4, v5);
v12 = cocos2d::CCDictionary::allKeys(v4);
while ( v3 < cocos2d::CCArray::count(v12) )
{
v6 = cocos2d::CCArray::stringAtIndex(v12, v3);
CString = (char *)cocos2d::CCString::getCString(v6);
sub_776584((int)v13, CString);
sub_775C20(v15);
prefabKeyFromBinary((int)&v14, (int)v15);
sub_774008(v15);
v8 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(a1->m_prefabArrays, &v14);
SmartPrefabResult::SmartPrefabResult(&v18);
sub_775D40(&v18.m_binaryKey, &v14);
sub_775D40(&v18.m_prefabKey, &v14);
v9 = (int)v8;
if ( v8 )
v9 = cocos2d::CCArray::count(v8);
v18.m_prefabCount = v9;
sub_775C20(v16);
v18.m_unrequired = GJSmartTemplate::isUnrequired((int)a1, (int)v16);
sub_774008(v16);
if ( v18.m_prefabCount <= 0 && !v18.m_unrequired )
{
sub_775C20(v17);
GJSmartTemplate::scanForPrefab(&v19, (int)a1, (int)v17);
v18.m_smartPrefab = v19.m_smartPrefab;
sub_774794(&v18.m_binaryKey, &v19.m_binaryKey);
sub_774794(&v18.m_prefabKey, &v19.m_prefabKey);
v18.m_prefabCount = v19.m_prefabCount;
v18.m_unrequired = v19.m_unrequired;
v18.m_rotation = v19.m_rotation;
v18.m_flipX = v19.m_flipX;
v18.m_flipY = v19.m_flipY;
v18.m_ignoreCorners = v19.m_ignoreCorners;
SmartPrefabResult::~SmartPrefabResult(&v19);
sub_774008(v17);
}
m_finish = a2->m_finish;
if ( m_finish == a2->m_reserveEnd )
{
std::vector::_M_emplace_back_aux((int)a2, &v18);
}
else
{
if ( m_finish )
SmartPrefabResult::SmartPrefabResult(m_finish, &v18);
++a2->m_finish;
}
++v3;
SmartPrefabResult::~SmartPrefabResult(&v18);
sub_774008(&v14);
sub_774008(v13);
}
}