mirror of
https://github.com/Maschell/hid_to_vpad.git
synced 2025-01-09 03:20:43 +01:00
clang format
This commit is contained in:
parent
b7143f814e
commit
3d19f8dff6
67
.clang-format
Normal file
67
.clang-format
Normal 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
|
49
.github/workflows/ci.yml
vendored
49
.github/workflows/ci.yml
vendored
@ -6,10 +6,25 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-binary:
|
clang-format:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
- name: clang-format
|
||||||
|
run: |
|
||||||
|
docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./src
|
||||||
|
build-binary:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
needs: clang-format
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: create version.h
|
||||||
|
run: |
|
||||||
|
git_hash=$(git rev-parse --short "$GITHUB_SHA")
|
||||||
|
cat <<EOF > ./src/version.h
|
||||||
|
#pragma once
|
||||||
|
#define VERSION_EXTRA " (nightly-$git_hash)"
|
||||||
|
EOF
|
||||||
- name: build binary
|
- name: build binary
|
||||||
run: |
|
run: |
|
||||||
docker build . -t builder
|
docker build . -t builder
|
||||||
@ -20,7 +35,7 @@ jobs:
|
|||||||
path: "*.wps"
|
path: "*.wps"
|
||||||
deploy-binary:
|
deploy-binary:
|
||||||
needs: build-binary
|
needs: build-binary
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- name: Get environment variables
|
- name: Get environment variables
|
||||||
id: get_repository_name
|
id: get_repository_name
|
||||||
@ -30,29 +45,15 @@ jobs:
|
|||||||
- uses: actions/download-artifact@master
|
- uses: actions/download-artifact@master
|
||||||
with:
|
with:
|
||||||
name: binary
|
name: binary
|
||||||
path: wiiu/plugins
|
|
||||||
- name: zip artifact
|
- name: zip artifact
|
||||||
run: zip -r ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip wiiu
|
run: zip -r ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip *.wps
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
id: create_release
|
uses: "softprops/action-gh-release@v1"
|
||||||
uses: actions/create-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }}
|
tag_name: ${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }}
|
||||||
release_name: Nightly-${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }}
|
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: true
|
prerelease: true
|
||||||
body: |
|
generate_release_notes: true
|
||||||
Not a stable release:
|
name: Nightly-${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }}
|
||||||
${{ github.event.head_commit.message }}
|
files: |
|
||||||
- name: Upload Release Asset
|
./${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip
|
||||||
id: upload-release-asset
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
|
||||||
asset_path: ./${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip
|
|
||||||
asset_name: ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip
|
|
||||||
asset_content_type: application/unknown
|
|
32
.github/workflows/pr.yml
vendored
32
.github/workflows/pr.yml
vendored
@ -3,10 +3,36 @@ name: CI-PR
|
|||||||
on: [pull_request]
|
on: [pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-binary:
|
clang-format:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
- name: clang-format
|
||||||
|
run: |
|
||||||
|
docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./src
|
||||||
|
check-build-with-logging:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
needs: clang-format
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: build binary with logging
|
||||||
|
run: |
|
||||||
|
docker build . -t builder
|
||||||
|
docker run --rm -v ${PWD}:/project builder make DEBUG=VERBOSE
|
||||||
|
docker run --rm -v ${PWD}:/project builder make clean
|
||||||
|
docker run --rm -v ${PWD}:/project builder make DEBUG=1
|
||||||
|
build-binary:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
needs: clang-format
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: create version.h
|
||||||
|
run: |
|
||||||
|
git_hash=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}")
|
||||||
|
cat <<EOF > ./src/version.h
|
||||||
|
#pragma once
|
||||||
|
#define VERSION_EXTRA " (nightly-$git_hash)"
|
||||||
|
EOF
|
||||||
- name: build binary
|
- name: build binary
|
||||||
run: |
|
run: |
|
||||||
docker build . -t builder
|
docker build . -t builder
|
||||||
|
@ -15,13 +15,13 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "WUPSConfigItemPadMapping.h"
|
||||||
|
#include "utils/StringTools.h"
|
||||||
|
#include "utils/logger.h"
|
||||||
|
#include <controller_patcher/ControllerPatcher.hpp>
|
||||||
#include <wups.h>
|
#include <wups.h>
|
||||||
#include <wups/config.h>
|
#include <wups/config.h>
|
||||||
#include <wups/config/WUPSConfigItemBoolean.h>
|
#include <wups/config/WUPSConfigItemBoolean.h>
|
||||||
#include <controller_patcher/ControllerPatcher.hpp>
|
|
||||||
#include "utils/logger.h"
|
|
||||||
#include "utils/StringTools.h"
|
|
||||||
#include "WUPSConfigItemPadMapping.h"
|
|
||||||
|
|
||||||
bool runNetworkClient = true;
|
bool runNetworkClient = true;
|
||||||
|
|
||||||
|
@ -158,7 +158,6 @@ DECL_FUNCTION(void,WPADRead,WPADChan chan, WPADStatusProController *data ) {
|
|||||||
ControllerPatcher::setProControllerDataFromHID((void *) data, chan, PRO_CONTROLLER_MODE_WPADReadData);
|
ControllerPatcher::setProControllerDataFromHID((void *) data, chan, PRO_CONTROLLER_MODE_WPADReadData);
|
||||||
} else {
|
} else {
|
||||||
real_WPADRead(chan, data);
|
real_WPADRead(chan, data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,13 +17,13 @@
|
|||||||
|
|
||||||
#include "WUPSConfigItemPadMapping.h"
|
#include "WUPSConfigItemPadMapping.h"
|
||||||
#include <controller_patcher/ControllerPatcher.hpp>
|
#include <controller_patcher/ControllerPatcher.hpp>
|
||||||
#include <vector>
|
#include <padscore/wpad.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <utils/logger.h>
|
|
||||||
#include <vpad/input.h>
|
|
||||||
#include <padscore/wpad.h>
|
|
||||||
#include <utils/StringTools.h>
|
#include <utils/StringTools.h>
|
||||||
|
#include <utils/logger.h>
|
||||||
|
#include <vector>
|
||||||
|
#include <vpad/input.h>
|
||||||
|
|
||||||
// At this point the VPADRead function is already patched. But we want to use the original function (note: this could be patched by a different plugin)
|
// At this point the VPADRead function is already patched. But we want to use the original function (note: this could be patched by a different plugin)
|
||||||
typedef int32_t (*VPADReadFunction)(VPADChan chan, VPADStatus *buffer, uint32_t buffer_size, VPADReadError *error);
|
typedef int32_t (*VPADReadFunction)(VPADChan chan, VPADStatus *buffer, uint32_t buffer_size, VPADReadError *error);
|
||||||
@ -190,8 +190,7 @@ extern "C" bool WUPSConfigItemPadMapping_AddToCategory(WUPSConfigCategoryHandle
|
|||||||
.isMovementAllowed = &WUPSConfigItemPadMapping_isMovementAllowed,
|
.isMovementAllowed = &WUPSConfigItemPadMapping_isMovementAllowed,
|
||||||
.callCallback = nullptr,
|
.callCallback = nullptr,
|
||||||
.onButtonPressed = &WUPSConfigItemPadMapping_onButtonPressed,
|
.onButtonPressed = &WUPSConfigItemPadMapping_onButtonPressed,
|
||||||
.onDelete = &WUPSConfigItemPadMapping_onDelete
|
.onDelete = &WUPSConfigItemPadMapping_onDelete};
|
||||||
};
|
|
||||||
|
|
||||||
if (WUPSConfigItem_Create(&item->handle, configID, displayName, callbacks, item) < 0) {
|
if (WUPSConfigItem_Create(&item->handle, configID, displayName, callbacks, item) < 0) {
|
||||||
free(item);
|
free(item);
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <wups.h>
|
|
||||||
#include <controller_patcher/ControllerPatcher.hpp>
|
#include <controller_patcher/ControllerPatcher.hpp>
|
||||||
|
#include <wups.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
#include <wups.h>
|
#include <wups.h>
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <controller_patcher/ControllerPatcher.hpp>
|
#include <controller_patcher/ControllerPatcher.hpp>
|
||||||
|
#include <cstring>
|
||||||
#include <utils/logger.h>
|
#include <utils/logger.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,17 +23,16 @@
|
|||||||
*
|
*
|
||||||
* for WiiXplorer 2010
|
* for WiiXplorer 2010
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <string.h>
|
||||||
#include <wchar.h>
|
#include <string>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <wut_types.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <utils/StringTools.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) {
|
BOOL StringTools::EndsWith(const std::string &a, const std::string &b) {
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
#ifndef __STRING_TOOLS_H
|
#ifndef __STRING_TOOLS_H
|
||||||
#define __STRING_TOOLS_H
|
#define __STRING_TOOLS_H
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
#include <wut_types.h>
|
#include <wut_types.h>
|
||||||
|
|
||||||
class StringTools {
|
class StringTools {
|
||||||
@ -49,8 +49,7 @@ class StringTools{
|
|||||||
const char *ptr = path;
|
const char *ptr = path;
|
||||||
const char *Filename = ptr;
|
const char *Filename = ptr;
|
||||||
|
|
||||||
while(*ptr != '\0')
|
while (*ptr != '\0') {
|
||||||
{
|
|
||||||
if (ptr[0] == '/' && ptr[1] != '\0')
|
if (ptr[0] == '/' && ptr[1] != '\0')
|
||||||
Filename = ptr + 1;
|
Filename = ptr + 1;
|
||||||
|
|
||||||
@ -64,10 +63,8 @@ class StringTools{
|
|||||||
uint32_t length = str.size();
|
uint32_t length = str.size();
|
||||||
|
|
||||||
//! clear path of double slashes
|
//! clear path of double slashes
|
||||||
for(uint32_t i = 1; i < length; ++i)
|
for (uint32_t i = 1; i < length; ++i) {
|
||||||
{
|
if (str[i - 1] == '/' && str[i] == '/') {
|
||||||
if(str[i-1] == '/' && str[i] == '/')
|
|
||||||
{
|
|
||||||
str.erase(i, 1);
|
str.erase(i, 1);
|
||||||
i--;
|
i--;
|
||||||
length--;
|
length--;
|
||||||
|
@ -11,11 +11,13 @@ extern "C" {
|
|||||||
#define __FILENAME_X__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
|
#define __FILENAME_X__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
|
||||||
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILENAME_X__)
|
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILENAME_X__)
|
||||||
|
|
||||||
#define DEBUG_FUNCTION_LINE(FMT, ARGS...)do { \
|
#define DEBUG_FUNCTION_LINE(FMT, ARGS...) \
|
||||||
|
do { \
|
||||||
WHBLogPrintf("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
|
WHBLogPrintf("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
|
||||||
} while (0);
|
} 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); \
|
WHBLogWritef("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user