diff --git a/patch/src/patch.c b/patch/src/patch.c index 4678af9..3126f46 100644 --- a/patch/src/patch.c +++ b/patch/src/patch.c @@ -154,7 +154,7 @@ int __attribute__((section(".text_entry"))) _start(void) printf("Patch: Initializing heap between: 0x%x - 0x%x\n", ppc_patch_end, ppc_heap_end); // init heap - umm_init_heap(ppc_patch_end, (ppc_heap_end - ppc_patch_end)); + umm_init_heap((void *)ppc_patch_end, (ppc_heap_end - ppc_patch_end)); printf("Patch: Heap initialized, size: 0x%x (%i bytes)\n", ppc_heap_size, ppc_heap_size); diff --git a/patch/src/ppc_mon/src/commands.c b/patch/src/ppc_mon/src/commands.c index 3f58193..05cedce 100644 --- a/patch/src/ppc_mon/src/commands.c +++ b/patch/src/ppc_mon/src/commands.c @@ -106,12 +106,10 @@ static int command_mem() counter++; } while (counter < len); - - } else { - printf("Invalid action: %c\n", *rw); - return -1; } + printf("Invalid action: %c\n", *rw); + return -1; } /* Reg commands: @@ -255,13 +253,10 @@ static int command_reg() counter++; } while (counter < len); + } - } else { - printf("Invalid action: %c\n", *rw); - return -1; - } - - + printf("Invalid action: %c\n", *rw); + return -1; } /* Dump commands: @@ -663,7 +658,7 @@ static int command_gte() char *rw = pm_parser_get_argv_ptr(1); char *reg = pm_parser_get_argv_ptr(2); - uint32_t value = pm_parser_get_argv_ptr(3); + uint32_t value = pm_parser_get_argv_dec(3); uint32_t reg_num = 0; uint32_t readback = 0; @@ -811,7 +806,7 @@ static int command_gte() static int command_xparam() { //TEMP: - void *xparam_str_ptr = 0xbe0a30; + void *xparam_str_ptr = (void *)0xbe0a30; char *rw = pm_parser_get_argv_ptr(1); uint32_t num = pm_parser_get_argv_dec(2); @@ -841,10 +836,10 @@ static int command_xparam() } else { printf("XPARAM %i does not exist\n", num); } - } else { - printf("Invalid action: %c\n", *rw); - return -1; - } + } + + printf("Invalid action: %c\n", *rw); + return -1; } /* Emulator commands: @@ -1148,10 +1143,10 @@ static int command_settings() default: break; } - } else { - printf("Invalid action %c\n", *drw); - return -1; - } + } + + printf("Invalid action %c\n", *drw); + return -1; } /* TODO: PPC core commands: @@ -1205,11 +1200,10 @@ static int command_ppc() } else if (*drw == 'r') { } else if (*drw == 'w') { + } - } else { - printf("Invalid action: %c\n", *drw); - return -1; - } + printf("Invalid action: %c\n", *drw); + return -1; } /* Debug commands: @@ -1220,7 +1214,7 @@ static int command_ppc() * arg2: * arg3:
*/ -static void command_debug() +static int command_debug() { char *action = pm_parser_get_argv_ptr(1); char *option = pm_parser_get_argv_ptr(2); @@ -1286,6 +1280,8 @@ static void command_debug() default: break; } + + return 0; } pm_cmd_t pm_core_cmds[] = { @@ -1398,7 +1394,7 @@ pm_cmd_t pm_core_cmds[] = { }, { .name = "debug", - .help = "debug
", + .help = "debug
\n" "debug ", .func = &command_debug } diff --git a/patch/src/ppc_mon/src/ppc_mon.c b/patch/src/ppc_mon/src/ppc_mon.c index de14dad..519fefa 100644 --- a/patch/src/ppc_mon/src/ppc_mon.c +++ b/patch/src/ppc_mon/src/ppc_mon.c @@ -84,7 +84,7 @@ static int ascii_hex_to_int(char *str) int pm_parser_get_argc() { int argc = 1; - char *str = &rx_buf; + char *str = rx_buf; while (*str != '\0') { //Ignore extra whitespace @@ -102,7 +102,7 @@ int pm_parser_get_argv_len(int n) uint32_t arg = 0; uint32_t len = 0; - char *str = &rx_buf; + char *str = rx_buf; while (*str != '\0') { @@ -126,7 +126,7 @@ char *pm_parser_get_argv_ptr(int n) uint32_t arg = 0; uint32_t pos = 0; - char *str = &rx_buf; + char *str = rx_buf; while (*str != '\0') { @@ -150,7 +150,7 @@ int pm_parser_get_argv_dec(int n) uint32_t argc = 0; uint32_t value = 0; - char *str = &rx_buf; + char *str = rx_buf; while (*str != '\0') { @@ -360,7 +360,7 @@ void pm_rx() add_event(pm_settings.event_cycles, &pm_rx, 0); //Poll UART status register - while (*(uint8_t*)(0x01000205) & 1 != 0) { + while ((*(uint8_t*)(0x01000205) & 1) != 0) { //Read char from UART FIFO c = *(char*)(0x01000200); @@ -478,7 +478,7 @@ void pm_start() debug_uart_init(pm_settings.baud); //Register PPC-MON core commands, mem, reg, mips, etc - pm_register_cmds(&pm_core_cmds, 12); + pm_register_cmds(pm_core_cmds, 12); //Preserve PPC-MON RX event through mode reset (PS2 <-> PS1) debug_run_on_reset(&pm_rx); diff --git a/patch_loader_ee/main.c b/patch_loader_ee/main.c index 4b909e0..f2b95af 100644 --- a/patch_loader_ee/main.c +++ b/patch_loader_ee/main.c @@ -1,10 +1,14 @@ #include #include #include +#include #include #include #include #include +#include +#include +#include extern unsigned char ppcpatchman_irx[]; extern unsigned int size_ppcpatchman_irx;