//
// cocos2d::CCDirector::calculateDeltaTime from 0x100483160 to 0x100483286 (294 bytes)
//
// 0 xrefs:
//
// 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 __fastcall cocos2d::CCDirector::calculateDeltaTime(cocos2d::CCDirector *a1)
{
float v1; // xmm0_4
float m_dAnimationInterval; // xmm1_4
int v3; // eax
int v4; // ecx
int v5; // edx
cocos2d::cc_timeval v6; // [rsp+8h] [rbp-18h] BYREF
if ( cocos2d::CCTime::gettimeofdayCocos2d(&v6, nullptr) )
{
*(_QWORD *)&a1->m_fDeltaTime = 0;
return;
}
if ( a1->m_bNextDeltaTimeZero )
{
a1->m_bNextDeltaTimeZero = 0;
v1 = 0.0;
a1->m_fDeltaTime = 0.0;
a1->m_fActualDeltaTime = 0.0;
if ( !a1->m_bSmoothFix )
goto LABEL_14;
LABEL_7:
if ( a1->m_bSmoothFixCheck )
{
m_dAnimationInterval = a1->m_dAnimationInterval;
v3 = a1->m_nSmoothFixCounter
+ 3 * (fabs(v1 - m_dAnimationInterval) > (float)(0.050000001 * m_dAnimationInterval))
- 2;
v4 = 100;
if ( v3 < 100 )
v4 = v3;
v5 = -100;
if ( v4 >= -99 )
v5 = v4;
a1->m_nSmoothFixCounter = v5;
if ( v3 <= 0 )
a1->m_fDeltaTime = m_dAnimationInterval;
}
goto LABEL_14;
}
v1 = fmaxf(
(float)((float)(v6.tv_usec - a1->m_pLastUpdate->tv_usec) / 1000000.0)
+ (float)(LODWORD(v6.tv_sec) - a1->m_pLastUpdate->tv_sec),
0.0);
a1->m_fDeltaTime = v1;
a1->m_fActualDeltaTime = v1;
if ( a1->m_bSmoothFix )
goto LABEL_7;
LABEL_14:
*a1->m_pLastUpdate = v6;
}