//
// ChallengesPage::updateTimers from 0x10039db20 to 0x10039dd36 (534 bytes)
//
// 5 xrefs:
// > ChallengesPage::challengeStatusFinished @ 0x10039e04e
// > ChallengesPage::challengeStatusFinished @ 0x10039e1ea
// > ChallengesPage::claimItem @ 0x10039e8b3
// > ChallengesPage::init @ 0x10039d573
// > ChallengesPage::challengeStatusFinished @ 0x10039e1ef
//
// 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 ChallengesPage::updateTimers(ChallengesPage *a1, float a2)
{
GameStatsManager *v2; // rax
double v3; // xmm0_8
int v4; // r15d
__int64 v5; // rsi
cocos2d::CCLabelBMFont *m_countdownLabel; // r14
cocos2d::CCString *v7; // rax
const char *CString; // rax
cocos2d::CCDictionary *m_challengeNodes; // rax
cocos2d::CCDictElement *m_pElements; // r12
cocos2d::CCObject *m_pObject; // rbx
__int64 v12; // rdi
char *v13; // rsi
double v14; // rbx
GameStatsManager *v15; // rax
__int64 v16; // rdi
GameLevelManager *v17; // rax
timeb v18; // [rsp+0h] [rbp-60h] BYREF
void *__p; // [rsp+10h] [rbp-50h]
double v20; // [rsp+18h] [rbp-48h]
timeb v21; // [rsp+20h] [rbp-40h] BYREF
void *v22; // [rsp+30h] [rbp-30h]
v2 = GameStatsManager::sharedState();
if ( GameStatsManager::areChallengesLoaded(v2) )
{
ftime(&v21);
v20 = (double)(v21.millitm + 1000 * (v21.time & 0xFFFFF)) / -1000.0;
v3 = v20 + GameStatsManager::sharedState()->m_challengeTime;
v4 = (int)v3;
v5 = 0;
if ( (int)v3 > 0 )
v5 = (unsigned int)v4;
GameToolbox::getTimeString(&v21, v5, 0);
m_countdownLabel = a1->m_countdownLabel;
v7 = (cocos2d::CCString *)sub_1007AB580("New quests in: %s", v18.time);
CString = cocos2d::CCString::getCString(v7);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))m_countdownLabel->setString)(
m_countdownLabel,
CString);
v20 = *(double *)&a1;
m_challengeNodes = a1->m_challengeNodes;
if ( m_challengeNodes )
{
m_pElements = m_challengeNodes->m_pElements;
while ( m_pElements )
{
m_pObject = m_pElements->m_pObject;
m_pElements = (cocos2d::CCDictElement *)m_pElements->hh.next;
if ( (v21.time & 1) != 0 )
{
sub_100006B70(&v18, v22, *(unsigned __int64 *)&v21.millitm, v3);
}
else
{
__p = v22;
v3 = *(double *)&v21.time;
v18 = v21;
}
v12 = *(_QWORD *)&m_pObject[6].m_uID;
if ( v12 )
{
v13 = (char *)&v18.time + 1;
if ( (v18.time & 1) != 0 )
v13 = (char *)__p;
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)v12 + 912LL))(v12, v13);
}
if ( (v18.time & 1) != 0 )
operator delete(__p);
}
}
v14 = v20;
if ( v4 <= 0 && !*(_BYTE *)(*(_QWORD *)&v20 + 681LL) )
{
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(*(_QWORD *)&v20 + 672LL) + 328LL))(
*(_QWORD *)(*(_QWORD *)&v20 + 672LL),
1);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(*(_QWORD *)&v14 + 664LL) + 328LL))(
*(_QWORD *)(*(_QWORD *)&v14 + 664LL),
0);
*(_WORD *)(*(_QWORD *)&v14 + 680LL) = 256;
v15 = GameStatsManager::sharedState();
GameStatsManager::resetChallengeTimer(v15);
if ( *(_BYTE *)(*(_QWORD *)&v14 + 680LL) == 1 )
{
v16 = *(_QWORD *)(*(_QWORD *)&v14 + 672LL);
if ( v16 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v16 + 328LL))(v16, 0);
}
else
{
*(_BYTE *)(*(_QWORD *)&v14 + 680LL) = 1;
v17 = GameLevelManager::sharedState();
GameLevelManager::getGJChallenges(v17);
}
}
if ( (v21.time & 1) != 0 )
operator delete(v22);
}
}