*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
This commit is contained in:
giantpune 2009-12-24 08:33:53 +00:00
parent 5b6a6e98df
commit 999e8c1817
9 changed files with 82 additions and 38 deletions

View File

@ -2,8 +2,8 @@
<app version="1">
<name> USB Loader GX</name>
<coder>USB Loader GX Team</coder>
<version>1.0 r874</version>
<release_date>200912202000</release_date>
<version>1.0 r875</version>
<release_date>200912230428</release_date>
<short_description>Loads games from USB-devices</short_description>
<long_description>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.

View File

@ -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");
}

View File

@ -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];

View File

@ -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;
}

View File

@ -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
@ -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
@ -164,6 +146,22 @@ writemulti2:
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:
mtctr r4
@ -505,4 +503,3 @@ writemd1:
icbi r0, r3
exitmd1:
blr # return

View File

@ -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)
{

View File

@ -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 (;;) {

View File

@ -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
*

View File

@ -12,6 +12,7 @@
#include <ogcsys.h>
void InitVideo ();
void InitVideodebug();
void StopGX();
void ResetVideo_Menu();
void Menu_Render();