//
// EmotePickerPopup::canAddEmote from 0x140124520 to 0x14012463f (287 bytes)
//
// 3 xrefs:
// > EmotePickerPopup::refreshEnabled @ 0x14012465c
// > EmotePickerPopup::onPickEmote @ 0x1401247ac
// > ??> @ 0x1409168bc
//
// 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:57 +0000
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall EmotePickerPopup::canAddEmote(__int64 a1, __int64 a2, __int64 a3, double a4)
{
__int64 v5; // rax
_BYTE *v7; // rax
size_t v8; // r8
int v9; // ebx
__int64 v10; // r8
bool v11; // bl
void *v12; // rcx
void *Block[2]; // [rsp+38h] [rbp-30h] BYREF
__int128 v14; // [rsp+48h] [rbp-20h]
v5 = *(_QWORD *)(a1 + 1152);
if ( !v5 )
return 1;
v7 = (_BYTE *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(*(_QWORD *)(v5 + 592) + 600LL) + 8LL))(*(_QWORD *)(v5 + 592) + 600LL);
*(_OWORD *)Block = 0;
v14 = 0;
v8 = -1;
do
++v8;
while ( v7[v8] );
sub_14003D230(Block, v7, v8);
v9 = *(_DWORD *)(a1 + 1160);
v11 = (int)EmoteSprite::parseTokens(Block, 0, v9, a4) < v9
&& (signed int)(EmoteSprite::effectiveLength(Block, *(_DWORD *)(a1 + 1160), v10, a4) + 1) <= *(_DWORD *)(a1 + 1164);
if ( *((_QWORD *)&v14 + 1) > 0xFu )
{
v12 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v14 + 1) + 1LL) >= 0x1000 )
{
v12 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v12 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v12);
}
return v11;
}