//
// SmartGameObject::updateSmartFrame from 0x7540a8 to 0x75426c (452 bytes)
//
// 7 xrefs:
// > EditorUI::createPrefab @ 0x6c07d8
// > EditorUI::createSmartObjectsFromTemplate @ 0x6c21cc
// > SmartGameObject::customObjectSetup @ 0x7542ac
// > SmartGameObject::customObjectSetup @ 0x7542c4
// > SetupSmartBlockLayer::onClose @ 0x9dbee4
// > SetupSmartBlockLayer::onClose @ 0x9dbf34
// > ??> @ 0x4b0c0
//
// 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 SmartGameObject::updateSmartFrame(SmartGameObject *a1)
{
int m_objectID; // w0
char *v3; // x23
_DWORD *v4; // x24
unsigned __int64 v5; // x25
stl::StringData::Internal *m_data; // x0
unsigned __int64 v7; // x22
size_t v8; // x2
int v9; // w20
__int64 v10; // x22
char *v11; // x0
size_t v12; // x0
void (__fastcall *setDisplayFrame)(cocos2d::CCSprite *__hidden, cocos2d::CCSpriteFrame *); // x20
cocos2d::CCSpriteFrameCache *v14; // x0
cocos2d::CCSpriteFrame *v15; // x0
unsigned int *v16; // x24
int v17; // w1
void *v18; // [xsp+60h] [xbp+60h] BYREF
m_objectID = a1->m_objectID;
switch ( m_objectID )
{
case 2896:
if ( a1->m_referenceOnly )
v3 = "smartBlock02b_001.png";
else
v3 = "smartBlock02_001.png";
break;
case 2897:
if ( a1->m_referenceOnly )
v3 = "smartBlock03b_001.png";
else
v3 = "smartBlock03_001.png";
break;
case 2895:
if ( a1->m_referenceOnly )
v3 = "smartBlock01b_001.png";
else
v3 = "smartBlock01_001.png";
break;
default:
return;
}
sub_D153B8((int)&v18, v3);
v4 = v18;
v5 = *((_QWORD *)v18 - 3);
m_data = a1->m_smartFrame.m_data.m_data;
v7 = *((_QWORD *)m_data - 3);
if ( v5 > v7 )
v8 = *((_QWORD *)m_data - 3);
else
v8 = *((_QWORD *)v18 - 3);
v9 = memcmp(m_data, v18, v8);
if ( !v9 )
{
v9 = 0x7FFFFFFF;
v10 = v7 - v5;
if ( v10 <= 0x7FFFFFFF )
{
if ( v10 >= (__int64)0xFFFFFFFF80000000LL )
v9 = v10;
else
v9 = 0x80000000;
}
}
v11 = (char *)(v4 - 6);
if ( v4 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = v4 - 2;
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(v4 - 2);
*(v4 - 2) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v11);
}
if ( v9 )
{
v12 = strlen(v3);
sub_D1798C(&a1->m_smartFrame, v3, v12);
setDisplayFrame = a1->setDisplayFrame;
v14 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v15 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v14, (const char *)a1->m_smartFrame.m_data.m_data);
setDisplayFrame(a1, v15);
}
}