From 999e8c18170f8c73235da51b34ace91e4ca77322 Mon Sep 17 00:00:00 2001 From: giantpune Date: Thu, 24 Dec 2009 08:33:53 +0000 Subject: [PATCH] *add a little debug text after the GUI if loaded from HBC to help track down the ocarina issues *take the IOS reload out of the slow usb loop *use patchhook.S from new geckoOS. this doesnt mean all the new geckoOS stuff will work, its just the S file --- HBC/META.XML | 4 +-- source/main.cpp | 16 +++++++---- source/menu.cpp | 7 +++++ source/patches/fst.c | 8 ++++++ source/patches/patchhook.S | 55 +++++++++++++++++------------------- source/sys.cpp | 4 +-- source/usbloader/apploader.c | 1 + source/video.cpp | 24 ++++++++++++++++ source/video.h | 1 + 9 files changed, 82 insertions(+), 38 deletions(-) diff --git a/HBC/META.XML b/HBC/META.XML index c6d8928f..43deb573 100644 --- a/HBC/META.XML +++ b/HBC/META.XML @@ -2,8 +2,8 @@ USB Loader GX USB Loader GX Team - 1.0 r874 - 200912202000 + 1.0 r875 + 200912230428 Loads games from USB-devices USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times. The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller. diff --git a/source/main.cpp b/source/main.cpp index ec8c1905..90e4533c 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -63,6 +63,8 @@ FreeTypeGX *fontSystem=0; FreeTypeGX *fontClock=0; PartList partitions; +u8 dbvideo =0; + static void BootUpProblems() { s32 ret2; @@ -88,7 +90,7 @@ static void BootUpProblems() time_t curtime; time_t endtime = time(0) + 30; do { - ret2 = IOS_ReloadIOSsafe(249); + /*ret2 = IOS_ReloadIOSsafe(249); if (ret2 < 0) { ret2 = IOS_ReloadIOSsafe(222); SDCard_Init(); @@ -102,7 +104,7 @@ static void BootUpProblems() sleep(5); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); } - } + }*/ ret2 = WBFS_Init(WBFS_DEVICE_USB); if (ret2 >= 0) { @@ -141,9 +143,12 @@ static void BootUpProblems() unsigned int *xfb = NULL; void InitTextVideo () { - - if (textVideoInit)return; - +gprintf("\nInitTextVideo ()"); + if (textVideoInit){ + gprintf("...0"); + return; + } + dbvideo=1; VIDEO_Init(); GXRModeObj *vmode = VIDEO_GetPreferredMode(NULL); // get default video mode @@ -169,6 +174,7 @@ void InitTextVideo () { //send console output to the gecko if (geckoinit)CON_EnableGecko(1, true); textVideoInit = true; + gprintf("...1"); } diff --git a/source/menu.cpp b/source/menu.cpp index 4b268cd3..3094e59d 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -69,6 +69,8 @@ extern u8 shutdown; extern u8 reset; extern s32 gameSelected, gameStart; extern u8 boothomebrew; +extern u8 dbvideo; + /**************************************************************************** * ResumeGui @@ -345,6 +347,11 @@ int MainMenu(int menu) { StopGX(); gettextCleanUp(); + if(dbvideo) + { + InitVideodebug (); + printf("\n\n\n\n\n"); + } if (mountMethod==3) { struct discHdr *header = &gameList[gameSelected]; diff --git a/source/patches/fst.c b/source/patches/fst.c index 9fb4ce30..8da88968 100644 --- a/source/patches/fst.c +++ b/source/patches/fst.c @@ -48,6 +48,7 @@ u8 filebuff[MAX_GCT_SIZE]; u32 do_sd_code(char *filename) { gprintf("\ndo_sd_code(%s)",filename); +printf("\ndo_sd_code(%s)",filename); FILE *fp; //u8 *filebuff; @@ -70,6 +71,8 @@ gprintf("\ndo_sd_code(%s)",filename); USBDevice_deInit(); SDCard_deInit(); gprintf("\n\tcan't open %s",filepath); + printf("\n\tcan't open %s",filepath); + sleep(10); return 0; } @@ -81,6 +84,8 @@ gprintf("\ndo_sd_code(%s)",filename); USBDevice_deInit(); SDCard_deInit(); gprintf("\n\tError. size = %d",filesize); + printf("\n\tError. size = %d",filesize); + sleep(10); return 0; } fseek(fp, 0, SEEK_SET); @@ -92,6 +97,8 @@ gprintf("\ndo_sd_code(%s)",filename); USBDevice_deInit(); SDCard_deInit(); gprintf("\n\tError. ret != size"); + printf("\n\tError. ret != size"); + sleep(10); return 0; } fclose(fp); @@ -105,6 +112,7 @@ gprintf("\ndo_sd_code(%s)",filename); gprintf("\n\tDone"); + printf("...Done"); return 1; } diff --git a/source/patches/patchhook.S b/source/patches/patchhook.S index a90151e1..865e3417 100644 --- a/source/patches/patchhook.S +++ b/source/patches/patchhook.S @@ -1,7 +1,11 @@ - - # (c) Nuke www.usbgecko.com. Licensed under GPL V2 .text -#include "ppc.h" +.set r0,0; .set sp,1; .set r2,2; .set r3,3; .set r4,4 +.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 +.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 +.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 +.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 +.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 +.set r30,30; .set r31,31 .globl patchhook # r3 address @@ -31,8 +35,8 @@ writebranch: icbi r0, r3 exit: blr # return - -.globl patchhook2 # r3 address + + .globl patchhook2 # r3 address patchhook2: mtctr r4 lis r6, 0x4E80 @@ -82,28 +86,6 @@ writebl: exit3: blr # return -.globl patchhook4 # r3 address -patchhook4: - mtctr r4 - lis r6, 0x4082 - ori r6, r6, 0x001C # blr -findregion: - lwz r5, 0(r3) - cmpw r6, r5 - beq writebr - addi r3, r3, 4 # next word - bdnz findregion # loop length - b exit4 # stop unhooked game hanging - -writebr: - lis r4, 0x4800 - ori r4, r4, 0x001C - stw r4, 0(r3) # result in r3 - dcbf r0, r3 # data cache block flush - icbi r0, r3 -exit4: - blr # return - .globl multidolpatchone # r3 address multidolpatchone: mtctr r4 @@ -163,6 +145,22 @@ writemulti2: isync exit6: blr # return + +.globl multidolhook # r3 address +multidolhook: + lis r4, 0x8000 # 80001000 hook location (source) + ori r4, r4, 0x1000 + subf r4, r3, r4 # subtract r3 from r4 and place in r4 + lis r5, 0x3FF + ori r5, r5, 0xFFFF # 0x3FFFFFF + and r4, r4, r5 + lis r5, 0x4800 # 0x48000000 + or r4, r4, r5 + stw r4, 0(r3) # result in r3 + dcbf r0, r3 # data cache block flush + icbi r0, r3 + blr # return + .globl langvipatch # r3 address, r4 len, r5 lang byte langvipatch: @@ -187,7 +185,7 @@ gofinal: icbi r0, r3 exitlang: blr # return - + .globl vipatch # r3 address vipatch: mtctr r4 @@ -505,4 +503,3 @@ writemd1: icbi r0, r3 exitmd1: blr # return - diff --git a/source/sys.cpp b/source/sys.cpp index b76e5e66..18996532 100644 --- a/source/sys.cpp +++ b/source/sys.cpp @@ -232,14 +232,14 @@ s32 IOS_ReloadIOSsafe(int ios) if (ios222rev == -69) ios222rev = getIOSrev(0x00000001000000dell); - if (ios222rev >= 0 && ios222rev != 4)return -2; + if (ios222rev >= 0 && (ios222rev != 4 && ios222rev != 5))return -2; } else if (ios==223) { if (ios223rev == -69) ios223rev = getIOSrev(0x00000001000000dfll); - if (ios223rev >= 0 && ios223rev != 4)return -2; + if (ios223rev >= 0 && (ios223rev != 4 && ios223rev != 5))return -2; } else if (ios==249) { diff --git a/source/usbloader/apploader.c b/source/usbloader/apploader.c index a6e37831..58d6f93e 100644 --- a/source/usbloader/apploader.c +++ b/source/usbloader/apploader.c @@ -408,6 +408,7 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 hooktype = 1; memcpy((void*)0x80001800, (char*)0x80000000, 6); // For WiiRD /*HOOKS STUFF - FISHEARS*/ + printf("\n\tcode handler loaded"); } for (;;) { diff --git a/source/video.cpp b/source/video.cpp index 743e82ae..8b8cbf4d 100644 --- a/source/video.cpp +++ b/source/video.cpp @@ -198,7 +198,31 @@ InitVideo () { ResetVideo_Menu(); // Finally, the video is up and ready for use :) } +static unsigned int *xfbDB = NULL; +void InitVideodebug () { + VIDEO_Init(); + GXRModeObj *vmode = VIDEO_GetPreferredMode(NULL); // get default video mode + + // widescreen fix + VIDEO_Configure (vmode); + + // Allocate the video buffers + xfbDB = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode)); + + // A console is always useful while debugging + console_init (xfbDB, 20, 64, vmode->fbWidth, vmode->xfbHeight, vmode->fbWidth * 2); + + // Clear framebuffers etc. + VIDEO_ClearFrameBuffer (vmode, xfbDB, COLOR_BLACK); + VIDEO_SetNextFramebuffer (xfbDB); + + VIDEO_SetBlack (FALSE); + VIDEO_Flush (); + VIDEO_WaitVSync (); + if (vmode->viTVMode & VI_NON_INTERLACE) + VIDEO_WaitVSync (); +} /**************************************************************************** * StopGX * diff --git a/source/video.h b/source/video.h index bf2cca9d..205f9950 100644 --- a/source/video.h +++ b/source/video.h @@ -12,6 +12,7 @@ #include void InitVideo (); +void InitVideodebug(); void StopGX(); void ResetVideo_Menu(); void Menu_Render();