//
// cocos2d::CCTouchDispatcher::addTargetedDelegate from 0x807f30 to 0x807fee (190 bytes)
//
// 52 xrefs:
// > CCBlockLayer::registerWithTouchDispatcher @ 0x3c599e
// > cocos2d::CCScrollLayer::initWithLayers @ 0x3c7ff0
// > CCScrollLayerExt::registerWithTouchDispatcher @ 0x3c8454
// > LoadingCircle::registerWithTouchDispatcher @ 0x3d483a
// > SlideInLayer::registerWithTouchDispatcher @ 0x3da2fa
// > CCTextInputMenu::registerWithTouchDispatcher @ 0x3dba30
// > CreateGuidelinesLayer::registerWithTouchDispatcher @ 0x3f78a4
// > UILayer::registerWithTouchDispatcher @ 0x3fc192
// > StartPosBrowser::registerWithTouchDispatcher @ 0x48ea12
// > MenuGameLayer::registerWithTouchDispatcher @ 0x49213a
// > LevelBrowserLayer::registerWithTouchDispatcher @ 0x4a9480
// > LevelPage::registerWithTouchDispatcher @ 0x511850
// > GJDropDownLayer::registerWithTouchDispatcher @ 0x52bb9e
// > InfoLayer::registerWithTouchDispatcher @ 0x53c99e
// > ShareCommentLayer::registerWithTouchDispatcher @ 0x540c22
// > AccountRegisterLayer::registerWithTouchDispatcher @ 0x58592a
// > AccountLoginLayer::registerWithTouchDispatcher @ 0x58594e
// > GJWriteMessagePopup::registerWithTouchDispatcher @ 0x5d374a
// > UIOptionsLayer::registerWithTouchDispatcher @ 0x5d376e
// > GJPromoPopup::registerWithTouchDispatcher @ 0x5d378e
// > UIPOptionsLayer::registerWithTouchDispatcher @ 0x5d37b2
// > MessagesProfilePage::registerWithTouchDispatcher @ 0x5ef60a
// > FRequestProfilePage::registerWithTouchDispatcher @ 0x5f0ebe
// > ProfilePage::registerWithTouchDispatcher @ 0x5f59f2
// > ChallengesPage::registerWithTouchDispatcher @ 0x5ff3be
// > DailyLevelPage::registerWithTouchDispatcher @ 0x606cc6
// > GJShopLayer::registerWithTouchDispatcher @ 0x610fa2
// > LevelLeaderboard::registerWithTouchDispatcher @ 0x614712
// > RewardsPage::registerWithTouchDispatcher @ 0x616932
// > ShardsPage::registerWithTouchDispatcher @ 0x62b2f2
// > FollowRewardPage::registerWithTouchDispatcher @ 0x62fa1e
// > TopArtistsLayer::registerWithTouchDispatcher @ 0x6311ca
// > CommunityCreditsPage::registerWithTouchDispatcher @ 0x6374ee
// > MapSelectLayer::registerWithTouchDispatcher @ 0x63ee0a
// > CharacterColorPage::registerWithTouchDispatcher @ 0x69caca
// > LevelSettingsLayer::registerWithTouchDispatcher @ 0x6a89c4
// > MusicBrowser::registerWithTouchDispatcher @ 0x6bd256
// > OptionsScrollLayer::registerWithTouchDispatcher @ 0x6bd27a
// > SFXBrowser::registerWithTouchDispatcher @ 0x6c37b2
// > GJPathsLayer::registerWithTouchDispatcher @ 0x6d1652
// > GJPathPage::registerWithTouchDispatcher @ 0x6d1676
// > AudioAssetsBrowser::registerWithTouchDispatcher @ 0x6e19ba
// > EditorUI::registerWithTouchDispatcher @ 0x6f123a
// > NotificationsPage::registerWithTouchDispatcher @ 0x7431de
// > EditorSoundBrowserLayer::registerWithTouchDispatcher @ 0x781b9e
// > SelectFontLayer2::registerWithTouchDispatcher @ 0x7a1742
// > TouchControlEditLayer::registerWithTouchDispatcher @ 0x7a2770
// > cocos2d::extension::CCControl::registerWithTouchDispatcher @ 0x7a665e
// > cocos2d::extension::CCScrollView::registerWithTouchDispatcher @ 0x7adc4e
// > cocos2d::CCLayer::registerWithTouchDispatcher @ 0x7d6f3a
// > cocos2d::CCMenu::registerWithTouchDispatcher @ 0x7dbd7c
// > cocos2d::CCTouchDispatcher::addPrioTargetedDelegate @ 0x808030
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:01:26 +0000
//
unsigned int *__fastcall cocos2d::CCTouchDispatcher::addTargetedDelegate(
cocos2d::CCTouchDispatcher *this,
cocos2d::CCTouchDelegate *a2,
cocos2d::CCTouchDelegate *a3,
int a4)
{
bool v8; // r3
cocos2d::CCTouchHandler *v9; // r6
unsigned int *result; // r0
int v11[2]; // [sp+0h] [bp-8h] BYREF
v11[1] = (int)a2;
v11[0] = 0;
if ( cocos2d::CCTouchDispatcher::ownerLevelFor((cocos2d::CCDictionary **)this, a2, v11) )
{
if ( (int)a3 >= v11[0] )
a3 = (cocos2d::CCTouchDelegate *)v11[0];
}
else if ( !cocos2d::CCTouchDispatcher::isUsingForcePrio(this)
|| (int)a3 <= *((_DWORD *)this + 25)
|| (*(int (__fastcall **)(cocos2d::CCTouchDelegate *))(*(_DWORD *)a2 + 44))(a2) )
{
if ( (*(int (__fastcall **)(cocos2d::CCTouchDelegate *))(*(_DWORD *)a2 + 44))(a2) )
a3 = (cocos2d::CCTouchDelegate *)(*(int (__fastcall **)(cocos2d::CCTouchDelegate *))(*(_DWORD *)a2 + 44))(a2);
}
else
{
a3 = *((cocos2d::CCTouchDelegate **)this + 25);
}
(*(void (__fastcall **)(cocos2d::CCTouchDelegate *, cocos2d::CCTouchDelegate *))(*(_DWORD *)a2 + 40))(a2, a3);
v9 = (cocos2d::CCTouchHandler *)cocos2d::CCTargetedTouchHandler::handlerWithDelegate(a2, a3, a4, v8);
if ( !*((_BYTE *)this + 64) )
return (unsigned int *)cocos2d::CCTouchDispatcher::forceAddHandler(this, v9, *((cocos2d::CCArray **)this + 14));
if ( cocos2d::ccCArrayContainsValue(*((_DWORD **)this + 18), (int)a2) )
return cocos2d::ccCArrayRemoveValue(*((unsigned int **)this + 18), (int)a2);
result = (unsigned int *)cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 17), v9);
*((_BYTE *)this + 65) = 1;
return result;
}