mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-22 03:09:15 +01:00
Correctly boot forwarder channels
This commit is contained in:
parent
ed7daf977c
commit
c23ea99704
@ -96,11 +96,11 @@ void Channels::InternalGetNandChannelList(u32 type)
|
|||||||
if (!tid)
|
if (!tid)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//these can't be booted anyways
|
// These can't be booted anyways
|
||||||
if (TITLE_LOWER(tid) == 0x48414741 || TITLE_LOWER(tid) == 0x48414141 || TITLE_LOWER(tid) == 0x48414641)
|
if (TITLE_LOWER(tid) == 0x48414741 || TITLE_LOWER(tid) == 0x48414141 || TITLE_LOWER(tid) == 0x48414641)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//these aren't installed on the nand
|
// These aren't installed on the nand
|
||||||
if (!NandTitles.Exists(tid))
|
if (!NandTitles.Exists(tid))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -159,8 +159,10 @@ std::vector<struct discHdr> &Channels::GetEmuHeaders(void)
|
|||||||
return EmuChannels;
|
return EmuChannels;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 *Channels::GetDol(const u64 &title, u8 *tmdBuffer)
|
u8 *Channels::GetDol(const u64 &title, u8 *tmdBuffer, bool &isForwarder)
|
||||||
{
|
{
|
||||||
|
static const u8 dolsign[6] = {0x00, 0x00, 0x01, 0x00, 0x00, 0x00};
|
||||||
|
static u8 dolhead[32] ATTRIBUTE_ALIGN(32);
|
||||||
u8 *buffer = NULL;
|
u8 *buffer = NULL;
|
||||||
u32 filesize = 0;
|
u32 filesize = 0;
|
||||||
u32 bootcontent = 0xDEADBEAF;
|
u32 bootcontent = 0xDEADBEAF;
|
||||||
@ -175,15 +177,45 @@ u8 *Channels::GetDol(const u64 &title, u8 *tmdBuffer)
|
|||||||
|
|
||||||
if (!Settings.UseChanLauncher)
|
if (!Settings.UseChanLauncher)
|
||||||
{
|
{
|
||||||
|
// Channels and VC
|
||||||
for (u32 i = 0; i < tmd_file->num_contents; ++i)
|
for (u32 i = 0; i < tmd_file->num_contents; ++i)
|
||||||
{
|
{
|
||||||
// It won't match a dol signature
|
if (tmd_file->contents[i].index == tmd_file->boot_index)
|
||||||
if (tmd_file->contents[i].index == 1)
|
continue; // Skip loader
|
||||||
|
|
||||||
|
snprintf(filepath, ISFS_MAXPATH, "/title/%08x/%08x/content/%08x.app", (unsigned int)high, (unsigned int)low, (unsigned int)tmd_file->contents[i].cid);
|
||||||
|
|
||||||
|
s32 fd = ISFS_Open(filepath, ISFS_OPEN_READ);
|
||||||
|
if (fd < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
s32 ret = ISFS_Read(fd, dolhead, 32);
|
||||||
|
ISFS_Close(fd);
|
||||||
|
|
||||||
|
if (ret != 32)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (memcmp(dolhead, dolsign, sizeof(dolsign)) == 0)
|
||||||
{
|
{
|
||||||
|
// Normal channels and VC use 1
|
||||||
|
if (tmd_file->contents[i].index != 1)
|
||||||
|
isForwarder = true;
|
||||||
bootcontent = tmd_file->contents[i].cid;
|
bootcontent = tmd_file->contents[i].cid;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// WiiWare not matching a dol signature
|
||||||
|
if (bootcontent == 0xDEADBEAF)
|
||||||
|
{
|
||||||
|
for (u32 i = 0; i < tmd_file->num_contents; ++i)
|
||||||
|
{
|
||||||
|
if (tmd_file->contents[i].index == 1)
|
||||||
|
{
|
||||||
|
bootcontent = tmd_file->contents[i].cid;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Fall back to boot content if dol is not found
|
//! Fall back to boot content if dol is not found
|
||||||
@ -300,7 +332,8 @@ u32 Channels::LoadChannel(const u64 &chantitle)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 *chanDOL = GetDol(chantitle, tmdBuffer);
|
bool isForwarder = false;
|
||||||
|
u8 *chanDOL = GetDol(chantitle, tmdBuffer, isForwarder);
|
||||||
if (!chanDOL)
|
if (!chanDOL)
|
||||||
{
|
{
|
||||||
ISFS_Deinitialize();
|
ISFS_Deinitialize();
|
||||||
@ -372,7 +405,8 @@ u32 Channels::LoadChannel(const u64 &chantitle)
|
|||||||
|
|
||||||
// IOS Version Check
|
// IOS Version Check
|
||||||
*(vu32 *)0x80003140 = ((ios << 16)) | 0xFFFF;
|
*(vu32 *)0x80003140 = ((ios << 16)) | 0xFFFF;
|
||||||
*(vu32 *)0x80003188 = ((ios << 16)) | 0xFFFF;
|
if (!isForwarder)
|
||||||
|
*(vu32 *)0x80003188 = ((ios << 16)) | 0xFFFF;
|
||||||
|
|
||||||
ISFS_Deinitialize();
|
ISFS_Deinitialize();
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public:
|
|||||||
static u32 LoadChannel(const u64 &chantitle);
|
static u32 LoadChannel(const u64 &chantitle);
|
||||||
static u8 GetRequestedIOS(const u64 &title);
|
static u8 GetRequestedIOS(const u64 &title);
|
||||||
static u8 *GetTMD(const u64 &tid, u32 *size, const char *prefix);
|
static u8 *GetTMD(const u64 &tid, u32 *size, const char *prefix);
|
||||||
static u8 *GetDol(const u64 &title, u8 *tmdBuffer);
|
static u8 *GetDol(const u64 &title, u8 *tmdBuffer, bool &isForwarder);
|
||||||
static u8 *GetOpeningBnr(const u64 &title, u32 *outsize, const char *pathPrefix);
|
static u8 *GetOpeningBnr(const u64 &title, u32 *outsize, const char *pathPrefix);
|
||||||
|
|
||||||
void GetChannelList();
|
void GetChannelList();
|
||||||
|
Loading…
Reference in New Issue
Block a user