//
// TouchControlEditLayer::onPaste from 0x100979ed0 to 0x10097a44d (1405 bytes)
//
// 1 xrefs:
// > TouchControlEditLayer::buildHud @ 0x100978eae
//
// 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 12:38:57 +0000
//
void __fastcall TouchControlEditLayer::onPaste(__int64 a1)
{
char *v2; // rax
__int64 v3; // rsi
__int64 v4; // rdx
__int64 v5; // rdi
char *v6; // r14
void **v7; // r14
char *v8; // rax
char *v9; // rax
__int64 v10; // r12
__int64 v11; // rax
__int64 v12; // rsi
__int128 *v13; // rdx
__int128 *v14; // rax
__int64 v15; // r14
__int128 v16; // xmm1
__int64 v17; // r15
__int128 v18; // xmm1
__int64 v19; // rdx
__int64 v20; // r14
__int128 v21; // xmm1
__int64 v22; // rdx
__int64 v23; // r15
__int128 v24; // xmm1
__int64 v25; // r14
__int128 v26; // xmm1
__int64 v27; // rax
__int64 v28; // rax
char *v29; // rax
__int128 v30; // [rsp+8h] [rbp-E8h] BYREF
void *__p; // [rsp+18h] [rbp-D8h]
__int128 v32; // [rsp+20h] [rbp-D0h] BYREF
void *v33; // [rsp+30h] [rbp-C0h]
__int128 v34; // [rsp+38h] [rbp-B8h] BYREF
void *v35; // [rsp+48h] [rbp-A8h]
__int128 v36; // [rsp+50h] [rbp-A0h] BYREF
__int64 v37; // [rsp+60h] [rbp-90h] BYREF
__int128 v38; // [rsp+68h] [rbp-88h] BYREF
__int64 v39; // [rsp+78h] [rbp-78h] BYREF
__int128 v40; // [rsp+80h] [rbp-70h] BYREF
char v41; // [rsp+90h] [rbp-60h] BYREF
_BYTE v42[26]; // [rsp+98h] [rbp-58h] BYREF
__int64 v43; // [rsp+B4h] [rbp-3Ch] BYREF
__int16 v44; // [rsp+BCh] [rbp-34h]
char v45; // [rsp+BEh] [rbp-32h]
_QWORD v46[6]; // [rsp+C0h] [rbp-30h] BYREF
if ( (byte_100BE78E0[0] & 1) != 0 )
{
if ( *(_QWORD *)&byte_100BE78E0[8] )
goto LABEL_3;
LABEL_11:
v7 = (void **)&v37;
LOBYTE(v36) = 28;
strcpy((char *)&v36 + 1, "Nothing copied");
LOWORD(v30) = 0;
v8 = TextAlertPopup::create(&v36, 0x96u, &v30, 0.5, 0.60000002);
(*(void (__fastcall **)(__int64, char *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v8, 100);
if ( (v30 & 1) != 0 )
operator delete(__p);
if ( (v36 & 1) != 0 )
goto LABEL_18;
return;
}
if ( !((unsigned __int8)byte_100BE78E0[0] >> 1) )
goto LABEL_11;
LABEL_3:
v2 = sub_100923C60((std::string *)byte_100BE78E0);
if ( v2 )
{
if ( *((int *)v2 + 14) > 0 )
{
v3 = *((_QWORD *)v2 + 19);
v4 = *((_QWORD *)v2 + 20);
if ( v3 != v4 )
{
v5 = *(_QWORD *)(a1 + 1016);
if ( v5 )
{
if ( (char *)v5 != v2 )
{
v6 = v2;
sub_10097C830(v5 + 152, v3, v4, 0xEEEEEEEEEEEEEEEFLL * ((v4 - v3) >> 2));
v2 = v6;
v5 = *(_QWORD *)(a1 + 1016);
}
*(_QWORD *)(v5 + 60) = *(_QWORD *)(v2 + 60);
*(_DWORD *)(v5 + 68) = *((_DWORD *)v2 + 17);
}
else
{
v10 = (__int64)v2;
v11 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v46, v11);
v12 = v10;
v13 = *(__int128 **)(v10 + 152);
v14 = *(__int128 **)(v10 + 160);
if ( *(_BYTE *)(a1 + 1012) )
{
if ( v14 != v13 )
{
sub_100924E00((__int64)v42, v10, v13, (unsigned int *)v46);
v15 = GameManager::sharedState();
v16 = *(_OWORD *)&v42[10];
*(_OWORD *)(v15 + 1356) = *(_OWORD *)v42;
*(_OWORD *)(v15 + 1366) = v16;
sub_100278300((_QWORD *)(v15 + 1384), &v43);
v12 = v10;
*(_WORD *)(v15 + 1392) = v44;
*(_BYTE *)(v15 + 1394) = v45;
v13 = *(__int128 **)(v10 + 152);
v14 = *(__int128 **)(v10 + 160);
}
if ( 0xEEEEEEEEEEEEEEEFLL * (((char *)v14 - (char *)v13) >> 2) >= 2 )
{
sub_100924E00((__int64)v42, v12, (__int128 *)((char *)v13 + 60), (unsigned int *)v46);
*(float *)&v43 = *(float *)v46 - *(float *)&v43;
v17 = GameManager::sharedState();
v18 = *(_OWORD *)&v42[10];
*(_OWORD *)(v17 + 1396) = *(_OWORD *)v42;
*(_OWORD *)(v17 + 1406) = v18;
sub_100278300((_QWORD *)(v17 + 1424), &v43);
*(_WORD *)(v17 + 1432) = v44;
*(_BYTE *)(v17 + 1434) = v45;
v19 = *(_QWORD *)(v10 + 152);
if ( 0xEEEEEEEEEEEEEEEFLL * ((*(_QWORD *)(v10 + 160) - v19) >> 2) >= 3 )
{
sub_100924E00((__int64)v42, v10, (__int128 *)(v19 + 120), (unsigned int *)v46);
v20 = GameManager::sharedState();
v21 = *(_OWORD *)&v42[10];
*(_OWORD *)(v20 + 1436) = *(_OWORD *)v42;
*(_OWORD *)(v20 + 1446) = v21;
sub_100278300((_QWORD *)(v20 + 1464), &v43);
*(_WORD *)(v20 + 1472) = v44;
*(_BYTE *)(v20 + 1474) = v45;
v22 = *(_QWORD *)(v10 + 152);
if ( 0xEEEEEEEEEEEEEEEFLL * ((*(_QWORD *)(v10 + 160) - v22) >> 2) >= 4 )
{
sub_100924E00((__int64)v42, v10, (__int128 *)(v22 + 180), (unsigned int *)v46);
*(float *)&v43 = *(float *)v46 - *(float *)&v43;
v23 = GameManager::sharedState();
v24 = *(_OWORD *)&v42[10];
*(_OWORD *)(v23 + 1476) = *(_OWORD *)v42;
*(_OWORD *)(v23 + 1486) = v24;
sub_100278300((_QWORD *)(v23 + 1504), &v43);
*(_WORD *)(v23 + 1512) = v44;
*(_BYTE *)(v23 + 1514) = v45;
}
}
}
}
else if ( v14 != v13 )
{
sub_100924E00((__int64)v42, v10, v13, (unsigned int *)v46);
v25 = GameManager::sharedState();
v26 = *(_OWORD *)&v42[10];
*(_OWORD *)(v25 + 1316) = *(_OWORD *)v42;
*(_OWORD *)(v25 + 1326) = v26;
sub_100278300((_QWORD *)(v25 + 1344), &v43);
*(_WORD *)(v25 + 1352) = v44;
*(_BYTE *)(v25 + 1354) = v45;
}
if ( !*(_BYTE *)(a1 + 1012) )
{
v27 = GameManager::sharedState();
GameManager::setGameVariable(v27, "0113");
}
v28 = GameManager::sharedState();
GameManager::prepareDPadSettings(v28);
}
v7 = (void **)&v41;
*(_BYTE *)(a1 + 1336) = 1;
TouchControlEditLayer::reloadNodes(a1);
LOBYTE(v40) = 12;
strcpy((char *)&v40 + 1, "Pasted");
LOWORD(v34) = 0;
v29 = TextAlertPopup::create(&v40, 0x96u, &v34, 0.5, 0.60000002);
(*(void (__fastcall **)(__int64, char *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v29, 100);
if ( (v34 & 1) != 0 )
operator delete(v35);
if ( (v40 & 1) == 0 )
return;
LABEL_18:
operator delete(*v7);
return;
}
}
}
v7 = (void **)&v39;
LOBYTE(v38) = 28;
strcpy((char *)&v38 + 1, "Invalid config");
LOWORD(v32) = 0;
v9 = TextAlertPopup::create(&v38, 0x96u, &v32, 0.5, 0.60000002);
(*(void (__fastcall **)(__int64, char *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v9, 100);
if ( (v32 & 1) != 0 )
operator delete(v33);
if ( (v38 & 1) != 0 )
goto LABEL_18;
}