//
// cocos2d::CCTouchDispatcher::addTargetedDelegate from 0x10014ed70 to 0x10014ee80 (272 bytes)
//
// 43 xrefs:
// > ChallengesPage::registerWithTouchDispatcher @ 0x100032c84
// > UILayer::registerWithTouchDispatcher @ 0x10004a978
// > CreateGuidelinesLayer::registerWithTouchDispatcher @ 0x10007e034
// > AccountRegisterLayer::registerWithTouchDispatcher @ 0x1000828c0
// > AccountLoginLayer::registerWithTouchDispatcher @ 0x1000844a8
// > CCBlockLayer::registerWithTouchDispatcher @ 0x1000863bc
// > CharacterColorPage::registerWithTouchDispatcher @ 0x10012a594
// > cocos2d::CCLayer::registerWithTouchDispatcher @ 0x100148724
// > GJShopLayer::registerWithTouchDispatcher @ 0x10014dad4
// > cocos2d::CCTouchDispatcher::addPrioTargetedDelegate @ 0x10014ed6c
// > SFXBrowser::registerWithTouchDispatcher @ 0x10016a8c4
// > LevelSettingsLayer::registerWithTouchDispatcher @ 0x10017be30
// > ProfilePage::registerWithTouchDispatcher @ 0x10019cd8c
// > CommunityCreditsPage::registerWithTouchDispatcher @ 0x1001a2b38
// > TopArtistsLayer::registerWithTouchDispatcher @ 0x1001a4fbc
// > cocos2d::extension::CCControl::registerWithTouchDispatcher @ 0x1001a5a30
// > FRequestProfilePage::registerWithTouchDispatcher @ 0x1001b7250
// > DailyLevelPage::registerWithTouchDispatcher @ 0x1001baac8
// > RewardsPage::registerWithTouchDispatcher @ 0x1001c4ef0
// > MessagesProfilePage::registerWithTouchDispatcher @ 0x1001cd2f0
// > AudioAssetsBrowser::registerWithTouchDispatcher @ 0x1001d238c
// > ShareCommentLayer::registerWithTouchDispatcher @ 0x1001d59e0
// > cocos2d::CCMenu::registerWithTouchDispatcher @ 0x1001d8360
// > FriendsProfilePage::registerWithTouchDispatcher @ 0x1001d9a68
// > LevelLeaderboard::registerWithTouchDispatcher @ 0x100250db0
// > GJWriteMessagePopup::registerWithTouchDispatcher @ 0x1002dd024
// > UIOptionsLayer::registerWithTouchDispatcher @ 0x1002e4780
// > GJPromoPopup::registerWithTouchDispatcher @ 0x1002e5554
// > UIPOptionsLayer::registerWithTouchDispatcher @ 0x1002e6564
// > CCScrollLayerExt::registerWithTouchDispatcher @ 0x100301168
// > InfoLayer::registerWithTouchDispatcher @ 0x100352b6c
// > LoadingCircle::registerWithTouchDispatcher @ 0x10039a268
// > MenuGameLayer::registerWithTouchDispatcher @ 0x10039b9a8
// > ShardsPage::registerWithTouchDispatcher @ 0x1003a363c
// > GJDropDownLayer::registerWithTouchDispatcher @ 0x1003b2694
// > GJPathsLayer::registerWithTouchDispatcher @ 0x1003b8858
// > GJPathPage::registerWithTouchDispatcher @ 0x1003bb4d4
// > MusicBrowser::registerWithTouchDispatcher @ 0x1003c2bd4
// > OptionsScrollLayer::registerWithTouchDispatcher @ 0x1003c3078
// > EditorUI::registerWithTouchDispatcher @ 0x1003f987c
// > LevelPage::registerWithTouchDispatcher @ 0x100405c70
// > LevelBrowserLayer::registerWithTouchDispatcher @ 0x100419a1c
// > FollowRewardPage::registerWithTouchDispatcher @ 0x100426108
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void __fastcall cocos2d::CCTouchDispatcher::addTargetedDelegate(
cocos2d::CCTouchDispatcher *a1,
cocos2d::CCTouchDelegate *a2,
int a3,
bool a4)
{
__int64 m_targetPrio; // x22
cocos2d::CCTouchDispatcher *v8; // x0
cocos2d::CCTouchDispatcher *v9; // x21
m_targetPrio = *(_QWORD *)&a3;
if ( a1->m_forcePrio < 1
|| a1->m_targetPrio >= a3
|| ((unsigned int (__fastcall *)(cocos2d::CCTouchDelegate *))a2->getPreviousPriority)(a2) )
{
if ( ((unsigned int (__fastcall *)(cocos2d::CCTouchDelegate *))a2->getPreviousPriority)(a2) )
m_targetPrio = ((__int64 (__fastcall *)(cocos2d::CCTouchDelegate *))a2->getPreviousPriority)(a2);
}
else
{
m_targetPrio = (unsigned int)a1->m_targetPrio;
}
((void (__fastcall *)(cocos2d::CCTouchDelegate *, __int64))a2->setPreviousPriority)(a2, m_targetPrio);
v8 = (cocos2d::CCTouchDispatcher *)cocos2d::CCTargetedTouchHandler::handlerWithDelegate(a2, m_targetPrio, a4);
v9 = v8;
if ( a1->m_bLocked )
{
if ( (unsigned int)sub_100353BC8(a1->m_pHandlersToRemove, a2) )
{
sub_100353C58(a1->m_pHandlersToRemove, a2);
}
else
{
sub_10024A2D0(a1->m_pHandlersToAdd, v9);
a1->m_bToAdd = 1;
}
}
else
{
cocos2d::CCTouchDispatcher::forceAddHandler(v8, (cocos2d::CCTouchHandler *)v8, a1->m_pTargetedHandlers);
}
}