//
// SetupPulsePopup::onSelectTargetMode from 0x1405d06d0 to 0x1405d0919 (585 bytes)
//
// 4 xrefs:
// > SetupPulsePopup::init @ 0x1405d01a5
// > SetupPulsePopup::init @ 0x1405ce1af
// > SetupPulsePopup::init @ 0x1405ce269
// > ??> @ 0x14092e5f8
//
// 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:34:55 +0000
//
int __fastcall SetupPulsePopup::onSelectTargetMode(__int64 a1, __int64 a2)
{
int v3; // ebp
const char *v4; // rsi
const char *v5; // rdi
__int64 v6; // rax
__int64 v7; // rax
const char *v8; // rsi
bool v9; // di
__int64 v10; // rcx
__int64 v11; // rcx
cocos2d::CCDictionary *v12; // rcx
struct cocos2d::CCObject *v13; // rax
unsigned int v14; // edi
__int64 v15; // rcx
cocos2d::CCArray *v16; // rcx
struct cocos2d::CCObject *v17; // rax
v3 = -1;
if ( a2 )
v3 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 56LL))(a2);
v4 = "GJ_button_04.png";
v5 = "GJ_button_04.png";
if ( !v3 )
v5 = "GJ_button_02.png";
v6 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1072) + 952LL))(*(_QWORD *)(a1 + 1072));
ButtonSprite::updateBGImage(v6, v5);
if ( v3 == 1 )
v4 = "GJ_button_02.png";
v7 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1080) + 952LL))(*(_QWORD *)(a1 + 1080));
ButtonSprite::updateBGImage(v7, v4);
if ( v3 )
{
v8 = (const char *)&qword_140748ED8;
if ( v3 != 1 )
v8 = "ID";
}
else
{
v8 = "Channel ID";
}
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 1152) + 336LL))(*(_QWORD *)(a1 + 1152), v3 == 0);
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 1152) + 936LL))(*(_QWORD *)(a1 + 1152), v3 == 0);
v9 = v3 == 1;
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 1200) + 336LL))(*(_QWORD *)(a1 + 1200), v3 == 1);
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 1200) + 936LL))(*(_QWORD *)(a1 + 1200), v3 == 1);
v10 = *(_QWORD *)(a1 + 1224);
if ( v10 )
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v10 + 336LL))(v10, v9);
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 1208) + 336LL))(*(_QWORD *)(a1 + 1208), v9);
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 1208) + 936LL))(*(_QWORD *)(a1 + 1208), v9);
v11 = *(_QWORD *)(a1 + 1232);
if ( v11 )
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v11 + 336LL))(v11, v9);
(**(void (__fastcall ***)(__int64, const char *))(*(_QWORD *)(a1 + 1088) + 360LL))(*(_QWORD *)(a1 + 1088) + 360LL, v8);
v12 = *(cocos2d::CCDictionary **)(a1 + 984);
*(_DWORD *)(a1 + 1280) = v3;
v13 = cocos2d::CCDictionary::objectForKey(v12, 51);
v14 = 0;
if ( v13 )
LODWORD(v13) = IDNameInput::setType((__int64)v13, v3 == 1);
if ( !*(_BYTE *)(a1 + 1284) )
{
*(_DWORD *)(a1 + 1252) = 0;
SetupPulsePopup::updateTargetID(a1);
LODWORD(v13) = SetupPulsePopup::updateTextInputLabel(a1);
v15 = *(_QWORD *)(a1 + 680);
if ( v15 )
{
LODWORD(v13) = *(_DWORD *)(a1 + 1280);
*(_DWORD *)(v15 + 1624) = (_DWORD)v13;
}
else
{
v16 = *(cocos2d::CCArray **)(a1 + 688);
if ( v16 )
{
LODWORD(v13) = cocos2d::CCArray::count(v16);
if ( (_DWORD)v13 )
{
do
{
v17 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 688), v14++);
*((_DWORD *)v17 + 406) = *(_DWORD *)(a1 + 1280);
LODWORD(v13) = cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 688));
}
while ( v14 < (unsigned int)v13 );
}
}
}
}
return (int)v13;
}