Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Maschell committed Sep 23, 2021
1 parent 235642b commit 73c8cfe
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion source/ElfUtils.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <stdint.h>
#include <cstdint>

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion source/gx2sploit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <coreinit/memorymap.h>
#include <whb/log.h>
#include <malloc.h>
#include <string.h>
#include <cstring>
#include <utils/logger.h>
#include "ElfUtils.h"
#include "gx2sploit.h"
Expand Down
2 changes: 1 addition & 1 deletion source/ios_kernel/source/instant_patches.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void instant_patches_setup(void) {
*(volatile u32 *) (0xe22830e0 - 0xe2280000 + 0x13140000) = 0x00000000;
*(volatile u32 *) (0xe22b2a78 - 0xe2280000 + 0x13140000) = 0x00000000;
*(volatile u32 *) (0xe204fb68 - 0xe2000000 + 0x12EC0000) = 0xe3a00000;

// Keep update patches
*(volatile u32 *) 0x0812A120 = ARM_BL(0x0812A120, kernel_launch_ios);

Expand Down
3 changes: 2 additions & 1 deletion source/ios_kernel/source/kernel_patches.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "utils.h"

extern void __KERNEL_CODE_START(void);

extern void __KERNEL_CODE_END(void);

void kernel_launch_ios(u32 launch_address, u32 L, u32 C, u32 H) {
Expand All @@ -51,7 +52,7 @@ void kernel_launch_ios(u32 launch_address, u32 L, u32 C, u32 H) {
void kernel_run_patches(u32 ios_elf_start) {
section_write(ios_elf_start, (u32) __KERNEL_CODE_START, __KERNEL_CODE_START, __KERNEL_CODE_END - __KERNEL_CODE_START);
section_write_word(ios_elf_start, 0x0812A120, ARM_BL(0x0812A120, kernel_launch_ios));

// update check
section_write_word(ios_elf_start, 0xe22830e0, 0x00000000);
section_write_word(ios_elf_start, 0xe22b2a78, 0x00000000);
Expand Down
23 changes: 10 additions & 13 deletions source/ios_kernel/source/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,21 @@
#define enable_interrupts ((int(*)(int))0x0812E78C)
#define kernel_bsp_command_5 ((int (*)(const char*, int offset, const char*, int size, void *buffer))0x0812EC40)

void reverse_memcpy(void* dest, const void* src, unsigned int size);
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));
return control_register;
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));
return control_register;
}

static inline void restore_mmu(unsigned int control_register)
{
asm volatile("MCR p15, 0, %0, c1, c0, 0" : : "r" (control_register));
static inline void restore_mmu(unsigned int 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));
static inline void set_domain_register(unsigned int domain_register) {
asm volatile("MCR p15, 0, %0, c3, c0, 0" : : "r" (domain_register));
}

#endif
18 changes: 9 additions & 9 deletions source/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
#include <coreinit/time.h>

#include <coreinit/foreground.h>
Expand Down Expand Up @@ -48,7 +48,7 @@ bool CheckRunning() {
}

extern "C" void _SYSLaunchMenuWithCheckingAccount(nn::act::SlotNo slot);
extern "C" void SYSLaunchMiiStudio(void * SysMiiStudioArgs);
extern "C" void SYSLaunchMiiStudio(void *SysMiiStudioArgs);

int main(int argc, char **argv) {
WHBLogUdpInit();
Expand All @@ -60,10 +60,10 @@ int main(int argc, char **argv) {
VPADRead(VPAD_CHAN_0, &vpad_data, 1, &err);

uint32_t btn = 0;
if(err == VPAD_READ_SUCCESS){
if (err == VPAD_READ_SUCCESS) {
btn = vpad_data.hold | vpad_data.trigger;
}

bool loadWithoutHacks = false;
bool kernelDone = false;
bool skipKernel = false;
Expand Down Expand Up @@ -94,10 +94,10 @@ int main(int argc, char **argv) {
if (entryPoint != 0) {
DEBUG_FUNCTION_LINE("New entrypoint at %08X", entryPoint);

char* arr[3];
char *arr[3];
arr[0] = argv[0];
arr[1] = (char*) "void forceDefaultTitleIDToWiiUMenu(void)";
arr[2] = (char*)&forceDefaultTitleIDToWiiUMenu;
arr[1] = (char *) "void forceDefaultTitleIDToWiiUMenu(void)";
arr[2] = (char *) &forceDefaultTitleIDToWiiUMenu;

int res = ((int (*)(int, char **)) entryPoint)(3, arr);
if (res >= 0) {
Expand Down Expand Up @@ -155,7 +155,7 @@ void forceDefaultTitleIDToWiiUMenu() {// Restore the default title id to the nor


void SplashScreen(int32_t durationInMs) {
int32_t screen_buf0_size = 0;
uint32_t screen_buf0_size;

// Init screen and screen buffers
OSScreenInit();
Expand Down

0 comments on commit 73c8cfe

Please sign in to comment.