//
// cocos2d::CCApplication::updateControllerKeys from 0x180076b00 to 0x1800775fd (2813 bytes)
//
// 6 xrefs:
// > cocos2d::CCApplication::run @ 0x180076194
// > cocos2d::CCApplication::run @ 0x1800761ac
// > ??> @ 0x180144454
// > ??> @ 0x18014456c
// > ??> @ 0x18014cf68
// > ??> @ 0x1801be860
//
// 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:21:59 +0000
//
void __fastcall cocos2d::CCApplication::updateControllerKeys(
cocos2d::CCApplication *this,
struct CXBOXController *a2,
int a3)
{
double v6; // xmm6_8
int v7; // esi
unsigned __int8 v8; // r14
struct cocos2d::CCDirector *v9; // rax
cocos2d::CCEGLView *v10; // rcx
struct cocos2d::CCDirector *v11; // rax
__int64 v12; // rax
unsigned __int8 v13; // r14
struct cocos2d::CCDirector *v14; // rax
__int64 v15; // rax
unsigned __int8 v16; // r14
struct cocos2d::CCDirector *v17; // rax
__int64 v18; // rax
__int16 v19; // r14
struct cocos2d::CCDirector *v20; // rax
__int64 v21; // rax
unsigned __int8 v22; // r14
struct cocos2d::CCDirector *v23; // rax
__int64 v24; // rax
unsigned __int8 v25; // r14
struct cocos2d::CCDirector *v26; // rax
__int64 v27; // rax
unsigned __int8 v28; // r14
struct cocos2d::CCDirector *v29; // rax
__int64 v30; // rax
unsigned __int8 v31; // r14
struct cocos2d::CCDirector *v32; // rax
__int64 v33; // rax
unsigned __int8 v34; // r14
struct cocos2d::CCDirector *v35; // rax
__int64 v36; // rax
char v37; // al
struct cocos2d::CCDirector *v38; // rax
__int64 v39; // rax
unsigned __int8 v40; // r14
struct cocos2d::CCDirector *v41; // rax
__int64 v42; // rax
unsigned __int8 v43; // r14
struct cocos2d::CCDirector *v44; // rax
__int64 v45; // rax
unsigned __int8 v46; // r14
struct cocos2d::CCDirector *v47; // rax
__int64 v48; // rax
unsigned __int8 v49; // r14
struct cocos2d::CCDirector *v50; // rax
__int64 v51; // rax
__int32 v52; // xmm2_4
float v53; // xmm9_4
float v54; // xmm8_4
float v55; // xmm1_4
float v56; // xmm1_4
float v57; // xmm1_4
float v58; // xmm1_4
float *v59; // rax
char v60; // al
float v61; // xmm10_4
float v62; // xmm0_4
unsigned __int8 v63; // r14
struct cocos2d::CCDirector *v64; // rax
__int64 v65; // rax
char v66; // al
float v67; // xmm0_4
unsigned __int8 v68; // r14
struct cocos2d::CCDirector *v69; // rax
__int64 v70; // rax
char v71; // al
float v72; // xmm0_4
unsigned __int8 v73; // r14
struct cocos2d::CCDirector *v74; // rax
__int64 v75; // rax
char v76; // al
float v77; // xmm0_4
unsigned __int8 v78; // r14
struct cocos2d::CCDirector *v79; // rax
__int64 v80; // rax
float v81; // xmm9_4
float v82; // xmm8_4
float v83; // xmm1_4
float v84; // xmm1_4
float v85; // xmm1_4
float v86; // xmm1_4
float *v87; // rax
char v88; // al
float v89; // xmm0_4
unsigned __int8 v90; // r14
struct cocos2d::CCDirector *v91; // rax
__int64 v92; // rax
char v93; // al
float v94; // xmm0_4
unsigned __int8 v95; // r14
struct cocos2d::CCDirector *v96; // rax
__int64 v97; // rax
char v98; // al
float v99; // xmm0_4
unsigned __int8 v100; // r14
struct cocos2d::CCDirector *v101; // rax
__int64 v102; // rax
char v103; // al
unsigned __int8 v104; // bl
struct cocos2d::CCDirector *v105; // rax
__int64 v106; // rax
LARGE_INTEGER PerformanceCount; // [rsp+38h] [rbp-D0h] BYREF
struct tagINPUT pInputs; // [rsp+40h] [rbp-C8h] BYREF
__int16 v109; // [rsp+68h] [rbp-A0h] BYREF
__int16 v110; // [rsp+6Ch] [rbp-9Ch]
unsigned __int8 v111; // [rsp+6Eh] [rbp-9Ah]
unsigned __int8 v112; // [rsp+6Fh] [rbp-99h]
__int16 v113; // [rsp+70h] [rbp-98h]
__int16 v114; // [rsp+72h] [rbp-96h]
__int16 v115; // [rsp+74h] [rbp-94h]
__int16 v116; // [rsp+76h] [rbp-92h]
if ( a2 )
{
if ( !byte_1801B2530 )
{
QueryPerformanceFrequency(&Frequency);
byte_1801B2530 = 1;
}
QueryPerformanceCounter(&PerformanceCount);
v6 = (double)(int)PerformanceCount.LowPart / (double)(int)Frequency.LowPart;
sub_180081500(a2, &v109);
v7 = 0;
v8 = (v110 & 0x1000) != 0;
if ( v8 != *((_BYTE *)a2 + 31) )
{
*((_BYTE *)a2 + 31) = v8;
if ( *((_BYTE *)this + 184) )
{
if ( !*((_BYTE *)cocos2d::CCEGLView::sharedOpenGLView() + 235)
&& !*((_BYTE *)cocos2d::CCEGLView::sharedOpenGLView() + 237) )
{
v9 = cocos2d::CCDirector::sharedDirector();
if ( !*(_BYTE *)((*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v9 + 176LL))(v9) + 158) )
{
v10 = cocos2d::CCEGLView::sharedOpenGLView();
if ( v8 )
{
cocos2d::CCEGLView::capture(v10);
pInputs.mi.dwFlags = 2;
}
else
{
cocos2d::CCEGLView::releaseCapture();
pInputs.mi.dwFlags = 4;
}
memset(&pInputs, 0, 20);
*((_OWORD *)&pInputs.hi + 1) = 0;
SendInput(1u, &pInputs, 40);
}
}
}
v11 = cocos2d::CCDirector::sharedDirector();
v12 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v11 + 176LL))(v11);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v12, (a3 > 1) + 1001, v8, 0, *(__int64 *)&v6);
}
v13 = (v110 & 0x2000) != 0;
if ( v13 != *((_BYTE *)a2 + 32) )
{
*((_BYTE *)a2 + 32) = v13;
v14 = cocos2d::CCDirector::sharedDirector();
v15 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v14 + 176LL))(v14);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v15, (a3 > 1) + 1003, v13, 0, *(__int64 *)&v6);
}
v16 = (v110 & 0x4000) != 0;
if ( v16 != *((_BYTE *)a2 + 33) )
{
*((_BYTE *)a2 + 33) = v16;
v17 = cocos2d::CCDirector::sharedDirector();
v18 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v17 + 176LL))(v17);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v18, (a3 > 1) + 1007, v16, 0, *(__int64 *)&v6);
}
v19 = (unsigned __int16)v110 >> 15;
if ( v110 < 0 != *((_BYTE *)a2 + 34) )
{
*((_BYTE *)a2 + 34) = v110 < 0;
v20 = cocos2d::CCDirector::sharedDirector();
v21 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v20 + 176LL))(v20);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v21, (a3 > 1) + 1005, v19, 0, *(__int64 *)&v6);
}
v22 = HIBYTE(v110) & 1;
if ( (HIBYTE(v110) & 1) != *((_BYTE *)a2 + 29) )
{
*((_BYTE *)a2 + 29) = v22;
v23 = cocos2d::CCDirector::sharedDirector();
v24 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v23 + 176LL))(v23);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v24, (a3 > 1) + 1015, v22, 0, *(__int64 *)&v6);
}
v25 = (v110 & 0x200) != 0;
if ( v25 != *((_BYTE *)a2 + 30) )
{
*((_BYTE *)a2 + 30) = v25;
v26 = cocos2d::CCDirector::sharedDirector();
v27 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v26 + 176LL))(v26);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v27, (a3 > 1) + 1013, v25, 0, *(__int64 *)&v6);
}
v28 = v111 >= 0x1Eu;
if ( v111 >= 0x1Eu != *((_BYTE *)a2 + 27) )
{
*((_BYTE *)a2 + 27) = v28;
v29 = cocos2d::CCDirector::sharedDirector();
v30 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v29 + 176LL))(v29);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v30, (a3 > 1) + 1019, v28, 0, *(__int64 *)&v6);
}
v31 = v112 >= 0x1Eu;
if ( v112 >= 0x1Eu != *((_BYTE *)a2 + 28) )
{
*((_BYTE *)a2 + 28) = v31;
v32 = cocos2d::CCDirector::sharedDirector();
v33 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v32 + 176LL))(v32);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v33, (a3 > 1) + 1017, v31, 0, *(__int64 *)&v6);
}
v34 = (v110 & 0x10) != 0;
if ( v34 != *((_BYTE *)a2 + 25) )
{
*((_BYTE *)a2 + 25) = v34;
v35 = cocos2d::CCDirector::sharedDirector();
v36 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v35 + 176LL))(v35);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v36, (a3 > 1) + 1009, v34, 0, *(__int64 *)&v6);
}
v37 = (v110 & 0x20) != 0;
if ( v37 != *((_BYTE *)a2 + 26) )
{
*((_BYTE *)a2 + 26) = v37;
if ( v37 )
{
v38 = cocos2d::CCDirector::sharedDirector();
v39 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v38 + 160LL))(v38);
cocos2d::CCKeypadDispatcher::dispatchKeypadMSG(v39, 1);
}
}
v40 = v110 & 1;
if ( (v110 & 1) != *((_BYTE *)a2 + 21) )
{
*((_BYTE *)a2 + 21) = v40;
v41 = cocos2d::CCDirector::sharedDirector();
v42 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v41 + 176LL))(v41);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v42, (a3 > 1) + 1021, v40, 0, *(__int64 *)&v6);
}
v43 = (v110 & 2) != 0;
if ( v43 != *((_BYTE *)a2 + 22) )
{
*((_BYTE *)a2 + 22) = v43;
v44 = cocos2d::CCDirector::sharedDirector();
v45 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v44 + 176LL))(v44);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v45, (a3 > 1) + 1023, v43, 0, *(__int64 *)&v6);
}
v46 = (v110 & 4) != 0;
if ( v46 != *((_BYTE *)a2 + 23) )
{
*((_BYTE *)a2 + 23) = v46;
v47 = cocos2d::CCDirector::sharedDirector();
v48 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v47 + 176LL))(v47);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v48, (a3 > 1) + 1025, v46, 0, *(__int64 *)&v6);
}
v49 = (v110 & 8) != 0;
if ( v49 != *((_BYTE *)a2 + 24) )
{
*((_BYTE *)a2 + 24) = v49;
v50 = cocos2d::CCDirector::sharedDirector();
v51 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v50 + 176LL))(v50);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v51, (a3 > 1) + 1027, v49, 0, *(__int64 *)&v6);
}
v52 = _mm_load_si128((const __m128i *)&xmmword_1800EC5C0).m128i_i32[0];
v53 = 0.0;
v54 = 0.0;
v55 = (float)v113;
if ( COERCE_FLOAT(LODWORD(v55) & v52) > 7849.0 )
{
if ( v55 <= 0.0 )
v56 = v55 + 7849.0;
else
v56 = v55 + -7849.0;
v53 = v56 / 24918.0;
}
v57 = (float)v114;
if ( COERCE_FLOAT(LODWORD(v57) & v52) > 7849.0 )
{
if ( v57 <= 0.0 )
v58 = v57 + 7849.0;
else
v58 = v57 + -7849.0;
v54 = -(float)(v58 / 24918.0);
}
if ( v53 != 0.0 || v54 != 0.0 )
{
v59 = kmVec2Fill((float *)&PerformanceCount, v53 * 10.0, v54 * 10.0);
cocos2d::CCSize::operator=((_DWORD *)this + 42, v59);
v52 = _mm_load_si128((const __m128i *)&xmmword_1800EC5C0).m128i_u32[0];
}
v60 = *((_BYTE *)a2 + 37);
v61 = 0.15000001;
if ( v60 )
v62 = 0.15000001;
else
v62 = 0.2;
v63 = (float)-v62 >= v53;
if ( v63 != v60 )
{
*((_BYTE *)a2 + 37) = v63;
v64 = cocos2d::CCDirector::sharedDirector();
v65 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v64 + 176LL))(v64);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v65, (a3 > 1) + 1033, v63, 0, *(__int64 *)&v6);
v52 = _mm_load_si128((const __m128i *)&xmmword_1800EC5C0).m128i_u32[0];
}
v66 = *((_BYTE *)a2 + 38);
if ( v66 )
v67 = 0.15000001;
else
v67 = 0.2;
v68 = v53 >= v67;
if ( v53 >= v67 != v66 )
{
*((_BYTE *)a2 + 38) = v68;
v69 = cocos2d::CCDirector::sharedDirector();
v70 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v69 + 176LL))(v69);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v70, (a3 > 1) + 1035, v68, 0, *(__int64 *)&v6);
v52 = _mm_load_si128((const __m128i *)&xmmword_1800EC5C0).m128i_u32[0];
}
v71 = *((_BYTE *)a2 + 35);
if ( v71 )
v72 = 0.15000001;
else
v72 = 0.2;
v73 = (float)-v72 >= v54;
if ( v73 != v71 )
{
*((_BYTE *)a2 + 35) = v73;
v74 = cocos2d::CCDirector::sharedDirector();
v75 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v74 + 176LL))(v74);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v75, (a3 > 1) + 1029, v73, 0, *(__int64 *)&v6);
v52 = _mm_load_si128((const __m128i *)&xmmword_1800EC5C0).m128i_u32[0];
}
v76 = *((_BYTE *)a2 + 36);
if ( v76 )
v77 = 0.15000001;
else
v77 = 0.2;
v78 = v54 >= v77;
if ( v54 >= v77 != v76 )
{
*((_BYTE *)a2 + 36) = v78;
v79 = cocos2d::CCDirector::sharedDirector();
v80 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v79 + 176LL))(v79);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v80, (a3 > 1) + 1031, v78, 0, *(__int64 *)&v6);
v52 = _mm_load_si128((const __m128i *)&xmmword_1800EC5C0).m128i_u32[0];
}
v81 = 0.0;
v82 = 0.0;
v83 = (float)v115;
if ( COERCE_FLOAT(LODWORD(v83) & v52) > 7849.0 )
{
if ( v83 <= 0.0 )
v84 = v83 + 7849.0;
else
v84 = v83 + -7849.0;
v81 = v84 / 24918.0;
}
v85 = (float)v116;
if ( COERCE_FLOAT(LODWORD(v85) & v52) > 7849.0 )
{
if ( v85 <= 0.0 )
v86 = v85 + 7849.0;
else
v86 = v85 + -7849.0;
v82 = -(float)(v86 / 24918.0);
}
if ( v81 != 0.0 || v82 != 0.0 )
{
v87 = kmVec2Fill((float *)&PerformanceCount, v81 * 10.0, v82 * 10.0);
cocos2d::CCSize::operator=((_DWORD *)this + 44, v87);
}
v88 = *((_BYTE *)a2 + 41);
if ( v88 )
v89 = 0.15000001;
else
v89 = 0.2;
v90 = (float)-v89 >= v81;
if ( v90 != v88 )
{
*((_BYTE *)a2 + 41) = v90;
v91 = cocos2d::CCDirector::sharedDirector();
v92 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v91 + 176LL))(v91);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v92, (a3 > 1) + 1041, v90, 0, *(__int64 *)&v6);
}
v93 = *((_BYTE *)a2 + 42);
if ( v93 )
v94 = 0.15000001;
else
v94 = 0.2;
v95 = v81 >= v94;
if ( v81 >= v94 != v93 )
{
*((_BYTE *)a2 + 42) = v95;
v96 = cocos2d::CCDirector::sharedDirector();
v97 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v96 + 176LL))(v96);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v97, (a3 > 1) + 1043, v95, 0, *(__int64 *)&v6);
}
v98 = *((_BYTE *)a2 + 39);
if ( v98 )
v99 = 0.15000001;
else
v99 = 0.2;
v100 = (float)-v99 >= v82;
if ( v100 != v98 )
{
*((_BYTE *)a2 + 39) = v100;
v101 = cocos2d::CCDirector::sharedDirector();
v102 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v101 + 176LL))(v101);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v102, (a3 > 1) + 1037, v100, 0, *(__int64 *)&v6);
}
v103 = *((_BYTE *)a2 + 40);
if ( !v103 )
v61 = 0.2;
v104 = v82 >= v61;
if ( v82 >= v61 != v103 )
{
*((_BYTE *)a2 + 40) = v104;
v105 = cocos2d::CCDirector::sharedDirector();
LOBYTE(v7) = a3 > 1;
v106 = (*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v105 + 176LL))(v105);
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v106, v7 + 1039, v104, 0, *(__int64 *)&v6);
}
}
}