//
// SoundPackDescPopup::onSave from 0x14019a2a0 to 0x14019a5b7 (791 bytes)
//
// 2 xrefs:
// > SoundPackDescPopup::init @ 0x1401997d5
// > ??> @ 0x140919694
//
// 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:27:46 +0000
//
// Hidden C++ exception states: #wind=4
void __fastcall SoundPackDescPopup::onSave(struct cocos2d::CCObject *a1, __int64 a2, __int64 a3, double a4)
{
__int64 v5; // rax
_BYTE *v6; // rax
size_t v7; // r8
void **v8; // rax
char v9; // di
void *v10; // rcx
void *v11; // rcx
__int64 v12; // r8
__int64 v13; // rcx
__int64 v14; // rax
cocos2d::CCObject *v15; // rbx
__int64 v16; // rax
cocos2d::CCTouchDispatcher *v17; // rax
void (__fastcall ***v18)(_QWORD, void **, __int64); // rcx
void *v19; // rcx
void *Block[2]; // [rsp+50h] [rbp-29h] BYREF
__m128i si128; // [rsp+60h] [rbp-19h]
void **v22; // [rsp+70h] [rbp-9h]
void *v23[2]; // [rsp+80h] [rbp+7h] BYREF
__int128 v24; // [rsp+90h] [rbp+17h]
void *v25[2]; // [rsp+A0h] [rbp+27h] BYREF
__int128 v26; // [rsp+B0h] [rbp+37h]
LODWORD(v22) = 0;
v5 = *((_QWORD *)a1 + 127);
if ( v5 )
{
v6 = (_BYTE *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(*(_QWORD *)(v5 + 592) + 600LL) + 8LL))(*(_QWORD *)(v5 + 592) + 600LL);
*(_OWORD *)v23 = 0;
v24 = 0;
v7 = -1;
do
++v7;
while ( v6[v7] );
sub_14003D230(v23, v6, v7);
v8 = v23;
v9 = 5;
}
else
{
*(_OWORD *)Block = 0;
si128 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(Block[0]) = 0;
v8 = Block;
v9 = 2;
}
*(_OWORD *)v25 = *(_OWORD *)v8;
v26 = *((_OWORD *)v8 + 1);
v8[2] = nullptr;
v8[3] = (void *)15;
*(_BYTE *)v8 = 0;
if ( (v9 & 2) != 0 )
{
v9 &= ~2u;
a2 = si128.m128i_i64[1];
if ( si128.m128i_i64[1] > 0xFuLL )
{
v10 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v10 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v10 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v10);
}
}
if ( (v9 & 1) != 0 )
{
a2 = *((_QWORD *)&v24 + 1);
if ( *((_QWORD *)&v24 + 1) > 0xFu )
{
v11 = v23[0];
if ( (unsigned __int64)(*((_QWORD *)&v24 + 1) + 1LL) >= 0x1000 )
{
v11 = *((void **)v23[0] - 1);
if ( (unsigned __int64)((char *)v23[0] - (char *)v11 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v11);
}
}
ensureEmotesAreLoaded((__int64)a1, a2, a3, a4);
if ( (int)EmoteSprite::effectiveLength(v25, dword_1408FE3A4, v12, a4) <= 140 )
{
v16 = cocos2d::CCDirector::sharedDirector(v13);
v17 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v16 + 144LL))(v16);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v17, a1);
v18 = *((void (__fastcall ****)(_QWORD, void **, __int64))a1 + 126);
if ( v18 )
(**v18)(v18, v25, (__int64)a1 + 1032);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)a1 + 1104LL))(a1, 0);
}
else
{
*(_OWORD *)Block = 0;
si128 = 0u;
Block[0] = sub_14003D460(0x20u);
si128.m128i_i64[0] = 24;
si128.m128i_i64[1] = 31;
strcpy((char *)Block[0], "Description is too long.");
v22 = Block;
v14 = sub_14003F4F0((__int64)v23, (__int64)Block);
v15 = FLAlertLayer::create(0, (int)"Description", v14, (__int64)"OK", 0, 1132068864, 0, 0, 1065353216);
sub_14003D310((__int64)Block);
(*(void (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v15 + 1064LL))(v15);
}
if ( *((_QWORD *)&v26 + 1) > 0xFu )
{
v19 = v25[0];
if ( (unsigned __int64)(*((_QWORD *)&v26 + 1) + 1LL) >= 0x1000 )
{
v19 = *((void **)v25[0] - 1);
if ( (unsigned __int64)((char *)v25[0] - (char *)v19 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v19);
}
}