//
// sub_1004FF270 from 0x1004ff270 to 0x1004ffa0c (1948 bytes)
//
// 1 xrefs:
// > sub_1004FB470 @ 0x1004fb4b4
//
// This function is hookable on this platform (idp: arm, 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:06:53 +0000
//
void __fastcall sub_1004FF270(__int64 a1)
{
int v1; // w20
float v3; // s8
std::string::size_type v4; // x28
unsigned int v5; // w21
int v6; // w22
__int64 v7; // x0
__int64 v8; // x27
char *v9; // x1
_QWORD *v10; // x24
__int64 v11; // x0
const char *CString; // x25
const char *v13; // x23
__int64 v14; // x0
__int64 v15; // x0
int v16; // w0
const char *v17; // x1
const char *v18; // x8
void *v19; // x0
const std::string::value_type *v20; // x0
void *v21; // x0
const char *v22; // x0
__int64 v23; // x0
int v24; // w0
void *v25; // x0
const std::string::value_type *v26; // x0
void *v27; // x0
__int64 v28; // x0
const std::string::value_type *v29; // x0
const std::string::value_type *v30; // x0
void *v31; // x0
const std::string::value_type *v32; // x0
__int64 v33; // x8
__int64 v34; // x8
__int64 v35; // x8
tm *v36; // x0
int tm_year; // w24
int tm_yday; // w23
tm *v39; // x0
unsigned int v40; // w8
float v41; // s13
tm *v42; // x3
int v43; // w8
_BOOL4 v44; // w23
float *v45; // x0
int v46; // w8
int v47; // w9
float v48; // s13
float v49; // s0
float v50; // s13
int v51; // [xsp+10h] [xbp-130h]
int v52; // [xsp+14h] [xbp-12Ch]
std::string v53; // [xsp+18h] [xbp-128h] BYREF
std::string __str; // [xsp+30h] [xbp-110h] BYREF
std::string v55; // [xsp+50h] [xbp-F0h] BYREF
std::string __p; // [xsp+68h] [xbp-D8h] BYREF
__int16 v57; // [xsp+80h] [xbp-C0h]
char v58; // [xsp+82h] [xbp-BEh]
time_t v59; // [xsp+88h] [xbp-B8h] BYREF
_BYTE v60[32]; // [xsp+90h] [xbp-B0h] BYREF
sub_1004FFAA8(a1 + 696);
*(_DWORD *)(a1 + 744) = 0;
v51 = sub_1002E757C(*(_QWORD *)(a1 + 760));
if ( v51 )
{
v3 = -6.0;
if ( *(_BYTE *)(a1 + 788) == 1 )
{
memset(&__p, 0, sizeof(__p));
v55.__r_.__value_.__r.__words[0] = 0xFFFFFFFF00000000LL;
v55.__r_.__value_.__l.__size_ = 0x41D00000C0C00000LL;
LOWORD(v55.__r_.__value_.__r.__words[2]) = 0;
v57 = -1;
v58 = -1;
sub_1004FFAF4(a1 + 696, &v55);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
v3 = -32.0;
}
if ( v51 >= 1 )
{
v4 = 0;
v5 = 0;
v52 = 0;
v6 = 0;
do
{
v7 = sub_1002E75A0(*(_QWORD *)(a1 + 760), v5);
v8 = v7;
memset(&__str, 0, sizeof(__str));
if ( *(_DWORD *)(v7 + 64) )
{
LABEL_50:
if ( (*(_BYTE *)(a1 + 1104) & 1) == 0 )
{
v34 = *(_QWORD *)(a1 + 960);
if ( v34 >= 1 && *(_QWORD *)(v8 + 56) == v34 )
{
memset(&__p, 0, sizeof(__p));
LODWORD(v55.__r_.__value_.__l.__data_) = 2;
*(std::string::size_type *)((char *)v55.__r_.__value_.__r.__words + 4) = __PAIR64__(LODWORD(v3), v5);
HIDWORD(v55.__r_.__value_.__r.__words[1]) = 1090519040;
LOWORD(v55.__r_.__value_.__r.__words[2]) = 0;
v57 = -1;
v58 = -1;
sub_1004FFAF4(a1 + 696, &v55);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
v6 = 0;
v3 = v3 + -8.0;
}
}
if ( !v5
|| (v35 = *(_QWORD *)(v8 + 96),
v55.__r_.__value_.__r.__words[0] = v4,
*(_QWORD *)v60 = v35,
v36 = localtime((const time_t *)&v55),
tm_year = v36->tm_year,
tm_yday = v36->tm_yday,
v39 = localtime((const time_t *)v60),
tm_year != v39->tm_year)
|| tm_yday != v39->tm_yday )
{
if ( *(_DWORD *)(v8 + 64) )
v40 = 7;
else
v40 = 15;
v41 = (float)v40;
memset(&__p, 0, sizeof(__p));
LODWORD(v55.__r_.__value_.__l.__data_) = 1;
*(std::string::size_type *)((char *)v55.__r_.__value_.__r.__words + 4) = __PAIR64__(LODWORD(v3), v5);
*((float *)&v55.__r_.__value_.__r.__words[1] + 1) = (float)v40;
LOWORD(v55.__r_.__value_.__r.__words[2]) = 0;
v57 = -1;
v58 = -1;
v59 = *(_QWORD *)(v8 + 96);
v42 = localtime(&v59);
memset(v60, 0, sizeof(v60));
if ( v42 )
strftime(v60, 0x20u, "%b %d, %Y", v42);
sub_100009900(&v53, v60);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
__p = v53;
sub_1004FFAF4(a1 + 696, &v55);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
v6 = 0;
v3 = v3 - v41;
}
v43 = *(_DWORD *)(v8 + 64);
if ( v43 )
{
v44 = 1;
if ( (*(_BYTE *)(a1 + 1104) & 1) == 0 && v43 == v6 )
v44 = (__int64)(*(_QWORD *)(v8 + 96) - v4) > 600;
memset(&__p, 0, sizeof(__p));
LODWORD(v55.__r_.__value_.__l.__data_) = 4;
*(std::string::size_type *)((char *)v55.__r_.__value_.__r.__words + 4) = __PAIR64__(LODWORD(v3), v5);
v55.__r_.__value_.__s.__data_[16] = v44;
v55.__r_.__value_.__s.__data_[17] = v44 & (v52 ^ 1);
v57 = -1;
v58 = -1;
v45 = (float *)sub_1004FEA64(a1, v8);
if ( (v44 & (v52 ^ 1)) != 0 )
v46 = 8;
else
v46 = 0;
if ( v44 )
v47 = 16;
else
v47 = 0;
*((float *)&v55.__r_.__value_.__r.__words[1] + 1) = (float)(v45[7] + (float)(v46 | (unsigned int)v47)) + 4.0;
sub_1004FFAF4(a1 + 696, &v55);
v48 = *((float *)&v55.__r_.__value_.__r.__words[1] + 1);
v4 = *(_QWORD *)(v8 + 96);
v6 = *(_DWORD *)(v8 + 64);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
v52 = 0;
v3 = v3 - v48;
}
else
{
memset(&__p, 0, sizeof(__p));
LODWORD(v55.__r_.__value_.__l.__data_) = 3;
*(std::string::size_type *)((char *)v55.__r_.__value_.__r.__words + 4) = __PAIR64__(LODWORD(v3), v5);
if ( std::string::find(&__str, 10, 0) == -1 )
v49 = 16.0;
else
v49 = 28.0;
*((float *)&v55.__r_.__value_.__r.__words[1] + 1) = v49;
LOWORD(v55.__r_.__value_.__r.__words[2]) = 0;
v58 = BYTE2(v1);
v57 = v1;
std::string::operator=(&__p, &__str);
sub_1004FFAF4(a1 + 696, &v55);
v50 = *((float *)&v55.__r_.__value_.__r.__words[1] + 1);
v4 = *(_QWORD *)(v8 + 96);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
v6 = 0;
v3 = v3 - v50;
v52 = 1;
}
goto LABEL_89;
}
memset(v60, 0, 24);
v9 = (char *)(v7 + 72);
if ( *(char *)(v7 + 95) < 0 )
v9 = *(char **)v9;
sub_100009900(&v55, v9);
v10 = sub_1004FE5C8(&v55, ",");
if ( SHIBYTE(v55.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v55.__r_.__value_.__l.__data_);
v1 = 11842740;
if ( (unsigned int)sub_1002E757C((__int64)v10) >= 3 )
{
v11 = cocos2d::CCArray::stringAtIndex((__int64)v10, 2u);
CString = (const char *)cocos2d::CCString::getCString(v11);
v13 = "";
if ( (unsigned int)sub_1002E757C((__int64)v10) >= 5 )
{
v14 = cocos2d::CCArray::stringAtIndex((__int64)v10, 4u);
v13 = (const char *)cocos2d::CCString::getCString(v14);
}
v15 = cocos2d::CCArray::stringAtIndex((__int64)v10, 0);
v16 = cocos2d::CCString::intValue(v15);
if ( v16 > 6 )
{
if ( v16 <= 8 )
{
if ( v16 == 7 )
v22 = "%s updated the description";
else
v22 = "%s renamed the group chat";
v21 = sub_1003065B0(v22, CString);
goto LABEL_40;
}
if ( (unsigned int)(v16 - 9) >= 2 )
{
if ( v16 != 11 )
goto LABEL_45;
v23 = cocos2d::CCArray::stringAtIndex((__int64)v10, 1u);
v24 = cocos2d::CCString::intValue(v23);
v17 = "%s closed this conversation";
if ( v24 >= 1 )
{
LABEL_34:
v25 = sub_1003065B0(v17, CString);
v26 = (const std::string::value_type *)cocos2d::CCString::getCString((__int64)v25);
std::string::assign((std::string *)v60, v26);
goto LABEL_45;
}
std::string::assign((std::string *)v60, "This conversation was closed");
}
else
{
v18 = "an Advisor";
if ( v16 == 10 )
v18 = "a Moderator";
v19 = sub_1003065B0("%s started this conversation as %s", CString, v18);
v20 = (const std::string::value_type *)cocos2d::CCString::getCString((__int64)v19);
std::string::assign((std::string *)v60, v20);
v1 = 16763000;
}
}
else if ( v16 > 3 )
{
if ( v16 != 4 )
{
if ( v16 == 5 )
{
v28 = cocos2d::CCArray::stringAtIndex((__int64)v10, 1u);
if ( (int)cocos2d::CCString::intValue(v28) <= 0 )
v21 = sub_1003065B0("%s is now the owner");
else
v21 = sub_1003065B0("%s made %s the owner");
}
else
{
v21 = sub_1003065B0("%s invited %s");
}
LABEL_40:
v29 = (const std::string::value_type *)cocos2d::CCString::getCString((__int64)v21);
std::string::assign((std::string *)v60, v29);
v1 = 5294335;
goto LABEL_45;
}
v31 = sub_1003065B0("%s kicked %s", CString, v13);
v32 = (const std::string::value_type *)cocos2d::CCString::getCString((__int64)v31);
std::string::assign((std::string *)v60, v32);
v1 = 7895295;
}
else
{
if ( v16 == 1 )
{
v27 = sub_1003065B0("%s added %s", CString, v13);
goto LABEL_42;
}
if ( v16 == 2 )
{
v27 = sub_1003065B0("%s joined", v13);
LABEL_42:
v30 = (const std::string::value_type *)cocos2d::CCString::getCString((__int64)v27);
std::string::assign((std::string *)v60, v30);
v1 = 7929720;
goto LABEL_45;
}
v17 = "%s left the group chat";
if ( v16 == 3 )
goto LABEL_34;
}
}
LABEL_45:
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
__str = *(std::string *)v60;
v33 = v60[23];
if ( v60[23] < 0 )
v33 = *(_QWORD *)&v60[8];
if ( v33 )
goto LABEL_50;
v6 = 0;
LABEL_89:
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
++v5;
}
while ( v51 != v5 );
}
if ( (*(_BYTE *)(a1 + 1168) & 1) != 0 && (*(_BYTE *)(a1 + 1104) & 1) == 0 )
{
memset(&__p, 0, sizeof(__p));
v55.__r_.__value_.__r.__words[0] = -4294967291LL;
v55.__r_.__value_.__l.__size_ = LODWORD(v3) | 0x41D0000000000000LL;
LOWORD(v55.__r_.__value_.__r.__words[2]) = 0;
v57 = -1;
v58 = -1;
sub_1004FFAF4(a1 + 696, &v55);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
v3 = v3 + -26.0;
}
*(float *)(a1 + 744) = 6.0 - v3;
}
}