//
// ProfilePage::onFriend from 0x10022da38 to 0x10022dcb4 (636 bytes)
//
// 1 xrefs:
// > ProfilePage::setupAccountButtons @ 0x10022d670
//
// 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:01:15 +0000
//
__int64 __fastcall ProfilePage::onFriend(__int64 a1)
{
__int64 v2; // x0
__int64 result; // x0
__int64 v4; // x8
int v5; // w9
__int64 v6; // x0
__int64 v7; // x0
__int64 v8; // x0
__int64 v9; // x1
__int64 v10; // x20
__int64 v11; // x20
__int64 v12; // x0
__int64 v13; // x0
__int64 *v14; // x19
void *v15[2]; // [xsp+0h] [xbp-90h] BYREF
__int64 v16; // [xsp+10h] [xbp-80h]
void *v17[2]; // [xsp+20h] [xbp-70h] BYREF
char v18; // [xsp+37h] [xbp-59h]
void *__p[2]; // [xsp+38h] [xbp-58h] BYREF
char v20; // [xsp+4Fh] [xbp-41h]
void *v21[2]; // [xsp+50h] [xbp-40h] BYREF
char v22; // [xsp+67h] [xbp-29h]
void *v23[2]; // [xsp+68h] [xbp-28h] BYREF
char v24; // [xsp+7Fh] [xbp-11h]
v2 = GJAccountManager::sharedState(a1);
if ( *(_DWORD *)(v2 + 352) <= *(_DWORD *)(v2 + 356) )
{
v6 = GJAccountManager::sharedState(v2);
return GJAccountManager::showAccountNeededAlert(v6, "add friends");
}
result = GameLevelManager::sharedState();
*(_QWORD *)(result + 1352) = a1 + 688;
v4 = *(_QWORD *)(a1 + 728);
v5 = *(_DWORD *)(v4 + 688);
if ( v5 > 2 )
{
if ( v5 == 3 )
{
v12 = GameLevelManager::sharedState();
v8 = GameLevelManager::friendRequestFromAccountID(v12, *(_DWORD *)(*(_QWORD *)(a1 + 728) + 376LL));
*(_BYTE *)(*(_QWORD *)(a1 + 728) + 724LL) = 0;
v9 = 0;
}
else
{
if ( v5 != 4 )
return result;
v7 = GameLevelManager::sharedState();
v8 = GameLevelManager::friendRequestFromAccountID(v7, *(_DWORD *)(*(_QWORD *)(a1 + 728) + 376LL));
if ( !v8 )
{
sub_100009900(v17, "Are you sure you want to remove this friend request?");
v14 = (__int64 *)FLAlertLayer::create(
a1 + 664,
"Cancel friend request",
v17,
"Back",
"Remove",
0,
380.0,
0.0,
1.0);
if ( v18 < 0 )
operator delete(v17[0]);
(*(void (__fastcall **)(__int64 *, __int64))(*v14 + 72))(v14, 1);
ButtonSprite::updateBGImage(v14[77], (__int64)"GJ_button_06.png");
return (*(__int64 (__fastcall **)(__int64 *))(*v14 + 1312))(v14);
}
v9 = 1;
}
v13 = FriendRequestPopup::create(v8, v9);
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 1312LL))(v13);
}
if ( v5 )
{
if ( v5 != 1 )
return result;
if ( *(char *)(v4 + 343) < 0 )
{
sub_1000097D0(v15, *(void **)(v4 + 320), *(_QWORD *)(v4 + 328));
}
else
{
*(_OWORD *)v15 = *(_OWORD *)(v4 + 320);
v16 = *(_QWORD *)(v4 + 336);
}
v14 = (__int64 *)sub_10022F9F0(a1 + 664, v15);
if ( SHIBYTE(v16) < 0 )
operator delete(v15[0]);
(*(void (__fastcall **)(__int64 *, __int64))(*v14 + 72))(v14, 2);
return (*(__int64 (__fastcall **)(__int64 *))(*v14 + 1312))(v14);
}
sub_100009900(v23, "Friend Request");
v10 = *(unsigned int *)(a1 + 736);
sub_100009900(v21, "");
v11 = ShareCommentLayer::create(v23, 140, 2, v10, v21);
if ( v22 < 0 )
operator delete(v21[0]);
if ( v24 < 0 )
operator delete(v23[0]);
if ( *(_DWORD *)(*(_QWORD *)(a1 + 728) + 440LL) != 2 )
{
sub_100009900(__p, "This user does not accept messages in friend requests.");
sub_10026DD44(v11, __p);
if ( v20 < 0 )
operator delete(__p[0]);
}
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v11 + 1312LL))(v11);
}