//
// PlayerObject::updatePlayerSwingFrame from 0x627f14 to 0x62816c (600 bytes)
//
// 3 xrefs:
// > PlayerObject::toggleSwingMode @ 0x6308cc
// > MenuGameLayer::resetPlayer @ 0x6c9790
// > ??> @ 0xb4678
//
// 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 PlayerObject::updatePlayerSwingFrame(PlayerObject *a1, int a2)
{
unsigned int v3; // w19
GameManager *v4; // x0
cocos2d::CCString *v5; // x0
const char *CString; // x27
cocos2d::CCString *v7; // x0
const char *v8; // x26
cocos2d::CCString *v9; // x0
const char *v10; // x0
cocos2d::CCSprite *m_iconSprite; // x23
const char *v12; // x25
void (__fastcall *setDisplayFrame)(cocos2d::CCSprite *__hidden, cocos2d::CCSpriteFrame *); // x24
cocos2d::CCSpriteFrameCache *v14; // x0
cocos2d::CCSpriteFrame *v15; // x0
cocos2d::CCSprite *m_iconSpriteSecondary; // x23
void (__fastcall *v17)(cocos2d::CCSprite *__hidden, cocos2d::CCSpriteFrame *); // x24
cocos2d::CCSpriteFrameCache *v18; // x0
cocos2d::CCSpriteFrame *v19; // x0
cocos2d::CCSprite *m_iconGlow; // x23
void (__fastcall *v21)(cocos2d::CCSprite *__hidden, cocos2d::CCSpriteFrame *); // x24
cocos2d::CCSpriteFrameCache *v22; // x0
cocos2d::CCSpriteFrame *v23; // x0
const cocos2d::CCSize *v24; // x0
cocos2d::CCSprite *v25; // x23
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
cocos2d::CCString *v27; // x0
char *v28; // x0
void *v29; // x0
unsigned int *v30; // x2
int v31; // w1
cocos2d::CCSize v32; // [xsp+78h] [xbp+78h] BYREF
cocos2d::CCPoint v33; // [xsp+80h] [xbp+80h] BYREF
if ( a2 <= 0 )
{
v3 = 1;
}
else if ( a2 > 43 )
{
v3 = 43;
}
else
{
v3 = a2;
}
v4 = GameManager::sharedState();
GameManager::loadIcon(v4, v3, 7, a1->m_iconRequestID);
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"swing_%02d_001.png",
(const char *)v3);
CString = cocos2d::CCString::getCString(v5);
v7 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"swing_%02d_2_001.png",
(const char *)v3);
v8 = cocos2d::CCString::getCString(v7);
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"swing_%02d_glow_001.png",
(const char *)v3);
v10 = cocos2d::CCString::getCString(v9);
m_iconSprite = a1->m_iconSprite;
v12 = v10;
setDisplayFrame = m_iconSprite->setDisplayFrame;
v14 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v15 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v14, CString);
setDisplayFrame(m_iconSprite, v15);
m_iconSpriteSecondary = a1->m_iconSpriteSecondary;
v17 = m_iconSpriteSecondary->setDisplayFrame;
v18 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v19 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v18, v8);
v17(m_iconSpriteSecondary, v19);
m_iconGlow = a1->m_iconGlow;
v21 = m_iconGlow->setDisplayFrame;
v22 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v23 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v22, v12);
v21(m_iconGlow, v23);
v24 = a1->m_iconSprite->getContentSize(a1->m_iconSprite);
cocos2d::CCSize::CCSize(&v32, v24);
v25 = a1->m_iconSpriteSecondary;
setPosition = v25->setPosition;
cocos2d::CCPoint::CCPoint(&v33, v32.width * 0.5, v32.height * 0.5);
setPosition(v25, &v33);
v27 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"swing_%02d_extra_001.png",
(const char *)v3);
v28 = (char *)cocos2d::CCString::getCString(v27);
sub_D153B8((int)&v33, v28);
PlayerObject::updatePlayerSpriteExtra((__int64)a1, (const char **)&v33);
v29 = (void *)(*(_QWORD *)&v33 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v33 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = (unsigned int *)(*(_QWORD *)&v33 - 8LL);
do
v31 = __ldaxr(v30);
while ( __stlxr(v31 - 1, v30) );
}
else
{
v31 = *(_DWORD *)(*(_QWORD *)&v33 - 8LL);
*(_DWORD *)(*(_QWORD *)&v33 - 8LL) = v31 - 1;
}
if ( v31 <= 0 )
operator delete(v29);
}
}