mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 21:54:15 +01:00
afdd19e591
r417 -> r417mod -Added very basic DML support (many thanks to the postloader code) -Re-added IOS reload -Added cIOS base 60, 70 and 80 as compatible ones for d2x v8+ r417mod -> r417mod2 -Fixed NTSC video mode r417mod2 -> r417mod3 -Fixed black wii game covers if no WiiTDB file exist, forcing to white now -Set default gamecube game cover to black -Added DML icon -Compressed all PNG files to save space -May fixed codedump if IOS58 games started from DVD (thanks entropy) -Allowing access to the homebrew screen while parental controls are enabled (thanks entropy) -Disable cover downloads while parental controls are enabled (thanks entropy) r417mod3 -> r417mod4 -fixed DML audio streaming if NAND emulator was enabled before -removed DVD boot from DML launch, makes boot process way faster (still needs a disc inserted) -Added base IOS58 to DVD launch list, may really fixes IOS58 games from DVD :P r417mod4 -> r417mod5 -added yellow covers for "Mario & Sonic at the London 2012 Olympic Games" PAL and NTSC-U -fixed black covers for "Pandora’s Tower: Until I Return to Your Side" and "Ikenie no Yoru" NTSC-J -removed some options in DML coverflow because they doesnt work -fixed global options in DML coverflow -fixed gametdb titles and synopsis (see http://gbatemp.net/topic/204106-wiiflow-an-open-source-gui-usb-loader/page__st__4515__p__3950858#entry3950858) -moved IOS selection to new page 4
105 lines
2.8 KiB
C++
105 lines
2.8 KiB
C++
/***************************************************************************
|
|
* Copyright (C) 2011
|
|
* by Dimok
|
|
* Modifications by xFede
|
|
* Wiiflowized and heavily improved by Miigotu
|
|
*
|
|
* This software is provided 'as-is', without any express or implied
|
|
* warranty. In no event will the authors be held liable for any
|
|
* damages arising from the use of this software.
|
|
*
|
|
* Permission is granted to anyone to use this software for any
|
|
* purpose, including commercial applications, and to alter it and
|
|
* redistribute it freely, subject to the following restrictions:
|
|
*
|
|
* 1. The origin of this software must not be misrepresented; you
|
|
* must not claim that you wrote the original software. If you use
|
|
* this software in a product, an acknowledgment in the product
|
|
* documentation would be appreciated but is not required.
|
|
*
|
|
* 2. Altered source versions must be plainly marked as such, and
|
|
* must not be misrepresented as being the original software.
|
|
*
|
|
* 3. This notice may not be removed or altered from any source
|
|
* distribution.
|
|
***************************************************************************/
|
|
|
|
|
|
#include <gctypes.h>
|
|
#include <malloc.h>
|
|
#include <cstdio>
|
|
#include <cstring>
|
|
|
|
#include "cios.hpp"
|
|
#include "utils.h"
|
|
#include "mem2.hpp"
|
|
#include "fs.h"
|
|
|
|
#define ARRAY_SIZE(a) (sizeof a / sizeof a[0])
|
|
|
|
static u32 allowedBases[] = { 37, 38, 53, 55, 56, 57, 58, 60, 70, 80 };
|
|
|
|
/* Check if the cIOS is a D2X. */
|
|
bool cIOSInfo::D2X(u8 ios, u8 *base)
|
|
{
|
|
bool ret = false;
|
|
|
|
iosinfo_t *info = GetInfo(ios);
|
|
if(info != NULL)
|
|
{
|
|
*base = (u8)info->baseios;
|
|
SAFE_FREE(info);
|
|
ret = true;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* Reads the ios info struct from the .app file.
|
|
* @return pointer to iosinfo_t on success else NULL. The user is responsible for freeing the buffer.
|
|
*/
|
|
|
|
iosinfo_t *cIOSInfo::GetInfo(u8 ios)
|
|
{
|
|
u32 TMD_Length;
|
|
if (ES_GetStoredTMDSize(TITLE_ID(1, ios), &TMD_Length) < 0) return NULL;
|
|
|
|
signed_blob *TMD = (signed_blob*) MEM2_alloc(ALIGN32(TMD_Length));
|
|
if (!TMD) return NULL;
|
|
|
|
if (ES_GetStoredTMD(TITLE_ID(1, ios), TMD, TMD_Length) < 0)
|
|
{
|
|
SAFE_FREE(TMD);
|
|
return NULL;
|
|
}
|
|
|
|
char filepath[ISFS_MAXPATH] ATTRIBUTE_ALIGN(32);
|
|
sprintf(filepath, "/title/%08x/%08x/content/%08x.app", 0x00000001, ios, *(u8 *)((u32)TMD+0x1E7));
|
|
|
|
SAFE_FREE(TMD);
|
|
|
|
u32 size = 0;
|
|
u8 *buffer = ISFS_GetFile((u8 *) filepath, &size, sizeof(iosinfo_t));
|
|
if(!buffer) return NULL;
|
|
|
|
iosinfo_t *iosinfo = (iosinfo_t *) buffer;
|
|
|
|
bool baseMatch = false;
|
|
for(u8 i = 0; i < ARRAY_SIZE(allowedBases); i++)
|
|
if(iosinfo->baseios == allowedBases[i])
|
|
{
|
|
baseMatch = true;
|
|
break;
|
|
}
|
|
|
|
if(iosinfo->magicword != 0x1ee7c105 /* Magic Word */
|
|
|| iosinfo->magicversion != 1 /* Magic Version */
|
|
|| iosinfo->version < 6 /* Version */
|
|
|| !baseMatch /* Base */
|
|
|| strncasecmp(iosinfo->name, "d2x", 3) != 0) /* Name */
|
|
{
|
|
SAFE_FREE(buffer);
|
|
return NULL;
|
|
}
|
|
return iosinfo;
|
|
} |