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.

This commit is contained in:
giantpune 2009-09-30 23:32:59 +00:00
parent 1cc7d3acd6
commit 3b4613249b
5 changed files with 49 additions and 26 deletions

File diff suppressed because one or more lines are too long

View File

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

View File

@ -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,23 +304,6 @@ 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 */
appldr_entry = (app_entry)buffer[4];

View File

@ -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<titlecount; i++) {
if (list[i]==TITLE_ID(0x00010001,0x4A4F4449)
|| list[i]==TITLE_ID(0x00010001,0x48415858))
{
tid = list[i];
break;
}
}
free(list);
if(!tid)
return WII_EINSTALL;
if(ES_GetStoredTMDSize(tid, &tmdsize) < 0)
return WII_EINSTALL;
return WII_LaunchTitle(tid);
}

View File

@ -64,6 +64,9 @@ extern "C" {
//check for a game save present on nand based on game ID
int CheckForSave(const char *gameID);
//boot HBC in either HAXX or JODI locations
s32 WII_BootHBC();
#ifdef __cplusplus
}
#endif