//
// RewardsPage::updateTimers from 0x140563090 to 0x140563544 (1204 bytes)
//
// 6 xrefs:
// > RewardsPage::init @ 0x140562b16
// > RewardsPage::rewardsStatusFinished @ 0x140562f05
// > RewardsPage::init @ 0x140562b8c
// > RewardsPage::rewardsStatusFinished @ 0x140562f28
// > RewardsPage::rewardsStatusFinished @ 0x140562f44
// > ??> @ 0x14092c4e0
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:34:15 +0000
//
// Hidden C++ exception states: #wind=9
void __fastcall RewardsPage::updateTimers(__int64 a1)
{
__int64 v2; // rcx
double v3; // xmm6_8
__int64 v4; // rcx
struct cocos2d::CCObject *v5; // rdi
__int64 v6; // rcx
__int64 v7; // rcx
struct cocos2d::CCObject *v8; // rsi
int v9; // r13d
int v10; // r12d
__int64 v11; // rbx
_QWORD *ItemKey; // rax
__int64 v13; // rbx
unsigned __int8 v14; // di
__int64 v15; // rbx
_QWORD *v16; // rax
__int64 v17; // rbx
unsigned __int8 v18; // r15
_QWORD *TimeString; // rax
_QWORD *v20; // rdx
void **v21; // rdx
_QWORD *v22; // rax
_QWORD *v23; // rdx
__int64 *v24; // rsi
cocos2d::CCString *v25; // rax
const char *CString; // rbx
__int64 v27; // rdi
__int64 v28; // rdx
__int64 v29; // rcx
cocos2d::CCSpriteFrameCache *v30; // rax
struct cocos2d::CCSpriteFrame *v31; // rax
__int64 *v32; // rsi
cocos2d::CCString *v33; // rax
const char *v34; // rbx
__int64 v35; // rdi
__int64 v36; // rdx
__int64 v37; // rcx
cocos2d::CCSpriteFrameCache *v38; // rax
struct cocos2d::CCSpriteFrame *v39; // rax
void *v40; // rcx
void *v41; // [rsp+38h] [rbp-49h]
void *v42; // [rsp+38h] [rbp-49h]
void *v43; // [rsp+38h] [rbp-49h]
void *v44; // [rsp+38h] [rbp-49h]
void *v45; // [rsp+38h] [rbp-49h]
void *Block[2]; // [rsp+40h] [rbp-41h] BYREF
__int64 v47; // [rsp+50h] [rbp-31h]
unsigned __int64 v48; // [rsp+58h] [rbp-29h]
_QWORD v49[4]; // [rsp+60h] [rbp-21h] BYREF
struct __timeb64 Time; // [rsp+80h] [rbp-1h] BYREF
v2 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v41 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v41);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v2 = qword_14090BFE0;
}
if ( cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(v2 + 528), 1) )
{
ftime64(&Time);
v3 = (double)Time.millitm / 1000.0 + (double)SLODWORD(Time.time);
v4 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v42 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v42);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v4 = qword_14090BFE0;
}
v5 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(v4 + 528), 1);
v6 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v43 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v43);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v6 = qword_14090BFE0;
}
v8 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(v6 + 528), 2);
v9 = (int)((double)*((int *)v5 + 15) - v3);
v10 = (int)((double)*((int *)v8 + 15) - v3);
if ( v9 <= 0 )
goto LABEL_13;
v11 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v44 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v11 = qword_14090BFE0;
}
ItemKey = GameStatsManager::getItemKey(v7, &Time, 1u, *((_DWORD *)v5 + 14));
v13 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(v11 + 536), ItemKey);
sub_14003D310((__int64)&Time);
if ( v13 )
v14 = 0;
else
LABEL_13:
v14 = 1;
if ( v10 <= 0 )
goto LABEL_19;
v15 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v45 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v15 = qword_14090BFE0;
}
v16 = GameStatsManager::getItemKey(v7, v49, 2u, *((_DWORD *)v8 + 14));
v17 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(v15 + 536), v16);
sub_14003D310((__int64)v49);
if ( v17 )
v18 = 0;
else
LABEL_19:
v18 = 1;
*(_OWORD *)Block = 0;
v47 = 4;
v48 = 15;
strcpy((char *)Block, "Open");
if ( v14 )
{
(**(void (__fastcall ***)(__int64, void **))(*(_QWORD *)(a1 + 680) + 360LL))(*(_QWORD *)(a1 + 680) + 360LL, Block);
}
else
{
TimeString = GameToolbox::getTimeString(v49, v9, 0);
v20 = TimeString;
if ( TimeString[3] > 0xFu )
v20 = (_QWORD *)*TimeString;
(**(void (__fastcall ***)(__int64, _QWORD *))(*(_QWORD *)(a1 + 680) + 360LL))(*(_QWORD *)(a1 + 680) + 360LL, v20);
sub_14003D310((__int64)v49);
}
if ( v18 )
{
v21 = Block;
if ( v48 > 0xF )
v21 = (void **)Block[0];
(**(void (__fastcall ***)(__int64, void **))(*(_QWORD *)(a1 + 688) + 360LL))(*(_QWORD *)(a1 + 688) + 360LL, v21);
}
else
{
v22 = GameToolbox::getTimeString(v49, v10, 0);
v23 = v22;
if ( v22[3] > 0xFu )
v23 = (_QWORD *)*v22;
(**(void (__fastcall ***)(__int64, _QWORD *))(*(_QWORD *)(a1 + 688) + 360LL))(*(_QWORD *)(a1 + 688) + 360LL, v23);
sub_14003D310((__int64)v49);
}
if ( v14 != *(_BYTE *)(a1 + 712) )
{
*(_BYTE *)(a1 + 712) = v14;
v24 = (__int64 *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 696) + 952LL))(*(_QWORD *)(a1 + 696));
v25 = cocos2d::CCString::createWithFormat("chest_%02d_%02d_001.png", 1, (unsigned int)v14 + 1);
CString = cocos2d::CCString::getCString(v25);
v27 = *v24;
v30 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v29, v28);
v31 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v30, CString);
(*(void (__fastcall **)(__int64 *, struct cocos2d::CCSpriteFrame *))(v27 + 1008))(v24, v31);
}
if ( v18 != *(_BYTE *)(a1 + 713) )
{
*(_BYTE *)(a1 + 713) = v18;
v32 = (__int64 *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 704) + 952LL))(*(_QWORD *)(a1 + 704));
v33 = cocos2d::CCString::createWithFormat("chest_%02d_%02d_001.png", 2, (unsigned int)v18 + 1);
v34 = cocos2d::CCString::getCString(v33);
v35 = *v32;
v38 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v37, v36);
v39 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v38, v34);
(*(void (__fastcall **)(__int64 *, struct cocos2d::CCSpriteFrame *))(v35 + 1008))(v32, v39);
}
if ( v48 > 0xF )
{
v40 = Block[0];
if ( v48 + 1 >= 0x1000 )
{
v40 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v40 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v40);
}
}
}