mirror of
https://github.com/Maschell/controller_patcher.git
synced 2024-11-24 21:16:52 +01:00
Adopt header changes for the kpad.h and wpad.h
This commit is contained in:
parent
ae5fbd4f84
commit
7091552d3d
@ -29,6 +29,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <padscore/wpad.h>
|
||||
#include <vpad/input.h>
|
||||
#include "ControllerPatcherDefs.h"
|
||||
|
||||
class ControllerPatcher{
|
||||
@ -235,13 +237,15 @@ class ControllerPatcher{
|
||||
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR resetCallbackData();
|
||||
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setKPADConnectedCallback(s32 chan, wpad_connect_callback_t callback);
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setKPADConnectedCallback(s32 chan, WPADConnectCallback callback);
|
||||
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setKPADExtensionCallback(s32 chan, wpad_connect_callback_t callback);
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setKPADExtensionCallback(s32 chan, WPADConnectCallback callback);
|
||||
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setWPADConnectCallback(s32 chan, wpad_connect_callback_t callback);
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setWPADConnectCallback(s32 chan, WPADConnectCallback callback);
|
||||
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR handleCallbackData(bool button_pressed);
|
||||
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR handleCallbackDataInternal(WPADChan chan);
|
||||
};
|
||||
|
||||
#endif /* _CONTROLLER_PATCHER_H_ */
|
||||
|
@ -886,8 +886,8 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setProControllerDataFromHI
|
||||
if(mode == PRO_CONTROLLER_MODE_KPADDATA){
|
||||
KPADStatus * pro_buffer = (KPADStatus *) data;
|
||||
if((res = ControllerPatcherUtils::translateToPro(vpad_buffer,pro_buffer,&last_button_hold[chan])) < 0 ) return res;
|
||||
}else if(mode == PRO_CONTROLLER_MODE_WPADReadData){
|
||||
WPADReadData * pro_buffer = (WPADReadData *) data;
|
||||
} else if(mode == PRO_CONTROLLER_MODE_WPADReadData) {
|
||||
WPADStatusProController * pro_buffer = (WPADStatusProController *) data;
|
||||
if((res = ControllerPatcherUtils::translateToProWPADRead(vpad_buffer,pro_buffer)) < 0 ) return res;
|
||||
}
|
||||
for(std::vector<HID_Data *>::iterator it = data_list.begin(); it != data_list.end(); ++it) {
|
||||
|
@ -726,15 +726,15 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToPro(VPADSt
|
||||
*lastButtonsPressesPRO = buttons_hold;
|
||||
|
||||
pro_buffer->format = WPAD_FMT_PRO_CONTROLLER;
|
||||
pro_buffer->wpad_error = 0x00;
|
||||
pro_buffer->device_type = WPAD_EXT_PRO_CONTROLLER;
|
||||
pro_buffer->error = 0x00;
|
||||
pro_buffer->extensionType = WPAD_EXT_PRO_CONTROLLER;
|
||||
pro_buffer->pro.wired = 1;
|
||||
pro_buffer->pro.charging = 1;
|
||||
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
}
|
||||
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToProWPADRead(VPADStatus * vpad_buffer,WPADReadData * pro_buffer){
|
||||
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;
|
||||
@ -779,9 +779,9 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToProWPADRea
|
||||
|
||||
pro_buffer->buttons = buttons_hold;
|
||||
|
||||
pro_buffer->fmt = WPAD_FMT_PRO_CONTROLLER;
|
||||
pro_buffer->dataFormat = WPAD_FMT_PRO_CONTROLLER;
|
||||
pro_buffer->err = 0x00;
|
||||
pro_buffer->dev = WPAD_EXT_PRO_CONTROLLER;
|
||||
pro_buffer->extensionType = WPAD_EXT_PRO_CONTROLLER;
|
||||
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
}
|
||||
@ -945,27 +945,33 @@ ControllerMappingPAD * ControllerPatcherUtils::getControllerMappingByType(UContr
|
||||
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::doSampling(u16 deviceslot,u8 padslot = 0,bool ignorePadSlot = false){
|
||||
if(gSamplingCallback != NULL){
|
||||
for(int i=0;i<4;i++){
|
||||
ControllerMappingPADInfo * padinfo = gProPadInfo[i];
|
||||
if(padinfo->active){
|
||||
DeviceInfo device_info;
|
||||
doSamplingSingle(WPAD_CHAN_0, deviceslot, padslot, ignorePadSlot);
|
||||
doSamplingSingle(WPAD_CHAN_1, deviceslot, padslot, ignorePadSlot);
|
||||
doSamplingSingle(WPAD_CHAN_2, deviceslot, padslot, ignorePadSlot);
|
||||
doSamplingSingle(WPAD_CHAN_3, deviceslot, padslot, ignorePadSlot);
|
||||
}
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
}
|
||||
|
||||
memset(&device_info,0,sizeof(device_info));
|
||||
device_info.vidpid = padinfo->vidpid;
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::doSamplingSingle(WPADChan chan, u16 deviceslot,u8 padslot = 0,bool ignorePadSlot = false){
|
||||
ControllerMappingPADInfo * padinfo = gProPadInfo[chan];
|
||||
if(padinfo->active){
|
||||
DeviceInfo device_info;
|
||||
|
||||
s32 res = -1;
|
||||
if((res = ControllerPatcherUtils::getDeviceInfoFromVidPid(&device_info)) >= 0){
|
||||
if(!ignorePadSlot){
|
||||
s32 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(i);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
gSamplingCallback(i);
|
||||
memset(&device_info,0,sizeof(device_info));
|
||||
device_info.vidpid = padinfo->vidpid;
|
||||
|
||||
s32 res = -1;
|
||||
if((res = ControllerPatcherUtils::getDeviceInfoFromVidPid(&device_info)) >= 0){
|
||||
if(!ignorePadSlot){
|
||||
s32 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);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
gSamplingCallback(chan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ class ControllerPatcherUtils{
|
||||
*
|
||||
*/
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR translateToPro(VPADStatus * vpad_buffer, KPADStatus * pro_buffer, u32 * lastButtonsPressesPRO);
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR translateToProWPADRead(VPADStatus * vpad_buffer,WPADReadData * pro_buffer);
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR translateToProWPADRead(VPADStatus * vpad_buffer,WPADStatusProController * pro_buffer);
|
||||
|
||||
/**
|
||||
\brief Checks if the value at the given device + CONTRPS slot equals the expected value.
|
||||
@ -314,6 +314,8 @@ class ControllerPatcherUtils{
|
||||
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 doSamplingSingle(WPADChan chan, u16 deviceslot, u8 padslot, bool ignorePadSlot);
|
||||
};
|
||||
|
||||
#endif /* _CONTROLLER_PATCHER_UTIL_H_ */
|
||||
|
@ -59,10 +59,10 @@ u16 gNetworkController[gHIDMaxDevices][HID_MAX_PADS_COUNT][4] __attribute__((sec
|
||||
s32 gHIDNetworkClientID __attribute__((section(".data"))) = 0;
|
||||
u8 gUsedProtocolVersion __attribute__((section(".data"))) = WIIU_CP_TCP_HANDSHAKE;
|
||||
|
||||
wpad_connect_callback_t gWPADConnectCallback[4] __attribute__((section(".data")));
|
||||
wpad_connect_callback_t gKPADConnectCallback[4] __attribute__((section(".data")));
|
||||
wpad_extension_callback_t gExtensionCallback[4] __attribute__((section(".data")));
|
||||
wpad_sampling_callback_t gSamplingCallback __attribute__((section(".data"))) = 0;
|
||||
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;
|
||||
|
||||
|
@ -62,10 +62,10 @@ extern s32 gHIDNetworkClientID;
|
||||
|
||||
extern u8 gUsedProtocolVersion;
|
||||
|
||||
extern wpad_connect_callback_t gWPADConnectCallback[4];
|
||||
extern wpad_connect_callback_t gKPADConnectCallback[4];
|
||||
extern wpad_extension_callback_t gExtensionCallback[4];
|
||||
extern wpad_sampling_callback_t gSamplingCallback;
|
||||
extern WPADConnectCallback gWPADConnectCallback[4];
|
||||
extern WPADConnectCallback gKPADConnectCallback[4];
|
||||
extern WPADExtensionCallback gExtensionCallback[4];
|
||||
extern WPADSamplingCallback gSamplingCallback;
|
||||
extern u8 gCallbackCooldown;
|
||||
extern u8 gGlobalRumbleActivated;
|
||||
extern u8 gNetworkControllerActivated;
|
||||
|
Loading…
Reference in New Issue
Block a user