//
// EditorSoundConfigInfoLayer::onFavorite from 0xccdec8 to 0xcce024 (348 bytes)
//
// 4 xrefs:
// > EditorSoundConfigInfoLayer::downloadEditorSoundFinished @ 0xccf468
// > ??> @ 0xb7280
// > EditorSoundConfigInfoLayer::init @ 0xcd1e4c
// > ??> @ 0x1545478
//
// 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 13:06:25 +0000
//
__int64 __fastcall EditorSoundConfigInfoLayer::onFavorite(EditorSoundConfigInfoLayer *this, cocos2d::CCObject *a2)
{
EditorSFXManager *v3; // x0
EditorSFXManager *v4; // x0
EditorSFXManager *v5; // x0
EditorSFXManager *FavoriteConfig; // x0
EditorSFXManager *v7; // x0
EditorSoundBrowserLayer *v8; // x0
EditorSFXManager *v10; // x0
EditorSFXManager *FavoriteConfigs; // x0
__int64 v12; // x0
__int64 v13; // x0
__int64 v14[2]; // [xsp+20h] [xbp+20h] BYREF
void *v15; // [xsp+30h] [xbp+30h]
v3 = *((EditorSFXManager **)this + 136);
if ( v3 )
{
v4 = (EditorSFXManager *)EditorSFXManager::sharedState(v3);
if ( v4
&& (v5 = (EditorSFXManager *)EditorSFXManager::sharedState(v4),
(FavoriteConfig = (EditorSFXManager *)EditorSFXManager::getFavoriteConfig(
v5,
*(_DWORD *)(*((_QWORD *)this + 136) + 316LL))) != nullptr) )
{
v7 = (EditorSFXManager *)EditorSFXManager::sharedState(FavoriteConfig);
EditorSFXManager::removeFavoriteConfig(v7, *(_DWORD *)(*((_QWORD *)this + 136) + 316LL));
EditorSoundConfigInfoLayer::refreshActionButtons(this);
v8 = *((EditorSoundBrowserLayer **)this + 138);
if ( v8 )
EditorSoundBrowserLayer::onConfigListChanged(v8);
}
else if ( *(_BYTE *)(*((_QWORD *)this + 136) + 496LL) )
{
v10 = (EditorSFXManager *)EditorSFXManager::sharedState((EditorSFXManager *)*(unsigned __int8 *)(*((_QWORD *)this + 136) + 496LL));
FavoriteConfigs = (EditorSFXManager *)EditorSFXManager::getFavoriteConfigs(v10);
if ( FavoriteConfigs
&& (FavoriteConfigs = (EditorSFXManager *)cocos2d::CCArray::count(FavoriteConfigs),
(unsigned int)FavoriteConfigs > 0x31) )
{
v14[0] = 0;
v14[1] = 0;
v15 = nullptr;
std::string::__init(v14, "You have reached the maximum of 50 favorites. Remove some first.", 0x40u);
v12 = FLAlertLayer::create(
0,
(cocos2d::CCLabelBMFont *)"Limit Reached",
(char *)v14,
(ButtonSprite *)"OK",
nullptr);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v12 + 1312LL))(v12);
if ( (v14[0] & 1) != 0 )
operator delete(v15);
}
else
{
v13 = EditorSFXManager::sharedState(FavoriteConfigs);
EditorSFXManager::addFavoriteConfig(v13, *((GJEditorSoundConfig **)this + 136));
EditorSoundConfigInfoLayer::refreshActionButtons(this);
}
}
else
{
*((_BYTE *)this + 1121) = 1;
EditorSoundConfigInfoLayer::startDownload((__int64)this);
}
}
return _stack_chk_guard;
}