mirror of
https://github.com/wiiu-env/libfunctionpatcher.git
synced 2024-11-30 05:14:15 +01:00
Format via clang_format
This commit is contained in:
parent
89c25abbb2
commit
076134a77c
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
|
25
.github/workflows/pr.yml
vendored
Normal file
25
.github/workflows/pr.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
name: CI-PR
|
||||||
|
|
||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
clang-format:
|
||||||
|
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 ./source ./include
|
||||||
|
build-binary:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
needs: clang-format
|
||||||
|
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"
|
8
.github/workflows/push_image.yml
vendored
8
.github/workflows/push_image.yml
vendored
@ -4,8 +4,16 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
jobs:
|
jobs:
|
||||||
|
clang-format:
|
||||||
|
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 ./source ./include
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: clang-format
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- name: Get release version
|
- name: Get release version
|
||||||
|
3
Dockerfile.buildlocal
Normal file
3
Dockerfile.buildlocal
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
FROM wiiuenv/devkitppc:20211229
|
||||||
|
|
||||||
|
WORKDIR project
|
@ -1,3 +1,5 @@
|
|||||||
|
[![Publish Docker Image](https://github.com/wiiu-env/libfunctionpatcher/actions/workflows/push_image.yml/badge.svg)](https://github.com/wiiu-env/libfunctionpatcher/actions/workflows/push_image.yml)
|
||||||
|
|
||||||
# libfunctionpatcher
|
# libfunctionpatcher
|
||||||
Requires the [FunctionPatcherModule](https://github.com/wiiu-env/FunctionPatcherModule) to be running via [WUMSLoader](https://github.com/wiiu-env/WUMSLoader).
|
Requires the [FunctionPatcherModule](https://github.com/wiiu-env/FunctionPatcherModule) to be running via [WUMSLoader](https://github.com/wiiu-env/WUMSLoader).
|
||||||
Requires [wut](https://github.com/decaf-emu/wut) for building.
|
Requires [wut](https://github.com/decaf-emu/wut) for building.
|
||||||
@ -28,3 +30,7 @@ COPY --from=wiiuenv/libfunctionpatcher:[tag] /artifacts $DEVKITPRO
|
|||||||
```
|
```
|
||||||
Replace [tag] with a tag you want to use, a list of tags can be found [here](https://hub.docker.com/r/wiiuenv/libfunctionpatcher/tags).
|
Replace [tag] with a tag you want to use, a list of tags can be found [here](https://hub.docker.com/r/wiiuenv/libfunctionpatcher/tags).
|
||||||
It's highly recommended to pin the version to the **latest date** instead of using `latest`.
|
It's highly recommended to pin the version to the **latest date** instead of using `latest`.
|
||||||
|
|
||||||
|
## Format the code via docker
|
||||||
|
|
||||||
|
`docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source ./include -i`
|
@ -111,7 +111,7 @@ typedef struct function_replacement_data_t {
|
|||||||
function_replacement_library_type_t library; /* [needs to be filled] rpl where the function we want to replace is. */
|
function_replacement_library_type_t library; /* [needs to be filled] rpl where the function we want to replace is. */
|
||||||
char function_name[MAXIMUM_FUNCTION_NAME_LENGTH]; /* [needs to be filled] name of the function we want to replace */
|
char function_name[MAXIMUM_FUNCTION_NAME_LENGTH]; /* [needs to be filled] name of the function we want to replace */
|
||||||
uint32_t realAddr; /* [will be filled] Address of the real function we want to replace. */
|
uint32_t realAddr; /* [will be filled] Address of the real function we want to replace. */
|
||||||
volatile uint32_t replace_data [FUNCTION_PATCHER_METHOD_STORE_SIZE]; /* [will be filled] Space for us to store some jump instructions */
|
volatile uint32_t replace_data[FUNCTION_PATCHER_METHOD_STORE_SIZE]; /* [will be filled] Space for us to store some jump instructions */
|
||||||
uint32_t restoreInstruction; /* [will be filled] Copy of the instruction we replaced to jump to our code. */
|
uint32_t restoreInstruction; /* [will be filled] Copy of the instruction we replaced to jump to our code. */
|
||||||
FunctionPatcherFunctionType functionType; /* [will be filled] */
|
FunctionPatcherFunctionType functionType; /* [will be filled] */
|
||||||
uint8_t alreadyPatched; /* [will be filled] */
|
uint8_t alreadyPatched; /* [will be filled] */
|
||||||
@ -123,21 +123,21 @@ typedef struct function_replacement_data_t {
|
|||||||
REPLACE_FUNCTION_FOR_PROCESS(x, lib, function_name, FP_TARGET_PROCESS_GAME_AND_MENU)
|
REPLACE_FUNCTION_FOR_PROCESS(x, lib, function_name, FP_TARGET_PROCESS_GAME_AND_MENU)
|
||||||
|
|
||||||
#define REPLACE_FUNCTION_FOR_PROCESS(x, lib, function_name, process) \
|
#define REPLACE_FUNCTION_FOR_PROCESS(x, lib, function_name, process) \
|
||||||
REPLACE_FUNCTION_EX(x, lib, # function_name, 0, 0, process)
|
REPLACE_FUNCTION_EX(x, lib, #function_name, 0, 0, process)
|
||||||
|
|
||||||
#define REPLACE_FUNCTION_VIA_ADDRESS(x, physicalAddress, effectiveAddress) \
|
#define REPLACE_FUNCTION_VIA_ADDRESS(x, physicalAddress, effectiveAddress) \
|
||||||
REPLACE_FUNCTION_VIA_ADDRESS_FOR_PROCESS(x, physicalAddress, effectiveAddress, FP_TARGET_PROCESS_ALL)
|
REPLACE_FUNCTION_VIA_ADDRESS_FOR_PROCESS(x, physicalAddress, effectiveAddress, FP_TARGET_PROCESS_ALL)
|
||||||
|
|
||||||
#define REPLACE_FUNCTION_VIA_ADDRESS_FOR_PROCESS(x, physicalAddress, effectiveAddress, process) \
|
#define REPLACE_FUNCTION_VIA_ADDRESS_FOR_PROCESS(x, physicalAddress, effectiveAddress, process) \
|
||||||
REPLACE_FUNCTION_EX(x, LIBRARY_OTHER, # x, physicalAddress, effectiveAddress, process)
|
REPLACE_FUNCTION_EX(x, LIBRARY_OTHER, #x, physicalAddress, effectiveAddress, process)
|
||||||
|
|
||||||
#define REPLACE_FUNCTION_EX(x, lib, function_name, physicalAddress, effectiveAddress, process) \
|
#define REPLACE_FUNCTION_EX(x, lib, function_name, physicalAddress, effectiveAddress, process) \
|
||||||
{ \
|
{ \
|
||||||
FUNCTION_REPLACEMENT_DATA_STRUCT_VERSION, \
|
FUNCTION_REPLACEMENT_DATA_STRUCT_VERSION, \
|
||||||
physicalAddress, \
|
physicalAddress, \
|
||||||
effectiveAddress, \
|
effectiveAddress, \
|
||||||
(uint32_t) my_ ## x, \
|
(uint32_t) my_##x, \
|
||||||
(uint32_t) &real_ ## x, \
|
(uint32_t) &real_##x, \
|
||||||
lib, \
|
lib, \
|
||||||
function_name, \
|
function_name, \
|
||||||
0, \
|
0, \
|
||||||
@ -149,5 +149,5 @@ typedef struct function_replacement_data_t {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define DECL_FUNCTION(res, name, ...) \
|
#define DECL_FUNCTION(res, name, ...) \
|
||||||
res (* real_ ## name)(__VA_ARGS__) __attribute__((section(".data"))); \
|
res (*real_##name)(__VA_ARGS__) __attribute__((section(".data"))); \
|
||||||
res my_ ## name(__VA_ARGS__)
|
res my_##name(__VA_ARGS__)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "fpatching_defines.h"
|
#include "fpatching_defines.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
Loading…
Reference in New Issue
Block a user