Add a .clang_format

This commit is contained in:
Maschell 2023-04-10 11:45:58 +02:00
parent c8a077574e
commit 7c4232e177
37 changed files with 3074 additions and 3005 deletions

67
.clang-format Normal file
View File

@ -0,0 +1,67 @@
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: false
ContinuationIndentWidth: 8
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Right
ReflowComments: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Never

View File

@ -50,6 +50,10 @@ ControllerPatcher::DeInit();
ControllerPatcher::stopNetworkServer();
```
## Format the code via docker
`docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./source ./include -i`
# Credits:
- Maschell
- FIX94 - huge thanks to him and his initally created gc-to-vpad. Was a motivation and base to start all this

View File

@ -29,9 +29,9 @@
#include <string>
#include "ControllerPatcherDefs.h"
#include <padscore/wpad.h>
#include <vpad/input.h>
#include "ControllerPatcherDefs.h"
class ControllerPatcher {
public:

View File

@ -17,13 +17,12 @@
#include "./ConfigReader.hpp"
#include <fs/FSUtils.h>
#include <fcntl.h>
#include <map>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>

View File

@ -25,6 +25,7 @@
class ConfigReader {
friend class ControllerPatcher;
friend class ConfigParser;
private:
static ConfigReader *getInstance() {
if (!instance) {

View File

@ -18,11 +18,11 @@
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <coreinit/energysaver.h>
#include <coreinit/dynload.h>
#include <coreinit/energysaver.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <utils/logger.h>
@ -527,7 +527,6 @@ BOOL ControllerPatcher::Init(const char * pathToConfig) {
DEBUG_FUNCTION_LINE("Done with reading config files from SD Card");
gConfig_done = HID_SDCARD_READ;
}
}
DEBUG_FUNCTION_LINE("Initializing the data for button remapping");

View File

@ -22,29 +22,29 @@
#include <wut_types.h>
#include <coreinit/systeminfo.h>
#include <padscore/kpad.h>
#include <padscore/wpad.h>
#include <vpad/input.h>
#include <coreinit/systeminfo.h>
#include <sys/socket.h>
#include <vpad/input.h>
#include "./ConfigReader.hpp"
#include <controller_patcher/ControllerPatcher.hpp>
#include <system/CThread.h>
#include "./utils/CPRetainVars.hpp"
#include "./utils/PadConst.hpp"
#include <system/CThread.h>
#include <utils/StringTools.h>
#include "./patcher/ControllerPatcherHID.hpp"
#include "./patcher/ControllerPatcherUtils.hpp"
#include "./config/ConfigValues.hpp"
#include "./config/ConfigParser.hpp"
#include "./config/ConfigValues.hpp"
#include "./network/CPTCPServer.hpp"
#include "./network/UDPServer.hpp"
#include "./network/UDPClient.hpp"
#include "./network/UDPServer.hpp"
#endif /* _CONTROLLER_PATCHER_INCLUDES_H_ */

View File

@ -15,11 +15,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "./ConfigParser.hpp"
#include <utils/StringTools.h>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <utils/StringTools.h>
ConfigParser::ConfigParser(std::string configData) {
this->content = configData;
@ -51,7 +51,6 @@ ConfigParser::ConfigParser(std::string configData) {
}
ConfigParser::~ConfigParser() {
}
PARSE_TYPE ConfigParser::getType() {

View File

@ -17,9 +17,9 @@
#ifndef _ConfigParser_H_
#define _ConfigParser_H_
#include <map>
#include <string>
#include <vector>
#include <map>
#include <stdio.h>
@ -37,6 +37,7 @@ enum PARSE_TYPE{
class ConfigParser {
friend class ConfigReader;
friend class ControllerPatcher;
private:
//!Constructor
ConfigParser(std::string configData);

View File

@ -17,18 +17,18 @@
#ifndef _ConfigValues_H_
#define _ConfigValues_H_
#include <map>
#include <string>
#include <vector>
#include <map>
#include "../ControllerPatcherIncludes.hpp"
#include <utils/logger.h>
class ConfigValues
{
class ConfigValues {
friend class ConfigParser;
friend class ControllerPatcher;
private:
static ConfigValues *getInstance() {
if (instance == NULL) {
@ -48,8 +48,7 @@ private:
/**
Returns NULL if not a preset!
**/
static const uint8_t * getValuesStickPreset(std::string possibleValue)
{
static const uint8_t *getValuesStickPreset(std::string possibleValue) {
ConfigValues *cur_instance = getInstance();
if (cur_instance == NULL) return NULL;
return cur_instance->getValuesForPreset(cur_instance->presetSticks, possibleValue);
@ -58,8 +57,7 @@ private:
/**
Returns -1 if not found
**/
static int32_t getKeySlotGamePad(std::string possibleValue)
{
static int32_t getKeySlotGamePad(std::string possibleValue) {
ConfigValues *cur_instance = getInstance();
if (cur_instance == NULL) return -1;
return cur_instance->getValueFromMap(cur_instance->CONTPRStringToValue, possibleValue);
@ -67,8 +65,7 @@ private:
/**
Returns -1 if not found
**/
static int32_t getKeySlotMouse(std::string possibleValue)
{
static int32_t getKeySlotMouse(std::string possibleValue) {
ConfigValues *cur_instance = getInstance();
if (cur_instance == NULL) return -1;
return cur_instance->getValueFromMap(cur_instance->mouseLeftValues, possibleValue);
@ -77,8 +74,7 @@ private:
/**
Returns -1 if not found
**/
static int32_t getKeySlotDefaultSingleValue(std::string possibleValue)
{
static int32_t getKeySlotDefaultSingleValue(std::string possibleValue) {
ConfigValues *cur_instance = getInstance();
if (cur_instance == NULL) return -1;
return cur_instance->getValueFromMap(cur_instance->CONTPRStringToValueSingle, possibleValue);
@ -87,8 +83,7 @@ private:
/**
Returns -1 if not found
**/
static int32_t getKeySlotDefaultPairedValue(std::string possibleValue)
{
static int32_t getKeySlotDefaultPairedValue(std::string possibleValue) {
ConfigValues *cur_instance = getInstance();
if (cur_instance == NULL) return -1;
return cur_instance->getValueFromMap(cur_instance->CONTPRStringToValue, possibleValue);
@ -97,8 +92,7 @@ private:
/**
Returns -1 if not found
**/
static int32_t getPresetValuesKeyboard(std::string possibleValue)
{
static int32_t getPresetValuesKeyboard(std::string possibleValue) {
ConfigValues *cur_instance = getInstance();
if (cur_instance == NULL) return -1;
return cur_instance->getValueFromMap(cur_instance->presetKeyboardValues, possibleValue);
@ -107,8 +101,7 @@ private:
/**
Returns -1 if not found
**/
static int32_t getPresetValue(std::string possibleValue)
{
static int32_t getPresetValue(std::string possibleValue) {
ConfigValues *cur_instance = getInstance();
if (cur_instance == NULL) return -1;
return cur_instance->getPresetValueEx(possibleValue);
@ -117,8 +110,7 @@ private:
/**
Returns -1 if not found
**/
static int32_t setIfValueIsAControllerPreset(std::string value,int32_t slot,int32_t keyslot)
{
static int32_t setIfValueIsAControllerPreset(std::string value, int32_t slot, int32_t keyslot) {
ConfigValues *cur_instance = getInstance();
if (cur_instance == NULL) return -1;
return cur_instance->setIfValueIsAControllerPresetEx(value, slot, keyslot);

View File

@ -1,7 +1,7 @@
#include "CFile.hpp"
#include <stdarg.h>
#include <stdio.h>
#include <strings.h>
#include "CFile.hpp"
CFile::CFile() {
iFd = -1;
@ -169,5 +169,3 @@ int32_t CFile::fwrite(const char *format, ...) {
return result;
}

View File

@ -1,10 +1,10 @@
#ifndef CFILE_HPP_
#define CFILE_HPP_
#include <stdio.h>
#include <string>
#include <string.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <unistd.h>
#include <wut_types.h>

View File

@ -1,11 +1,11 @@
#include <malloc.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include "FSUtils.h"
#include "CFile.hpp"
#include "utils/logger.h"
#include <fcntl.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
int32_t FSUtils::LoadFileToMem(const char *filepath, uint8_t **inbuffer, uint32_t *size) {
//! always initialze input
@ -171,4 +171,3 @@ int32_t FSUtils::saveBufferToFile(const char *path, const void *buffer, uint32_t
file.close();
return written;
}

View File

@ -1,7 +1,7 @@
#pragma once
#include <wut_types.h>
#include <string>
#include <wut_types.h>
class FSUtils {
public:

View File

@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "CPTCPServer.hpp"
#include <netinet/in.h>
#include <malloc.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>

View File

@ -19,12 +19,12 @@
#include "../ControllerPatcherIncludes.hpp"
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <utils/TCPServer.hpp>
#include <network/net.h>
#include <coreinit/title.h>
#include <errno.h>
#include <netinet/in.h>
#include <network/net.h>
#include <sys/socket.h>
#include <utils/TCPServer.hpp>
#define WIIU_CP_TCP_HANDSHAKE WIIU_CP_TCP_HANDSHAKE_VERSION_3
@ -98,7 +98,6 @@ private:
virtual void onConnectionClosed();
static CPTCPServer *instance;
};
#endif //_TCPSERVER_WINDOW_H_

View File

@ -18,8 +18,8 @@
#define _UDPCLIENT_WINDOW_H_
#include "../ControllerPatcherIncludes.hpp"
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/socket.h>
#define DEFAULT_UDP_CLIENT_PORT 8114
@ -27,8 +27,8 @@ class UDPClient {
friend class ControllerPatcher;
friend class ControllerPatcherHID;
friend class CPTCPServer;
public:
public:
private:
static UDPClient *getInstance() {
if (instance == NULL) {

View File

@ -60,8 +60,6 @@ UDPServer::~UDPServer() {
if (HID_DEBUG) {
DEBUG_FUNCTION_LINE("Thread has been closed");
}
}
void UDPServer::StartUDPThread(UDPServer *server) {

View File

@ -5,7 +5,6 @@
static volatile int socket_lock __attribute__((section(".data"))) = 0;
void initNetwork() {
}
int32_t recvwait(int32_t sock, void *buffer, int32_t len) {

View File

@ -360,7 +360,6 @@ void ControllerPatcherHID::HIDReadCallback(uint32_t handle, unsigned char *buf,
data_ptr = &(gHID_Devices[gHID_SLOT_GC].pad_data[i]);
memcpy(&(data_ptr->data_union.controller.last_hid_data[0]), &(data_ptr->data_union.controller.cur_hid_data[0]), 10); //save last data.
memcpy(&(data_ptr->data_union.controller.cur_hid_data[0]), &buf[(i * 9) + 1], 9); //save new data.
}
/*
@ -676,16 +675,54 @@ void ControllerPatcherHID::HIDRumble(uint32_t handle,my_cb_user *usr,uint32_t pa
}
static uint8_t ds3_rumble_Report[48] = {
0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0x27, 0x10, 0x00, 0x32,
0xFF, 0x27, 0x10, 0x00, 0x32,
0xFF, 0x27, 0x10, 0x00, 0x32,
0xFF, 0x27, 0x10, 0x00, 0x32,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00,
0xFF,
0x00,
0xFF,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0xFF,
0x27,
0x10,
0x00,
0x32,
0xFF,
0x27,
0x10,
0x00,
0x32,
0xFF,
0x27,
0x10,
0x00,
0x32,
0xFF,
0x27,
0x10,
0x00,
0x32,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
};
void ControllerPatcherHID::HIDDS3Rumble(uint32_t handle, my_cb_user *usr, int32_t rumble) {

View File

@ -43,6 +43,7 @@
class ControllerPatcherHID {
friend class ControllerPatcher;
friend class ControllerPatcherUtils;
public:
static int32_t externAttachDetachCallback(HIDDevice *p_device, HIDAttachEvent attach);
static void externHIDReadCallback(uint32_t handle, unsigned char *buf, uint32_t bytes_transfered, my_cb_user *usr);

View File

@ -636,7 +636,6 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(H
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;
}

View File

@ -77,6 +77,7 @@ public:
*
*/
static CONTROLLER_PATCHER_RESULT_OR_ERROR translateToVPAD(VPADStatus *vpad_buffer, KPADStatus *pro_buffer, uint32_t *lastButtonsPressesVPAD);
private:
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
* Analyse inputs

View File

@ -18,10 +18,10 @@
#define CTHREAD_H_
#include <malloc.h>
#include <unistd.h>
#include <coreinit/systeminfo.h>
#include <coreinit/thread.h>
#include <malloc.h>
#include <unistd.h>
class CThread {
public:
@ -29,10 +29,7 @@ public:
//! constructor
CThread(int32_t iAttr, int32_t iPriority = 16, int32_t iStackSize = 0x8000, CThread::Callback callback = NULL, void *callbackArg = NULL)
: pThread(NULL)
, pThreadStack(NULL)
, pCallback(callback)
, pCallbackArg(callbackArg) {
: pThread(NULL), pThreadStack(NULL), pCallback(callback), pCallbackArg(callbackArg) {
//! save attribute assignment
iAttributes = iAttr;
//! allocate the thread
@ -117,6 +114,7 @@ public:
eAttributeDetach = 0x08,
eAttributePinnedAff = 0x10
};
private:
static int threadCallback(int argc, const char **argv) {
//! After call to start() continue with the internal function

View File

@ -72,5 +72,4 @@ uint32_t gUDPClientip __attribute__((section(".data"))) = 0;
ControllerMappingPADInfo *gProPadInfo[4] __attribute__((section(".data"))) = {&gControllerMapping.proController[0].pad_infos[0],
&gControllerMapping.proController[1].pad_infos[0],
&gControllerMapping.proController[2].pad_infos[0],
&gControllerMapping.proController[3].pad_infos[0]
} ;
&gControllerMapping.proController[3].pad_infos[0]};

View File

@ -63,8 +63,7 @@ const uint8_t HID_GC_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGI
0x09, //STICK_CONF_DEADZONE,
0x00, //STICK_CONF_INVERT,
0x1A, //STICK_CONF_MIN,
0xE4
};//STICK_CONF_MAX,
0xE4}; //STICK_CONF_MAX,
const uint8_t HID_GC_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = {STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
0x04, //STICK_CONF_BYTE,
@ -72,8 +71,7 @@ const uint8_t HID_GC_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGI
0x09, //STICK_CONF_DEADZONE,
0x00, //STICK_CONF_INVERT,
0x11, //STICK_CONF_MIN,
0xE1
};//STICK_CONF_MAX,
0xE1}; //STICK_CONF_MAX,
const uint8_t HID_GC_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = {STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
0x05, //STICK_CONF_BYTE,
@ -81,8 +79,7 @@ const uint8_t HID_GC_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGI
0x09, //STICK_CONF_DEADZONE,
0x00, //STICK_CONF_INVERT,
0x2B, //STICK_CONF_MIN,
0xE2
};//STICK_CONF_MAX,
0xE2}; //STICK_CONF_MAX,
const uint8_t HID_GC_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = {STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
0x06, //STICK_CONF_BYTE,
@ -90,8 +87,7 @@ const uint8_t HID_GC_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGI
0x09, //STICK_CONF_DEADZONE,
0x00, //STICK_CONF_INVERT,
0x1D, //STICK_CONF_MIN,
0xDB
};//STICK_CONF_MAX,
0xDB}; //STICK_CONF_MAX,
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! DS3
@ -126,8 +122,7 @@ const uint8_t HID_DS3_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGI
0x06, //STICK_CONF_DEADZONE,
0x00, //STICK_CONF_INVERT,
0x00, //STICK_CONF_MIN,
0xFF
};//STICK_CONF_MAX,
0xFF}; //STICK_CONF_MAX,
const uint8_t HID_DS3_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = {STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
0x07, //STICK_CONF_BYTE,
@ -135,8 +130,7 @@ const uint8_t HID_DS3_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGI
0x06, //STICK_CONF_DEADZONE,
0x01, //STICK_CONF_INVERT,
0x00, //STICK_CONF_MIN,
0xFF
};//STICK_CONF_MAX,
0xFF}; //STICK_CONF_MAX,
const uint8_t HID_DS3_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = {STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
0x08, //STICK_CONF_BYTE,
@ -144,8 +138,7 @@ const uint8_t HID_DS3_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGI
0x06, //STICK_CONF_DEADZONE,
0x00, //STICK_CONF_INVERT,
0x00, //STICK_CONF_MIN,
0xFF
};//STICK_CONF_MAX,
0xFF}; //STICK_CONF_MAX,
const uint8_t HID_DS3_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = {STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
0x09, //STICK_CONF_BYTE,
@ -153,8 +146,7 @@ const uint8_t HID_DS3_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGI
0x06, //STICK_CONF_DEADZONE,
0x01, //STICK_CONF_INVERT,
0x00, //STICK_CONF_MIN,
0xFF
};//STICK_CONF_MAX,
0xFF}; //STICK_CONF_MAX,
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! DS4
@ -197,8 +189,7 @@ const uint8_t HID_DS4_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGI
0x06, //STICK_CONF_DEADZONE,
0x00, //STICK_CONF_INVERT,
0x00, //STICK_CONF_MIN,
0xFF
};//STICK_CONF_MAX,
0xFF}; //STICK_CONF_MAX,
const uint8_t HID_DS4_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = {STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
0x02, //STICK_CONF_BYTE,
@ -206,8 +197,7 @@ const uint8_t HID_DS4_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGI
0x05, //STICK_CONF_DEADZONE,
0x01, //STICK_CONF_INVERT,
0x00, //STICK_CONF_MIN,
0xFF
};//STICK_CONF_MAX,
0xFF}; //STICK_CONF_MAX,
const uint8_t HID_DS4_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = {STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
0x03, //STICK_CONF_BYTE,
@ -215,8 +205,7 @@ const uint8_t HID_DS4_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGI
0x07, //STICK_CONF_DEADZONE,
0x00, //STICK_CONF_INVERT,
0x00, //STICK_CONF_MIN,
0xFF
};//STICK_CONF_MAX,
0xFF}; //STICK_CONF_MAX,
const uint8_t HID_DS4_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = {STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
0x04, //STICK_CONF_BYTE,
@ -224,8 +213,7 @@ const uint8_t HID_DS4_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGI
0x09, //STICK_CONF_DEADZONE,
0x01, //STICK_CONF_INVERT,
0x00, //STICK_CONF_MIN,
0xFF
};//STICK_CONF_MAX,
0xFF}; //STICK_CONF_MAX,
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! XInput
@ -260,8 +248,7 @@ const uint8_t HID_XINPUT_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_M
0x10, //STICK_CONF_DEADZONE,
0x00, //STICK_CONF_INVERT,
0x00, //STICK_CONF_MIN,
0xFF
};//STICK_CONF_MAX,
0xFF}; //STICK_CONF_MAX,
const uint8_t HID_XINPUT_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = {STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
0x01, //STICK_CONF_BYTE,
@ -269,8 +256,7 @@ const uint8_t HID_XINPUT_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_M
0x10, //STICK_CONF_DEADZONE,
0x00, //STICK_CONF_INVERT,
0x00, //STICK_CONF_MIN,
0xFF
};//STICK_CONF_MAX,
0xFF}; //STICK_CONF_MAX,
const uint8_t HID_XINPUT_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = {STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
0x02, //STICK_CONF_BYTE,
@ -278,8 +264,7 @@ const uint8_t HID_XINPUT_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_M
0x10, //STICK_CONF_DEADZONE,
0x00, //STICK_CONF_INVERT,
0x00, //STICK_CONF_MIN,
0xFF
};//STICK_CONF_MAX,
0xFF}; //STICK_CONF_MAX,
const uint8_t HID_XINPUT_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = {STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION
0x03, //STICK_CONF_BYTE,
@ -287,9 +272,7 @@ const uint8_t HID_XINPUT_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_M
0x10, //STICK_CONF_DEADZONE,
0x00, //STICK_CONF_INVERT,
0x00, //STICK_CONF_MIN,
0xFF
};//STICK_CONF_MAX,
0xFF}; //STICK_CONF_MAX,
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -331,8 +314,7 @@ const uint8_t HID_SWITCH_PRO_BT_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK
0x01, //STICK_CONF_DEADZONE,
0x00, //STICK_CONF_INVERT,
0x28, //STICK_CONF_MIN,
0xDF
};//STICK_CONF_MAX,
0xDF}; //STICK_CONF_MAX,
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,
@ -340,8 +322,7 @@ const uint8_t HID_SWITCH_PRO_BT_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK
0x06, //STICK_CONF_DEADZONE,
0x01, //STICK_CONF_INVERT,
0x16, //STICK_CONF_MIN,
0xD7
};//STICK_CONF_MAX,
0xD7}; //STICK_CONF_MAX,
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,
@ -349,8 +330,7 @@ const uint8_t HID_SWITCH_PRO_BT_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK
0x04, //STICK_CONF_DEADZONE,
0x00, //STICK_CONF_INVERT,
0x29, //STICK_CONF_MIN,
0xE2
};//STICK_CONF_MAX,
0xE2}; //STICK_CONF_MAX,
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,
@ -358,5 +338,4 @@ const uint8_t HID_SWITCH_PRO_BT_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK
0x08, //STICK_CONF_DEADZONE,
0x01, //STICK_CONF_INVERT,
0x22, //STICK_CONF_MIN,
0xE4
};//STICK_CONF_MAX,
0xE4}; //STICK_CONF_MAX,

View File

@ -19,8 +19,8 @@
#define _PAD_CONST_H_
#include <string>
#include <controller_patcher/ControllerPatcherDefs.h>
#include <string>
extern const uint8_t DEF_R_STICK;
extern const uint8_t DEF_L_STICK;

View File

@ -23,17 +23,16 @@
*
* for WiiXplorer 2010
***************************************************************************/
#include <vector>
#include <string>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <string.h>
#include <string>
#include <strings.h>
#include <wut_types.h>
#include <stdio.h>
#include <utils/StringTools.h>
#include <vector>
#include <wchar.h>
#include <wut_types.h>
BOOL StringTools::EndsWith(const std::string &a, const std::string &b) {

View File

@ -26,8 +26,8 @@
#ifndef __STRING_TOOLS_H
#define __STRING_TOOLS_H
#include <vector>
#include <string>
#include <vector>
#include <wut_types.h>
class StringTools {
@ -49,8 +49,7 @@ class StringTools{
const char *ptr = path;
const char *Filename = ptr;
while(*ptr != '\0')
{
while (*ptr != '\0') {
if (ptr[0] == '/' && ptr[1] != '\0')
Filename = ptr + 1;
@ -64,10 +63,8 @@ class StringTools{
uint32_t length = str.size();
//! clear path of double slashes
for(uint32_t i = 1; i < length; ++i)
{
if(str[i-1] == '/' && str[i] == '/')
{
for (uint32_t i = 1; i < length; ++i) {
if (str[i - 1] == '/' && str[i] == '/') {
str.erase(i, 1);
i--;
length--;

View File

@ -1,10 +1,10 @@
#include <utils/TCPServer.hpp>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <utils/TCPServer.hpp>
#include <utils/logger.h>
#include <network/net.h>
#include <utils/logger.h>
#define wiiu_errno (*__gh_errno_ptr())

View File

@ -1,14 +1,14 @@
#ifndef _TCPSERVER_H_
#define _TCPSERVER_H_
#include <netinet/in.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <system/CThread.h>
#include <wut_types.h>
#include <coreinit/cache.h>
#include "utils/logger.h"
#include <coreinit/cache.h>
class TCPServer {
public:
@ -18,6 +18,7 @@ public:
BOOL isConnected() {
return connected;
}
protected:
BOOL shouldExit() {
return (exitThread == 1);
@ -40,6 +41,7 @@ protected:
struct sockaddr_in getSockAddr() {
return sock_addr;
}
private:
virtual void CloseSockets();
virtual void ErrorHandling();

View File

@ -15,11 +15,13 @@ extern "C" {
#define log_print(str) WHBLogPrint(str)
#define log_printf(FMT, ARGS...) WHBLogPrintf(FMT, ##ARGS);
#define DEBUG_FUNCTION_LINE(FMT, ARGS...)do { \
#define DEBUG_FUNCTION_LINE(FMT, ARGS...) \
do { \
WHBLogPrintf("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
} while (0);
#define DEBUG_FUNCTION_LINE_WRITE(FMT, ARGS...)do { \
#define DEBUG_FUNCTION_LINE_WRITE(FMT, ARGS...) \
do { \
WHBLogWritef("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
} while (0);