mirror of
https://github.com/wiiu-env/MochaPayload.git
synced 2024-11-21 23:49:15 +01:00
Format the code via clang-format
This commit is contained in:
parent
77c31bd0fe
commit
8015a18f24
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:
|
|||||||
- 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
|
||||||
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
|
||||||
@ -54,4 +62,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 ./source
|
||||||
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,5 +1,7 @@
|
|||||||
|
[![CI-Release](https://github.com/wiiu-env/MochaPayload/actions/workflows/ci.yml/badge.svg)](https://github.com/wiiu-env/MochaPayload/actions/workflows/ci.yml)
|
||||||
|
|
||||||
# MochaPayload - a simple custom firmware
|
# MochaPayload - a simple custom firmware
|
||||||
This a lite version of the [original mocha](https://github.com/dimok789/mocha) to be used with the [EnvironmentLoader](https://github.com/wiiu-env/EnvironmentLoader).
|
This a version of the [original mocha](https://github.com/dimok789/mocha) to be used with the [EnvironmentLoader](https://github.com/wiiu-env/EnvironmentLoader).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
Place the `00_mocha.rpx` in the `[ENVIRONMENT]/modules/setup` folder and run the [EnvironmentLoader](https://github.com/wiiu-env/EnvironmentLoader).
|
Place the `00_mocha.rpx` in the `[ENVIRONMENT]/modules/setup` folder and run the [EnvironmentLoader](https://github.com/wiiu-env/EnvironmentLoader).
|
||||||
@ -15,7 +17,6 @@ Place the `00_mocha.rpx` in the `[ENVIRONMENT]/modules/setup` folder and run the
|
|||||||
|
|
||||||
For building you just need [wut](https://github.com/devkitPro/wut/) installed, then use the `make` command.
|
For building you just need [wut](https://github.com/devkitPro/wut/) installed, then use the `make` command.
|
||||||
|
|
||||||
|
|
||||||
## Building using the Dockerfile
|
## Building using the Dockerfile
|
||||||
|
|
||||||
It's possible to use a docker image for building. This way you don't need anything installed on your host system.
|
It's possible to use a docker image for building. This way you don't need anything installed on your host system.
|
||||||
@ -31,6 +32,10 @@ docker run -it --rm -v ${PWD}:/project mochapayload-builder make
|
|||||||
docker run -it --rm -v ${PWD}:/project mochapayload-builder make clean
|
docker run -it --rm -v ${PWD}:/project mochapayload-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
|
## Credits
|
||||||
dimok
|
dimok
|
||||||
Maschell
|
Maschell
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#define CHECK_SIZE(Type, Size) \
|
#define CHECK_SIZE(Type, Size) \
|
||||||
static_assert(sizeof(Type) == Size, \
|
static_assert(sizeof(Type) == Size, \
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <string.h>
|
|
||||||
#include <coreinit/cache.h>
|
|
||||||
#include <coreinit/thread.h>
|
|
||||||
#include <coreinit/ios.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "ios_exploit.h"
|
#include "ios_exploit.h"
|
||||||
|
#include <coreinit/cache.h>
|
||||||
|
#include <coreinit/ios.h>
|
||||||
|
#include <coreinit/thread.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define ALIGN4(x) (((x) + 3) & ~3)
|
#define ALIGN4(x) (((x) + 3) & ~3)
|
||||||
|
|
||||||
@ -34,8 +34,8 @@ typedef struct __attribute__((packed)) {
|
|||||||
|
|
||||||
/* YOUR ARM CODE HERE (starts at ARM_CODE_BASE) */
|
/* YOUR ARM CODE HERE (starts at ARM_CODE_BASE) */
|
||||||
#include "ios_kernel/ios_kernel.bin.h"
|
#include "ios_kernel/ios_kernel.bin.h"
|
||||||
#include "ios_usb/ios_usb.bin.h"
|
|
||||||
#include "ios_mcp/ios_mcp.bin.h"
|
#include "ios_mcp/ios_mcp.bin.h"
|
||||||
|
#include "ios_usb/ios_usb.bin.h"
|
||||||
|
|
||||||
/* ROP CHAIN STARTS HERE (0x1015BD78) */
|
/* ROP CHAIN STARTS HERE (0x1015BD78) */
|
||||||
static const int final_chain[] = {
|
static const int final_chain[] = {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// clang-format off
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995, 1996, 2001, 2002
|
* Copyright (c) 1995, 1996, 2001, 2002
|
||||||
* Erik Theisen. All rights reserved.
|
* Erik Theisen. All rights reserved.
|
||||||
|
@ -21,16 +21,14 @@
|
|||||||
* 3. This notice may not be removed or altered from any source
|
* 3. This notice may not be removed or altered from any source
|
||||||
* distribution.
|
* distribution.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "types.h"
|
|
||||||
#include "elf_abi.h"
|
#include "elf_abi.h"
|
||||||
|
#include "types.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
static Elf32_Phdr *get_section(u32 data, u32 vaddr) {
|
static Elf32_Phdr *get_section(u32 data, u32 vaddr) {
|
||||||
Elf32_Ehdr *ehdr = (Elf32_Ehdr *) data;
|
Elf32_Ehdr *ehdr = (Elf32_Ehdr *) data;
|
||||||
|
|
||||||
if (!IS_ELF (*ehdr)
|
if (!IS_ELF(*ehdr) || (ehdr->e_type != ET_EXEC) || (ehdr->e_machine != EM_ARM)) {
|
||||||
|| (ehdr->e_type != ET_EXEC)
|
|
||||||
|| (ehdr->e_machine != EM_ARM)) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,4 +218,3 @@ int FSA_SDWriteRawSectors(const void *buffer, u32 sector, u32 num_sectors) {
|
|||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,12 +21,12 @@
|
|||||||
* 3. This notice may not be removed or altered from any source
|
* 3. This notice may not be removed or altered from any source
|
||||||
* distribution.
|
* distribution.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "utils.h"
|
|
||||||
#include "types.h"
|
|
||||||
#include "elf_patcher.h"
|
|
||||||
#include "kernel_patches.h"
|
|
||||||
#include "ios_mcp_patches.h"
|
|
||||||
#include "../../ios_mcp/ios_mcp_syms.h"
|
#include "../../ios_mcp/ios_mcp_syms.h"
|
||||||
|
#include "elf_patcher.h"
|
||||||
|
#include "ios_mcp_patches.h"
|
||||||
|
#include "kernel_patches.h"
|
||||||
|
#include "types.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 paddr;
|
u32 paddr;
|
||||||
|
@ -21,11 +21,11 @@
|
|||||||
* 3. This notice may not be removed or altered from any source
|
* 3. This notice may not be removed or altered from any source
|
||||||
* distribution.
|
* distribution.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "types.h"
|
|
||||||
#include "elf_patcher.h"
|
|
||||||
#include "ios_mcp_patches.h"
|
#include "ios_mcp_patches.h"
|
||||||
#include "../../ios_mcp/ios_mcp.bin.h"
|
#include "../../ios_mcp/ios_mcp.bin.h"
|
||||||
#include "../../ios_mcp/ios_mcp_syms.h"
|
#include "../../ios_mcp/ios_mcp_syms.h"
|
||||||
|
#include "elf_patcher.h"
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
#define MCP_CODE_BASE_PHYS_ADDR (-0x05100000 + 0x13D80000)
|
#define MCP_CODE_BASE_PHYS_ADDR (-0x05100000 + 0x13D80000)
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#ifndef _MCP_PATCHES_H_
|
#ifndef _MCP_PATCHES_H_
|
||||||
#define _MCP_PATCHES_H_
|
#define _MCP_PATCHES_H_
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
#define MCP_LAUNCH_IMG_PHYS_ADDR (0x27000000)
|
#define MCP_LAUNCH_IMG_PHYS_ADDR (0x27000000)
|
||||||
|
|
||||||
u32 mcp_get_phys_code_base(void);
|
u32 mcp_get_phys_code_base(void);
|
||||||
|
@ -21,14 +21,14 @@
|
|||||||
* 3. This notice may not be removed or altered from any source
|
* 3. This notice may not be removed or altered from any source
|
||||||
* distribution.
|
* distribution.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "types.h"
|
#include "kernel_patches.h"
|
||||||
#include "../../common/kernel_commands.h"
|
#include "../../common/kernel_commands.h"
|
||||||
#include "elf_patcher.h"
|
#include "elf_patcher.h"
|
||||||
#include "ios_mcp_patches.h"
|
|
||||||
#include "kernel_patches.h"
|
|
||||||
#include "fsa.h"
|
#include "fsa.h"
|
||||||
#include "utils.h"
|
#include "ios_mcp_patches.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
#include "types.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
extern void __KERNEL_CODE_START(void);
|
extern void __KERNEL_CODE_START(void);
|
||||||
|
|
||||||
@ -154,4 +154,3 @@ void kernel_run_patches(u32 ios_elf_start) {
|
|||||||
u32 patch_count = (u32) (((u8 *) kernel_patches_table_end) - ((u8 *) kernel_patches_table)) / sizeof(patch_table_t);
|
u32 patch_count = (u32) (((u8 *) kernel_patches_table_end) - ((u8 *) kernel_patches_table)) / sizeof(patch_table_t);
|
||||||
patch_table_entries(ios_elf_start, kernel_patches_table, patch_count);
|
patch_table_entries(ios_elf_start, kernel_patches_table, patch_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#ifndef _KERNEL_PATCHES_H
|
#ifndef _KERNEL_PATCHES_H
|
||||||
#define _KERNEL_PATCHES_H
|
#define _KERNEL_PATCHES_H
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
int kernel_init_otp_buffer(u32 sd_sector, int tagValid);
|
int kernel_init_otp_buffer(u32 sd_sector, int tagValid);
|
||||||
|
|
||||||
int kernel_syscall_0x81(u32 command, u32 arg1, u32 arg2, u32 arg3);
|
int kernel_syscall_0x81(u32 command, u32 arg1, u32 arg2, u32 arg3);
|
||||||
|
@ -21,10 +21,10 @@
|
|||||||
* 3. This notice may not be removed or altered from any source
|
* 3. This notice may not be removed or altered from any source
|
||||||
* distribution.
|
* distribution.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
#include "instant_patches.h"
|
||||||
|
#include "ios_mcp_patches.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "ios_mcp_patches.h"
|
|
||||||
#include "instant_patches.h"
|
|
||||||
|
|
||||||
#define USB_PHYS_CODE_BASE 0x101312D0
|
#define USB_PHYS_CODE_BASE 0x101312D0
|
||||||
|
|
||||||
@ -33,6 +33,7 @@ typedef struct {
|
|||||||
u8 data[0];
|
u8 data[0];
|
||||||
} payload_info_t;
|
} payload_info_t;
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
static const char repairData_set_fault_behavior[] = {
|
static const char repairData_set_fault_behavior[] = {
|
||||||
0xE1, 0x2F, 0xFF, 0x1E, 0xE9, 0x2D, 0x40, 0x30, 0xE5, 0x93, 0x20, 0x00, 0xE1, 0xA0, 0x40, 0x00,
|
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,
|
0xE5, 0x92, 0x30, 0x54, 0xE1, 0xA0, 0x50, 0x01, 0xE3, 0x53, 0x00, 0x01, 0x0A, 0x00, 0x00, 0x02,
|
||||||
@ -56,6 +57,7 @@ static const char repairData_usb_root_thread[] = {
|
|||||||
0xE2, 0x4D, 0xDE, 0x17, 0xEB, 0x00, 0xB9, 0x92, 0xE3, 0xA0, 0x10, 0x00, 0xE3, 0xA0, 0x20, 0x03,
|
0xE2, 0x4D, 0xDE, 0x17, 0xEB, 0x00, 0xB9, 0x92, 0xE3, 0xA0, 0x10, 0x00, 0xE3, 0xA0, 0x20, 0x03,
|
||||||
0xE5, 0x9F, 0x0E, 0x68, 0xEB, 0x00, 0xB3, 0x20,
|
0xE5, 0x9F, 0x0E, 0x68, 0xEB, 0x00, 0xB3, 0x20,
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
int _main() {
|
int _main() {
|
||||||
void (*invalidate_icache)() = (void (*)()) 0x0812DCF0;
|
void (*invalidate_icache)() = (void (*)()) 0x0812DCF0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef struct ThreadContext {
|
typedef struct ThreadContext {
|
||||||
uint32_t cspr;
|
uint32_t cspr;
|
||||||
|
@ -37,17 +37,24 @@ void reverse_memcpy(void *dest, const void *src, unsigned int size);
|
|||||||
|
|
||||||
static inline unsigned int disable_mmu(void) {
|
static inline unsigned int disable_mmu(void) {
|
||||||
unsigned int control_register = 0;
|
unsigned int control_register = 0;
|
||||||
asm volatile("MRC p15, 0, %0, c1, c0, 0" : "=r" (control_register));
|
asm volatile("MRC p15, 0, %0, c1, c0, 0"
|
||||||
asm volatile("MCR p15, 0, %0, c1, c0, 0" : : "r" (control_register & 0xFFFFEFFA));
|
: "=r"(control_register));
|
||||||
|
asm volatile("MCR p15, 0, %0, c1, c0, 0"
|
||||||
|
:
|
||||||
|
: "r"(control_register & 0xFFFFEFFA));
|
||||||
return control_register;
|
return control_register;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void restore_mmu(unsigned int 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) {
|
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
|
#endif
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "svc.h"
|
|
||||||
#include "imports.h"
|
|
||||||
#include "fsa.h"
|
#include "fsa.h"
|
||||||
|
#include "imports.h"
|
||||||
|
#include "svc.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
static void *allocIobuf() {
|
static void *allocIobuf() {
|
||||||
void *ptr = svcAlloc(0xCAFF, 0x828);
|
void *ptr = svcAlloc(0xCAFF, 0x828);
|
||||||
@ -193,7 +193,8 @@ int _FSA_ReadWriteFile(int fd, void *data, u32 size, u32 cnt, int fileHandle, u3
|
|||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
if (read) ret = svcIoctlv(fd, 0x0F, 1, 2, iovec);
|
if (read) ret = svcIoctlv(fd, 0x0F, 1, 2, iovec);
|
||||||
else ret = svcIoctlv(fd, 0x10, 2, 1, iovec);
|
else
|
||||||
|
ret = svcIoctlv(fd, 0x10, 2, 1, iovec);
|
||||||
|
|
||||||
freeIobuf(iobuf);
|
freeIobuf(iobuf);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef FSA_H
|
#ifndef FSA_H
|
||||||
#define FSA_H
|
#define FSA_H
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 flag;
|
u32 flag;
|
||||||
u32 permission;
|
u32 permission;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef IMPORTS_H
|
#ifndef IMPORTS_H
|
||||||
#define IMPORTS_H
|
#define IMPORTS_H
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define MCP_SVC_BASE ((void *) 0x050567EC)
|
#define MCP_SVC_BASE ((void *) 0x050567EC)
|
||||||
|
|
||||||
|
@ -21,16 +21,15 @@
|
|||||||
* 3. This notice may not be removed or altered from any source
|
* 3. This notice may not be removed or altered from any source
|
||||||
* distribution.
|
* distribution.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "imports.h"
|
|
||||||
#include "fsa.h"
|
|
||||||
#include "svc.h"
|
|
||||||
#include "logger.h"
|
|
||||||
#include "fsa.h"
|
|
||||||
#include "wupserver.h"
|
|
||||||
#include "../../common/kernel_commands.h"
|
#include "../../common/kernel_commands.h"
|
||||||
|
#include "fsa.h"
|
||||||
|
#include "imports.h"
|
||||||
|
#include "logger.h"
|
||||||
|
#include "svc.h"
|
||||||
|
#include "wupserver.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define IOS_ERROR_UNKNOWN_VALUE 0xFFFFFFD6
|
#define IOS_ERROR_UNKNOWN_VALUE 0xFFFFFFD6
|
||||||
#define IOS_ERROR_INVALID_ARG 0xFFFFFFE3
|
#define IOS_ERROR_INVALID_ARG 0xFFFFFFE3
|
||||||
@ -451,5 +450,4 @@ void ipc_deinit(void) {
|
|||||||
svcIoctl(fd, IOCTL_KILL_SERVER, &dummy, sizeof(dummy), &dummy, sizeof(dummy));
|
svcIoctl(fd, IOCTL_KILL_SERVER, &dummy, sizeof(dummy), &dummy, sizeof(dummy));
|
||||||
svcClose(fd);
|
svcClose(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <stdarg.h>
|
#include "logger.h"
|
||||||
#include <string.h>
|
|
||||||
#include "types.h"
|
|
||||||
#include "imports.h"
|
#include "imports.h"
|
||||||
#include "socket.h"
|
#include "socket.h"
|
||||||
#include "logger.h"
|
#include "types.h"
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef LOG_IP
|
#ifdef LOG_IP
|
||||||
static int log_socket = 0;
|
static int log_socket = 0;
|
||||||
@ -20,8 +20,7 @@ int log_init(unsigned int ipAddress){
|
|||||||
connect_addr.sin_port = 4405;
|
connect_addr.sin_port = 4405;
|
||||||
connect_addr.sin_addr.s_addr = ipAddress;
|
connect_addr.sin_addr.s_addr = ipAddress;
|
||||||
|
|
||||||
if(connect(log_socket, (struct sockaddr*)&connect_addr, sizeof(connect_addr)) < 0)
|
if (connect(log_socket, (struct sockaddr *) &connect_addr, sizeof(connect_addr)) < 0) {
|
||||||
{
|
|
||||||
closesocket(log_socket);
|
closesocket(log_socket);
|
||||||
log_socket = -1;
|
log_socket = -1;
|
||||||
}
|
}
|
||||||
@ -29,17 +28,14 @@ int log_init(unsigned int ipAddress){
|
|||||||
return log_socket;
|
return log_socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_deinit()
|
void log_deinit() {
|
||||||
{
|
if (log_socket >= 0) {
|
||||||
if(log_socket >= 0)
|
|
||||||
{
|
|
||||||
closesocket(log_socket);
|
closesocket(log_socket);
|
||||||
log_socket = -1;
|
log_socket = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void log_print(const char *str, int len)
|
static void log_print(const char *str, int len) {
|
||||||
{
|
|
||||||
if (log_socket < 0) {
|
if (log_socket < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -55,8 +51,7 @@ static void log_print(const char *str, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_printf(const char *format, ...)
|
void log_printf(const char *format, ...) {
|
||||||
{
|
|
||||||
if (log_socket < 0) {
|
if (log_socket < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,8 @@ void log_printf(const char *format, ...);
|
|||||||
#define log_printf(x, ...)
|
#define log_printf(x, ...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEBUG_FUNCTION_LINE(FMT, ARGS...)do { \
|
#define DEBUG_FUNCTION_LINE(FMT, ARGS...) \
|
||||||
|
do { \
|
||||||
log_printf("[%23s]%30s@L%04d: " FMT "", __FILE__, __FUNCTION__, __LINE__, ##ARGS); \
|
log_printf("[%23s]%30s@L%04d: " FMT "", __FILE__, __FUNCTION__, __LINE__, ##ARGS); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "wupserver.h"
|
|
||||||
#include "ipc.h"
|
#include "ipc.h"
|
||||||
|
#include "wupserver.h"
|
||||||
|
|
||||||
static int threadsStarted = 0;
|
static int threadsStarted = 0;
|
||||||
|
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
* - each request routes here where we can do whatever
|
* - each request routes here where we can do whatever
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "logger.h"
|
|
||||||
#include "ipc_types.h"
|
|
||||||
#include "../../common/ipc_defs.h"
|
#include "../../common/ipc_defs.h"
|
||||||
#include "fsa.h"
|
#include "fsa.h"
|
||||||
|
#include "ipc_types.h"
|
||||||
|
#include "logger.h"
|
||||||
#include "svc.h"
|
#include "svc.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "net_ifmgr_ncl.h"
|
#include "net_ifmgr_ncl.h"
|
||||||
#include "imports.h"
|
#include "imports.h"
|
||||||
#include "svc.h"
|
#include "svc.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
static int ifmgrncl_handle = 0;
|
static int ifmgrncl_handle = 0;
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "socket.h"
|
#include "socket.h"
|
||||||
#include "svc.h"
|
|
||||||
#include "imports.h"
|
#include "imports.h"
|
||||||
|
#include "svc.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
static int socket_handle = 0;
|
static int socket_handle = 0;
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef TYPES_H
|
#ifndef TYPES_H
|
||||||
#define TYPES_H
|
#define TYPES_H
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#define U64_MAX UINT64_MAX
|
#define U64_MAX UINT64_MAX
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#include <stdlib.h>
|
#include "fsa.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "imports.h"
|
#include "imports.h"
|
||||||
|
#include "ipc.h"
|
||||||
|
#include "logger.h"
|
||||||
#include "net_ifmgr_ncl.h"
|
#include "net_ifmgr_ncl.h"
|
||||||
#include "socket.h"
|
#include "socket.h"
|
||||||
#include "fsa.h"
|
|
||||||
#include "svc.h"
|
#include "svc.h"
|
||||||
#include "logger.h"
|
#include <stdio.h>
|
||||||
#include "ipc.h"
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
static int serverKilled;
|
static int serverKilled;
|
||||||
static int serverSocket;
|
static int serverSocket;
|
||||||
|
@ -19,6 +19,4 @@ void _main() {
|
|||||||
"newlr: .word 0x1012EACC\n"
|
"newlr: .word 0x1012EACC\n"
|
||||||
"newr0: .word 0x10146080\n"
|
"newr0: .word 0x10146080\n"
|
||||||
"newpc: .word 0x10111164\n");
|
"newpc: .word 0x10111164\n");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <cstring>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <coreinit/cache.h>
|
#include <coreinit/cache.h>
|
||||||
#include <coreinit/ios.h>
|
#include <coreinit/ios.h>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstring>
|
||||||
#include <sysapp/title.h>
|
#include <sysapp/title.h>
|
||||||
|
|
||||||
#include <whb/log.h>
|
#include <whb/log.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user