//
// DailyLevelPage::updateTimers from 0x915a3c to 0x915c8c (592 bytes)
//
// 7 xrefs:
// > DailyLevelPage::dailyStatusFinished @ 0x915cb8
// > DailyLevelPage::dailyStatusFinished @ 0x915cdc
// > ??> @ 0x34698
// > DailyLevelPage::init @ 0x914d00
// > DailyLevelPage::dailyStatusFinished @ 0x915ce0
// > DailyLevelPage::dailyStatusFinished @ 0x915cf0
// > ??> @ 0x1229960
//
// 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 DailyLevelPage::updateTimers(DailyLevelPage *a1, float a2)
{
GameLevelManager *v3; // x0
int DailyTime; // w22
DailyLevelNode *m_dailyNode; // x24
void *v6; // x0
unsigned __int8 *v7; // x0
unsigned int *v8; // x20
int v9; // w1
GJTimedLevelType m_type; // w0
GameLevelManager *v11; // x0
unsigned int *v12; // x1
int v13; // w2
const unsigned __int8 *v14; // [xsp+58h] [xbp+58h] BYREF
__int64 v15; // [xsp+60h] [xbp+60h] BYREF
v3 = GameLevelManager::sharedState();
if ( GameLevelManager::hasDailyStateBeenLoaded(v3, a1->m_type) )
{
DailyTime = DailyLevelPage::getDailyTime(a1);
DailyLevelPage::getDailyTimeString(a1, (GameToolbox *)(unsigned int)DailyTime, (__int64)&v14);
if ( a1->m_type != Event )
{
a1->m_timeLabel->setString(a1->m_timeLabel, v14);
m_dailyNode = a1->m_dailyNode;
if ( m_dailyNode )
{
sub_D18D28(&v15);
DailyLevelNode::updateTimeLabel((__int64)m_dailyNode, &v15);
v6 = (void *)(v15 - 24);
if ( (__int64 *)(v15 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v15 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *(_DWORD *)(v15 - 8);
*(_DWORD *)(v15 - 8) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v6);
}
}
}
if ( DailyTime <= 0 && !*(&a1->m_gettingDailyStatus + 1) )
{
m_type = a1->m_type;
*(&a1->m_gettingDailyStatus + 1) = 1;
if ( m_type != Event )
{
((void (__fastcall *)(LoadingCircle *))a1->m_timeCircle->setVisible)(a1->m_timeCircle);
a1->m_timeLabel->setVisible(a1->m_timeLabel, 0);
}
v11 = GameLevelManager::sharedState();
GameLevelManager::resetDailyLevelState(v11, a1->m_type);
DailyLevelPage::tryGetDailyStatus(a1);
a1->m_gettingDailyStatus = 0;
}
v7 = (unsigned __int8 *)(v14 - 24);
if ( v14 - 24 != (const unsigned __int8 *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v8 = (unsigned int *)(v14 - 8);
do
v9 = __ldaxr(v8);
while ( __stlxr(v9 - 1, v8) );
}
else
{
v9 = *((_DWORD *)v14 - 2);
*((_DWORD *)v14 - 2) = v9 - 1;
}
if ( v9 <= 0 )
operator delete(v7);
}
}
}