//
// CustomSFXWidget::onPlayback from 0x1005e3c20 to 0x1005e3d55 (309 bytes)
//
// 3 xrefs:
// > CustomSFXWidget::downloadSFXFinished @ 0x1005e4bd5
// > sub_1005E4BE0 @ 0x1005e4c2c
// > CustomSFXWidget::init @ 0x1005e3107
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall CustomSFXWidget::onPlayback(CustomSFXWidget *a1, cocos2d::CCObject *a2)
{
double v2; // xmm0_8
FMODAudioEngine *v4; // rax
CustomSFXDelegate *m_delegate; // rdi
FMODAudioEngine *v6; // rbx
MusicDownloadManager *v7; // rax
const char *data; // r14
size_t v9; // rax
size_t v10; // r15
char *v11; // r12
size_t v12; // r13
std::string v13; // [rsp+8h] [rbp-58h] BYREF
_QWORD __dst[2]; // [rsp+20h] [rbp-40h] BYREF
void *__p; // [rsp+30h] [rbp-30h]
if ( !a1->m_sfxObject )
return;
v4 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllEffects(v4);
m_delegate = a1->m_delegate;
if ( m_delegate )
{
if ( ((unsigned __int8 (__fastcall *)(CustomSFXDelegate *, SFXInfoObject *))m_delegate->overridePlaySFX)(
m_delegate,
a1->m_sfxObject) )
{
return;
}
}
v6 = FMODAudioEngine::sharedEngine();
v7 = MusicDownloadManager::sharedState();
MusicDownloadManager::pathForSFX(&v13, v2, (__int64)v7, a1->m_sfxObject->m_sfxID);
if ( (*(_BYTE *)&v13.__r_.__value_.__s.0 & 1) != 0 )
data = v13.__r_.__value_.__l.__data_;
else
data = v13.__r_.__value_.__s.__data_;
v9 = strlen(data);
if ( v9 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v2);
v10 = v9;
if ( v9 >= 0x17 )
{
v12 = 26;
if ( (v9 | 7) != 0x17 )
v12 = (v9 | 7) + 1;
v11 = (char *)operator new(v12);
__p = v11;
__dst[0] = v12 | 1;
__dst[1] = v10;
}
else
{
LOBYTE(__dst[0]) = 2 * v9;
v11 = (char *)__dst + 1;
if ( !v9 )
goto LABEL_15;
}
memmove(v11, data, v10);
LABEL_15:
v11[v10] = 0;
FMODAudioEngine::playEffectAsync((__int64)v6, (__int64)__dst, v2);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
if ( (*(_BYTE *)&v13.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v13.__r_.__value_.__l.__data_);
}