From 3b4613249b873fc702f16d389186312bb1ce90d6 Mon Sep 17 00:00:00 2001 From: giantpune Date: Wed, 30 Sep 2009 23:32:59 +0000 Subject: [PATCH] support exiting to both tid for hbc. when you press exit to homebrew channel (and was not started from homebrew channel so he can't use the stub) he will look for HAXX and JODI and boot the first one he sees. --- gui.pnproj | 2 +- source/prompts/PromptWindows.cpp | 4 +-- source/usbloader/apploader.c | 24 +----------------- source/wad/title.c | 42 ++++++++++++++++++++++++++++++++ source/wad/title.h | 3 +++ 5 files changed, 49 insertions(+), 26 deletions(-) diff --git a/gui.pnproj b/gui.pnproj index bdcf7498..941d9393 100644 --- a/gui.pnproj +++ b/gui.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index b96c9b2d..b9c0719c 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -926,7 +926,8 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label, ShutdownAudio(); StopGX(); WII_Initialize(); - WII_LaunchTitle(TITLE_ID(0x00010001,0x48415858)); + WII_BootHBC(); + } choice = 2; } @@ -3408,4 +3409,3 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version, return choice; } - diff --git a/source/usbloader/apploader.c b/source/usbloader/apploader.c index e4c6af88..d9626f47 100644 --- a/source/usbloader/apploader.c +++ b/source/usbloader/apploader.c @@ -13,15 +13,10 @@ #include "fstfile.h" #include "settings/cfg.h" -#define BC 0x0000000100000100ULL -#define MIOS 0x0000000100000101ULL -static tikview view ATTRIBUTE_ALIGN(32); - /*KENOBI! - FISHEARS*/ extern const unsigned char kenobiwii[]; extern const int kenobiwii_size; /*KENOBI! - FISHEARS*/ -extern u8 dvdMounted; /* Apploader function pointers */ typedef int (*app_main)(void **dst, int *size, int *offset); @@ -309,24 +304,7 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 if (ret < 0) return ret; - if (dvdMounted==2) - { - int retval; - retval = ES_GetTicketViews(BC, &view, 1); - if (retval != 0){ - // error. do something smart here like exit. anything besides return 0; - return 0; - } - - WPAD_Shutdown(); - *(volatile unsigned int *)0xCC003024 |= 7; - - retval = ES_LaunchTitle(BC, &view); // bushing's code - return 0; - } - - - /* Set apploader entry function */ + /* Set apploader entry function */ appldr_entry = (app_entry)buffer[4]; /* Call apploader entry */ diff --git a/source/wad/title.c b/source/wad/title.c index ff73e303..8e493935 100644 --- a/source/wad/title.c +++ b/source/wad/title.c @@ -820,6 +820,48 @@ s32 getTitles_Type(u32 type, u32 *titles, u32 count) { } +//this function expects initialize be called before it is called +// if not, it will fail miserably and catch the wii on fire and kick you in the nuts +#define TITLE_ID(x,y) (((u64)(x) << 32) | (y)) +s32 WII_BootHBC() +{ + u32 tmdsize; + u64 tid = 0; + u64 *list; + u32 titlecount; + s32 ret; + u32 i; + + ret = ES_GetNumTitles(&titlecount); + if(ret < 0) + return WII_EINTERNAL; + + list = memalign(32, titlecount * sizeof(u64) + 32); + + ret = ES_GetTitles(list, titlecount); + if(ret < 0) { + free(list); + return WII_EINTERNAL; + } + + for(i=0; i