mirror of
https://github.com/wiiu-env/PayloadLoaderPayload.git
synced 2024-11-23 18:29:19 +01:00
Format the code via clang-format
This commit is contained in:
parent
6098af25eb
commit
a3c549c0da
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
|
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
@ -6,8 +6,16 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
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 ./src
|
||||||
build-binary:
|
build-binary:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
|
needs: clang-format
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: build binary
|
- name: build binary
|
||||||
@ -55,4 +63,4 @@ jobs:
|
|||||||
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
|
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_path: ./${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip
|
||||||
asset_name: ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip
|
asset_name: ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip
|
||||||
asset_content_type: application/unknown
|
asset_content_type: application/zip
|
8
.github/workflows/pr.yml
vendored
8
.github/workflows/pr.yml
vendored
@ -3,8 +3,16 @@ name: CI-PR
|
|||||||
on: [pull_request]
|
on: [pull_request]
|
||||||
|
|
||||||
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 ./src
|
||||||
build-binary:
|
build-binary:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
|
needs: clang-format
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: build binary
|
- name: build binary
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
FROM wiiuenv/devkitppc:20210414
|
FROM wiiuenv/devkitppc:20211229
|
||||||
|
|
||||||
WORKDIR project
|
WORKDIR project
|
@ -34,6 +34,10 @@ docker run -it --rm -v ${PWD}:/project payloadloaderpayload-builder make
|
|||||||
docker run -it --rm -v ${PWD}:/project payloadloaderpayload-builder make clean
|
docker run -it --rm -v ${PWD}:/project payloadloaderpayload-builder make clean
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Format the code via docker
|
||||||
|
|
||||||
|
`docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./src -i`
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
- Maschell
|
- Maschell
|
||||||
- orboditilt
|
- orboditilt
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <coreinit/dynload.h>
|
|
||||||
#include <coreinit/debug.h>
|
#include <coreinit/debug.h>
|
||||||
|
#include <coreinit/dynload.h>
|
||||||
|
|
||||||
#define IMPORT(name) void *addr_##name
|
#define IMPORT(name) void *addr_##name
|
||||||
#define IMPORT_BEGIN(lib)
|
#define IMPORT_BEGIN(lib)
|
||||||
@ -11,7 +11,10 @@
|
|||||||
#undef IMPORT_BEGIN
|
#undef IMPORT_BEGIN
|
||||||
#undef IMPORT_END
|
#undef IMPORT_END
|
||||||
|
|
||||||
#define IMPORT(name) do{if(OSDynLoad_FindExport(handle, 0, #name, &addr_##name) < 0)OSFatal("Function " # name " is NULL");} while(0)
|
#define IMPORT(name) \
|
||||||
|
do { \
|
||||||
|
if (OSDynLoad_FindExport(handle, 0, #name, &addr_##name) < 0) OSFatal("Function " #name " is NULL"); \
|
||||||
|
} while (0)
|
||||||
#define IMPORT_BEGIN(lib) OSDynLoad_Acquire(#lib ".rpl", &handle)
|
#define IMPORT_BEGIN(lib) OSDynLoad_Acquire(#lib ".rpl", &handle)
|
||||||
/* #define IMPORT_END() OSDynLoad_Release(handle) */
|
/* #define IMPORT_END() OSDynLoad_Release(handle) */
|
||||||
#define IMPORT_END()
|
#define IMPORT_END()
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
* 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 <coreinit/cache.h>
|
||||||
|
#include <coreinit/memorymap.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <coreinit/cache.h>
|
|
||||||
#include <coreinit/memorymap.h>
|
|
||||||
|
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
|
|
||||||
@ -69,6 +69,5 @@ void __attribute__ ((noinline)) kern_write(void *addr, uint32_t value) {
|
|||||||
:
|
:
|
||||||
: "r"(addr), "r"(value)
|
: "r"(addr), "r"(value)
|
||||||
: "memory", "ctr", "lr", "0", "3", "4", "5", "6", "7", "8", "9", "10",
|
: "memory", "ctr", "lr", "0", "3", "4", "5", "6", "7", "8", "9", "10",
|
||||||
"11", "12"
|
"11", "12");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
22
src/main.cpp
22
src/main.cpp
@ -15,25 +15,25 @@
|
|||||||
* 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 <malloc.h>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <coreinit/dynload.h>
|
#include <coreinit/dynload.h>
|
||||||
#include <coreinit/screen.h>
|
|
||||||
#include <coreinit/memexpheap.h>
|
#include <coreinit/memexpheap.h>
|
||||||
|
#include <coreinit/screen.h>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <malloc.h>
|
||||||
|
|
||||||
#include "utils/ElfUtils.h"
|
|
||||||
#include "utils/logger.h"
|
|
||||||
#include "dynamic.h"
|
#include "dynamic.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include <whb/log_udp.h>
|
#include "utils/ElfUtils.h"
|
||||||
|
#include "utils/logger.h"
|
||||||
#include <coreinit/filesystem.h>
|
#include <coreinit/filesystem.h>
|
||||||
#include <whb/sdcard.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <string>
|
|
||||||
#include <vpad/input.h>
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <utils/StringTools.h>
|
#include <utils/StringTools.h>
|
||||||
|
#include <vector>
|
||||||
|
#include <vpad/input.h>
|
||||||
|
#include <whb/log_udp.h>
|
||||||
|
#include <whb/sdcard.h>
|
||||||
|
|
||||||
std::map<std::string, std::string> get_all_payloads(const char *relativefilepath);
|
std::map<std::string, std::string> get_all_payloads(const char *relativefilepath);
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <coreinit/debug.h>
|
|
||||||
#include <coreinit/cache.h>
|
#include <coreinit/cache.h>
|
||||||
|
#include <coreinit/debug.h>
|
||||||
#include <coreinit/memdefaultheap.h>
|
#include <coreinit/memdefaultheap.h>
|
||||||
#include <whb/sdcard.h>
|
#include <stdbool.h>
|
||||||
|
#include <utils/logger.h>
|
||||||
#include <whb/file.h>
|
#include <whb/file.h>
|
||||||
#include <whb/log.h>
|
#include <whb/log.h>
|
||||||
#include <utils/logger.h>
|
#include <whb/sdcard.h>
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include "elf_abi.h"
|
#include "elf_abi.h"
|
||||||
|
|
||||||
@ -102,10 +102,7 @@ static bool CheckElfLoadedBetween(void *data_elf, uint32_t start_address, uint32
|
|||||||
static unsigned int get_section(void *data, const char *name, unsigned int *size, unsigned int *addr, int fail_on_not_found) {
|
static unsigned int get_section(void *data, const char *name, unsigned int *size, unsigned int *addr, int fail_on_not_found) {
|
||||||
Elf32_Ehdr *ehdr = (Elf32_Ehdr *) data;
|
Elf32_Ehdr *ehdr = (Elf32_Ehdr *) data;
|
||||||
|
|
||||||
if (!data
|
if (!data || !IS_ELF(*ehdr) || (ehdr->e_type != ET_EXEC) || (ehdr->e_machine != EM_PPC)) {
|
||||||
|| !IS_ELF (*ehdr)
|
|
||||||
|| (ehdr->e_type != ET_EXEC)
|
|
||||||
|| (ehdr->e_machine != EM_PPC)) {
|
|
||||||
OSFatal("Invalid elf file");
|
OSFatal("Invalid elf file");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +156,6 @@ static void InstallMain(void *data_elf) {
|
|||||||
memcpy((void *) (main_rodata_addr), (void *) main_rodata, main_rodata_len);
|
memcpy((void *) (main_rodata_addr), (void *) main_rodata, main_rodata_len);
|
||||||
DCFlushRange((void *) main_rodata_addr, main_rodata_len);
|
DCFlushRange((void *) main_rodata_addr, main_rodata_len);
|
||||||
ICInvalidateRange((void *) main_rodata_addr, main_rodata_len);
|
ICInvalidateRange((void *) main_rodata_addr, main_rodata_len);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the .data section
|
// get the .data section
|
||||||
@ -185,5 +181,4 @@ static void InstallMain(void *data_elf) {
|
|||||||
DCFlushRange((void *) main_bss_addr, main_bss_len);
|
DCFlushRange((void *) main_bss_addr, main_bss_len);
|
||||||
ICInvalidateRange((void *) main_bss_addr, main_bss_len);
|
ICInvalidateRange((void *) main_bss_addr, main_bss_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,4 +4,3 @@
|
|||||||
|
|
||||||
extern "C" int32_t LoadFileToMem(const char *relativefilepath, char **fileOut, uint32_t *sizeOut);
|
extern "C" int32_t LoadFileToMem(const char *relativefilepath, char **fileOut, uint32_t *sizeOut);
|
||||||
extern "C" uint32_t load_loader_elf_from_sd(unsigned char *baseAddress, const char *relativePath);
|
extern "C" uint32_t load_loader_elf_from_sd(unsigned char *baseAddress, const char *relativePath);
|
||||||
|
|
||||||
|
@ -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) {
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
#include <wut_types.h>
|
#include <wut_types.h>
|
||||||
|
|
||||||
class StringTools {
|
class StringTools {
|
||||||
|
@ -440,8 +440,7 @@ typedef struct {
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Elf32_Sword d_tag; /* controls meaning of d_val */
|
Elf32_Sword d_tag; /* controls meaning of d_val */
|
||||||
union
|
union {
|
||||||
{
|
|
||||||
Elf32_Word d_val; /* Multiple meanings - see d_tag */
|
Elf32_Word d_val; /* Multiple meanings - see d_tag */
|
||||||
Elf32_Addr d_ptr; /* program virtual address */
|
Elf32_Addr d_ptr; /* program virtual address */
|
||||||
} d_un;
|
} d_un;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <whb/log.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <whb/log.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -10,7 +10,8 @@ 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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user