-fixed using usb gecko debugger without cheats enabled

This commit is contained in:
fix94.1 2012-10-20 17:57:09 +00:00
parent 1fc6250f04
commit 3168e5660c
2 changed files with 34 additions and 24 deletions

View File

@ -74,19 +74,19 @@ void ocarina_set_codes(void *list, u8 *listend, u8 *cheats, u32 cheatSize)
code_size = cheatSize; code_size = cheatSize;
if(code_size <= 0) if(code_size <= 0)
{ {
gprintf("Ocarina: No codes found\n"); //gprintf("Ocarina: No codes found\n");
code_buf = NULL; code_buf = NULL;
code_size = 0; code_size = 0;
return; return;
} }
if (code_size > (u32)codelistend - (u32)codelist) if (code_size > (u32)codelistend - (u32)codelist)
{ {
gprintf("Ocarina: Too many codes found\n"); gprintf("Ocarina: Too many codes found.\n");
code_buf = NULL; code_buf = NULL;
code_size = 0; code_size = 0;
return; return;
} }
gprintf("Ocarina: Codes found.\n"); //gprintf("Ocarina: Codes found.\n");
} }
void app_pokevalues() void app_pokevalues()
@ -142,34 +142,43 @@ void load_handler()
{ {
if(debuggerselect == 0x01) if(debuggerselect == 0x01)
{ {
//printf("Debbugger selected is gecko\n"); gprintf("Ocarina: Debugger selected.\n");
memset((void*)0x80001800,0,codehandler_size); memcpy((void*)0x80001800, codehandler, codehandler_size);
memcpy((void*)0x80001800,codehandler,codehandler_size);
//if (pausedstartoption == 0x01) //if (pausedstartoption == 0x01)
// *(u32*)0x80002798 = 1; // *(u32*)0x80002798 = 1;
if(code_size > 0 && code_buf)
{
gprintf("Ocarina: Codes found.\n");
memcpy((void*)0x80001CDE, &codelist, 2); memcpy((void*)0x80001CDE, &codelist, 2);
memcpy((void*)0x80001CE2, ((u8*) &codelist) + 2, 2); memcpy((void*)0x80001CE2, ((u8*) &codelist) + 2, 2);
memcpy((void*)0x80001F5A, &codelist, 2); memcpy((void*)0x80001F5A, &codelist, 2);
memcpy((void*)0x80001F5E, ((u8*) &codelist) + 2, 2); memcpy((void*)0x80001F5E, ((u8*) &codelist) + 2, 2);
DCFlushRange((void*)0x80001800,codehandler_size); }
ICInvalidateRange((void*)0x80001800,codehandler_size); else
gprintf("Ocarina: No Codes found.\n");
DCFlushRange((void*)0x80001800, codehandler_size);
ICInvalidateRange((void*)0x80001800, codehandler_size);
} }
else else
{ {
//printf("Debbugger selected is not gecko\n"); gprintf("Ocarina: No Debugger selected.\n");
memset((void*)0x80001800,0,codehandleronly_size); memcpy((void*)0x80001800, codehandleronly, codehandleronly_size);
memcpy((void*)0x80001800,codehandleronly,codehandleronly_size); if(code_size > 0 && code_buf)
{
gprintf("Ocarina: Codes found.\n");
memcpy((void*)0x80001906, &codelist, 2); memcpy((void*)0x80001906, &codelist, 2);
memcpy((void*)0x8000190A, ((u8*) &codelist) + 2, 2); memcpy((void*)0x8000190A, ((u8*) &codelist) + 2, 2);
DCFlushRange((void*)0x80001800,codehandleronly_size); }
ICInvalidateRange((void*)0x80001800,codehandleronly_size); else
gprintf("Ocarina: No Codes found.\n");
DCFlushRange((void*)0x80001800, codehandleronly_size);
ICInvalidateRange((void*)0x80001800, codehandleronly_size);
} }
// Load multidol handler // Load multidol handler
memset((void*)0x80001000,0,multidol_size); memcpy((void*)0x80001000, multidol, multidol_size);
memcpy((void*)0x80001000,multidol,multidol_size); DCFlushRange((void*)0x80001000, multidol_size);
DCFlushRange((void*)0x80001000,multidol_size); ICInvalidateRange((void*)0x80001000, multidol_size);
ICInvalidateRange((void*)0x80001000,multidol_size);
switch(hooktype) switch(hooktype)
{ {
case 0x01: case 0x01:

View File

@ -27,6 +27,7 @@
#include "apploader.h" #include "apploader.h"
#include "patchcode.h" #include "patchcode.h"
#include "memory.h" #include "memory.h"
#include "gecko.h"
u32 hooktype; u32 hooktype;
u8 configbytes[2]; u8 configbytes[2];
@ -323,7 +324,7 @@ bool PatchReturnTo( void *Address, int Size, u32 id )
//if the function is found //if the function is found
if( found == 3 && ad[ 3 ] ) if( found == 3 && ad[ 3 ] )
{ {
//gprintf("patch __OSLaunchMenu( 0x00010001, 0x%08x )\n", id); gprintf("patch __OSLaunchMenu( 0x00010001, 0x%08x )\n", id);
u32 nop = 0x60000000; u32 nop = 0x60000000;
//the magic that writes the TID to the registers //the magic that writes the TID to the registers