mirror of
https://github.com/Maschell/controller_patcher.git
synced 2024-11-24 21:16:52 +01:00
First commit of the wut branch.
This commit is contained in:
parent
7f811bb836
commit
2a78306327
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,3 @@
|
||||
release/*
|
||||
build/*
|
||||
libcontrollerpatcher.cbp
|
||||
libcontrollerpatcher.depend
|
18
.travis.yml
18
.travis.yml
@ -7,13 +7,13 @@ dist: trusty
|
||||
env:
|
||||
global:
|
||||
- DEVKITPRO=/opt/devkitpro
|
||||
- WUT_ROOT=/opt/devkitpro/wut
|
||||
- DEVKITPPC=/opt/devkitpro/devkitPPC
|
||||
- PORTLIBREPOS=$HOME/portlibrepos
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- "$HOME/.local"
|
||||
- "$PORTLIBREPOS"
|
||||
- "$DEVKITPRO"
|
||||
|
||||
addons:
|
||||
@ -27,16 +27,22 @@ before_install:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb -O /tmp/devkitpro-pacman.deb; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo dpkg -i /tmp/devkitpro-pacman.deb; fi
|
||||
- yes | sudo dkp-pacman -Syu devkitPPC --needed
|
||||
- wget $(curl -s https://api.github.com/repos/decaf-emu/wut/releases/latest | grep 'browser_' | grep 'linux' | cut -d\" -f4
|
||||
|
||||
install:
|
||||
- 7z x -y $(ls | grep "linux") -o${WUT_ROOT}
|
||||
- cd $PORTLIBREPOS
|
||||
- git clone https://github.com/Maschell/libutils.git -b wut
|
||||
- cd libutils
|
||||
- mkdir build && cd build
|
||||
- cmake -DCMAKE_TOOLCHAIN_FILE=$WUT_ROOT/share/wut.toolchain.cmake -DCMAKE_INSTALL_PREFIX=$WUT_ROOT ../
|
||||
- make install
|
||||
- cd $PORTLIBREPOS
|
||||
- ((git clone https://github.com/Maschell/dynamic_libs.git -b lib && (7z x -y ./dynamic_libs/libs/portlibs.zip -o${DEVKITPRO})) || (cd dynamic_libs && git pull))
|
||||
- (git clone https://github.com/Maschell/libutils.git || (cd libutils && git pull))
|
||||
- (cd dynamic_libs && ((make -j8 | grep -c "built ... ") && make install && echo "installed" ) || (echo "no need for make install" && make))
|
||||
- (cd libutils && ((make -j8 | grep -c "built ... ") && make install && echo "installed" ) || (echo "no need for make install" && make))
|
||||
|
||||
before_script:
|
||||
- cd $TRAVIS_BUILD_DIR/
|
||||
|
||||
script:
|
||||
- make && make install
|
||||
- mkdir build && cd build
|
||||
- cmake -DCMAKE_TOOLCHAIN_FILE=$WUT_ROOT/share/wut.toolchain.cmake -DCMAKE_INSTALL_PREFIX=$WUT_ROOT ../
|
||||
- make install
|
27
CMakeLists.txt
Normal file
27
CMakeLists.txt
Normal file
@ -0,0 +1,27 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
project(controllerpatcherwut)
|
||||
include("${WUT_ROOT}/share/wut.cmake" REQUIRED)
|
||||
|
||||
file(GLOB_RECURSE SOURCE_FILES *.c *.cpp)
|
||||
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||
|
||||
add_library(controllerpatcherwut STATIC ${SOURCE_FILES} ${HEADER_FILES})
|
||||
|
||||
target_link_libraries(controllerpatcherwut
|
||||
utilswut)
|
||||
|
||||
target_include_directories(controllerpatcherwut PUBLIC "include")
|
||||
target_include_directories(controllerpatcherwut PRIVATE "src")
|
||||
|
||||
include_directories("${WUT_ROOT}/include/libutils" REQUIRED)
|
||||
|
||||
wut_enable_stdcpp(controllerpatcherwut)
|
||||
wut_default_malloc(controllerpatcherwut)
|
||||
|
||||
target_include_directories(controllerpatcherwut PUBLIC "include")
|
||||
|
||||
install(TARGETS controllerpatcherwut
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
|
||||
FILES_MATCHING PATTERN "*.h*")
|
143
Makefile
143
Makefile
@ -1,143 +0,0 @@
|
||||
DO_LOGGING := 1
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC)
|
||||
endif
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPRO")
|
||||
endif
|
||||
|
||||
export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH)
|
||||
export PORTLIBS := $(DEVKITPRO)/portlibs/ppc
|
||||
|
||||
PREFIX := powerpc-eabi-
|
||||
|
||||
export AS := $(PREFIX)as
|
||||
export CC := $(PREFIX)gcc
|
||||
export CXX := $(PREFIX)g++
|
||||
export AR := $(PREFIX)ar
|
||||
export OBJCOPY := $(PREFIX)objcopy
|
||||
|
||||
include $(DEVKITPPC)/base_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
# DATA is a list of directories containing binary files
|
||||
# LIBDIR is where the built library will be placed
|
||||
# all directories are relative to this makefile
|
||||
#---------------------------------------------------------------------------------
|
||||
BUILD ?= release
|
||||
SOURCES := source \
|
||||
source/utils \
|
||||
source/network \
|
||||
source/patcher \
|
||||
source/config \
|
||||
INCLUDES := include
|
||||
DATA :=
|
||||
LIB := lib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
CFLAGS = -g -O2 -Wall -D__wiiu__ $(MACHDEP) $(INCLUDE)
|
||||
CXXFLAGS = $(CFLAGS) -D_GNU_SOURCE
|
||||
|
||||
ifeq ($(DO_LOGGING), 1)
|
||||
CFLAGS += -D__LOGGING__
|
||||
CXXFLAGS += -D__LOGGING__
|
||||
endif
|
||||
|
||||
ASFLAGS := -g
|
||||
|
||||
export WIIUBIN := $(LIB)/libcontrollerpatcher.a
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -ldynamiclibs -lutils
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export TOPDIR ?= $(CURDIR)/..
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include -I$(PORTLIBS)/include/libutils
|
||||
|
||||
|
||||
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) $(PORTLIBS)/lib
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr debug release bin obj $(LIB) include
|
||||
|
||||
all: $(WIIUBIN)
|
||||
|
||||
install:
|
||||
@cp $(BUILD)/lib/libcontrollerpatcher.a $(PORTLIBS)/lib
|
||||
@mkdir -p $(PORTLIBS)/include/controller_patcher
|
||||
@cp source/ControllerPatcher.hpp $(PORTLIBS)/include/controller_patcher
|
||||
@cp source/ControllerPatcherDefs.h $(PORTLIBS)/include/controller_patcher
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(WIIUBIN) : $(OFILES) $(LIB)
|
||||
@rm -f "$(WIIUBIN)"
|
||||
@$(AR) rcs "$(WIIUBIN)" $(OFILES)
|
||||
@echo built ... $(notdir $@)
|
||||
|
||||
$(LIB):
|
||||
mkdir $(LIB)
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
17
README.md
17
README.md
@ -1,4 +1,4 @@
|
||||
[![Build Status](https://travis-ci.org/Maschell/controller_patcher.svg?branch=master)](https://travis-ci.org/Maschell/controller_patcher)
|
||||
[![Build Status](https://travis-ci.org/Maschell/controller_patcher.svg?branch=wut)](https://travis-ci.org/Maschell/controller_patcher)
|
||||
|
||||
# What is in this controller_patcher repository
|
||||
These files are the magic behind tools like HID to VPAD and can used to use your USB HID Device on your WiiU console.
|
||||
@ -15,28 +15,29 @@ To able to use the logging change the "DO_LOGGING" parameter in the Makefile.
|
||||
# Compiling
|
||||
You need to install all dependencies first!
|
||||
|
||||
Install this static library into your portlibs folder via:
|
||||
Install this static library into your wut folder via:
|
||||
|
||||
```
|
||||
make && make install
|
||||
mkdir build && cd build
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=$WUT_ROOT/share/wut.toolchain.cmake -DCMAKE_INSTALL_PREFIX=$WUT_ROOT ../
|
||||
make install
|
||||
```
|
||||
|
||||
Link the application with
|
||||
|
||||
```
|
||||
-lutils -ldynamiclibs -lcontrollerpatcher
|
||||
-lutilswut -lcontrollerpatcherwut
|
||||
```
|
||||
|
||||
You also need to add the include path to your Makefile. Example:
|
||||
|
||||
```
|
||||
export INCLUDE := [...] -I$(PORTLIBS)/include
|
||||
export INCLUDE := [...] -I$(WUT_ROOT)/include
|
||||
```
|
||||
|
||||
# Dependencies
|
||||
- Application needs to be loaded from the [homebrew_launcher](https://github.com/dimok789/homebrew_launcher)
|
||||
- [libutils](https://github.com/Maschell/libutils) for common functions.
|
||||
- [dynamic_libs](https://github.com/Maschell/dynamic_libs/tree/lib) for access to the functions.
|
||||
- [libutils](https://github.com/Maschell/libutils/tree/wut) (WUT branch) for common functions.
|
||||
- [wut](https://github.com/decaf-emu/wut) (WUT branch) for common functions.
|
||||
|
||||
# Example implementation
|
||||
|
||||
|
247
include/controller_patcher/ControllerPatcher.hpp
Normal file
247
include/controller_patcher/ControllerPatcher.hpp
Normal file
@ -0,0 +1,247 @@
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2016,2017 Maschell
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file ControllerPatcher.hpp
|
||||
* @author Maschell
|
||||
* @date 30 Mar 2017
|
||||
* \brief This files contain all public accessible functions of the controller patcher engine
|
||||
*
|
||||
* @see https://github.com/Maschell/controller_patcher
|
||||
*/
|
||||
|
||||
#ifndef _CONTROLLER_PATCHER_H_
|
||||
#define _CONTROLLER_PATCHER_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ControllerPatcherDefs.h"
|
||||
|
||||
class ControllerPatcher{
|
||||
public:
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------
|
||||
* Initialization
|
||||
*----------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
\brief Resets the data thats used by the controller configuration
|
||||
**/
|
||||
static void ResetConfig();
|
||||
/**
|
||||
\brief Initializes the libraries, functions, values and arrays. Need to be called on each start of an Application. Returns false on errors.
|
||||
@param pathToConfig: The path of the directory containing the configuration files. The path needs already to be mounted and accessible via the
|
||||
devoptabs! If no configuration should be loaded from the SD Card, set this parameter to NULL.
|
||||
**/
|
||||
|
||||
static bool Init(const char * pathToConfig);
|
||||
|
||||
/**
|
||||
\brief De-Initialises the controller_patcher
|
||||
**/
|
||||
static void DeInit();
|
||||
/**
|
||||
Initialises the button remapping
|
||||
**/
|
||||
static void InitButtonMapping();
|
||||
|
||||
/**
|
||||
Starts the network server
|
||||
**/
|
||||
static void startNetworkServer();
|
||||
|
||||
/**
|
||||
Stops the network server
|
||||
**/
|
||||
static void stopNetworkServer();
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------
|
||||
* Initialization
|
||||
*----------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
Sets the data in a given data from HID Devices. The information about which HID Device will be used is stored in the gControllerMapping array int slot 1-4 (counting starts at 0, which is the gamepad). The \p
|
||||
chan provides the information of the channel from which the data will be used. The mode sets the type of the buffer.
|
||||
|
||||
@param buffer: A pointer to the struct where the result will be stored.
|
||||
@param chan: Indicates the channel from which slot the information about the mapped HID Device will be used.
|
||||
@param mode: Sets the type of the buffer. PRO_CONTROLLER_MODE_KPADDATA or PRO_CONTROLLER_MODE_WPADReadData
|
||||
|
||||
@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);
|
||||
|
||||
|
||||
/**
|
||||
Sets the data in a given VPADStatus from HID Devices. The information about which HID Device will be used is stored in the gControllerMapping array in slot 0.
|
||||
|
||||
@param buffer: A pointer to an KPADData struct where the result will be stored.
|
||||
@param chan: Indicates the channel from which slot the information about the mapped HID Device will be used.
|
||||
|
||||
@return When the functions failed result < 0 is returned. If the result is == 0 the function was successful.
|
||||
**/
|
||||
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setControllerDataFromHID(VPADStatus * buffer);
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------
|
||||
* Useful functions
|
||||
*----------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
Enable the Controller mapping.
|
||||
@return When the functions failed result < 0 is returned. If the result is == 0 the function was successful.
|
||||
**/
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR enableControllerMapping();
|
||||
|
||||
/**
|
||||
Disbale the Controller mapping. Afterwards all connected controllers will be used for the gamepad.
|
||||
@return When the functions failed result < 0 is returned. If the result is == 0 the function was successful.
|
||||
**/
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR disableControllerMapping();
|
||||
|
||||
/**
|
||||
Disables the energy settings for the WiiU. Settings can be restored via restoreWiiUEnergySetting.
|
||||
@return When the functions failed result < 0 is returned. If the result is == 0 the function was successful.
|
||||
**/
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR disableWiiUEnergySetting();
|
||||
|
||||
/**
|
||||
Restores the WiiU Energy Settings.
|
||||
@return When the functions failed result < 0 is returned. If the result is == 0 the function was successful.
|
||||
**/
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR restoreWiiUEnergySetting();
|
||||
|
||||
/**
|
||||
Resets the controller mapping for a given controller type.
|
||||
|
||||
@param type: The type of the controller.
|
||||
|
||||
@return When the functions failed result < 0 is returned. If the result is == 0 the function was successful.
|
||||
**/
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR resetControllerMapping(UController_Type type);
|
||||
|
||||
|
||||
/**
|
||||
Adds a controller mapping
|
||||
|
||||
@param type: The type of the controller.
|
||||
@param config: information about the added controller.
|
||||
|
||||
@return When the functions failed result < 0 is returned. If the result is == 0 the function was successful.
|
||||
**/
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR addControllerMapping(UController_Type type,ControllerMappingPADInfo config);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@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);
|
||||
|
||||
/**
|
||||
@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);
|
||||
|
||||
/**
|
||||
Checks if a emulated controller is connected for the given controller type / mapping slot.
|
||||
|
||||
@param type: The type of the controller.
|
||||
@param mapping_slot: Slot of the controller mapped to this controller type (usually 0)
|
||||
|
||||
@return
|
||||
**/
|
||||
static bool isControllerConnectedAndActive(UController_Type type,s32 mapping_slot = 0);
|
||||
|
||||
/**
|
||||
Search for a connected mouse and returns a pointer to it's data.
|
||||
@return A pointer to the first connected mouse that is found. NULL if no mouse is connected.
|
||||
**/
|
||||
static HID_Mouse_Data * getMouseData();
|
||||
|
||||
/**
|
||||
Sets a rumble status for a controller.
|
||||
|
||||
@param type: The type of the controller.
|
||||
@param status: status of the rumble. 0 for off, 1 for on.
|
||||
|
||||
@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);
|
||||
|
||||
/**
|
||||
Reads the input of all connected HID devices. Each attached controller will write his date into given array until it's full.
|
||||
|
||||
@param output: A pointer to an InputData array where the result will be stored. (Make sure to reset the array before using this function).
|
||||
@param array_size: Size of the given InputData array.
|
||||
|
||||
@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);
|
||||
|
||||
/**
|
||||
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.
|
||||
One easy way to set it is using the a config file on the SD Card.
|
||||
|
||||
@param buffer: A pointer to the buffer where the input will be read from and the result will be stored.
|
||||
|
||||
@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);
|
||||
|
||||
/**
|
||||
Prints the current pressed down buttons of the given \p VPADStatus pointer. Uses the utils/logger.c UDP logger..
|
||||
|
||||
@param buffer: A pointer to the buffer where the input will be read from.
|
||||
|
||||
@return When the functions failed result < 0 is returned. If the result is == 0 the function was successful.
|
||||
**/
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR printVPADButtons(VPADStatus * buffer);
|
||||
|
||||
static std::string getIdentifierByVIDPID(u16 vid,u16 pid);
|
||||
|
||||
static void destroyConfigHelper();
|
||||
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR doSamplingForDeviceSlot(u16 device_slot);
|
||||
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setRumbleActivated(bool value);
|
||||
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setNetworkControllerActivated(bool value);
|
||||
|
||||
static bool isRumbleActivated();
|
||||
|
||||
static bool isButtonRemappingDone();
|
||||
|
||||
static bool isKeyboardConnected();
|
||||
|
||||
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, wpad_connect_callback_t callback);
|
||||
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setKPADExtensionCallback(s32 chan, wpad_connect_callback_t callback);
|
||||
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setWPADConnectCallback(s32 chan, wpad_connect_callback_t callback);
|
||||
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR handleCallbackData(bool button_pressed);
|
||||
};
|
||||
|
||||
#endif /* _CONTROLLER_PATCHER_H_ */
|
@ -27,8 +27,7 @@
|
||||
#ifndef _CONTROLLER_PATCHER_DEFS_H_
|
||||
#define _CONTROLLER_PATCHER_DEFS_H_
|
||||
|
||||
#include <dynamic_libs/os_types.h>
|
||||
|
||||
#include <wut.h>
|
||||
|
||||
#define FIRST_INSTRUCTION_IN_SAMPLING_CALLBACK 0x9421FFB8
|
||||
|
@ -29,7 +29,6 @@
|
||||
|
||||
#include <dirent.h>
|
||||
|
||||
#include <dynamic_libs/fs_functions.h>
|
||||
#include <utils/logger.h>
|
||||
|
||||
s32 ConfigReader::numberValidFiles = 0;
|
||||
|
@ -21,14 +21,10 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <vector>
|
||||
#include <coreinit/energysaver.h>
|
||||
|
||||
#include <utils/logger.h>
|
||||
|
||||
#include <dynamic_libs/sys_functions.h>
|
||||
#include <dynamic_libs/syshid_functions.h>
|
||||
#include <dynamic_libs/socket_functions.h>
|
||||
#include <dynamic_libs/padscore_functions.h>
|
||||
|
||||
// This stores the holded buttons for the gamepad after the button remapping.
|
||||
static u32 buttonRemapping_lastButtonsHold = 0;
|
||||
|
||||
@ -36,8 +32,8 @@ static u32 buttonRemapping_lastButtonsHold = 0;
|
||||
|
||||
// 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 VPADDATA that will be used to get the HID Data for the Pro Controllers. One for each channel.
|
||||
static VPADData myVPADBuffer[4];
|
||||
// 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];
|
||||
|
||||
void ControllerPatcher::InitButtonMapping(){
|
||||
if(HID_DEBUG){ DEBUG_FUNCTION_LINE("Init called \n"); }
|
||||
@ -471,12 +467,6 @@ void ControllerPatcher::ResetConfig(){
|
||||
}
|
||||
|
||||
bool ControllerPatcher::Init(const char * pathToConfig){
|
||||
InitOSFunctionPointers();
|
||||
InitSocketFunctionPointers();
|
||||
InitSysHIDFunctionPointers();
|
||||
InitVPadFunctionPointers();
|
||||
InitPadScoreFunctionPointers();
|
||||
|
||||
gSamplingCallback = (wpad_sampling_callback_t)((u32)KPADRead + 0x1F0);
|
||||
if(*(u32*)gSamplingCallback != FIRST_INSTRUCTION_IN_SAMPLING_CALLBACK){
|
||||
//In Firmware <= 5.1.2 the offset changes
|
||||
@ -490,11 +480,6 @@ bool ControllerPatcher::Init(const char * pathToConfig){
|
||||
|
||||
if(HID_DEBUG){ DEBUG_FUNCTION_LINE("Init called! \n"); }
|
||||
|
||||
if(syshid_handle == 0){
|
||||
DEBUG_FUNCTION_LINE("Failed to load the HID API \n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(gConfig_done == HID_INIT_NOT_DONE){
|
||||
if(HID_DEBUG){ DEBUG_FUNCTION_LINE("First time calling the Init\n"); }
|
||||
gConfig_done = HID_INIT_DONE;
|
||||
@ -759,8 +744,8 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setRumble(UController_Type
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::gettingInputAllDevices(InputData * output,s32 array_size){
|
||||
s32 hid = gHIDCurrentDevice;
|
||||
HID_Data * data_cur;
|
||||
VPADData pad_buffer;
|
||||
VPADData * buffer = &pad_buffer;
|
||||
VPADStatus pad_buffer;
|
||||
VPADStatus * buffer = &pad_buffer;
|
||||
s32 result = CONTROLLER_PATCHER_ERROR_NONE;
|
||||
for(s32 i = 0;i< gHIDMaxDevices;i++){
|
||||
if((hid & (1 << i)) != 0){
|
||||
@ -851,7 +836,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setProControllerDataFromHI
|
||||
if(chan < 0 || chan > 3) return CONTROLLER_PATCHER_ERROR_INVALID_CHAN;
|
||||
//if(gControllerMapping.proController[chan].enabled == 0) return CONTROLLER_PATCHER_ERROR_MAPPING_DISABLED;
|
||||
|
||||
VPADData * vpad_buffer = &myVPADBuffer[chan];
|
||||
VPADStatus * vpad_buffer = &myVPADBuffer[chan];
|
||||
memset(vpad_buffer,0,sizeof(*vpad_buffer));
|
||||
|
||||
std::vector<HID_Data *> data_list;
|
||||
@ -894,7 +879,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setProControllerDataFromHI
|
||||
|
||||
//a bit hacky?
|
||||
if(mode == PRO_CONTROLLER_MODE_KPADDATA){
|
||||
KPADData * pro_buffer = (KPADData *) data;
|
||||
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;
|
||||
@ -908,7 +893,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setProControllerDataFromHI
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
}
|
||||
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setControllerDataFromHID(VPADData * buffer){
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setControllerDataFromHID(VPADStatus * buffer){
|
||||
if(buffer == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER;
|
||||
//if(gControllerMapping.gamepad.enabled == 0) return CONTROLLER_PATCHER_ERROR_MAPPING_DISABLED;
|
||||
|
||||
@ -960,52 +945,52 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setControllerDataFromHID(V
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
}
|
||||
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::printVPADButtons(VPADData * buffer){
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::printVPADButtons(VPADStatus * buffer){
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
/* BROKEN on transitions.*/
|
||||
if(buffer == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER;
|
||||
if(buffer->btns_d != 0x00000000){
|
||||
if(buffer->trigger != 0x00000000){
|
||||
char output[250];
|
||||
|
||||
output[0] = 0; //null terminate it. just in case.
|
||||
|
||||
if((buffer->btns_d & VPAD_BUTTON_A) == VPAD_BUTTON_A) strcat(output,"A ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_B) == VPAD_BUTTON_B) strcat(output,"B ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_X) == VPAD_BUTTON_X) strcat(output,"X ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_Y) == VPAD_BUTTON_Y) strcat(output,"Y ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_L) == VPAD_BUTTON_L) strcat(output,"L ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_R) == VPAD_BUTTON_R) strcat(output,"R ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_ZR) == VPAD_BUTTON_ZR) strcat(output,"ZR ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_ZL) == VPAD_BUTTON_ZL) strcat(output,"ZL ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_LEFT) == VPAD_BUTTON_LEFT) strcat(output,"Left ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_RIGHT) == VPAD_BUTTON_RIGHT) strcat(output,"Right ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_UP) == VPAD_BUTTON_UP) strcat(output,"Up ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_DOWN) == VPAD_BUTTON_DOWN) strcat(output,"Down ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_PLUS) == VPAD_BUTTON_PLUS) strcat(output,"+ ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_MINUS) == VPAD_BUTTON_MINUS) strcat(output,"- ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_TV) == VPAD_BUTTON_TV) strcat(output,"TV ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_HOME) == VPAD_BUTTON_HOME) strcat(output,"HOME ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_STICK_L) == VPAD_BUTTON_STICK_L) strcat(output,"SL ");
|
||||
if((buffer->btns_d & VPAD_BUTTON_STICK_R) == VPAD_BUTTON_STICK_R) strcat(output,"SR ");
|
||||
if((buffer->btns_d & VPAD_STICK_R_EMULATION_LEFT) == VPAD_STICK_R_EMULATION_LEFT) strcat(output,"RE_Left ");
|
||||
if((buffer->btns_d & VPAD_STICK_R_EMULATION_RIGHT) == VPAD_STICK_R_EMULATION_RIGHT) strcat(output,"RE_Right ");
|
||||
if((buffer->btns_d & VPAD_STICK_R_EMULATION_UP) == VPAD_STICK_R_EMULATION_UP) strcat(output,"RE_Up ");
|
||||
if((buffer->btns_d & VPAD_STICK_R_EMULATION_DOWN) == VPAD_STICK_R_EMULATION_DOWN) strcat(output,"RE_Down ");
|
||||
if((buffer->btns_d & VPAD_STICK_L_EMULATION_LEFT) == VPAD_STICK_L_EMULATION_LEFT) strcat(output,"LE_Left ");
|
||||
if((buffer->btns_d & VPAD_STICK_L_EMULATION_RIGHT) == VPAD_STICK_L_EMULATION_RIGHT) strcat(output,"LE_Right ");
|
||||
if((buffer->btns_d & VPAD_STICK_L_EMULATION_UP) == VPAD_STICK_L_EMULATION_UP) strcat(output,"LE_Up ");
|
||||
if((buffer->btns_d & VPAD_STICK_L_EMULATION_DOWN) == VPAD_STICK_L_EMULATION_DOWN) strcat(output,"LE_Down ");
|
||||
if((buffer->trigger & VPAD_BUTTON_A) == VPAD_BUTTON_A) strcat(output,"A ");
|
||||
if((buffer->trigger & VPAD_BUTTON_B) == VPAD_BUTTON_B) strcat(output,"B ");
|
||||
if((buffer->trigger & VPAD_BUTTON_X) == VPAD_BUTTON_X) strcat(output,"X ");
|
||||
if((buffer->trigger & VPAD_BUTTON_Y) == VPAD_BUTTON_Y) strcat(output,"Y ");
|
||||
if((buffer->trigger & VPAD_BUTTON_L) == VPAD_BUTTON_L) strcat(output,"L ");
|
||||
if((buffer->trigger & VPAD_BUTTON_R) == VPAD_BUTTON_R) strcat(output,"R ");
|
||||
if((buffer->trigger & VPAD_BUTTON_ZR) == VPAD_BUTTON_ZR) strcat(output,"ZR ");
|
||||
if((buffer->trigger & VPAD_BUTTON_ZL) == VPAD_BUTTON_ZL) strcat(output,"ZL ");
|
||||
if((buffer->trigger & VPAD_BUTTON_LEFT) == VPAD_BUTTON_LEFT) strcat(output,"Left ");
|
||||
if((buffer->trigger & VPAD_BUTTON_RIGHT) == VPAD_BUTTON_RIGHT) strcat(output,"Right ");
|
||||
if((buffer->trigger & VPAD_BUTTON_UP) == VPAD_BUTTON_UP) strcat(output,"Up ");
|
||||
if((buffer->trigger & VPAD_BUTTON_DOWN) == VPAD_BUTTON_DOWN) strcat(output,"Down ");
|
||||
if((buffer->trigger & VPAD_BUTTON_PLUS) == VPAD_BUTTON_PLUS) strcat(output,"+ ");
|
||||
if((buffer->trigger & VPAD_BUTTON_MINUS) == VPAD_BUTTON_MINUS) strcat(output,"- ");
|
||||
if((buffer->trigger & VPAD_BUTTON_TV) == VPAD_BUTTON_TV) strcat(output,"TV ");
|
||||
if((buffer->trigger & VPAD_BUTTON_HOME) == VPAD_BUTTON_HOME) strcat(output,"HOME ");
|
||||
if((buffer->trigger & VPAD_BUTTON_STICK_L) == VPAD_BUTTON_STICK_L) strcat(output,"SL ");
|
||||
if((buffer->trigger & VPAD_BUTTON_STICK_R) == VPAD_BUTTON_STICK_R) strcat(output,"SR ");
|
||||
if((buffer->trigger & VPAD_STICK_R_EMULATION_LEFT) == VPAD_STICK_R_EMULATION_LEFT) strcat(output,"RE_Left ");
|
||||
if((buffer->trigger & VPAD_STICK_R_EMULATION_RIGHT) == VPAD_STICK_R_EMULATION_RIGHT) strcat(output,"RE_Right ");
|
||||
if((buffer->trigger & VPAD_STICK_R_EMULATION_UP) == VPAD_STICK_R_EMULATION_UP) strcat(output,"RE_Up ");
|
||||
if((buffer->trigger & VPAD_STICK_R_EMULATION_DOWN) == VPAD_STICK_R_EMULATION_DOWN) strcat(output,"RE_Down ");
|
||||
if((buffer->trigger & VPAD_STICK_L_EMULATION_LEFT) == VPAD_STICK_L_EMULATION_LEFT) strcat(output,"LE_Left ");
|
||||
if((buffer->trigger & VPAD_STICK_L_EMULATION_RIGHT) == VPAD_STICK_L_EMULATION_RIGHT) strcat(output,"LE_Right ");
|
||||
if((buffer->trigger & VPAD_STICK_L_EMULATION_UP) == VPAD_STICK_L_EMULATION_UP) strcat(output,"LE_Up ");
|
||||
if((buffer->trigger & VPAD_STICK_L_EMULATION_DOWN) == VPAD_STICK_L_EMULATION_DOWN) strcat(output,"LE_Down ");
|
||||
|
||||
DEBUG_FUNCTION_LINE("%spressed Sticks: LX %f LY %f RX %f RY %f\n",output,buffer->lstick.x,buffer->lstick.y,buffer->rstick.x,buffer->rstick.y);
|
||||
}
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
}
|
||||
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::buttonRemapping(VPADData * buffer,s32 buffer_count){
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::buttonRemapping(VPADStatus * buffer,s32 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++){
|
||||
VPADData new_data;
|
||||
VPADStatus new_data;
|
||||
memset(&new_data,0,sizeof(new_data));
|
||||
|
||||
ControllerPatcherUtils::setButtonRemappingData(&buffer[i],&new_data,VPAD_BUTTON_A, CONTRPS_VPAD_BUTTON_A);
|
||||
@ -1049,9 +1034,9 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::buttonRemapping(VPADData *
|
||||
ControllerPatcherUtils::setButtonData(&buffer[i],&new_data,VPAD_STICK_R_EMULATION_UP, VPAD_STICK_R_EMULATION_UP);
|
||||
ControllerPatcherUtils::setButtonData(&buffer[i],&new_data,VPAD_STICK_R_EMULATION_DOWN, VPAD_STICK_R_EMULATION_DOWN);
|
||||
|
||||
buffer[i].btns_h = new_data.btns_h;
|
||||
buffer[i].btns_d = new_data.btns_d;
|
||||
buffer[i].btns_r = new_data.btns_r;
|
||||
buffer[i].hold = new_data.hold;
|
||||
buffer[i].trigger = new_data.trigger;
|
||||
buffer[i].release = new_data.release;
|
||||
}
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
}
|
||||
|
@ -29,8 +29,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <dynamic_libs/vpad_functions.h>
|
||||
#include <dynamic_libs/padscore_functions.h>
|
||||
#include <padscore/wpad.h>
|
||||
|
||||
#include "ControllerPatcherDefs.h"
|
||||
|
||||
class ControllerPatcher{
|
||||
|
@ -20,10 +20,19 @@
|
||||
|
||||
#define HID_DEBUG 0
|
||||
|
||||
#include <dynamic_libs/os_types.h>
|
||||
#include <wut_types.h>
|
||||
|
||||
extern int32_t * (* __gh_errno_ptr)(void);
|
||||
|
||||
#include <padscore/kpad.h>
|
||||
#include <padscore/wpad.h>
|
||||
#include <vpad/input.h>
|
||||
#include <coreinit/systeminfo.h>
|
||||
#include <nsysnet/socket.h>
|
||||
|
||||
#include "./ConfigReader.hpp"
|
||||
#include "./ControllerPatcher.hpp"
|
||||
#include <controller_patcher/ControllerPatcher.hpp>
|
||||
|
||||
|
||||
#include <system/CThread.h>
|
||||
#include "./utils/CPRetainVars.hpp"
|
||||
|
@ -86,7 +86,7 @@ bool CPTCPServer::whileLoop() {
|
||||
if(wiiu_errno != 6) {
|
||||
return false;
|
||||
}
|
||||
os_usleep(1000);
|
||||
OSSleepTicks(OSMillisecondsToTicks(1000));
|
||||
continue;
|
||||
}
|
||||
//DEBUG_FUNCTION_LINE("got byte from tcp! %01X\n",ret);
|
||||
|
@ -19,10 +19,9 @@
|
||||
|
||||
#include "../ControllerPatcherIncludes.hpp"
|
||||
|
||||
#include <dynamic_libs/socket_functions.h>
|
||||
#include <dynamic_libs/os_functions.h>
|
||||
#include <utils/TCPServer.hpp>
|
||||
#include <utils/net.h>
|
||||
#include <network/net.h>
|
||||
#include <coreinit/title.h>
|
||||
|
||||
#define WIIU_CP_TCP_HANDSHAKE WIIU_CP_TCP_HANDSHAKE_VERSION_3
|
||||
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
#include "../ControllerPatcherIncludes.hpp"
|
||||
|
||||
#include <dynamic_libs/socket_functions.h>
|
||||
|
||||
#define DEFAULT_UDP_CLIENT_PORT 8114
|
||||
|
||||
class UDPClient{
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dynamic_libs/socket_functions.h>
|
||||
#include <utils/logger.h>
|
||||
|
||||
#define MAX_UDP_SIZE 0x578
|
||||
@ -105,7 +104,7 @@ void UDPServer::DoUDPThreadInternal(){
|
||||
n = recv(sockfd,buffer,MAX_UDP_SIZE,0);
|
||||
if (n < 0){
|
||||
s32 errno_ = wiiu_errno;
|
||||
os_usleep(2000);
|
||||
OSSleepTicks(OSMillisecondsToTicks(2000));
|
||||
if(errno_ != 11 && errno_ != 9){
|
||||
break;
|
||||
}
|
||||
|
@ -20,9 +20,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include <dynamic_libs/os_functions.h>
|
||||
|
||||
#include <utils/logger.h>
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@ -102,7 +99,7 @@ void ControllerPatcherHID::myHIDReadCallback(u32 handle, s32 error, unsigned cha
|
||||
HIDReadCallback(handle,buf,bytes_transfered,usr);
|
||||
|
||||
if(usr->slotdata.hidmask == gHID_LIST_DS4){
|
||||
os_usleep(1000*2); //DS4 is way tooo fast. sleeping to reduce lag. (need to check the other pads)
|
||||
OSSleepTicks(OSMillisecondsToTicks(2000)); //DS4 is way tooo fast. sleeping to reduce lag. (need to check the other pads)
|
||||
}
|
||||
HIDRead(handle, usr->buf, bytes_transfered, myHIDReadCallback, usr);
|
||||
}
|
||||
@ -482,7 +479,7 @@ void ControllerPatcherHID::HIDReadCallback(u32 handle, unsigned char *buf, u32 b
|
||||
* Other functions
|
||||
*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherHID::setVPADControllerData(VPADData * buffer,std::vector<HID_Data *>& data){
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherHID::setVPADControllerData(VPADStatus * buffer,std::vector<HID_Data *>& data){
|
||||
if(buffer == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER;
|
||||
HID_Data * data_cur;
|
||||
|
||||
@ -526,9 +523,9 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherHID::setVPADControllerData(V
|
||||
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;
|
||||
|
||||
buffer->btns_h |= buttons_hold;
|
||||
buffer->btns_d |= (buttons_hold & (~last_realbuttons));
|
||||
buffer->btns_r |= (last_realbuttons & (~buttons_hold));
|
||||
buffer->hold |= buttons_hold;
|
||||
buffer->trigger |= (buttons_hold & (~last_realbuttons));
|
||||
buffer->release |= (last_realbuttons & (~buttons_hold));
|
||||
|
||||
ControllerPatcherUtils::convertAnalogSticks(data_cur,buffer);
|
||||
|
||||
@ -544,8 +541,8 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherHID::setVPADControllerData(V
|
||||
|
||||
// Caculates a valid stick position
|
||||
if(data.size() > 0){
|
||||
ControllerPatcherUtils::normalizeStickValues(&buffer->lstick);
|
||||
ControllerPatcherUtils::normalizeStickValues(&buffer->rstick);
|
||||
ControllerPatcherUtils::normalizeStickValues(&buffer->leftStick);
|
||||
ControllerPatcherUtils::normalizeStickValues(&buffer->rightStick);
|
||||
}
|
||||
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
|
@ -29,11 +29,14 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <dynamic_libs/syshid_functions.h>
|
||||
#include <dynamic_libs/vpad_functions.h>
|
||||
|
||||
#include "../ControllerPatcherIncludes.hpp"
|
||||
|
||||
//! Own definitions
|
||||
#define VPAD_BUTTON_TOUCH 0x00080000
|
||||
#define VPAD_MASK_EMULATED_STICKS 0x7F800000
|
||||
#define VPAD_MASK_BUTTONS ~VPAD_MASK_EMULATED_STICKS
|
||||
|
||||
|
||||
#define SWAP16(x) ((x>>8) | ((x&0xFF)<<8))
|
||||
#define SWAP8(x) ((x>>4) | ((x&0xF)<<4))
|
||||
|
||||
@ -45,7 +48,7 @@ class ControllerPatcherHID{
|
||||
static void externHIDReadCallback(u32 handle, unsigned char *buf, u32 bytes_transfered, my_cb_user * usr);
|
||||
|
||||
private:
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setVPADControllerData(VPADData * buffer,std::vector<HID_Data *>& data);
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setVPADControllerData(VPADStatus * buffer,std::vector<HID_Data *>& data);
|
||||
static std::vector<HID_Data *> getHIDDataAll();
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR getHIDData(u32 hidmask, s32 pad, HID_Data ** data);
|
||||
|
||||
|
@ -260,7 +260,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::isInKeyboardData(unsi
|
||||
* Utils for setting the Button data
|
||||
*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setButtonRemappingData(VPADData * old_buffer, VPADData * new_buffer,u32 VPADButton, s32 CONTRPS_SLOT){
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setButtonRemappingData(VPADStatus * old_buffer, VPADStatus * new_buffer,u32 VPADButton, s32 CONTRPS_SLOT){
|
||||
if(old_buffer == NULL || new_buffer == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER;
|
||||
u32 new_value = VPADButton;
|
||||
|
||||
@ -272,16 +272,16 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setButtonRemappingDat
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
}
|
||||
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setButtonData(VPADData * old_buffer, VPADData * new_buffer,u32 oldVPADButton,u32 newVPADButton){
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setButtonData(VPADStatus * old_buffer, VPADStatus * new_buffer,u32 oldVPADButton,u32 newVPADButton){
|
||||
if(old_buffer == NULL || new_buffer == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER;
|
||||
if((old_buffer->btns_h & oldVPADButton) == oldVPADButton){
|
||||
new_buffer->btns_h |= newVPADButton;
|
||||
if((old_buffer->hold & oldVPADButton) == oldVPADButton){
|
||||
new_buffer->hold |= newVPADButton;
|
||||
}
|
||||
if((old_buffer->btns_r & oldVPADButton) == oldVPADButton){
|
||||
new_buffer->btns_r |= newVPADButton;
|
||||
if((old_buffer->release & oldVPADButton) == oldVPADButton){
|
||||
new_buffer->release |= newVPADButton;
|
||||
}
|
||||
if((old_buffer->btns_d & oldVPADButton) == oldVPADButton){
|
||||
new_buffer->btns_d |= newVPADButton;
|
||||
if((old_buffer->trigger & oldVPADButton) == oldVPADButton){
|
||||
new_buffer->trigger |= newVPADButton;
|
||||
}
|
||||
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
@ -324,7 +324,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::getActivePad(u32 hidm
|
||||
* Stick functions
|
||||
*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::normalizeStickValues(Vec2D * stick){
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::normalizeStickValues(VPADVec2D * stick){
|
||||
if(stick == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER;
|
||||
|
||||
f32 max_val = 0.0f;
|
||||
@ -370,8 +370,8 @@ f32 ControllerPatcherUtils::convertAnalogValue(u8 value, u8 default_val, u8 min,
|
||||
}
|
||||
}
|
||||
|
||||
Vec2D ControllerPatcherUtils::getAnalogValueByButtons(u8 stick_values){
|
||||
Vec2D stick;
|
||||
VPADVec2D ControllerPatcherUtils::getAnalogValueByButtons(u8 stick_values){
|
||||
VPADVec2D stick;
|
||||
stick.x = 0.0f;
|
||||
stick.y = 0.0f;
|
||||
|
||||
@ -413,7 +413,7 @@ Vec2D ControllerPatcherUtils::getAnalogValueByButtons(u8 stick_values){
|
||||
return stick;
|
||||
}
|
||||
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(HID_Data * data, VPADData * buffer){
|
||||
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;
|
||||
@ -427,14 +427,14 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(H
|
||||
|
||||
if(config_controller[deviceslot][CONTRPS_MOUSE_STICK][0] != CONTROLLER_PATCHER_INVALIDVALUE){
|
||||
if(config_controller[deviceslot][CONTRPS_MOUSE_STICK][1] == DEF_L_STICK){
|
||||
buffer->lstick.x += x_value;
|
||||
buffer->lstick.y += y_value;
|
||||
buffer->leftStick.x += x_value;
|
||||
buffer->leftStick.y += y_value;
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
buffer->rstick.x += x_value;
|
||||
buffer->rstick.y += y_value;
|
||||
buffer->rightStick.x += x_value;
|
||||
buffer->rightStick.y += y_value;
|
||||
}
|
||||
}else{
|
||||
u8 * cur_data = &data->data_union.controller.cur_hid_data[0];
|
||||
@ -447,7 +447,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(H
|
||||
deadzone = config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE][1];
|
||||
}
|
||||
|
||||
buffer->lstick.x += convertAnalogValue(cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_X][0]],
|
||||
buffer->leftStick.x += convertAnalogValue(cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_X][0]],
|
||||
config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_X][1],
|
||||
config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX][0],
|
||||
config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX][1],
|
||||
@ -460,7 +460,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(H
|
||||
if(config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_Y_DEADZONE][0] == CONTROLLER_PATCHER_VALUE_SET){
|
||||
deadzone = config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_Y_DEADZONE][1];
|
||||
}
|
||||
buffer->lstick.y += convertAnalogValue(cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_Y][0]],
|
||||
buffer->leftStick.y += convertAnalogValue(cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_Y][0]],
|
||||
config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_Y][1],
|
||||
config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_Y_MINMAX][0],
|
||||
config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_Y_MINMAX][1],
|
||||
@ -474,7 +474,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(H
|
||||
deadzone = config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_X_DEADZONE][1];
|
||||
}
|
||||
|
||||
buffer->rstick.x += convertAnalogValue(cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_X][0]],
|
||||
buffer->rightStick.x += convertAnalogValue(cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_X][0]],
|
||||
config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_X][1],
|
||||
config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_X_MINMAX][0],
|
||||
config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_X_MINMAX][1],
|
||||
@ -488,7 +488,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(H
|
||||
deadzone = config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_Y_DEADZONE][1];
|
||||
}
|
||||
|
||||
buffer->rstick.y += convertAnalogValue(cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_Y][0]],
|
||||
buffer->rightStick.y += convertAnalogValue(cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_Y][0]],
|
||||
config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_Y][1],
|
||||
config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_Y_MINMAX][0],
|
||||
config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_Y_MINMAX][1],
|
||||
@ -504,9 +504,9 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(H
|
||||
if(isValueSet(data,CONTRPS_VPAD_BUTTON_L_STICK_RIGHT)){ stick_values |= STICK_VALUE_RIGHT; }
|
||||
|
||||
if(stick_values > 0 ){
|
||||
Vec2D stick = getAnalogValueByButtons(stick_values);
|
||||
buffer->lstick.x += stick.x;
|
||||
buffer->lstick.y += stick.y;
|
||||
VPADVec2D stick = getAnalogValueByButtons(stick_values);
|
||||
buffer->leftStick.x += stick.x;
|
||||
buffer->leftStick.y += stick.y;
|
||||
}
|
||||
|
||||
stick_values = 0;
|
||||
@ -516,24 +516,24 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(H
|
||||
if(isValueSet(data,CONTRPS_VPAD_BUTTON_R_STICK_RIGHT)){ stick_values |= STICK_VALUE_RIGHT; }
|
||||
|
||||
if(stick_values > 0 ){
|
||||
Vec2D stick = getAnalogValueByButtons(stick_values);
|
||||
buffer->rstick.x += stick.x;
|
||||
buffer->rstick.y += stick.y;
|
||||
VPADVec2D stick = getAnalogValueByButtons(stick_values);
|
||||
buffer->rightStick.x += stick.x;
|
||||
buffer->rightStick.y += stick.y;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if(buffer->btns_h & VPAD_BUTTON_UP){ stick_values |= STICK_VALUE_UP; }
|
||||
if(buffer->btns_h & VPAD_BUTTON_DOWN){ stick_values |= STICK_VALUE_DOWN; }
|
||||
if(buffer->btns_h & VPAD_BUTTON_LEFT){ stick_values |= STICK_VALUE_LEFT; }
|
||||
if(buffer->btns_h & VPAD_BUTTON_RIGHT){ stick_values |= STICK_VALUE_RIGHT; }
|
||||
if(buffer->hold & VPAD_BUTTON_UP){ stick_values |= STICK_VALUE_UP; }
|
||||
if(buffer->hold & VPAD_BUTTON_DOWN){ stick_values |= STICK_VALUE_DOWN; }
|
||||
if(buffer->hold & VPAD_BUTTON_LEFT){ stick_values |= STICK_VALUE_LEFT; }
|
||||
if(buffer->hold & VPAD_BUTTON_RIGHT){ stick_values |= STICK_VALUE_RIGHT; }
|
||||
|
||||
if(stick_values > 0 ){
|
||||
Vec2D stick = getAnalogValueByButtons(stick_values);
|
||||
buffer->lstick.x += stick.x;
|
||||
buffer->lstick.y += stick.y;
|
||||
VPADVec2D stick = getAnalogValueByButtons(stick_values);
|
||||
buffer->leftStick.x += stick.x;
|
||||
buffer->leftStick.y += stick.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -541,68 +541,68 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(H
|
||||
if(config_controller[deviceslot][CONTRPS_VPAD_STICK_R_COPY_DPAD][0] == 1){
|
||||
u8 stick_values = 0;
|
||||
|
||||
if(buffer->btns_h & VPAD_BUTTON_UP){ stick_values |= STICK_VALUE_UP; }
|
||||
if(buffer->btns_h & VPAD_BUTTON_DOWN){ stick_values |= STICK_VALUE_DOWN; }
|
||||
if(buffer->btns_h & VPAD_BUTTON_LEFT){ stick_values |= STICK_VALUE_LEFT; }
|
||||
if(buffer->btns_h & VPAD_BUTTON_RIGHT){ stick_values |= STICK_VALUE_RIGHT; }
|
||||
if(buffer->hold & VPAD_BUTTON_UP){ stick_values |= STICK_VALUE_UP; }
|
||||
if(buffer->hold & VPAD_BUTTON_DOWN){ stick_values |= STICK_VALUE_DOWN; }
|
||||
if(buffer->hold & VPAD_BUTTON_LEFT){ stick_values |= STICK_VALUE_LEFT; }
|
||||
if(buffer->hold & VPAD_BUTTON_RIGHT){ stick_values |= STICK_VALUE_RIGHT; }
|
||||
|
||||
if(stick_values > 0 ){
|
||||
Vec2D stick = getAnalogValueByButtons(stick_values);
|
||||
buffer->rstick.x += stick.x;
|
||||
buffer->rstick.y += stick.y;
|
||||
VPADVec2D stick = getAnalogValueByButtons(stick_values);
|
||||
buffer->rightStick.x += stick.x;
|
||||
buffer->rightStick.y += stick.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*log_printf("LX %f(%02X) LY %f(%02X) RX %f(%02X) RY %f(%02X)\n",buffer->lstick.x,cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_X][0]],
|
||||
buffer->lstick.y,cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_Y][0]],
|
||||
buffer->rstick.x,cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_X][0]],
|
||||
buffer->rstick.y,cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_Y][0]]);*/
|
||||
/*log_printf("LX %f(%02X) LY %f(%02X) RX %f(%02X) RY %f(%02X)\n",buffer->leftStick.x,cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_X][0]],
|
||||
buffer->leftStick.y,cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_Y][0]],
|
||||
buffer->rightStick.x,cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_X][0]],
|
||||
buffer->rightStick.y,cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_Y][0]]);*/
|
||||
|
||||
}
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
}
|
||||
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setEmulatedSticks(VPADData * buffer, u32 * last_emulatedSticks){
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setEmulatedSticks(VPADStatus * buffer, u32 * last_emulatedSticks){
|
||||
if(buffer == NULL || last_emulatedSticks == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER;
|
||||
|
||||
u32 emulatedSticks = 0;
|
||||
|
||||
s32 l_x_full = (buffer->lstick.x > 0.5f || buffer->lstick.x < -0.5f)? 1:0;
|
||||
s32 l_y_full = (buffer->lstick.y > 0.5f || buffer->lstick.y < -0.5f)? 1:0;
|
||||
s32 r_x_full = (buffer->rstick.x > 0.5f || buffer->rstick.x < -0.5f)? 1:0;
|
||||
s32 r_y_full = (buffer->rstick.y > 0.5f || buffer->rstick.y < -0.5f)? 1: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;
|
||||
|
||||
if((buffer->lstick.x > 0.5f) || (buffer->lstick.x > 0.1f && !l_y_full)){
|
||||
if((buffer->leftStick.x > 0.5f) || (buffer->leftStick.x > 0.1f && !l_y_full)){
|
||||
emulatedSticks |= VPAD_STICK_L_EMULATION_RIGHT;
|
||||
}
|
||||
if((buffer->lstick.x < -0.5f) || (buffer->lstick.x < -0.1f && !l_y_full)){
|
||||
if((buffer->leftStick.x < -0.5f) || (buffer->leftStick.x < -0.1f && !l_y_full)){
|
||||
emulatedSticks |= VPAD_STICK_L_EMULATION_LEFT;
|
||||
}
|
||||
if((buffer->lstick.y > 0.5f) || (buffer->lstick.y > 0.1f && !l_x_full)){
|
||||
if((buffer->leftStick.y > 0.5f) || (buffer->leftStick.y > 0.1f && !l_x_full)){
|
||||
emulatedSticks |= VPAD_STICK_L_EMULATION_UP;
|
||||
}
|
||||
if((buffer->lstick.y < -0.5f) || (buffer->lstick.y < -0.1f && !l_x_full)){
|
||||
if((buffer->leftStick.y < -0.5f) || (buffer->leftStick.y < -0.1f && !l_x_full)){
|
||||
emulatedSticks |= VPAD_STICK_L_EMULATION_DOWN;
|
||||
}
|
||||
|
||||
if((buffer->rstick.x > 0.5f) || (buffer->rstick.x > 0.1f && !r_y_full)){
|
||||
if((buffer->rightStick.x > 0.5f) || (buffer->rightStick.x > 0.1f && !r_y_full)){
|
||||
emulatedSticks |= VPAD_STICK_R_EMULATION_RIGHT;
|
||||
}
|
||||
if((buffer->rstick.x < -0.5f) || (buffer->rstick.x < -0.1f && !r_y_full)){
|
||||
if((buffer->rightStick.x < -0.5f) || (buffer->rightStick.x < -0.1f && !r_y_full)){
|
||||
emulatedSticks |= VPAD_STICK_R_EMULATION_LEFT;
|
||||
}
|
||||
if((buffer->rstick.y > 0.5f) || (buffer->rstick.y > 0.1f && !r_x_full)){
|
||||
if((buffer->rightStick.y > 0.5f) || (buffer->rightStick.y > 0.1f && !r_x_full)){
|
||||
emulatedSticks |= VPAD_STICK_R_EMULATION_UP;
|
||||
}
|
||||
if((buffer->rstick.y < -0.5f) || (buffer->rstick.y < -0.1f && !r_x_full)){
|
||||
if((buffer->rightStick.y < -0.5f) || (buffer->rightStick.y < -0.1f && !r_x_full)){
|
||||
emulatedSticks |= VPAD_STICK_R_EMULATION_DOWN;
|
||||
}
|
||||
|
||||
//Setting the emulated sticks
|
||||
buffer->btns_h |= emulatedSticks;
|
||||
buffer->btns_d |= (emulatedSticks & (~*last_emulatedSticks));
|
||||
buffer->btns_r |= (*last_emulatedSticks & (~emulatedSticks));
|
||||
buffer->hold |= emulatedSticks;
|
||||
buffer->trigger |= (emulatedSticks & (~*last_emulatedSticks));
|
||||
buffer->release |= (*last_emulatedSticks & (~emulatedSticks));
|
||||
|
||||
*last_emulatedSticks = emulatedSticks;
|
||||
|
||||
@ -613,7 +613,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setEmulatedSticks(VPA
|
||||
* Touch functions
|
||||
*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setTouch(HID_Data * data,VPADData * buffer){
|
||||
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;
|
||||
@ -622,18 +622,18 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::setTouch(HID_Data * d
|
||||
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));
|
||||
buffer->tpdata.x = x_mouse;
|
||||
buffer->tpdata.y = y_mouse;
|
||||
buffer->tpdata.touched = 1;
|
||||
buffer->tpdata.invalid = 0;
|
||||
buffer->tpdata1.x = x_mouse;
|
||||
buffer->tpdata1.y = y_mouse;
|
||||
buffer->tpdata1.touched = 1;
|
||||
buffer->tpdata1.invalid = 0;
|
||||
buffer->tpdata2.x = x_mouse;
|
||||
buffer->tpdata2.y = y_mouse;
|
||||
buffer->tpdata2.touched = 1;
|
||||
buffer->tpdata2.invalid = 0;
|
||||
buffer->tpNormal.x = x_mouse;
|
||||
buffer->tpNormal.y = y_mouse;
|
||||
buffer->tpNormal.touched = 1;
|
||||
buffer->tpNormal.validity = 0;
|
||||
buffer->tpFiltered1.x = x_mouse;
|
||||
buffer->tpFiltered1.y = y_mouse;
|
||||
buffer->tpFiltered1.touched = 1;
|
||||
buffer->tpFiltered1.validity = 0;
|
||||
buffer->tpFiltered2.x = x_mouse;
|
||||
buffer->tpFiltered2.y = y_mouse;
|
||||
buffer->tpFiltered2.touched = 1;
|
||||
buffer->tpFiltered2.validity = 0;
|
||||
}
|
||||
}
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
@ -666,48 +666,48 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::checkAndSetMouseMode(
|
||||
* Other functions
|
||||
*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToPro(VPADData * vpad_buffer,KPADData * pro_buffer,u32 * lastButtonsPressesPRO){
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToPro(VPADStatus * vpad_buffer,KPADStatus * pro_buffer,u32 * lastButtonsPressesPRO){
|
||||
if(vpad_buffer == NULL || pro_buffer == NULL || lastButtonsPressesPRO == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER;
|
||||
|
||||
s32 buttons_hold = 0;
|
||||
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_A) buttons_hold |= WPAD_PRO_BUTTON_A;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_B) buttons_hold |= WPAD_PRO_BUTTON_B;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_X) buttons_hold |= WPAD_PRO_BUTTON_X;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_Y) buttons_hold |= WPAD_PRO_BUTTON_Y;
|
||||
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;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_X) buttons_hold |= WPAD_PRO_BUTTON_X;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_Y) buttons_hold |= WPAD_PRO_BUTTON_Y;
|
||||
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_PLUS) buttons_hold |= WPAD_PRO_BUTTON_PLUS;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_MINUS) buttons_hold |= WPAD_PRO_BUTTON_MINUS;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_HOME) buttons_hold |= WPAD_PRO_BUTTON_HOME;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_PLUS) buttons_hold |= WPAD_PRO_BUTTON_PLUS;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_MINUS) buttons_hold |= WPAD_PRO_BUTTON_MINUS;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_HOME) buttons_hold |= WPAD_PRO_BUTTON_HOME;
|
||||
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_LEFT) buttons_hold |= WPAD_PRO_BUTTON_LEFT;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_RIGHT) buttons_hold |= WPAD_PRO_BUTTON_RIGHT;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_UP) buttons_hold |= WPAD_PRO_BUTTON_UP;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_DOWN) buttons_hold |= WPAD_PRO_BUTTON_DOWN;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_LEFT) buttons_hold |= WPAD_PRO_BUTTON_LEFT;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_RIGHT) buttons_hold |= WPAD_PRO_BUTTON_RIGHT;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_UP) buttons_hold |= WPAD_PRO_BUTTON_UP;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_DOWN) buttons_hold |= WPAD_PRO_BUTTON_DOWN;
|
||||
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_L) buttons_hold |= WPAD_PRO_TRIGGER_L;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_ZL) buttons_hold |= WPAD_PRO_TRIGGER_ZL;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_L) buttons_hold |= WPAD_PRO_TRIGGER_L;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_ZL) buttons_hold |= WPAD_PRO_TRIGGER_ZL;
|
||||
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_R) buttons_hold |= WPAD_PRO_TRIGGER_R;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_ZR) buttons_hold |= WPAD_PRO_TRIGGER_ZR;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_R) buttons_hold |= WPAD_PRO_TRIGGER_R;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_ZR) buttons_hold |= WPAD_PRO_TRIGGER_ZR;
|
||||
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_STICK_L) buttons_hold |= WPAD_PRO_BUTTON_STICK_L;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_STICK_R) buttons_hold |= WPAD_PRO_BUTTON_STICK_R;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_STICK_L) buttons_hold |= WPAD_PRO_BUTTON_STICK_L;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_STICK_R) buttons_hold |= WPAD_PRO_BUTTON_STICK_R;
|
||||
|
||||
if(vpad_buffer->btns_h & VPAD_STICK_L_EMULATION_LEFT) buttons_hold |= WPAD_PRO_STICK_L_EMULATION_LEFT;
|
||||
if(vpad_buffer->btns_h & VPAD_STICK_L_EMULATION_RIGHT) buttons_hold |= WPAD_PRO_STICK_L_EMULATION_RIGHT;
|
||||
if(vpad_buffer->btns_h & VPAD_STICK_L_EMULATION_UP) buttons_hold |= WPAD_PRO_STICK_L_EMULATION_UP;
|
||||
if(vpad_buffer->btns_h & VPAD_STICK_L_EMULATION_DOWN) buttons_hold |= WPAD_PRO_STICK_L_EMULATION_DOWN;
|
||||
if(vpad_buffer->hold & VPAD_STICK_L_EMULATION_LEFT) buttons_hold |= WPAD_PRO_STICK_L_EMULATION_LEFT;
|
||||
if(vpad_buffer->hold & VPAD_STICK_L_EMULATION_RIGHT) buttons_hold |= WPAD_PRO_STICK_L_EMULATION_RIGHT;
|
||||
if(vpad_buffer->hold & VPAD_STICK_L_EMULATION_UP) buttons_hold |= WPAD_PRO_STICK_L_EMULATION_UP;
|
||||
if(vpad_buffer->hold & VPAD_STICK_L_EMULATION_DOWN) buttons_hold |= WPAD_PRO_STICK_L_EMULATION_DOWN;
|
||||
|
||||
if(vpad_buffer->btns_h & VPAD_STICK_R_EMULATION_LEFT) buttons_hold |= WPAD_PRO_STICK_R_EMULATION_LEFT;
|
||||
if(vpad_buffer->btns_h & VPAD_STICK_R_EMULATION_RIGHT) buttons_hold |= WPAD_PRO_STICK_R_EMULATION_RIGHT;
|
||||
if(vpad_buffer->btns_h & VPAD_STICK_R_EMULATION_UP) buttons_hold |= WPAD_PRO_STICK_R_EMULATION_UP;
|
||||
if(vpad_buffer->btns_h & VPAD_STICK_R_EMULATION_DOWN) buttons_hold |= WPAD_PRO_STICK_R_EMULATION_DOWN;
|
||||
if(vpad_buffer->hold & VPAD_STICK_R_EMULATION_LEFT) buttons_hold |= WPAD_PRO_STICK_R_EMULATION_LEFT;
|
||||
if(vpad_buffer->hold & VPAD_STICK_R_EMULATION_RIGHT) buttons_hold |= WPAD_PRO_STICK_R_EMULATION_RIGHT;
|
||||
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->pro.lstick_x = vpad_buffer->lstick.x;
|
||||
pro_buffer->pro.lstick_y = vpad_buffer->lstick.y;
|
||||
pro_buffer->pro.rstick_x = vpad_buffer->rstick.x;
|
||||
pro_buffer->pro.rstick_y = vpad_buffer->rstick.y;
|
||||
pro_buffer->pro.leftStick.x = vpad_buffer->leftStick.x;
|
||||
pro_buffer->pro.leftStick.y = vpad_buffer->leftStick.y;
|
||||
pro_buffer->pro.rightStick.x = vpad_buffer->rightStick.x;
|
||||
pro_buffer->pro.rightStick.y = vpad_buffer->rightStick.y;
|
||||
|
||||
/*
|
||||
pro_buffer->unused_1[1] = 0xBF800000;
|
||||
@ -719,9 +719,9 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToPro(VPADDa
|
||||
pro_buffer->unused_7[1] = 0x3F800000;
|
||||
pro_buffer->unused_7[5] = 0x3F800000;*/
|
||||
|
||||
pro_buffer->pro.btns_h = buttons_hold;
|
||||
pro_buffer->pro.btns_d = (buttons_hold & (~*lastButtonsPressesPRO));
|
||||
pro_buffer->pro.btns_r = (*lastButtonsPressesPRO & (~buttons_hold));
|
||||
pro_buffer->pro.hold = buttons_hold;
|
||||
pro_buffer->pro.trigger = (buttons_hold & (~*lastButtonsPressesPRO));
|
||||
pro_buffer->pro.release = (*lastButtonsPressesPRO & (~buttons_hold));
|
||||
|
||||
*lastButtonsPressesPRO = buttons_hold;
|
||||
|
||||
@ -734,48 +734,48 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToPro(VPADDa
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
}
|
||||
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToProWPADRead(VPADData * vpad_buffer,WPADReadData * pro_buffer){
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToProWPADRead(VPADStatus * vpad_buffer,WPADReadData * pro_buffer){
|
||||
if(vpad_buffer == NULL || pro_buffer == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER;
|
||||
|
||||
s32 buttons_hold = 0;
|
||||
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_A) buttons_hold |= WPAD_PRO_BUTTON_A;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_B) buttons_hold |= WPAD_PRO_BUTTON_B;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_X) buttons_hold |= WPAD_PRO_BUTTON_X;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_Y) buttons_hold |= WPAD_PRO_BUTTON_Y;
|
||||
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;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_X) buttons_hold |= WPAD_PRO_BUTTON_X;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_Y) buttons_hold |= WPAD_PRO_BUTTON_Y;
|
||||
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_PLUS) buttons_hold |= WPAD_PRO_BUTTON_PLUS;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_MINUS) buttons_hold |= WPAD_PRO_BUTTON_MINUS;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_HOME) buttons_hold |= WPAD_PRO_BUTTON_HOME;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_PLUS) buttons_hold |= WPAD_PRO_BUTTON_PLUS;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_MINUS) buttons_hold |= WPAD_PRO_BUTTON_MINUS;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_HOME) buttons_hold |= WPAD_PRO_BUTTON_HOME;
|
||||
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_LEFT) buttons_hold |= WPAD_PRO_BUTTON_LEFT;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_RIGHT) buttons_hold |= WPAD_PRO_BUTTON_RIGHT;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_UP) buttons_hold |= WPAD_PRO_BUTTON_UP;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_DOWN) buttons_hold |= WPAD_PRO_BUTTON_DOWN;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_LEFT) buttons_hold |= WPAD_PRO_BUTTON_LEFT;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_RIGHT) buttons_hold |= WPAD_PRO_BUTTON_RIGHT;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_UP) buttons_hold |= WPAD_PRO_BUTTON_UP;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_DOWN) buttons_hold |= WPAD_PRO_BUTTON_DOWN;
|
||||
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_L) buttons_hold |= WPAD_PRO_TRIGGER_L;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_ZL) buttons_hold |= WPAD_PRO_TRIGGER_ZL;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_L) buttons_hold |= WPAD_PRO_TRIGGER_L;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_ZL) buttons_hold |= WPAD_PRO_TRIGGER_ZL;
|
||||
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_R) buttons_hold |= WPAD_PRO_TRIGGER_R;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_ZR) buttons_hold |= WPAD_PRO_TRIGGER_ZR;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_R) buttons_hold |= WPAD_PRO_TRIGGER_R;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_ZR) buttons_hold |= WPAD_PRO_TRIGGER_ZR;
|
||||
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_STICK_L) buttons_hold |= WPAD_PRO_BUTTON_STICK_L;
|
||||
if(vpad_buffer->btns_h & VPAD_BUTTON_STICK_R) buttons_hold |= WPAD_PRO_BUTTON_STICK_R;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_STICK_L) buttons_hold |= WPAD_PRO_BUTTON_STICK_L;
|
||||
if(vpad_buffer->hold & VPAD_BUTTON_STICK_R) buttons_hold |= WPAD_PRO_BUTTON_STICK_R;
|
||||
|
||||
if(vpad_buffer->btns_h & VPAD_STICK_L_EMULATION_LEFT) buttons_hold |= WPAD_PRO_STICK_L_EMULATION_LEFT;
|
||||
if(vpad_buffer->btns_h & VPAD_STICK_L_EMULATION_RIGHT) buttons_hold |= WPAD_PRO_STICK_L_EMULATION_RIGHT;
|
||||
if(vpad_buffer->btns_h & VPAD_STICK_L_EMULATION_UP) buttons_hold |= WPAD_PRO_STICK_L_EMULATION_UP;
|
||||
if(vpad_buffer->btns_h & VPAD_STICK_L_EMULATION_DOWN) buttons_hold |= WPAD_PRO_STICK_L_EMULATION_DOWN;
|
||||
if(vpad_buffer->hold & VPAD_STICK_L_EMULATION_LEFT) buttons_hold |= WPAD_PRO_STICK_L_EMULATION_LEFT;
|
||||
if(vpad_buffer->hold & VPAD_STICK_L_EMULATION_RIGHT) buttons_hold |= WPAD_PRO_STICK_L_EMULATION_RIGHT;
|
||||
if(vpad_buffer->hold & VPAD_STICK_L_EMULATION_UP) buttons_hold |= WPAD_PRO_STICK_L_EMULATION_UP;
|
||||
if(vpad_buffer->hold & VPAD_STICK_L_EMULATION_DOWN) buttons_hold |= WPAD_PRO_STICK_L_EMULATION_DOWN;
|
||||
|
||||
if(vpad_buffer->btns_h & VPAD_STICK_R_EMULATION_LEFT) buttons_hold |= WPAD_PRO_STICK_R_EMULATION_LEFT;
|
||||
if(vpad_buffer->btns_h & VPAD_STICK_R_EMULATION_RIGHT) buttons_hold |= WPAD_PRO_STICK_R_EMULATION_RIGHT;
|
||||
if(vpad_buffer->btns_h & VPAD_STICK_R_EMULATION_UP) buttons_hold |= WPAD_PRO_STICK_R_EMULATION_UP;
|
||||
if(vpad_buffer->btns_h & VPAD_STICK_R_EMULATION_DOWN) buttons_hold |= WPAD_PRO_STICK_R_EMULATION_DOWN;
|
||||
if(vpad_buffer->hold & VPAD_STICK_R_EMULATION_LEFT) buttons_hold |= WPAD_PRO_STICK_R_EMULATION_LEFT;
|
||||
if(vpad_buffer->hold & VPAD_STICK_R_EMULATION_RIGHT) buttons_hold |= WPAD_PRO_STICK_R_EMULATION_RIGHT;
|
||||
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->l_stick_x = (s16) (vpad_buffer->lstick.x * 950.0f);
|
||||
pro_buffer->l_stick_y = (s16) (vpad_buffer->lstick.y * 950.0f);
|
||||
pro_buffer->r_stick_x = (s16) (vpad_buffer->rstick.x * 950.0f);
|
||||
pro_buffer->r_stick_y = (s16) (vpad_buffer->rstick.y * 950.0f);
|
||||
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->buttons = buttons_hold;
|
||||
|
||||
@ -786,54 +786,54 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToProWPADRea
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
}
|
||||
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToVPAD(VPADData * vpad_buffer,KPADData * pro_buffer,u32 * lastButtonsPressesVPAD){
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::translateToVPAD(VPADStatus * vpad_buffer,KPADStatus * pro_buffer,u32 * lastButtonsPressesVPAD){
|
||||
if(vpad_buffer == NULL || pro_buffer == NULL || lastButtonsPressesVPAD == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER;
|
||||
|
||||
s32 buttons_hold = 0;
|
||||
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_BUTTON_A) buttons_hold |= VPAD_BUTTON_A;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_BUTTON_A) buttons_hold |= VPAD_BUTTON_A;
|
||||
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_BUTTON_B) buttons_hold |= VPAD_BUTTON_B;
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_BUTTON_X) buttons_hold |= VPAD_BUTTON_X;
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_BUTTON_Y) buttons_hold |= VPAD_BUTTON_Y;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_BUTTON_B) buttons_hold |= VPAD_BUTTON_B;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_BUTTON_X) buttons_hold |= VPAD_BUTTON_X;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_BUTTON_Y) buttons_hold |= VPAD_BUTTON_Y;
|
||||
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_BUTTON_PLUS) buttons_hold |= VPAD_BUTTON_PLUS;
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_BUTTON_MINUS) buttons_hold |= VPAD_BUTTON_MINUS;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_BUTTON_PLUS) buttons_hold |= VPAD_BUTTON_PLUS;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_BUTTON_MINUS) buttons_hold |= VPAD_BUTTON_MINUS;
|
||||
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_BUTTON_HOME) buttons_hold |= VPAD_BUTTON_HOME;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_BUTTON_HOME) buttons_hold |= VPAD_BUTTON_HOME;
|
||||
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_BUTTON_LEFT) buttons_hold |= VPAD_BUTTON_LEFT;
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_BUTTON_RIGHT) buttons_hold |= VPAD_BUTTON_RIGHT;
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_BUTTON_UP) buttons_hold |= VPAD_BUTTON_UP;
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_BUTTON_DOWN) buttons_hold |= VPAD_BUTTON_DOWN;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_BUTTON_LEFT) buttons_hold |= VPAD_BUTTON_LEFT;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_BUTTON_RIGHT) buttons_hold |= VPAD_BUTTON_RIGHT;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_BUTTON_UP) buttons_hold |= VPAD_BUTTON_UP;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_BUTTON_DOWN) buttons_hold |= VPAD_BUTTON_DOWN;
|
||||
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_TRIGGER_L) buttons_hold |= VPAD_BUTTON_L;
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_TRIGGER_ZL) buttons_hold |= VPAD_BUTTON_ZL;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_TRIGGER_L) buttons_hold |= VPAD_BUTTON_L;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_TRIGGER_ZL) buttons_hold |= VPAD_BUTTON_ZL;
|
||||
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_TRIGGER_R) buttons_hold |= VPAD_BUTTON_R;
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_TRIGGER_ZR) buttons_hold |= VPAD_BUTTON_ZR;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_TRIGGER_R) buttons_hold |= VPAD_BUTTON_R;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_TRIGGER_ZR) buttons_hold |= VPAD_BUTTON_ZR;
|
||||
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_BUTTON_STICK_L) buttons_hold |= VPAD_BUTTON_STICK_L;
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_BUTTON_STICK_R) buttons_hold |= VPAD_BUTTON_STICK_R;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_BUTTON_STICK_L) buttons_hold |= VPAD_BUTTON_STICK_L;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_BUTTON_STICK_R) buttons_hold |= VPAD_BUTTON_STICK_R;
|
||||
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_STICK_L_EMULATION_LEFT) buttons_hold |= VPAD_STICK_L_EMULATION_LEFT;
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_STICK_L_EMULATION_RIGHT) buttons_hold |= VPAD_STICK_L_EMULATION_RIGHT;
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_STICK_L_EMULATION_UP) buttons_hold |= VPAD_STICK_L_EMULATION_UP;
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_STICK_L_EMULATION_DOWN) buttons_hold |= VPAD_STICK_L_EMULATION_DOWN;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_STICK_L_EMULATION_LEFT) buttons_hold |= VPAD_STICK_L_EMULATION_LEFT;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_STICK_L_EMULATION_RIGHT) buttons_hold |= VPAD_STICK_L_EMULATION_RIGHT;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_STICK_L_EMULATION_UP) buttons_hold |= VPAD_STICK_L_EMULATION_UP;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_STICK_L_EMULATION_DOWN) buttons_hold |= VPAD_STICK_L_EMULATION_DOWN;
|
||||
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_STICK_R_EMULATION_LEFT) buttons_hold |= VPAD_STICK_R_EMULATION_LEFT;
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_STICK_R_EMULATION_RIGHT) buttons_hold |= VPAD_STICK_R_EMULATION_RIGHT;
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_STICK_R_EMULATION_UP) buttons_hold |= VPAD_STICK_R_EMULATION_UP;
|
||||
if(pro_buffer->pro.btns_h & WPAD_PRO_STICK_R_EMULATION_DOWN) buttons_hold |= VPAD_STICK_R_EMULATION_DOWN;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_STICK_R_EMULATION_LEFT) buttons_hold |= VPAD_STICK_R_EMULATION_LEFT;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_STICK_R_EMULATION_RIGHT) buttons_hold |= VPAD_STICK_R_EMULATION_RIGHT;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_STICK_R_EMULATION_UP) buttons_hold |= VPAD_STICK_R_EMULATION_UP;
|
||||
if(pro_buffer->pro.hold & WPAD_PRO_STICK_R_EMULATION_DOWN) buttons_hold |= VPAD_STICK_R_EMULATION_DOWN;
|
||||
|
||||
vpad_buffer->lstick.x = pro_buffer->pro.lstick_x;
|
||||
vpad_buffer->lstick.y = pro_buffer->pro.lstick_y;
|
||||
vpad_buffer->rstick.x = pro_buffer->pro.rstick_x;
|
||||
vpad_buffer->rstick.y = pro_buffer->pro.rstick_y;
|
||||
vpad_buffer->leftStick.x = pro_buffer->pro.leftStick.x;
|
||||
vpad_buffer->leftStick.y = pro_buffer->pro.leftStick.y;
|
||||
vpad_buffer->rightStick.x = pro_buffer->pro.rightStick.x;
|
||||
vpad_buffer->rightStick.y = pro_buffer->pro.rightStick.y;
|
||||
|
||||
vpad_buffer->btns_h |= buttons_hold;
|
||||
vpad_buffer->btns_d |= (buttons_hold & (~*lastButtonsPressesVPAD));
|
||||
vpad_buffer->btns_r |= (*lastButtonsPressesVPAD & (~buttons_hold));
|
||||
vpad_buffer->hold |= buttons_hold;
|
||||
vpad_buffer->trigger |= (buttons_hold & (~*lastButtonsPressesVPAD));
|
||||
vpad_buffer->release |= (*lastButtonsPressesVPAD & (~buttons_hold));
|
||||
|
||||
*lastButtonsPressesVPAD = buttons_hold;
|
||||
|
||||
|
@ -27,8 +27,8 @@
|
||||
#ifndef _CONTROLLER_PATCHER_UTIL_H_
|
||||
#define _CONTROLLER_PATCHER_UTIL_H_
|
||||
|
||||
#include <dynamic_libs/vpad_functions.h>
|
||||
#include <dynamic_libs/padscore_functions.h>
|
||||
#include <padscore/kpad.h>
|
||||
#include <padscore/wpad.h>
|
||||
|
||||
#include "../ControllerPatcherIncludes.hpp"
|
||||
|
||||
@ -70,13 +70,13 @@ class ControllerPatcherUtils{
|
||||
|
||||
/** \brief Set the VPAD data for a given KPAD data.
|
||||
*
|
||||
* \param vpad_buffer VPADData* A pointer to the VPAD Data where the result will be stored.
|
||||
* \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.
|
||||
* \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(VPADData * vpad_buffer,KPADData * pro_buffer,u32 * lastButtonsPressesVPAD);
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR translateToVPAD(VPADStatus * vpad_buffer,KPADStatus * pro_buffer,u32 * lastButtonsPressesVPAD);
|
||||
private:
|
||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
* Analyse inputs
|
||||
@ -119,27 +119,27 @@ class ControllerPatcherUtils{
|
||||
/** \brief Checks if a @p VPADButton (VPAD_BUTTON_XXX) is set in the given @p CONTRPS_SLOT (usually the one for buttons remapping) of the GamePad. When its set it'll be
|
||||
* set for the corresponding Button (aka button remapping). When the @p CONTRPS_SLOT is not valid, the normal buttons layout will be used.
|
||||
*
|
||||
* \param old_buffer A pointer to a VPADData struct from which will be read.
|
||||
* \param new_buffer A pointer to a VPADData struct where the result will be written.
|
||||
* \param old_buffer A pointer to a VPADStatus struct from which will be read.
|
||||
* \param new_buffer A pointer to a VPADStatus struct where the result will be written.
|
||||
* \param VPADButton The buttons that will be may replaced
|
||||
* \param CONTRPS_SLOT The CONTRPS_SLOT where the VPAD_Buttons we want to use instead of the parameter "VPADButton" could be saved.
|
||||
* \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(VPADData * old_buffer, VPADData * new_buffer,u32 VPADButton, s32 CONTRPS_SLOT);
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setButtonRemappingData(VPADStatus * old_buffer, VPADStatus * new_buffer,u32 VPADButton, s32 CONTRPS_SLOT);
|
||||
|
||||
/**
|
||||
\brief Checks if a given button (oldVPADButton) is set in a given VPADData struct (old_buffer). If its set, it will set an other
|
||||
button (newVPADButton) to the second given VPADData struct (new_buffer)
|
||||
\brief Checks if a given button (oldVPADButton) is set in a given VPADStatus struct (old_buffer). If its set, it will set an other
|
||||
button (newVPADButton) to the second given VPADStatus struct (new_buffer)
|
||||
|
||||
\param old_buffer A pointer to a VPADData struct from which will be read.
|
||||
\param new_buffer A pointer to a VPADData struct where the result will be written.
|
||||
\param oldVPADButton The buttons that need to be set in the first VPADData
|
||||
\param newVPADButton The buttons that will be set in the second VPADData, when the oldVPADButton is pressed in the first buffer.
|
||||
\param old_buffer A pointer to a VPADStatus struct from which will be read.
|
||||
\param new_buffer A pointer to a VPADStatus struct where the result will be written.
|
||||
\param oldVPADButton The buttons that need to be set in the first VPADStatus
|
||||
\param newVPADButton The buttons that will be set in the second VPADStatus, when the oldVPADButton is pressed in the first buffer.
|
||||
|
||||
\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(VPADData * old_buffer, VPADData * new_buffer,u32 oldVPADButton,u32 newVPADButton);
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setButtonData(VPADStatus * old_buffer, VPADStatus * new_buffer,u32 oldVPADButton,u32 newVPADButton);
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
* Pad Status functions
|
||||
@ -173,7 +173,7 @@ class ControllerPatcherUtils{
|
||||
|
||||
\return When the functions failed result < 0 is returned. If the result is >= 0 the function was successful.
|
||||
**/
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR normalizeStickValues(Vec2D * stick);
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR normalizeStickValues(VPADVec2D * stick);
|
||||
|
||||
/**
|
||||
\brief Converts the digital absolute stick data into a float value. It also applies the deadzones, and can invert the result.
|
||||
@ -190,37 +190,37 @@ class ControllerPatcherUtils{
|
||||
static f32 convertAnalogValue(u8 value, u8 default_val, u8 min, u8 max, u8 invert,u8 deadzone);
|
||||
|
||||
/**
|
||||
\brief Calculates a the stick data (Vec2D) from given digital direction.
|
||||
\brief Calculates a the stick data (VPADVec2D) from given digital direction.
|
||||
|
||||
\param stick_values bits need to set for each direction. (STICK_VALUE_UP,STICK_VALUE_DOWN,STICK_VALUE_LEFT,STICK_VALUE_RIGHT)
|
||||
|
||||
\return The Vec2D with the set values.
|
||||
\return The VPADVec2D with the set values.
|
||||
**/
|
||||
static Vec2D getAnalogValueByButtons(u8 stick_values);
|
||||
static VPADVec2D getAnalogValueByButtons(u8 stick_values);
|
||||
|
||||
/**
|
||||
\brief Handles the analog-stick data of HID devices. The result will written in the VPADData buffer.
|
||||
\brief Handles the analog-stick data of HID devices. The result will written in the VPADStatus buffer.
|
||||
|
||||
\param data Pointer to the current data of the HID device
|
||||
\param buffer Pointer to VPADData where the analog-stick data will be set.
|
||||
\param buffer Pointer to VPADStatus where the analog-stick data will be set.
|
||||
|
||||
\return When the functions failed result < 0 is returned. If the result is >= 0 the function was successful.
|
||||
**/
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR convertAnalogSticks(HID_Data * data,VPADData * buffer);
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR convertAnalogSticks(HID_Data * data,VPADStatus * buffer);
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
* Mouse functions
|
||||
*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
\brief Set the touch data in the VPADData buffer.
|
||||
\brief Set the touch data in the VPADStatus buffer.
|
||||
Currently its only possible to set the touch data from a Mouse
|
||||
|
||||
\param data The current data of the HID device
|
||||
\param buffer Pointer to VPADData where the touch data will be set.
|
||||
\param buffer Pointer to VPADStatus where the touch data will be set.
|
||||
|
||||
\return When the functions failed result < 0 is returned. If the result is >= 0 the function was successful.
|
||||
**/
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setTouch(HID_Data * data,VPADData * buffer);
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setTouch(HID_Data * data,VPADStatus * buffer);
|
||||
|
||||
/** \brief Checks if the mouse mode needs to be changed. Sets it to the new mode if necessary.
|
||||
* Currently the incoming data needs to be from a keyboard.
|
||||
@ -239,21 +239,21 @@ class ControllerPatcherUtils{
|
||||
|
||||
\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(VPADData * buffer, u32 * last_emulatedSticks);
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setEmulatedSticks(VPADStatus * buffer, u32 * last_emulatedSticks);
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
* Other functions
|
||||
*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/** \brief Set the Pro Controller for a given VPAD data.
|
||||
*
|
||||
* \param vpad_buffer VPADData* A pointer to the given VPAD Data.
|
||||
* \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.
|
||||
* \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(VPADData * vpad_buffer,KPADData * pro_buffer,u32 * lastButtonsPressesPRO);
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR translateToProWPADRead(VPADData * vpad_buffer,WPADReadData * pro_buffer);
|
||||
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);
|
||||
|
||||
/**
|
||||
\brief Checks if the value at the given device + CONTRPS slot equals the expected value.
|
||||
|
@ -17,9 +17,8 @@
|
||||
#ifndef CP_RETAINS_VARS_H_
|
||||
#define CP_RETAINS_VARS_H_
|
||||
|
||||
#include <dynamic_libs/syshid_functions.h>
|
||||
#include <dynamic_libs/padscore_functions.h>
|
||||
#include "../ControllerPatcherDefs.h"
|
||||
#include <controller_patcher/ControllerPatcherDefs.h>
|
||||
#include <nsyshid/hid.h>
|
||||
|
||||
extern ControllerMapping gControllerMapping;
|
||||
|
||||
|
@ -15,13 +15,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
#include "PadConst.hpp"
|
||||
#include <wut.h>
|
||||
|
||||
const u8 DEF_R_STICK = 220;
|
||||
const u8 DEF_L_STICK = 221;
|
||||
const uint8_t DEF_R_STICK = 220;
|
||||
const uint8_t DEF_L_STICK = 221;
|
||||
|
||||
const u8 DEF_STICK_OFFSET_INVERT = CONTRPS_VPAD_BUTTON_L_STICK_X_INVERT - CONTRPS_VPAD_BUTTON_L_STICK_X;
|
||||
const u8 DEF_STICK_OFFSET_DEADZONE = CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE - CONTRPS_VPAD_BUTTON_L_STICK_X;
|
||||
const u8 DEF_STICK_OFFSET_MINMAX = CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX - CONTRPS_VPAD_BUTTON_L_STICK_X;
|
||||
const uint8_t DEF_STICK_OFFSET_INVERT = CONTRPS_VPAD_BUTTON_L_STICK_X_INVERT - CONTRPS_VPAD_BUTTON_L_STICK_X;
|
||||
const uint8_t DEF_STICK_OFFSET_DEADZONE = CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE - CONTRPS_VPAD_BUTTON_L_STICK_X;
|
||||
const uint8_t DEF_STICK_OFFSET_MINMAX = CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX - CONTRPS_VPAD_BUTTON_L_STICK_X;
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Device names
|
||||
@ -39,24 +40,24 @@ const char *HID_SWITCH_PRO_STRING = "Switch\nPro Controller";
|
||||
//! GC-Adapter
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
const u8 HID_GC_BUTTON_A[] = { 0x01,HID_GC_BUTTON_A_VALUE};
|
||||
const u8 HID_GC_BUTTON_B[] = { 0x01,HID_GC_BUTTON_B_VALUE};
|
||||
const u8 HID_GC_BUTTON_X[] = { 0x01,HID_GC_BUTTON_X_VALUE};
|
||||
const u8 HID_GC_BUTTON_Y[] = { 0x01,HID_GC_BUTTON_Y_VALUE};
|
||||
const u8 HID_GC_BUTTON_LEFT[] = { 0x01,HID_GC_BUTTON_LEFT_VALUE};
|
||||
const u8 HID_GC_BUTTON_RIGHT[] = { 0x01,HID_GC_BUTTON_RIGHT_VALUE};
|
||||
const u8 HID_GC_BUTTON_DOWN[] = { 0x01,HID_GC_BUTTON_DOWN_VALUE};
|
||||
const u8 HID_GC_BUTTON_UP[] = { 0x01,HID_GC_BUTTON_UP_VALUE};
|
||||
const uint8_t HID_GC_BUTTON_A[] = { 0x01,HID_GC_BUTTON_A_VALUE};
|
||||
const uint8_t HID_GC_BUTTON_B[] = { 0x01,HID_GC_BUTTON_B_VALUE};
|
||||
const uint8_t HID_GC_BUTTON_X[] = { 0x01,HID_GC_BUTTON_X_VALUE};
|
||||
const uint8_t HID_GC_BUTTON_Y[] = { 0x01,HID_GC_BUTTON_Y_VALUE};
|
||||
const uint8_t HID_GC_BUTTON_LEFT[] = { 0x01,HID_GC_BUTTON_LEFT_VALUE};
|
||||
const uint8_t HID_GC_BUTTON_RIGHT[] = { 0x01,HID_GC_BUTTON_RIGHT_VALUE};
|
||||
const uint8_t HID_GC_BUTTON_DOWN[] = { 0x01,HID_GC_BUTTON_DOWN_VALUE};
|
||||
const uint8_t HID_GC_BUTTON_UP[] = { 0x01,HID_GC_BUTTON_UP_VALUE};
|
||||
|
||||
const u8 HID_GC_BUTTON_START[] = { 0x02,HID_GC_BUTTON_START_VALUE};
|
||||
const u8 HID_GC_BUTTON_Z[] = { 0x02,HID_GC_BUTTON_Z_VALUE};
|
||||
const uint8_t HID_GC_BUTTON_START[] = { 0x02,HID_GC_BUTTON_START_VALUE};
|
||||
const uint8_t HID_GC_BUTTON_Z[] = { 0x02,HID_GC_BUTTON_Z_VALUE};
|
||||
|
||||
const u8 HID_GC_BUTTON_L[] = { 0x07,HID_GC_BUTTON_L_VALUE};
|
||||
const u8 HID_GC_BUTTON_R[] = { 0x08,HID_GC_BUTTON_R_VALUE};
|
||||
const uint8_t HID_GC_BUTTON_L[] = { 0x07,HID_GC_BUTTON_L_VALUE};
|
||||
const uint8_t HID_GC_BUTTON_R[] = { 0x08,HID_GC_BUTTON_R_VALUE};
|
||||
|
||||
const u8 HID_GC_BUTTON_DPAD_TYPE[] = { CONTRPDM_Normal,0x00};
|
||||
const uint8_t HID_GC_BUTTON_DPAD_TYPE[] = { CONTRPDM_Normal,0x00};
|
||||
|
||||
const u8 HID_GC_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_GC_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x03, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x09, //STICK_CONF_DEADZONE,
|
||||
@ -64,7 +65,7 @@ const u8 HID_GC_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VAL
|
||||
0x1A, //STICK_CONF_MIN,
|
||||
0xE4};//STICK_CONF_MAX,
|
||||
|
||||
const u8 HID_GC_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_GC_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x04, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x09, //STICK_CONF_DEADZONE,
|
||||
@ -72,7 +73,7 @@ const u8 HID_GC_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VAL
|
||||
0x11, //STICK_CONF_MIN,
|
||||
0xE1};//STICK_CONF_MAX,
|
||||
|
||||
const u8 HID_GC_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_GC_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x05, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x09, //STICK_CONF_DEADZONE,
|
||||
@ -80,7 +81,7 @@ const u8 HID_GC_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VAL
|
||||
0x2B, //STICK_CONF_MIN,
|
||||
0xE2};//STICK_CONF_MAX,
|
||||
|
||||
const u8 HID_GC_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_GC_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x06, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x09, //STICK_CONF_DEADZONE,
|
||||
@ -92,30 +93,30 @@ const u8 HID_GC_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VAL
|
||||
//! DS3
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
const u8 HID_DS3_BUTTON_CROSS[] = { 0x03,HID_DS3_BUTTON_CROSS_VALUE};
|
||||
const u8 HID_DS3_BUTTON_CIRCLE[] = { 0x03,HID_DS3_BUTTON_CIRCLE_VALUE};
|
||||
const u8 HID_DS3_BUTTON_SQUARE [] = { 0x03,HID_DS3_BUTTON_SQUARE_VALUE};
|
||||
const u8 HID_DS3_BUTTON_TRIANGLE[] = { 0x03,HID_DS3_BUTTON_TRIANGLE_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_CROSS[] = { 0x03,HID_DS3_BUTTON_CROSS_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_CIRCLE[] = { 0x03,HID_DS3_BUTTON_CIRCLE_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_SQUARE [] = { 0x03,HID_DS3_BUTTON_SQUARE_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_TRIANGLE[] = { 0x03,HID_DS3_BUTTON_TRIANGLE_VALUE};
|
||||
|
||||
const u8 HID_DS3_BUTTON_L1[] = { 0x03,HID_DS3_BUTTON_L1_VALUE};
|
||||
const u8 HID_DS3_BUTTON_L2[] = { 0x03,HID_DS3_BUTTON_L2_VALUE};
|
||||
const u8 HID_DS3_BUTTON_R1[] = { 0x03,HID_DS3_BUTTON_R1_VALUE};
|
||||
const u8 HID_DS3_BUTTON_R2[] = { 0x03,HID_DS3_BUTTON_R2_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_L1[] = { 0x03,HID_DS3_BUTTON_L1_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_L2[] = { 0x03,HID_DS3_BUTTON_L2_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_R1[] = { 0x03,HID_DS3_BUTTON_R1_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_R2[] = { 0x03,HID_DS3_BUTTON_R2_VALUE};
|
||||
|
||||
const u8 HID_DS3_BUTTON_L3[] = { 0x02,HID_DS3_BUTTON_L3_VALUE};
|
||||
const u8 HID_DS3_BUTTON_R3[] = { 0x02,HID_DS3_BUTTON_R3_VALUE};
|
||||
const u8 HID_DS3_BUTTON_SELECT[] = { 0x02,HID_DS3_BUTTON_SELECT_VALUE};
|
||||
const u8 HID_DS3_BUTTON_START[] = { 0x02,HID_DS3_BUTTON_START_VALUE};
|
||||
const u8 HID_DS3_BUTTON_LEFT[] = { 0x02,HID_DS3_BUTTON_LEFT_VALUE};
|
||||
const u8 HID_DS3_BUTTON_RIGHT[] = { 0x02,HID_DS3_BUTTON_RIGHT_VALUE};
|
||||
const u8 HID_DS3_BUTTON_UP[] = { 0x02,HID_DS3_BUTTON_UP_VALUE};
|
||||
const u8 HID_DS3_BUTTON_DOWN[] = { 0x02,HID_DS3_BUTTON_DOWN_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_L3[] = { 0x02,HID_DS3_BUTTON_L3_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_R3[] = { 0x02,HID_DS3_BUTTON_R3_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_SELECT[] = { 0x02,HID_DS3_BUTTON_SELECT_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_START[] = { 0x02,HID_DS3_BUTTON_START_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_LEFT[] = { 0x02,HID_DS3_BUTTON_LEFT_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_RIGHT[] = { 0x02,HID_DS3_BUTTON_RIGHT_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_UP[] = { 0x02,HID_DS3_BUTTON_UP_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_DOWN[] = { 0x02,HID_DS3_BUTTON_DOWN_VALUE};
|
||||
|
||||
const u8 HID_DS3_BUTTON_GUIDE[] = { 0x04,HID_DS3_BUTTON_GUIDE_VALUE};
|
||||
const uint8_t HID_DS3_BUTTON_GUIDE[] = { 0x04,HID_DS3_BUTTON_GUIDE_VALUE};
|
||||
|
||||
const u8 HID_DS3_BUTTON_DPAD_TYPE[] = { CONTRPDM_Normal,0x00};
|
||||
const uint8_t HID_DS3_BUTTON_DPAD_TYPE[] = { CONTRPDM_Normal,0x00};
|
||||
|
||||
const u8 HID_DS3_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_DS3_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x06, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x06, //STICK_CONF_DEADZONE,
|
||||
@ -123,7 +124,7 @@ const u8 HID_DS3_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VAL
|
||||
0x00, //STICK_CONF_MIN,
|
||||
0xFF};//STICK_CONF_MAX,
|
||||
|
||||
const u8 HID_DS3_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_DS3_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x07, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x06, //STICK_CONF_DEADZONE,
|
||||
@ -131,7 +132,7 @@ const u8 HID_DS3_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VAL
|
||||
0x00, //STICK_CONF_MIN,
|
||||
0xFF};//STICK_CONF_MAX,
|
||||
|
||||
const u8 HID_DS3_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_DS3_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x08, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x06, //STICK_CONF_DEADZONE,
|
||||
@ -139,7 +140,7 @@ const u8 HID_DS3_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VAL
|
||||
0x00, //STICK_CONF_MIN,
|
||||
0xFF};//STICK_CONF_MAX,
|
||||
|
||||
const u8 HID_DS3_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_DS3_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x09, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x06, //STICK_CONF_DEADZONE,
|
||||
@ -151,38 +152,38 @@ const u8 HID_DS3_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VAL
|
||||
//! DS4
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
const u8 HID_DS4_BUTTON_CROSS[] = { 0x05,HID_DS4_BUTTON_CROSS_VALUE};
|
||||
const u8 HID_DS4_BUTTON_CIRCLE[] = { 0x05,HID_DS4_BUTTON_CIRCLE_VALUE};
|
||||
const u8 HID_DS4_BUTTON_SQUARE [] = { 0x05,HID_DS4_BUTTON_SQUARE_VALUE};
|
||||
const u8 HID_DS4_BUTTON_TRIANGLE[] = { 0x05,HID_DS4_BUTTON_TRIANGLE_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_CROSS[] = { 0x05,HID_DS4_BUTTON_CROSS_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_CIRCLE[] = { 0x05,HID_DS4_BUTTON_CIRCLE_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_SQUARE [] = { 0x05,HID_DS4_BUTTON_SQUARE_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_TRIANGLE[] = { 0x05,HID_DS4_BUTTON_TRIANGLE_VALUE};
|
||||
|
||||
const u8 HID_DS4_BUTTON_L1[] = { 0x06,HID_DS4_BUTTON_L1_VALUE};
|
||||
const u8 HID_DS4_BUTTON_L2[] = { 0x06,HID_DS4_BUTTON_L2_VALUE};
|
||||
const u8 HID_DS4_BUTTON_L3[] = { 0x06,HID_DS4_BUTTON_L3_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_L1[] = { 0x06,HID_DS4_BUTTON_L1_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_L2[] = { 0x06,HID_DS4_BUTTON_L2_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_L3[] = { 0x06,HID_DS4_BUTTON_L3_VALUE};
|
||||
|
||||
const u8 HID_DS4_BUTTON_R1[] = { 0x06,HID_DS4_BUTTON_R1_VALUE};
|
||||
const u8 HID_DS4_BUTTON_R2[] = { 0x06,HID_DS4_BUTTON_R2_VALUE};
|
||||
const u8 HID_DS4_BUTTON_R3[] = { 0x06,HID_DS4_BUTTON_R3_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_R1[] = { 0x06,HID_DS4_BUTTON_R1_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_R2[] = { 0x06,HID_DS4_BUTTON_R2_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_R3[] = { 0x06,HID_DS4_BUTTON_R3_VALUE};
|
||||
|
||||
const u8 HID_DS4_BUTTON_SHARE[] = { 0x06,HID_DS4_BUTTON_SHARE_VALUE};
|
||||
const u8 HID_DS4_BUTTON_OPTIONS[] = { 0x06,HID_DS4_BUTTON_OPTIONS_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_SHARE[] = { 0x06,HID_DS4_BUTTON_SHARE_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_OPTIONS[] = { 0x06,HID_DS4_BUTTON_OPTIONS_VALUE};
|
||||
|
||||
|
||||
const u8 HID_DS4_BUTTON_DPAD_TYPE[] = { CONTRPDM_Hat,HID_DS4_BUTTON_DPAD_MASK_VALUE};
|
||||
const u8 HID_DS4_BUTTON_DPAD_N[] = { 0x05,HID_DS4_BUTTON_DPAD_N_VALUE};
|
||||
const u8 HID_DS4_BUTTON_DPAD_NE[] = { 0x05,HID_DS4_BUTTON_DPAD_NE_VALUE};
|
||||
const u8 HID_DS4_BUTTON_DPAD_E[] = { 0x05,HID_DS4_BUTTON_DPAD_E_VALUE};
|
||||
const u8 HID_DS4_BUTTON_DPAD_SE[] = { 0x05,HID_DS4_BUTTON_DPAD_SE_VALUE};
|
||||
const u8 HID_DS4_BUTTON_DPAD_S[] = { 0x05,HID_DS4_BUTTON_DPAD_S_VALUE};
|
||||
const u8 HID_DS4_BUTTON_DPAD_SW[] = { 0x05,HID_DS4_BUTTON_DPAD_SW_VALUE};
|
||||
const u8 HID_DS4_BUTTON_DPAD_W[] = { 0x05,HID_DS4_BUTTON_DPAD_W_VALUE};
|
||||
const u8 HID_DS4_BUTTON_DPAD_NW[] = { 0x05,HID_DS4_BUTTON_DPAD_NW_VALUE};
|
||||
const u8 HID_DS4_BUTTON_DPAD_NEUTRAL[] = { 0x05,HID_DS4_BUTTON_DPAD_NEUTRAL_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_DPAD_TYPE[] = { CONTRPDM_Hat,HID_DS4_BUTTON_DPAD_MASK_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_DPAD_N[] = { 0x05,HID_DS4_BUTTON_DPAD_N_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_DPAD_NE[] = { 0x05,HID_DS4_BUTTON_DPAD_NE_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_DPAD_E[] = { 0x05,HID_DS4_BUTTON_DPAD_E_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_DPAD_SE[] = { 0x05,HID_DS4_BUTTON_DPAD_SE_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_DPAD_S[] = { 0x05,HID_DS4_BUTTON_DPAD_S_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_DPAD_SW[] = { 0x05,HID_DS4_BUTTON_DPAD_SW_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_DPAD_W[] = { 0x05,HID_DS4_BUTTON_DPAD_W_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_DPAD_NW[] = { 0x05,HID_DS4_BUTTON_DPAD_NW_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_DPAD_NEUTRAL[] = { 0x05,HID_DS4_BUTTON_DPAD_NEUTRAL_VALUE};
|
||||
|
||||
const u8 HID_DS4_BUTTON_GUIDE[] = { 0x07,HID_DS4_BUTTON_GUIDE_VALUE};
|
||||
const u8 HID_DS4_BUTTON_T_PAD_CLICK[] = { 0x07,HID_DS4_BUTTON_T_PAD_CLICK_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_GUIDE[] = { 0x07,HID_DS4_BUTTON_GUIDE_VALUE};
|
||||
const uint8_t HID_DS4_BUTTON_T_PAD_CLICK[] = { 0x07,HID_DS4_BUTTON_T_PAD_CLICK_VALUE};
|
||||
|
||||
const u8 HID_DS4_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_DS4_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x01, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x06, //STICK_CONF_DEADZONE,
|
||||
@ -190,7 +191,7 @@ const u8 HID_DS4_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VAL
|
||||
0x00, //STICK_CONF_MIN,
|
||||
0xFF};//STICK_CONF_MAX,
|
||||
|
||||
const u8 HID_DS4_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_DS4_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x02, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x05, //STICK_CONF_DEADZONE,
|
||||
@ -198,7 +199,7 @@ const u8 HID_DS4_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VAL
|
||||
0x00, //STICK_CONF_MIN,
|
||||
0xFF};//STICK_CONF_MAX,
|
||||
|
||||
const u8 HID_DS4_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_DS4_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x03, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x07, //STICK_CONF_DEADZONE,
|
||||
@ -206,7 +207,7 @@ const u8 HID_DS4_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VAL
|
||||
0x00, //STICK_CONF_MIN,
|
||||
0xFF};//STICK_CONF_MAX,
|
||||
|
||||
const u8 HID_DS4_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_DS4_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x04, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x09, //STICK_CONF_DEADZONE,
|
||||
@ -218,30 +219,30 @@ const u8 HID_DS4_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VAL
|
||||
//! XInput
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
const u8 HID_XINPUT_BUTTON_A[] = { 0x07,HID_XINPUT_BUTTON_A_VALUE};
|
||||
const u8 HID_XINPUT_BUTTON_B[] = { 0x07,HID_XINPUT_BUTTON_B_VALUE};
|
||||
const u8 HID_XINPUT_BUTTON_X[] = { 0x07,HID_XINPUT_BUTTON_X_VALUE};
|
||||
const u8 HID_XINPUT_BUTTON_Y[] = { 0x07,HID_XINPUT_BUTTON_Y_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_A[] = { 0x07,HID_XINPUT_BUTTON_A_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_B[] = { 0x07,HID_XINPUT_BUTTON_B_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_X[] = { 0x07,HID_XINPUT_BUTTON_X_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_Y[] = { 0x07,HID_XINPUT_BUTTON_Y_VALUE};
|
||||
|
||||
const u8 HID_XINPUT_BUTTON_LB[] = { 0x06,HID_XINPUT_BUTTON_LB_VALUE};
|
||||
const u8 HID_XINPUT_BUTTON_LT[] = { 0x04,HID_XINPUT_BUTTON_LT_VALUE};
|
||||
const u8 HID_XINPUT_BUTTON_L3[] = { 0x06,HID_XINPUT_BUTTON_L3_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_LB[] = { 0x06,HID_XINPUT_BUTTON_LB_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_LT[] = { 0x04,HID_XINPUT_BUTTON_LT_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_L3[] = { 0x06,HID_XINPUT_BUTTON_L3_VALUE};
|
||||
|
||||
const u8 HID_XINPUT_BUTTON_RB[] = { 0x06,HID_XINPUT_BUTTON_RB_VALUE};
|
||||
const u8 HID_XINPUT_BUTTON_RT[] = { 0x05,HID_XINPUT_BUTTON_RT_VALUE};
|
||||
const u8 HID_XINPUT_BUTTON_R3[] = { 0x06,HID_XINPUT_BUTTON_R3_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_RB[] = { 0x06,HID_XINPUT_BUTTON_RB_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_RT[] = { 0x05,HID_XINPUT_BUTTON_RT_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_R3[] = { 0x06,HID_XINPUT_BUTTON_R3_VALUE};
|
||||
|
||||
const u8 HID_XINPUT_BUTTON_START[] = { 0x06,HID_XINPUT_BUTTON_START_VALUE};
|
||||
const u8 HID_XINPUT_BUTTON_BACK[] = { 0x06,HID_XINPUT_BUTTON_BACK_VALUE};
|
||||
const u8 HID_XINPUT_BUTTON_GUIDE[] = { 0x06,HID_XINPUT_BUTTON_GUIDE_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_START[] = { 0x06,HID_XINPUT_BUTTON_START_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_BACK[] = { 0x06,HID_XINPUT_BUTTON_BACK_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_GUIDE[] = { 0x06,HID_XINPUT_BUTTON_GUIDE_VALUE};
|
||||
|
||||
const u8 HID_XINPUT_BUTTON_DPAD_TYPE[] = { CONTRPDM_Normal,HID_XINPUT_BUTTON_DPAD_MASK_VALUE};
|
||||
const u8 HID_XINPUT_BUTTON_LEFT[] = { 0x07,HID_XINPUT_BUTTON_LEFT_VALUE};
|
||||
const u8 HID_XINPUT_BUTTON_RIGHT[] = { 0x07,HID_XINPUT_BUTTON_RIGHT_VALUE};
|
||||
const u8 HID_XINPUT_BUTTON_DOWN[] = { 0x07,HID_XINPUT_BUTTON_DOWN_VALUE};
|
||||
const u8 HID_XINPUT_BUTTON_UP[] = { 0x07,HID_XINPUT_BUTTON_UP_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_DPAD_TYPE[] = { CONTRPDM_Normal,HID_XINPUT_BUTTON_DPAD_MASK_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_LEFT[] = { 0x07,HID_XINPUT_BUTTON_LEFT_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_RIGHT[] = { 0x07,HID_XINPUT_BUTTON_RIGHT_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_DOWN[] = { 0x07,HID_XINPUT_BUTTON_DOWN_VALUE};
|
||||
const uint8_t HID_XINPUT_BUTTON_UP[] = { 0x07,HID_XINPUT_BUTTON_UP_VALUE};
|
||||
|
||||
const u8 HID_XINPUT_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_XINPUT_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x00, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x10, //STICK_CONF_DEADZONE,
|
||||
@ -249,7 +250,7 @@ const u8 HID_XINPUT_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_
|
||||
0x00, //STICK_CONF_MIN,
|
||||
0xFF};//STICK_CONF_MAX,
|
||||
|
||||
const u8 HID_XINPUT_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_XINPUT_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x01, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x10, //STICK_CONF_DEADZONE,
|
||||
@ -257,7 +258,7 @@ const u8 HID_XINPUT_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_
|
||||
0x00, //STICK_CONF_MIN,
|
||||
0xFF};//STICK_CONF_MAX,
|
||||
|
||||
const u8 HID_XINPUT_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_XINPUT_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x02, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x10, //STICK_CONF_DEADZONE,
|
||||
@ -265,7 +266,7 @@ const u8 HID_XINPUT_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_
|
||||
0x00, //STICK_CONF_MIN,
|
||||
0xFF};//STICK_CONF_MAX,
|
||||
|
||||
const u8 HID_XINPUT_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_XINPUT_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x03, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x10, //STICK_CONF_DEADZONE,
|
||||
@ -279,36 +280,36 @@ const u8 HID_XINPUT_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_
|
||||
//! Switch Pro Controller
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_A[] = { 0x00,(u8)((HID_SWITCH_PRO_BT_BUTTON_A_VALUE >> 24) & 0xFF)};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_B[] = { 0x00,(u8)((HID_SWITCH_PRO_BT_BUTTON_B_VALUE >> 24) & 0xFF)};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_X[] = { 0x00,(u8)((HID_SWITCH_PRO_BT_BUTTON_X_VALUE >> 24) & 0xFF)};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_Y[] = { 0x00,(u8)((HID_SWITCH_PRO_BT_BUTTON_Y_VALUE >> 24) & 0xFF)};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_A[] = { 0x00,(uint8_t)((HID_SWITCH_PRO_BT_BUTTON_A_VALUE >> 24) & 0xFF)};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_B[] = { 0x00,(uint8_t)((HID_SWITCH_PRO_BT_BUTTON_B_VALUE >> 24) & 0xFF)};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_X[] = { 0x00,(uint8_t)((HID_SWITCH_PRO_BT_BUTTON_X_VALUE >> 24) & 0xFF)};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_Y[] = { 0x00,(uint8_t)((HID_SWITCH_PRO_BT_BUTTON_Y_VALUE >> 24) & 0xFF)};
|
||||
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_L[] = { 0x00,(u8)((HID_SWITCH_PRO_BT_BUTTON_L_VALUE >> 24) & 0xFF)};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_ZL[] = { 0x00,(u8)((HID_SWITCH_PRO_BT_BUTTON_ZL_VALUE >> 24) & 0xFF)};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_STICK_L[] = { 0x01,(u8)((HID_SWITCH_PRO_BT_BUTTON_STICK_L_VALUE >> 16) & 0xFF)};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_L[] = { 0x00,(uint8_t)((HID_SWITCH_PRO_BT_BUTTON_L_VALUE >> 24) & 0xFF)};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_ZL[] = { 0x00,(uint8_t)((HID_SWITCH_PRO_BT_BUTTON_ZL_VALUE >> 24) & 0xFF)};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_STICK_L[] = { 0x01,(uint8_t)((HID_SWITCH_PRO_BT_BUTTON_STICK_L_VALUE >> 16) & 0xFF)};
|
||||
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_R[] = { 0x00,(u8)((HID_SWITCH_PRO_BT_BUTTON_R_VALUE >> 24) & 0xFF)};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_ZR[] = { 0x00,(u8)((HID_SWITCH_PRO_BT_BUTTON_ZR_VALUE >> 24) & 0xFF)};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_STICK_R[] = { 0x01,(u8)((HID_SWITCH_PRO_BT_BUTTON_STICK_R_VALUE >> 16) & 0xFF)};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_R[] = { 0x00,(uint8_t)((HID_SWITCH_PRO_BT_BUTTON_R_VALUE >> 24) & 0xFF)};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_ZR[] = { 0x00,(uint8_t)((HID_SWITCH_PRO_BT_BUTTON_ZR_VALUE >> 24) & 0xFF)};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_STICK_R[] = { 0x01,(uint8_t)((HID_SWITCH_PRO_BT_BUTTON_STICK_R_VALUE >> 16) & 0xFF)};
|
||||
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_PLUS[] = { 0x01,(u8)((HID_SWITCH_PRO_BT_BUTTON_PLUS_VALUE >> 16) & 0xFF)};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_MINUS[] = { 0x01,(u8)((HID_SWITCH_PRO_BT_BUTTON_MINUS_VALUE >> 16) & 0xFF)};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_HOME[] = { 0x01,(u8)((HID_SWITCH_PRO_BT_BUTTON_HOME_VALUE >> 16) & 0xFF)};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_PLUS[] = { 0x01,(uint8_t)((HID_SWITCH_PRO_BT_BUTTON_PLUS_VALUE >> 16) & 0xFF)};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_MINUS[] = { 0x01,(uint8_t)((HID_SWITCH_PRO_BT_BUTTON_MINUS_VALUE >> 16) & 0xFF)};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_HOME[] = { 0x01,(uint8_t)((HID_SWITCH_PRO_BT_BUTTON_HOME_VALUE >> 16) & 0xFF)};
|
||||
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_TYPE[] = { CONTRPDM_Hat,HID_SWITCH_PRO_BT_BUTTON_DPAD_MASK_VALUE};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_N[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_N_VALUE};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_NE[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_NE_VALUE};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_E[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_E_VALUE};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_SE[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_SE_VALUE};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_S[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_S_VALUE};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_SW[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_SW_VALUE};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_W[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_W_VALUE};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_NW[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_NW_VALUE};
|
||||
const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_NEUTRAL[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_NEUTRAL_VALUE};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_TYPE[] = { CONTRPDM_Hat,HID_SWITCH_PRO_BT_BUTTON_DPAD_MASK_VALUE};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_N[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_N_VALUE};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_NE[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_NE_VALUE};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_E[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_E_VALUE};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_SE[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_SE_VALUE};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_S[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_S_VALUE};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_SW[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_SW_VALUE};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_W[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_W_VALUE};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_NW[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_NW_VALUE};
|
||||
const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_NEUTRAL[] = { 0x02,HID_SWITCH_PRO_BT_BUTTON_DPAD_NEUTRAL_VALUE};
|
||||
|
||||
|
||||
const u8 HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x04, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x01, //STICK_CONF_DEADZONE,
|
||||
@ -316,7 +317,7 @@ const u8 HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF
|
||||
0x28, //STICK_CONF_MIN,
|
||||
0xDF};//STICK_CONF_MAX,
|
||||
|
||||
const u8 HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x06, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x06, //STICK_CONF_DEADZONE,
|
||||
@ -324,7 +325,7 @@ const u8 HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF
|
||||
0x16, //STICK_CONF_MIN,
|
||||
0xD7};//STICK_CONF_MAX,
|
||||
|
||||
const u8 HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x08, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x04, //STICK_CONF_DEADZONE,
|
||||
@ -332,7 +333,7 @@ const u8 HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF
|
||||
0x29, //STICK_CONF_MIN,
|
||||
0xE2};//STICK_CONF_MAX,
|
||||
|
||||
const u8 HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
const uint8_t HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
|
||||
0x0A, //STICK_CONF_BYTE,
|
||||
0x80, //STICK_CONF_DEFAULT,
|
||||
0x08, //STICK_CONF_DEADZONE,
|
||||
|
@ -20,14 +20,14 @@
|
||||
|
||||
|
||||
#include <string>
|
||||
#include "../ControllerPatcherDefs.h"
|
||||
#include <controller_patcher/ControllerPatcherDefs.h>
|
||||
|
||||
extern const u8 DEF_R_STICK;
|
||||
extern const u8 DEF_L_STICK;
|
||||
extern const uint8_t DEF_R_STICK;
|
||||
extern const uint8_t DEF_L_STICK;
|
||||
|
||||
extern const u8 DEF_STICK_OFFSET_INVERT;
|
||||
extern const u8 DEF_STICK_OFFSET_DEADZONE;
|
||||
extern const u8 DEF_STICK_OFFSET_MINMAX;
|
||||
extern const uint8_t DEF_STICK_OFFSET_INVERT;
|
||||
extern const uint8_t DEF_STICK_OFFSET_DEADZONE;
|
||||
extern const uint8_t DEF_STICK_OFFSET_MINMAX;
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Device names
|
||||
@ -45,168 +45,168 @@ extern const char *HID_SWITCH_PRO_STRING;
|
||||
//! GC_Adapter
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
extern const u8 HID_GC_BUTTON_A[];
|
||||
extern const u8 HID_GC_BUTTON_B[];
|
||||
extern const u8 HID_GC_BUTTON_X[];
|
||||
extern const u8 HID_GC_BUTTON_Y[];
|
||||
extern const u8 HID_GC_BUTTON_LEFT[];
|
||||
extern const u8 HID_GC_BUTTON_RIGHT[];
|
||||
extern const u8 HID_GC_BUTTON_DOWN[];
|
||||
extern const u8 HID_GC_BUTTON_UP[];
|
||||
extern const uint8_t HID_GC_BUTTON_A[];
|
||||
extern const uint8_t HID_GC_BUTTON_B[];
|
||||
extern const uint8_t HID_GC_BUTTON_X[];
|
||||
extern const uint8_t HID_GC_BUTTON_Y[];
|
||||
extern const uint8_t HID_GC_BUTTON_LEFT[];
|
||||
extern const uint8_t HID_GC_BUTTON_RIGHT[];
|
||||
extern const uint8_t HID_GC_BUTTON_DOWN[];
|
||||
extern const uint8_t HID_GC_BUTTON_UP[];
|
||||
|
||||
extern const u8 HID_GC_BUTTON_START[];
|
||||
extern const u8 HID_GC_BUTTON_Z[];
|
||||
extern const uint8_t HID_GC_BUTTON_START[];
|
||||
extern const uint8_t HID_GC_BUTTON_Z[];
|
||||
|
||||
extern const u8 HID_GC_BUTTON_L[];
|
||||
extern const u8 HID_GC_BUTTON_R[];
|
||||
extern const uint8_t HID_GC_BUTTON_L[];
|
||||
extern const uint8_t HID_GC_BUTTON_R[];
|
||||
|
||||
extern const u8 HID_GC_BUTTON_DPAD_TYPE[];
|
||||
extern const uint8_t HID_GC_BUTTON_DPAD_TYPE[];
|
||||
|
||||
extern const u8 HID_GC_STICK_L_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const u8 HID_GC_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const u8 HID_GC_STICK_R_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const u8 HID_GC_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_GC_STICK_L_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_GC_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_GC_STICK_R_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_GC_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! DS3
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
extern const u8 HID_DS3_BUTTON_CROSS[];
|
||||
extern const u8 HID_DS3_BUTTON_CIRCLE[];
|
||||
extern const u8 HID_DS3_BUTTON_SQUARE [];
|
||||
extern const u8 HID_DS3_BUTTON_TRIANGLE[];
|
||||
extern const uint8_t HID_DS3_BUTTON_CROSS[];
|
||||
extern const uint8_t HID_DS3_BUTTON_CIRCLE[];
|
||||
extern const uint8_t HID_DS3_BUTTON_SQUARE [];
|
||||
extern const uint8_t HID_DS3_BUTTON_TRIANGLE[];
|
||||
|
||||
extern const u8 HID_DS3_BUTTON_L1[];
|
||||
extern const u8 HID_DS3_BUTTON_L2[];
|
||||
extern const u8 HID_DS3_BUTTON_R1[];
|
||||
extern const u8 HID_DS3_BUTTON_R2[];
|
||||
extern const uint8_t HID_DS3_BUTTON_L1[];
|
||||
extern const uint8_t HID_DS3_BUTTON_L2[];
|
||||
extern const uint8_t HID_DS3_BUTTON_R1[];
|
||||
extern const uint8_t HID_DS3_BUTTON_R2[];
|
||||
|
||||
extern const u8 HID_DS3_BUTTON_L3[];
|
||||
extern const u8 HID_DS3_BUTTON_R3[];
|
||||
extern const u8 HID_DS3_BUTTON_SELECT[];
|
||||
extern const u8 HID_DS3_BUTTON_START[];
|
||||
extern const u8 HID_DS3_BUTTON_LEFT[];
|
||||
extern const u8 HID_DS3_BUTTON_RIGHT[];
|
||||
extern const u8 HID_DS3_BUTTON_UP[];
|
||||
extern const u8 HID_DS3_BUTTON_DOWN[];
|
||||
extern const uint8_t HID_DS3_BUTTON_L3[];
|
||||
extern const uint8_t HID_DS3_BUTTON_R3[];
|
||||
extern const uint8_t HID_DS3_BUTTON_SELECT[];
|
||||
extern const uint8_t HID_DS3_BUTTON_START[];
|
||||
extern const uint8_t HID_DS3_BUTTON_LEFT[];
|
||||
extern const uint8_t HID_DS3_BUTTON_RIGHT[];
|
||||
extern const uint8_t HID_DS3_BUTTON_UP[];
|
||||
extern const uint8_t HID_DS3_BUTTON_DOWN[];
|
||||
|
||||
extern const u8 HID_DS3_BUTTON_GUIDE[];
|
||||
extern const uint8_t HID_DS3_BUTTON_GUIDE[];
|
||||
|
||||
extern const u8 HID_DS3_BUTTON_DPAD_TYPE[];
|
||||
extern const uint8_t HID_DS3_BUTTON_DPAD_TYPE[];
|
||||
|
||||
extern const u8 HID_DS3_STICK_L_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const u8 HID_DS3_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const u8 HID_DS3_STICK_R_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const u8 HID_DS3_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_DS3_STICK_L_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_DS3_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_DS3_STICK_R_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_DS3_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! DS4
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
extern const u8 HID_DS4_BUTTON_CROSS[];
|
||||
extern const u8 HID_DS4_BUTTON_CIRCLE[];
|
||||
extern const u8 HID_DS4_BUTTON_SQUARE [];
|
||||
extern const u8 HID_DS4_BUTTON_TRIANGLE[];
|
||||
extern const uint8_t HID_DS4_BUTTON_CROSS[];
|
||||
extern const uint8_t HID_DS4_BUTTON_CIRCLE[];
|
||||
extern const uint8_t HID_DS4_BUTTON_SQUARE [];
|
||||
extern const uint8_t HID_DS4_BUTTON_TRIANGLE[];
|
||||
|
||||
extern const u8 HID_DS4_BUTTON_L1[];
|
||||
extern const u8 HID_DS4_BUTTON_L2[];
|
||||
extern const u8 HID_DS4_BUTTON_L3[];
|
||||
extern const u8 HID_DS4_BUTTON_R1[];
|
||||
extern const u8 HID_DS4_BUTTON_R2[];
|
||||
extern const u8 HID_DS4_BUTTON_R3[];
|
||||
extern const uint8_t HID_DS4_BUTTON_L1[];
|
||||
extern const uint8_t HID_DS4_BUTTON_L2[];
|
||||
extern const uint8_t HID_DS4_BUTTON_L3[];
|
||||
extern const uint8_t HID_DS4_BUTTON_R1[];
|
||||
extern const uint8_t HID_DS4_BUTTON_R2[];
|
||||
extern const uint8_t HID_DS4_BUTTON_R3[];
|
||||
|
||||
extern const u8 HID_DS4_BUTTON_SHARE[];
|
||||
extern const u8 HID_DS4_BUTTON_OPTIONS[];
|
||||
extern const uint8_t HID_DS4_BUTTON_SHARE[];
|
||||
extern const uint8_t HID_DS4_BUTTON_OPTIONS[];
|
||||
|
||||
extern const u8 HID_DS4_BUTTON_DPAD_TYPE[];
|
||||
extern const u8 HID_DS4_BUTTON_DPAD_N[];
|
||||
extern const u8 HID_DS4_BUTTON_DPAD_NE[];
|
||||
extern const u8 HID_DS4_BUTTON_DPAD_E[];
|
||||
extern const u8 HID_DS4_BUTTON_DPAD_SE[];
|
||||
extern const u8 HID_DS4_BUTTON_DPAD_S[];
|
||||
extern const u8 HID_DS4_BUTTON_DPAD_SW[];
|
||||
extern const u8 HID_DS4_BUTTON_DPAD_W[];
|
||||
extern const u8 HID_DS4_BUTTON_DPAD_NW[];
|
||||
extern const u8 HID_DS4_BUTTON_DPAD_NEUTRAL[];
|
||||
extern const uint8_t HID_DS4_BUTTON_DPAD_TYPE[];
|
||||
extern const uint8_t HID_DS4_BUTTON_DPAD_N[];
|
||||
extern const uint8_t HID_DS4_BUTTON_DPAD_NE[];
|
||||
extern const uint8_t HID_DS4_BUTTON_DPAD_E[];
|
||||
extern const uint8_t HID_DS4_BUTTON_DPAD_SE[];
|
||||
extern const uint8_t HID_DS4_BUTTON_DPAD_S[];
|
||||
extern const uint8_t HID_DS4_BUTTON_DPAD_SW[];
|
||||
extern const uint8_t HID_DS4_BUTTON_DPAD_W[];
|
||||
extern const uint8_t HID_DS4_BUTTON_DPAD_NW[];
|
||||
extern const uint8_t HID_DS4_BUTTON_DPAD_NEUTRAL[];
|
||||
|
||||
extern const u8 HID_DS4_BUTTON_GUIDE[];
|
||||
extern const u8 HID_DS4_BUTTON_T_PAD_CLICK[];
|
||||
extern const uint8_t HID_DS4_BUTTON_GUIDE[];
|
||||
extern const uint8_t HID_DS4_BUTTON_T_PAD_CLICK[];
|
||||
|
||||
extern const u8 HID_DS4_STICK_L_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const u8 HID_DS4_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const u8 HID_DS4_STICK_R_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const u8 HID_DS4_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_DS4_STICK_L_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_DS4_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_DS4_STICK_R_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_DS4_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! XInput
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
extern const u8 HID_XINPUT_BUTTON_A[];
|
||||
extern const u8 HID_XINPUT_BUTTON_B[];
|
||||
extern const u8 HID_XINPUT_BUTTON_X[];
|
||||
extern const u8 HID_XINPUT_BUTTON_Y[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_A[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_B[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_X[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_Y[];
|
||||
|
||||
extern const u8 HID_XINPUT_BUTTON_LB[];
|
||||
extern const u8 HID_XINPUT_BUTTON_LT[];
|
||||
extern const u8 HID_XINPUT_BUTTON_L3[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_LB[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_LT[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_L3[];
|
||||
|
||||
extern const u8 HID_XINPUT_BUTTON_RB[];
|
||||
extern const u8 HID_XINPUT_BUTTON_RT[];
|
||||
extern const u8 HID_XINPUT_BUTTON_R3[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_RB[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_RT[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_R3[];
|
||||
|
||||
extern const u8 HID_XINPUT_BUTTON_START[];
|
||||
extern const u8 HID_XINPUT_BUTTON_BACK[];
|
||||
extern const u8 HID_XINPUT_BUTTON_GUIDE[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_START[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_BACK[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_GUIDE[];
|
||||
|
||||
extern const u8 HID_XINPUT_BUTTON_DPAD_TYPE[];
|
||||
extern const u8 HID_XINPUT_BUTTON_LEFT[];
|
||||
extern const u8 HID_XINPUT_BUTTON_RIGHT[];
|
||||
extern const u8 HID_XINPUT_BUTTON_DOWN[];
|
||||
extern const u8 HID_XINPUT_BUTTON_UP[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_DPAD_TYPE[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_LEFT[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_RIGHT[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_DOWN[];
|
||||
extern const uint8_t HID_XINPUT_BUTTON_UP[];
|
||||
|
||||
extern const u8 HID_XINPUT_STICK_L_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const u8 HID_XINPUT_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const u8 HID_XINPUT_STICK_R_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const u8 HID_XINPUT_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_XINPUT_STICK_L_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_XINPUT_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_XINPUT_STICK_R_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_XINPUT_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Switch Pro Controller
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_A[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_B[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_X[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_Y[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_A[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_B[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_X[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_Y[];
|
||||
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_L[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_ZL[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_STICK_L[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_L[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_ZL[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_STICK_L[];
|
||||
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_R[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_ZR[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_STICK_R[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_R[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_ZR[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_STICK_R[];
|
||||
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_PLUS[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_MINUS[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_HOME[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_PLUS[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_MINUS[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_HOME[];
|
||||
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_TYPE[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_N[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_NE[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_E[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_SE[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_S[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_SW[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_W[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_NW[];
|
||||
extern const u8 HID_SWITCH_PRO_BT_BUTTON_DPAD_NEUTRAL[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_TYPE[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_N[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_NE[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_E[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_SE[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_S[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_SW[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_W[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_NW[];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_BUTTON_DPAD_NEUTRAL[];
|
||||
|
||||
|
||||
extern const u8 HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const u8 HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const u8 HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const u8 HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_ENUM_MAXVALUE];
|
||||
extern const uint8_t HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE];
|
||||
|
||||
#endif /* _PAD_CONST_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user