//
// LabelGameObject::updatePreviewLabel from 0x77fd5c to 0x78000c (688 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::resetGroupCounters @ 0x865a68
// > GJBaseGameLayer::resetGroupCounters @ 0x865b10
// > SetItemIDLayer::updateEditorLabel @ 0x94c53c
// > ??> @ 0x2e200
//
// 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 LabelGameObject::updatePreviewLabel(LabelGameObject *a1)
{
int m_shownSpecial; // w0
_BOOL4 m_isTimeCounter; // w0
size_t v4; // x24
void *v5; // x0
unsigned int *v6; // x2
int v7; // w1
__int64 v8; // [xsp+50h] [xbp+50h] BYREF
size_t v9; // [xsp+58h] [xbp+58h] BYREF
unsigned __int64 v10; // [xsp+60h] [xbp+60h]
char *v11; // [xsp+68h] [xbp+68h]
_BYTE v12[504]; // [xsp+70h] [xbp+70h] BYREF
m_shownSpecial = a1->m_shownSpecial;
switch ( m_shownSpecial )
{
case -1:
sub_D153B8((int)&v8, "C:GT");
LabelGameObject::updateLabel((__int64)a1, &v8);
break;
case -2:
sub_D153B8((int)&v8, "C:GP");
LabelGameObject::updateLabel((__int64)a1, &v8);
break;
case -3:
sub_D153B8((int)&v8, "C:AT");
LabelGameObject::updateLabel((__int64)a1, &v8);
break;
default:
m_isTimeCounter = a1->m_isTimeCounter;
v9 = 0;
v10 = 500;
v11 = v12;
if ( m_isTimeCounter )
fmt::BasicWriter::operator<<(&v9, "T:", 0);
else
fmt::BasicWriter::operator<<(&v9, "C:", 0);
fmt::BasicWriter::FormatInt,char>>(&v9, a1->m_itemID);
v4 = v9;
if ( v10 < v9 + 1 )
fmt::internal::Array::grow(&v9, v9 + 1);
v11[v4] = 0;
sub_D153B8((int)&v8, v11);
LabelGameObject::updateLabel((__int64)a1, &v8);
v5 = (void *)(v8 - 24);
if ( (__int64 *)(v8 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v6 = (unsigned int *)(v8 - 8);
do
v7 = __ldaxr(v6);
while ( __stlxr(v7 - 1, v6) );
}
else
{
v7 = *(_DWORD *)(v8 - 8);
*(_DWORD *)(v8 - 8) = v7 - 1;
}
if ( v7 <= 0 )
operator delete(v5);
}
if ( v11 != v12 )
{
if ( v11 )
operator delete[](v11);
}
return;
}
if ( (__int64 *)(v8 - 24) != &qword_124B6B0 )
sub_74B3A8((void *)(v8 - 24));
}