2011-07-29 22:59:31 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Copyright (C) 2011 Dimok
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
****************************************************************************/
|
2010-10-27 21:50:48 +02:00
|
|
|
#include "menu/menus.h"
|
2011-01-16 14:12:07 +01:00
|
|
|
#include "menu/WDMMenu.hpp"
|
2010-10-27 21:50:48 +02:00
|
|
|
#include "mload/mload.h"
|
|
|
|
#include "mload/mload_modules.h"
|
2010-11-07 13:16:34 +01:00
|
|
|
#include "system/IosLoader.h"
|
2010-12-31 00:49:22 +01:00
|
|
|
#include "Controls/DeviceHandler.hpp"
|
2011-11-12 19:14:09 +01:00
|
|
|
#include "Channels/channels.h"
|
2010-10-27 21:50:48 +02:00
|
|
|
#include "usbloader/disc.h"
|
2010-11-06 16:30:14 +01:00
|
|
|
#include "usbloader/apploader.h"
|
2011-02-05 22:06:52 +01:00
|
|
|
#include "usbloader/usbstorage2.h"
|
2010-11-06 16:30:14 +01:00
|
|
|
#include "usbloader/wdvd.h"
|
2010-10-27 21:50:48 +02:00
|
|
|
#include "usbloader/GameList.h"
|
|
|
|
#include "settings/CGameSettings.h"
|
|
|
|
#include "usbloader/frag.h"
|
|
|
|
#include "usbloader/wbfs.h"
|
2010-12-27 10:44:27 +01:00
|
|
|
#include "usbloader/playlog.h"
|
2010-12-31 00:49:22 +01:00
|
|
|
#include "usbloader/MountGamePartition.h"
|
2011-01-21 20:43:59 +01:00
|
|
|
#include "usbloader/AlternateDOLOffsets.h"
|
2010-10-27 21:50:48 +02:00
|
|
|
#include "settings/newtitles.h"
|
2011-06-18 09:00:42 +02:00
|
|
|
#include "network/Wiinnertag.h"
|
2011-07-29 22:59:31 +02:00
|
|
|
#include "patches/patchcode.h"
|
2010-11-06 16:30:14 +01:00
|
|
|
#include "patches/gamepatches.h"
|
|
|
|
#include "patches/wip.h"
|
2011-07-29 22:59:31 +02:00
|
|
|
#include "patches/bca.h"
|
2010-11-06 16:30:14 +01:00
|
|
|
#include "system/IosLoader.h"
|
2010-12-27 10:44:27 +01:00
|
|
|
#include "banner/OpeningBNR.hpp"
|
2010-10-27 21:50:48 +02:00
|
|
|
#include "wad/nandtitle.h"
|
2010-11-06 16:30:14 +01:00
|
|
|
#include "menu/menus.h"
|
|
|
|
#include "memory/memory.h"
|
2011-01-22 01:06:28 +01:00
|
|
|
#include "GameBooter.hpp"
|
2011-07-26 10:57:12 +02:00
|
|
|
#include "NandEmu.h"
|
2011-07-24 18:32:09 +02:00
|
|
|
#include "SavePath.h"
|
2010-11-06 16:30:14 +01:00
|
|
|
#include "sys.h"
|
|
|
|
|
|
|
|
//appentrypoint has to be global because of asm
|
|
|
|
u32 AppEntrypoint = 0;
|
2010-10-27 21:50:48 +02:00
|
|
|
|
|
|
|
struct discHdr *dvdheader = NULL;
|
2011-12-20 22:41:00 +01:00
|
|
|
extern u8 mountMethod;
|
2010-10-27 21:50:48 +02:00
|
|
|
|
2011-01-22 01:06:28 +01:00
|
|
|
int GameBooter::BootGCMode()
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
ExitApp();
|
|
|
|
gprintf("\nLoading BC for GameCube");
|
|
|
|
WII_Initialize();
|
|
|
|
return WII_LaunchTitle(0x0000000100000100ULL);
|
2011-01-22 01:06:28 +01:00
|
|
|
}
|
2010-11-06 16:30:14 +01:00
|
|
|
|
2011-01-22 01:06:28 +01:00
|
|
|
|
2011-05-30 21:49:12 +02:00
|
|
|
u32 GameBooter::BootPartition(char * dolpath, u8 videoselected, u8 alternatedol, u32 alternatedoloffset)
|
2010-11-06 16:30:14 +01:00
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
gprintf("booting partition IOS %u r%u\n", IOS_GetVersion(), IOS_GetRevision());
|
|
|
|
entry_point p_entry;
|
|
|
|
s32 ret;
|
|
|
|
u64 offset;
|
2010-11-06 16:30:14 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
/* Find game partition offset */
|
|
|
|
ret = Disc_FindPartition(&offset);
|
|
|
|
if (ret < 0)
|
|
|
|
return 0;
|
2010-11-06 16:30:14 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
/* Open specified partition */
|
|
|
|
ret = WDVD_OpenPartition(offset);
|
|
|
|
if (ret < 0)
|
|
|
|
return 0;
|
2010-11-06 16:30:14 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
/* Setup low memory */
|
|
|
|
Disc_SetLowMem();
|
2011-03-14 22:19:21 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
/* Setup video mode */
|
|
|
|
Disc_SelectVMode(videoselected);
|
2010-11-06 16:30:14 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
/* Run apploader */
|
|
|
|
ret = Apploader_Run(&p_entry, dolpath, alternatedol, alternatedoloffset);
|
2010-11-06 16:30:14 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
if (ret < 0)
|
|
|
|
return 0;
|
2010-11-06 16:30:14 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
return (u32) p_entry;
|
2010-11-06 16:30:14 +01:00
|
|
|
}
|
|
|
|
|
2011-01-22 01:06:28 +01:00
|
|
|
void GameBooter::SetupAltDOL(u8 * gameID, u8 &alternatedol, u32 &alternatedoloffset)
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
if(alternatedol == ALT_DOL_ON_LAUNCH)
|
|
|
|
{
|
|
|
|
alternatedol = ALT_DOL_FROM_GAME;
|
|
|
|
alternatedoloffset = WDMMenu::GetAlternateDolOffset();
|
|
|
|
}
|
|
|
|
else if(alternatedol == ALT_DOL_DEFAULT)
|
|
|
|
{
|
|
|
|
alternatedol = ALT_DOL_FROM_GAME;
|
|
|
|
alternatedoloffset = defaultAltDol((char *) gameID);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(alternatedol == ALT_DOL_FROM_GAME && alternatedoloffset == 0)
|
|
|
|
alternatedol = OFF;
|
2011-01-22 01:06:28 +01:00
|
|
|
}
|
|
|
|
|
2011-11-12 19:14:09 +01:00
|
|
|
void GameBooter::SetupNandEmu(u8 NandEmuMode, const char *NandEmuPath, struct discHdr &gameHeader)
|
2011-07-29 22:59:31 +02:00
|
|
|
{
|
2011-11-12 19:14:09 +01:00
|
|
|
if(NandEmuMode && strchr(NandEmuPath, '/'))
|
2011-07-29 22:59:31 +02:00
|
|
|
{
|
|
|
|
//! Create save game path and title.tmd for not existing saves
|
|
|
|
CreateSavePath(&gameHeader);
|
|
|
|
|
2011-11-12 19:14:09 +01:00
|
|
|
gprintf("Enabling Nand Emulation on: %s\n", NandEmuPath);
|
2011-09-03 11:39:26 +02:00
|
|
|
Set_FullMode(NandEmuMode == 2);
|
2011-11-12 19:14:09 +01:00
|
|
|
Set_Path(strchr(NandEmuPath, '/'));
|
2011-07-29 22:59:31 +02:00
|
|
|
|
|
|
|
//! Set which partition to use (USB only)
|
2011-11-12 19:14:09 +01:00
|
|
|
if(strncmp(NandEmuPath, "usb", 3) == 0)
|
|
|
|
Set_Partition(atoi(NandEmuPath+3)-1);
|
2011-07-29 22:59:31 +02:00
|
|
|
//! Unmount SD since NAND Emu mount fails otherwise
|
2011-11-12 19:14:09 +01:00
|
|
|
else if(strncmp(NandEmuPath, "sd", 2) == 0)
|
2011-07-29 22:59:31 +02:00
|
|
|
DeviceHandler::Instance()->UnMountSD();
|
|
|
|
|
2011-11-12 19:14:09 +01:00
|
|
|
Enable_Emu(strncmp(NandEmuPath, "usb", 3) == 0 ? EMU_USB : EMU_SD);
|
2011-07-29 22:59:31 +02:00
|
|
|
|
|
|
|
//! Remount SD again after activating NAND emu
|
2011-11-12 19:14:09 +01:00
|
|
|
if(strncmp(NandEmuPath, "sd", 2) == 0)
|
2011-07-29 22:59:31 +02:00
|
|
|
DeviceHandler::Instance()->MountSD();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-22 01:06:28 +01:00
|
|
|
int GameBooter::SetupDisc(u8 * gameID)
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
if (mountMethod)
|
|
|
|
{
|
|
|
|
gprintf("\tloading DVD\n");
|
|
|
|
return Disc_Open();
|
|
|
|
}
|
|
|
|
|
|
|
|
int ret = -1;
|
|
|
|
|
|
|
|
if(IosLoader::IsWaninkokoIOS() && IOS_GetRevision() < 18)
|
|
|
|
{
|
|
|
|
gprintf("Disc_SetUSB...");
|
|
|
|
ret = Disc_SetUSB(gameID);
|
|
|
|
gprintf("%d\n", ret);
|
|
|
|
if(ret < 0) return ret;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gprintf("Loading fragment list...");
|
|
|
|
ret = get_frag_list(gameID);
|
|
|
|
gprintf("%d\n", ret);
|
|
|
|
if(ret < 0) return ret;
|
|
|
|
ret = set_frag_list(gameID);
|
|
|
|
if(ret < 0) return ret;
|
|
|
|
gprintf("\tUSB set to game\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
gprintf("Disc_Open()...");
|
|
|
|
ret = Disc_Open();
|
|
|
|
gprintf("%d\n", ret);
|
|
|
|
|
|
|
|
return ret;
|
2011-01-22 01:06:28 +01:00
|
|
|
}
|
|
|
|
|
2011-11-20 11:46:07 +01:00
|
|
|
void GameBooter::ShutDownDevices(int gameUSBPort)
|
|
|
|
{
|
|
|
|
gprintf("Shutting down devices...\n");
|
|
|
|
//! Flush all caches and close up all devices
|
|
|
|
WBFS_CloseAll();
|
|
|
|
DeviceHandler::DestroyInstance();
|
|
|
|
|
|
|
|
//! Shadow mload - Only needed on some games with Hermes v5.1 (Check is inside the function)
|
|
|
|
shadow_mload();
|
|
|
|
|
|
|
|
if(Settings.USBPort == 2)
|
|
|
|
//! Reset USB port because device handler changes it for cache flushing
|
|
|
|
USBStorage2_SetPort(gameUSBPort);
|
|
|
|
USBStorage2_Deinit();
|
|
|
|
USB_Deinitialize();
|
|
|
|
}
|
|
|
|
|
2011-12-22 23:44:48 +01:00
|
|
|
int GameBooter::BootGame(struct discHdr *gameHdr)
|
2011-01-22 01:06:28 +01:00
|
|
|
{
|
2011-12-22 23:44:48 +01:00
|
|
|
if(!gameHdr)
|
2011-07-26 00:28:22 +02:00
|
|
|
return -1;
|
2011-01-22 01:06:28 +01:00
|
|
|
|
2011-12-22 23:44:48 +01:00
|
|
|
char gameID[7];
|
|
|
|
snprintf(gameID, sizeof(gameID), "%s", gameHdr->id);
|
|
|
|
gprintf("\tBootGame: %s\n", gameID);
|
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
if(Settings.Wiinnertag)
|
|
|
|
Wiinnertag::TagGame(gameID);
|
2011-06-18 09:00:42 +02:00
|
|
|
|
2011-12-20 22:41:00 +01:00
|
|
|
if(mountMethod == 2)
|
|
|
|
return BootGCMode();
|
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
AppCleanUp();
|
2010-10-27 21:50:48 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
gprintf("\tSettings.partition: %d\n", Settings.partition);
|
2011-01-22 01:06:28 +01:00
|
|
|
|
2011-12-22 23:44:48 +01:00
|
|
|
s32 ret = -1;
|
2011-07-26 00:28:22 +02:00
|
|
|
struct discHdr gameHeader;
|
2011-12-22 23:44:48 +01:00
|
|
|
memcpy(&gameHeader, gameHdr, sizeof(struct discHdr));
|
2011-12-20 22:41:00 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
//! Remember game's USB port
|
|
|
|
int partition = gameList.GetPartitionNumber(gameHeader.id);
|
|
|
|
int usbport = DeviceHandler::PartitionToUSBPort(partition);
|
2011-06-22 19:57:37 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
//! Setup game configuration from game settings. If no game settings exist use global/default.
|
|
|
|
GameCFG * game_cfg = GameSettings.GetGameCFG(gameHeader.id);
|
|
|
|
u8 videoChoice = game_cfg->video == INHERIT ? Settings.videomode : game_cfg->video;
|
2011-12-23 16:48:20 +01:00
|
|
|
u8 aspectChoice = game_cfg->aspectratio == INHERIT ? Settings.GameAspectRatio : game_cfg->aspectratio;
|
2011-07-26 00:28:22 +02:00
|
|
|
u8 languageChoice = game_cfg->language == INHERIT ? Settings.language : game_cfg->language;
|
|
|
|
u8 ocarinaChoice = game_cfg->ocarina == INHERIT ? Settings.ocarina : game_cfg->ocarina;
|
|
|
|
u8 viChoice = game_cfg->vipatch == INHERIT ? Settings.videopatch : game_cfg->vipatch;
|
|
|
|
u8 sneekChoice = game_cfg->sneekVideoPatch == INHERIT ? Settings.sneekVideoPatch : game_cfg->sneekVideoPatch;
|
|
|
|
u8 iosChoice = game_cfg->ios == INHERIT ? Settings.cios : game_cfg->ios;
|
|
|
|
u8 fix002 = game_cfg->errorfix002 == INHERIT ? Settings.error002 : game_cfg->errorfix002;
|
|
|
|
u8 countrystrings = game_cfg->patchcountrystrings == INHERIT ? Settings.patchcountrystrings : game_cfg->patchcountrystrings;
|
|
|
|
u8 alternatedol = game_cfg->loadalternatedol;
|
|
|
|
u32 alternatedoloffset = game_cfg->alternatedolstart;
|
|
|
|
u8 reloadblock = game_cfg->iosreloadblock == INHERIT ? Settings.BlockIOSReload : game_cfg->iosreloadblock;
|
2011-09-03 11:39:26 +02:00
|
|
|
u8 Hooktype = game_cfg->Hooktype == INHERIT ? Settings.Hooktype : game_cfg->Hooktype;
|
|
|
|
u8 WiirdDebugger = game_cfg->WiirdDebugger == INHERIT ? Settings.WiirdDebugger : game_cfg->WiirdDebugger;
|
2011-07-26 00:28:22 +02:00
|
|
|
u64 returnToChoice = game_cfg->returnTo ? NandTitles.FindU32(Settings.returnTo) : 0;
|
2011-12-20 22:41:00 +01:00
|
|
|
u8 NandEmuMode = game_cfg->NandEmuMode == INHERIT ? Settings.NandEmuMode : game_cfg->NandEmuMode;
|
|
|
|
const char *NandEmuPath = game_cfg->NandEmuPath.size() == 0 ? Settings.NandEmuPath : game_cfg->NandEmuPath.c_str();
|
2011-12-22 23:44:48 +01:00
|
|
|
if(gameHeader.tid != 0)
|
2011-12-20 22:41:00 +01:00
|
|
|
{
|
2011-12-22 23:44:48 +01:00
|
|
|
NandEmuMode = (gameHeader.type == TYPE_GAME_EMUNANDCHAN) ? 2 : 0; // If from emu nand set full emulation mode
|
2011-12-20 22:41:00 +01:00
|
|
|
NandEmuPath = game_cfg->NandEmuPath.size() == 0 ? Settings.NandEmuChanPath : game_cfg->NandEmuPath.c_str();
|
|
|
|
}
|
2011-01-21 20:43:59 +01:00
|
|
|
|
2011-09-04 12:13:47 +02:00
|
|
|
if(ocarinaChoice && Hooktype == OFF)
|
|
|
|
Hooktype = 1;
|
2011-07-24 18:32:09 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
//! Prepare alternate dol settings
|
|
|
|
SetupAltDOL(gameHeader.id, alternatedol, alternatedoloffset);
|
|
|
|
|
|
|
|
//! Reload game settings cIOS for this game
|
|
|
|
if(iosChoice != IOS_GetVersion())
|
|
|
|
{
|
|
|
|
gprintf("Reloading into game cIOS: %i...\n", iosChoice);
|
|
|
|
IosLoader::LoadGameCios(iosChoice);
|
|
|
|
if(MountGamePartition(false) < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2011-07-29 22:59:31 +02:00
|
|
|
//! Modify Wii Message Board to display the game starting here (before Nand Emu)
|
|
|
|
if(Settings.PlaylogUpdate)
|
|
|
|
Playlog_Update((char *) gameHeader.id, BNRInstance::Instance()->GetIMETTitle(CONF_GetLanguage()));
|
|
|
|
|
|
|
|
//! Setup NAND emulation
|
2011-12-20 22:41:00 +01:00
|
|
|
SetupNandEmu(NandEmuMode, NandEmuPath, gameHeader);
|
2011-07-29 22:59:31 +02:00
|
|
|
|
2011-11-12 19:14:09 +01:00
|
|
|
// Load wip codes
|
|
|
|
load_wip_code(gameHeader.id);
|
2011-07-26 00:28:22 +02:00
|
|
|
|
2011-11-12 19:14:09 +01:00
|
|
|
//! Load Ocarina codes
|
|
|
|
if (ocarinaChoice)
|
2011-11-15 22:01:25 +01:00
|
|
|
ocarina_load_code(Settings.Cheatcodespath, gameHeader.id);
|
2011-11-12 19:14:09 +01:00
|
|
|
|
|
|
|
//! Setup disc stuff if we load a game
|
2011-12-22 23:44:48 +01:00
|
|
|
if(gameHeader.tid == 0)
|
2011-11-12 19:14:09 +01:00
|
|
|
{
|
|
|
|
//! Setup disc in cIOS and open it
|
|
|
|
ret = SetupDisc(gameHeader.id);
|
|
|
|
if (ret < 0)
|
|
|
|
Sys_BackToLoader();
|
|
|
|
|
|
|
|
//! Load BCA data for the game
|
|
|
|
gprintf("Loading BCA data...");
|
|
|
|
ret = do_bca_code(Settings.BcaCodepath, gameHeader.id);
|
|
|
|
gprintf("%d\n", ret);
|
|
|
|
}
|
2011-07-26 00:28:22 +02:00
|
|
|
|
2011-12-22 23:44:48 +01:00
|
|
|
if(IosLoader::IsHermesIOS())
|
2011-07-26 00:28:22 +02:00
|
|
|
{
|
|
|
|
if(reloadblock == ON)
|
|
|
|
{
|
2011-12-22 23:44:48 +01:00
|
|
|
//! Setup IOS reload block
|
2011-07-26 00:28:22 +02:00
|
|
|
enable_ES_ioctlv_vector();
|
|
|
|
if (gameList.GetGameFS(gameHeader.id) == PART_FS_WBFS)
|
|
|
|
mload_close();
|
|
|
|
}
|
|
|
|
}
|
2011-12-22 23:44:48 +01:00
|
|
|
else if(IosLoader::GetIOSInfo(IOS_GetVersion()) != NULL)
|
2011-07-26 00:28:22 +02:00
|
|
|
{
|
2011-12-22 23:44:48 +01:00
|
|
|
// Open ES file descriptor for the d2x patches
|
|
|
|
static char es_fs[] ATTRIBUTE_ALIGN(32) = "/dev/es";
|
|
|
|
int es_fd = IOS_Open(es_fs, 0);
|
|
|
|
if(es_fd >= 0)
|
|
|
|
{
|
|
|
|
// IOS Reload Block
|
|
|
|
if(reloadblock != OFF) {
|
|
|
|
BlockIOSReload(es_fd, iosChoice);
|
|
|
|
}
|
|
|
|
// Check if new patch method for return to works otherwise old method will be used
|
|
|
|
if(PatchNewReturnTo(es_fd, returnToChoice) < 0)
|
|
|
|
returnToChoice = 0; // Patch successful, no need for old method
|
|
|
|
|
|
|
|
// Close ES file descriptor
|
|
|
|
IOS_Close(es_fd);
|
|
|
|
}
|
2011-07-26 00:28:22 +02:00
|
|
|
}
|
2011-02-05 22:06:52 +01:00
|
|
|
|
2011-11-12 19:14:09 +01:00
|
|
|
//! Now we can free up the memory used by the game/channel lists
|
2011-07-26 00:28:22 +02:00
|
|
|
gameList.clear();
|
2011-11-12 19:14:09 +01:00
|
|
|
Channels::DestroyInstance();
|
2011-07-26 00:28:22 +02:00
|
|
|
|
|
|
|
//! Load main.dol or alternative dol into memory, start the game apploader and get game entrypoint
|
2011-12-22 23:44:48 +01:00
|
|
|
if(gameHeader.tid == 0)
|
2011-11-12 19:14:09 +01:00
|
|
|
{
|
|
|
|
gprintf("\tGame Boot\n");
|
|
|
|
AppEntrypoint = BootPartition(Settings.dolpath, videoChoice, alternatedol, alternatedoloffset);
|
2011-11-20 11:46:07 +01:00
|
|
|
// Reading of game is done we can close devices now
|
|
|
|
ShutDownDevices(usbport);
|
2011-11-12 19:14:09 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-20 11:46:07 +01:00
|
|
|
//! shutdown now and avoid later crashs with free if memory gets overwritten by channel
|
|
|
|
ShutDownDevices(usbport);
|
2011-11-12 19:14:09 +01:00
|
|
|
gprintf("\tChannel Boot\n");
|
|
|
|
/* Setup low memory */
|
|
|
|
Disc_SetLowMem();
|
|
|
|
/* Setup video mode */
|
|
|
|
Disc_SelectVMode(videoChoice);
|
|
|
|
// Load dol
|
2011-11-13 10:09:27 +01:00
|
|
|
AppEntrypoint = Channels::LoadChannel(gameHeader.tid);
|
2011-11-12 19:14:09 +01:00
|
|
|
}
|
2011-07-26 00:28:22 +02:00
|
|
|
|
|
|
|
//! No entrypoint found...back to HBC/SystemMenu
|
|
|
|
if(AppEntrypoint == 0)
|
|
|
|
{
|
2011-11-12 19:14:09 +01:00
|
|
|
gprintf("AppEntryPoint is 0, something went wrong\n");
|
2011-07-26 00:28:22 +02:00
|
|
|
WDVD_ClosePartition();
|
|
|
|
Sys_BackToLoader();
|
|
|
|
}
|
|
|
|
|
|
|
|
//! Do all the game patches
|
|
|
|
gprintf("Applying game patches...\n");
|
2011-12-23 16:48:20 +01:00
|
|
|
gamepatches(videoChoice, aspectChoice, languageChoice, countrystrings, viChoice, sneekChoice, Hooktype, fix002, returnToChoice);
|
2011-07-26 00:28:22 +02:00
|
|
|
|
2011-07-29 22:59:31 +02:00
|
|
|
//! Load Code handler if needed
|
2011-11-12 19:14:09 +01:00
|
|
|
load_handler(Hooktype, WiirdDebugger, Settings.WiirdDebuggerPause);
|
2011-07-26 00:28:22 +02:00
|
|
|
|
|
|
|
//! Jump to the entrypoint of the game - the last function of the USB Loader
|
|
|
|
gprintf("Jumping to game entrypoint: 0x%08X.\n", AppEntrypoint);
|
2011-09-04 12:13:47 +02:00
|
|
|
return Disc_JumpToEntrypoint(Hooktype, WDMMenu::GetDolParameter());
|
2010-10-27 21:50:48 +02:00
|
|
|
}
|