//
// ThreadOptionsPopup::onLeave from 0x1400f5000 to 0x1400f51d4 (468 bytes)
//
// 2 xrefs:
// > ThreadOptionsPopup::init @ 0x1400f4acd
// > ??> @ 0x140915200
//
// 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:26:38 +0000
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall ThreadOptionsPopup::onLeave(__int64 a1)
{
__int64 v2; // rax
int *v3; // r9
int v4; // r10d
int v5; // r8d
const char *v6; // rdx
cocos2d::CCString *v7; // rax
const char *CString; // rax
__int64 v9; // rdi
size_t v10; // r8
__int64 *v11; // rbx
__int64 v12; // rax
__int128 v14; // [rsp+50h] [rbp-48h] BYREF
__int64 v15; // [rsp+60h] [rbp-38h]
__int64 v16; // [rsp+68h] [rbp-30h]
_BYTE v17[40]; // [rsp+70h] [rbp-28h] BYREF
void *v18; // [rsp+B0h] [rbp+18h]
v2 = GJAccountManager::sharedState(a1);
v3 = *(int **)(a1 + 1016);
v4 = v3[60];
v5 = *(_DWORD *)(v2 + 360) - *(_DWORD *)(v2 + 364);
if ( v3[62] == 1 )
{
v6 = "the owner";
if ( v4 == v5 )
v6 = "the new owner";
}
else
{
v6 = "a member";
}
if ( v4 != v5 )
{
v7 = cocos2d::CCString::createWithFormat(
"Leave this group chat?\nYou can only rejoin if %s invites you back.",
v6);
LABEL_11:
CString = cocos2d::CCString::getCString(v7);
goto LABEL_12;
}
if ( v3[50] > 1 )
{
v7 = cocos2d::CCString::createWithFormat(
"Leave this group chat?\n"
"Ownership will pass to the member who\n"
"has been here the longest.\n"
"You can only rejoin if %s invites you back.",
v6);
goto LABEL_11;
}
CString = "Leave this group chat?\nYou are the last member, so the group chat will end.";
LABEL_12:
v9 = a1 + 1008;
v14 = 0;
v15 = 0;
v16 = 0;
v10 = -1;
do
++v10;
while ( CString[v10] );
sub_14003D230(&v14, CString, v10);
v18 = operator new(0x298u);
v11 = (__int64 *)FLAlertLayer::FLAlertLayer((__int64)v18);
if ( v11 )
{
v12 = sub_14003F4F0((__int64)v17, (__int64)&v14);
if ( FLAlertLayer::init(
(cocos2d::CCLayerColor *)v11,
v9,
"Leave Group Chat",
v12,
(__int64)"Back",
(__int64)"Leave",
380.0,
0,
0,
1.0) )
{
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v11);
}
else
{
(*(void (__fastcall **)(__int64 *, __int64))(*v11 + 8))(v11, 1);
v11 = nullptr;
}
}
sub_14003D310((__int64)&v14);
(*(void (__fastcall **)(__int64 *, __int64))(*v11 + 64))(v11, 3);
ButtonSprite::updateBGImage(v11[77], "GJ_button_06.png");
return (*(__int64 (__fastcall **)(__int64 *))(*v11 + 1064))(v11);
}