Formatting

This commit is contained in:
Maschell 2021-09-23 18:52:20 +02:00
parent 35f046172e
commit f1b866f1ce
12 changed files with 73 additions and 76 deletions

View File

@ -133,7 +133,7 @@ typedef struct __attribute__((packed)) {
uint32_t groupId; uint32_t groupId;
uint32_t cmdFlags; uint32_t cmdFlags;
char argstr[4096]; char argstr[4096];
char* argv[64]; char *argv[64];
uint32_t max_size; uint32_t max_size;
uint32_t avail_size; uint32_t avail_size;
uint32_t codegen_size; uint32_t codegen_size;

View File

@ -1,30 +1,36 @@
void __init_wut_malloc(); void __init_wut_malloc();
void __init_wut_newlib(); void __init_wut_newlib();
void __init_wut_stdcpp(); void __init_wut_stdcpp();
void __init_wut_devoptab(); void __init_wut_devoptab();
void __attribute__((weak)) __init_wut_socket(); void __attribute__((weak)) __init_wut_socket();
void __fini_wut_malloc(); void __fini_wut_malloc();
void __fini_wut_newlib(); void __fini_wut_newlib();
void __fini_wut_stdcpp(); void __fini_wut_stdcpp();
void __fini_wut_devoptab(); void __fini_wut_devoptab();
void __attribute__((weak)) __fini_wut_socket(); void __attribute__((weak)) __fini_wut_socket();
void __attribute__((weak)) void __attribute__((weak))
__init_wut_() __init_wut_() {
{ __init_wut_malloc();
__init_wut_malloc(); __init_wut_newlib();
__init_wut_newlib(); __init_wut_stdcpp();
__init_wut_stdcpp(); __init_wut_devoptab();
__init_wut_devoptab(); if (&__init_wut_socket) __init_wut_socket();
if (&__init_wut_socket) __init_wut_socket();
} }
void __attribute__((weak)) void __attribute__((weak))
__fini_wut_() __fini_wut_() {
{ __fini_wut_devoptab();
__fini_wut_devoptab(); __fini_wut_stdcpp();
__fini_wut_stdcpp(); __fini_wut_newlib();
__fini_wut_newlib(); __fini_wut_malloc();
__fini_wut_malloc();
} }

View File

@ -1,5 +1,4 @@
#include <string.h> #include <string.h>
#include <stdio.h>
#include <coreinit/cache.h> #include <coreinit/cache.h>
#include <coreinit/thread.h> #include <coreinit/thread.h>
#include <coreinit/ios.h> #include <coreinit/ios.h>
@ -349,11 +348,11 @@ int ExecuteIOSExploit() {
int dummy[2]; int dummy[2];
dummy[0] = 0x050B817C; dummy[0] = 0x050B817C;
dummy[1] = *((uint32_t*) 0xF417FFF0); dummy[1] = *((uint32_t *) 0xF417FFF0);
IOS_Ioctl(iosuhaxFd, 0x07, &dummy, sizeof(dummy), &dummy, sizeof(dummy)); // IOCTL_KERN_WRITE32 IOS_Ioctl(iosuhaxFd, 0x07, &dummy, sizeof(dummy), &dummy, sizeof(dummy)); // IOCTL_KERN_WRITE32
dummy[0] = 0x050B8180; dummy[0] = 0x050B8180;
dummy[1] = *((uint32_t*) 0xF417FFF4); dummy[1] = *((uint32_t *) 0xF417FFF4);
IOS_Ioctl(iosuhaxFd, 0x07, &dummy, sizeof(dummy), &dummy, sizeof(dummy)); // IOCTL_KERN_WRITE32 IOS_Ioctl(iosuhaxFd, 0x07, &dummy, sizeof(dummy), &dummy, sizeof(dummy)); // IOCTL_KERN_WRITE32
//! do not run patches again as that will most likely crash //! do not run patches again as that will most likely crash

View File

@ -57,17 +57,17 @@ int FSA_Unmount(int fd, char *path, u32 flags) {
return ret; return ret;
} }
int FSA_FlushVolume(int fd, char* volume_path) { int FSA_FlushVolume(int fd, char *volume_path) {
u8* iobuf = allocIobuf(); u8 *iobuf = allocIobuf();
u32* inbuf = (u32*)iobuf; u32 *inbuf = (u32 *) iobuf;
u32* outbuf = (u32*)&iobuf[0x520]; u32 *outbuf = (u32 *) &iobuf[0x520];
strncpy((char*)&inbuf[0x01], volume_path, 0x27F); strncpy((char *) &inbuf[0x01], volume_path, 0x27F);
int ret = svcIoctl(fd, 0x1B, inbuf, 0x520, outbuf, 0x293); int ret = svcIoctl(fd, 0x1B, inbuf, 0x520, outbuf, 0x293);
freeIobuf(iobuf); freeIobuf(iobuf);
return ret; return ret;
} }
int FSA_MakeDir(int fd, char *path, u32 flags) { int FSA_MakeDir(int fd, char *path, u32 flags) {

View File

@ -31,7 +31,7 @@ int FSA_Mount(int fd, char *device_path, char *volume_path, u32 flags, char *arg
int FSA_Unmount(int fd, char *path, u32 flags); int FSA_Unmount(int fd, char *path, u32 flags);
int FSA_FlushVolume(int fd, char* volume_path); int FSA_FlushVolume(int fd, char *volume_path);
int FSA_GetDeviceInfo(int fd, char *device_path, int type, u32 *out_data); int FSA_GetDeviceInfo(int fd, char *device_path, int type, u32 *out_data);

View File

@ -110,8 +110,8 @@ static int ipc_ioctl(ipcmessage *message) {
memcpy(arguments, message->ioctl.buffer_in + 1, (size_arguments < 8 * 4) ? size_arguments : (8 * 4)); memcpy(arguments, message->ioctl.buffer_in + 1, (size_arguments < 8 * 4) ? size_arguments : (8 * 4));
// return error code as data // return error code as data
message->ioctl.buffer_io[0] = ((int (*const)(u32, u32, u32, u32, u32, u32, u32, u32)) (MCP_SVC_BASE + svc_id * 8))(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6], message->ioctl.buffer_io[0] = ((int (*const)(u32, u32, u32, u32, u32, u32, u32, u32)) (MCP_SVC_BASE + svc_id * 8))(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4],
arguments[7]); arguments[5], arguments[6], arguments[7]);
} }
break; break;
} }
@ -364,7 +364,7 @@ static int ipc_ioctl(ipcmessage *message) {
} }
case IOCTL_FSA_FLUSHVOLUME: { case IOCTL_FSA_FLUSHVOLUME: {
int fd = message->ioctl.buffer_in[0]; int fd = message->ioctl.buffer_in[0];
char *path = ((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[1]; char *path = ((char *) message->ioctl.buffer_in) + message->ioctl.buffer_in[1];
message->ioctl.buffer_io[0] = FSA_FlushVolume(fd, path); message->ioctl.buffer_io[0] = FSA_FlushVolume(fd, path);
break; break;

View File

@ -1,11 +1,5 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "wupserver.h" #include "wupserver.h"
#include "ipc.h" #include "ipc.h"
#include "svc.h"
#include "text.h"
#include "../../common/kernel_commands.h"
static int threadsStarted = 0; static int threadsStarted = 0;

View File

@ -21,7 +21,6 @@
#include "../../common/ipc_defs.h" #include "../../common/ipc_defs.h"
#include "fsa.h" #include "fsa.h"
#include "svc.h" #include "svc.h"
#include "utils.h"
#include <string.h> #include <string.h>
int (*const real_MCP_LoadFile)(ipcmessage *msg) = (void *) 0x0501CAA8 + 1; //+1 for thumb int (*const real_MCP_LoadFile)(ipcmessage *msg) = (void *) 0x0501CAA8 + 1; //+1 for thumb
@ -62,12 +61,12 @@ int _MCP_LoadFile_patch(ipcmessage *msg) {
int replace_fileoffset = rep_fileoffset; int replace_fileoffset = rep_fileoffset;
char *replace_path = rpxpath; char *replace_path = rpxpath;
if(strlen(request->name) > 1 && request->name[strlen(request->name)-1] == 'x'){ if (strlen(request->name) > 1 && request->name[strlen(request->name) - 1] == 'x') {
if (strncmp(request->name, "safe.rpx", strlen("safe.rpx")) != 0) { if (strncmp(request->name, "safe.rpx", strlen("safe.rpx")) != 0) {
//DEBUG_FUNCTION_LINE("set replace_valid to false\n"); //DEBUG_FUNCTION_LINE("set replace_valid to false\n");
replace_valid = false; replace_valid = false;
}else if(request->pos == 0){ } else if (request->pos == 0) {
if(replace_valid){ if (replace_valid) {
//DEBUG_FUNCTION_LINE("set doWantReplaceRPX to true\n"); //DEBUG_FUNCTION_LINE("set doWantReplaceRPX to true\n");
doWantReplaceRPX = true; doWantReplaceRPX = true;
} }
@ -95,7 +94,7 @@ int _MCP_LoadFile_patch(ipcmessage *msg) {
replace_filesize = 0; // unknown replace_filesize = 0; // unknown
replace_fileoffset = 0; replace_fileoffset = 0;
} }
}else if(!doWantReplaceRPX){ } else if (!doWantReplaceRPX) {
doWantReplaceRPX = false; // Only replace it once. doWantReplaceRPX = false; // Only replace it once.
replace_path = NULL; replace_path = NULL;
return real_MCP_LoadFile(msg); return real_MCP_LoadFile(msg);
@ -108,7 +107,7 @@ int _MCP_LoadFile_patch(ipcmessage *msg) {
if (result >= 0) { if (result >= 0) {
return result; return result;
} }
}else{ } else {
DEBUG_FUNCTION_LINE("replace_path was NULL\n"); DEBUG_FUNCTION_LINE("replace_path was NULL\n");
} }
@ -174,29 +173,29 @@ int _MCP_ReadCOSXml_patch(uint32_t u1, uint32_t u2, MCPPPrepareTitleInfo *xmlDat
if (xmlData->titleId == 0x000500101004E000 || if (xmlData->titleId == 0x000500101004E000 ||
xmlData->titleId == 0x000500101004E100 || xmlData->titleId == 0x000500101004E100 ||
xmlData->titleId == 0x000500101004E200) { xmlData->titleId == 0x000500101004E200) {
xmlData->codegen_size = 0x02000000; xmlData->codegen_size = 0x02000000;
xmlData->codegen_core = 0x80000001; xmlData->codegen_core = 0x80000001;
xmlData->max_size = 0x40000000; xmlData->max_size = 0x40000000;
// Set maximum codesize to 64 MiB // Set maximum codesize to 64 MiB
xmlData->max_codesize = 0x04000000; xmlData->max_codesize = 0x04000000;
xmlData->avail_size = 0; xmlData->avail_size = 0;
xmlData->overlay_arena = 0; xmlData->overlay_arena = 0;
// Give us full permissions everywhere // Give us full permissions everywhere
for (uint32_t i = 0; i < 19; i++) { for (uint32_t i = 0; i < 19; i++) {
xmlData->permissions[i].mask = 0xFFFFFFFFFFFFFFFF; xmlData->permissions[i].mask = 0xFFFFFFFFFFFFFFFF;
} }
xmlData->default_stack0_size = 0; xmlData->default_stack0_size = 0;
xmlData->default_stack1_size = 0; xmlData->default_stack1_size = 0;
xmlData->default_stack2_size = 0; xmlData->default_stack2_size = 0;
xmlData->default_redzone0_size = 0; xmlData->default_redzone0_size = 0;
xmlData->default_redzone1_size = 0; xmlData->default_redzone1_size = 0;
xmlData->default_redzone2_size = 0; xmlData->default_redzone2_size = 0;
xmlData->exception_stack0_size = 0x00001000; xmlData->exception_stack0_size = 0x00001000;
xmlData->exception_stack1_size = 0x00001000; xmlData->exception_stack1_size = 0x00001000;
xmlData->exception_stack2_size = 0x00001000; xmlData->exception_stack2_size = 0x00001000;
} }
} }

View File

@ -55,7 +55,8 @@ static int serverCommandHandler(u32 *command_buffer, u32 length) {
// return error code as data // return error code as data
out_length = 8; out_length = 8;
command_buffer[1] = ((int (*const)(u32, u32, u32, u32, u32, u32, u32, u32)) (MCP_SVC_BASE + svc_id * 8))(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7]); command_buffer[1] = ((int (*const)(u32, u32, u32, u32, u32, u32, u32, u32)) (MCP_SVC_BASE + svc_id * 8))(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5],
arguments[6], arguments[7]);
} }
break; break;
case 3: case 3:

View File

@ -1,6 +1,4 @@
#include <stdio.h> #include <cstring>
#include <string.h>
#include <string>
#include <coreinit/cache.h> #include <coreinit/cache.h>
#include <coreinit/ios.h> #include <coreinit/ios.h>