mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 00:55:06 +01:00
-removed alot of unneeded cIOS checks, saving the info about our
currently loaded cIOS instead -fixed bug of missing remount if no games are found with enabled NAND emulation which made wiiflow hang -added information for neek2o -removed ios reload on boot when wiiflow is in neek2o mode -made NAND file extraction MEM2 only -fixed two not free'd memory allocations which could fill the memory with unused stuff
This commit is contained in:
parent
5cd988fe23
commit
2b32db857a
@ -24,7 +24,6 @@ if [ $GENERATE -eq 1 ];
|
||||
then
|
||||
|
||||
cat <<EOF > $FILENAME
|
||||
#include "alt_ios.h"
|
||||
int mainIOS = $VERSION;
|
||||
EOF
|
||||
fi
|
@ -34,7 +34,7 @@
|
||||
#include "ext2.h"
|
||||
#include "sdhc.h"
|
||||
#include "usbstorage.h"
|
||||
#include "loader/cios.h"
|
||||
#include "loader/nk.h"
|
||||
#include "loader/utils.h"
|
||||
#include "loader/wbfs.h"
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "alt_ios.h"
|
||||
#include "cios.h"
|
||||
#include "disc.h"
|
||||
#include "nk.h"
|
||||
#include "sys.h"
|
||||
#include "wbfs.h"
|
||||
#include "wdvd.h"
|
||||
@ -81,7 +82,16 @@ void load_dip_249()
|
||||
bool loadIOS(int ios, bool launch_game, bool emu_channel)
|
||||
{
|
||||
#ifndef DOLPHIN
|
||||
gprintf("Reloading into IOS %i from %i (AHBPROT: %u)...\n", ios, IOS_GetVersion(), HAVE_AHBPROT);
|
||||
if(neek2o())
|
||||
{
|
||||
memset(&CurrentIOS, 0, sizeof(IOS_Info));
|
||||
CurrentIOS.Version = 254;
|
||||
CurrentIOS.Type = IOS_TYPE_D2X;
|
||||
CurrentIOS.Base = 254;
|
||||
CurrentIOS.Revision = 999;
|
||||
DCFlushRange(&CurrentIOS, sizeof(IOS_Info));
|
||||
return true;
|
||||
}
|
||||
|
||||
Close_Inputs();
|
||||
DeviceHandler::Instance()->UnMountAll();
|
||||
@ -89,21 +99,17 @@ bool loadIOS(int ios, bool launch_game, bool emu_channel)
|
||||
USBStorage2_Deinit();
|
||||
mload_close();
|
||||
|
||||
gprintf("Reloading into IOS %i from %i (AHBPROT: %u)...\n", ios, IOS_GetVersion(), HAVE_AHBPROT);
|
||||
ISFS_Deinitialize();
|
||||
bool iosOK = IOS_ReloadIOS(ios) == 0;
|
||||
ISFS_Initialize();
|
||||
|
||||
gprintf("%s, Current IOS: %i\n", iosOK ? "OK" : "FAILED!", IOS_GetVersion());
|
||||
if(is_ios_type(IOS_TYPE_HERMES, IOS_GetVersion()))
|
||||
{
|
||||
IOS_GetCurrentIOSInfo();
|
||||
if(CurrentIOS.Type == IOS_TYPE_HERMES)
|
||||
load_ehc_module_ex();
|
||||
gprintf("Hermes cIOS Base IOS%i\n", get_ios_base());
|
||||
}
|
||||
else if(is_ios_type(IOS_TYPE_WANIN, IOS_GetVersion()) && IOS_GetRevision() >= 18)
|
||||
{
|
||||
else if(CurrentIOS.Type == IOS_TYPE_WANIN && CurrentIOS.Revision >= 18)
|
||||
load_dip_249();
|
||||
gprintf("Waninkoko cIOS Base IOS%i\n", get_ios_base());
|
||||
}
|
||||
|
||||
if(!emu_channel)
|
||||
{
|
||||
if(launch_game)
|
||||
@ -121,15 +127,3 @@ bool loadIOS(int ios, bool launch_game, bool emu_channel)
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
u32 get_ios_base()
|
||||
{
|
||||
u32 revision = IOS_GetRevision();
|
||||
if (is_ios_type(IOS_TYPE_WANIN, IOS_GetVersion()) && revision >= 17)
|
||||
return wanin_mload_get_IOS_base();
|
||||
|
||||
else if (is_ios_type(IOS_TYPE_HERMES, IOS_GetVersion()) && revision >= 4)
|
||||
return mload_get_IOS_base();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -8,9 +8,6 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
bool loadIOS(int ios, bool launch_game, bool emu_channel);
|
||||
u32 get_ios_base();
|
||||
|
||||
extern int mainIOS;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipa
|
||||
PrinceOfPersiaPatch();
|
||||
NewSuperMarioBrosPatch();
|
||||
// Patch NoDiscInDrive only for IOS 249 < rev13 or IOS 222/223/224
|
||||
if((is_ios_type(IOS_TYPE_WANIN, IOS_GetVersion()) && IOS_GetRevision() < 13) || (is_ios_type(IOS_TYPE_HERMES, IOS_GetVersion())))
|
||||
if((CurrentIOS.Type == IOS_TYPE_WANIN && CurrentIOS.Revision < 13) || CurrentIOS.Type == IOS_TYPE_HERMES)
|
||||
patch_NoDiscinDrive(dst, len);
|
||||
patchVideoModes(dst, len, vidMode, vmode, patchVidModes);
|
||||
if(hooktype != 0 && dogamehooks(dst, len, false))
|
||||
@ -117,7 +117,7 @@ void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipa
|
||||
vidolpatcher(dst, len);
|
||||
if(configbytes[0] != 0xCD)
|
||||
langpatcher(dst, len);
|
||||
if(is_ios_type(IOS_TYPE_WANIN, IOS_GetVersion()) && IOS_GetRevision() < 13)
|
||||
if(CurrentIOS.Type == IOS_TYPE_WANIN && CurrentIOS.Revision < 13)
|
||||
Anti_002_fix(dst, len);
|
||||
if(countryString)
|
||||
PatchCountryStrings(dst, len); // Country Patch by WiiPower
|
||||
|
@ -3,6 +3,7 @@
|
||||
* by Dimok
|
||||
* Modifications by xFede
|
||||
* Wiiflowized and heavily improved by Miigotu
|
||||
* 2012 Converted, corrected and extended by FIX94
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any
|
||||
@ -24,60 +25,19 @@
|
||||
* distribution.
|
||||
***************************************************************************/
|
||||
#include <gctypes.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "cios.h"
|
||||
#include "alt_ios.h"
|
||||
#include "utils.h"
|
||||
#include "fs.h"
|
||||
#include "nk.h"
|
||||
#include "mload.h"
|
||||
#include "gecko/gecko.h"
|
||||
#include "memory/mem2.hpp"
|
||||
|
||||
static bool checked = false;
|
||||
static bool neek = false;
|
||||
extern u32 get_ios_base();
|
||||
|
||||
bool neek2o(void)
|
||||
{
|
||||
if(!checked)
|
||||
{
|
||||
u32 num = 0;
|
||||
neek = !(ISFS_ReadDir("/sneek", NULL, &num));
|
||||
gprintf("WiiFlow is in %s mode\n", neek ? "neek2o" : "real nand");
|
||||
checked = true;
|
||||
}
|
||||
return neek;
|
||||
}
|
||||
|
||||
/* Check if the cIOS is a D2X. */
|
||||
bool D2X(u8 ios, u8 *base)
|
||||
{
|
||||
if(neek2o())
|
||||
{
|
||||
*base = (u8)IOS_GetVersion();
|
||||
return true;
|
||||
}
|
||||
|
||||
iosinfo_t *info = GetInfo(ios);
|
||||
if(!info)
|
||||
return false;
|
||||
|
||||
if(info->magicword != 0x1ee7c105 /* Magic Word */
|
||||
|| info->magicversion != 1 /* Magic Version */
|
||||
|| info->version < 6 /* Version */
|
||||
|| strncasecmp(info->name, "d2x", 3) != 0) /* Name */
|
||||
{
|
||||
free(info);
|
||||
return false;
|
||||
}
|
||||
|
||||
*base = (u8)info->baseios;
|
||||
free(info);
|
||||
return true;
|
||||
}
|
||||
|
||||
IOS_Info CurrentIOS;
|
||||
signed_blob *GetTMD(u8 ios, u32 *TMD_Length)
|
||||
{
|
||||
if(ES_GetStoredTMDSize(TITLE_ID(1, ios), TMD_Length) < 0)
|
||||
@ -88,7 +48,7 @@ signed_blob *GetTMD(u8 ios, u32 *TMD_Length)
|
||||
return NULL;
|
||||
if(ES_GetStoredTMD(TITLE_ID(1, ios), TMD, *TMD_Length) < 0)
|
||||
{
|
||||
free(TMD);
|
||||
MEM2_free(TMD);
|
||||
return NULL;
|
||||
}
|
||||
return TMD;
|
||||
@ -99,17 +59,15 @@ signed_blob *GetTMD(u8 ios, u32 *TMD_Length)
|
||||
* @return pointer to iosinfo_t on success else NULL. The user is responsible for freeing the buffer.
|
||||
*/
|
||||
|
||||
iosinfo_t *GetInfo(u8 ios)
|
||||
iosinfo_t *IOS_GetInfo(u8 ios)
|
||||
{
|
||||
u32 TMD_Length;
|
||||
signed_blob *TMD = GetTMD(ios, &TMD_Length);
|
||||
if(TMD == NULL)
|
||||
return NULL;
|
||||
|
||||
char filepath[ISFS_MAXPATH] ATTRIBUTE_ALIGN(32);
|
||||
sprintf(filepath, "/title/00000001/%08x/content/%08x.app", ios, *(u8 *)((u32)TMD+0x1E7));
|
||||
|
||||
free(TMD);
|
||||
MEM2_free(TMD);
|
||||
|
||||
u32 size = 0;
|
||||
u8 *buffer = ISFS_GetFile((u8 *)filepath, &size, sizeof(iosinfo_t));
|
||||
@ -125,9 +83,9 @@ u32 Title_GetSize_FromTMD(tmd *tmd_data)
|
||||
u32 cnt, size = 0;
|
||||
|
||||
/* Calculate title size */
|
||||
for (cnt = 0; cnt < tmd_data->num_contents; cnt++) {
|
||||
for(cnt = 0; cnt < tmd_data->num_contents; cnt++)
|
||||
{
|
||||
tmd_content *content = &tmd_data->contents[cnt];
|
||||
|
||||
/* Add content size */
|
||||
size += content->size;
|
||||
}
|
||||
@ -135,7 +93,34 @@ u32 Title_GetSize_FromTMD(tmd *tmd_data)
|
||||
return size;
|
||||
}
|
||||
|
||||
int get_ios_type(u8 slot)
|
||||
/* Check if the cIOS is a D2X. */
|
||||
bool IOS_D2X(u8 ios, u8 *base)
|
||||
{
|
||||
if(neek2o())
|
||||
{
|
||||
*base = (u8)IOS_GetVersion();
|
||||
return true;
|
||||
}
|
||||
|
||||
iosinfo_t *info = IOS_GetInfo(ios);
|
||||
if(!info)
|
||||
return false;
|
||||
|
||||
if(info->magicword != 0x1ee7c105 /* Magic Word */
|
||||
|| info->magicversion != 1 /* Magic Version */
|
||||
|| info->version < 6 /* Version */
|
||||
|| strncasecmp(info->name, "d2x", 3) != 0) /* Name */
|
||||
{
|
||||
MEM2_free(info);
|
||||
return false;
|
||||
}
|
||||
|
||||
*base = (u8)info->baseios;
|
||||
MEM2_free(info);
|
||||
return true;
|
||||
}
|
||||
|
||||
u8 IOS_GetType(u8 slot)
|
||||
{
|
||||
u32 TMD_Length;
|
||||
signed_blob *TMD_Buffer = GetTMD(slot, &TMD_Length);
|
||||
@ -145,18 +130,13 @@ int get_ios_type(u8 slot)
|
||||
tmd *iosTMD = (tmd*)SIGNATURE_PAYLOAD(TMD_Buffer);
|
||||
if(Title_GetSize_FromTMD(iosTMD) < 0x100000 || iosTMD->title_version == 65280)
|
||||
{
|
||||
free(TMD_Buffer);
|
||||
MEM2_free(TMD_Buffer);
|
||||
return IOS_TYPE_NO_CIOS;
|
||||
}
|
||||
u32 title_rev = iosTMD->title_version;
|
||||
free(TMD_Buffer);
|
||||
MEM2_free(TMD_Buffer);
|
||||
iosTMD = NULL;
|
||||
|
||||
iosinfo_t *info = GetInfo(slot);
|
||||
if(info == NULL)
|
||||
return IOS_TYPE_NO_CIOS;
|
||||
free(info);
|
||||
|
||||
u8 base = 0;
|
||||
switch(slot)
|
||||
{
|
||||
@ -175,35 +155,61 @@ int get_ios_type(u8 slot)
|
||||
case 249:
|
||||
case 250:
|
||||
case 251:
|
||||
if(D2X(slot, &base))
|
||||
if(IOS_D2X(slot, &base))
|
||||
return IOS_TYPE_D2X;
|
||||
else
|
||||
return IOS_TYPE_WANIN;
|
||||
default:
|
||||
if(D2X(slot, &base))
|
||||
if(IOS_D2X(slot, &base))
|
||||
return IOS_TYPE_D2X;
|
||||
else
|
||||
return IOS_TYPE_NO_CIOS;
|
||||
}
|
||||
}
|
||||
|
||||
int is_ios_type(int type, u8 slot)
|
||||
void IOS_GetCurrentIOSInfo()
|
||||
{
|
||||
return (get_ios_type(slot) == type);
|
||||
memset(&CurrentIOS, 0, sizeof(IOS_Info));
|
||||
CurrentIOS.Revision = IOS_GetRevision();
|
||||
CurrentIOS.Version = IOS_GetVersion();
|
||||
CurrentIOS.Type = IOS_GetType(CurrentIOS.Version);
|
||||
if(CurrentIOS.Type == IOS_TYPE_D2X)
|
||||
{
|
||||
iosinfo_t *iosInfo = IOS_GetInfo(CurrentIOS.Version);
|
||||
CurrentIOS.Revision = iosInfo->version;
|
||||
CurrentIOS.Base = iosInfo->baseios;
|
||||
gprintf("D2X cIOS Base IOS%i\n", CurrentIOS.Base);
|
||||
MEM2_free(iosInfo);
|
||||
}
|
||||
else if(CurrentIOS.Type == IOS_TYPE_WANIN && CurrentIOS.Revision >= 18)
|
||||
{
|
||||
CurrentIOS.Base = wanin_mload_get_IOS_base();
|
||||
gprintf("Waninkoko cIOS Base IOS%i\n", CurrentIOS.Base);
|
||||
}
|
||||
else if(CurrentIOS.Type == IOS_TYPE_HERMES && CurrentIOS.Revision >= 4)
|
||||
{
|
||||
CurrentIOS.Base = mload_get_IOS_base();
|
||||
gprintf("Hermes cIOS Base IOS%i\n", CurrentIOS.Base);
|
||||
}
|
||||
else
|
||||
CurrentIOS.Base = CurrentIOS.Version;
|
||||
DCFlushRange(&CurrentIOS, sizeof(IOS_Info));
|
||||
}
|
||||
|
||||
bool shadow_mload()
|
||||
bool Hermes_shadow_mload()
|
||||
{
|
||||
if(!is_ios_type(IOS_TYPE_HERMES, IOS_GetVersion()))
|
||||
return false;
|
||||
int v51 = (5 << 4) & 1;
|
||||
if (mload_get_version() >= v51)
|
||||
if(mload_get_version() >= v51)
|
||||
{
|
||||
// shadow /dev/mload supported in hermes cios v5.1
|
||||
//IOS_Open("/dev/usb123/OFF",0);// this disables ehc completely
|
||||
IOS_Open("/dev/mload/OFF",0);
|
||||
IOS_Open("/dev/mload/OFF",0); // shadow /dev/mload supported in hermes cios v5.1
|
||||
gprintf("Shadow mload\n");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Hermes_Disable_EHC()
|
||||
{
|
||||
IOS_Open("/dev/usb123/OFF", 0);// this disables ehc completely
|
||||
gprintf("Hermes EHC Disabled\n");
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#ifndef _CIOSINFO_H_
|
||||
#define _CIOSINFO_H_
|
||||
|
||||
@ -8,23 +9,30 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct _iosinfo_t
|
||||
{
|
||||
typedef struct _iosinfo_t {
|
||||
u32 magicword; //0x1ee7c105
|
||||
u32 magicversion; // 1
|
||||
u32 version; // Example: 5
|
||||
u32 baseios; // Example: 56
|
||||
char name[0x10]; // Example: d2x
|
||||
char versionstring[0x10]; // Example: beta2
|
||||
} __attribute__((packed)) iosinfo_t;
|
||||
} iosinfo_t;
|
||||
|
||||
bool neek2o(void);
|
||||
bool D2X(u8 ios, u8 *base);
|
||||
iosinfo_t *GetInfo(u8 ios);
|
||||
signed_blob *GetTMD(u8 ios, u32 *TMD_Length);
|
||||
int is_ios_type(int type, u8 slot);
|
||||
int get_ios_type(u8 slot);
|
||||
bool shadow_mload();
|
||||
typedef struct _IOS_Info {
|
||||
u32 Revision;
|
||||
u8 Version;
|
||||
u8 Type;
|
||||
u8 Base;
|
||||
} IOS_Info;
|
||||
|
||||
extern IOS_Info CurrentIOS;
|
||||
void IOS_GetCurrentIOSInfo();
|
||||
|
||||
bool IOS_D2X(u8 ios, u8 *base);
|
||||
u8 IOS_GetType(u8 slot);
|
||||
|
||||
bool Hermes_shadow_mload();
|
||||
void Hermes_Disable_EHC();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ void __Disc_SetLowMem()
|
||||
*(vu32*)0xCD00643C = 0x00000000; // 32Mhz on Bus
|
||||
|
||||
/* Fix for Sam & Max (WiiPower) */
|
||||
if (!is_ios_type(IOS_TYPE_HERMES, IOS_GetVersion()))
|
||||
if(CurrentIOS.Type != IOS_TYPE_HERMES)
|
||||
*GameID_Address = 0x80000000;
|
||||
|
||||
/* Copy disc ID */
|
||||
@ -309,7 +309,7 @@ s32 Disc_SetUSB(const u8 *id, bool frag)
|
||||
if(frag)
|
||||
return set_frag_list();
|
||||
s32 part = -1;
|
||||
if(is_ios_type(IOS_TYPE_HERMES, IOS_GetVersion()))
|
||||
if(CurrentIOS.Type == IOS_TYPE_HERMES)
|
||||
part = wbfs_part_idx ? wbfs_part_idx - 1 : 0;
|
||||
return WDVD_SetUSBMode(wbfsDev, (u8*)id, part);
|
||||
}
|
||||
|
@ -1,9 +1,14 @@
|
||||
|
||||
#include <ogcsys.h>
|
||||
#include <locale.h>
|
||||
#include <ogc/isfs.h>
|
||||
#include <malloc.h>
|
||||
#include "utils.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "fs.h"
|
||||
#include "utils.h"
|
||||
#include "memory/mem2.hpp"
|
||||
|
||||
static fstats stats ATTRIBUTE_ALIGN(32);
|
||||
|
||||
u8 *ISFS_GetFile(u8 *path, u32 *size, s32 length)
|
||||
{
|
||||
@ -11,31 +16,30 @@ u8 *ISFS_GetFile(u8 *path, u32 *size, s32 length)
|
||||
|
||||
s32 fd = ISFS_Open((const char *)path, ISFS_OPEN_READ);
|
||||
u8 *buf = NULL;
|
||||
static fstats stats ATTRIBUTE_ALIGN(32);
|
||||
|
||||
if(fd >= 0)
|
||||
{
|
||||
memset(&stats, 0, sizeof(fstats));
|
||||
if(ISFS_GetFileStats(fd, &stats) >= 0)
|
||||
{
|
||||
if(length <= 0)
|
||||
length = stats.file_length;
|
||||
if(length > 0)
|
||||
buf = (u8 *)memalign(32, ALIGN32(length));
|
||||
|
||||
buf = (u8 *)MEM2_memalign(32, ALIGN32(length));
|
||||
if(buf)
|
||||
{
|
||||
*size = stats.file_length;
|
||||
if(ISFS_Read(fd, (char*)buf, length) != length)
|
||||
{
|
||||
*size = 0;
|
||||
free(buf);
|
||||
MEM2_free(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
ISFS_Close(fd);
|
||||
}
|
||||
|
||||
if (*size > 0)
|
||||
if(*size > 0)
|
||||
{
|
||||
DCFlushRange(buf, *size);
|
||||
ICInvalidateRange(buf, *size);
|
||||
|
@ -29,9 +29,24 @@
|
||||
#include <malloc.h>
|
||||
|
||||
#include "nk.h"
|
||||
#include "cios.h"
|
||||
#include "armboot.h"
|
||||
#include "memory/mem2.hpp"
|
||||
#include "gecko/gecko.h"
|
||||
|
||||
bool checked = false;
|
||||
bool neek = false;
|
||||
|
||||
bool neek2o(void)
|
||||
{
|
||||
if(!checked)
|
||||
{
|
||||
u32 num = 0;
|
||||
neek = !(ISFS_ReadDir("/sneek", NULL, &num));
|
||||
gprintf("WiiFlow is in %s mode\n", neek ? "neek2o" : "real nand");
|
||||
checked = true;
|
||||
}
|
||||
return neek;
|
||||
}
|
||||
|
||||
s32 Launch_nk(u64 TitleID, const char *nandpath)
|
||||
{
|
||||
|
@ -25,6 +25,7 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
s32 Launch_nk(u64 TitleID, const char *nandpath);
|
||||
bool neek2o(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ CMenu *mainMenu;
|
||||
extern "C"
|
||||
{
|
||||
extern void __exception_setreload(int t);
|
||||
extern int mainIOS;
|
||||
|
||||
void ShowError(const wstringEx &error) { mainMenu->error(error); }
|
||||
void HideWaitMessage() { mainMenu->_hideWaitMessage(); }
|
||||
@ -69,13 +70,7 @@ int main(int argc, char **argv)
|
||||
// Load Custom IOS
|
||||
gprintf("Loading cIOS: %d\n", mainIOS);
|
||||
bool iosOK = loadIOS(mainIOS, false, false);
|
||||
|
||||
u8 mainIOSBase = 0;
|
||||
D2X(mainIOS, &mainIOSBase);
|
||||
if(!mainIOSBase)
|
||||
mainIOSBase = get_ios_base();
|
||||
iosOK = iosOK && mainIOSBase > 0;
|
||||
gprintf("Loaded cIOS: %u has base %u\n", mainIOS, mainIOSBase);
|
||||
iosOK = iosOK && CurrentIOS.Type != IOS_TYPE_NO_CIOS;
|
||||
#else
|
||||
bool iosOK = true;
|
||||
#endif
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "loader/alt_ios.h"
|
||||
#include "loader/cios.h"
|
||||
#include "loader/fs.h"
|
||||
#include "loader/nk.h"
|
||||
#include "loader/playlog.h"
|
||||
#include "loader/sys.h"
|
||||
#include "loader/wbfs.h"
|
||||
@ -280,10 +281,7 @@ void CMenu::init(void)
|
||||
if(!neek2o())
|
||||
_load_installed_cioses();
|
||||
else
|
||||
{
|
||||
extern int mainIOS;
|
||||
_installed_cios[mainIOS] = mainIOS;
|
||||
}
|
||||
_installed_cios[CurrentIOS.Version] = CurrentIOS.Version;
|
||||
|
||||
snprintf(m_app_update_drive, sizeof(m_app_update_drive), "%s:/", drive);
|
||||
m_dataDir = sfmt("%s:/%s", drive, APPDATA_DIR);
|
||||
@ -2307,12 +2305,12 @@ void CMenu::_load_installed_cioses()
|
||||
for(u8 slot = 200; slot < 254; slot++)
|
||||
{
|
||||
u8 base = 1;
|
||||
if(D2X(slot, &base))
|
||||
if(IOS_D2X(slot, &base))
|
||||
{
|
||||
gprintf("Found d2x base %u in slot %u\n", base, slot);
|
||||
_installed_cios[slot] = base;
|
||||
}
|
||||
else if(!is_ios_type(IOS_TYPE_NO_CIOS, slot))
|
||||
else if(IOS_GetType(slot) != IOS_TYPE_NO_CIOS)
|
||||
{
|
||||
gprintf("Found cIOS in slot %u\n", slot);
|
||||
_installed_cios[slot] = slot;
|
||||
|
@ -158,11 +158,5 @@ void CMenu::_textAbout(void)
|
||||
false
|
||||
);
|
||||
|
||||
Nand::Instance()->Disable_Emu();
|
||||
iosinfo_t * iosInfo = GetInfo(mainIOS);
|
||||
if(iosInfo != NULL)
|
||||
{
|
||||
m_btnMgr.setText(m_aboutLblIOS, wfmt(_fmt("ios", L"IOS%i base %i v%i"), mainIOS, iosInfo->baseios, iosInfo->version), true);
|
||||
free(iosInfo);
|
||||
}
|
||||
m_btnMgr.setText(m_aboutLblIOS, wfmt(_fmt("ios", L"IOS%i base %i v%i"), CurrentIOS.Version, CurrentIOS.Base, CurrentIOS.Revision), true);
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
|
||||
#include "menu.hpp"
|
||||
#include "channel/nand.hpp"
|
||||
#include "loader/alt_ios.h"
|
||||
#include "loader/cios.h"
|
||||
#include "loader/nk.h"
|
||||
#include "loader/sys.h"
|
||||
|
||||
const int CMenu::_nbCfgPages = 6;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "channel/nand.hpp"
|
||||
#include "gecko/gecko.h"
|
||||
#include "loader/cios.h"
|
||||
#include "loader/nk.h"
|
||||
#include "loader/sys.h"
|
||||
|
||||
static const int g_curPage = 4;
|
||||
|
@ -56,7 +56,6 @@ extern const u8 gc_ogg[];
|
||||
extern const u32 gc_ogg_size;
|
||||
|
||||
extern u32 boot2version;
|
||||
extern int mainIOS;
|
||||
static u64 sm_title_id[8] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
bool m_zoom_banner = false;
|
||||
@ -934,7 +933,7 @@ int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id, bool emu_channel)
|
||||
}
|
||||
}
|
||||
else if(gameIOS != 57)
|
||||
gameIOS = mainIOS;
|
||||
gameIOS = CurrentIOS.Version;
|
||||
gprintf("Changed requested IOS to %d.\n", gameIOS);
|
||||
|
||||
// remap IOS to CIOS
|
||||
@ -970,7 +969,7 @@ int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id, bool emu_channel)
|
||||
return LOAD_IOS_FAILED;
|
||||
}
|
||||
|
||||
if(gameIOS != mainIOS)
|
||||
if(gameIOS != CurrentIOS.Version)
|
||||
{
|
||||
gprintf("Reloading IOS into %d\n", gameIOS);
|
||||
if(!loadIOS(gameIOS, true, false))
|
||||
@ -1064,8 +1063,8 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
cleanup();
|
||||
else
|
||||
cleanup();
|
||||
|
||||
if(!forwarder)
|
||||
{
|
||||
@ -1083,12 +1082,12 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
if(_loadIOS(gameIOS, userIOS, id, !emu_disabled) == LOAD_IOS_FAILED)
|
||||
return;
|
||||
}
|
||||
if(rtrn != NULL && strlen(rtrn) == 4)
|
||||
if(CurrentIOS.Type == IOS_TYPE_D2X && rtrn != NULL && strlen(rtrn) == 4)
|
||||
{
|
||||
int rtrnID = rtrn[0] << 24 | rtrn[1] << 16 | rtrn[2] << 8 | rtrn[3];
|
||||
|
||||
static ioctlv vector[1] ATTRIBUTE_ALIGN(32);
|
||||
sm_title_id[0] = (((u64)(0x00010001) << 32) | (rtrnID&0xFFFFFFFF));
|
||||
sm_title_id[0] = (((u64)(0x00010001) << 32) | (rtrnID & 0xFFFFFFFF));
|
||||
|
||||
vector[0].data = sm_title_id;
|
||||
vector[0].len = 8;
|
||||
@ -1344,13 +1343,12 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
#else
|
||||
bool iosLoaded = true;
|
||||
#endif
|
||||
u8 base;
|
||||
if(D2X(IOS_GetVersion(), &base))
|
||||
if(CurrentIOS.Type == IOS_TYPE_D2X)
|
||||
{
|
||||
if(!m_directLaunch && returnTo)
|
||||
{
|
||||
static ioctlv vector[1] ATTRIBUTE_ALIGN(32);
|
||||
sm_title_id[0] = (((u64)(0x00010001) << 32) | (returnTo&0xFFFFFFFF));
|
||||
sm_title_id[0] = (((u64)(0x00010001) << 32) | (returnTo & 0xFFFFFFFF));
|
||||
vector[0].data = sm_title_id;
|
||||
vector[0].len = 8;
|
||||
s32 ESHandle = IOS_Open("/dev/es", 0);
|
||||
@ -1358,7 +1356,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
IOS_Close(ESHandle);
|
||||
returnTo = 0;
|
||||
}
|
||||
IOSReloadBlock(IOS_GetVersion(), true);
|
||||
IOSReloadBlock(CurrentIOS.Version, true);
|
||||
}
|
||||
if(emulate_mode && !neek2o())
|
||||
{
|
||||
@ -1411,15 +1409,23 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
#ifndef DOLPHIN
|
||||
USBStorage2_Deinit();
|
||||
USB_Deinitialize();
|
||||
shadow_mload();
|
||||
if(CurrentIOS.Type == IOS_TYPE_HERMES)
|
||||
{
|
||||
if(dvd)
|
||||
Hermes_Disable_EHC();
|
||||
else
|
||||
Hermes_shadow_mload();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Last check if the Disc ID is correct */
|
||||
char discid[32] ATTRIBUTE_ALIGN(32);
|
||||
memset(discid, 0, sizeof(discid));
|
||||
WDVD_UnencryptedRead(discid, 32, 0);
|
||||
gprintf("WDVD_UnencryptedRead ID: %s (expected: %s)\n", discid, id.c_str());
|
||||
if(strncasecmp(id.c_str(), discid, 6) != 0)
|
||||
void *ReadBuffer = MEM2_memalign(32, 32);
|
||||
WDVD_UnencryptedRead(ReadBuffer, 32, 0);
|
||||
string ReadedID((char*)ReadBuffer, 6);
|
||||
MEM2_free(ReadBuffer);
|
||||
|
||||
gprintf("WDVD_UnencryptedRead ID: %s (expected: %s)\n", ReadedID.c_str(), id.c_str());
|
||||
if(strncasecmp(id.c_str(), ReadedID.c_str(), 6) != 0)
|
||||
return;
|
||||
|
||||
DisableMEM1allocR();
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "menu.hpp"
|
||||
|
||||
#include "gui/GameTDB.hpp"
|
||||
#include "loader/alt_ios.h"
|
||||
#include "loader/sys.h"
|
||||
|
||||
extern const u8 wifi1_png[];
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "loader/alt_ios.h"
|
||||
#include "loader/cios.h"
|
||||
#include "loader/disc.h"
|
||||
#include "loader/nk.h"
|
||||
#include "loader/sys.h"
|
||||
#include "loader/wbfs.h"
|
||||
#include "loader/wdvd.h"
|
||||
@ -153,6 +154,7 @@ void CMenu::_showMain(void)
|
||||
if(!m_cfg.getBool("NAND", "disable", true))
|
||||
{
|
||||
Nand::Instance()->Disable_Emu();
|
||||
DeviceHandler::Instance()->MountAll();
|
||||
_hideMain();
|
||||
if(!_AutoCreateNand())
|
||||
m_cfg.setBool("NAND", "disable", true);
|
||||
@ -633,10 +635,8 @@ int CMenu::main(void)
|
||||
{
|
||||
_showWaitMessage();
|
||||
_hideMain();
|
||||
Nand::Instance()->Disable_Emu();
|
||||
bool isD2XnewerThanV6 = false;
|
||||
iosinfo_t * iosInfo = GetInfo(mainIOS);
|
||||
if (iosInfo->version > 6)
|
||||
if(CurrentIOS.Revision > 6 && CurrentIOS.Type == IOS_TYPE_D2X)
|
||||
isD2XnewerThanV6 = true;
|
||||
if(m_current_view == COVERFLOW_CHANNEL && m_cfg.getInt("NAND", "emulation", 0))
|
||||
Nand::Instance()->Enable_Emu();
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "lockMutex.hpp"
|
||||
#include "channel/nand.hpp"
|
||||
#include "fileOps/fileOps.h"
|
||||
#include "loader/alt_ios.h"
|
||||
#include "loader/cios.h"
|
||||
#include "loader/nk.h"
|
||||
#include "loader/sys.h"
|
||||
|
||||
// NandEmulation menu
|
||||
@ -201,9 +201,7 @@ void CMenu::_enableNandEmu(bool fromconfig)
|
||||
if(!disable)
|
||||
{
|
||||
bool isD2XnewerThanV6 = false;
|
||||
Nand::Instance()->Disable_Emu();
|
||||
iosinfo_t * iosInfo = GetInfo(mainIOS);
|
||||
if(iosInfo->version > 6 || neek2o())
|
||||
if(CurrentIOS.Revision > 6 && CurrentIOS.Type == IOS_TYPE_D2X)
|
||||
isD2XnewerThanV6 = true;
|
||||
if(m_current_view == COVERFLOW_CHANNEL && !m_cfg.getBool("NAND", "disable", true) && !neek2o() && !m_tempView)
|
||||
Nand::Instance()->Enable_Emu();
|
||||
|
@ -6,8 +6,6 @@
|
||||
#include "loader/sys.h"
|
||||
#include "loader/wbfs.h"
|
||||
|
||||
extern int mainIOS;
|
||||
|
||||
int version_num = 0, num_versions = 0, i;
|
||||
int CMenu::_version[9] = {0, atoi(SVN_REV), atoi(SVN_REV), atoi(SVN_REV), atoi(SVN_REV), atoi(SVN_REV), atoi(SVN_REV), atoi(SVN_REV), atoi(SVN_REV)};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user