Add clang-format for formatting, check building the example in CI
This commit is contained in:
parent
9d41a89c45
commit
d3cf0691ef
|
@ -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
|
|
@ -0,0 +1,46 @@
|
|||
name: CI-PR
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
clang-format-lib:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: clang-format
|
||||
run: |
|
||||
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./include ./libraries
|
||||
build-lib:
|
||||
runs-on: ubuntu-18.04
|
||||
needs: clang-format-lib
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: build binary
|
||||
run: |
|
||||
docker build . -f Dockerfile.buildlocal -t builder
|
||||
docker run --rm -v ${PWD}:/project builder make
|
||||
- uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: binary
|
||||
path: "/lib/*.a"
|
||||
clang-format-examples:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: clang-format
|
||||
run: |
|
||||
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./plugins/example_plugin/src
|
||||
build-examples:
|
||||
runs-on: ubuntu-18.04
|
||||
needs: clang-format-examples
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: build binary
|
||||
run: |
|
||||
docker build . -f Dockerfile.buildexamples -t builder
|
||||
cd ./plugins/example_plugin
|
||||
docker run --rm -v ${PWD}:/project builder make
|
||||
- uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: binary
|
||||
path: "*.wps"
|
|
@ -4,8 +4,33 @@ on:
|
|||
branches:
|
||||
- master
|
||||
jobs:
|
||||
build:
|
||||
clang-format-lib:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: clang-format
|
||||
run: |
|
||||
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./include ./libraries
|
||||
clang-format-examples:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: clang-format
|
||||
run: |
|
||||
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./plugins/example_plugin/src
|
||||
build-examples:
|
||||
runs-on: ubuntu-18.04
|
||||
needs: clang-format-examples
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: build binary
|
||||
run: |
|
||||
docker build . -f Dockerfile.buildexamples -t builder
|
||||
cd ./plugins/example_plugin
|
||||
docker run --rm -v ${PWD}:/project builder make
|
||||
push_image:
|
||||
runs-on: ubuntu-latest
|
||||
needs: clang-format-lib
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: Get release version
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM wiiuenv/devkitppc:20210920
|
||||
FROM wiiuenv/devkitppc:20211229
|
||||
|
||||
WORKDIR tmp_build
|
||||
COPY . .
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
FROM wiiuenv/devkitppc:20211229
|
||||
|
||||
WORKDIR tmp_build
|
||||
COPY . .
|
||||
RUN make clean && make && mkdir -p /artifacts/wups && cp -r lib /artifacts/wups && cp -r include /artifacts/wups && cp -r share /artifacts/wups
|
||||
WORKDIR /artifacts
|
||||
|
||||
FROM scratch as libwups
|
||||
COPY --from=0 /artifacts /artifacts
|
||||
|
||||
FROM wiiuenv/devkitppc:20211229
|
||||
|
||||
COPY --from=libwups /artifacts $DEVKITPRO
|
||||
|
||||
WORKDIR project
|
|
@ -0,0 +1,3 @@
|
|||
FROM wiiuenv/devkitppc:20211229
|
||||
|
||||
WORKDIR project
|
|
@ -56,6 +56,10 @@ This has been created by @dimok789 and can be found in the tools folder.
|
|||
# Future and contribution
|
||||
On the Discord you can more information about open tasks and how to contribute: https://discord.gg/bZ2rep2
|
||||
|
||||
## Format the code via docker
|
||||
|
||||
`docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./include ./libraries ./plugins/example_plugin/src -i`
|
||||
|
||||
# Credits
|
||||
Some files are based on brainslug by Chadderz:
|
||||
https://github.com/Chadderz121/brainslug-wii
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "wups/common.h"
|
||||
#include "wups/meta.h"
|
||||
#include "wups/function_patching.h"
|
||||
#include "wups/config.h"
|
||||
#include "wups/hooks.h"
|
||||
#include "wups/config_imports.h"
|
||||
#include "wups/function_patching.h"
|
||||
#include "wups/hooks.h"
|
||||
#include "wups/meta.h"
|
||||
#include "wups/storage.h"
|
||||
|
|
|
@ -25,14 +25,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -15,8 +15,7 @@ typedef struct ConfigItemIntegerRange {
|
|||
|
||||
typedef void (*IntegerRangeValueChangedCallback)(ConfigItemIntegerRange *, int32_t);
|
||||
|
||||
bool
|
||||
WUPSConfigItemIntegerRange_AddToCategory(WUPSConfigCategoryHandle cat, const char *configID, const char *displayName,
|
||||
bool WUPSConfigItemIntegerRange_AddToCategory(WUPSConfigCategoryHandle cat, const char *configID, const char *displayName,
|
||||
int32_t defaultValue, int32_t minValue, int32_t maxValue,
|
||||
IntegerRangeValueChangedCallback callback);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "stdint.h"
|
||||
#include "config.h"
|
||||
#include "stdint.h"
|
||||
|
||||
extern "C" int32_t WUPSConfigItem_Create(WUPSConfigItemHandle *out, const char *configID, const char *displayName, WUPSConfigCallbacks_t callbacks, void *context);
|
||||
|
||||
|
|
|
@ -160,9 +160,7 @@ typedef struct wups_loader_entry_t {
|
|||
.my_function_name = #replace_func, \
|
||||
.target = (const void *) &(replace_func), \
|
||||
.call_addr = (const void *) &(original_func), \
|
||||
.targetProcess = process\
|
||||
} \
|
||||
}
|
||||
.targetProcess = process}}
|
||||
|
||||
#define DECL_FUNCTION(res, name, ...) \
|
||||
res (*real_##name)(__VA_ARGS__) __attribute__((section(".data"))); \
|
||||
|
|
|
@ -27,8 +27,7 @@ extern "C" {
|
|||
extern const wups_loader_hook_t wups_hooks_##original_func WUPS_SECTION("hooks"); \
|
||||
const wups_loader_hook_t wups_hooks_##original_func = { \
|
||||
.type = type_def, \
|
||||
.target = (const void*)&(original_func) \
|
||||
}
|
||||
.target = (const void *) &(original_func)}
|
||||
|
||||
typedef enum wups_loader_hook_type_t {
|
||||
WUPS_LOADER_HOOK_INIT_WUT_MALLOC,
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WUPS_PLUGIN_NAME(x) WUPS_META(name, x); \
|
||||
#define WUPS_PLUGIN_NAME(x) \
|
||||
WUPS_META(name, x); \
|
||||
WUPS_META(wups, "0.7.0"); \
|
||||
WUPS_USE_WUT_MALLOC(); \
|
||||
WUPS_USE_WUT_SOCKETS(); \
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <wups.h>
|
||||
#include "wups/config/WUPSConfigItemBoolean.h"
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include "wups/config/WUPSConfigItemBoolean.h"
|
||||
#include <wups.h>
|
||||
|
||||
void WUPSConfigItemBoolean_onDelete(void *context);
|
||||
|
||||
|
@ -82,8 +82,7 @@ WUPSConfigItemBoolean_AddToCategoryEx(WUPSConfigCategoryHandle cat, const char *
|
|||
.isMovementAllowed = &WUPSConfigItemBoolean_isMovementAllowed,
|
||||
.callCallback = &WUPSConfigItemBoolean_callCallback,
|
||||
.onButtonPressed = &WUPSConfigItemBoolean_onButtonPressed,
|
||||
.onDelete = &WUPSConfigItemBoolean_onDelete
|
||||
};
|
||||
.onDelete = &WUPSConfigItemBoolean_onDelete};
|
||||
|
||||
if (WUPSConfigItem_Create(&item->handle, configID, displayName, callbacks, item) < 0) {
|
||||
free(item);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <wups.h>
|
||||
#include "wups/config/WUPSConfigItemIntegerRange.h"
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include "wups/config/WUPSConfigItemIntegerRange.h"
|
||||
#include <wups.h>
|
||||
|
||||
int32_t WUPSConfigItemIntegerRange_getCurrentValueDisplay(void *context, char *out_buf, int32_t out_size) {
|
||||
auto *item = (ConfigItemIntegerRange *) context;
|
||||
|
@ -64,7 +64,6 @@ void WUPSConfigItemIntegerRange_onDelete(void *context) {
|
|||
}
|
||||
|
||||
void WUPSConfigItemIntegerRange_onSelected(void *context, bool isSelected) {
|
||||
|
||||
}
|
||||
|
||||
extern "C" bool WUPSConfigItemIntegerRange_AddToCategory(WUPSConfigCategoryHandle cat, const char *configID, const char *displayName, int32_t defaultValue, int32_t minValue, int32_t maxValue,
|
||||
|
@ -91,8 +90,7 @@ extern "C" bool WUPSConfigItemIntegerRange_AddToCategory(WUPSConfigCategoryHandl
|
|||
.isMovementAllowed = &WUPSConfigItemIntegerRange_isMovementAllowed,
|
||||
.callCallback = &WUPSConfigItemIntegerRange_callCallback,
|
||||
.onButtonPressed = &WUPSConfigItemIntegerRange_onButtonPressed,
|
||||
.onDelete = &WUPSConfigItemIntegerRange_onDelete
|
||||
};
|
||||
.onDelete = &WUPSConfigItemIntegerRange_onDelete};
|
||||
|
||||
if (WUPSConfigItem_Create(&(item->handle), configID, displayName, callbacks, item) < 0) {
|
||||
free(item);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <wups.h>
|
||||
#include "wups/config/WUPSConfigItemMultipleValues.h"
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include "wups/config/WUPSConfigItemMultipleValues.h"
|
||||
#include <wups.h>
|
||||
|
||||
void WUPSConfigItemMultipleValues_onDelete(void *context);
|
||||
|
||||
|
@ -119,8 +119,7 @@ WUPSConfigItemMultipleValues_AddToCategory(WUPSConfigCategoryHandle cat, const c
|
|||
.isMovementAllowed = &WUPSConfigItemMultipleValues_isMovementAllowed,
|
||||
.callCallback = &WUPSConfigItemMultipleValues_callCallback,
|
||||
.onButtonPressed = &WUPSConfigItemMultipleValues_onButtonPressed,
|
||||
.onDelete = &WUPSConfigItemMultipleValues_onDelete
|
||||
};
|
||||
.onDelete = &WUPSConfigItemMultipleValues_onDelete};
|
||||
|
||||
if (WUPSConfigItem_Create(&item->handle, configID, displayName, callbacks, item) < 0) {
|
||||
free(item);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <wups.h>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <wups.h>
|
||||
|
||||
#include "utils/base64.h"
|
||||
|
||||
|
|
|
@ -77,8 +77,7 @@ size_t b64_decoded_size(const char *in) {
|
|||
static const int b64invs[] = {
|
||||
62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3,
|
||||
4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
|
||||
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51
|
||||
};
|
||||
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51};
|
||||
|
||||
static int b64_isvalidchar(char c) {
|
||||
if (c >= '0' && c <= '9')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// based on https://nachtimwald.com/2017/11/18/base64-encode-and-decode-in-c/
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#include <wups.h>
|
||||
#include <whb/libmanager.h>
|
||||
#include <coreinit/filesystem.h>
|
||||
#include <coreinit/thread.h>
|
||||
#include <coreinit/time.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include <utils/logger.h>
|
||||
#include <coreinit/time.h>
|
||||
#include <coreinit/thread.h>
|
||||
#include <coreinit/filesystem.h>
|
||||
#include <whb/libmanager.h>
|
||||
#include <whb/log_cafe.h>
|
||||
#include <whb/log_module.h>
|
||||
#include <whb/log_udp.h>
|
||||
#include <wups.h>
|
||||
#include <wups/config/WUPSConfigItemBoolean.h>
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,15 +10,18 @@ extern "C" {
|
|||
#define __FILENAME_X__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
|
||||
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILENAME_X__)
|
||||
|
||||
#define OSFATAL_FUNCTION_LINE(FMT, ARGS...)do { \
|
||||
#define OSFATAL_FUNCTION_LINE(FMT, ARGS...) \
|
||||
do { \
|
||||
OSFatal_printf("[%s]%s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
|
||||
} while (0)
|
||||
|
||||
#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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue