From ac2ec82779e7d45e789b7882b97c0e8c60bb42cb Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 20 Jun 2018 15:07:15 +0200 Subject: [PATCH] Fix types --- .../controller_patcher/ControllerPatcher.hpp | 40 +- .../ControllerPatcherDefs.h | 64 +- source/ConfigReader.cpp | 8 +- source/ConfigReader.hpp | 8 +- source/ControllerPatcher.cpp | 628 +++++++++--------- source/config/ConfigParser.cpp | 48 +- source/config/ConfigParser.hpp | 24 +- source/config/ConfigValues.cpp | 20 +- source/config/ConfigValues.hpp | 48 +- source/network/CPTCPServer.cpp | 34 +- source/network/CPTCPServer.hpp | 10 +- source/network/UDPClient.cpp | 6 +- source/network/UDPClient.hpp | 6 +- source/network/UDPServer.cpp | 40 +- source/network/UDPServer.hpp | 8 +- source/patcher/ControllerPatcherHID.cpp | 116 ++-- source/patcher/ControllerPatcherHID.hpp | 22 +- source/patcher/ControllerPatcherUtils.cpp | 172 ++--- source/patcher/ControllerPatcherUtils.hpp | 48 +- source/utils/CPRetainVars.cpp | 58 +- source/utils/CPRetainVars.hpp | 58 +- 21 files changed, 733 insertions(+), 733 deletions(-) diff --git a/include/controller_patcher/ControllerPatcher.hpp b/include/controller_patcher/ControllerPatcher.hpp index fd46671..55f556e 100644 --- a/include/controller_patcher/ControllerPatcher.hpp +++ b/include/controller_patcher/ControllerPatcher.hpp @@ -48,7 +48,7 @@ public: devoptabs! If no configuration should be loaded from the SD Card, set this parameter to NULL. **/ - static bool Init(const char * pathToConfig); + static BOOL Init(const char * pathToConfig); /** \brief De-Initialises the controller_patcher @@ -84,7 +84,7 @@ public: @return When the functions failed result < 0 is returned. If the result is == 0 the function was successful. **/ - static CONTROLLER_PATCHER_RESULT_OR_ERROR setProControllerDataFromHID(void * data,s32 chan,s32 mode = PRO_CONTROLLER_MODE_KPADDATA); + static CONTROLLER_PATCHER_RESULT_OR_ERROR setProControllerDataFromHID(void * data,int32_t chan,int32_t mode = PRO_CONTROLLER_MODE_KPADDATA); /** @@ -151,14 +151,14 @@ public: @return The first active mapping slot for the given controller type will be returned. If the controller type is not set active, -1 will be returned. **/ - static s32 getActiveMappingSlot(UController_Type type); + static int32_t getActiveMappingSlot(UController_Type type); /** @param type: The type of the controller. @param mapping_slot: information about the added controller. @return When the functions failed result < 0 is returned. Otherwise a pointer to a ControllerMappingPADInfo is returned. **/ - static ControllerMappingPADInfo * getControllerMappingInfo(UController_Type type,s32 mapping_slot); + static ControllerMappingPADInfo * getControllerMappingInfo(UController_Type type,int32_t mapping_slot); /** Checks if a emulated controller is connected for the given controller type / mapping slot. @@ -168,7 +168,7 @@ public: @return **/ - static bool isControllerConnectedAndActive(UController_Type type,s32 mapping_slot = 0); + static BOOL isControllerConnectedAndActive(UController_Type type,int32_t mapping_slot = 0); /** Search for a connected mouse and returns a pointer to it's data. @@ -184,7 +184,7 @@ public: @return When the functions failed result < 0 is returned. If the result is == 0 the function was successful. **/ - static CONTROLLER_PATCHER_RESULT_OR_ERROR setRumble(UController_Type type,u32 status); + static CONTROLLER_PATCHER_RESULT_OR_ERROR setRumble(UController_Type type,uint32_t status); /** Reads the input of all connected HID devices. Each attached controller will write his date into given array until it's full. @@ -194,7 +194,7 @@ public: @return When the functions failed result < 0 is returned. If the result is == 0 the function was successful. If the result is > 0 the number of stored sets in the array is returned. **/ - static CONTROLLER_PATCHER_RESULT_OR_ERROR gettingInputAllDevices(InputData * output,s32 array_size); + static CONTROLLER_PATCHER_RESULT_OR_ERROR gettingInputAllDevices(InputData * output,int32_t array_size); /** Remaps the buttons in the given \p VPADStatus pointer. InitButtonMapping() needs to be called before calling this. The information about the remapping is stored in the config_controller array. @@ -204,7 +204,7 @@ public: @return When the functions failed result < 0 is returned. If the result is == 0 the function was successful. **/ - static CONTROLLER_PATCHER_RESULT_OR_ERROR buttonRemapping(VPADStatus * buffer, s32 buffer_count); + static CONTROLLER_PATCHER_RESULT_OR_ERROR buttonRemapping(VPADStatus * buffer, int32_t buffer_count); /** Prints the current pressed down buttons of the given \p VPADStatus pointer. Uses the utils/logger.c UDP logger.. @@ -215,35 +215,35 @@ public: **/ static CONTROLLER_PATCHER_RESULT_OR_ERROR printVPADButtons(VPADStatus * buffer); - static std::string getIdentifierByVIDPID(u16 vid,u16 pid); + static std::string getIdentifierByVIDPID(uint16_t vid,uint16_t pid); static void destroyConfigHelper(); - static CONTROLLER_PATCHER_RESULT_OR_ERROR doSamplingForDeviceSlot(u16 device_slot); + static CONTROLLER_PATCHER_RESULT_OR_ERROR doSamplingForDeviceSlot(uint16_t device_slot); - static CONTROLLER_PATCHER_RESULT_OR_ERROR setRumbleActivated(bool value); + static CONTROLLER_PATCHER_RESULT_OR_ERROR setRumbleActivated(BOOL value); - static CONTROLLER_PATCHER_RESULT_OR_ERROR setNetworkControllerActivated(bool value); + static CONTROLLER_PATCHER_RESULT_OR_ERROR setNetworkControllerActivated(BOOL value); - static bool isRumbleActivated(); + static BOOL isRumbleActivated(); - static bool isButtonRemappingDone(); + static BOOL isButtonRemappingDone(); - static bool isKeyboardConnected(); + static BOOL isKeyboardConnected(); - static bool areControllersConnected(); + static BOOL areControllersConnected(); static CONTROLLER_PATCHER_RESULT_OR_ERROR sampleKeyboardData(); static CONTROLLER_PATCHER_RESULT_OR_ERROR resetCallbackData(); - static CONTROLLER_PATCHER_RESULT_OR_ERROR setKPADConnectedCallback(s32 chan, WPADConnectCallback callback); + static CONTROLLER_PATCHER_RESULT_OR_ERROR setKPADConnectedCallback(int32_t chan, WPADConnectCallback callback); - static CONTROLLER_PATCHER_RESULT_OR_ERROR setKPADExtensionCallback(s32 chan, WPADConnectCallback callback); + static CONTROLLER_PATCHER_RESULT_OR_ERROR setKPADExtensionCallback(int32_t chan, WPADConnectCallback callback); - static CONTROLLER_PATCHER_RESULT_OR_ERROR setWPADConnectCallback(s32 chan, WPADConnectCallback callback); + static CONTROLLER_PATCHER_RESULT_OR_ERROR setWPADConnectCallback(int32_t chan, WPADConnectCallback callback); - static CONTROLLER_PATCHER_RESULT_OR_ERROR handleCallbackData(bool button_pressed); + static CONTROLLER_PATCHER_RESULT_OR_ERROR handleCallbackData(BOOL button_pressed); static CONTROLLER_PATCHER_RESULT_OR_ERROR handleCallbackDataInternal(WPADChan chan); }; diff --git a/include/controller_patcher/ControllerPatcherDefs.h b/include/controller_patcher/ControllerPatcherDefs.h index bc86b08..5b82f09 100644 --- a/include/controller_patcher/ControllerPatcherDefs.h +++ b/include/controller_patcher/ControllerPatcherDefs.h @@ -218,35 +218,35 @@ enum Controller_Patcher_DPAD_Settings { * @brief Stores data if the Slot the device is using in gHID_Devices */ typedef struct _HIDSlotData { - u16 deviceslot; /**< deviceslot number */ - u32 hidmask; /**< Used HID-Mask */ + uint16_t deviceslot; /**< deviceslot number */ + uint32_t hidmask; /**< Used HID-Mask */ } HIDSlotData; /** * @brief Struct where the data for the callback funtion is stored */ typedef struct _my_cb_user { - u8 *buf; /**< pointer the buffer that is used */ - u32 transfersize; /**< number of transfered data */ - u32 handle; /**< HID handle */ + uint8_t *buf; /**< pointer the buffer that is used */ + uint32_t transfersize; /**< number of transfered data */ + uint32_t handle; /**< HID handle */ HIDSlotData slotdata; /**< Information about the deviceslot and hidmask */ - u32 pads_per_device; /**< Number of maximum pads of this device */ - u8 pad_slot; /**< number of the pad that will be used */ - u8 rumblestatus[HID_MAX_PADS_COUNT]; /**< Current status of the device rumble */ - u8 forceRumbleInTicks[HID_MAX_PADS_COUNT]; + uint32_t pads_per_device; /**< Number of maximum pads of this device */ + uint8_t pad_slot; /**< number of the pad that will be used */ + uint8_t rumblestatus[HID_MAX_PADS_COUNT]; /**< Current status of the device rumble */ + uint8_t forceRumbleInTicks[HID_MAX_PADS_COUNT]; } my_cb_user; /** * @brief Stores data for the mouse */ typedef struct _HID_Mouse_Data { - u8 left_click; /**< Is 1 when the left mouse button is pressed */ - u8 right_click; /**< Is 1 when the right mouse button is pressed */ - s16 X; /**< X position of the cursor */ - s16 Y; /**< Y position of the cursor */ - s16 deltaX; /**< difference of the X value since the last call */ - s16 deltaY; /**< difference of the Y value since the last call */ - u8 valuedChanged; /**< Is 1 when the value has changed */ + uint8_t left_click; /**< Is 1 when the left mouse button is pressed */ + uint8_t right_click; /**< Is 1 when the right mouse button is pressed */ + int16_t X; /**< X position of the cursor */ + int16_t Y; /**< Y position of the cursor */ + int16_t deltaX; /**< difference of the X value since the last call */ + int16_t deltaY; /**< difference of the Y value since the last call */ + uint8_t valuedChanged; /**< Is 1 when the value has changed */ } HID_Mouse_Data; /** @@ -261,14 +261,14 @@ enum DEVICE_TYPE { * @brief Stores all data of the HID Device for accessing */ typedef struct _HID_Data { - u32 handle; /**< The HID-handle this device is using */ - u8 rumbleActive; /**< 1 when rumble is active */ - u32 last_buttons; /**< The last pressed buttons, based on VPAD_BUTTON_XXX data */ + uint32_t handle; /**< The HID-handle this device is using */ + uint8_t rumbleActive; /**< 1 when rumble is active */ + uint32_t last_buttons; /**< The last pressed buttons, based on VPAD_BUTTON_XXX data */ union { struct { - u8 cur_hid_data[HID_MAX_DATA_LENGTH_PER_PAD]; /**< Array where the current controller data is stored */ - u8 last_hid_data[HID_MAX_DATA_LENGTH_PER_PAD]; /**< Array where the last controller data is stored */ - } controller; /**< Used when the device in a controller. Using u8 array where the raw data of the controller is placed. */ + uint8_t cur_hid_data[HID_MAX_DATA_LENGTH_PER_PAD]; /**< Array where the current controller data is stored */ + uint8_t last_hid_data[HID_MAX_DATA_LENGTH_PER_PAD]; /**< Array where the last controller data is stored */ + } controller; /**< Used when the device in a controller. Using uint8_t array where the raw data of the controller is placed. */ struct { HID_Mouse_Data cur_mouse_data; /**< Struct where the current mouse data is stored */ HID_Mouse_Data last_mouse_data; /**< Struct where the last mouse data is stored */ @@ -292,8 +292,8 @@ typedef struct _HID_DEVICE_DATA { * @brief Stores a VID and PID */ typedef struct _DeviceVIDPIDInfo { - u16 vid; /**< Vendor ID of this device */ - u16 pid; /**< Product ID of this device */ + uint16_t vid; /**< Vendor ID of this device */ + uint16_t pid; /**< Product ID of this device */ } DeviceVIDPIDInfo; /** @@ -302,7 +302,7 @@ typedef struct _DeviceVIDPIDInfo { typedef struct _DeviceInfo { HIDSlotData slotdata; /**< The slot used by this device */ DeviceVIDPIDInfo vidpid; /**< The VID/PID of the device */ - u8 pad_count; /**< Number of maximum pads this device can have*/ + uint8_t pad_count; /**< Number of maximum pads this device can have*/ } DeviceInfo; /** @@ -319,10 +319,10 @@ enum ControllerMapping_Type_Defines { * @brief Infos of a mapped controller */ typedef struct _ControllerMappingPADInfo { - u8 active; /**< Set to one if mapped */ + uint8_t active; /**< Set to one if mapped */ ControllerMapping_Type_Defines type; /**< Type of the controller mapping */ DeviceVIDPIDInfo vidpid; /**< The VID/PID of the device */ - u8 pad; /**< Stores which pad it mapped */ + uint8_t pad; /**< Stores which pad it mapped */ } ControllerMappingPADInfo; /** @@ -330,8 +330,8 @@ typedef struct _ControllerMappingPADInfo { */ typedef struct _ControllerMappingPAD { ControllerMappingPADInfo pad_infos[HID_MAX_DEVICES_PER_SLOT]; //lets limit this to HID_MAX_DEVICES_PER_SLOT. - u8 useAll; - u8 rumble; /**< Set when the controller should rumble */ + uint8_t useAll; + uint8_t rumble; /**< Set when the controller should rumble */ } ControllerMappingPAD; /** @@ -346,9 +346,9 @@ typedef struct _ControllerMapping { * @brief Pressed/Released/Down Button data. */ typedef struct _InputButtonData { - u32 btn_h; /**< Buttons beeing hold */ - u32 btn_d; /**< Buttons that started pressing */ - u32 btn_r; /**< Buttons that were button released */ + uint32_t btn_h; /**< Buttons beeing hold */ + uint32_t btn_d; /**< Buttons that started pressing */ + uint32_t btn_r; /**< Buttons that were button released */ } InputButtonData; /** diff --git a/source/ConfigReader.cpp b/source/ConfigReader.cpp index 0eb612b..3679ce5 100644 --- a/source/ConfigReader.cpp +++ b/source/ConfigReader.cpp @@ -31,13 +31,13 @@ #include -s32 ConfigReader::numberValidFiles = 0; +int32_t ConfigReader::numberValidFiles = 0; ConfigReader *ConfigReader::instance = NULL; ConfigReader::ConfigReader() { } -bool ConfigReader::ReadConfigs(std::string path) { +BOOL ConfigReader::ReadConfigs(std::string path) { std::vector fileList = ScanFolder(path); if(fileList.size() == 1 && fileList[0].compare("ERROR") == 0) { return false; @@ -70,7 +70,7 @@ std::vector ConfigReader::ScanFolder(std::string path) { return config_files; } while ((dirent = readdir(dirHandle)) != 0) { - bool isDir = dirent->d_type & DT_DIR; + BOOL isDir = dirent->d_type & DT_DIR; const char *filename = dirent->d_name; if(strcmp(filename,".") == 0 || strcmp(filename,"..") == 0) { @@ -102,7 +102,7 @@ void ConfigReader::processFileList(std::vector path) { std::string ConfigReader::loadFileToString(std::string path) { std::string strBuffer = ""; - u8 * buffer = NULL; + uint8_t * buffer = NULL; if(FSUtils::LoadFileToMem(path.c_str(),&buffer,NULL) > 0) { strBuffer = std::string((char *)buffer); strBuffer = StringTools::removeCharFromString(strBuffer,'\r'); diff --git a/source/ConfigReader.hpp b/source/ConfigReader.hpp index 0e6fbd8..7204ead 100644 --- a/source/ConfigReader.hpp +++ b/source/ConfigReader.hpp @@ -40,22 +40,22 @@ class ConfigReader{ } } - static s32 getNumberOfLoadedFiles(){ + static int32_t getNumberOfLoadedFiles(){ return ConfigReader::numberValidFiles; } static void increaseNumberOfLoadedFiles(){ ConfigReader::numberValidFiles++; } - bool ReadConfigs(std::string path); - static s32 numberValidFiles; + BOOL ReadConfigs(std::string path); + static int32_t numberValidFiles; //!Constructor ConfigReader(); //!Destructor ~ConfigReader(); - s32 InitSDCard(); + int32_t InitSDCard(); static ConfigReader *instance; diff --git a/source/ControllerPatcher.cpp b/source/ControllerPatcher.cpp index 997c53a..0be3aec 100644 --- a/source/ControllerPatcher.cpp +++ b/source/ControllerPatcher.cpp @@ -27,12 +27,12 @@ #include // This stores the holded buttons for the gamepad after the button remapping. -static u32 buttonRemapping_lastButtonsHold = 0; +static uint32_t buttonRemapping_lastButtonsHold = 0; /* To set the controls of an Pro Controler, we first get the result for an Gamepad and convert them later. This way both can share the same functions.*/ -// This arrays stores the last hold buttons of the Pro Controllers. One u32 for each channel of the controllers -static u32 last_button_hold[4] = {0,0,0,0}; +// This arrays stores the last hold buttons of the Pro Controllers. One uint32_t for each channel of the controllers +static uint32_t last_button_hold[4] = {0,0,0,0}; // This arrays stores the VPADStatus that will be used to get the HID Data for the Pro Controllers. One for each channel. static VPADStatus myVPADBuffer[4]; @@ -118,8 +118,8 @@ void ControllerPatcher::ResetConfig() { } ControllerPatcherUtils::getNextSlotData(&slotdata); - u32 keyboard_slot = slotdata.deviceslot; - u32 keyboard_hid = slotdata.hidmask; + uint32_t keyboard_slot = slotdata.deviceslot; + uint32_t keyboard_hid = slotdata.hidmask; gHID_LIST_KEYBOARD = keyboard_hid; gHID_SLOT_KEYBOARD = keyboard_slot; @@ -128,8 +128,8 @@ void ControllerPatcher::ResetConfig() { } ControllerPatcherUtils::getNextSlotData(&slotdata); - u32 gc_slot = slotdata.deviceslot; - u32 gc_hid = slotdata.hidmask; + uint32_t gc_slot = slotdata.deviceslot; + uint32_t gc_hid = slotdata.hidmask; gHID_LIST_GC = gc_hid; gHID_SLOT_GC = gc_slot; if(HID_DEBUG) { @@ -137,30 +137,30 @@ void ControllerPatcher::ResetConfig() { } ControllerPatcherUtils::getNextSlotData(&slotdata); - u32 ds3_slot = slotdata.deviceslot; - u32 ds3_hid = slotdata.hidmask; + uint32_t ds3_slot = slotdata.deviceslot; + uint32_t ds3_hid = slotdata.hidmask; gHID_LIST_DS3 = ds3_hid; if(HID_DEBUG) { DEBUG_FUNCTION_LINE("Register DS3-Config. HID-Mask %s Device-Slot: %d\n",StringTools::byte_to_binary(gHID_LIST_DS3),ds3_slot); } ControllerPatcherUtils::getNextSlotData(&slotdata); - u32 ds4_slot = slotdata.deviceslot; - u32 ds4_hid = slotdata.hidmask; + uint32_t ds4_slot = slotdata.deviceslot; + uint32_t ds4_hid = slotdata.hidmask; gHID_LIST_DS4 = ds4_hid; if(HID_DEBUG) { DEBUG_FUNCTION_LINE("Register DS4-Config. HID-Mask %s Device-Slot: %d\n",StringTools::byte_to_binary(ds4_hid),ds4_slot); } ControllerPatcherUtils::getNextSlotData(&slotdata); - u32 xinput_slot = slotdata.deviceslot; - u32 xinput_hid = slotdata.hidmask; + uint32_t xinput_slot = slotdata.deviceslot; + uint32_t xinput_hid = slotdata.hidmask; if(HID_DEBUG) { DEBUG_FUNCTION_LINE("Register XInput-Config. HID-Mask %s Device-Slot: %d\n",StringTools::byte_to_binary(xinput_hid),xinput_slot); } ControllerPatcherUtils::getNextSlotData(&slotdata); - u32 switch_pro_slot = slotdata.deviceslot; + uint32_t switch_pro_slot = slotdata.deviceslot; gHID_LIST_SWITCH_PRO = slotdata.hidmask; DEBUG_FUNCTION_LINE("Register Switch-Pro-Config. HID-Mask %s Device-Slot: %d\n",StringTools::byte_to_binary(gHID_LIST_SWITCH_PRO),switch_pro_slot); @@ -177,325 +177,325 @@ void ControllerPatcher::ResetConfig() { //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //! GamePad //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gGamePadSlot][CONTRPS_VID], 0xAF,0xFE); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gGamePadSlot][CONTRPS_PID], 0xAA,0xAA); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gGamePadSlot][CONTRPS_VID], 0xAF,0xFE); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gGamePadSlot][CONTRPS_PID], 0xAA,0xAA); //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //! Switch Pro Controller //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VID], (HID_SWITCH_PRO_VID>>8)&0xFF, HID_SWITCH_PRO_VID&0xFF); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_PID], (HID_SWITCH_PRO_PID>>8)&0xFF, HID_SWITCH_PRO_PID&0xFF); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_A], HID_SWITCH_PRO_BT_BUTTON_A[0], HID_SWITCH_PRO_BT_BUTTON_A[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_B], HID_SWITCH_PRO_BT_BUTTON_B[0], HID_SWITCH_PRO_BT_BUTTON_B[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_X], HID_SWITCH_PRO_BT_BUTTON_X[0], HID_SWITCH_PRO_BT_BUTTON_X[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_Y], HID_SWITCH_PRO_BT_BUTTON_Y[0], HID_SWITCH_PRO_BT_BUTTON_Y[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_DPAD_MODE], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_BUTTON_DPAD_TYPE[CONTRDPAD_MODE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_DPAD_MASK], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_BUTTON_DPAD_TYPE[CONTRDPAD_MASK]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_N], HID_SWITCH_PRO_BT_BUTTON_DPAD_N[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_N[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_NE], HID_SWITCH_PRO_BT_BUTTON_DPAD_NE[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_NE[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_E], HID_SWITCH_PRO_BT_BUTTON_DPAD_E[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_E[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_SE], HID_SWITCH_PRO_BT_BUTTON_DPAD_SE[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_SE[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_S], HID_SWITCH_PRO_BT_BUTTON_DPAD_S[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_S[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_SW], HID_SWITCH_PRO_BT_BUTTON_DPAD_SW[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_SW[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_W], HID_SWITCH_PRO_BT_BUTTON_DPAD_W[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_W[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_NW], HID_SWITCH_PRO_BT_BUTTON_DPAD_NW[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_NW[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_NEUTRAL], HID_SWITCH_PRO_BT_BUTTON_DPAD_NEUTRAL[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_NEUTRAL[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_PLUS], HID_SWITCH_PRO_BT_BUTTON_PLUS[0], HID_SWITCH_PRO_BT_BUTTON_PLUS[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_MINUS], HID_SWITCH_PRO_BT_BUTTON_MINUS[0], HID_SWITCH_PRO_BT_BUTTON_MINUS[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L], HID_SWITCH_PRO_BT_BUTTON_L[0], HID_SWITCH_PRO_BT_BUTTON_L[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R], HID_SWITCH_PRO_BT_BUTTON_R[0], HID_SWITCH_PRO_BT_BUTTON_R[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_ZL], HID_SWITCH_PRO_BT_BUTTON_ZL[0], HID_SWITCH_PRO_BT_BUTTON_ZL[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_ZR], HID_SWITCH_PRO_BT_BUTTON_ZR[0], HID_SWITCH_PRO_BT_BUTTON_ZR[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_STICK_L], HID_SWITCH_PRO_BT_BUTTON_STICK_L[0], HID_SWITCH_PRO_BT_BUTTON_STICK_L[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_STICK_R], HID_SWITCH_PRO_BT_BUTTON_STICK_R[0], HID_SWITCH_PRO_BT_BUTTON_STICK_R[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_HOME], HID_SWITCH_PRO_BT_BUTTON_HOME[0], HID_SWITCH_PRO_BT_BUTTON_HOME[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_PAD_COUNT], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_PAD_COUNT); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VID], (HID_SWITCH_PRO_VID>>8)&0xFF, HID_SWITCH_PRO_VID&0xFF); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_PID], (HID_SWITCH_PRO_PID>>8)&0xFF, HID_SWITCH_PRO_PID&0xFF); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_A], HID_SWITCH_PRO_BT_BUTTON_A[0], HID_SWITCH_PRO_BT_BUTTON_A[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_B], HID_SWITCH_PRO_BT_BUTTON_B[0], HID_SWITCH_PRO_BT_BUTTON_B[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_X], HID_SWITCH_PRO_BT_BUTTON_X[0], HID_SWITCH_PRO_BT_BUTTON_X[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_Y], HID_SWITCH_PRO_BT_BUTTON_Y[0], HID_SWITCH_PRO_BT_BUTTON_Y[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_DPAD_MODE], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_BUTTON_DPAD_TYPE[CONTRDPAD_MODE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_DPAD_MASK], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_BUTTON_DPAD_TYPE[CONTRDPAD_MASK]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_N], HID_SWITCH_PRO_BT_BUTTON_DPAD_N[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_N[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_NE], HID_SWITCH_PRO_BT_BUTTON_DPAD_NE[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_NE[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_E], HID_SWITCH_PRO_BT_BUTTON_DPAD_E[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_E[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_SE], HID_SWITCH_PRO_BT_BUTTON_DPAD_SE[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_SE[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_S], HID_SWITCH_PRO_BT_BUTTON_DPAD_S[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_S[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_SW], HID_SWITCH_PRO_BT_BUTTON_DPAD_SW[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_SW[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_W], HID_SWITCH_PRO_BT_BUTTON_DPAD_W[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_W[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_NW], HID_SWITCH_PRO_BT_BUTTON_DPAD_NW[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_NW[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_DPAD_NEUTRAL], HID_SWITCH_PRO_BT_BUTTON_DPAD_NEUTRAL[0], HID_SWITCH_PRO_BT_BUTTON_DPAD_NEUTRAL[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_PLUS], HID_SWITCH_PRO_BT_BUTTON_PLUS[0], HID_SWITCH_PRO_BT_BUTTON_PLUS[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_MINUS], HID_SWITCH_PRO_BT_BUTTON_MINUS[0], HID_SWITCH_PRO_BT_BUTTON_MINUS[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L], HID_SWITCH_PRO_BT_BUTTON_L[0], HID_SWITCH_PRO_BT_BUTTON_L[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R], HID_SWITCH_PRO_BT_BUTTON_R[0], HID_SWITCH_PRO_BT_BUTTON_R[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_ZL], HID_SWITCH_PRO_BT_BUTTON_ZL[0], HID_SWITCH_PRO_BT_BUTTON_ZL[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_ZR], HID_SWITCH_PRO_BT_BUTTON_ZR[0], HID_SWITCH_PRO_BT_BUTTON_ZR[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_STICK_L], HID_SWITCH_PRO_BT_BUTTON_STICK_L[0], HID_SWITCH_PRO_BT_BUTTON_STICK_L[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_STICK_R], HID_SWITCH_PRO_BT_BUTTON_STICK_R[0], HID_SWITCH_PRO_BT_BUTTON_STICK_R[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_HOME], HID_SWITCH_PRO_BT_BUTTON_HOME[0], HID_SWITCH_PRO_BT_BUTTON_HOME[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_PAD_COUNT], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_PAD_COUNT); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L_STICK_X], HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_BYTE], HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX], HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_MIN], HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L_STICK_X], HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_BYTE], HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX], HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_MIN], HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_INVERT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y], HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_BYTE], HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_MINMAX], HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_MIN], HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y], HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_BYTE], HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_MINMAX], HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_MIN], HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_INVERT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R_STICK_X], HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_BYTE], HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_MINMAX], HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_MIN], HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R_STICK_X], HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_BYTE], HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_MINMAX], HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_MIN], HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_INVERT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y], HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_BYTE], HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_MINMAX], HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_MIN], HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y], HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_BYTE], HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_MINMAX], HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_MIN], HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[switch_pro_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_INVERT]); //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //! Mouse //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gMouseSlot][CONTRPS_VID], (HID_MOUSE_VID>>8)&0xFF, HID_MOUSE_VID&0xFF); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gMouseSlot][CONTRPS_PID], (HID_MOUSE_PID>>8)&0xFF, HID_MOUSE_PID&0xFF); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gMouseSlot][CONTRPS_VPAD_BUTTON_LEFT], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_ZR); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gMouseSlot][CONTRPS_VPAD_BUTTON_RIGHT], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_R); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gMouseSlot][CONTRPS_PAD_COUNT], CONTROLLER_PATCHER_VALUE_SET, HID_MOUSE_PAD_COUNT); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gMouseSlot][CONTRPS_VID], (HID_MOUSE_VID>>8)&0xFF, HID_MOUSE_VID&0xFF); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gMouseSlot][CONTRPS_PID], (HID_MOUSE_PID>>8)&0xFF, HID_MOUSE_PID&0xFF); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gMouseSlot][CONTRPS_VPAD_BUTTON_LEFT], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_ZR); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gMouseSlot][CONTRPS_VPAD_BUTTON_RIGHT], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_R); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gMouseSlot][CONTRPS_PAD_COUNT], CONTROLLER_PATCHER_VALUE_SET, HID_MOUSE_PAD_COUNT); //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //! Keyboard //!--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VID], (HID_KEYBOARD_VID>>8)&0xFF, HID_KEYBOARD_VID&0xFF); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_PID], (HID_KEYBOARD_PID>>8)&0xFF, HID_KEYBOARD_PID&0xFF); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_A], 0x00, HID_KEYBOARD_BUTTON_E); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_B], 0x00, HID_KEYBOARD_BUTTON_Q); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_X], 0x00, HID_KEYBOARD_BUTTON_SPACEBAR); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_Y], 0x00, HID_KEYBOARD_BUTTON_R); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_DPAD_MODE], CONTROLLER_PATCHER_VALUE_SET,CONTRPDM_Normal); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_LEFT], 0x00, HID_KEYBOARD_BUTTON_LEFT); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_RIGHT], 0x00, HID_KEYBOARD_BUTTON_RIGHT); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_DOWN], 0x00, HID_KEYBOARD_BUTTON_DOWN); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_UP], 0x00, HID_KEYBOARD_BUTTON_UP); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_PLUS], 0x00, HID_KEYBOARD_BUTTON_RETURN); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_MINUS], 0x00, HID_KEYBOARD_KEYPAD_BUTTON_MINUS); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_L], 0x00, HID_KEYBOARD_BUTTON_V); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_R], 0x00, HID_KEYBOARD_BUTTON_B); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_ZL], 0x00, HID_KEYBOARD_BUTTON_SHIFT); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_ZR], 0x00, HID_KEYBOARD_BUTTON_N); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_STICK_L], 0x00, HID_KEYBOARD_BUTTON_F); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_STICK_R], 0x00, HID_KEYBOARD_BUTTON_TAB); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VID], (HID_KEYBOARD_VID>>8)&0xFF, HID_KEYBOARD_VID&0xFF); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_PID], (HID_KEYBOARD_PID>>8)&0xFF, HID_KEYBOARD_PID&0xFF); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_A], 0x00, HID_KEYBOARD_BUTTON_E); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_B], 0x00, HID_KEYBOARD_BUTTON_Q); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_X], 0x00, HID_KEYBOARD_BUTTON_SPACEBAR); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_Y], 0x00, HID_KEYBOARD_BUTTON_R); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_DPAD_MODE], CONTROLLER_PATCHER_VALUE_SET,CONTRPDM_Normal); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_LEFT], 0x00, HID_KEYBOARD_BUTTON_LEFT); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_RIGHT], 0x00, HID_KEYBOARD_BUTTON_RIGHT); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_DOWN], 0x00, HID_KEYBOARD_BUTTON_DOWN); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_UP], 0x00, HID_KEYBOARD_BUTTON_UP); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_PLUS], 0x00, HID_KEYBOARD_BUTTON_RETURN); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_MINUS], 0x00, HID_KEYBOARD_KEYPAD_BUTTON_MINUS); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_L], 0x00, HID_KEYBOARD_BUTTON_V); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_R], 0x00, HID_KEYBOARD_BUTTON_B); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_ZL], 0x00, HID_KEYBOARD_BUTTON_SHIFT); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_ZR], 0x00, HID_KEYBOARD_BUTTON_N); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_STICK_L], 0x00, HID_KEYBOARD_BUTTON_F); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_STICK_R], 0x00, HID_KEYBOARD_BUTTON_TAB); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_L_STICK_UP], 0x00, HID_KEYBOARD_BUTTON_W); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_L_STICK_DOWN], 0x00, HID_KEYBOARD_BUTTON_S); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_L_STICK_LEFT], 0x00, HID_KEYBOARD_BUTTON_A); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_L_STICK_RIGHT], 0x00, HID_KEYBOARD_BUTTON_D); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_L_STICK_UP], 0x00, HID_KEYBOARD_BUTTON_W); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_L_STICK_DOWN], 0x00, HID_KEYBOARD_BUTTON_S); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_L_STICK_LEFT], 0x00, HID_KEYBOARD_BUTTON_A); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_L_STICK_RIGHT], 0x00, HID_KEYBOARD_BUTTON_D); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_R_STICK_UP], 0x00, HID_KEYBOARD_KEYPAD_BUTTON_8); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_R_STICK_DOWN], 0x00, HID_KEYBOARD_KEYPAD_BUTTON_2); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_R_STICK_LEFT], 0x00, HID_KEYBOARD_KEYPAD_BUTTON_4); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_R_STICK_RIGHT], 0x00, HID_KEYBOARD_KEYPAD_BUTTON_6); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_R_STICK_UP], 0x00, HID_KEYBOARD_KEYPAD_BUTTON_8); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_R_STICK_DOWN], 0x00, HID_KEYBOARD_KEYPAD_BUTTON_2); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_R_STICK_LEFT], 0x00, HID_KEYBOARD_KEYPAD_BUTTON_4); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_VPAD_BUTTON_R_STICK_RIGHT], 0x00, HID_KEYBOARD_KEYPAD_BUTTON_6); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_PAD_COUNT], CONTROLLER_PATCHER_VALUE_SET,HID_KEYBOARD_PAD_COUNT); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_KEYBOARD][CONTRPS_PAD_COUNT], CONTROLLER_PATCHER_VALUE_SET,HID_KEYBOARD_PAD_COUNT); //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //! GC-Adapter //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VID], (HID_GC_VID>>8)&0xFF, HID_GC_VID&0xFF); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_PID], (HID_GC_PID>>8)&0xFF, HID_GC_PID&0xFF); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_A], HID_GC_BUTTON_A[0], HID_GC_BUTTON_A[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_B], HID_GC_BUTTON_B[0], HID_GC_BUTTON_B[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_X], HID_GC_BUTTON_X[0], HID_GC_BUTTON_X[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_Y], HID_GC_BUTTON_Y[0], HID_GC_BUTTON_Y[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_DPAD_MODE], CONTROLLER_PATCHER_VALUE_SET, HID_GC_BUTTON_DPAD_TYPE[CONTRDPAD_MODE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_DPAD_MASK], CONTROLLER_PATCHER_VALUE_SET, HID_GC_BUTTON_DPAD_TYPE[CONTRDPAD_MASK]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_LEFT], HID_GC_BUTTON_LEFT[0], HID_GC_BUTTON_LEFT[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_RIGHT], HID_GC_BUTTON_RIGHT[0], HID_GC_BUTTON_RIGHT[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_DOWN], HID_GC_BUTTON_DOWN[0], HID_GC_BUTTON_DOWN[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_UP], HID_GC_BUTTON_UP[0], HID_GC_BUTTON_UP[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_MINUS], HID_GC_BUTTON_START[0], HID_GC_BUTTON_START[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L], HID_GC_BUTTON_L[0], HID_GC_BUTTON_L[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R], HID_GC_BUTTON_R[0], HID_GC_BUTTON_R[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_PLUS], HID_GC_BUTTON_START[0], HID_GC_BUTTON_START[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_ZL], HID_GC_BUTTON_L[0], HID_GC_BUTTON_L[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_ZR], HID_GC_BUTTON_R[0], HID_GC_BUTTON_R[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_STICK_L], HID_GC_BUTTON_A[0], HID_GC_BUTTON_A[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_STICK_R], HID_GC_BUTTON_B[0], HID_GC_BUTTON_B[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE], CONTROLLER_PATCHER_VALUE_SET, CONTROLLER_PATCHER_GC_DOUBLE_USE); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_ACTIVATOR], HID_GC_BUTTON_Z[0], HID_GC_BUTTON_Z[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VID], (HID_GC_VID>>8)&0xFF, HID_GC_VID&0xFF); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_PID], (HID_GC_PID>>8)&0xFF, HID_GC_PID&0xFF); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_A], HID_GC_BUTTON_A[0], HID_GC_BUTTON_A[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_B], HID_GC_BUTTON_B[0], HID_GC_BUTTON_B[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_X], HID_GC_BUTTON_X[0], HID_GC_BUTTON_X[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_Y], HID_GC_BUTTON_Y[0], HID_GC_BUTTON_Y[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_DPAD_MODE], CONTROLLER_PATCHER_VALUE_SET, HID_GC_BUTTON_DPAD_TYPE[CONTRDPAD_MODE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_DPAD_MASK], CONTROLLER_PATCHER_VALUE_SET, HID_GC_BUTTON_DPAD_TYPE[CONTRDPAD_MASK]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_LEFT], HID_GC_BUTTON_LEFT[0], HID_GC_BUTTON_LEFT[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_RIGHT], HID_GC_BUTTON_RIGHT[0], HID_GC_BUTTON_RIGHT[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_DOWN], HID_GC_BUTTON_DOWN[0], HID_GC_BUTTON_DOWN[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_UP], HID_GC_BUTTON_UP[0], HID_GC_BUTTON_UP[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_MINUS], HID_GC_BUTTON_START[0], HID_GC_BUTTON_START[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L], HID_GC_BUTTON_L[0], HID_GC_BUTTON_L[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R], HID_GC_BUTTON_R[0], HID_GC_BUTTON_R[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_PLUS], HID_GC_BUTTON_START[0], HID_GC_BUTTON_START[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_ZL], HID_GC_BUTTON_L[0], HID_GC_BUTTON_L[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_ZR], HID_GC_BUTTON_R[0], HID_GC_BUTTON_R[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_STICK_L], HID_GC_BUTTON_A[0], HID_GC_BUTTON_A[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_STICK_R], HID_GC_BUTTON_B[0], HID_GC_BUTTON_B[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE], CONTROLLER_PATCHER_VALUE_SET, CONTROLLER_PATCHER_GC_DOUBLE_USE); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_ACTIVATOR], HID_GC_BUTTON_Z[0], HID_GC_BUTTON_Z[1]); //Buttons that will be ignored when the CONTRPS_DOUBLE_USE_BUTTON_ACTIVATOR is pressed - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_1_PRESSED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_MINUS); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_2_PRESSED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_L); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_3_PRESSED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_R); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_4_PRESSED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_STICK_L); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_5_PRESSED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_STICK_R); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_1_PRESSED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_MINUS); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_2_PRESSED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_L); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_3_PRESSED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_R); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_4_PRESSED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_STICK_L); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_5_PRESSED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_STICK_R); //Buttons that will be ignored when the CONTRPS_DOUBLE_USE_BUTTON_ACTIVATOR is released - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_1_RELEASED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_PLUS); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_2_RELEASED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_ZL); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_3_RELEASED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_ZR); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_4_RELEASED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_A); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_5_RELEASED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_B); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_1_RELEASED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_PLUS); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_2_RELEASED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_ZL); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_3_RELEASED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_ZR); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_4_RELEASED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_A); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_DOUBLE_USE_BUTTON_5_RELEASED], CONTROLLER_PATCHER_VALUE_SET, CONTRPS_VPAD_BUTTON_B); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_PAD_COUNT], CONTROLLER_PATCHER_VALUE_SET, HID_GC_PAD_COUNT); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_PAD_COUNT], CONTROLLER_PATCHER_VALUE_SET, HID_GC_PAD_COUNT); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_X], HID_GC_STICK_L_X[STICK_CONF_BYTE],HID_GC_STICK_L_X[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_L_X[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX], HID_GC_STICK_L_X[STICK_CONF_MIN], HID_GC_STICK_L_X[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_L_X[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_X], HID_GC_STICK_L_X[STICK_CONF_BYTE],HID_GC_STICK_L_X[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_L_X[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX], HID_GC_STICK_L_X[STICK_CONF_MIN], HID_GC_STICK_L_X[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_L_X[STICK_CONF_INVERT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_Y], HID_GC_STICK_L_Y[STICK_CONF_BYTE],HID_GC_STICK_L_Y[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_L_Y[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_Y_MINMAX], HID_GC_STICK_L_Y[STICK_CONF_MIN], HID_GC_STICK_L_Y[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_L_Y[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_Y], HID_GC_STICK_L_Y[STICK_CONF_BYTE],HID_GC_STICK_L_Y[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_L_Y[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_Y_MINMAX], HID_GC_STICK_L_Y[STICK_CONF_MIN], HID_GC_STICK_L_Y[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_L_Y[STICK_CONF_INVERT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_X], HID_GC_STICK_R_X[STICK_CONF_BYTE],HID_GC_STICK_R_X[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_R_X[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_X_MINMAX], HID_GC_STICK_R_X[STICK_CONF_MIN], HID_GC_STICK_R_X[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_R_X[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_X], HID_GC_STICK_R_X[STICK_CONF_BYTE],HID_GC_STICK_R_X[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_R_X[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_X_MINMAX], HID_GC_STICK_R_X[STICK_CONF_MIN], HID_GC_STICK_R_X[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_R_X[STICK_CONF_INVERT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_Y], HID_GC_STICK_R_Y[STICK_CONF_BYTE],HID_GC_STICK_R_Y[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_R_Y[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_Y_MINMAX], HID_GC_STICK_R_Y[STICK_CONF_MIN], HID_GC_STICK_R_Y[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_R_Y[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_Y], HID_GC_STICK_R_Y[STICK_CONF_BYTE],HID_GC_STICK_R_Y[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_R_Y[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_Y_MINMAX], HID_GC_STICK_R_Y[STICK_CONF_MIN], HID_GC_STICK_R_Y[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_R_Y[STICK_CONF_INVERT]); //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //! DS3 //!--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VID], (HID_DS3_VID>>8)&0xFF, HID_DS3_VID&0xFF); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_PID], (HID_DS3_PID>>8)&0xFF, HID_DS3_PID&0xFF); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_BUF_SIZE], CONTROLLER_PATCHER_VALUE_SET, 128); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_A], HID_DS3_BUTTON_CIRCLE[0], HID_DS3_BUTTON_CIRCLE[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_B], HID_DS3_BUTTON_CROSS[0], HID_DS3_BUTTON_CROSS[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_X], HID_DS3_BUTTON_TRIANGLE[0], HID_DS3_BUTTON_TRIANGLE[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_Y], HID_DS3_BUTTON_SQUARE[0], HID_DS3_BUTTON_SQUARE[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_DPAD_MODE], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_BUTTON_DPAD_TYPE[CONTRDPAD_MODE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_DPAD_MASK], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_BUTTON_DPAD_TYPE[CONTRDPAD_MASK]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_LEFT], HID_DS3_BUTTON_LEFT[0], HID_DS3_BUTTON_LEFT[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_RIGHT], HID_DS3_BUTTON_RIGHT[0], HID_DS3_BUTTON_RIGHT[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_DOWN], HID_DS3_BUTTON_DOWN[0], HID_DS3_BUTTON_DOWN[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_UP], HID_DS3_BUTTON_UP[0], HID_DS3_BUTTON_UP[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_PLUS], HID_DS3_BUTTON_START[0], HID_DS3_BUTTON_START[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_MINUS], HID_DS3_BUTTON_SELECT[0], HID_DS3_BUTTON_SELECT[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L], HID_DS3_BUTTON_L1[0], HID_DS3_BUTTON_L1[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R], HID_DS3_BUTTON_R1[0], HID_DS3_BUTTON_R1[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_ZL], HID_DS3_BUTTON_L2[0], HID_DS3_BUTTON_L2[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_ZR], HID_DS3_BUTTON_R2[0], HID_DS3_BUTTON_R2[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_STICK_L], HID_DS3_BUTTON_L3[0], HID_DS3_BUTTON_L3[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_STICK_R], HID_DS3_BUTTON_R3[0], HID_DS3_BUTTON_R3[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_HOME], HID_DS3_BUTTON_GUIDE[0], HID_DS3_BUTTON_GUIDE[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_PAD_COUNT], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_PAD_COUNT); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VID], (HID_DS3_VID>>8)&0xFF, HID_DS3_VID&0xFF); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_PID], (HID_DS3_PID>>8)&0xFF, HID_DS3_PID&0xFF); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_BUF_SIZE], CONTROLLER_PATCHER_VALUE_SET, 128); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_A], HID_DS3_BUTTON_CIRCLE[0], HID_DS3_BUTTON_CIRCLE[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_B], HID_DS3_BUTTON_CROSS[0], HID_DS3_BUTTON_CROSS[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_X], HID_DS3_BUTTON_TRIANGLE[0], HID_DS3_BUTTON_TRIANGLE[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_Y], HID_DS3_BUTTON_SQUARE[0], HID_DS3_BUTTON_SQUARE[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_DPAD_MODE], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_BUTTON_DPAD_TYPE[CONTRDPAD_MODE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_DPAD_MASK], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_BUTTON_DPAD_TYPE[CONTRDPAD_MASK]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_LEFT], HID_DS3_BUTTON_LEFT[0], HID_DS3_BUTTON_LEFT[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_RIGHT], HID_DS3_BUTTON_RIGHT[0], HID_DS3_BUTTON_RIGHT[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_DOWN], HID_DS3_BUTTON_DOWN[0], HID_DS3_BUTTON_DOWN[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_UP], HID_DS3_BUTTON_UP[0], HID_DS3_BUTTON_UP[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_PLUS], HID_DS3_BUTTON_START[0], HID_DS3_BUTTON_START[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_MINUS], HID_DS3_BUTTON_SELECT[0], HID_DS3_BUTTON_SELECT[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L], HID_DS3_BUTTON_L1[0], HID_DS3_BUTTON_L1[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R], HID_DS3_BUTTON_R1[0], HID_DS3_BUTTON_R1[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_ZL], HID_DS3_BUTTON_L2[0], HID_DS3_BUTTON_L2[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_ZR], HID_DS3_BUTTON_R2[0], HID_DS3_BUTTON_R2[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_STICK_L], HID_DS3_BUTTON_L3[0], HID_DS3_BUTTON_L3[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_STICK_R], HID_DS3_BUTTON_R3[0], HID_DS3_BUTTON_R3[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_HOME], HID_DS3_BUTTON_GUIDE[0], HID_DS3_BUTTON_GUIDE[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_PAD_COUNT], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_PAD_COUNT); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_X], HID_DS3_STICK_L_X[STICK_CONF_BYTE], HID_DS3_STICK_L_X[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_L_X[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX], HID_DS3_STICK_L_X[STICK_CONF_MIN], HID_DS3_STICK_L_X[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_L_X[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_X], HID_DS3_STICK_L_X[STICK_CONF_BYTE], HID_DS3_STICK_L_X[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_L_X[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX], HID_DS3_STICK_L_X[STICK_CONF_MIN], HID_DS3_STICK_L_X[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_L_X[STICK_CONF_INVERT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y], HID_DS3_STICK_L_Y[STICK_CONF_BYTE], HID_DS3_STICK_L_Y[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_L_Y[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_MINMAX], HID_DS3_STICK_L_Y[STICK_CONF_MIN], HID_DS3_STICK_L_Y[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_L_Y[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y], HID_DS3_STICK_L_Y[STICK_CONF_BYTE], HID_DS3_STICK_L_Y[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_L_Y[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_MINMAX], HID_DS3_STICK_L_Y[STICK_CONF_MIN], HID_DS3_STICK_L_Y[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_L_Y[STICK_CONF_INVERT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_X], HID_DS3_STICK_R_X[STICK_CONF_BYTE], HID_DS3_STICK_R_X[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_R_X[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_MINMAX], HID_DS3_STICK_R_X[STICK_CONF_MIN], HID_DS3_STICK_R_X[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_R_X[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_X], HID_DS3_STICK_R_X[STICK_CONF_BYTE], HID_DS3_STICK_R_X[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_R_X[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_MINMAX], HID_DS3_STICK_R_X[STICK_CONF_MIN], HID_DS3_STICK_R_X[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_R_X[STICK_CONF_INVERT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y], HID_DS3_STICK_R_Y[STICK_CONF_BYTE], HID_DS3_STICK_R_Y[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_R_Y[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_MINMAX], HID_DS3_STICK_R_Y[STICK_CONF_MIN], HID_DS3_STICK_R_Y[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_R_Y[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y], HID_DS3_STICK_R_Y[STICK_CONF_BYTE], HID_DS3_STICK_R_Y[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_R_Y[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_MINMAX], HID_DS3_STICK_R_Y[STICK_CONF_MIN], HID_DS3_STICK_R_Y[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_R_Y[STICK_CONF_INVERT]); //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //! DS4 //!--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VID], (HID_DS4_VID>>8)&0xFF, HID_DS4_VID&0xFF); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_PID], (HID_DS4_PID>>8)&0xFF, HID_DS4_PID&0xFF); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_BUF_SIZE], CONTROLLER_PATCHER_VALUE_SET, 128); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_A], HID_DS4_BUTTON_CIRCLE[0], HID_DS4_BUTTON_CIRCLE[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_B], HID_DS4_BUTTON_CROSS[0], HID_DS4_BUTTON_CROSS[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_X], HID_DS4_BUTTON_TRIANGLE[0], HID_DS4_BUTTON_TRIANGLE[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_Y], HID_DS4_BUTTON_SQUARE[0], HID_DS4_BUTTON_SQUARE[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_DPAD_MODE], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_BUTTON_DPAD_TYPE[CONTRDPAD_MODE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_DPAD_MASK], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_BUTTON_DPAD_TYPE[CONTRDPAD_MASK]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_N], HID_DS4_BUTTON_DPAD_N[0], HID_DS4_BUTTON_DPAD_N[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_NE], HID_DS4_BUTTON_DPAD_NE[0], HID_DS4_BUTTON_DPAD_NE[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_E], HID_DS4_BUTTON_DPAD_E[0], HID_DS4_BUTTON_DPAD_E[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_SE], HID_DS4_BUTTON_DPAD_SE[0], HID_DS4_BUTTON_DPAD_SE[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_S], HID_DS4_BUTTON_DPAD_S[0], HID_DS4_BUTTON_DPAD_S[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_SW], HID_DS4_BUTTON_DPAD_SW[0], HID_DS4_BUTTON_DPAD_SW[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_W], HID_DS4_BUTTON_DPAD_W[0], HID_DS4_BUTTON_DPAD_W[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_NW], HID_DS4_BUTTON_DPAD_NW[0], HID_DS4_BUTTON_DPAD_NW[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_NEUTRAL], HID_DS4_BUTTON_DPAD_NEUTRAL[0], HID_DS4_BUTTON_DPAD_NEUTRAL[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_PLUS], HID_DS4_BUTTON_OPTIONS[0], HID_DS4_BUTTON_OPTIONS[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_MINUS], HID_DS4_BUTTON_SHARE[0], HID_DS4_BUTTON_SHARE[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L], HID_DS4_BUTTON_L1[0], HID_DS4_BUTTON_L1[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R], HID_DS4_BUTTON_R1[0], HID_DS4_BUTTON_R1[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_ZL], HID_DS4_BUTTON_L2[0], HID_DS4_BUTTON_L2[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_ZR], HID_DS4_BUTTON_R2[0], HID_DS4_BUTTON_R2[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_STICK_L], HID_DS4_BUTTON_L3[0], HID_DS4_BUTTON_L3[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_STICK_R], HID_DS4_BUTTON_R3[0], HID_DS4_BUTTON_R3[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_HOME], HID_DS4_BUTTON_GUIDE[0], HID_DS4_BUTTON_GUIDE[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_PAD_COUNT], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_PAD_COUNT); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VID], (HID_DS4_VID>>8)&0xFF, HID_DS4_VID&0xFF); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_PID], (HID_DS4_PID>>8)&0xFF, HID_DS4_PID&0xFF); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_BUF_SIZE], CONTROLLER_PATCHER_VALUE_SET, 128); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_A], HID_DS4_BUTTON_CIRCLE[0], HID_DS4_BUTTON_CIRCLE[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_B], HID_DS4_BUTTON_CROSS[0], HID_DS4_BUTTON_CROSS[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_X], HID_DS4_BUTTON_TRIANGLE[0], HID_DS4_BUTTON_TRIANGLE[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_Y], HID_DS4_BUTTON_SQUARE[0], HID_DS4_BUTTON_SQUARE[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_DPAD_MODE], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_BUTTON_DPAD_TYPE[CONTRDPAD_MODE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_DPAD_MASK], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_BUTTON_DPAD_TYPE[CONTRDPAD_MASK]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_N], HID_DS4_BUTTON_DPAD_N[0], HID_DS4_BUTTON_DPAD_N[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_NE], HID_DS4_BUTTON_DPAD_NE[0], HID_DS4_BUTTON_DPAD_NE[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_E], HID_DS4_BUTTON_DPAD_E[0], HID_DS4_BUTTON_DPAD_E[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_SE], HID_DS4_BUTTON_DPAD_SE[0], HID_DS4_BUTTON_DPAD_SE[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_S], HID_DS4_BUTTON_DPAD_S[0], HID_DS4_BUTTON_DPAD_S[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_SW], HID_DS4_BUTTON_DPAD_SW[0], HID_DS4_BUTTON_DPAD_SW[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_W], HID_DS4_BUTTON_DPAD_W[0], HID_DS4_BUTTON_DPAD_W[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_NW], HID_DS4_BUTTON_DPAD_NW[0], HID_DS4_BUTTON_DPAD_NW[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_DPAD_NEUTRAL], HID_DS4_BUTTON_DPAD_NEUTRAL[0], HID_DS4_BUTTON_DPAD_NEUTRAL[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_PLUS], HID_DS4_BUTTON_OPTIONS[0], HID_DS4_BUTTON_OPTIONS[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_MINUS], HID_DS4_BUTTON_SHARE[0], HID_DS4_BUTTON_SHARE[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L], HID_DS4_BUTTON_L1[0], HID_DS4_BUTTON_L1[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R], HID_DS4_BUTTON_R1[0], HID_DS4_BUTTON_R1[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_ZL], HID_DS4_BUTTON_L2[0], HID_DS4_BUTTON_L2[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_ZR], HID_DS4_BUTTON_R2[0], HID_DS4_BUTTON_R2[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_STICK_L], HID_DS4_BUTTON_L3[0], HID_DS4_BUTTON_L3[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_STICK_R], HID_DS4_BUTTON_R3[0], HID_DS4_BUTTON_R3[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_HOME], HID_DS4_BUTTON_GUIDE[0], HID_DS4_BUTTON_GUIDE[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_PAD_COUNT], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_PAD_COUNT); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_X], HID_DS4_STICK_L_X[STICK_CONF_BYTE], HID_DS4_STICK_L_X[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_L_X[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX], HID_DS4_STICK_L_X[STICK_CONF_MIN], HID_DS4_STICK_L_X[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_L_X[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_X], HID_DS4_STICK_L_X[STICK_CONF_BYTE], HID_DS4_STICK_L_X[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_L_X[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX], HID_DS4_STICK_L_X[STICK_CONF_MIN], HID_DS4_STICK_L_X[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_L_X[STICK_CONF_INVERT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y], HID_DS4_STICK_L_Y[STICK_CONF_BYTE], HID_DS4_STICK_L_Y[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_L_Y[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_MINMAX], HID_DS4_STICK_L_Y[STICK_CONF_MIN], HID_DS4_STICK_L_Y[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_L_Y[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y], HID_DS4_STICK_L_Y[STICK_CONF_BYTE], HID_DS4_STICK_L_Y[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_L_Y[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_MINMAX], HID_DS4_STICK_L_Y[STICK_CONF_MIN], HID_DS4_STICK_L_Y[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_L_Y[STICK_CONF_INVERT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_X], HID_DS4_STICK_R_X[STICK_CONF_BYTE], HID_DS4_STICK_R_X[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_R_X[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_MINMAX], HID_DS4_STICK_R_X[STICK_CONF_MIN], HID_DS4_STICK_R_X[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_R_X[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_X], HID_DS4_STICK_R_X[STICK_CONF_BYTE], HID_DS4_STICK_R_X[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_R_X[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_MINMAX], HID_DS4_STICK_R_X[STICK_CONF_MIN], HID_DS4_STICK_R_X[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_R_X[STICK_CONF_INVERT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y], HID_DS4_STICK_R_Y[STICK_CONF_BYTE], HID_DS4_STICK_R_Y[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_R_Y[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_MINMAX], HID_DS4_STICK_R_Y[STICK_CONF_MIN], HID_DS4_STICK_R_Y[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_R_Y[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y], HID_DS4_STICK_R_Y[STICK_CONF_BYTE], HID_DS4_STICK_R_Y[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_R_Y[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_MINMAX], HID_DS4_STICK_R_Y[STICK_CONF_MIN], HID_DS4_STICK_R_Y[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_R_Y[STICK_CONF_INVERT]); //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //! XInput //!--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VID], (HID_XINPUT_VID>>8)&0xFF, HID_XINPUT_VID&0xFF); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_PID], (HID_XINPUT_PID>>8)&0xFF, HID_XINPUT_PID&0xFF); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_BUF_SIZE], CONTROLLER_PATCHER_VALUE_SET, 128); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_A], HID_XINPUT_BUTTON_B[0], HID_XINPUT_BUTTON_B[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_B], HID_XINPUT_BUTTON_A[0], HID_XINPUT_BUTTON_A[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_X], HID_XINPUT_BUTTON_Y[0], HID_XINPUT_BUTTON_Y[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_Y], HID_XINPUT_BUTTON_X[0], HID_XINPUT_BUTTON_X[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_DPAD_MODE], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_BUTTON_DPAD_TYPE[CONTRDPAD_MODE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_DPAD_MASK], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_BUTTON_DPAD_TYPE[CONTRDPAD_MASK]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_UP], HID_XINPUT_BUTTON_UP[0], HID_XINPUT_BUTTON_UP[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_DOWN], HID_XINPUT_BUTTON_DOWN[0], HID_XINPUT_BUTTON_DOWN[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_LEFT], HID_XINPUT_BUTTON_LEFT[0], HID_XINPUT_BUTTON_LEFT[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_RIGHT], HID_XINPUT_BUTTON_RIGHT[0], HID_XINPUT_BUTTON_RIGHT[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_PLUS], HID_XINPUT_BUTTON_START[0], HID_XINPUT_BUTTON_START[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_MINUS], HID_XINPUT_BUTTON_BACK[0], HID_XINPUT_BUTTON_BACK[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L], HID_XINPUT_BUTTON_LB[0], HID_XINPUT_BUTTON_LB[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R], HID_XINPUT_BUTTON_RB[0], HID_XINPUT_BUTTON_RB[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_ZL], HID_XINPUT_BUTTON_LT[0], HID_XINPUT_BUTTON_LT[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_ZR], HID_XINPUT_BUTTON_RT[0], HID_XINPUT_BUTTON_RT[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_STICK_L], HID_XINPUT_BUTTON_L3[0], HID_XINPUT_BUTTON_L3[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_STICK_R], HID_XINPUT_BUTTON_R3[0], HID_XINPUT_BUTTON_R3[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_HOME], HID_XINPUT_BUTTON_GUIDE[0], HID_XINPUT_BUTTON_GUIDE[1]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_PAD_COUNT], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_PAD_COUNT); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VID], (HID_XINPUT_VID>>8)&0xFF, HID_XINPUT_VID&0xFF); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_PID], (HID_XINPUT_PID>>8)&0xFF, HID_XINPUT_PID&0xFF); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_BUF_SIZE], CONTROLLER_PATCHER_VALUE_SET, 128); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_A], HID_XINPUT_BUTTON_B[0], HID_XINPUT_BUTTON_B[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_B], HID_XINPUT_BUTTON_A[0], HID_XINPUT_BUTTON_A[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_X], HID_XINPUT_BUTTON_Y[0], HID_XINPUT_BUTTON_Y[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_Y], HID_XINPUT_BUTTON_X[0], HID_XINPUT_BUTTON_X[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_DPAD_MODE], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_BUTTON_DPAD_TYPE[CONTRDPAD_MODE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_DPAD_MASK], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_BUTTON_DPAD_TYPE[CONTRDPAD_MASK]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_UP], HID_XINPUT_BUTTON_UP[0], HID_XINPUT_BUTTON_UP[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_DOWN], HID_XINPUT_BUTTON_DOWN[0], HID_XINPUT_BUTTON_DOWN[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_LEFT], HID_XINPUT_BUTTON_LEFT[0], HID_XINPUT_BUTTON_LEFT[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_RIGHT], HID_XINPUT_BUTTON_RIGHT[0], HID_XINPUT_BUTTON_RIGHT[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_PLUS], HID_XINPUT_BUTTON_START[0], HID_XINPUT_BUTTON_START[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_MINUS], HID_XINPUT_BUTTON_BACK[0], HID_XINPUT_BUTTON_BACK[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L], HID_XINPUT_BUTTON_LB[0], HID_XINPUT_BUTTON_LB[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R], HID_XINPUT_BUTTON_RB[0], HID_XINPUT_BUTTON_RB[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_ZL], HID_XINPUT_BUTTON_LT[0], HID_XINPUT_BUTTON_LT[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_ZR], HID_XINPUT_BUTTON_RT[0], HID_XINPUT_BUTTON_RT[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_STICK_L], HID_XINPUT_BUTTON_L3[0], HID_XINPUT_BUTTON_L3[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_STICK_R], HID_XINPUT_BUTTON_R3[0], HID_XINPUT_BUTTON_R3[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_HOME], HID_XINPUT_BUTTON_GUIDE[0], HID_XINPUT_BUTTON_GUIDE[1]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_PAD_COUNT], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_PAD_COUNT); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L_STICK_X], HID_XINPUT_STICK_L_X[STICK_CONF_BYTE], HID_XINPUT_STICK_L_X[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_STICK_L_X[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX], HID_XINPUT_STICK_L_X[STICK_CONF_MIN], HID_XINPUT_STICK_L_X[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_STICK_L_X[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L_STICK_X], HID_XINPUT_STICK_L_X[STICK_CONF_BYTE], HID_XINPUT_STICK_L_X[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_STICK_L_X[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX], HID_XINPUT_STICK_L_X[STICK_CONF_MIN], HID_XINPUT_STICK_L_X[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_STICK_L_X[STICK_CONF_INVERT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y], HID_XINPUT_STICK_L_Y[STICK_CONF_BYTE], HID_XINPUT_STICK_L_Y[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_STICK_L_Y[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_MINMAX], HID_XINPUT_STICK_L_Y[STICK_CONF_MIN], HID_XINPUT_STICK_L_Y[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_STICK_L_Y[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y], HID_XINPUT_STICK_L_Y[STICK_CONF_BYTE], HID_XINPUT_STICK_L_Y[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_STICK_L_Y[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_MINMAX], HID_XINPUT_STICK_L_Y[STICK_CONF_MIN], HID_XINPUT_STICK_L_Y[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_STICK_L_Y[STICK_CONF_INVERT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R_STICK_X], HID_XINPUT_STICK_R_X[STICK_CONF_BYTE], HID_XINPUT_STICK_R_X[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_STICK_R_X[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_MINMAX], HID_XINPUT_STICK_R_X[STICK_CONF_MIN], HID_XINPUT_STICK_R_X[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_STICK_R_X[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R_STICK_X], HID_XINPUT_STICK_R_X[STICK_CONF_BYTE], HID_XINPUT_STICK_R_X[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_STICK_R_X[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_MINMAX], HID_XINPUT_STICK_R_X[STICK_CONF_MIN], HID_XINPUT_STICK_R_X[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_STICK_R_X[STICK_CONF_INVERT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y], HID_XINPUT_STICK_R_Y[STICK_CONF_BYTE], HID_XINPUT_STICK_R_Y[STICK_CONF_DEFAULT]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_STICK_R_Y[STICK_CONF_DEADZONE]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_MINMAX], HID_XINPUT_STICK_R_Y[STICK_CONF_MIN], HID_XINPUT_STICK_R_Y[STICK_CONF_MAX]); - ControllerPatcherUtils::setConfigValue((u8*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_STICK_R_Y[STICK_CONF_INVERT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y], HID_XINPUT_STICK_R_Y[STICK_CONF_BYTE], HID_XINPUT_STICK_R_Y[STICK_CONF_DEFAULT]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_STICK_R_Y[STICK_CONF_DEADZONE]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_MINMAX], HID_XINPUT_STICK_R_Y[STICK_CONF_MIN], HID_XINPUT_STICK_R_Y[STICK_CONF_MAX]); + ControllerPatcherUtils::setConfigValue((uint8_t*)&config_controller[xinput_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_XINPUT_STICK_R_Y[STICK_CONF_INVERT]); } -bool ControllerPatcher::Init(const char * pathToConfig) { +BOOL ControllerPatcher::Init(const char * pathToConfig) { OSDynLoad_Module handle; void* kpad_ptr; OSDynLoad_Acquire("padscore",&handle); OSDynLoad_FindExport(handle, 0 ,"KPADRead",&kpad_ptr); - gSamplingCallback = (WPADSamplingCallback)((u32)kpad_ptr + 0x1F0); - if(*(u32*)gSamplingCallback != FIRST_INSTRUCTION_IN_SAMPLING_CALLBACK) { + gSamplingCallback = (WPADSamplingCallback)((uint32_t)kpad_ptr + 0x1F0); + if(*(uint32_t*)gSamplingCallback != FIRST_INSTRUCTION_IN_SAMPLING_CALLBACK) { //In Firmware <= 5.1.2 the offset changes - gSamplingCallback = (WPADSamplingCallback)((u32)kpad_ptr + 0x1F8); - if(*(u32*)gSamplingCallback != FIRST_INSTRUCTION_IN_SAMPLING_CALLBACK) { + gSamplingCallback = (WPADSamplingCallback)((uint32_t)kpad_ptr + 0x1F8); + if(*(uint32_t*)gSamplingCallback != FIRST_INSTRUCTION_IN_SAMPLING_CALLBACK) { //Should never happen. I looked into the padscore.rpl of ALL firmwares. gSamplingCallback = NULL; } @@ -668,9 +668,9 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::resetControllerMapping(UCo CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::addControllerMapping(UController_Type type,ControllerMappingPADInfo config) { ControllerMappingPAD * cm_map_pad = ControllerPatcherUtils::getControllerMappingByType(type); - s32 result = 0; + int32_t result = 0; - for(s32 i=0; ipad_infos[i]); if(info != NULL && !info->active) { info->active = 1; @@ -691,15 +691,15 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::addControllerMapping(UCont return CONTROLLER_PATCHER_ERROR_NONE; } -s32 ControllerPatcher::getActiveMappingSlot(UController_Type type) { +int32_t ControllerPatcher::getActiveMappingSlot(UController_Type type) { ControllerMappingPAD * cm_map_pad = ControllerPatcherUtils::getControllerMappingByType(type); if(cm_map_pad == NULL) { return -1; } - s32 connected = -1; - for(s32 i =0; ipad_infos[i].active || cm_map_pad->pad_infos[i].type == CM_Type_RealController) { connected = i; break; @@ -709,7 +709,7 @@ s32 ControllerPatcher::getActiveMappingSlot(UController_Type type) { return connected; } -bool ControllerPatcher::isControllerConnectedAndActive(UController_Type type,s32 mapping_slot) { +BOOL ControllerPatcher::isControllerConnectedAndActive(UController_Type type,int32_t mapping_slot) { ControllerMappingPADInfo * padinfo = getControllerMappingInfo(type,mapping_slot); if(!padinfo) { return false; @@ -721,13 +721,13 @@ bool ControllerPatcher::isControllerConnectedAndActive(UController_Type type,s32 device_info.vidpid = padinfo->vidpid; - s32 res; + int32_t res; if((res = ControllerPatcherUtils::getDeviceInfoFromVidPid(&device_info)) < 0) { return false; } - u32 hidmask = device_info.slotdata.hidmask; - u32 pad = padinfo->pad; + uint32_t hidmask = device_info.slotdata.hidmask; + uint32_t pad = padinfo->pad; HID_Data * data_cur; @@ -740,7 +740,7 @@ bool ControllerPatcher::isControllerConnectedAndActive(UController_Type type,s32 return false; } -ControllerMappingPADInfo * ControllerPatcher::getControllerMappingInfo(UController_Type type,s32 mapping_slot) { +ControllerMappingPADInfo * ControllerPatcher::getControllerMappingInfo(UController_Type type,int32_t mapping_slot) { ControllerMappingPAD * cm_map_pad = ControllerPatcherUtils::getControllerMappingByType(type); if(cm_map_pad == NULL) { @@ -764,7 +764,7 @@ HID_Mouse_Data * ControllerPatcher::getMouseData() { HID_Mouse_Data * result = NULL; - for(s32 i = 0; ipad_infos[i]); if(!padinfo->active) { break; @@ -779,7 +779,7 @@ HID_Mouse_Data * ControllerPatcher::getMouseData() { return result; } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setRumble(UController_Type type,u32 status) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setRumble(UController_Type type,uint32_t status) { ControllerMappingPAD * cm_map_pad = ControllerPatcherUtils::getControllerMappingByType(type); if(cm_map_pad == NULL) { return -1; @@ -788,18 +788,18 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setRumble(UController_Type return CONTROLLER_PATCHER_ERROR_NONE; } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::gettingInputAllDevices(InputData * output,s32 array_size) { - s32 hid = gHIDCurrentDevice; +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::gettingInputAllDevices(InputData * output,int32_t array_size) { + int32_t hid = gHIDCurrentDevice; HID_Data * data_cur; VPADStatus pad_buffer; VPADStatus * buffer = &pad_buffer; - s32 result = CONTROLLER_PATCHER_ERROR_NONE; - for(s32 i = 0; i< gHIDMaxDevices; i++) { + int32_t result = CONTROLLER_PATCHER_ERROR_NONE; + for(int32_t i = 0; i< gHIDMaxDevices; i++) { if((hid & (1 << i)) != 0) { memset(buffer,0,sizeof(*buffer)); - s32 newhid = (1 << i); - s32 deviceslot = ControllerPatcherUtils::getDeviceSlot(newhid); + int32_t newhid = (1 << i); + int32_t deviceslot = ControllerPatcherUtils::getDeviceSlot(newhid); if(deviceslot < 0) continue; output[result].type = CM_Type_Controller; @@ -826,14 +826,14 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::gettingInputAllDevices(Inp deviceinfo->pad_count = HID_MAX_PADS_COUNT; }*/ - s32 buttons_hold = 0; + int32_t buttons_hold = 0; - for(s32 pad = 0; padslotdata.hidmask,pad,&data_cur)) < 0) { continue; @@ -878,7 +878,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::gettingInputAllDevices(Inp return result; } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setProControllerDataFromHID(void * data,s32 chan, s32 mode) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setProControllerDataFromHID(void * data,int32_t chan, int32_t mode) { if(data == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; if(chan < 0 || chan > 3) return CONTROLLER_PATCHER_ERROR_INVALID_CHAN; //if(gControllerMapping.proController[chan].enabled == 0) return CONTROLLER_PATCHER_ERROR_MAPPING_DISABLED; @@ -888,7 +888,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setProControllerDataFromHI std::vector data_list; - for(s32 i = 0; i data_list; @@ -953,7 +953,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setControllerDataFromHID(V if (cm_map_pad.useAll == 1) { data_list = ControllerPatcherHID::getHIDDataAll(); } else { - for(s32 i = 0; irumbleActive = !!gControllerMapping.gamepad.rumble; } @@ -1033,10 +1033,10 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::printVPADButtons(VPADStatu return CONTROLLER_PATCHER_ERROR_NONE; } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::buttonRemapping(VPADStatus * buffer,s32 buffer_count) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::buttonRemapping(VPADStatus * buffer,int32_t buffer_count) { if(!gButtonRemappingConfigDone) return CONTROLLER_PATCHER_ERROR_CONFIG_NOT_DONE; if(buffer == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; - for(s32 i = 0; i < buffer_count; i++) { + for(int32_t i = 0; i < buffer_count; i++) { VPADStatus new_data; memset(&new_data,0,sizeof(new_data)); @@ -1088,7 +1088,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::buttonRemapping(VPADStatus return CONTROLLER_PATCHER_ERROR_NONE; } -std::string ControllerPatcher::getIdentifierByVIDPID(u16 vid,u16 pid) { +std::string ControllerPatcher::getIdentifierByVIDPID(uint16_t vid,uint16_t pid) { return ConfigValues::getStringByVIDPID(vid,pid); } @@ -1097,34 +1097,34 @@ void ControllerPatcher::destroyConfigHelper() { ConfigValues::destroyInstance(); } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::doSamplingForDeviceSlot(u16 device_slot) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::doSamplingForDeviceSlot(uint16_t device_slot) { return ControllerPatcherUtils::doSampling(device_slot,0,true); } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setRumbleActivated(bool value) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setRumbleActivated(BOOL value) { gGlobalRumbleActivated = value; return CONTROLLER_PATCHER_ERROR_NONE; } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setNetworkControllerActivated(bool value) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setNetworkControllerActivated(BOOL value) { gNetworkControllerActivated = value; return CONTROLLER_PATCHER_ERROR_NONE; } -bool ControllerPatcher::isRumbleActivated() { +BOOL ControllerPatcher::isRumbleActivated() { return gGlobalRumbleActivated; } -bool ControllerPatcher::isButtonRemappingDone() { +BOOL ControllerPatcher::isButtonRemappingDone() { return gButtonRemappingConfigDone; } -bool ControllerPatcher::isKeyboardConnected() { +BOOL ControllerPatcher::isKeyboardConnected() { return (gHIDCurrentDevice & gHID_LIST_KEYBOARD) == gHID_LIST_KEYBOARD; } -bool ControllerPatcher::areControllersConnected() { +BOOL ControllerPatcher::areControllersConnected() { return gHIDAttached > 0; } @@ -1145,7 +1145,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::resetCallbackData() { } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setKPADConnectedCallback(s32 chan, WPADConnectCallback callback) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setKPADConnectedCallback(int32_t chan, WPADConnectCallback callback) { if(chan >= 4) { return CONTROLLER_PATCHER_ERROR_INVALID_CHAN; } @@ -1153,7 +1153,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setKPADConnectedCallback(s return CONTROLLER_PATCHER_ERROR_NONE; } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setKPADExtensionCallback(s32 chan, WPADConnectCallback callback) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setKPADExtensionCallback(int32_t chan, WPADConnectCallback callback) { if(chan >= 4) { return CONTROLLER_PATCHER_ERROR_INVALID_CHAN; } @@ -1161,7 +1161,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setKPADExtensionCallback(s return CONTROLLER_PATCHER_ERROR_NONE; } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setWPADConnectCallback(s32 chan, WPADConnectCallback callback) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setWPADConnectCallback(int32_t chan, WPADConnectCallback callback) { if(chan >= 4) { return CONTROLLER_PATCHER_ERROR_INVALID_CHAN; } @@ -1169,7 +1169,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setWPADConnectCallback(s32 return CONTROLLER_PATCHER_ERROR_NONE; } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::handleCallbackData(bool button_pressed) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::handleCallbackData(BOOL button_pressed) { if(button_pressed && gCallbackCooldown == 0) { gCallbackCooldown = 0xFF; diff --git a/source/config/ConfigParser.cpp b/source/config/ConfigParser.cpp index 5636848..0962892 100644 --- a/source/config/ConfigParser.cpp +++ b/source/config/ConfigParser.cpp @@ -30,7 +30,7 @@ ConfigParser::ConfigParser(std::string configData) { } //remove the comments and make everything uppercase - for(u32 i = 0; i < contentLines.size(); i++) { + for(uint32_t i = 0; i < contentLines.size(); i++) { std::vector comments = StringTools::stringSplit(contentLines[i], "//"); if(!comments.empty()) { contentLines[i] = comments[0]; @@ -41,7 +41,7 @@ ConfigParser::ConfigParser(std::string configData) { //remove empty lines std::vector contentline2; - for(u32 i = 0; i < contentLines.size(); i++) { + for(uint32_t i = 0; i < contentLines.size(); i++) { if(strlen(contentLines[i].c_str()) > 0) { contentline2.push_back(contentLines[i]); } @@ -62,21 +62,21 @@ void ConfigParser::setType(PARSE_TYPE newType) { this->type_b = newType; } -u16 ConfigParser::getSlot() { +uint16_t ConfigParser::getSlot() { return this->slot_b; } -void ConfigParser::setSlot(u16 newSlot) { +void ConfigParser::setSlot(uint16_t newSlot) { this->slot_b = newSlot; } -bool ConfigParser::Init() { +BOOL ConfigParser::Init() { if(contentLines.size() == 0) { DEBUG_FUNCTION_LINE("File seems to be empty. Make sure to have a proper header\n"); return false; } const char * line = contentLines[0].c_str(); - s32 len = strlen(line); + int32_t len = strlen(line); if(len <= 4) { DEBUG_FUNCTION_LINE("Header is too short.\n"); return false; @@ -133,7 +133,7 @@ void ConfigParser::parseSingleLine(std::string line) { } return; } else { - u16 hid_slot = getSlot(); + uint16_t hid_slot = getSlot(); if(HID_DEBUG) { DEBUG_FUNCTION_LINE("leftpart = \"%s\" \n",cur_values[0].c_str()); @@ -141,7 +141,7 @@ void ConfigParser::parseSingleLine(std::string line) { if(HID_DEBUG) { DEBUG_FUNCTION_LINE("rightpart = \"%s\" \n",cur_values[1].c_str()); } - s32 keyslot = -1; + int32_t keyslot = -1; if(HID_DEBUG) { DEBUG_FUNCTION_LINE("Checking single value\n"); @@ -158,9 +158,9 @@ void ConfigParser::parseSingleLine(std::string line) { DEBUG_FUNCTION_LINE("Its a single value\n"); } long rightValue = -1; - bool valueSet = false; + BOOL valueSet = false; if(cur_values[0].compare("DPAD_MODE") == 0) { - const u8 * values_ = NULL; + const uint8_t * values_ = NULL; if((values_ = ConfigValues::getValuesStickPreset(cur_values[1])) != NULL) { if(values_[STICK_CONF_MAGIC_VERSION] != STICK_CONF_MAGIC_VALUE) if(HID_DEBUG) { @@ -258,17 +258,17 @@ void ConfigParser::parseSingleLine(std::string line) { } } -bool ConfigParser::resetConfig() { - s32 slot = getSlot(); +BOOL ConfigParser::resetConfig() { + int32_t slot = getSlot(); if((slot == HID_INVALID_SLOT) || (slot >= gHIDMaxDevices)) return false; - for(s32 j = (CONTRPS_PID+1); j< CONTRPS_MAX_VALUE; j++) { + for(int32_t j = (CONTRPS_PID+1); j< CONTRPS_MAX_VALUE; j++) { config_controller[slot][j][0] = CONTROLLER_PATCHER_INVALIDVALUE; config_controller[slot][j][1] = CONTROLLER_PATCHER_INVALIDVALUE; } return true; } -s32 ConfigParser::getSlotController(std::string identify) { +int32_t ConfigParser::getSlotController(std::string identify) { if(HID_DEBUG) { DEBUG_FUNCTION_LINE("Getting Controller Slot\n"); } @@ -280,11 +280,11 @@ s32 ConfigParser::getSlotController(std::string identify) { return HID_INVALID_SLOT; } - s32 vid = getValueFromKeyValue(values[0],"VID","="); + int32_t vid = getValueFromKeyValue(values[0],"VID","="); if(vid < 0) { return HID_INVALID_SLOT; } - s32 pid = getValueFromKeyValue(values[1],"PID","="); + int32_t pid = getValueFromKeyValue(values[1],"PID","="); if(pid < 0) { return HID_INVALID_SLOT; } @@ -296,9 +296,9 @@ s32 ConfigParser::getSlotController(std::string identify) { memset(&deviceinfo,0,sizeof(deviceinfo)); deviceinfo.vidpid.vid = vid; deviceinfo.vidpid.pid = pid; - s32 result = ControllerPatcherUtils::getDeviceInfoFromVidPid(&deviceinfo); - s32 slot = deviceinfo.slotdata.deviceslot; - s32 hid = 0; + int32_t result = ControllerPatcherUtils::getDeviceInfoFromVidPid(&deviceinfo); + int32_t slot = deviceinfo.slotdata.deviceslot; + int32_t hid = 0; if(result < 0) { if(HID_DEBUG) { DEBUG_FUNCTION_LINE("Its a new controller, lets save it\n"); @@ -350,7 +350,7 @@ s32 ConfigParser::getSlotController(std::string identify) { return slot; } -bool ConfigParser::parseIni() { +BOOL ConfigParser::parseIni() { if(getSlot() == HID_INVALID_SLOT) { DEBUG_FUNCTION_LINE("Couldn't parse file. Not a valid slot. Probably broken config. Or you tried to have more than %d devices\n",getType(),gHIDMaxDevices); return false; @@ -361,7 +361,7 @@ bool ConfigParser::parseIni() { DEBUG_FUNCTION_LINE("Parsing content, type %d\n",getType()); } - s32 start = 1; + int32_t start = 1; if(contentLines.size() <= 1) { DEBUG_FUNCTION_LINE("File only contains a header.\n"); return false; @@ -372,7 +372,7 @@ bool ConfigParser::parseIni() { start++; } - for(u32 i = start; i < contentLines.size(); i++) { + for(uint32_t i = start; i < contentLines.size(); i++) { if(HID_DEBUG) { DEBUG_FUNCTION_LINE("line %d: \"%s\" \n",(i+1),contentLines[i].c_str()); } @@ -385,7 +385,7 @@ bool ConfigParser::parseIni() { return true; } -s32 ConfigParser::getValueFromKeyValue(std::string value_pair,std::string expectedKey,std::string delimiter) { +int32_t ConfigParser::getValueFromKeyValue(std::string value_pair,std::string expectedKey,std::string delimiter) { std::vector string_value = StringTools::stringSplit(value_pair,delimiter); if(string_value.size() != 2) { if(HID_DEBUG || string_value.size() > 2) { @@ -398,7 +398,7 @@ s32 ConfigParser::getValueFromKeyValue(std::string value_pair,std::string expect return -1; } char * ptr; - s32 value = strtol(string_value[1].c_str(),&ptr,16); + int32_t value = strtol(string_value[1].c_str(),&ptr,16); return value; } diff --git a/source/config/ConfigParser.hpp b/source/config/ConfigParser.hpp index 421e42c..4ef4917 100644 --- a/source/config/ConfigParser.hpp +++ b/source/config/ConfigParser.hpp @@ -46,29 +46,29 @@ private: PARSE_TYPE getType(); void setType(PARSE_TYPE newType); - u16 getSlot(); - void setSlot(u16 newSlot); + uint16_t getSlot(); + void setSlot(uint16_t newSlot); - bool parseIni(); + BOOL parseIni(); - bool Init(); + BOOL Init(); - bool parseConfigString(std::string content); + BOOL parseConfigString(std::string content); - s32 getSlotController(std::string identify); + int32_t getSlotController(std::string identify); - s32 checkExistingController(s32 vid, s32 pid); + int32_t checkExistingController(int32_t vid, int32_t pid); - s32 getValueFromKeyValue(std::string value_pair,std::string expectedKey,std::string delimiter); + int32_t getValueFromKeyValue(std::string value_pair,std::string expectedKey,std::string delimiter); - bool resetConfig(); + BOOL resetConfig(); void parseSingleLine(std::string line); - u16 slot_b; + uint16_t slot_b; PARSE_TYPE type_b; - u16 vid; - u16 pid; + uint16_t vid; + uint16_t pid; std::string content; std::vector contentLines; diff --git a/source/config/ConfigValues.cpp b/source/config/ConfigValues.cpp index d588a0a..1f910ef 100644 --- a/source/config/ConfigValues.cpp +++ b/source/config/ConfigValues.cpp @@ -33,8 +33,8 @@ ConfigValues::~ConfigValues() { } } -const u8 * ConfigValues::getValuesForPreset(std::map values,std::string possibleValue) { - std::map::iterator it; +const uint8_t * ConfigValues::getValuesForPreset(std::map values,std::string possibleValue) { + std::map::iterator it; it = values.find(possibleValue); if (it != values.end()) { return it->second; @@ -42,7 +42,7 @@ const u8 * ConfigValues::getValuesForPreset(std::map valu return NULL; } -bool ConfigValues::setIfValueIsAControllerPresetEx(std::string value,s32 slot,s32 keyslot) { +BOOL ConfigValues::setIfValueIsAControllerPresetEx(std::string value,int32_t slot,int32_t keyslot) { if(setIfValueIsPreset(presetGCValues,value,slot,keyslot)) return true; if(setIfValueIsPreset(presetDS3Values,value,slot,keyslot)) return true; if(setIfValueIsPreset(presetDS4Values,value,slot,keyslot)) return true; @@ -52,11 +52,11 @@ bool ConfigValues::setIfValueIsAControllerPresetEx(std::string value,s32 slot,s3 } //We need this function here so we can use preset sticks. -bool ConfigValues::setIfValueIsPreset(std::map values,std::string possibleValue,s32 slot,s32 keyslot) { +BOOL ConfigValues::setIfValueIsPreset(std::map values,std::string possibleValue,int32_t slot,int32_t keyslot) { if(slot > gHIDMaxDevices || slot < 0 || keyslot < 0 || keyslot >= CONTRPS_MAX_VALUE) { return false; } - const u8 * values_ = NULL; + const uint8_t * values_ = NULL; if( keyslot == CONTRPS_VPAD_BUTTON_L_STICK_X || keyslot == CONTRPS_VPAD_BUTTON_L_STICK_Y || keyslot == CONTRPS_VPAD_BUTTON_R_STICK_X || @@ -90,7 +90,7 @@ bool ConfigValues::setIfValueIsPreset(std::map values,std } -s32 ConfigValues::getValueFromMap(std::map values,std::string nameOfString) { +int32_t ConfigValues::getValueFromMap(std::map values,std::string nameOfString) { std::map::iterator it; it = values.find(nameOfString); if (it != values.end()) { @@ -101,8 +101,8 @@ s32 ConfigValues::getValueFromMap(std::map values,std::string n return -1; } -s32 ConfigValues::getPresetValueEx(std::string possibleString) { - s32 rightValue = -1; +int32_t ConfigValues::getPresetValueEx(std::string possibleString) { + int32_t rightValue = -1; if((rightValue = getValueFromMap(gGamePadValuesToCONTRPSString,possibleString))!= -1) { if(HID_DEBUG) { DEBUG_FUNCTION_LINE("Used pre-defined VPAD_VALUE! \"%s\" is %d\n",possibleString.c_str(),rightValue); @@ -115,11 +115,11 @@ s32 ConfigValues::getPresetValueEx(std::string possibleString) { return rightValue; } -void ConfigValues::addDeviceNameEx(u16 vid,u16 pid,std::string value) { +void ConfigValues::addDeviceNameEx(uint16_t vid,uint16_t pid,std::string value) { deviceNames[StringTools::strfmt("%04X%04X",vid,pid).c_str()] = value; } -std::string ConfigValues::getStringByVIDPIDEx(u16 vid,u16 pid) { +std::string ConfigValues::getStringByVIDPIDEx(uint16_t vid,uint16_t pid) { std::string result = ""; std::map::iterator it; diff --git a/source/config/ConfigValues.hpp b/source/config/ConfigValues.hpp index bdacafc..038176d 100644 --- a/source/config/ConfigValues.hpp +++ b/source/config/ConfigValues.hpp @@ -48,7 +48,7 @@ private: /** Returns NULL if not a preset! **/ - static const u8 * getValuesStickPreset(std::string possibleValue) + static const uint8_t * getValuesStickPreset(std::string possibleValue) { ConfigValues * cur_instance = getInstance(); if(cur_instance == NULL) return NULL; @@ -58,7 +58,7 @@ private: /** Returns -1 if not found **/ - static s32 getKeySlotGamePad(std::string possibleValue) + static int32_t getKeySlotGamePad(std::string possibleValue) { ConfigValues * cur_instance = getInstance(); if(cur_instance == NULL) return -1; @@ -67,7 +67,7 @@ private: /** Returns -1 if not found **/ - static s32 getKeySlotMouse(std::string possibleValue) + static int32_t getKeySlotMouse(std::string possibleValue) { ConfigValues * cur_instance = getInstance(); if(cur_instance == NULL) return -1; @@ -77,7 +77,7 @@ private: /** Returns -1 if not found **/ - static s32 getKeySlotDefaultSingleValue(std::string possibleValue) + static int32_t getKeySlotDefaultSingleValue(std::string possibleValue) { ConfigValues * cur_instance = getInstance(); if(cur_instance == NULL) return -1; @@ -87,7 +87,7 @@ private: /** Returns -1 if not found **/ - static s32 getKeySlotDefaultPairedValue(std::string possibleValue) + static int32_t getKeySlotDefaultPairedValue(std::string possibleValue) { ConfigValues * cur_instance = getInstance(); if(cur_instance == NULL) return -1; @@ -97,7 +97,7 @@ private: /** Returns -1 if not found **/ - static s32 getPresetValuesKeyboard(std::string possibleValue) + static int32_t getPresetValuesKeyboard(std::string possibleValue) { ConfigValues * cur_instance = getInstance(); if(cur_instance == NULL) return -1; @@ -107,7 +107,7 @@ private: /** Returns -1 if not found **/ - static s32 getPresetValue(std::string possibleValue) + static int32_t getPresetValue(std::string possibleValue) { ConfigValues * cur_instance = getInstance(); if(cur_instance == NULL) return -1; @@ -117,14 +117,14 @@ private: /** Returns -1 if not found **/ - static s32 setIfValueIsAControllerPreset(std::string value,s32 slot,s32 keyslot) + static int32_t setIfValueIsAControllerPreset(std::string value,int32_t slot,int32_t keyslot) { ConfigValues * cur_instance = getInstance(); if(cur_instance == NULL) return -1; return cur_instance->setIfValueIsAControllerPresetEx(value,slot,keyslot); } - static void addDeviceName(u16 vid,u16 pid,std::string value){ + static void addDeviceName(uint16_t vid,uint16_t pid,std::string value){ ConfigValues * cur_instance = getInstance(); if(cur_instance != NULL){ cur_instance->addDeviceNameEx(vid,pid,value); @@ -134,7 +134,7 @@ private: /** Returns empty String if not found **/ - static std::string getStringByVIDPID(u16 vid,u16 pid){ + static std::string getStringByVIDPID(uint16_t vid,uint16_t pid){ ConfigValues * cur_instance = getInstance(); if(cur_instance == NULL) return ""; return cur_instance->getStringByVIDPIDEx(vid,pid); @@ -156,18 +156,18 @@ private: std::map deviceNames; - std::map presetGCValues; - std::map presetDS3Values; - std::map presetDS4Values; - std::map presetXInputValues; - std::map presetSwitchProValues; - std::map presetSticks; + std::map presetGCValues; + std::map presetDS3Values; + std::map presetDS4Values; + std::map presetXInputValues; + std::map presetSwitchProValues; + std::map presetSticks; - s32 getValueFromMap(std::map values,std::string nameOfString); + int32_t getValueFromMap(std::map values,std::string nameOfString); - bool checkIfValueIsAControllerPreset(std::string value,s32 slot,s32 keyslot); + BOOL checkIfValueIsAControllerPreset(std::string value,int32_t slot,int32_t keyslot); - s32 getPresetValueEx(std::string possibleString); + int32_t getPresetValueEx(std::string possibleString); void InitValues(){ DEBUG_FUNCTION_LINE("Init values for the configuration\n"); @@ -563,12 +563,12 @@ private: deviceNames[StringTools::strfmt("%04X%04X",HID_SWITCH_PRO_VID,HID_SWITCH_PRO_PID).c_str()] = HID_SWITCH_PRO_STRING; } - const u8 * getValuesForPreset(std::map values,std::string possibleValue); + const uint8_t * getValuesForPreset(std::map values,std::string possibleValue); - bool setIfValueIsPreset(std::map values,std::string possibleValue,s32 slot,s32 keyslot); - bool setIfValueIsAControllerPresetEx(std::string value,s32 slot,s32 keyslot); + BOOL setIfValueIsPreset(std::map values,std::string possibleValue,int32_t slot,int32_t keyslot); + BOOL setIfValueIsAControllerPresetEx(std::string value,int32_t slot,int32_t keyslot); - void addDeviceNameEx(u16 vid,u16 pid,std::string value); - std::string getStringByVIDPIDEx(u16 vid,u16 pid); + void addDeviceNameEx(uint16_t vid,uint16_t pid,std::string value); + std::string getStringByVIDPIDEx(uint16_t vid,uint16_t pid); }; #endif diff --git a/source/network/CPTCPServer.cpp b/source/network/CPTCPServer.cpp index e4e7971..64eef6b 100644 --- a/source/network/CPTCPServer.cpp +++ b/source/network/CPTCPServer.cpp @@ -23,7 +23,7 @@ CPTCPServer * CPTCPServer::instance = NULL; -CPTCPServer::CPTCPServer(s32 port): TCPServer(port,CPTCPServer::getPriority()) { +CPTCPServer::CPTCPServer(int32_t port): TCPServer(port,CPTCPServer::getPriority()) { CPTCPServer::AttachDetach(HID_DEVICE_DETACH); } @@ -40,8 +40,8 @@ void CPTCPServer::AttachDetach(HIDAttachEvent attach) { } } - for(s32 i= 0; i< gHIDMaxDevices; i++) { - for(s32 j= 0; j< HID_MAX_PADS_COUNT; j++) { + for(int32_t i= 0; i< gHIDMaxDevices; i++) { + for(int32_t j= 0; j< HID_MAX_PADS_COUNT; j++) { if(gNetworkController[i][j][NETWORK_CONTROLLER_ACTIVE] > 0) { DEBUG_FUNCTION_LINE("Found a registered pad in deviceslot %d and padslot %d! Lets detach it.\n",i,j); HIDDevice device; @@ -72,9 +72,9 @@ void CPTCPServer::DetachAndDelete() { memset(&gNetworkController,0,sizeof(gNetworkController)); } -bool CPTCPServer::whileLoop() { - s32 ret; - s32 clientfd = getClientFD(); +BOOL CPTCPServer::whileLoop() { + int32_t ret; + int32_t clientfd = getClientFD(); while (1) { if(shouldExit()) { break; @@ -91,7 +91,7 @@ bool CPTCPServer::whileLoop() { switch (ret) { case WIIU_CP_TCP_ATTACH: { /*attach */ if(gUsedProtocolVersion >= WIIU_CP_TCP_HANDSHAKE_VERSION_1) { - s32 handle; + int32_t handle; ret = recvwait(clientfd, &handle, 4); if(ret < 0) { DEBUG_FUNCTION_LINE("Error in %02X: recvwait handle\n",WIIU_CP_TCP_ATTACH); @@ -100,8 +100,8 @@ bool CPTCPServer::whileLoop() { if(HID_DEBUG) { DEBUG_FUNCTION_LINE("got handle %d\n",handle); } - u16 vid = 0; - u16 pid = 0; + uint16_t vid = 0; + uint16_t pid = 0; ret = recvwait(clientfd, &vid, 2); if(ret < 0) { DEBUG_FUNCTION_LINE("Error in %02X: recvwait vid\n",WIIU_CP_TCP_ATTACH); @@ -185,7 +185,7 @@ bool CPTCPServer::whileLoop() { } case WIIU_CP_TCP_DETACH: { /*detach */ if(gUsedProtocolVersion >= WIIU_CP_TCP_HANDSHAKE_VERSION_1) { - s32 handle; + int32_t handle; ret = recvwait(clientfd, &handle, 4); if(ret < 0) { DEBUG_FUNCTION_LINE("Error in %02X: recvwait handle\n",WIIU_CP_TCP_DETACH); @@ -207,13 +207,13 @@ bool CPTCPServer::whileLoop() { return false; break; } - s32 deviceslot = user->slotdata.deviceslot; + int32_t deviceslot = user->slotdata.deviceslot; if(HID_DEBUG) { DEBUG_FUNCTION_LINE("device slot is: %d , pad slot is: %d\n",deviceslot,user->pad_slot); } DeviceVIDPIDInfo vidpid; - s32 result; + int32_t result; if((result = ControllerPatcherUtils::getVIDPIDbyDeviceSlot(deviceslot,&vidpid)) < 0) { DEBUG_FUNCTION_LINE("Error in %02X: Couldn't find a valid VID/PID for device slot %d. Error: %d\n",WIIU_CP_TCP_DETACH,deviceslot,ret); return false; @@ -242,7 +242,7 @@ bool CPTCPServer::whileLoop() { if(HID_DEBUG) { DEBUG_FUNCTION_LINE("Got Ping, sending now a Pong\n"); } - s32 ret = sendbyte(clientfd, WIIU_CP_TCP_PONG); + int32_t ret = sendbyte(clientfd, WIIU_CP_TCP_PONG); if(ret < 0) { DEBUG_FUNCTION_LINE("Error in %02X: sendbyte PONG\n"); return false; @@ -260,21 +260,21 @@ bool CPTCPServer::whileLoop() { return true; } -bool CPTCPServer::acceptConnection() { - s32 clientfd = getClientFD(); +BOOL CPTCPServer::acceptConnection() { + int32_t clientfd = getClientFD(); DEBUG_FUNCTION_LINE("TCP Connection accepted! Sending my protocol version: %d (0x%02X)\n", (WIIU_CP_TCP_HANDSHAKE - WIIU_CP_TCP_HANDSHAKE_VERSION_1)+1,WIIU_CP_TCP_HANDSHAKE); gUDPClientip = getSockAddr().sin_addr.s_addr; UDPClient::createInstance(); - s32 ret; + int32_t ret; ret = sendbyte(clientfd, WIIU_CP_TCP_HANDSHAKE); //Hey I'm a WiiU console! if(ret < 0) { DEBUG_FUNCTION_LINE("Error sendbyte: %02X\n",WIIU_CP_TCP_HANDSHAKE); return false; } - u8 clientProtocolVersion = recvbyte(clientfd); + uint8_t clientProtocolVersion = recvbyte(clientfd); if(ret < 0) { DEBUG_FUNCTION_LINE("Error recvbyte: %02X\n",WIIU_CP_TCP_HANDSHAKE); return false; diff --git a/source/network/CPTCPServer.hpp b/source/network/CPTCPServer.hpp index 109a6b4..30c564c 100644 --- a/source/network/CPTCPServer.hpp +++ b/source/network/CPTCPServer.hpp @@ -65,8 +65,8 @@ private: } } - static s32 getPriority() { - s32 priority = 28; + static int32_t getPriority() { + int32_t priority = 28; if(OSGetTitleID() == 0x00050000101c9300 || //The Legend of Zelda Breath of the Wild JPN OSGetTitleID() == 0x00050000101c9400 || //The Legend of Zelda Breath of the Wild USA OSGetTitleID() == 0x00050000101c9500 || //The Legend of Zelda Breath of the Wild EUR @@ -78,7 +78,7 @@ private: return priority; } - CPTCPServer(s32 port); + CPTCPServer(int32_t port); virtual ~CPTCPServer(); @@ -88,9 +88,9 @@ private: virtual void DetachAndDelete(); - virtual bool whileLoop(); + virtual BOOL whileLoop(); - virtual bool acceptConnection(); + virtual BOOL acceptConnection(); virtual void onConnectionClosed(); diff --git a/source/network/UDPClient.cpp b/source/network/UDPClient.cpp index ff13121..e04fa6f 100644 --- a/source/network/UDPClient.cpp +++ b/source/network/UDPClient.cpp @@ -24,7 +24,7 @@ UDPClient * UDPClient::instance = NULL; -UDPClient::UDPClient(u32 ip, s32 port) { +UDPClient::UDPClient(uint32_t ip, int32_t port) { sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (sockfd < 0) return; @@ -50,12 +50,12 @@ UDPClient::~UDPClient() { } } -bool UDPClient::sendData(char * data,s32 length) { +BOOL UDPClient::sendData(char * data,int32_t length) { if(sockfd < 0 || data == 0 || length < 0 || gUsedProtocolVersion < WIIU_CP_TCP_HANDSHAKE_VERSION_3) { return false; } if(length > 1400) length = 1400; - s32 ret = send(sockfd, data, length, 0); + int32_t ret = send(sockfd, data, length, 0); return (ret >= 0); } diff --git a/source/network/UDPClient.hpp b/source/network/UDPClient.hpp index 326fd47..8abecf4 100644 --- a/source/network/UDPClient.hpp +++ b/source/network/UDPClient.hpp @@ -52,11 +52,11 @@ private: } } - UDPClient(u32 ip,s32 port); + UDPClient(uint32_t ip,int32_t port); ~UDPClient(); - bool sendData(char * data, s32 length); + BOOL sendData(char * data, int32_t length); - volatile s32 sockfd = -1; + volatile int32_t sockfd = -1; struct sockaddr_in addr; static UDPClient *instance; }; diff --git a/source/network/UDPServer.cpp b/source/network/UDPServer.cpp index 91aeddf..8023e32 100644 --- a/source/network/UDPServer.cpp +++ b/source/network/UDPServer.cpp @@ -26,8 +26,8 @@ CThread * UDPServer::pThread = NULL; UDPServer * UDPServer::instance = NULL; -UDPServer::UDPServer(s32 port) { - s32 ret; +UDPServer::UDPServer(int32_t port) { + int32_t ret; struct sockaddr_in addr; addr.sin_family = AF_INET; @@ -36,7 +36,7 @@ UDPServer::UDPServer(s32 port) { this->sockfd = ret = socket(AF_INET, SOCK_DGRAM, 0); if(ret == -1) return; - s32 enable = 1; + int32_t enable = 1; setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)); ret = bind(sockfd, (sockaddr *)&addr, 16); if(ret < 0) return; @@ -65,7 +65,7 @@ UDPServer::~UDPServer() { } void UDPServer::StartUDPThread(UDPServer * server) { - s32 priority = 28; + int32_t priority = 28; if(OSGetTitleID() == 0x00050000101c9300 || //The Legend of Zelda Breath of the Wild JPN OSGetTitleID() == 0x00050000101c9400 || //The Legend of Zelda Breath of the Wild USA OSGetTitleID() == 0x00050000101c9500 || //The Legend of Zelda Breath of the Wild EUR @@ -78,12 +78,12 @@ void UDPServer::StartUDPThread(UDPServer * server) { UDPServer::pThread->resumeThread(); } -bool UDPServer::cpyIncrementBufferOffset(void * target, void * source, s32 * offset, s32 typesize, s32 maximum) { +BOOL UDPServer::cpyIncrementBufferOffset(void * target, void * source, int32_t * offset, int32_t typesize, int32_t maximum) { if(((int)*offset + typesize) > maximum) { DEBUG_FUNCTION_LINE("Transfer error. Excepted %04X bytes, but only got %04X\n",(*offset + typesize),maximum); return false; } - memcpy(target,(void*)((u32)source+(*offset)),typesize); + memcpy(target,(void*)((uint32_t)source+(*offset)),typesize); *offset += typesize; return true; } @@ -94,46 +94,46 @@ void UDPServer::DoUDPThread(CThread *thread, void *arg) { } void UDPServer::DoUDPThreadInternal() { - u8 buffer[MAX_UDP_SIZE]; - s32 n; + uint8_t buffer[MAX_UDP_SIZE]; + int32_t n; my_cb_user user; while(1) { - //s32 usingVar = exitThread; + //int32_t usingVar = exitThread; if(exitThread)break; memset(buffer,0,MAX_UDP_SIZE); n = recv(sockfd,buffer,MAX_UDP_SIZE,0); if (n < 0) { - s32 errno_ = socketlasterr(); + int32_t errno_ = socketlasterr(); OSSleepTicks(OSMicrosecondsToTicks(2000)); if(errno_ != 11 && errno_ != 9) { break; } continue; } - s32 bufferoffset = 0; - u8 type; + int32_t bufferoffset = 0; + uint8_t type; memcpy((void *)&type,buffer,sizeof(type)); bufferoffset += sizeof(type); switch (buffer[0]) { case WIIU_CP_UDP_CONTROLLER_READ_DATA: { if(gUsedProtocolVersion >= WIIU_CP_TCP_HANDSHAKE_VERSION_1) { - u8 count_commands; + uint8_t count_commands; memcpy((void *)&count_commands,buffer+bufferoffset,sizeof(count_commands)); bufferoffset += sizeof(count_commands); - for(s32 i = 0; ipad_slot < HID_MAX_PADS_COUNT) { slot = usr->pad_slot; } @@ -63,8 +63,8 @@ void ControllerPatcherHID::myHIDMouseReadCallback(u32 handle, s32 error, unsigne buf +=1; } - s8 x_value = 0; - s8 y_value = 0; + int8_t x_value = 0; + int8_t y_value = 0; x_value = buf[1]; y_value = buf[2]; @@ -92,7 +92,7 @@ void ControllerPatcherHID::myHIDMouseReadCallback(u32 handle, s32 error, unsigne } } -void ControllerPatcherHID::myHIDReadCallback(u32 handle, s32 error, unsigned char *buf, u32 bytes_transfered, void *p_user) { +void ControllerPatcherHID::myHIDReadCallback(uint32_t handle, int32_t error, unsigned char *buf, uint32_t bytes_transfered, void *p_user) { if(error == 0 && p_user != NULL && gHIDAttached) { my_cb_user *usr = (my_cb_user*)p_user; @@ -109,7 +109,7 @@ void ControllerPatcherHID::myHIDReadCallback(u32 handle, s32 error, unsigned cha * Intern Callback actions *---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -s32 ControllerPatcherHID::AttachDetachCallback(HIDClient *p_client, HIDDevice *p_device, HIDAttachEvent attach) { +int32_t ControllerPatcherHID::AttachDetachCallback(HIDClient *p_client, HIDDevice *p_device, HIDAttachEvent attach) { if(attach) { DEBUG_FUNCTION_LINE("vid %04x pid %04x connected\n", SWAP16(p_device->vid),SWAP16(p_device->pid)); if(HID_DEBUG) { @@ -140,7 +140,7 @@ s32 ControllerPatcherHID::AttachDetachCallback(HIDClient *p_client, HIDDevice *p slotdata->deviceslot = gMouseSlot; //DEBUG_FUNCTION_LINE("Found Mouse: device: %s slot: %d\n",byte_to_binary(device_info.hid),device_info.slot); } else { - s32 ret; + int32_t ret; if((ret = ControllerPatcherUtils::getDeviceInfoFromVidPid(&device_info)) < 0) { DEBUG_FUNCTION_LINE("ControllerPatcherUtils::getDeviceInfoFromVidPid(&device_info) failed %d \n",ret); return HID_DEVICE_DETACH; @@ -151,7 +151,7 @@ s32 ControllerPatcherHID::AttachDetachCallback(HIDClient *p_client, HIDDevice *p if(slotdata->hidmask) { if(attach) { - s32 bufSize = 64; + int32_t bufSize = 64; if(slotdata->hidmask != gHID_LIST_MOUSE && config_controller[slotdata->deviceslot][CONTRPS_BUF_SIZE][0] == CONTROLLER_PATCHER_VALUE_SET) { bufSize = config_controller[slotdata->deviceslot][CONTRPS_BUF_SIZE][1]; } @@ -164,7 +164,7 @@ s32 ControllerPatcherHID::AttachDetachCallback(HIDClient *p_client, HIDDevice *p usr->handle = p_device->handle; gHIDAttached |= slotdata->hidmask; gHIDCurrentDevice |= slotdata->hidmask; - s32 pads_per_device = 1; + int32_t pads_per_device = 1; if(config_controller[slotdata->deviceslot][CONTRPS_PAD_COUNT][0] != CONTROLLER_PATCHER_INVALIDVALUE) { pads_per_device = config_controller[slotdata->deviceslot][CONTRPS_PAD_COUNT][1]; if(pads_per_device > HID_MAX_PADS_COUNT) { //maximum of HID_MAX_PADS_COUNT @@ -172,14 +172,14 @@ s32 ControllerPatcherHID::AttachDetachCallback(HIDClient *p_client, HIDDevice *p } } - s32 pad_count = config_controller[slotdata->deviceslot][CONTRPS_CONNECTED_PADS][1]; + int32_t pad_count = config_controller[slotdata->deviceslot][CONTRPS_CONNECTED_PADS][1]; if(pad_count > 0x0F) pad_count = 0; //??? - s32 pad_slot = 0; + int32_t pad_slot = 0; - s32 failed = 1; + int32_t failed = 1; - for(s32 i = 0; ipads_per_device = pads_per_device; usr->pad_slot = pad_slot; - for(s32 i = 0; ideviceslot].pad_data[pad_slot+i],0,sizeof(HID_Data)); gHID_Devices[slotdata->deviceslot].pad_data[pad_slot+i].handle = p_device->handle; @@ -243,7 +243,7 @@ s32 ControllerPatcherHID::AttachDetachCallback(HIDClient *p_client, HIDDevice *p gHID_Mouse_Mode = HID_MOUSE_MODE_AIM; HIDRead(p_device->handle, buf, p_device->maxPacketSizeRx, myHIDMouseReadCallback, usr); } else if (slotdata->hidmask == gHID_LIST_SWITCH_PRO) { - s32 read_result = HIDRead(p_device->handle, usr->buf, usr->transfersize, NULL, NULL); + int32_t read_result = HIDRead(p_device->handle, usr->buf, usr->transfersize, NULL, NULL); if(read_result == 64) { if(usr->buf[01] == 0x01) { //We need to do the handshake DEBUG_FUNCTION_LINE("Switch Pro Controller handshake needed\n"); @@ -290,8 +290,8 @@ s32 ControllerPatcherHID::AttachDetachCallback(HIDClient *p_client, HIDDevice *p } else { my_cb_user * user_data = NULL; - s32 founddata = 0; - for(s32 i = 0; ideviceslot].pad_data[i].handle == p_device->handle) { gHID_Devices[slotdata->deviceslot].pad_data[i].handle = 0; @@ -348,7 +348,7 @@ s32 ControllerPatcherHID::AttachDetachCallback(HIDClient *p_client, HIDDevice *p return HID_DEVICE_DETACH; } -void ControllerPatcherHID::HIDReadCallback(u32 handle, unsigned char *buf, u32 bytes_transfered, my_cb_user * usr) { +void ControllerPatcherHID::HIDReadCallback(uint32_t handle, unsigned char *buf, uint32_t bytes_transfered, my_cb_user * usr) { ControllerPatcherUtils::doSampling(usr->slotdata.deviceslot,usr->pad_slot,false); //DEBUG_FUNCTION_LINE("my_read_cbInternal: %d %08X %d\n",bytes_transfered,usr->slotdata.hidmask,usr->slotdata.deviceslot); @@ -356,7 +356,7 @@ void ControllerPatcherHID::HIDReadCallback(u32 handle, unsigned char *buf, u32 b HID_Data * data_ptr = NULL; //Copy the data for all 4 pads - for(s32 i = 0; i<4; i++) { + for(int32_t i = 0; i<4; i++) { data_ptr = &(gHID_Devices[gHID_SLOT_GC].pad_data[i]); memcpy(&(data_ptr->data_union.controller.last_hid_data[0]),&(data_ptr->data_union.controller.cur_hid_data[0]),10); //save last data. memcpy(&(data_ptr->data_union.controller.cur_hid_data[0]),&buf[(i*9)+1],9); //save new data. @@ -364,7 +364,7 @@ void ControllerPatcherHID::HIDReadCallback(u32 handle, unsigned char *buf, u32 b } /* - s32 i = 0; + int32_t i = 0; DEBUG_FUNCTION_LINE("GC1 %08X: %02X %02X %02X %02X %02X %02X %02X %02X %02X ", buf[i*9+0],buf[i*9+1],buf[i*9+2],buf[i*9+3],buf[i*9+4],buf[i*9+5],buf[i*9+6],buf[i*9+7],buf[i*9+8]);i++; DEBUG_FUNCTION_LINE("GC2 %08X: %02X %02X %02X %02X %02X %02X %02X %02X %02X ", buf[i*9+0],buf[i*9+1],buf[i*9+2],buf[i*9+3],buf[i*9+4],buf[i*9+5],buf[i*9+6],buf[i*9+7],buf[i*9+8]);i++; DEBUG_FUNCTION_LINE("GC3 %08X: %02X %02X %02X %02X %02X %02X %02X %02X %02X ", buf[i*9+0],buf[i*9+1],buf[i*9+2],buf[i*9+3],buf[i*9+4],buf[i*9+5],buf[i*9+6],buf[i*9+7],buf[i*9+8]);i++; @@ -374,7 +374,7 @@ void ControllerPatcherHID::HIDReadCallback(u32 handle, unsigned char *buf, u32 b //Depending on how the switch pro controller is connected, it has a different data format. At first we had the Bluetooth version, so we need to convert //the USB one into it now. (When it's connected via USB). The network client always sends the BT version, even if connected via USB to the PC. if(usr->slotdata.hidmask == gHID_LIST_SWITCH_PRO && buf != NULL && bytes_transfered >= 0x20) { - u8 buffer[0x13]; + uint8_t buffer[0x13]; memcpy(buffer,buf+0x0D,0x013); /** @@ -390,13 +390,13 @@ void ControllerPatcherHID::HIDReadCallback(u32 handle, unsigned char *buf, u32 b buf[7] = 0x00; buf[8] = 0x1F; //We want to get the next input! - s32 res = HIDWrite(handle, buf, 9, NULL,NULL); + int32_t res = HIDWrite(handle, buf, 9, NULL,NULL); if(res == 9) { //Check if it's the USB data format. if(buffer[1] == 0) return; //Converting the buttons - u32 buttons = (((u32*)(buffer))[0]) & 0xFFFFFF00; - u32 newButtons = 0; + uint32_t buttons = (((uint32_t*)(buffer))[0]) & 0xFFFFFF00; + uint32_t newButtons = 0; if((buttons & HID_SWITCH_PRO_USB_BUTTON_A_VALUE) == HID_SWITCH_PRO_USB_BUTTON_A_VALUE) newButtons |= HID_SWITCH_PRO_BT_BUTTON_A_VALUE; if((buttons & HID_SWITCH_PRO_USB_BUTTON_B_VALUE) == HID_SWITCH_PRO_USB_BUTTON_B_VALUE) newButtons |= HID_SWITCH_PRO_BT_BUTTON_B_VALUE; if((buttons & HID_SWITCH_PRO_USB_BUTTON_X_VALUE) == HID_SWITCH_PRO_USB_BUTTON_X_VALUE) newButtons |= HID_SWITCH_PRO_BT_BUTTON_X_VALUE; @@ -415,8 +415,8 @@ void ControllerPatcherHID::HIDReadCallback(u32 handle, unsigned char *buf, u32 b if((buttons & HID_SWITCH_PRO_USB_BUTTON_ZL_VALUE) == HID_SWITCH_PRO_USB_BUTTON_ZL_VALUE) newButtons |= HID_SWITCH_PRO_BT_BUTTON_ZL_VALUE; if((buttons & HID_SWITCH_PRO_USB_BUTTON_STICK_L_VALUE) == HID_SWITCH_PRO_USB_BUTTON_STICK_L_VALUE) newButtons |= HID_SWITCH_PRO_BT_BUTTON_STICK_L_VALUE; - u8 dpad = buffer[2]; - u8 dpadResult = HID_SWITCH_PRO_BT_BUTTON_DPAD_NEUTRAL_VALUE; + uint8_t dpad = buffer[2]; + uint8_t dpadResult = HID_SWITCH_PRO_BT_BUTTON_DPAD_NEUTRAL_VALUE; //Converting the DPAD if(((dpad & HID_SWITCH_PRO_USB_BUTTON_UP_VALUE) == HID_SWITCH_PRO_USB_BUTTON_UP_VALUE) && @@ -442,10 +442,10 @@ void ControllerPatcherHID::HIDReadCallback(u32 handle, unsigned char *buf, u32 b } //Converting the stick data - u8 LX = (u8) ((u16) ((buffer[0x04] << 8 &0xFF00) | (((u16)buffer[0x03])&0xFF)) >> 0x04); - u8 LY = (u8)((buffer[0x05] *-1)); - u8 RX = (u8) ((u16) ((buffer[0x07] << 8 &0xFF00) | (((u16)buffer[0x06])&0xFF)) >> 0x04); - u8 RY = (u8)((buffer[0x08] *-1)); + uint8_t LX = (uint8_t) ((uint16_t) ((buffer[0x04] << 8 &0xFF00) | (((uint16_t)buffer[0x03])&0xFF)) >> 0x04); + uint8_t LY = (uint8_t)((buffer[0x05] *-1)); + uint8_t RX = (uint8_t) ((uint16_t) ((buffer[0x07] << 8 &0xFF00) | (((uint16_t)buffer[0x06])&0xFF)) >> 0x04); + uint8_t RY = (uint8_t)((buffer[0x08] *-1)); buf[0] = (newButtons >> 24) & 0xFF; buf[1] = (newButtons >> 16) & 0xFF; @@ -457,8 +457,8 @@ void ControllerPatcherHID::HIDReadCallback(u32 handle, unsigned char *buf, u32 b } } - s32 dsize = (HID_MAX_DATA_LENGTH_PER_PAD > bytes_transfered)? bytes_transfered : HID_MAX_DATA_LENGTH_PER_PAD; - s32 skip = 0; + int32_t dsize = (HID_MAX_DATA_LENGTH_PER_PAD > bytes_transfered)? bytes_transfered : HID_MAX_DATA_LENGTH_PER_PAD; + int32_t skip = 0; //Input filter if( config_controller[usr->slotdata.deviceslot][CONTRPS_INPUT_FILTER][0] != CONTROLLER_PATCHER_INVALIDVALUE) { @@ -468,7 +468,7 @@ void ControllerPatcherHID::HIDReadCallback(u32 handle, unsigned char *buf, u32 b } if(!skip) { - u32 slot = 0; + uint32_t slot = 0; if(usr->pad_slot < HID_MAX_PADS_COUNT) { slot = usr->pad_slot; } @@ -496,8 +496,8 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherHID::setVPADControllerData(V if(buffer == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; HID_Data * data_cur; - s32 buttons_hold; - for(u32 i = 0; islotdata.hidmask & gHID_LIST_MOUSE) { //Reset the input when we have no new inputs @@ -533,8 +533,8 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherHID::setVPADControllerData(V ControllerPatcherUtils::getButtonPressed(data_cur,&buttons_hold,VPAD_BUTTON_STICK_L); ControllerPatcherUtils::getButtonPressed(data_cur,&buttons_hold,VPAD_BUTTON_STICK_R); - u32 last_emulate_stick = (data_cur->last_buttons) & VPAD_MASK_EMULATED_STICKS; // We should only need the emulated stick data. - s32 last_realbuttons = (data_cur->last_buttons) & VPAD_MASK_BUTTONS; + uint32_t last_emulate_stick = (data_cur->last_buttons) & VPAD_MASK_EMULATED_STICKS; // We should only need the emulated stick data. + int32_t last_realbuttons = (data_cur->last_buttons) & VPAD_MASK_BUTTONS; buffer->hold |= buttons_hold; buffer->trigger |= (buttons_hold & (~last_realbuttons)); @@ -562,14 +562,14 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherHID::setVPADControllerData(V } std::vector ControllerPatcherHID::getHIDDataAll() { - u32 hid = gHIDCurrentDevice; + uint32_t hid = gHIDCurrentDevice; std::vector data_list; - for(s32 i = 0; i < gHIDMaxDevices; i++) { + for(int32_t i = 0; i < gHIDMaxDevices; i++) { if((hid & (1 << i)) != 0) { - u32 cur_hidmask = config_controller_hidmask[i]; - for(s32 pad = 0; pad < HID_MAX_PADS_COUNT; pad++) { - s32 res; + uint32_t cur_hidmask = config_controller_hidmask[i]; + for(int32_t pad = 0; pad < HID_MAX_PADS_COUNT; pad++) { + int32_t res; HID_Data * new_data = NULL; if((res = ControllerPatcherHID::getHIDData(cur_hidmask,pad,&new_data)) < 0) { // Checks if the pad is invalid. //DEBUG_FUNCTION_LINE("error: Error getting the HID data from HID(%s) CHAN(). Error %d\n",StringTools::byte_to_binary(cur_hidmask),pad,res); @@ -585,24 +585,24 @@ std::vector ControllerPatcherHID::getHIDDataAll() { /* The slotdata in the HID_Data pointer is empty. We need to provide the hidmask via the parameter */ -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherHID::getHIDData(u32 hidmask, s32 pad, HID_Data ** data) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherHID::getHIDData(uint32_t hidmask, int32_t pad, HID_Data ** data) { if(data == NULL) return CONTROLLER_PATCHER_ERROR_INVALID_BUFFER; if(!(hidmask & gHIDCurrentDevice)) return CONTROLLER_PATCHER_ERROR_HID_NOT_CONNECTED; if(pad < 0 && pad > 3) return CONTROLLER_PATCHER_ERROR_INVALID_CHAN; - s32 device_slot = ControllerPatcherUtils::getDeviceSlot(hidmask); + int32_t device_slot = ControllerPatcherUtils::getDeviceSlot(hidmask); if(device_slot < 0) { return CONTROLLER_PATCHER_ERROR_DEVICE_SLOT_NOT_FOUND; } - s32 real_pad = pad; + int32_t real_pad = pad; if((device_slot != gHID_SLOT_GC) && config_controller[device_slot][CONTRPS_PAD_COUNT][0] != CONTROLLER_PATCHER_INVALIDVALUE) { - s32 pad_count = config_controller[device_slot][CONTRPS_PAD_COUNT][1]; + int32_t pad_count = config_controller[device_slot][CONTRPS_PAD_COUNT][1]; if(pad_count > HID_MAX_PADS_COUNT) pad_count = HID_MAX_PADS_COUNT; pad = (pad/(pad_count))*pad_count; } - s32 result = ControllerPatcherUtils::checkActivePad(hidmask,pad); + int32_t result = ControllerPatcherUtils::checkActivePad(hidmask,pad); if(result < 0) { //Not pad connected to adapter return CONTROLLER_PATCHER_ERROR_NO_PAD_CONNECTED; @@ -614,13 +614,13 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherHID::getHIDData(u32 hidmask, } -void ControllerPatcherHID::HIDGCRumble(u32 handle,my_cb_user *usr) { +void ControllerPatcherHID::HIDGCRumble(uint32_t handle,my_cb_user *usr) { if(usr == NULL) return; if(!ControllerPatcher::isRumbleActivated()) return; - s32 rumblechanged = 0; + int32_t rumblechanged = 0; - for(s32 i = 0; islotdata.deviceslot].pad_data[i]); if(data_ptr->rumbleActive != usr->rumblestatus[i]) { rumblechanged = 1; @@ -636,11 +636,11 @@ void ControllerPatcherHID::HIDGCRumble(u32 handle,my_cb_user *usr) { } } -void ControllerPatcherHID::HIDRumble(u32 handle,my_cb_user *usr,u32 pad) { +void ControllerPatcherHID::HIDRumble(uint32_t handle,my_cb_user *usr,uint32_t pad) { if(usr == NULL || pad > HID_MAX_PADS_COUNT) return; if(!ControllerPatcher::isRumbleActivated()) return; - s32 rumblechanged = 0; + int32_t rumblechanged = 0; HID_Data * data_ptr = &(gHID_Devices[usr->slotdata.deviceslot].pad_data[pad]); if(data_ptr->rumbleActive != usr->rumblestatus[pad]) { usr->rumblestatus[pad] = data_ptr->rumbleActive; @@ -652,7 +652,7 @@ void ControllerPatcherHID::HIDRumble(u32 handle,my_cb_user *usr,u32 pad) { //Seding to the network client! char bytes[6]; - s32 i = 0; + int32_t i = 0; bytes[i++] = 0x01; bytes[i++] = (handle >> 24) & 0xFF; bytes[i++] = (handle >> 16) & 0xFF; @@ -675,7 +675,7 @@ void ControllerPatcherHID::HIDRumble(u32 handle,my_cb_user *usr,u32 pad) { } } -static u8 ds3_rumble_Report[48] = { +static uint8_t ds3_rumble_Report[48] = { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x27, 0x10, 0x00, 0x32, @@ -688,7 +688,7 @@ static u8 ds3_rumble_Report[48] = { 0x00, 0x00, 0x00, }; -void ControllerPatcherHID::HIDDS3Rumble(u32 handle,my_cb_user *usr,s32 rumble) { +void ControllerPatcherHID::HIDDS3Rumble(uint32_t handle,my_cb_user *usr,int32_t rumble) { memcpy(usr->buf, ds3_rumble_Report, 48); if (rumble) { diff --git a/source/patcher/ControllerPatcherHID.hpp b/source/patcher/ControllerPatcherHID.hpp index c1c15d0..ae9702a 100644 --- a/source/patcher/ControllerPatcherHID.hpp +++ b/source/patcher/ControllerPatcherHID.hpp @@ -44,34 +44,34 @@ class ControllerPatcherHID { friend class ControllerPatcher; friend class ControllerPatcherUtils; public: - static s32 externAttachDetachCallback(HIDDevice *p_device, HIDAttachEvent attach); - static void externHIDReadCallback(u32 handle, unsigned char *buf, u32 bytes_transfered, my_cb_user * usr); + static int32_t externAttachDetachCallback(HIDDevice *p_device, HIDAttachEvent attach); + static void externHIDReadCallback(uint32_t handle, unsigned char *buf, uint32_t bytes_transfered, my_cb_user * usr); private: static CONTROLLER_PATCHER_RESULT_OR_ERROR setVPADControllerData(VPADStatus * buffer,std::vector& data); static std::vector getHIDDataAll(); - static CONTROLLER_PATCHER_RESULT_OR_ERROR getHIDData(u32 hidmask, s32 pad, HID_Data ** data); + static CONTROLLER_PATCHER_RESULT_OR_ERROR getHIDData(uint32_t hidmask, int32_t pad, HID_Data ** data); /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- * Rumble *---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ - static void HIDRumble(u32 handle,my_cb_user *usr,u32 pad); + static void HIDRumble(uint32_t handle,my_cb_user *usr,uint32_t pad); - static void HIDGCRumble(u32 handle,my_cb_user *usr); + static void HIDGCRumble(uint32_t handle,my_cb_user *usr); - static void HIDDS3Rumble(u32 handle,my_cb_user *usr,s32 rumble); + static void HIDDS3Rumble(uint32_t handle,my_cb_user *usr,int32_t rumble); /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- * HID Callbacks *--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ - static s32 myAttachDetachCallback(HIDClient *p_client, HIDDevice *p_device, HIDAttachEvent attach); + static int32_t myAttachDetachCallback(HIDClient *p_client, HIDDevice *p_device, HIDAttachEvent attach); - static void myHIDMouseReadCallback(u32 handle, s32 error, unsigned char *buf, u32 bytes_transfered, void *p_user); - static void myHIDReadCallback(u32 handle, s32 error, unsigned char *buf, u32 bytes_transfered, void *p_user); + static void myHIDMouseReadCallback(uint32_t handle, int32_t error, unsigned char *buf, uint32_t bytes_transfered, void *p_user); + static void myHIDReadCallback(uint32_t handle, int32_t error, unsigned char *buf, uint32_t bytes_transfered, void *p_user); - static s32 AttachDetachCallback(HIDClient *p_client, HIDDevice *p_device, HIDAttachEvent attach); - static void HIDReadCallback(u32 handle, unsigned char *buf, u32 bytes_transfered, my_cb_user * usr); + static int32_t AttachDetachCallback(HIDClient *p_client, HIDDevice *p_device, HIDAttachEvent attach); + static void HIDReadCallback(uint32_t handle, unsigned char *buf, uint32_t bytes_transfered, my_cb_user * usr); }; #endif /* _CONTROLLER_PATCHER_HID_H_ */ diff --git a/source/patcher/ControllerPatcherUtils.cpp b/source/patcher/ControllerPatcherUtils.cpp index 832210f..be11908 100644 --- a/source/patcher/ControllerPatcherUtils.cpp +++ b/source/patcher/ControllerPatcherUtils.cpp @@ -20,11 +20,11 @@ #include -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getDataByHandle(s32 handle, my_cb_user ** data) { - for(s32 i = 0; i< gHIDMaxDevices; i++) { - for(s32 j = 0; j<4; j++) { - //log_printf("%d %d %d %d\n",i,j,gHID_Devices[i].pad_data[j].handle,(u32)handle); - if(gHID_Devices[i].pad_data[j].handle == (u32)handle) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getDataByHandle(int32_t handle, my_cb_user ** data) { + for(int32_t i = 0; i< gHIDMaxDevices; i++) { + for(int32_t j = 0; j<4; j++) { + //log_printf("%d %d %d %d\n",i,j,gHID_Devices[i].pad_data[j].handle,(uint32_t)handle); + if(gHID_Devices[i].pad_data[j].handle == (uint32_t)handle) { *data = gHID_Devices[i].pad_data[j].user_data; return CONTROLLER_PATCHER_ERROR_NONE; } @@ -36,12 +36,12 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getDataByHandle(s32 h * Analyse inputs *---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getButtonPressed(HID_Data * data, s32 * buttons_hold, s32 VPADButton) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getButtonPressed(HID_Data * data, int32_t * buttons_hold, int32_t VPADButton) { if(data == NULL || buttons_hold == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; - s32 deviceslot = data->slotdata.deviceslot; + int32_t deviceslot = data->slotdata.deviceslot; - s32 result = -1; + int32_t result = -1; do { if(data->type == DEVICE_TYPE_MOUSE) { @@ -75,10 +75,10 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getButtonPressed(HID_ result = 0; break; } - u8 * cur_data = &data->data_union.controller.cur_hid_data[0]; + uint8_t * cur_data = &data->data_union.controller.cur_hid_data[0]; if(cur_data == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; - s32 cur_config = 0; + int32_t cur_config = 0; if(VPADButton == VPAD_BUTTON_A) { cur_config = CONTRPS_VPAD_BUTTON_A; @@ -111,15 +111,15 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getButtonPressed(HID_ //! Special DPAD treatment. if(config_controller[deviceslot][CONTRPS_DPAD_MODE][0] == CONTROLLER_PATCHER_VALUE_SET) { if(config_controller[deviceslot][CONTRPS_DPAD_MODE][1] == CONTRPDM_Hat) { - u8 mask = 0x0F; + uint8_t mask = 0x0F; if(config_controller[deviceslot][CONTRPS_DPAD_MASK][0] == CONTROLLER_PATCHER_VALUE_SET) { mask = config_controller[deviceslot][CONTRPS_DPAD_MASK][1]; } if(cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_DPAD_NEUTRAL][0]] != config_controller[deviceslot][CONTRPS_VPAD_BUTTON_DPAD_NEUTRAL][1]) { // Not neutral - u8 dir1_0 = 0,dir1_1 = 0; - u8 dir2_0 = 0,dir2_1 = 0; - u8 dir3_0 = 0,dir3_1 = 0; - u8 direction = 0; + uint8_t dir1_0 = 0,dir1_1 = 0; + uint8_t dir2_0 = 0,dir2_1 = 0; + uint8_t dir3_0 = 0,dir3_1 = 0; + uint8_t direction = 0; if(VPADButton == VPAD_BUTTON_LEFT) { dir1_0 = config_controller[deviceslot][CONTRPS_VPAD_BUTTON_DPAD_W][0]; dir2_0 = config_controller[deviceslot][CONTRPS_VPAD_BUTTON_DPAD_NW][0]; @@ -162,7 +162,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getButtonPressed(HID_ } } else if(config_controller[deviceslot][CONTRPS_DPAD_MODE][1] == CONTRPDM_Absolute_2Values) { - s32 contrps_value = 0; + int32_t contrps_value = 0; if(VPADButton == VPAD_BUTTON_LEFT) { contrps_value = CONTRPS_VPAD_BUTTON_DPAD_ABS_LEFT; } else if(VPADButton == VPAD_BUTTON_RIGHT) { @@ -174,7 +174,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getButtonPressed(HID_ } if(contrps_value != 0) { - s32 value_byte = CONTROLLER_PATCHER_INVALIDVALUE; + int32_t value_byte = CONTROLLER_PATCHER_INVALIDVALUE; if((value_byte = config_controller[deviceslot][contrps_value][0]) != CONTROLLER_PATCHER_INVALIDVALUE) { if(cur_data[config_controller[deviceslot][contrps_value][0]] == config_controller[deviceslot][contrps_value][1]) { result = 1; @@ -259,16 +259,16 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getButtonPressed(HID_ return CONTROLLER_PATCHER_ERROR_NONE; } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::isValueSet(HID_Data * data,s32 cur_config) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::isValueSet(HID_Data * data,int32_t cur_config) { if(data == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; - u8 * cur_data = &data->data_union.controller.cur_hid_data[0]; + uint8_t * cur_data = &data->data_union.controller.cur_hid_data[0]; if(cur_data == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; - u32 hidmask = data->slotdata.hidmask; - s32 deviceslot = data->slotdata.deviceslot; + uint32_t hidmask = data->slotdata.hidmask; + int32_t deviceslot = data->slotdata.deviceslot; - s32 result = CONTROLLER_PATCHER_ERROR_NONE; + int32_t result = CONTROLLER_PATCHER_ERROR_NONE; if(config_controller[deviceslot][cur_config][0] != CONTROLLER_PATCHER_INVALIDVALUE) { //Invalid data if(hidmask & gHID_LIST_KEYBOARD) { if(isInKeyboardData(cur_data,config_controller[deviceslot][cur_config][1]) > 0) { @@ -282,9 +282,9 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::isValueSet(HID_Data * } return result; } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::isInKeyboardData(unsigned char * keyboardData,s32 key) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::isInKeyboardData(unsigned char * keyboardData,int32_t key) { if(keyboardData == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; - for(s32 i = 0; i 1) { break; } else if (keyboardData[i] == key) { @@ -298,9 +298,9 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::isInKeyboardData(unsi * Utils for setting the Button data *---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setButtonRemappingData(VPADStatus * old_buffer, VPADStatus * new_buffer,u32 VPADButton, s32 CONTRPS_SLOT) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setButtonRemappingData(VPADStatus * old_buffer, VPADStatus * new_buffer,uint32_t VPADButton, int32_t CONTRPS_SLOT) { if(old_buffer == NULL || new_buffer == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; - u32 new_value = VPADButton; + uint32_t new_value = VPADButton; if(config_controller[gGamePadSlot][CONTRPS_SLOT][0] != CONTROLLER_PATCHER_INVALIDVALUE) { //using new value! new_value = gGamePadValues[config_controller[gGamePadSlot][CONTRPS_SLOT][1]]; @@ -310,7 +310,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setButtonRemappingDat return CONTROLLER_PATCHER_ERROR_NONE; } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setButtonData(VPADStatus * old_buffer, VPADStatus * new_buffer,u32 oldVPADButton,u32 newVPADButton) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setButtonData(VPADStatus * old_buffer, VPADStatus * new_buffer,uint32_t oldVPADButton,uint32_t newVPADButton) { if(old_buffer == NULL || new_buffer == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; if((old_buffer->hold & oldVPADButton) == oldVPADButton) { new_buffer->hold |= newVPADButton; @@ -329,14 +329,14 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setButtonData(VPADSta * Pad Status functions *---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::checkActivePad(u32 hidmask,s32 pad) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::checkActivePad(uint32_t hidmask,int32_t pad) { if(hidmask & gHID_LIST_GC && pad >= 0 && pad <= 3) { if (!(((gHID_Devices[gHID_SLOT_GC].pad_data[pad].data_union.controller.cur_hid_data[0] & 0x10) == 0) && ((gHID_Devices[gHID_SLOT_GC].pad_data[pad].data_union.controller.cur_hid_data[0] & 0x22) != 0x22))) return 1; return CONTROLLER_PATCHER_ERROR_NO_PAD_CONNECTED; } else { - s32 deviceslot = getDeviceSlot(hidmask); + int32_t deviceslot = getDeviceSlot(hidmask); if(deviceslot < 0 ) return CONTROLLER_PATCHER_ERROR_DEVICE_SLOT_NOT_FOUND; - s32 connected_pads = config_controller[deviceslot][CONTRPS_CONNECTED_PADS][1]; + int32_t connected_pads = config_controller[deviceslot][CONTRPS_CONNECTED_PADS][1]; if((connected_pads & (1 << pad)) > 0) { return 1; @@ -346,7 +346,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::checkActivePad(u32 hi } /* -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getActivePad(u32 hidmask){ +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getActivePad(uint32_t hidmask){ if(hidmask & gHID_LIST_GC){ if (!(((gHID_Devices[gHID_SLOT_GC].pad_data[0].data_union.controller.cur_hid_data[0] & 0x10) == 0) && ((gHID_Devices[gHID_SLOT_GC].pad_data[0].data_union.controller.cur_hid_data[0] & 0x22) != 0x22))) return 0; if (!(((gHID_Devices[gHID_SLOT_GC].pad_data[1].data_union.controller.cur_hid_data[0] & 0x10) == 0) && ((gHID_Devices[gHID_SLOT_GC].pad_data[1].data_union.controller.cur_hid_data[0] & 0x22) != 0x22))) return 1; @@ -365,8 +365,8 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getActivePad(u32 hidm CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::normalizeStickValues(VPADVec2D * stick) { if(stick == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; - f32 max_val = 0.0f; - f32 mul_val = 0.0f; + float max_val = 0.0f; + float mul_val = 0.0f; if((max_val = (fabs(stick->x)) + fabs(stick->y)) > 1.414f) { mul_val = 1.414f / max_val; @@ -390,9 +390,9 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::normalizeStickValues( return CONTROLLER_PATCHER_ERROR_NONE; } -f32 ControllerPatcherUtils::convertAnalogValue(u8 value, u8 default_val, u8 min, u8 max, u8 invert,u8 deadzone) { - s8 new_value = (s8)(value - default_val); - u8 range = 0; +float ControllerPatcherUtils::convertAnalogValue(uint8_t value, uint8_t default_val, uint8_t min, uint8_t max, uint8_t invert,uint8_t deadzone) { + int8_t new_value = (int8_t)(value - default_val); + uint8_t range = 0; if(value >= max) { if(invert == 0x01) return -1.0f; return 1.0f; @@ -416,15 +416,15 @@ f32 ControllerPatcherUtils::convertAnalogValue(u8 value, u8 default_val, u8 min, } } -VPADVec2D ControllerPatcherUtils::getAnalogValueByButtons(u8 stick_values) { +VPADVec2D ControllerPatcherUtils::getAnalogValueByButtons(uint8_t stick_values) { VPADVec2D stick; stick.x = 0.0f; stick.y = 0.0f; - u8 up = ((stick_values & STICK_VALUE_UP) == STICK_VALUE_UP); - u8 down = ((stick_values & STICK_VALUE_DOWN) == STICK_VALUE_DOWN); - u8 left = ((stick_values & STICK_VALUE_LEFT) == STICK_VALUE_LEFT); - u8 right = ((stick_values & STICK_VALUE_RIGHT) == STICK_VALUE_RIGHT); + uint8_t up = ((stick_values & STICK_VALUE_UP) == STICK_VALUE_UP); + uint8_t down = ((stick_values & STICK_VALUE_DOWN) == STICK_VALUE_DOWN); + uint8_t left = ((stick_values & STICK_VALUE_LEFT) == STICK_VALUE_LEFT); + uint8_t right = ((stick_values & STICK_VALUE_RIGHT) == STICK_VALUE_RIGHT); if(up) { if(!down) { @@ -462,14 +462,14 @@ VPADVec2D ControllerPatcherUtils::getAnalogValueByButtons(u8 stick_values) { CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(HID_Data * data, VPADStatus * buffer) { if(buffer == NULL || data == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; - s32 deviceslot = data->slotdata.deviceslot; + int32_t deviceslot = data->slotdata.deviceslot; if (data->type == DEVICE_TYPE_MOUSE) { if(gHID_Mouse_Mode == HID_MOUSE_MODE_AIM) { // TODO: tweak values HID_Mouse_Data * ms_data = &data->data_union.mouse.cur_mouse_data; if(ms_data == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; - f32 x_value = ms_data->deltaX/10.0f; - f32 y_value = -1.0f*(ms_data->deltaY/10.0f); + float x_value = ms_data->deltaX/10.0f; + float y_value = -1.0f*(ms_data->deltaY/10.0f); if(config_controller[deviceslot][CONTRPS_MOUSE_STICK][0] != CONTROLLER_PATCHER_INVALIDVALUE) { if(config_controller[deviceslot][CONTRPS_MOUSE_STICK][1] == DEF_L_STICK) { @@ -483,10 +483,10 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(H buffer->rightStick.y += y_value; } } else { - u8 * cur_data = &data->data_union.controller.cur_hid_data[0]; + uint8_t * cur_data = &data->data_union.controller.cur_hid_data[0]; if(cur_data == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; - s32 deadzone = 0; + int32_t deadzone = 0; if( config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_X][0] != CONTROLLER_PATCHER_INVALIDVALUE) { if(config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE][0] == CONTROLLER_PATCHER_VALUE_SET) { @@ -542,7 +542,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(H deadzone); } - u8 stick_values = 0; + uint8_t stick_values = 0; if(isValueSet(data,CONTRPS_VPAD_BUTTON_L_STICK_UP)) { stick_values |= STICK_VALUE_UP; @@ -585,7 +585,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(H if(config_controller[deviceslot][CONTRPS_VPAD_STICK_L_COPY_DPAD][0] != CONTROLLER_PATCHER_INVALIDVALUE) { if(config_controller[deviceslot][CONTRPS_VPAD_STICK_L_COPY_DPAD][0] == 1) { - u8 stick_values = 0; + uint8_t stick_values = 0; if(buffer->hold & VPAD_BUTTON_UP) { stick_values |= STICK_VALUE_UP; @@ -609,7 +609,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(H } if(config_controller[deviceslot][CONTRPS_VPAD_STICK_R_COPY_DPAD][0] != CONTROLLER_PATCHER_INVALIDVALUE) { if(config_controller[deviceslot][CONTRPS_VPAD_STICK_R_COPY_DPAD][0] == 1) { - u8 stick_values = 0; + uint8_t stick_values = 0; if(buffer->hold & VPAD_BUTTON_UP) { stick_values |= STICK_VALUE_UP; @@ -641,15 +641,15 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(H return CONTROLLER_PATCHER_ERROR_NONE; } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setEmulatedSticks(VPADStatus * buffer, u32 * last_emulatedSticks) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setEmulatedSticks(VPADStatus * buffer, uint32_t * last_emulatedSticks) { if(buffer == NULL || last_emulatedSticks == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; - u32 emulatedSticks = 0; + uint32_t emulatedSticks = 0; - s32 l_x_full = (buffer->leftStick.x > 0.5f || buffer->leftStick.x < -0.5f)? 1:0; - s32 l_y_full = (buffer->leftStick.y > 0.5f || buffer->leftStick.y < -0.5f)? 1:0; - s32 r_x_full = (buffer->rightStick.x > 0.5f || buffer->rightStick.x < -0.5f)? 1:0; - s32 r_y_full = (buffer->rightStick.y > 0.5f || buffer->rightStick.y < -0.5f)? 1:0; + int32_t l_x_full = (buffer->leftStick.x > 0.5f || buffer->leftStick.x < -0.5f)? 1:0; + int32_t l_y_full = (buffer->leftStick.y > 0.5f || buffer->leftStick.y < -0.5f)? 1:0; + int32_t r_x_full = (buffer->rightStick.x > 0.5f || buffer->rightStick.x < -0.5f)? 1:0; + int32_t r_y_full = (buffer->rightStick.y > 0.5f || buffer->rightStick.y < -0.5f)? 1:0; if((buffer->leftStick.x > 0.5f) || (buffer->leftStick.x > 0.1f && !l_y_full)) { emulatedSticks |= VPAD_STICK_L_EMULATION_RIGHT; @@ -694,12 +694,12 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setEmulatedSticks(VPA CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setTouch(HID_Data * data,VPADStatus * buffer) { if(buffer == NULL || data == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; if(data->type == DEVICE_TYPE_MOUSE && gHID_Mouse_Mode == HID_MOUSE_MODE_TOUCH) { - s32 buttons_hold; + int32_t buttons_hold; if(getButtonPressed(data,&buttons_hold,VPAD_BUTTON_TOUCH)) { HID_Mouse_Data * ms_data = &data->data_union.mouse.cur_mouse_data; if(ms_data == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; - s32 x_mouse = 80 + ((int)(((ms_data->X)*1.0f/1280.0)*3890.0f)); - s32 y_mouse = 3910 - ((int)(((ms_data->Y)*1.0f/720.0)*3760.0f)); + int32_t x_mouse = 80 + ((int)(((ms_data->X)*1.0f/1280.0)*3890.0f)); + int32_t y_mouse = 3910 - ((int)(((ms_data->Y)*1.0f/720.0)*3760.0f)); buffer->tpNormal.x = x_mouse; buffer->tpNormal.y = y_mouse; buffer->tpNormal.touched = 1; @@ -718,11 +718,11 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setTouch(HID_Data * d } CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::checkAndSetMouseMode(HID_Data * data) { - u32 hidmask = data->slotdata.hidmask; + uint32_t hidmask = data->slotdata.hidmask; if(hidmask & gHID_LIST_KEYBOARD) { - u8 * cur_data = &data->data_union.controller.cur_hid_data[0]; - u8 * last_data = &data->data_union.controller.last_hid_data[0]; + uint8_t * cur_data = &data->data_union.controller.cur_hid_data[0]; + uint8_t * last_data = &data->data_union.controller.last_hid_data[0]; if((isInKeyboardData(cur_data,HID_KEYBOARD_BUTTON_F1) > 0) && ((isInKeyboardData(cur_data,HID_KEYBOARD_BUTTON_F1) > 0) != (isInKeyboardData(last_data,HID_KEYBOARD_BUTTON_F1) > 0)) && gMouseModeCoolDown == 0) { gMouseModeCoolDown = 60; if(gHID_Mouse_Mode == HID_MOUSE_MODE_AIM) { @@ -744,10 +744,10 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::checkAndSetMouseMode( * Other functions *---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToPro(VPADStatus * vpad_buffer,KPADStatus * pro_buffer,u32 * lastButtonsPressesPRO) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToPro(VPADStatus * vpad_buffer,KPADStatus * pro_buffer,uint32_t * lastButtonsPressesPRO) { if(vpad_buffer == NULL || pro_buffer == NULL || lastButtonsPressesPRO == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; - s32 buttons_hold = 0; + int32_t buttons_hold = 0; if(vpad_buffer->hold & VPAD_BUTTON_A) buttons_hold |= WPAD_PRO_BUTTON_A; if(vpad_buffer->hold & VPAD_BUTTON_B) buttons_hold |= WPAD_PRO_BUTTON_B; @@ -815,7 +815,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToPro(VPADSt CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToProWPADRead(VPADStatus * vpad_buffer,WPADStatusProController * pro_buffer) { if(vpad_buffer == NULL || pro_buffer == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; - s32 buttons_hold = 0; + int32_t buttons_hold = 0; if(vpad_buffer->hold & VPAD_BUTTON_A) buttons_hold |= WPAD_PRO_BUTTON_A; if(vpad_buffer->hold & VPAD_BUTTON_B) buttons_hold |= WPAD_PRO_BUTTON_B; @@ -850,10 +850,10 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToProWPADRea if(vpad_buffer->hold & VPAD_STICK_R_EMULATION_UP) buttons_hold |= WPAD_PRO_STICK_R_EMULATION_UP; if(vpad_buffer->hold & VPAD_STICK_R_EMULATION_DOWN) buttons_hold |= WPAD_PRO_STICK_R_EMULATION_DOWN; - pro_buffer->leftStick.x = (s16) (vpad_buffer->leftStick.x * 950.0f); - pro_buffer->leftStick.y = (s16) (vpad_buffer->leftStick.y * 950.0f); - pro_buffer->rightStick.x = (s16) (vpad_buffer->rightStick.x * 950.0f); - pro_buffer->rightStick.y = (s16) (vpad_buffer->rightStick.y * 950.0f); + pro_buffer->leftStick.x = (int16_t) (vpad_buffer->leftStick.x * 950.0f); + pro_buffer->leftStick.y = (int16_t) (vpad_buffer->leftStick.y * 950.0f); + pro_buffer->rightStick.x = (int16_t) (vpad_buffer->rightStick.x * 950.0f); + pro_buffer->rightStick.y = (int16_t) (vpad_buffer->rightStick.y * 950.0f); pro_buffer->buttons = buttons_hold; @@ -864,10 +864,10 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToProWPADRea return CONTROLLER_PATCHER_ERROR_NONE; } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToVPAD(VPADStatus * vpad_buffer,KPADStatus * pro_buffer,u32 * lastButtonsPressesVPAD) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToVPAD(VPADStatus * vpad_buffer,KPADStatus * pro_buffer,uint32_t * lastButtonsPressesVPAD) { if(vpad_buffer == NULL || pro_buffer == NULL || lastButtonsPressesVPAD == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; - s32 buttons_hold = 0; + int32_t buttons_hold = 0; if(pro_buffer->pro.hold & WPAD_PRO_BUTTON_A) buttons_hold |= VPAD_BUTTON_A; @@ -918,20 +918,20 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToVPAD(VPADS return CONTROLLER_PATCHER_ERROR_NONE; } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::checkValueinConfigController(s32 deviceslot,s32 CONTRPS_slot,s32 expectedValue) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::checkValueinConfigController(int32_t deviceslot,int32_t CONTRPS_slot,int32_t expectedValue) { if(config_controller[deviceslot][CONTRPS_slot][0] != CONTROLLER_PATCHER_INVALIDVALUE) { if(expectedValue == config_controller[deviceslot][CONTRPS_slot][1]) return 1; } return 0; } -void ControllerPatcherUtils::setConfigValue(u8 * dest, u8 first, u8 second) { +void ControllerPatcherUtils::setConfigValue(uint8_t * dest, uint8_t first, uint8_t second) { dest[0] = first; dest[1] = second; } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getDeviceSlot(u32 hidmask) { - for(s32 i = 0; i < gHIDMaxDevices; i++) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getDeviceSlot(uint32_t hidmask) { + for(int32_t i = 0; i < gHIDMaxDevices; i++) { if(hidmask & config_controller_hidmask[i]) { return i; } @@ -941,9 +941,9 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getDeviceSlot(u32 hid CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getDeviceInfoFromVidPid(DeviceInfo * info) { if(info != NULL) { - for(s32 i = 0; i< gHIDMaxDevices; i++) { - u16 my_vid = config_controller[i][CONTRPS_VID][0] * 0x100 + config_controller[i][CONTRPS_VID][1]; - u16 my_pid = config_controller[i][CONTRPS_PID][0] * 0x100 + config_controller[i][CONTRPS_PID][1]; + for(int32_t i = 0; i< gHIDMaxDevices; i++) { + uint16_t my_vid = config_controller[i][CONTRPS_VID][0] * 0x100 + config_controller[i][CONTRPS_VID][1]; + uint16_t my_pid = config_controller[i][CONTRPS_PID][0] * 0x100 + config_controller[i][CONTRPS_PID][1]; //log_printf("info->vidpid.vid (%04X) == my_vid (%04X) && info->vidpid.pid (%04X) == my_pid (%04X)\n",info->vidpid.vid,my_vid,info->vidpid.pid,my_pid); if(info->vidpid.vid == my_vid && info->vidpid.pid == my_pid) { info->slotdata.hidmask = config_controller_hidmask[i]; @@ -976,7 +976,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getNextSlotData(HIDSl return CONTROLLER_PATCHER_ERROR_NONE; } -CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getVIDPIDbyDeviceSlot(s32 deviceslot, DeviceVIDPIDInfo * vidpid) { +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getVIDPIDbyDeviceSlot(int32_t deviceslot, DeviceVIDPIDInfo * vidpid) { if(vidpid == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER; if(deviceslot >= gHIDMaxDevices || deviceslot < 0) return CONTROLLER_PATCHER_ERROR_DEVICE_SLOT_NOT_FOUND; vidpid->vid = config_controller[deviceslot][CONTRPS_VID][0] * 0x100 + config_controller[deviceslot][CONTRPS_VID][1]; @@ -985,14 +985,14 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getVIDPIDbyDeviceSlot return CONTROLLER_PATCHER_ERROR_NONE; } -s32 ControllerPatcherUtils::getPadSlotInAdapter(s32 deviceslot, u8 * input_data) { - s32 slot_incr = 0; +int32_t ControllerPatcherUtils::getPadSlotInAdapter(int32_t deviceslot, uint8_t * input_data) { + int32_t slot_incr = 0; if(config_controller[deviceslot][CONTRPS_PAD_COUNT][0] != CONTROLLER_PATCHER_INVALIDVALUE) { - s32 pad_count = config_controller[deviceslot][CONTRPS_PAD_COUNT][1]; + int32_t pad_count = config_controller[deviceslot][CONTRPS_PAD_COUNT][1]; if(pad_count > HID_MAX_PADS_COUNT) { pad_count = HID_MAX_PADS_COUNT; } - for(s32 i= 0; iactive) { DeviceInfo device_info; @@ -1039,10 +1039,10 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::doSamplingSingle(WPAD memset(&device_info,0,sizeof(device_info)); device_info.vidpid = padinfo->vidpid; - s32 res = -1; + int32_t res = -1; if((res = ControllerPatcherUtils::getDeviceInfoFromVidPid(&device_info)) >= 0) { if(!ignorePadSlot) { - s32 real_pad = (padinfo->pad/(device_info.pad_count))*device_info.pad_count; + int32_t real_pad = (padinfo->pad/(device_info.pad_count))*device_info.pad_count; if(real_pad == padslot && device_info.slotdata.deviceslot == deviceslot) { if(ControllerPatcherUtils::checkActivePad(device_info.slotdata.hidmask,padinfo->pad)) { gSamplingCallback(chan); diff --git a/source/patcher/ControllerPatcherUtils.hpp b/source/patcher/ControllerPatcherUtils.hpp index 1a8cd5b..e8b37af 100644 --- a/source/patcher/ControllerPatcherUtils.hpp +++ b/source/patcher/ControllerPatcherUtils.hpp @@ -46,7 +46,7 @@ public: \return When the functions failed result < 0 is returned. If the result is >= 0 the function was successful. The returned value is the deviceslot of the given HID-Mask **/ - static CONTROLLER_PATCHER_RESULT_OR_ERROR getDeviceSlot(u32 hidmask); + static CONTROLLER_PATCHER_RESULT_OR_ERROR getDeviceSlot(uint32_t hidmask); /** \brief Returns the device slot for a given HID-Mask. @@ -56,7 +56,7 @@ public: \return When the functions failed result < 0 is returned. If the result is >= 0 the function was successful. The actual result will be store in the given my_cb_user **. **/ - static CONTROLLER_PATCHER_RESULT_OR_ERROR getDataByHandle(s32 handle, my_cb_user ** data); + static CONTROLLER_PATCHER_RESULT_OR_ERROR getDataByHandle(int32_t handle, my_cb_user ** data); /** \brief Returns the VID/PID for the given device slot. @@ -66,17 +66,17 @@ public: \return When the functions failed result < 0 is returned. If the result is >= 0 the function was successful. The actual result will be store in the given DeviceVIDPIDInfo *. **/ - static CONTROLLER_PATCHER_RESULT_OR_ERROR getVIDPIDbyDeviceSlot(s32 deviceslot, DeviceVIDPIDInfo * vidpid); + static CONTROLLER_PATCHER_RESULT_OR_ERROR getVIDPIDbyDeviceSlot(int32_t deviceslot, DeviceVIDPIDInfo * vidpid); /** \brief Set the VPAD data for a given KPAD data. * * \param vpad_buffer VPADStatus* A pointer to the VPAD Data where the result will be stored. * \param pro_buffer KPADData* A pointer to the given KPADData data. - * \param lastButtonsPressesPRO u32* A pointer to the button presses of the previous call. Will be updated while calling. + * \param lastButtonsPressesPRO uint32_t* A pointer to the button presses of the previous call. Will be updated while calling. * \return When the functions failed result < 0 is returned. If the result is >= 0 the function was successful. * */ - static CONTROLLER_PATCHER_RESULT_OR_ERROR translateToVPAD(VPADStatus * vpad_buffer,KPADStatus * pro_buffer,u32 * lastButtonsPressesVPAD); + static CONTROLLER_PATCHER_RESULT_OR_ERROR translateToVPAD(VPADStatus * vpad_buffer,KPADStatus * pro_buffer,uint32_t * lastButtonsPressesVPAD); private: /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- * Analyse inputs @@ -85,12 +85,12 @@ private: /** \brief Checks if a the given @p VPADButton was pressed in the given HID @data. When it was pressed, the result will be set the in given @p buttons_hold * * \param data Pointer to the HID_Data from where the input is read. - * \param buttons_hold Pointer to the u32 where the result will be written to. + * \param buttons_hold Pointer to the uint32_t where the result will be written to. * \param VPADButton The button that will be checked * \return When the functions failed result < 0 is returned.If the result is >= 0 the function was successful. * */ - static CONTROLLER_PATCHER_RESULT_OR_ERROR getButtonPressed(HID_Data * data, s32 * buttons_hold, s32 VPADButton); + static CONTROLLER_PATCHER_RESULT_OR_ERROR getButtonPressed(HID_Data * data, int32_t * buttons_hold, int32_t VPADButton); /** \brief Checks if a given value is set in the HID_DATA given the data in the slot number provided by cur_config. @@ -100,7 +100,7 @@ private: * \return When the functions failed result < 0 is returned. If the value is set, 1 will be returned. Otherwise 0. * */ - static CONTROLLER_PATCHER_RESULT_OR_ERROR isValueSet(HID_Data * data,s32 cur_config); + static CONTROLLER_PATCHER_RESULT_OR_ERROR isValueSet(HID_Data * data,int32_t cur_config); /** \brief Checks if a given key in the keyboard data is pressed. @@ -110,7 +110,7 @@ private: * \return When the functions failed result < 0 is returned. If the key is active pressed, 1 is returned. * */ - static CONTROLLER_PATCHER_RESULT_OR_ERROR isInKeyboardData(unsigned char * keyboardData,s32 key); + static CONTROLLER_PATCHER_RESULT_OR_ERROR isInKeyboardData(unsigned char * keyboardData,int32_t key); /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- * Utils for setting the Button data @@ -126,7 +126,7 @@ private: * \return When the functions failed result < 0 is returned. If the pad is active/connected, 1 is returned. * */ - static CONTROLLER_PATCHER_RESULT_OR_ERROR setButtonRemappingData(VPADStatus * old_buffer, VPADStatus * new_buffer,u32 VPADButton, s32 CONTRPS_SLOT); + static CONTROLLER_PATCHER_RESULT_OR_ERROR setButtonRemappingData(VPADStatus * old_buffer, VPADStatus * new_buffer,uint32_t VPADButton, int32_t CONTRPS_SLOT); /** \brief Checks if a given button (oldVPADButton) is set in a given VPADStatus struct (old_buffer). If its set, it will set an other @@ -139,7 +139,7 @@ private: \return When the functions failed result < 0 is returned. If the pad is active/connected, 1 is returned. **/ - static CONTROLLER_PATCHER_RESULT_OR_ERROR setButtonData(VPADStatus * old_buffer, VPADStatus * new_buffer,u32 oldVPADButton,u32 newVPADButton); + static CONTROLLER_PATCHER_RESULT_OR_ERROR setButtonData(VPADStatus * old_buffer, VPADStatus * new_buffer,uint32_t oldVPADButton,uint32_t newVPADButton); /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- * Pad Status functions @@ -152,7 +152,7 @@ private: \return When the functions failed result < 0 is returned. If the pad is active/connected, 1 is returned. **/ - static CONTROLLER_PATCHER_RESULT_OR_ERROR checkActivePad(u32 hidmask,s32 pad); + static CONTROLLER_PATCHER_RESULT_OR_ERROR checkActivePad(uint32_t hidmask,int32_t pad); /** \brief Returns the first active pad of devices with the given HID-Mask. Currently only implemented for the GC-Adapter. Every other pad will always return 0. @@ -161,7 +161,7 @@ private: \return When the functions failed result < 0 is returned. If the result is >= 0 the function was successful. The returned value is fist active pad. **/ - static CONTROLLER_PATCHER_RESULT_OR_ERROR getActivePad(u32 hidmask); + static CONTROLLER_PATCHER_RESULT_OR_ERROR getActivePad(uint32_t hidmask); /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- * Stick functions @@ -187,7 +187,7 @@ private: \return When the functions failed result < 0 is returned. If the result is >= 0 the function was successful. **/ - static f32 convertAnalogValue(u8 value, u8 default_val, u8 min, u8 max, u8 invert,u8 deadzone); + static float convertAnalogValue(uint8_t value, uint8_t default_val, uint8_t min, uint8_t max, uint8_t invert,uint8_t deadzone); /** \brief Calculates a the stick data (VPADVec2D) from given digital direction. @@ -196,7 +196,7 @@ private: \return The VPADVec2D with the set values. **/ - static VPADVec2D getAnalogValueByButtons(u8 stick_values); + static VPADVec2D getAnalogValueByButtons(uint8_t stick_values); /** \brief Handles the analog-stick data of HID devices. The result will written in the VPADStatus buffer. @@ -239,7 +239,7 @@ private: \return When the functions failed result < 0 is returned. If the result is >= 0 the function was successful. **/ - static CONTROLLER_PATCHER_RESULT_OR_ERROR setEmulatedSticks(VPADStatus * buffer, u32 * last_emulatedSticks); + static CONTROLLER_PATCHER_RESULT_OR_ERROR setEmulatedSticks(VPADStatus * buffer, uint32_t * last_emulatedSticks); /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- * Other functions @@ -248,11 +248,11 @@ private: * * \param vpad_buffer VPADStatus* A pointer to the given VPAD Data. * \param pro_buffer KPADData* A pointer to the KPADData where the result will be stored. - * \param lastButtonsPressesPRO u32* A pointer to the button presses of the previous call. Will be updated while calling. + * \param lastButtonsPressesPRO uint32_t* A pointer to the button presses of the previous call. Will be updated while calling. * \return When the functions failed result < 0 is returned. If the result is >= 0 the function was successful. * */ - static CONTROLLER_PATCHER_RESULT_OR_ERROR translateToPro(VPADStatus * vpad_buffer, KPADStatus * pro_buffer, u32 * lastButtonsPressesPRO); + static CONTROLLER_PATCHER_RESULT_OR_ERROR translateToPro(VPADStatus * vpad_buffer, KPADStatus * pro_buffer, uint32_t * lastButtonsPressesPRO); static CONTROLLER_PATCHER_RESULT_OR_ERROR translateToProWPADRead(VPADStatus * vpad_buffer,WPADStatusProController * pro_buffer); /** @@ -264,16 +264,16 @@ private: \return When the functions failed result < 0 is returned. If the result is >= 0 the function was successful. **/ - static CONTROLLER_PATCHER_RESULT_OR_ERROR checkValueinConfigController(s32 device_slot,s32 CONTRPS_slot,s32 expectedValue); + static CONTROLLER_PATCHER_RESULT_OR_ERROR checkValueinConfigController(int32_t device_slot,int32_t CONTRPS_slot,int32_t expectedValue); /** - \brief Sets two u8 values to the given pointer. + \brief Sets two uint8_t values to the given pointer. \param dest: pointer to the destination array. \param first: Value that will be written in @p dest[0] \param second: Value that will be written in @p dest[1] **/ - static void setConfigValue(u8 * dest , u8 first, u8 second); + static void setConfigValue(uint8_t * dest , uint8_t first, uint8_t second); /** \brief Saves a new free device slot and the corresponding HID-Mask in the given @p HIDSlotData pointer @@ -302,7 +302,7 @@ private: \param current input data \return The relative slot in the device **/ - static s32 getPadSlotInAdapter(s32 deviceslot, u8 * input_data); + static int32_t getPadSlotInAdapter(int32_t deviceslot, uint8_t * input_data); /** \brief returns a pointer to the ControllerMapping to the given controller type @@ -313,9 +313,9 @@ private: **/ static ControllerMappingPAD * getControllerMappingByType(UController_Type type); - static CONTROLLER_PATCHER_RESULT_OR_ERROR doSampling(u16 deviceslot,u8 padslot,bool ignorePadSlot); + static CONTROLLER_PATCHER_RESULT_OR_ERROR doSampling(uint16_t deviceslot,uint8_t padslot,BOOL ignorePadSlot); - static CONTROLLER_PATCHER_RESULT_OR_ERROR doSamplingSingle(WPADChan chan, u16 deviceslot, u8 padslot, bool ignorePadSlot); + static CONTROLLER_PATCHER_RESULT_OR_ERROR doSamplingSingle(WPADChan chan, uint16_t deviceslot, uint8_t padslot, BOOL ignorePadSlot); }; #endif /* _CONTROLLER_PATCHER_UTIL_H_ */ diff --git a/source/utils/CPRetainVars.cpp b/source/utils/CPRetainVars.cpp index 4dd43f3..4624705 100644 --- a/source/utils/CPRetainVars.cpp +++ b/source/utils/CPRetainVars.cpp @@ -19,56 +19,56 @@ ControllerMapping gControllerMapping __attribute__((section(".data"))); -u8 gConfig_done __attribute__((section(".data"))) = 0; -u8 gButtonRemappingConfigDone __attribute__((section(".data"))) = 0; +uint8_t gConfig_done __attribute__((section(".data"))) = 0; +uint8_t gButtonRemappingConfigDone __attribute__((section(".data"))) = 0; -u32 gHIDAttached __attribute__((section(".data"))) = 0; -u32 gHIDCurrentDevice __attribute__((section(".data"))) = 0; +uint32_t gHIDAttached __attribute__((section(".data"))) = 0; +uint32_t gHIDCurrentDevice __attribute__((section(".data"))) = 0; -u16 gHIDRegisteredDevices __attribute__((section(".data"))) = 0; +uint16_t gHIDRegisteredDevices __attribute__((section(".data"))) = 0; HIDClient gHIDClient __attribute__((section(".data"))); HID_DEVICE_DATA gHID_Devices[gHIDMaxDevices] __attribute__((section(".data"))); -u8 gHID_Mouse_Mode __attribute__((section(".data"))) = HID_MOUSE_MODE_TOUCH; +uint8_t gHID_Mouse_Mode __attribute__((section(".data"))) = HID_MOUSE_MODE_TOUCH; -u8 gMouseModeCoolDown __attribute__((section(".data"))) = 0; +uint8_t gMouseModeCoolDown __attribute__((section(".data"))) = 0; -u32 gGamePadValues[CONTRPS_MAX_VALUE] __attribute__((section(".data"))); +uint32_t gGamePadValues[CONTRPS_MAX_VALUE] __attribute__((section(".data"))); -u8 config_controller[gHIDMaxDevices][CONTRPS_MAX_VALUE][2] __attribute__((section(".data"))); -u32 config_controller_hidmask[gHIDMaxDevices] __attribute__((section(".data"))); +uint8_t config_controller[gHIDMaxDevices][CONTRPS_MAX_VALUE][2] __attribute__((section(".data"))); +uint32_t config_controller_hidmask[gHIDMaxDevices] __attribute__((section(".data"))); -u32 gHID_LIST_GC __attribute__((section(".data"))) = 0; -u32 gHID_LIST_DS3 __attribute__((section(".data"))) = 0; -u32 gHID_LIST_DS4 __attribute__((section(".data"))) = 0; -u32 gHID_LIST_KEYBOARD __attribute__((section(".data"))) = 0; -u32 gHID_LIST_SWITCH_PRO __attribute__((section(".data"))) = 0; -u32 gHID_LIST_MOUSE __attribute__((section(".data"))) = 0; +uint32_t gHID_LIST_GC __attribute__((section(".data"))) = 0; +uint32_t gHID_LIST_DS3 __attribute__((section(".data"))) = 0; +uint32_t gHID_LIST_DS4 __attribute__((section(".data"))) = 0; +uint32_t gHID_LIST_KEYBOARD __attribute__((section(".data"))) = 0; +uint32_t gHID_LIST_SWITCH_PRO __attribute__((section(".data"))) = 0; +uint32_t gHID_LIST_MOUSE __attribute__((section(".data"))) = 0; -u16 gGamePadSlot __attribute__((section(".data"))) = 0; -u16 gHID_SLOT_GC __attribute__((section(".data"))) = 0; -u16 gHID_SLOT_KEYBOARD __attribute__((section(".data"))) = 0; -u16 gMouseSlot __attribute__((section(".data"))) = 0; +uint16_t gGamePadSlot __attribute__((section(".data"))) = 0; +uint16_t gHID_SLOT_GC __attribute__((section(".data"))) = 0; +uint16_t gHID_SLOT_KEYBOARD __attribute__((section(".data"))) = 0; +uint16_t gMouseSlot __attribute__((section(".data"))) = 0; -u8 gOriginalDimState __attribute__((section(".data"))) = 0; -u8 gOriginalAPDState __attribute__((section(".data"))) = 0; +uint8_t gOriginalDimState __attribute__((section(".data"))) = 0; +uint8_t gOriginalAPDState __attribute__((section(".data"))) = 0; -u16 gNetworkController[gHIDMaxDevices][HID_MAX_PADS_COUNT][4] __attribute__((section(".data"))); -s32 gHIDNetworkClientID __attribute__((section(".data"))) = 0; -u8 gUsedProtocolVersion __attribute__((section(".data"))) = WIIU_CP_TCP_HANDSHAKE; +uint16_t gNetworkController[gHIDMaxDevices][HID_MAX_PADS_COUNT][4] __attribute__((section(".data"))); +int32_t gHIDNetworkClientID __attribute__((section(".data"))) = 0; +uint8_t gUsedProtocolVersion __attribute__((section(".data"))) = WIIU_CP_TCP_HANDSHAKE; WPADConnectCallback gWPADConnectCallback[4] __attribute__((section(".data"))); WPADConnectCallback gKPADConnectCallback[4] __attribute__((section(".data"))); WPADExtensionCallback gExtensionCallback[4] __attribute__((section(".data"))); WPADSamplingCallback gSamplingCallback __attribute__((section(".data"))) = 0; -u8 gCallbackCooldown __attribute__((section(".data"))) = 0; -u8 gNetworkControllerActivated __attribute__((section(".data"))) = 1; +uint8_t gCallbackCooldown __attribute__((section(".data"))) = 0; +uint8_t gNetworkControllerActivated __attribute__((section(".data"))) = 1; -u8 gGlobalRumbleActivated __attribute__((section(".data"))) = 0; +uint8_t gGlobalRumbleActivated __attribute__((section(".data"))) = 0; -u32 gUDPClientip __attribute__((section(".data"))) = 0; +uint32_t gUDPClientip __attribute__((section(".data"))) = 0; ControllerMappingPADInfo* gProPadInfo[4] __attribute__((section(".data"))) = {&gControllerMapping.proController[0].pad_infos[0], &gControllerMapping.proController[1].pad_infos[0], &gControllerMapping.proController[2].pad_infos[0], diff --git a/source/utils/CPRetainVars.hpp b/source/utils/CPRetainVars.hpp index 2394547..3474ed2 100644 --- a/source/utils/CPRetainVars.hpp +++ b/source/utils/CPRetainVars.hpp @@ -22,55 +22,55 @@ extern ControllerMapping gControllerMapping; -extern u8 gConfig_done; -extern u8 gButtonRemappingConfigDone; +extern uint8_t gConfig_done; +extern uint8_t gButtonRemappingConfigDone; -extern u32 gHIDAttached; -extern u32 gHIDCurrentDevice; +extern uint32_t gHIDAttached; +extern uint32_t gHIDCurrentDevice; extern HIDClient gHIDClient; -extern u16 gHIDRegisteredDevices; +extern uint16_t gHIDRegisteredDevices; extern HID_DEVICE_DATA gHID_Devices[gHIDMaxDevices]; -extern u8 gHID_Mouse_Mode; +extern uint8_t gHID_Mouse_Mode; -extern u8 gMouseModeCoolDown; +extern uint8_t gMouseModeCoolDown; -extern u32 gGamePadValues[CONTRPS_MAX_VALUE]; +extern uint32_t gGamePadValues[CONTRPS_MAX_VALUE]; -extern u8 config_controller[gHIDMaxDevices][CONTRPS_MAX_VALUE][2]; -extern u32 config_controller_hidmask[gHIDMaxDevices]; +extern uint8_t config_controller[gHIDMaxDevices][CONTRPS_MAX_VALUE][2]; +extern uint32_t config_controller_hidmask[gHIDMaxDevices]; -extern u32 gHID_LIST_GC; -extern u32 gHID_LIST_DS3; -extern u32 gHID_LIST_DS4; -extern u32 gHID_LIST_KEYBOARD; -extern u32 gHID_LIST_SWITCH_PRO; -extern u32 gHID_LIST_MOUSE; -extern u16 gGamePadSlot; +extern uint32_t gHID_LIST_GC; +extern uint32_t gHID_LIST_DS3; +extern uint32_t gHID_LIST_DS4; +extern uint32_t gHID_LIST_KEYBOARD; +extern uint32_t gHID_LIST_SWITCH_PRO; +extern uint32_t gHID_LIST_MOUSE; +extern uint16_t gGamePadSlot; -extern u16 gHID_SLOT_GC; -extern u16 gHID_SLOT_KEYBOARD; -extern u16 gMouseSlot; +extern uint16_t gHID_SLOT_GC; +extern uint16_t gHID_SLOT_KEYBOARD; +extern uint16_t gMouseSlot; -extern u8 gOriginalDimState; -extern u8 gOriginalAPDState; +extern uint8_t gOriginalDimState; +extern uint8_t gOriginalAPDState; -extern u16 gNetworkController[gHIDMaxDevices][HID_MAX_PADS_COUNT][4]; -extern s32 gHIDNetworkClientID; +extern uint16_t gNetworkController[gHIDMaxDevices][HID_MAX_PADS_COUNT][4]; +extern int32_t gHIDNetworkClientID; -extern u8 gUsedProtocolVersion; +extern uint8_t gUsedProtocolVersion; extern WPADConnectCallback gWPADConnectCallback[4]; extern WPADConnectCallback gKPADConnectCallback[4]; extern WPADExtensionCallback gExtensionCallback[4]; extern WPADSamplingCallback gSamplingCallback; -extern u8 gCallbackCooldown; -extern u8 gGlobalRumbleActivated; -extern u8 gNetworkControllerActivated; +extern uint8_t gCallbackCooldown; +extern uint8_t gGlobalRumbleActivated; +extern uint8_t gNetworkControllerActivated; -extern u32 gUDPClientip; +extern uint32_t gUDPClientip; extern ControllerMappingPADInfo* gProPadInfo[4]; #endif // CP_RETAINS_VARS_H_