Format via clang-format
This commit is contained in:
parent
f74dd732b0
commit
de4405ecf9
|
@ -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
|
|
@ -6,8 +6,16 @@ on:
|
|||
- master
|
||||
|
||||
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
|
||||
build-binary:
|
||||
runs-on: ubuntu-18.04
|
||||
needs: clang-format
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: build binary
|
||||
|
|
|
@ -3,8 +3,16 @@ 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
|
||||
build-binary:
|
||||
runs-on: ubuntu-18.04
|
||||
needs: clang-format
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: build binary
|
||||
|
|
|
@ -63,6 +63,11 @@ docker run -it --rm -v ${PWD}:/project payloadfromrpx-builder make
|
|||
docker run -it --rm -v ${PWD}:/project payloadfromrpx-builder make clean
|
||||
```
|
||||
|
||||
|
||||
## Format the code via docker
|
||||
|
||||
`docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source -i`
|
||||
|
||||
## Credits
|
||||
- orboditilt
|
||||
- Maschell
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <coreinit/debug.h>
|
||||
#include <coreinit/cache.h>
|
||||
#include <coreinit/debug.h>
|
||||
#include <coreinit/memdefaultheap.h>
|
||||
#include <whb/sdcard.h>
|
||||
#include <utils/logger.h>
|
||||
#include <whb/file.h>
|
||||
#include <whb/log.h>
|
||||
#include <utils/logger.h>
|
||||
#include <whb/sdcard.h>
|
||||
|
||||
#include "elf_abi.h"
|
||||
|
||||
|
@ -61,10 +61,7 @@ uint32_t load_loader_elf_from_sd(unsigned char *baseAddress, const char *relativ
|
|||
static unsigned int get_section(unsigned char *data, const char *name, unsigned int *size, unsigned int *addr, int fail_on_not_found) {
|
||||
Elf32_Ehdr *ehdr = (Elf32_Ehdr *) data;
|
||||
|
||||
if (!data
|
||||
|| !IS_ELF (*ehdr)
|
||||
|| (ehdr->e_type != ET_EXEC)
|
||||
|| (ehdr->e_machine != EM_PPC)) {
|
||||
if (!data || !IS_ELF(*ehdr) || (ehdr->e_type != ET_EXEC) || (ehdr->e_machine != EM_PPC)) {
|
||||
OSFatal("Invalid elf file");
|
||||
}
|
||||
|
||||
|
@ -118,7 +115,6 @@ static void InstallMain(void *data_elf) {
|
|||
memcpy((void *) (main_rodata_addr), (void *) main_rodata, main_rodata_len);
|
||||
DCFlushRange((void *) main_rodata_addr, main_rodata_len);
|
||||
ICInvalidateRange((void *) main_rodata_addr, main_rodata_len);
|
||||
|
||||
}
|
||||
|
||||
// get the .data section
|
||||
|
@ -144,5 +140,4 @@ static void InstallMain(void *data_elf) {
|
|||
DCFlushRange((void *) main_bss_addr, main_bss_len);
|
||||
ICInvalidateRange((void *) main_bss_addr, main_bss_len);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// clang-format off
|
||||
/*
|
||||
* Copyright (c) 1995, 1996, 2001, 2002
|
||||
* Erik Theisen. All rights reserved.
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
#include <coreinit/core.h>
|
||||
#include <coreinit/memory.h>
|
||||
#include <coreinit/debug.h>
|
||||
#include <coreinit/thread.h>
|
||||
#include <coreinit/cache.h>
|
||||
#include <coreinit/dynload.h>
|
||||
#include <coreinit/thread.h>
|
||||
#include <coreinit/exit.h>
|
||||
#include <sysapp/launch.h>
|
||||
#include <gx2/state.h>
|
||||
#include <coreinit/memorymap.h>
|
||||
#include <whb/log.h>
|
||||
#include <malloc.h>
|
||||
#include <cstring>
|
||||
#include <utils/logger.h>
|
||||
#include "ElfUtils.h"
|
||||
#include "gx2sploit.h"
|
||||
#include "ElfUtils.h"
|
||||
#include <coreinit/cache.h>
|
||||
#include <coreinit/core.h>
|
||||
#include <coreinit/debug.h>
|
||||
#include <coreinit/dynload.h>
|
||||
#include <coreinit/exit.h>
|
||||
#include <coreinit/memory.h>
|
||||
#include <coreinit/memorymap.h>
|
||||
#include <coreinit/thread.h>
|
||||
#include <cstring>
|
||||
#include <gx2/state.h>
|
||||
#include <malloc.h>
|
||||
#include <sysapp/launch.h>
|
||||
#include <utils/logger.h>
|
||||
#include <whb/log.h>
|
||||
|
||||
#define JIT_ADDRESS 0x01800000
|
||||
|
||||
|
@ -65,8 +64,7 @@ void __attribute__((noinline)) kern_write(const void *addr, uint32_t value) {
|
|||
:
|
||||
: "r"(addr), "r"(value)
|
||||
: "memory", "ctr", "lr", "0", "3", "4", "5", "6", "7", "8", "9", "10",
|
||||
"11", "12"
|
||||
);
|
||||
"11", "12");
|
||||
}
|
||||
|
||||
extern "C" void OSSwitchSecCodeGenMode(int);
|
||||
|
@ -186,15 +184,23 @@ static void SCSetupIBAT4DBAT5() {
|
|||
// 00800000-01000000 => 30800000-31000000 (read/write, user/supervisor)
|
||||
unsigned int ibat4u = 0x008000FF;
|
||||
unsigned int ibat4l = 0x30800012;
|
||||
asm volatile("mtspr 560, %0" : : "r" (ibat4u));
|
||||
asm volatile("mtspr 561, %0" : : "r" (ibat4l));
|
||||
asm volatile("mtspr 560, %0"
|
||||
:
|
||||
: "r"(ibat4u));
|
||||
asm volatile("mtspr 561, %0"
|
||||
:
|
||||
: "r"(ibat4l));
|
||||
|
||||
// Give our and the kernel full data access rights.
|
||||
// 00800000-01000000 => 30800000-31000000 (read/write, user/supervisor)
|
||||
unsigned int dbat5u = ibat4u;
|
||||
unsigned int dbat5l = ibat4l;
|
||||
asm volatile("mtspr 570, %0" : : "r" (dbat5u));
|
||||
asm volatile("mtspr 571, %0" : : "r" (dbat5l));
|
||||
asm volatile("mtspr 570, %0"
|
||||
:
|
||||
: "r"(dbat5u));
|
||||
asm volatile("mtspr 571, %0"
|
||||
:
|
||||
: "r"(dbat5l));
|
||||
|
||||
asm volatile("eieio; isync");
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define KERN_SYSCALL_TBL_1 0xFFE84C70 // unknown
|
||||
#define KERN_SYSCALL_TBL_2 0xFFE85070 // works with games
|
||||
#define KERN_SYSCALL_TBL_3 0xFFE85470 // works with loader
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <coreinit/cache.h>
|
||||
#include <coreinit/thread.h>
|
||||
#include <coreinit/ios.h>
|
||||
#include "ios_exploit.h"
|
||||
#include <coreinit/cache.h>
|
||||
#include <coreinit/ios.h>
|
||||
#include <coreinit/thread.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define CHAIN_START 0x1016AD40
|
||||
#define SOURCE (0x120000)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// clang-format off
|
||||
/*
|
||||
* Copyright (c) 1995, 1996, 2001, 2002
|
||||
* Erik Theisen. All rights reserved.
|
||||
|
|
|
@ -21,16 +21,14 @@
|
|||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
***************************************************************************/
|
||||
#include "types.h"
|
||||
#include "elf_abi.h"
|
||||
#include "types.h"
|
||||
#include "utils.h"
|
||||
|
||||
static Elf32_Phdr *get_section(u32 data, u32 vaddr) {
|
||||
Elf32_Ehdr *ehdr = (Elf32_Ehdr *) data;
|
||||
|
||||
if (!IS_ELF (*ehdr)
|
||||
|| (ehdr->e_type != ET_EXEC)
|
||||
|| (ehdr->e_machine != EM_ARM)) {
|
||||
if (!IS_ELF(*ehdr) || (ehdr->e_type != ET_EXEC) || (ehdr->e_machine != EM_ARM)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
***************************************************************************/
|
||||
#include "utils.h"
|
||||
#include "types.h"
|
||||
#include "kernel_patches.h"
|
||||
#include "types.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define mcp_rodata_phys(addr) ((u32) (addr) -0x05060000 + 0x08220000)
|
||||
#define mcp_data_phys(addr) ((u32) (addr) -0x05074000 + 0x08234000)
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
***************************************************************************/
|
||||
#include "types.h"
|
||||
#include "elf_patcher.h"
|
||||
#include "kernel_patches.h"
|
||||
#include "elf_patcher.h"
|
||||
#include "types.h"
|
||||
#include "utils.h"
|
||||
|
||||
extern void __KERNEL_CODE_START(void);
|
||||
|
@ -58,4 +58,3 @@ void kernel_run_patches(u32 ios_elf_start) {
|
|||
section_write_word(ios_elf_start, 0xe22b2a78, 0x00000000);
|
||||
section_write_word(ios_elf_start, 0xe204fb68, 0xe3a00000);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
***************************************************************************/
|
||||
#include "instant_patches.h"
|
||||
#include "types.h"
|
||||
#include "utils.h"
|
||||
#include "instant_patches.h"
|
||||
|
||||
#define USB_PHYS_CODE_BASE 0x101312D0
|
||||
|
||||
|
@ -32,6 +32,7 @@ typedef struct {
|
|||
u8 data[0];
|
||||
} payload_info_t;
|
||||
|
||||
// clang-format off
|
||||
static const char repairData_set_fault_behavior[] = {
|
||||
0xE1, 0x2F, 0xFF, 0x1E, 0xE9, 0x2D, 0x40, 0x30, 0xE5, 0x93, 0x20, 0x00, 0xE1, 0xA0, 0x40, 0x00,
|
||||
0xE5, 0x92, 0x30, 0x54, 0xE1, 0xA0, 0x50, 0x01, 0xE3, 0x53, 0x00, 0x01, 0x0A, 0x00, 0x00, 0x02,
|
||||
|
@ -55,6 +56,7 @@ static const char repairData_usb_root_thread[] = {
|
|||
0xE2, 0x4D, 0xDE, 0x17, 0xEB, 0x00, 0xB9, 0x92, 0xE3, 0xA0, 0x10, 0x00, 0xE3, 0xA0, 0x20, 0x03,
|
||||
0xE5, 0x9F, 0x0E, 0x68, 0xEB, 0x00, 0xB3, 0x20,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
int _main() {
|
||||
void (*invalidate_icache)() = (void (*)()) 0x0812DCF0;
|
||||
|
|
|
@ -37,17 +37,24 @@ void reverse_memcpy(void *dest, const void *src, unsigned int size);
|
|||
|
||||
static inline unsigned int disable_mmu(void) {
|
||||
unsigned int control_register = 0;
|
||||
asm volatile("MRC p15, 0, %0, c1, c0, 0" : "=r" (control_register));
|
||||
asm volatile("MCR p15, 0, %0, c1, c0, 0" : : "r" (control_register & 0xFFFFEFFA));
|
||||
asm volatile("MRC p15, 0, %0, c1, c0, 0"
|
||||
: "=r"(control_register));
|
||||
asm volatile("MCR p15, 0, %0, c1, c0, 0"
|
||||
:
|
||||
: "r"(control_register & 0xFFFFEFFA));
|
||||
return control_register;
|
||||
}
|
||||
|
||||
static inline void restore_mmu(unsigned int control_register) {
|
||||
asm volatile("MCR p15, 0, %0, c1, c0, 0" : : "r" (control_register));
|
||||
asm volatile("MCR p15, 0, %0, c1, c0, 0"
|
||||
:
|
||||
: "r"(control_register));
|
||||
}
|
||||
|
||||
static inline void set_domain_register(unsigned int domain_register) {
|
||||
asm volatile("MCR p15, 0, %0, c3, c0, 0" : : "r" (domain_register));
|
||||
asm volatile("MCR p15, 0, %0, c3, c0, 0"
|
||||
:
|
||||
: "r"(domain_register));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,5 +20,4 @@ void _main() {
|
|||
"newlr: .word 0x1012EACC\n"
|
||||
"newr0: .word 0x10146080\n"
|
||||
"newpc: .word 0x10111164\n");
|
||||
|
||||
}
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
#include <coreinit/time.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <coreinit/time.h>
|
||||
|
||||
#include <coreinit/foreground.h>
|
||||
|
||||
#include <nn/act/client_cpp.h>
|
||||
|
||||
#include <proc_ui/procui.h>
|
||||
#include <coreinit/thread.h>
|
||||
#include <coreinit/screen.h>
|
||||
#include <coreinit/thread.h>
|
||||
#include <proc_ui/procui.h>
|
||||
|
||||
#include <whb/log.h>
|
||||
#include <whb/log_udp.h>
|
||||
#include <sysapp/launch.h>
|
||||
#include <sysapp/title.h>
|
||||
#include <coreinit/cache.h>
|
||||
#include <vpad/input.h>
|
||||
#include <string>
|
||||
#include "utils/logger.h"
|
||||
#include "ElfUtils.h"
|
||||
#include "ios_exploit.h"
|
||||
#include "utils/logger.h"
|
||||
#include <coreinit/cache.h>
|
||||
#include <string>
|
||||
#include <sysapp/launch.h>
|
||||
#include <sysapp/title.h>
|
||||
#include <vpad/input.h>
|
||||
#include <whb/log.h>
|
||||
#include <whb/log_udp.h>
|
||||
|
||||
#include "gx2sploit.h"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <whb/log.h>
|
||||
#include <string.h>
|
||||
#include <whb/log.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -10,11 +10,11 @@ extern "C" {
|
|||
#define __FILENAME_X__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
|
||||
#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); \
|
||||
} while (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue