mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 00:55:06 +01:00
-corrected a few wrong things from r673
-use the devolution sample loader device mount way to read the iso (may fixes bugs in booting devolution)
This commit is contained in:
parent
6723f00181
commit
99a2f9faad
@ -36,14 +36,12 @@
|
||||
#include <malloc.h>
|
||||
|
||||
#include "nand.hpp"
|
||||
#include "devicemounter/DeviceHandler.hpp"
|
||||
#include "fileOps/fileOps.h"
|
||||
#include "gecko/gecko.h"
|
||||
#include "loader/alt_ios.h"
|
||||
#include "loader/cios.h"
|
||||
#include "loader/sys.h"
|
||||
#include "loader/wbfs.h"
|
||||
#include "music/musicplayer.h"
|
||||
#include "memory/memory.h"
|
||||
|
||||
u8 *confbuffer ATTRIBUTE_ALIGN(32);
|
||||
@ -160,12 +158,7 @@ s32 Nand::Enable_Emu()
|
||||
if(emu_enabled)
|
||||
return 0;
|
||||
if(CurrentIOS.Type == IOS_TYPE_NORMAL_IOS)
|
||||
{
|
||||
m_music.Stop();
|
||||
loadIOS(mainIOS, false, false);
|
||||
DeviceHandler::Instance()->MountAll();
|
||||
m_music.Next();
|
||||
}
|
||||
|
||||
NandDevice *Device = &NandDeviceList[EmuDevice];
|
||||
|
||||
|
@ -115,36 +115,34 @@ void DeviceHandler::UnMount(int dev)
|
||||
UnMountUSB(dev-USB1);
|
||||
}
|
||||
|
||||
void DeviceHandler::SetModes()
|
||||
{
|
||||
/* Set for USB */
|
||||
if(CurrentIOS.Type == IOS_TYPE_NORMAL_IOS)
|
||||
usb_libogc_mode = 1;
|
||||
else
|
||||
usb_libogc_mode = 0;
|
||||
/* Set for SD */
|
||||
if(CurrentIOS.Type == IOS_TYPE_D2X)
|
||||
sdhc_mode_sd = 0;
|
||||
else
|
||||
sdhc_mode_sd = 1;
|
||||
}
|
||||
|
||||
bool DeviceHandler::MountSD()
|
||||
{
|
||||
if(sd)
|
||||
{
|
||||
delete sd;
|
||||
sd = NULL;
|
||||
}
|
||||
sd = new PartitionHandle(&__io_sdhc);
|
||||
if(sd->GetPartitionCount() < 1)
|
||||
{
|
||||
delete sd;
|
||||
sdhc_mode_sd = 1;
|
||||
gprintf("Couldn't find SD Card. Trying __io_wiisd mode\n");
|
||||
if(!sd)
|
||||
sd = new PartitionHandle(&__io_sdhc);
|
||||
}
|
||||
if(sd->GetPartitionCount() < 1)
|
||||
if(sd && sd->GetPartitionCount() < 1)
|
||||
{
|
||||
delete sd;
|
||||
sd = NULL;
|
||||
sdhc_mode_sd = 0;
|
||||
gprintf("SD Card not found.\n");
|
||||
return false;
|
||||
}
|
||||
gprintf("SD Card found.\n");
|
||||
|
||||
//! Mount only one SD Partition
|
||||
return sd->Mount(0, DeviceName[SD], true);
|
||||
}
|
||||
|
||||
|
||||
bool DeviceHandler::MountUSB(int pos)
|
||||
{
|
||||
if(!usb0 && !usb1)
|
||||
@ -165,36 +163,21 @@ bool DeviceHandler::MountUSB(int pos)
|
||||
|
||||
bool DeviceHandler::MountAllUSB()
|
||||
{
|
||||
if(CurrentIOS.Type == IOS_TYPE_NORMAL_IOS)
|
||||
usb_libogc_mode = 1;
|
||||
else
|
||||
usb_libogc_mode = 0;
|
||||
|
||||
if(!usb0)
|
||||
usb0 = new PartitionHandle(GetUSB0Interface());
|
||||
//if(!usb1 && (Settings.USBPort == 1 || Settings.USBPort == 2))
|
||||
//usb1 = new PartitionHandle(GetUSB1Interface());
|
||||
|
||||
if(usb0 && usb0->GetPartitionCount() < 1)
|
||||
{
|
||||
delete usb0;
|
||||
usb0 = NULL;
|
||||
return false;
|
||||
}
|
||||
if(usb1 && usb1->GetPartitionCount() < 1)
|
||||
{
|
||||
delete usb1;
|
||||
usb1 = NULL;
|
||||
}
|
||||
|
||||
bool result = false;
|
||||
int partCount = GetUSBPartitionCount();
|
||||
|
||||
for(int i = 0; i < partCount; i++)
|
||||
{
|
||||
if(MountUSB(i))
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,8 @@ class DeviceHandler
|
||||
static DeviceHandler * Instance();
|
||||
static void DestroyInstance();
|
||||
|
||||
void SetModes();
|
||||
|
||||
void MountAll();
|
||||
void UnMountAll();
|
||||
bool Mount(int dev);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <ogc/machine/processor.h>
|
||||
#include <sdcard/wiisd_io.h>
|
||||
|
||||
// for directory parsing and low-level file I/O
|
||||
#include <sys/types.h>
|
||||
@ -28,6 +29,7 @@
|
||||
#include <dirent.h>
|
||||
|
||||
#include "gc/gc.hpp"
|
||||
#include "fat.h"
|
||||
#include "gecko/gecko.h"
|
||||
#include "fileOps/fileOps.h"
|
||||
#include "loader/utils.h"
|
||||
@ -182,12 +184,7 @@ bool DEVO_Installed(const char* path)
|
||||
return devo;
|
||||
}
|
||||
|
||||
void DEVO_ShowReport(void)
|
||||
{
|
||||
gprintf("%s\n", (char*)loader_bin + 4);
|
||||
}
|
||||
|
||||
void DEVO_SetOptions(const char *isopath, const char *partition, const char *loader, const char *gameID, bool memcard_emu)
|
||||
void DEVO_GetLoader(const char *loader)
|
||||
{
|
||||
//Read in loader.bin
|
||||
char loader_path[256];
|
||||
@ -209,8 +206,13 @@ void DEVO_SetOptions(const char *isopath, const char *partition, const char *loa
|
||||
gprintf("Devolution loader.bin not found!\n");
|
||||
return;
|
||||
}
|
||||
gprintf("%s\n", (char*)loader_bin + 4);
|
||||
}
|
||||
|
||||
DEVO_ShowReport();
|
||||
void DEVO_SetOptions(const char *isopath, const char *partition, const char *gameID, bool memcard_emu)
|
||||
{
|
||||
// re-mount device we need
|
||||
fatMountSimple(partition, strncasecmp(partition, "sd", 2) ? &__io_usbstorage : &__io_wiisd);
|
||||
|
||||
//start writing cfg to mem
|
||||
struct stat st;
|
||||
@ -218,7 +220,7 @@ void DEVO_SetOptions(const char *isopath, const char *partition, const char *loa
|
||||
char iso2path[256];
|
||||
|
||||
stat(isopath, &st);
|
||||
f = fopen(isopath, "rb");
|
||||
FILE *f = fopen(isopath, "rb");
|
||||
gprintf("Read ISO File: \"%s\"\n", isopath);
|
||||
fread((u8*)0x80000000, 1, 32, f);
|
||||
fclose(f);
|
||||
@ -296,6 +298,8 @@ void DEVO_SetOptions(const char *isopath, const char *partition, const char *loa
|
||||
|
||||
// flush disc ID and Devolution config out to memory
|
||||
DCFlushRange((void*)0x80000000, 64);
|
||||
|
||||
fatUnmount(partition);
|
||||
}
|
||||
|
||||
void DEVO_Boot()
|
||||
|
@ -80,8 +80,8 @@ typedef struct global_config
|
||||
} gconfig;
|
||||
|
||||
bool DEVO_Installed(const char *path);
|
||||
void DEVO_ShowReport(void);
|
||||
void DEVO_SetOptions(const char *isopath, const char *partition, const char *loader, const char *gameID, bool memcard_emum);
|
||||
void DEVO_GetLoader(const char *loader);
|
||||
void DEVO_SetOptions(const char *isopath, const char *partition, const char *gameID, bool memcard_emum);
|
||||
void DEVO_Boot();
|
||||
|
||||
// General
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "gecko/gecko.h"
|
||||
#include "memory/mem2.hpp"
|
||||
#include "memory/memory.h"
|
||||
#include "music/musicplayer.h"
|
||||
#include "types.h"
|
||||
|
||||
// mload from uloader by Hermes
|
||||
@ -81,15 +82,16 @@ void load_dip_249()
|
||||
bool loadIOS(int ios, bool launch_game, bool emu_channel)
|
||||
{
|
||||
#ifndef DOLPHIN
|
||||
Close_Inputs();
|
||||
DeviceHandler::Instance()->UnMountAll();
|
||||
WDVD_Close();
|
||||
USBStorage2_Deinit();
|
||||
mload_close();
|
||||
bool iosOK = true;
|
||||
|
||||
if(ios != IOS_GetVersion())
|
||||
{
|
||||
m_music.Stop();
|
||||
Close_Inputs();
|
||||
DeviceHandler::Instance()->UnMountAll();
|
||||
WDVD_Close();
|
||||
USBStorage2_Deinit();
|
||||
mload_close();
|
||||
|
||||
gprintf("Reloading into IOS %i from %i...\n", ios, IOS_GetVersion());
|
||||
Nand::Instance()->DeInit_ISFS();
|
||||
iosOK = IOS_ReloadIOS(ios) == 0;
|
||||
@ -102,6 +104,7 @@ bool loadIOS(int ios, bool launch_game, bool emu_channel)
|
||||
load_ehc_module_ex();
|
||||
else if(CurrentIOS.Type == IOS_TYPE_WANIN && CurrentIOS.Revision >= 18)
|
||||
load_dip_249();
|
||||
DeviceHandler::Instance()->SetModes();
|
||||
|
||||
if(!emu_channel)
|
||||
{
|
||||
@ -112,7 +115,10 @@ bool loadIOS(int ios, bool launch_game, bool emu_channel)
|
||||
Disc_Init();
|
||||
}
|
||||
else
|
||||
{
|
||||
DeviceHandler::Instance()->MountAll();
|
||||
Open_Inputs();
|
||||
}
|
||||
}
|
||||
|
||||
return iosOK;
|
||||
|
@ -69,7 +69,7 @@ int main(int argc, char **argv)
|
||||
iosOK = true;
|
||||
memset(&CurrentIOS, 0, sizeof(IOS_Info));
|
||||
CurrentIOS.Version = 254;
|
||||
CurrentIOS.Type = IOS_TYPE_D2X;
|
||||
CurrentIOS.Type = IOS_TYPE_NEEK2O;
|
||||
CurrentIOS.Base = 254;
|
||||
CurrentIOS.Revision = 999;
|
||||
DCFlushRange(&CurrentIOS, sizeof(IOS_Info));
|
||||
@ -77,12 +77,12 @@ int main(int argc, char **argv)
|
||||
else if(*HW_AHBPROT != 0xFFFFFFFF)
|
||||
{
|
||||
gprintf("Loading cIOS: %d\n", mainIOS);
|
||||
iosOK = loadIOS(mainIOS, false, false) && CustomIOS(CurrentIOS.Type);
|
||||
iosOK = loadIOS(mainIOS, true, true) && CustomIOS(CurrentIOS.Type);
|
||||
}
|
||||
else
|
||||
{
|
||||
gprintf("Using IOS%d and AHBPROT patched out\n", IOS_GetVersion());
|
||||
iosOK = loadIOS(IOS_GetVersion(), false, false);
|
||||
gprintf("AHBPROT patched out, use IOS58\n");
|
||||
iosOK = loadIOS(58, true, true);
|
||||
}
|
||||
#else
|
||||
iosOK = true;
|
||||
@ -98,7 +98,6 @@ int main(int argc, char **argv)
|
||||
{
|
||||
Open_Inputs(); //(re)init wiimote
|
||||
#ifndef DOLPHIN
|
||||
DeviceHandler::Instance()->MountSD();
|
||||
const DISC_INTERFACE *handle = DeviceHandler::GetUSB0Interface();
|
||||
bool deviceAvailable = false;
|
||||
u8 timeout = 0;
|
||||
@ -109,13 +108,10 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
usleep(50000);
|
||||
}
|
||||
DeviceHandler::Instance()->MountAllUSB();
|
||||
#endif
|
||||
DeviceHandler::Instance()->MountAll();
|
||||
if(DeviceHandler::Instance()->IsInserted(SD))
|
||||
deviceAvailable = true;
|
||||
#else
|
||||
bool deviceAvailable = true;
|
||||
DeviceHandler::Instance()->MountAll();
|
||||
#endif
|
||||
bool dipOK = Disc_Init() >= 0;
|
||||
|
||||
mainMenu = new CMenu(vid);
|
||||
|
@ -809,6 +809,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
|
||||
}
|
||||
|
||||
u8 loader = min((u32)m_gcfg2.getInt(id, "gc_loader", 0), ARRAY_SIZE(CMenu::_GCLoader) - 1u);
|
||||
bool memcard_emu = m_gcfg2.getBool(id, "devo_memcard_emu", false);
|
||||
|
||||
if(disc)
|
||||
{
|
||||
@ -856,8 +857,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
|
||||
else if(loader == 2 || (loader == 0 && m_devo_installed && strcasestr(path.c_str(), "boot.bin") == NULL))
|
||||
{
|
||||
loader = 2;
|
||||
bool memcard_emu = m_gcfg2.getBool(id, "devo_memcard_emu", false);
|
||||
DEVO_SetOptions(path.c_str(), DeviceName[currentPartition], m_dataDir.c_str(), id.c_str(), memcard_emu);
|
||||
DEVO_GetLoader(m_dataDir.c_str());
|
||||
}
|
||||
|
||||
m_gcfg1.save(true);
|
||||
@ -865,21 +865,24 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
|
||||
m_cat.save(true);
|
||||
m_cfg.save(true);
|
||||
cleanup();
|
||||
|
||||
#ifndef DOLPHIN
|
||||
USBStorage2_Deinit();
|
||||
USB_Deinitialize();
|
||||
Nand::Instance()->DeInit_ISFS();
|
||||
#endif
|
||||
|
||||
GC_SetVideoMode(videoMode, videoSetting);
|
||||
GC_SetLanguage(GClanguage);
|
||||
if(loader == 2)
|
||||
{
|
||||
loadIOS(58, true, true);
|
||||
writeStub();
|
||||
DEVO_SetOptions(path.c_str(), DeviceName[currentPartition], id.c_str(), memcard_emu);
|
||||
DEVO_Boot();
|
||||
}
|
||||
DML_New_WriteOptions();
|
||||
|
||||
Nand::Instance()->DeInit_ISFS();
|
||||
DML_New_WriteOptions();
|
||||
WII_Initialize();
|
||||
if(WII_LaunchTitle(0x100000100LL) < 0)
|
||||
Sys_LoadMenu();
|
||||
|
@ -687,7 +687,7 @@ int CMenu::main(void)
|
||||
{
|
||||
_showWaitMessage();
|
||||
_hideMain();
|
||||
bool isD2XnewerThanV6 = false;
|
||||
bool isD2XnewerThanV6 = (CurrentIOS.Type == IOS_TYPE_NEEK2O);
|
||||
if(CurrentIOS.Revision > 6 && CurrentIOS.Type == IOS_TYPE_D2X)
|
||||
isD2XnewerThanV6 = true;
|
||||
if(m_current_view == COVERFLOW_CHANNEL && m_cfg.getInt("NAND", "emulation", 0))
|
||||
|
@ -200,7 +200,7 @@ void CMenu::_enableNandEmu(bool fromconfig)
|
||||
|
||||
if(!disable)
|
||||
{
|
||||
bool isD2XnewerThanV6 = false;
|
||||
bool isD2XnewerThanV6 = (CurrentIOS.Type == IOS_TYPE_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)
|
||||
|
@ -25,6 +25,7 @@ enum
|
||||
IOS_TYPE_WANIN,
|
||||
IOS_TYPE_HERMES,
|
||||
IOS_TYPE_KWIIRK,
|
||||
IOS_TYPE_NEEK2O,
|
||||
IOS_TYPE_NORMAL_IOS,
|
||||
IOS_TYPE_STUB,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user