#include "XCTRL.h" #include "FTTInput.h" #include "CFE.h" #include "GFXRENDER.h" struct XCTRL_Touch { TPoint ttouchDownPos_0; TPoint tpos_8; uint8 bWipe_10; //是否向右滑动 bool bisReleased_11; bool bisPressed_12; bool bisTouch_13; bool bisDoubleTapped_14; //是否双击 bool bfield_15; bool bfield_16; bool bfield_17; int ilastTime_18; int touchDownTime_1C; }; MYSTATIC XCTRL_Touch gs_ptouchEventHW_34A490[4]; MYSTATIC XCTRL_Touch gs_ptouchEvent_34A510[4]; MYSTATIC int gs_icount_34A590; //未使用会被优化掉 MYSTATIC int gs_icountHW_34A594; //未使用会被优化掉 MYSTATIC int gs_i_34A598; //未使用会被优化掉 //0x0011AA24 ^_^ void sub_11AA24() { } //------------------------------------------------------------------------------------------------- //0011A5C4 void XCTRL_ProcessHW() { } //------------------------------------------------------------------------------------------------- //0011A5C8 // void XCTRL_TouchSetHWToDevice() { // for (int i = 0; i != 4; i++) { // TPoint tp1 = gs_ptouchEvent_34A510[i].ttouchDownPos_0; // int ilastTime = gs_ptouchEvent_34A510[i].ilastTime_18; // int touchDownTime = gs_ptouchEvent_34A510[i].touchDownTime_1C; // memcpy(&gs_ptouchEvent_34A510[i], &gs_ptouchEventHW_34A490[i], sizeof(XCTRL_Touch)); // gs_ptouchEvent_34A510[i].ttouchDownPos_0 = tp1; // gs_ptouchEvent_34A510[i].ilastTime_18 = ilastTime; // gs_ptouchEvent_34A510[i].touchDownTime_1C = touchDownTime; // } // gs_icount_34A590 = gs_icountHW_34A594; // for (int i = 0; i != 4; i++) { // if (gs_ptouchEvent_34A510[i].bisPressed_12) { // gs_ptouchEvent_34A510[i].ttouchDownPos_0 = // gs_ptouchEvent_34A510[i].tpos_8; // gs_ptouchEvent_34A510[i].touchDownTime_1C = 0; // } // if (gs_ptouchEvent_34A510[i].bisTouch_13) // gs_ptouchEvent_34A510[i].touchDownTime_1C++; // } // sub_11AA24(); // for (int i = 0; i != 4; i++) { // gs_ptouchEvent_34A510[i].bWipe_10 = 0; // if (gs_ptouchEvent_34A510[i].bisReleased_11) { // int ix = gs_ptouchEvent_34A510[i].tpos_8.dx_0 - // gs_ptouchEvent_34A510[i].ttouchDownPos_0.dx_0; // int iy = gs_ptouchEvent_34A510[i].tpos_8.dy_4 - // gs_ptouchEvent_34A510[i].ttouchDownPos_0.dy_4; // if ((ix * ix + iy * iy) > 0x400) { // int iabsX = ix; // int iabsY = iy; // if (iy < 0) // iabsY = -iy; // if (ix < 0) // iabsX = -ix; // if (iabsX <= iabsY) { // if (iy >= 1) // gs_ptouchEvent_34A510[i].bWipe_10 = 2; // else // gs_ptouchEvent_34A510[i].bWipe_10 = 1; // } else if (ix >= 1) { // gs_ptouchEvent_34A510[i].bWipe_10 = 4; // } else // gs_ptouchEvent_34A510[i].bWipe_10 = 3; // } // } // } // } //------------------------------------------------------------------------------------------------- //0011A5CC void XCTRL_Process_ClearTriggers() { LOGE("XCTRL_Process_ClearTriggers"); } //------------------------------------------------------------------------------------------------- //0011A5D0 bool XCTRL_TouchHWIsPressed() { return false; } //------------------------------------------------------------------------------------------------- //0011A5DC ^_^ bool XCTRL_TouchHWIsReleased() { return false; } //------------------------------------------------------------------------------------------------- //0011A5E8 ^_^ bool XCTRL_TouchHWIsTouching() { return false; } //------------------------------------------------------------------------------------------------- //0011A5F4 TPoint XCTRL_TouchHWGetPos() { TPoint d; return d; } //------------------------------------------------------------------------------------------------- //0011A608 int XCTRL_TouchGetCount() { return 10; } //------------------------------------------------------------------------------------------------- //0011A614 ^_^ bool XCTRL_TouchIsTouching(int i1) { return false; } //------------------------------------------------------------------------------------------------- //0011A624 TPoint XCTRL_TouchGetDownPos(int dIndex) { TPoint d; return d; } //------------------------------------------------------------------------------------------------- //0011A63C ^_^ void XCTRL_TouchSetDownPos(int i1, TPoint tPoint2) { } //------------------------------------------------------------------------------------------------- //0011a654 ^_^ int XCTRL_TouchGetDownTime(int i1) { return 12; } //------------------------------------------------------------------------------------------------- //0011A664 //^_^ TPoint XCTRL_TouchGetPos(int dIndex) { TPoint d; return d; } //------------------------------------------------------------------------------------------------- //0011A67C ^_^ int XCTRL_TouchLastTime(int i1) { return false; } //------------------------------------------------------------------------------------------------- //0011A68C ^_^ bool XCTRL_TouchIsPressed(int i1) { return false; } //------------------------------------------------------------------------------------------------- //0011A69C ^_^ bool XCTRL_TouchIsReleased(int i1) { return false; } //------------------------------------------------------------------------------------------------- //0011A6AC bool XCTRL_TouchIsDoubleTapped(int i1) { return false; } //------------------------------------------------------------------------------------------------- //0011A6BC ^_^ bool XCTRL_TouchGetSwipe(int i1) { return false; } //------------------------------------------------------------------------------------------------- //0011A6CC void XCTRL_TouchResetHW() { } //------------------------------------------------------------------------------------------------- //0011A6EC ^_^ void XCTRL_TouchReset() { } //------------------------------------------------------------------------------------------------- //0011A70C void XCTRL_TouchProcessHW() { // if (CFTTRewardedVideos::AdOnScreen() == false) { gs_i_34A598++; // loc_11A73C for (int i = 0; i < gs_icountHW_34A594; i++) { if (gs_ptouchEventHW_34A490[i].bisReleased_11 || gs_ptouchEventHW_34A490[i].bisTouch_13 == false) { memmove(&gs_ptouchEventHW_34A490[i], &gs_ptouchEventHW_34A490[i + 1], (3 - i) * sizeof(XCTRL_Touch)); gs_icountHW_34A594--; i--; memset(&gs_ptouchEventHW_34A490[gs_icountHW_34A594], 0, sizeof(XCTRL_Touch)); } else if (gs_ptouchEventHW_34A490[i].bisPressed_12) { gs_ptouchEventHW_34A490[i].bisPressed_12 = false; } } // loc_11A77E do { // loc_11A8C2 TPoint tpos; UseByAddTouchEvent_Internal touvhEvent = FTTInput_GetTouchEvent(); if (touvhEvent.field_0 == ETouchEvent_neg1) return; // loc_11A7AC tpos.dx_0 = (touvhEvent.field_4 * SCR_WID) / CFE::s_fHardwareWidth; tpos.dy_4 = (touvhEvent.field_8 * SCR_HEI) / CFE::s_fHardwareHeight; if (touvhEvent.field_0 != ETouchEvent_0) { if (gs_icountHW_34A594 < 1) continue; else { int i_r10 = 0x7FFFFFFF; int j = 0; for (int i = 0; i < gs_icountHW_34A594; i++) { if (gs_ptouchEventHW_34A490[i].bisTouch_13) { int i_distance_r0 = XMATH_Distance(&tpos, &gs_ptouchEventHW_34A490[i].tpos_8); if (i_distance_r0 < i_r10) { j = i; i_r10 = i_distance_r0; } } } switch (touvhEvent.field_0) { case ETouchEvent_1: case ETouchEvent_3: { // loc_11A852 gs_ptouchEventHW_34A490[j].bisTouch_13 = false; gs_ptouchEventHW_34A490[j].bisReleased_11 = true; gs_ptouchEventHW_34A490[j].bisPressed_12 = false; break; } case ETouchEvent_Touch_2: { // loc_11A8A8 gs_ptouchEventHW_34A490[j].bisTouch_13 = true; gs_ptouchEventHW_34A490[j].tpos_8 = &tpos; break; } } } } else if (gs_icountHW_34A594 <= 3) { // loc_11A864 ok memset(&gs_ptouchEventHW_34A490[gs_icountHW_34A594], 0, sizeof(XCTRL_Touch)); gs_ptouchEventHW_34A490[gs_icountHW_34A594].bisPressed_12 = 1; gs_ptouchEventHW_34A490[gs_icountHW_34A594].bisTouch_13 = 1; gs_ptouchEventHW_34A490[gs_icountHW_34A594].tpos_8 = &tpos; gs_ptouchEventHW_34A490[gs_icountHW_34A594].ttouchDownPos_0 = &tpos; gs_icountHW_34A594++; } } while (1); } // loc_11A8D0 } //------------------------------------------------------------------------------------------------- //0011A8F8 ^_^ void XCTRL_TouchSetHWToDevice() { for (int i = 0; i != 4; i++) { TPoint tp1 = gs_ptouchEvent_34A510[i].ttouchDownPos_0; int ilastTime = gs_ptouchEvent_34A510[i].ilastTime_18; int touchDownTime = gs_ptouchEvent_34A510[i].touchDownTime_1C; memcpy(&gs_ptouchEvent_34A510[i], &gs_ptouchEventHW_34A490[i], sizeof(XCTRL_Touch)); gs_ptouchEvent_34A510[i].ttouchDownPos_0 = tp1; gs_ptouchEvent_34A510[i].ilastTime_18 = ilastTime; gs_ptouchEvent_34A510[i].touchDownTime_1C = touchDownTime; } gs_icount_34A590 = gs_icountHW_34A594; for (int i = 0; i != 4; i++) { if (gs_ptouchEvent_34A510[i].bisPressed_12) { gs_ptouchEvent_34A510[i].ttouchDownPos_0 = gs_ptouchEvent_34A510[i].tpos_8; gs_ptouchEvent_34A510[i].touchDownTime_1C = 0; } if (gs_ptouchEvent_34A510[i].bisTouch_13) gs_ptouchEvent_34A510[i].touchDownTime_1C++; } sub_11AA24(); for (int i = 0; i != 4; i++) { gs_ptouchEvent_34A510[i].bWipe_10 = 0; if (gs_ptouchEvent_34A510[i].bisReleased_11) { int ix = gs_ptouchEvent_34A510[i].tpos_8.dx_0 - gs_ptouchEvent_34A510[i].ttouchDownPos_0.dx_0; int iy = gs_ptouchEvent_34A510[i].tpos_8.dy_4 - gs_ptouchEvent_34A510[i].ttouchDownPos_0.dy_4; if ((ix * ix + iy * iy) > 0x400) { int iabsX = ix; int iabsY = iy; if (iy < 0) iabsY = -iy; if (ix < 0) iabsX = -ix; if (iabsX <= iabsY) { if (iy >= 1) gs_ptouchEvent_34A510[i].bWipe_10 = 2; else gs_ptouchEvent_34A510[i].bWipe_10 = 1; } else if (ix >= 1) { gs_ptouchEvent_34A510[i].bWipe_10 = 4; } else gs_ptouchEvent_34A510[i].bWipe_10 = 3; } } } } //------------------------------------------------------------------------------------------------- //0011A9F4 void XCTRL_TouchProcess_ClearTriggers() { LOGE("XCTRL_TouchProcess_ClearTriggers"); } //-------------------------------------------------------------------------------------------------