2009-10-01 01:10:58 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* DiscBrowser
|
|
|
|
* USB Loader GX 2009
|
|
|
|
*
|
|
|
|
* DiscBrowser.h
|
|
|
|
***************************************************************************/
|
2010-12-17 18:50:44 +01:00
|
|
|
#include <unistd.h>
|
2009-10-01 01:10:58 +02:00
|
|
|
#include "language/gettext.h"
|
|
|
|
#include "libwiigui/gui.h"
|
|
|
|
#include "libwiigui/gui_customoptionbrowser.h"
|
|
|
|
#include "prompts/PromptWindows.h"
|
2011-01-11 18:52:30 +01:00
|
|
|
#include "menu/menus.h"
|
2009-10-01 01:10:58 +02:00
|
|
|
#include "usbloader/disc.h"
|
|
|
|
#include "usbloader/fstfile.h"
|
|
|
|
#include "usbloader/wdvd.h"
|
2010-10-01 17:01:19 +02:00
|
|
|
#include "usbloader/wbfs.h"
|
2010-12-17 18:50:44 +01:00
|
|
|
#include "patches/dvd_broadway.h"
|
2010-10-01 20:53:38 +02:00
|
|
|
#include "libs/libwbfs/libwbfs.h"
|
|
|
|
#include "libs/libwbfs/wiidisc.h"
|
2009-10-01 01:10:58 +02:00
|
|
|
#include "main.h"
|
|
|
|
#include "sys.h"
|
2010-10-28 11:00:52 +02:00
|
|
|
#include "settings/GameTitles.h"
|
2010-09-24 19:58:56 +02:00
|
|
|
#include "themes/CTheme.h"
|
2010-11-06 16:30:14 +01:00
|
|
|
#include "memory/memory.h"
|
2010-12-17 18:50:44 +01:00
|
|
|
#include "gecko.h"
|
2009-10-01 01:10:58 +02:00
|
|
|
|
|
|
|
/********************************************************************************
|
2010-09-24 02:48:03 +02:00
|
|
|
*Disk Browser
|
|
|
|
*********************************************************************************/
|
2010-11-13 23:34:53 +01:00
|
|
|
int DiscBrowse(const char * GameID, char * alternatedname, int alternatedname_size)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
gprintf("\nDiscBrowser() started");
|
2009-10-01 01:10:58 +02:00
|
|
|
bool exit = false;
|
2010-12-17 18:50:44 +01:00
|
|
|
int ret = -1, choice;
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
HaltGui();
|
|
|
|
|
2010-12-17 18:50:44 +01:00
|
|
|
gprintf("WBFS_OpenDisc\n");
|
2010-11-13 23:34:53 +01:00
|
|
|
wbfs_disc_t *disc = WBFS_OpenDisc((u8 *) GameID);
|
2010-10-01 17:01:19 +02:00
|
|
|
if (!disc)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
|
|
|
ResumeGui();
|
2010-09-24 02:48:03 +02:00
|
|
|
WindowPrompt(tr( "ERROR:" ), tr( "Could not open Disc" ), tr( "OK" ));
|
2009-10-01 01:10:58 +02:00
|
|
|
return ret;
|
|
|
|
}
|
2010-12-17 18:50:44 +01:00
|
|
|
gprintf("wd_open_disc\n");
|
2010-10-01 17:01:19 +02:00
|
|
|
wiidisc_t *wdisc = wd_open_disc((int(*)(void *, u32, u32, void *)) wbfs_disc_read, disc);
|
|
|
|
if (!wdisc)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
|
|
|
ResumeGui();
|
2010-10-01 17:01:19 +02:00
|
|
|
WindowPrompt(tr( "ERROR:" ), tr( "Could not open Disc" ), tr( "OK" ));
|
2009-10-01 01:10:58 +02:00
|
|
|
return ret;
|
|
|
|
}
|
2010-09-19 01:16:05 +02:00
|
|
|
|
2010-12-17 18:50:44 +01:00
|
|
|
gprintf("wd_get_fst\n");
|
2010-10-01 17:01:19 +02:00
|
|
|
FST_ENTRY * fstbuffer = (FST_ENTRY *) wd_get_fst(wdisc, ONLY_GAME_PARTITION);
|
|
|
|
if (!fstbuffer)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
|
|
|
ResumeGui();
|
2010-09-24 02:48:03 +02:00
|
|
|
WindowPrompt(tr( "ERROR:" ), tr( "Not enough free memory." ), tr( "OK" ));
|
2009-10-01 01:10:58 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-12-17 18:50:44 +01:00
|
|
|
gprintf("wd_close_disc\n");
|
2010-10-01 17:01:19 +02:00
|
|
|
wd_close_disc(wdisc);
|
2010-12-17 18:50:44 +01:00
|
|
|
gprintf("WBFS_CloseDisc\n");
|
2010-10-01 17:01:19 +02:00
|
|
|
WBFS_CloseDisc(disc);
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-12-17 18:50:44 +01:00
|
|
|
gprintf("options\n");
|
|
|
|
OptionList options;
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-12-17 18:50:44 +01:00
|
|
|
for (u32 i = 0, position = 0; i < fstbuffer[0].filelen; i++)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2009-10-01 01:10:58 +02:00
|
|
|
//don't add files that aren't .dol to the list
|
2010-12-04 08:36:23 +01:00
|
|
|
const char * filename = fstfiles(fstbuffer, i);
|
|
|
|
const char * fileext = NULL;
|
|
|
|
|
|
|
|
if(filename)
|
|
|
|
fileext = strrchr(filename, '.');
|
|
|
|
|
|
|
|
if (fileext && strcasecmp(fileext, ".dol") == 0)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-12-17 18:50:44 +01:00
|
|
|
options.SetName(position, "%s %03i", tr("Offset"), i);
|
|
|
|
options.SetValue(position, filename);
|
|
|
|
position++;
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
|
|
|
}
|
2010-12-04 08:36:23 +01:00
|
|
|
|
2010-12-17 18:50:44 +01:00
|
|
|
free(fstbuffer);
|
|
|
|
|
|
|
|
gprintf("\n%i alt dols found", options.GetLength()+1);
|
|
|
|
if (options.GetLength() <= 0)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
WindowPrompt(tr( "ERROR" ), tr( "No DOL file found on disc." ), tr( "OK" ));
|
2010-12-17 18:50:44 +01:00
|
|
|
return ret;
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
|
|
|
|
2010-09-26 10:33:43 +02:00
|
|
|
GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
|
|
|
|
GuiImageData settingsbg(Resources::GetFile("settings_background.png"), Resources::GetFileSize("settings_background.png"));
|
2009-10-01 01:10:58 +02:00
|
|
|
|
|
|
|
GuiTrigger trigA;
|
2010-09-24 02:48:03 +02:00
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
2009-10-01 01:10:58 +02:00
|
|
|
GuiTrigger trigHome;
|
2010-09-24 02:48:03 +02:00
|
|
|
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
|
2009-10-01 01:10:58 +02:00
|
|
|
GuiTrigger trigB;
|
2010-09-24 02:48:03 +02:00
|
|
|
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
|
|
|
|
2010-11-13 23:34:53 +01:00
|
|
|
GuiText titleTxt(GameTitles.GetTitle(GameID), 28, ( GXColor ) {0, 0, 0, 255});
|
2010-09-24 02:48:03 +02:00
|
|
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(12, 40);
|
|
|
|
titleTxt.SetMaxWidth(356, SCROLL_HORIZONTAL);
|
|
|
|
|
|
|
|
GuiImage settingsbackground(&settingsbg);
|
|
|
|
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
|
|
|
|
settingsbackgroundbtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
settingsbackgroundbtn.SetPosition(0, 0);
|
|
|
|
settingsbackgroundbtn.SetImage(&settingsbackground);
|
|
|
|
|
2010-12-26 18:02:14 +01:00
|
|
|
GuiText cancelBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
|
2010-09-24 02:48:03 +02:00
|
|
|
cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30);
|
|
|
|
GuiImage cancelBtnImg(&btnOutline);
|
2010-10-27 16:45:27 +02:00
|
|
|
if (Settings.wsprompt == ON)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
cancelBtnTxt.SetWidescreen(Settings.widescreen);
|
|
|
|
cancelBtnImg.SetWidescreen(Settings.widescreen);
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
2010-11-13 23:34:53 +01:00
|
|
|
GuiButton cancelBtn(&cancelBtnImg, &cancelBtnImg, 2, 3, 180, 400, &trigA, btnSoundOver, btnSoundClick2, 1);
|
2010-09-24 02:48:03 +02:00
|
|
|
cancelBtn.SetScale(0.9);
|
|
|
|
cancelBtn.SetLabel(&cancelBtnTxt);
|
|
|
|
cancelBtn.SetTrigger(&trigB);
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-12-17 18:50:44 +01:00
|
|
|
GuiCustomOptionBrowser optionBrowser3(396, 280, &options, "bg_options_settings.png");
|
2010-09-24 02:48:03 +02:00
|
|
|
optionBrowser3.SetPosition(0, 90);
|
|
|
|
optionBrowser3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-10-01 01:10:58 +02:00
|
|
|
|
|
|
|
HaltGui();
|
2010-09-24 02:48:03 +02:00
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
w.Append(&settingsbackgroundbtn);
|
|
|
|
w.Append(&titleTxt);
|
|
|
|
w.Append(&cancelBtn);
|
|
|
|
w.Append(&optionBrowser3);
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
mainWindow->Append(&w);
|
2009-10-01 01:10:58 +02:00
|
|
|
|
|
|
|
ResumeGui();
|
2010-09-24 02:48:03 +02:00
|
|
|
while (!exit)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-12-17 18:50:44 +01:00
|
|
|
usleep(100);
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-12-17 18:50:44 +01:00
|
|
|
if (shutdown)
|
|
|
|
Sys_Shutdown();
|
|
|
|
if (reset)
|
|
|
|
Sys_Reboot();
|
2010-01-19 11:48:50 +01:00
|
|
|
|
2009-10-01 01:10:58 +02:00
|
|
|
ret = optionBrowser3.GetClickedOption();
|
|
|
|
|
2010-12-17 18:50:44 +01:00
|
|
|
if (ret >= 0)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-12-17 18:50:44 +01:00
|
|
|
choice = WindowPrompt(options.GetValue(ret), tr( "Load this DOL as alternate DOL?" ), tr( "OK" ), tr( "Cancel" ));
|
2010-09-24 02:48:03 +02:00
|
|
|
if (choice)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-12-17 18:50:44 +01:00
|
|
|
snprintf(alternatedname, alternatedname_size, options.GetValue(ret));
|
|
|
|
const char * offset = options.GetName(ret);
|
|
|
|
if(offset)
|
|
|
|
ret = atoi(offset+strlen("Offset ")); //doloffset
|
|
|
|
else
|
|
|
|
ret = -1; // weird problem
|
2010-09-19 01:16:05 +02:00
|
|
|
exit = true;
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
if (cancelBtn.GetState() == STATE_CLICKED)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
|
|
|
exit = true;
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HaltGui();
|
2010-09-24 02:48:03 +02:00
|
|
|
mainWindow->Remove(&w);
|
2009-10-01 01:10:58 +02:00
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
int autoSelectDol(const char *id, bool force)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
gprintf("\nautoSelectDol() started");
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
|
|
char id4[10];
|
2010-09-24 02:48:03 +02:00
|
|
|
sprintf(id4, "%c%c%c%c", id[0], id[1], id[2], id[3]);
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
////// games that can be forced (always need alt dol)
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
//Boogie
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RBOP69") == 0) return 675;//previous value was 657
|
|
|
|
if (strcmp(id, "RBOE69") == 0) return 675;//starstremr
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
|
|
//Fifa 08
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RF8E69") == 0) return 439;//from isostar
|
|
|
|
if (strcmp(id, "RF8P69") == 0) return 463;//from isostar
|
|
|
|
if (strcmp(id, "RF8X69") == 0) return 464;//from isostar
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
|
|
//Madden NFL07
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RMDP69") == 0) return 39;//from isostar
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
|
|
//Madden NFL08
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RNFP69") == 0) return 1079;//from isostar
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
|
|
//Medal of Honor: Heroes 2
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RM2X69") == 0) return 601;//dj_skual
|
|
|
|
if (strcmp(id, "RM2P69") == 0) return 517;//MZottel
|
|
|
|
if (strcmp(id, "RM2E69") == 0) return 492;//Old8oy
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
|
|
//Mortal Kombat
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RKMP5D") == 0) return 290;//from isostar
|
|
|
|
if (strcmp(id, "RKME5D") == 0) return 290;//starstremr
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
|
|
//NBA 08
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RNBX69") == 0) return 964;//from isostar
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
|
|
//Pangya! Golf with Style
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RPYP9B") == 0) return 12490;//from isostar
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
|
|
//Redsteel
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "REDP41") == 0) return 1957;//from isostar
|
|
|
|
if (strcmp(id, "REDE41") == 0) return 1957;//starstremr
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
|
|
//SSX
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RSXP69") == 0) return 377;//previous value was 337
|
|
|
|
if (strcmp(id, "RSXE69") == 0) return 377;//previous value was 337
|
2010-09-19 01:16:05 +02:00
|
|
|
|
2010-12-29 11:22:11 +01:00
|
|
|
//Madden NFL 07
|
|
|
|
if (strcmp(id, "RMDE69") == 0) return 39; //from TwEbErIs
|
|
|
|
|
|
|
|
//Madden NFL 08
|
|
|
|
if (strcmp(id, "RNFE69") == 0) return 1079; //from TwEbErIs
|
|
|
|
|
|
|
|
//Super Swing Golf
|
|
|
|
if (strcmp(id, "RPYE9B") == 0) return 10617; //from TwEbErIs
|
|
|
|
|
|
|
|
//NBA Live 08
|
|
|
|
if (strcmp(id, "RNBE69") == 0) return 936; //from TwEbErIs
|
2010-09-19 01:16:05 +02:00
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
///// games that can't be forced (alt dol is not always needed)
|
|
|
|
if (!force)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
|
|
|
//Grand Slam Tennis
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "R5TP69") == 0) return 1493;//from isostar
|
|
|
|
if (strcmp(id, "R5TE69") == 0) return 1493;//starstremr
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
|
|
//Medal of Honor Heroes
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RMZX69") == 0) return 492;//from isostar
|
|
|
|
if (strcmp(id, "RMZP69") == 0) return 492;//from isostar
|
|
|
|
if (strcmp(id, "RMZE69") == 0) return 492;//starstremr
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
|
|
//Tiger Woods 10
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "R9OP69") == 0) return 1991;//from isostar
|
|
|
|
if (strcmp(id, "R9OE69") == 0) return 1973;//starstremr
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
|
|
//Virtual Tennis 2009
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RVUP8P") == 0) return 16426;//from isostar
|
|
|
|
if (strcmp(id, "RVUE8P") == 0) return 16405;//from isostar
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
|
|
//Wii Sports Resort
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RZTP01") == 0) return 952;//from isostar
|
|
|
|
if (strcmp(id, "RZTE01") == 0) return 674;//from starstremr
|
2010-09-19 01:16:05 +02:00
|
|
|
}
|
|
|
|
|
2009-10-01 01:10:58 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
int autoSelectDolMenu(const char *id, bool force)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
//Indiana Jones and the Staff of Kings (Fate of Atlantis)
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RJ8E64") == 0)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-11-13 23:34:53 +01:00
|
|
|
int choice = WindowPrompt(tr( "Select a DOL" ), 0, "Fate of Atlantis", tr( "Cancel" ));
|
2010-09-24 02:48:03 +02:00
|
|
|
switch (choice)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-02-09 11:59:55 +01:00
|
|
|
case 1:
|
2010-09-19 01:16:05 +02:00
|
|
|
choice = 8; //from starstremr
|
|
|
|
break;
|
|
|
|
default: // no alt dol
|
|
|
|
choice = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return choice;
|
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RJ8P64") == 0)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-11-13 23:34:53 +01:00
|
|
|
int choice = WindowPrompt(tr( "Select a DOL" ), 0, "Fate of Atlantis", tr( "Cancel" ));
|
2010-09-24 02:48:03 +02:00
|
|
|
switch (choice)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
choice = 8; //from isostar
|
|
|
|
break;
|
|
|
|
default: // no alt dol
|
|
|
|
choice = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return choice;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Metal Slug Anthology (Metal Slug 6)
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RMLEH4") == 0)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-11-13 23:34:53 +01:00
|
|
|
int choice = WindowPrompt(tr( "Select a DOL" ), 0, "Metal Slug 6", tr( "Cancel" ));
|
2010-09-24 02:48:03 +02:00
|
|
|
switch (choice)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
choice = 54; //from lustar
|
|
|
|
break;
|
|
|
|
default: // no alt dol
|
|
|
|
choice = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return choice;
|
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RMLP7U") == 0)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-11-13 23:34:53 +01:00
|
|
|
int choice = WindowPrompt(tr( "Select a DOL" ), 0, "Metal Slug 6", tr( "Cancel" ));
|
2010-09-24 02:48:03 +02:00
|
|
|
switch (choice)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
choice = 56; //from isostar
|
|
|
|
break;
|
|
|
|
default: // no alt dol
|
|
|
|
choice = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return choice;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Metroid Prime Trilogy
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "R3ME01") == 0)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-11-13 23:34:53 +01:00
|
|
|
int choice = WindowPrompt(tr( "Select a DOL" ), 0, "Metroid Prime", "Metroid Prime 2", "Metroid Prime 3", tr( "Cancel" ));
|
2010-09-24 02:48:03 +02:00
|
|
|
switch (choice)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
choice = 780;
|
2010-02-09 11:59:55 +01:00
|
|
|
break;
|
|
|
|
case 2:
|
2010-09-19 01:16:05 +02:00
|
|
|
choice = 781;
|
2010-02-09 11:59:55 +01:00
|
|
|
break;
|
2010-09-19 01:16:05 +02:00
|
|
|
case 3:
|
|
|
|
choice = 782;
|
2010-02-09 11:59:55 +01:00
|
|
|
break;
|
|
|
|
default: // no alt dol
|
2010-09-19 01:16:05 +02:00
|
|
|
choice = 0;
|
2010-02-09 11:59:55 +01:00
|
|
|
break;
|
2010-09-19 01:16:05 +02:00
|
|
|
}
|
|
|
|
return choice;
|
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "R3MP01") == 0)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-11-13 23:34:53 +01:00
|
|
|
int choice = WindowPrompt(tr( "Select a DOL" ), 0, "Metroid Prime", "Metroid Prime 2", "Metroid Prime 3", tr( "Cancel" ));
|
2010-09-24 02:48:03 +02:00
|
|
|
switch (choice)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-02-09 11:59:55 +01:00
|
|
|
case 1:
|
2010-09-19 01:16:05 +02:00
|
|
|
choice = 782;
|
|
|
|
break;
|
2010-02-09 11:59:55 +01:00
|
|
|
case 2:
|
2010-09-19 01:16:05 +02:00
|
|
|
choice = 783;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
choice = 784;
|
2010-02-09 11:59:55 +01:00
|
|
|
break;
|
|
|
|
default: // no alt dol
|
2010-09-19 01:16:05 +02:00
|
|
|
choice = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return choice;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Rampage: Total Destruction (M1.dol=Rampage, jarvos.dol=Rampage World Tour)
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RPGP5D") == 0)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-11-13 23:34:53 +01:00
|
|
|
int choice = WindowPrompt(tr( "Select a DOL" ), 0, "Rampage", "World Tour", tr( "Cancel" ));
|
2010-09-24 02:48:03 +02:00
|
|
|
switch (choice)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-02-09 11:59:55 +01:00
|
|
|
case 1:
|
2010-09-19 01:16:05 +02:00
|
|
|
choice = 369; //from Ramzee
|
|
|
|
break;
|
2010-02-09 11:59:55 +01:00
|
|
|
case 2:
|
2010-09-19 01:16:05 +02:00
|
|
|
choice = 368; //from Ramzee
|
|
|
|
break;
|
|
|
|
default: // no alt dol
|
|
|
|
choice = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return choice;
|
|
|
|
}
|
|
|
|
|
|
|
|
//The House Of The Dead 2 & 3 Return (only to play 2)
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RHDE8P") == 0)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-11-13 23:34:53 +01:00
|
|
|
int choice = WindowPrompt(tr( "Select a DOL" ), 0, "HotD 2", tr( "Cancel" ));
|
2010-09-24 02:48:03 +02:00
|
|
|
switch (choice)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
choice = 149; //from starstremr
|
|
|
|
break;
|
2010-02-09 11:59:55 +01:00
|
|
|
default: // no alt dol
|
2010-09-19 01:16:05 +02:00
|
|
|
choice = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return choice;
|
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
if (strcmp(id, "RHDP8P") == 0)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-11-13 23:34:53 +01:00
|
|
|
int choice = WindowPrompt(tr( "Select a DOL" ), 0, "HotD 2", tr( "Cancel" ));
|
2010-09-24 02:48:03 +02:00
|
|
|
switch (choice)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
choice = 149; //from isostar
|
|
|
|
break;
|
|
|
|
default: // no alt dol
|
|
|
|
choice = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return choice;
|
|
|
|
}
|
2009-10-04 11:48:03 +02:00
|
|
|
|
2009-10-01 01:10:58 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************************
|
2010-09-24 02:48:03 +02:00
|
|
|
* Mount a DVD, get the type and ID.
|
|
|
|
*********************************************************************************/
|
2010-12-17 18:50:44 +01:00
|
|
|
u8 DiscMount(struct discHdr * header)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
gprintf("\nDiscMount() ");
|
2010-12-17 18:50:44 +01:00
|
|
|
u8 * g_diskID = (u8 *) 0x80000000;
|
2009-10-01 01:10:58 +02:00
|
|
|
int ret;
|
2010-09-19 01:16:05 +02:00
|
|
|
HaltGui();
|
|
|
|
|
2011-01-11 18:52:30 +01:00
|
|
|
u8 tmpBuff[0x60];
|
2010-09-24 02:48:03 +02:00
|
|
|
memcpy(tmpBuff, g_diskID, 0x60); // Make a backup of the first 96 bytes at 0x80000000
|
2010-09-19 01:16:05 +02:00
|
|
|
|
2010-12-17 18:50:44 +01:00
|
|
|
Disc_SetUSB(NULL);
|
|
|
|
ret = WDVD_Reset();
|
|
|
|
if(ret < 0)
|
|
|
|
return 0;
|
2010-09-19 01:16:05 +02:00
|
|
|
|
2010-12-17 18:50:44 +01:00
|
|
|
ret = WDVD_ReadDiskId(g_diskID);
|
|
|
|
if(ret < 0)
|
|
|
|
return 0;
|
2010-09-19 01:16:05 +02:00
|
|
|
|
2010-12-17 18:50:44 +01:00
|
|
|
ret = WDVD_UnencryptedRead(g_diskID, 0x60, 0x00);
|
|
|
|
if(ret < 0)
|
|
|
|
return 0;
|
2010-09-19 01:16:05 +02:00
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
memcpy(header, g_diskID, 0x60);
|
|
|
|
memcpy(g_diskID, tmpBuff, 0x60); // Put the backup back, or games won't load
|
2010-09-19 01:16:05 +02:00
|
|
|
|
|
|
|
ResumeGui();
|
2010-12-17 18:50:44 +01:00
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
return (header->magic == 0x5D1C9EA3) ? 1 : 2; // Don't check gamecube magic (0xC2339F3D)
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|