Improve logging

This commit is contained in:
Maschell 2020-08-23 10:37:31 +02:00
parent 215a5d4156
commit 666d3c2bd4
3 changed files with 10 additions and 9 deletions

View File

@ -101,7 +101,7 @@ static void InstallMain(void *data_elf) {
unsigned char *main_text = data_elf + section_offset; unsigned char *main_text = data_elf + section_offset;
/* Copy main .text to memory */ /* Copy main .text to memory */
if (section_offset > 0) { if (section_offset > 0) {
WHBLogPrintf("%08X %08X %d", main_text_addr, main_text, main_text_len); DEBUG_FUNCTION_LINE("Copy section to %08X from %08X (size: %d)", main_text_addr, main_text, main_text_len);
memcpy((void *) (main_text_addr), (void *) main_text, main_text_len); memcpy((void *) (main_text_addr), (void *) main_text, main_text_len);
DCFlushRange((void *) main_text_addr, main_text_len); DCFlushRange((void *) main_text_addr, main_text_len);
ICInvalidateRange((void *) main_text_addr, main_text_len); ICInvalidateRange((void *) main_text_addr, main_text_len);

View File

@ -12,6 +12,7 @@
#include <whb/log.h> #include <whb/log.h>
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#include <utils/logger.h>
#include "ElfUtils.h" #include "ElfUtils.h"
#include "gx2sploit.h" #include "gx2sploit.h"
@ -201,7 +202,7 @@ static void SCSetupIBAT4DBAT5() {
extern "C" void SC_0x36_SETBATS(void); extern "C" void SC_0x36_SETBATS(void);
int DoKernelExploit(void) { int DoKernelExploit(void) {
WHBLogPrintf("Running GX2Sploit"); DEBUG_FUNCTION_LINE("Running GX2Sploit");
/* Make a thread to modify the semaphore */ /* Make a thread to modify the semaphore */
OSThread *thread = (OSThread *) memalign(8, 0x1000); OSThread *thread = (OSThread *) memalign(8, 0x1000);
uint8_t *stack = (uint8_t *) memalign(0x40, 0x2000); uint8_t *stack = (uint8_t *) memalign(0x40, 0x2000);
@ -268,6 +269,6 @@ int DoKernelExploit(void) {
/* repair data */ /* repair data */
KernelWrite(targetAddress, backupBuffer, sizeof(backupBuffer)); KernelWrite(targetAddress, backupBuffer, sizeof(backupBuffer));
DCFlushRange((void *) targetAddress, sizeof(backupBuffer)); DCFlushRange((void *) targetAddress, sizeof(backupBuffer));
WHBLogPrintf("GX2Sploit done"); DEBUG_FUNCTION_LINE("GX2Sploit done");
return 1; return 1;
} }

View File

@ -42,7 +42,7 @@ bool CheckRunning() {
int main(int argc, char **argv) { int main(int argc, char **argv) {
WHBLogUdpInit(); WHBLogUdpInit();
WHBLogPrintf("Hello!"); DEBUG_FUNCTION_LINE("Hello!");
VPADReadError err; VPADReadError err;
VPADStatus vpad_data; VPADStatus vpad_data;
@ -62,14 +62,14 @@ int main(int argc, char **argv) {
} }
if ((btn & VPAD_BUTTON_ZL) == VPAD_BUTTON_ZL) { if ((btn & VPAD_BUTTON_ZL) == VPAD_BUTTON_ZL) {
// In case that fopen check is not working... // In case that fopen check is not working...
WHBLogPrintf("Force kernel exploit"); DEBUG_FUNCTION_LINE("Force kernel exploit");
kernelDone = true; kernelDone = true;
DoKernelExploit(); DoKernelExploit();
} }
if (!kernelDone && !skipKernel) { if (!kernelDone && !skipKernel) {
if (fopen("fs:/vol/external01/wiiu/payload.elf", "r") != NULL) { if (fopen("fs:/vol/external01/wiiu/payload.elf", "r") != NULL) {
WHBLogPrintf("We need the kernel exploit to load the payload"); DEBUG_FUNCTION_LINE("We need the kernel exploit to load the payload");
DoKernelExploit(); DoKernelExploit();
} }
} }
@ -77,10 +77,10 @@ int main(int argc, char **argv) {
if (!loadWithoutHacks) { if (!loadWithoutHacks) {
uint32_t entryPoint = load_loader_elf_from_sd(0, "wiiu/payload.elf"); uint32_t entryPoint = load_loader_elf_from_sd(0, "wiiu/payload.elf");
if (entryPoint != 0) { if (entryPoint != 0) {
WHBLogPrintf("New entrypoint: %08X", entryPoint); DEBUG_FUNCTION_LINE("New entrypoint at %08X", entryPoint);
int res = ((int (*)(int, char **)) entryPoint)(argc, argv); int res = ((int (*)(int, char **)) entryPoint)(argc, argv);
if (res > 0) { if (res > 0) {
WHBLogPrintf("Returning..."); DEBUG_FUNCTION_LINE("Returning result of payload");
WHBLogUdpDeinit(); WHBLogUdpDeinit();
return 0; return 0;
} }
@ -98,7 +98,7 @@ int main(int argc, char **argv) {
memcpy((void *) 0xF417FFF0, &sysmenuIdUll, 8); memcpy((void *) 0xF417FFF0, &sysmenuIdUll, 8);
DCStoreRange((void *) 0xF417FFF0, 0x8); DCStoreRange((void *) 0xF417FFF0, 0x8);
DEBUG_FUNCTION_LINE("Forcing start of title: %016llX\n", sysmenuIdUll); DEBUG_FUNCTION_LINE("Forcing start of title: %016llX", sysmenuIdUll);
ExecuteIOSExploit(); ExecuteIOSExploit();
SYSLaunchMenu(); SYSLaunchMenu();