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

View File

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