//
// GJDifficultySprite::updateDifficultyFrame from 0x8d9f70 to 0x8da124 (436 bytes)
//
// 6 xrefs:
// > LevelInfoLayer::updateLabelValues @ 0x6d9c04
// > GJRateLevelLayer::selectRating @ 0x8203d0
// > GJRateLevelLayer::selectRating @ 0x8203f0
// > RateStarsLayer::selectRating @ 0x8244dc
// > RateStarsLayer::selectRating @ 0x8244fc
// > ??> @ 0xab840
//
// 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 GJDifficultySprite::updateDifficultyFrame(GJDifficultySprite *a1, int a2, GJDifficultyName a3)
{
void (__fastcall *setDisplayFrame)(cocos2d::CCSprite *__hidden, cocos2d::CCSpriteFrame *); // x19
cocos2d::CCSpriteFrameCache *v5; // x23
cocos2d::CCSpriteFrame *v6; // x0
char *v7; // x0
unsigned int v8; // w19
const cocos2d::CCSize *v9; // x0
unsigned int v10; // w1
__int64 v11; // x0
unsigned int *v12; // x2
int v13; // w1
float v16; // [xsp+50h] [xbp+50h]
char *v17; // [xsp+70h] [xbp+70h] BYREF
setDisplayFrame = a1->setDisplayFrame;
v5 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
GJDifficultySprite::getDifficultyFrame(a2, a3, (__int64)&v17);
v6 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v5, v17);
setDisplayFrame(a1, v6);
v7 = v17 - 24;
if ( v17 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v17 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *((_DWORD *)v17 - 2);
*((_DWORD *)v17 - 2) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v7);
}
if ( a1->m_pChildren )
{
v8 = 0;
v16 = a1->getContentSize(a1)->width * 0.5;
v9 = a1->getContentSize(a1);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v17, v16, v9->height * 0.5);
while ( v8 < (unsigned int)cocos2d::CCArray::count(a1->m_pChildren) )
{
v10 = v8++;
v11 = cocos2d::CCArray::objectAtIndex(a1->m_pChildren, v10);
(*(void (__fastcall **)(__int64, char **))(*(_QWORD *)v11 + 184LL))(v11, &v17);
}
}
}