//
// GJBaseGameLayer::updatePlatformerTime from 0x87a594 to 0x87a88c (760 bytes)
//
// 3 xrefs:
// > PlayLayer::toggleProgressbar @ 0x5cf350
// > GJBaseGameLayer::updateSpecialLabels @ 0x87a8c8
// > ??> @ 0x70698
//
// 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 GJBaseGameLayer::updatePlatformerTime(GJBaseGameLayer *a1)
{
int PlayTimerMilli; // w24
GJBaseGameLayer *v3; // x0
void (__fastcall *updateTimeLabel)(GJBaseGameLayer *__hidden, int, int, bool); // x4
char **p_m_labelObjects; // x19
unsigned int v6; // w20
unsigned int v7; // w21
cocos2d::CCString *v8; // x0
char *CString; // x0
char *v10; // x0
__int64 *v11; // x19
__int64 *v12; // x22
__int64 v13; // x20
void *v14; // x0
unsigned int *v15; // x1
int v16; // w2
void *v17; // x0
void *v18; // x20
unsigned int *v19; // x19
int v20; // w0
unsigned int *v21; // x1
int v22; // w2
__int64 v23; // [xsp+0h] [xbp+0h] BYREF
__int64 v24; // [xsp+70h] [xbp+70h]
__int64 v25; // [xsp+78h] [xbp+78h] BYREF
__int64 v26; // [xsp+80h] [xbp+80h] BYREF
PlayTimerMilli = GJBaseGameLayer::getPlayTimerMilli(a1);
v3 = a1;
updateTimeLabel = a1->updateTimeLabel;
p_m_labelObjects = (char **)&a1->m_labelObjects;
v6 = (int)(float)((float)PlayTimerMilli / 1000.0);
v7 = (int)(float)((float)(int)(PlayTimerMilli - 1000 * v6) / 10.0);
updateTimeLabel(v3, v6, v7, 1);
if ( sub_856164(p_m_labelObjects, -1) )
{
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i.%02d", (const char *)v6, v7);
CString = (char *)cocos2d::CCString::getCString(v8);
sub_D153B8((unsigned int)&v23 + 112, CString);
GameToolbox::intToString(&v25, (GameToolbox *)v6);
LODWORD(v26) = -1;
v10 = std::__detail::_Map_base>,std::allocator>>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[](
p_m_labelObjects,
(int *)&v26);
v11 = *(__int64 **)v10;
v12 = *((__int64 **)v10 + 1);
if ( *(__int64 **)v10 != v12 )
{
do
{
while ( 1 )
{
v13 = *v11;
if ( *(_BYTE *)(*v11 + 773) )
{
sub_D18D28(&v26);
LabelGameObject::updateLabel(v13, &v26);
v14 = (void *)(v26 - 24);
if ( (__int64 *)(v26 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)(v26 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *(_DWORD *)(v26 - 8);
*(_DWORD *)(v26 - 8) = v16 - 1;
}
if ( v16 <= 0 )
break;
}
}
if ( v12 == ++v11 )
goto LABEL_13;
}
++v11;
operator delete(v14);
}
while ( v12 != v11 );
}
LABEL_13:
v17 = (void *)(v25 - 24);
if ( (__int64 *)(v25 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v21 = (unsigned int *)(v25 - 8);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *(_DWORD *)(v25 - 8);
*(_DWORD *)(v25 - 8) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v17);
}
v18 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(v24 - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *(_DWORD *)(v24 - 8);
*(_DWORD *)(v24 - 8) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v18);
}
}
}