*Add DML support (thx goes to G0dLiKe, crediar, all DML devs and FIX94)

*restructured game settings for different types of games (Wii/GC/Channels)
*added uninstall option for emu nand channels and game cube games (iso only)
*add display of game size from wii disc games on game prompt
*add game size display for game cube games (iso only)
*force interlace mode on GC games except when explicitly used FORCE 480p PAL/NTSC
*removed mountMethod global variable which was annoying me very much
*some source cleanup
This commit is contained in:
strtoul 2012-02-09 21:18:16 +00:00
parent df7022870c
commit 5b2f453d9e
46 changed files with 860 additions and 480 deletions

View File

@ -2,8 +2,8 @@
<app version="1"> <app version="1">
<name> USB Loader GX</name> <name> USB Loader GX</name>
<coder>USB Loader GX Team</coder> <coder>USB Loader GX Team</coder>
<version>2.3 r1151</version> <version>2.3 r1152</version>
<release_date>201202060127</release_date> <release_date>201202092115</release_date>
<!-- // remove this line to enable arguments <!-- // remove this line to enable arguments
<arguments> <arguments>
<arg>--ios=250</arg> <arg>--ios=250</arg>

View File

@ -35,6 +35,7 @@ SOURCES := source \
source/banner \ source/banner \
source/Channels \ source/Channels \
source/BoxCover \ source/BoxCover \
source/GameCube \
source/cheats \ source/cheats \
source/homebrewboot \ source/homebrewboot \
source/themes \ source/themes \

File diff suppressed because one or more lines are too long

193
source/GameCube/GCGames.cpp Normal file
View File

@ -0,0 +1,193 @@
/****************************************************************************
* 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/>.
****************************************************************************/
#include <dirent.h>
#include <sys/stat.h>
#include "GCGames.h"
#include "FileOperations/fileops.h"
#include "settings/GameTitles.h"
#include "settings/CSettings.h"
#include "usbloader/wbfs/wbfs_fat.h"
#include "utils/tools.h"
GCGames *GCGames::instance = NULL;
inline bool isGameID(const u8 *id)
{
for (int i = 0; i < 6; i++)
if (!isalnum((int) id[i]))
return false;
return true;
}
const char *GCGames::GetPath(const char *gameID) const
{
if(!gameID)
return "";
for(u32 i = 0; i < HeaderList.size(); i++)
{
if(strncasecmp((const char *) HeaderList[i].id, gameID, 6) == 0)
return PathList[i].c_str();
}
return "";
}
u32 GCGames::LoadGameList(const string &path)
{
PathList.clear();
HeaderList.clear();
struct discHdr tmpHdr;
struct stat st;
u8 id[8];
char fpath[1024];
char fname_title[64];
DIR *dir_iter;
struct dirent *dirent;
dir_iter = opendir(path.c_str());
if (!dir_iter) return 0;
while ((dirent = readdir(dir_iter)) != 0)
{
const char *dirname = dirent->d_name;
if(!dirname)
continue;
if (dirname[0] == '.') continue;
snprintf(fpath, sizeof(fpath), "%s/%s/game.iso", path.c_str(), dirname);
if(stat(fpath, &st) != 0)
continue;
// reset id and title
memset(id, 0, sizeof(id));
*fname_title = 0;
bool lay_a = false;
bool lay_b = false;
int len = strlen(dirname);
if (len >= 8)
{
if (Wbfs_Fat::CheckLayoutB((char *) dirname, len, id, fname_title))
{
// path/TITLE[GAMEID]/game.iso
lay_b = true;
}
else if (dirname[6] == '_')
{
// path/GAMEID_TITLE/game.iso
memcpy(id, dirname, 6);
if(isGameID(id))
{
lay_a = true;
snprintf(fname_title, sizeof(fname_title), &dirname[7]);
}
}
}
if(!lay_a && !lay_b)
memset(id, 0, sizeof(id));
// if we have titles.txt entry use that
const char *title = GameTitles.GetTitle(id);
// if no titles.txt get title from dir or file name
if (strlen(title) == 0 && Settings.titlesOverride && strlen(fname_title) > 0)
title = fname_title;
if (*id != 0 && strlen(title) > 0)
{
memset(&tmpHdr, 0, sizeof(tmpHdr));
memcpy(tmpHdr.id, id, 6);
strncpy(tmpHdr.title, title, sizeof(tmpHdr.title)-1);
tmpHdr.magic = GCGames::MAGIC;
tmpHdr.type = TYPE_GAME_GC_IMG;
HeaderList.push_back(tmpHdr);
PathList.push_back(dirname);
continue;
}
// else read it from file directly
// iso file
FILE *fp = fopen(fpath, "rb");
if (fp != NULL)
{
fread(&tmpHdr, sizeof(struct discHdr), 1, fp);
fclose(fp);
if (tmpHdr.gc_magic == GCGames::MAGIC)
{
tmpHdr.magic = tmpHdr.gc_magic;
tmpHdr.type = TYPE_GAME_GC_IMG;
HeaderList.push_back(tmpHdr);
PathList.push_back(dirname);
// Save title for next start
GameTitles.SetGameTitle(tmpHdr.id, tmpHdr.title);
}
}
}
closedir(dir_iter);
return HeaderList.size();
}
bool GCGames::RemoveGame(const char *gameID)
{
const char *path = GetPath(gameID);
if(*path == 0)
return false;
char filepath[512];
int result = 0;
int ret;
// Remove game iso
snprintf(filepath, sizeof(filepath), "%s%s/game.iso", Settings.GameCubePath, path);
ret = RemoveFile(filepath);
if(ret != 0)
result = -1;
// Remove path
snprintf(filepath, sizeof(filepath), "%s%s", Settings.GameCubePath, path);
ret = RemoveFile(filepath);
if(ret != 0)
result = -1;
return (result == 0);
}
float GCGames::GetGameSize(const char *gameID)
{
const char *path = GetPath(gameID);
if(*path == 0)
return 0.0f;
struct stat st;
char filepath[512];
snprintf(filepath, sizeof(filepath), "%s%s/game.iso", Settings.GameCubePath, path);
if(stat(filepath, &st) != 0)
return 0.0f;
return ((float) st.st_size / GB_SIZE);
}

58
source/GameCube/GCGames.h Normal file
View File

@ -0,0 +1,58 @@
/****************************************************************************
* 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/>.
****************************************************************************/
#ifndef _GCGAMES_H_
#define _GCGAMES_H_
#include <string>
#include <vector>
#include <gccore.h>
#include "usbloader/disc.h"
#include "settings/CSettings.h"
using namespace std;
class GCGames
{
public:
static const u32 MAGIC = 0xC2339F3D;
static GCGames *Instance(void) { if(!instance) instance = new GCGames(); return instance; }
static void DestroyInstance(void) { delete instance; instance = NULL; }
static u8 *GetOpeningBnr(const char *gameID);
u32 LoadGameList(const string &path);
bool RemoveGame(const char *gameID);
float GetGameSize(const char *gameID);
const char *GetPath(const char *gameID) const;
vector<struct discHdr> & GetHeaders(void)
{
if(HeaderList.empty())
LoadGameList(Settings.GameCubePath);
return HeaderList;
}
private:
static GCGames *instance;
vector<string> PathList;
vector<struct discHdr> HeaderList;
};
#endif

View File

@ -28,11 +28,11 @@
#include "language/gettext.h" #include "language/gettext.h"
#include "network/networkops.h" #include "network/networkops.h"
#include "utils/minizip/miniunz.h" #include "utils/minizip/miniunz.h"
#include "usbloader/utils.h"
#include "prompts/TitleBrowser.h" #include "prompts/TitleBrowser.h"
#include "homebrewboot/BootHomebrew.h" #include "homebrewboot/BootHomebrew.h"
#include "FileOperations/fileops.h" #include "FileOperations/fileops.h"
#include "prompts/ProgressWindow.h" #include "prompts/ProgressWindow.h"
#include "utils/tools.h"
#include "wstring.hpp" #include "wstring.hpp"
#include "HomebrewXML.h" #include "HomebrewXML.h"

View File

@ -49,7 +49,6 @@ GuiSound *btnSoundClick2 = NULL;
GuiSound *btnSoundOver = NULL; GuiSound *btnSoundOver = NULL;
static int currentMenu = 0; static int currentMenu = 0;
u8 mountMethod = 0;
static lwp_t guithread = LWP_THREAD_NULL; static lwp_t guithread = LWP_THREAD_NULL;
static bool guiHalt = true; static bool guiHalt = true;
@ -108,7 +107,7 @@ static void * UpdateGUI(void *arg)
mainWindow->Draw(); mainWindow->Draw();
if (Settings.tooltips && Theme::ShowTooltips && mainWindow->GetState() != STATE_DISABLED) if (Settings.tooltips && Theme::ShowTooltips && mainWindow->GetState() != STATE_DISABLED)
mainWindow->DrawTooltip(); mainWindow->DrawTooltip();
// Pointer modifies wpad data struct for easy implementation of "virtual pointer" with PAD-Sticks // Pointer modifies wpad data struct for easy implementation of "virtual pointer" with PAD-Sticks
// That is why it has to be called right before updating other gui elements with the triggers // That is why it has to be called right before updating other gui elements with the triggers
for (i = 3; i >= 0; i--) for (i = 3; i >= 0; i--)

View File

@ -33,10 +33,9 @@
#include "wpad.h" #include "wpad.h"
#include "sys.h" #include "sys.h"
extern u8 mountMethod;
extern bool updateavailable; extern bool updateavailable;
extern struct discHdr *dvdheader;
struct discHdr *dvdheader = NULL;
static bool Exiting = false; static bool Exiting = false;
GameBrowseMenu::GameBrowseMenu() GameBrowseMenu::GameBrowseMenu()
@ -1093,11 +1092,11 @@ int GameBrowseMenu::MainLoop()
gameInfo->ResetState(); gameInfo->ResetState();
if (SelectedGame >= 0 && SelectedGame < (s32) gameList.size()) if (SelectedGame >= 0 && SelectedGame < (s32) gameList.size())
{ {
rockout(SelectedGame); rockout(gameList[SelectedGame]);
SetState(STATE_DISABLED); SetState(STATE_DISABLED);
int choice = showGameInfo(SelectedGame); int choice = showGameInfo(SelectedGame, 0);
SetState(STATE_DEFAULT); SetState(STATE_DEFAULT);
rockout(SelectedGame, 2); rockout(0);
if (choice == 2) if (choice == 2)
homeBtn->SetState(STATE_CLICKED); homeBtn->SetState(STATE_CLICKED);
} }
@ -1173,7 +1172,7 @@ int GameBrowseMenu::MainLoop()
return returnMenu; return returnMenu;
} }
int choice = CheckboxWindow(tr( "Select titles sources." ), 0, tr( "Wii Games" ), tr( "Nand Channels" ), tr("EmuNand Channels"), 0, 0, 0, Settings.LoaderMode); int choice = CheckboxWindow(tr( "Select titles sources." ), 0, tr( "Wii Games" ), tr("GC Games"), tr( "Nand Channels" ), tr("EmuNand Channels"), 0, 0, Settings.LoaderMode);
if(choice != CheckedNone && choice != Settings.LoaderMode) if(choice != CheckedNone && choice != Settings.LoaderMode)
{ {
Settings.LoaderMode = choice; Settings.LoaderMode = choice;
@ -1237,10 +1236,9 @@ int GameBrowseMenu::MainLoop()
} }
gameClicked = gameBrowser ? gameBrowser->GetClickedOption() : -1; gameClicked = gameBrowser ? gameBrowser->GetClickedOption() : -1;
if ((gameClicked >= 0 && gameClicked < (s32) gameList.size()) || mountMethod != 0)
{ if(gameClicked >= 0 && gameClicked < (s32) gameList.size())
OpenClickedGame(); OpenClickedGame(gameList[gameClicked]);
}
return returnMenu; return returnMenu;
} }
@ -1271,8 +1269,15 @@ void GameBrowseMenu::CheckDiscSlotUpdate()
{ {
if(!dvdheader) if(!dvdheader)
dvdheader = new struct discHdr; dvdheader = new struct discHdr;
mountMethod = DiscMount(dvdheader);
rockout(GetSelectedGame()); if(Disc_Mount(dvdheader) < 0)
{
delete dvdheader;
dvdheader = NULL;
ShowError(tr("Can't mount or unknown disc format."));
}
else
OpenClickedGame(dvdheader);
} }
else else
WindowPrompt(tr( "No disc inserted." ), 0, tr( "OK" )); WindowPrompt(tr( "No disc inserted." ), 0, tr( "OK" ));
@ -1399,7 +1404,7 @@ void GameBrowseMenu::UpdateGameInfoText(const u8 * gameId)
ResumeGui(); ResumeGui();
} }
int GameBrowseMenu::OpenClickedGame() int GameBrowseMenu::OpenClickedGame(struct discHdr *header)
{ {
int choice = -1; int choice = -1;
int gameSelected = GetSelectedGame(); int gameSelected = GetSelectedGame();
@ -1413,7 +1418,8 @@ int GameBrowseMenu::OpenClickedGame()
ResumeGui(); ResumeGui();
} }
rockout(gameSelected); rockout(header);
SetState(STATE_DISABLED); SetState(STATE_DISABLED);
if(gameBrowser) if(gameBrowser)
gameBrowser->SetState(STATE_DISABLED); gameBrowser->SetState(STATE_DISABLED);
@ -1422,11 +1428,11 @@ int GameBrowseMenu::OpenClickedGame()
wiilight(1); wiilight(1);
if (Settings.quickboot) { //quickboot game if (Settings.quickboot) { //quickboot game
GameWindow::BootGame(mountMethod ? dvdheader : gameList[gameSelected]); GameWindow::BootGame(header);
} }
else else
{ {
GameWindow * GamePrompt = new GameWindow(gameSelected); GameWindow * GamePrompt = new GameWindow(gameSelected, dvdheader == header ? dvdheader : 0);
GamePrompt->SetGameBrowseMenu(this); GamePrompt->SetGameBrowseMenu(this);
mainWindow->Append(GamePrompt); mainWindow->Append(GamePrompt);
@ -1447,8 +1453,7 @@ int GameBrowseMenu::OpenClickedGame()
} }
wiilight(0); wiilight(0);
rockout(-1, -1); rockout(0);
mountMethod = 0;
SetState(STATE_DEFAULT); SetState(STATE_DEFAULT);
if(gameBrowser) if(gameBrowser)

View File

@ -14,7 +14,7 @@ class GameBrowseMenu : public GuiWindow
void ReloadBrowser(); void ReloadBrowser();
private: private:
int MainLoop(); int MainLoop();
int OpenClickedGame(); int OpenClickedGame(struct discHdr *header);
int GetSelectedGame() { return (gameBrowser ? gameBrowser->GetSelectedOption() : -1); } int GetSelectedGame() { return (gameBrowser ? gameBrowser->GetSelectedOption() : -1); }
void UpdateGameInfoText(const u8 * gameId); void UpdateGameInfoText(const u8 * gameId);
void LoadCover(struct discHdr *header); void LoadCover(struct discHdr *header);

View File

@ -2,10 +2,10 @@
#include "usbloader/usbstorage2.h" #include "usbloader/usbstorage2.h"
#include "usbloader/wbfs.h" #include "usbloader/wbfs.h"
#include "usbloader/disc.h" #include "usbloader/disc.h"
#include "usbloader/utils.h"
#include "usbloader/GameList.h" #include "usbloader/GameList.h"
#include "prompts/ProgressWindow.h" #include "prompts/ProgressWindow.h"
#include "themes/CTheme.h" #include "themes/CTheme.h"
#include "utils/tools.h"
extern int install_abort_signal; extern int install_abort_signal;
float gamesize = 0.0f; float gamesize = 0.0f;

View File

@ -2,11 +2,11 @@
#include "menus.h" #include "menus.h"
#include "usbloader/usbstorage2.h" #include "usbloader/usbstorage2.h"
#include "usbloader/utils.h"
#include "usbloader/wbfs.h" #include "usbloader/wbfs.h"
#include "GUI/gui_optionbrowser.h" #include "GUI/gui_optionbrowser.h"
#include "Controls/DeviceHandler.hpp" #include "Controls/DeviceHandler.hpp"
#include "themes/CTheme.h" #include "themes/CTheme.h"
#include "utils/tools.h"
/**************************************************************************** /****************************************************************************
* SelectPartitionMenu * SelectPartitionMenu

View File

@ -181,37 +181,3 @@ int DiscBrowse(const char * GameID, char * alternatedname, int alternatedname_si
return ret; return ret;
} }
/********************************************************************************
* Mount a DVD, get the type and ID.
*********************************************************************************/
u8 DiscMount(struct discHdr * header)
{
gprintf("\nDiscMount() ");
u8 * g_diskID = (u8 *) 0x80000000;
int ret;
HaltGui();
u8 tmpBuff[0x60];
memcpy(tmpBuff, g_diskID, 0x60); // Make a backup of the first 96 bytes at 0x80000000
Disc_SetUSB(NULL);
ret = WDVD_Reset();
if(ret < 0)
return 0;
ret = WDVD_ReadDiskId(g_diskID);
if(ret < 0)
return 0;
ret = WDVD_UnencryptedRead(g_diskID, 0x60, 0x00);
if(ret < 0)
return 0;
memcpy(header, g_diskID, 0x60);
memcpy(g_diskID, tmpBuff, 0x60); // Put the backup back, or games won't load
ResumeGui();
return (header->magic == 0x5D1C9EA3) ? 1 : 2; // Don't check gamecube magic (0xC2339F3D)
}

View File

@ -12,6 +12,5 @@
#include "usbloader/disc.h" #include "usbloader/disc.h"
int DiscBrowse(const char * GameID, char * dolname, int dolname_size); int DiscBrowse(const char * GameID, char * dolname, int dolname_size);
u8 DiscMount(struct discHdr * header);
#endif #endif

View File

@ -5,6 +5,7 @@
#include "usbloader/GameList.h" #include "usbloader/GameList.h"
#include "usbloader/GameBooter.hpp" #include "usbloader/GameBooter.hpp"
#include "usbloader/AlternateDOLOffsets.h" #include "usbloader/AlternateDOLOffsets.h"
#include "GameCube/GCGames.h"
#include "themes/CTheme.h" #include "themes/CTheme.h"
#include "FileOperations/fileops.h" #include "FileOperations/fileops.h"
#include "settings/menus/GameSettingsMenu.hpp" #include "settings/menus/GameSettingsMenu.hpp"
@ -20,6 +21,7 @@
#include "menu/WDMMenu.hpp" #include "menu/WDMMenu.hpp"
#include "banner/OpeningBNR.hpp" #include "banner/OpeningBNR.hpp"
#include "utils/ShowError.h" #include "utils/ShowError.h"
#include "utils/tools.h"
#define NONE 0 #define NONE 0
#define LEFT 1 #define LEFT 1
@ -27,14 +29,12 @@
#define IN 3 #define IN 3
#define OUT 4 #define OUT 4
extern u8 mountMethod; GameWindow::GameWindow(int Selected, struct discHdr *dvd)
extern struct discHdr *dvdheader;
GameWindow::GameWindow(int Selected)
: GuiWindow(472, 320) : GuiWindow(472, 320)
{ {
returnVal = -1; returnVal = -1;
gameSelected = Selected; gameSelected = Selected;
dvdheader = dvd;
gameSound = NULL; gameSound = NULL;
diskImgData = NULL; diskImgData = NULL;
diskImgData2 = NULL; diskImgData2 = NULL;
@ -76,7 +76,7 @@ GameWindow::GameWindow(int Selected)
nameBtn->SetSoundOver(btnSoundOver); nameBtn->SetSoundOver(btnSoundOver);
nameBtn->SetSoundClick(btnSoundClick2); nameBtn->SetSoundClick(btnSoundClick2);
if (Settings.godmode == 1 && !mountMethod) if (Settings.godmode == 1 && !dvdheader)
{ {
nameBtn->SetToolTip(nameBtnTT, 24, -30, ALIGN_LEFT); nameBtn->SetToolTip(nameBtnTT, 24, -30, ALIGN_LEFT);
nameBtn->SetTrigger(trigA); nameBtn->SetTrigger(trigA);
@ -179,7 +179,7 @@ GameWindow::GameWindow(int Selected)
Append(detailsBtn); Append(detailsBtn);
Append(nameBtn); Append(nameBtn);
Append(sizeTxt); Append(sizeTxt);
if (!mountMethod)//stuff we don't show if it is a DVD mounted if (!dvdheader)//stuff we don't show if it is a DVD mounted
{ {
Append(btnLeft); Append(btnLeft);
Append(btnRight); Append(btnRight);
@ -187,7 +187,7 @@ GameWindow::GameWindow(int Selected)
Append(FavoriteBtn[i]); Append(FavoriteBtn[i]);
} }
//check if unlocked //check if unlocked
if (mountMethod != 2 && (Settings.godmode || !(Settings.ParentalBlocks & BLOCK_GAME_SETTINGS))) if (Settings.godmode || !(Settings.ParentalBlocks & BLOCK_GAME_SETTINGS))
{ {
backBtn->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); backBtn->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
backBtn->SetPosition(-50, -40); backBtn->SetPosition(-50, -40);
@ -423,7 +423,7 @@ void GameWindow::SetWindowEffect(int direction, int in_out)
void GameWindow::ChangeGame(int EffectDirection) void GameWindow::ChangeGame(int EffectDirection)
{ {
struct discHdr * header = (mountMethod ? dvdheader : gameList[gameSelected]); struct discHdr * header = (dvdheader ? dvdheader : gameList[gameSelected]);
LoadGameSound(header); LoadGameSound(header);
LoadDiscImage(header->id); LoadDiscImage(header->id);
SetWindowEffect(EffectDirection, OUT); SetWindowEffect(EffectDirection, OUT);
@ -438,12 +438,25 @@ void GameWindow::ChangeGame(int EffectDirection)
sizeTxt->SetTextf(tr("Emulated Nand")); sizeTxt->SetTextf(tr("Emulated Nand"));
} }
else if (!mountMethod) else if(header->type == TYPE_GAME_WII_IMG)
{ {
float size = 0.0f; float size = 0.0f;
WBFS_GameSize(header->id, &size); WBFS_GameSize(header->id, &size);
sizeTxt->SetTextf("%.2fGB", size); //set size text; sizeTxt->SetTextf("%.2fGB", size); //set size text;
} }
else if(header->type == TYPE_GAME_WII_DISC)
{
float size = (float) WBFS_EstimeGameSize() / GB_SIZE;
if(size == 0.0f)
size = 4.37f*GB_SIZE; // Use default disc size if can't be determined
sizeTxt->SetTextf("%.2fGB", size); //set size text;
}
else if(header->type == TYPE_GAME_GC_IMG)
{
float size = GCGames::Instance()->GetGameSize((const char *) header->id);
sizeTxt->SetTextf("%.2fGB", size); //set size text;
// TODO: Add GC disc size check
}
diskImg->SetImage(diskImgData); diskImg->SetImage(diskImgData);
nameTxt->SetText(GameTitles.GetTitle(header)); nameTxt->SetText(GameTitles.GetTitle(header));
@ -506,7 +519,7 @@ int GameWindow::MainLoop()
Hide(); Hide();
// If this function was left then the game start was canceled // If this function was left then the game start was canceled
GameWindow::BootGame(mountMethod ? dvdheader : gameList[gameSelected]); GameWindow::BootGame(dvdheader ? dvdheader : gameList[gameSelected]);
// Show the window again // Show the window again
Show(); Show();
@ -525,7 +538,7 @@ int GameWindow::MainLoop()
Hide(); Hide();
wiilight(0); wiilight(0);
int settret = GameSettingsMenu::Execute(browserMenu, mountMethod ? dvdheader : gameList[gameSelected]); int settret = GameSettingsMenu::Execute(browserMenu, dvdheader ? dvdheader : gameList[gameSelected]);
// Show the window again or return to browser on uninstall // Show the window again or return to browser on uninstall
if (settret == MENU_DISCLIST) if (settret == MENU_DISCLIST)
@ -540,7 +553,8 @@ int GameWindow::MainLoop()
// Hide the window // Hide the window
Hide(); Hide();
struct discHdr *header = mountMethod ? dvdheader : gameList[gameSelected]; // This button can only be clicked when this is not a dvd header
struct discHdr *header = gameList[gameSelected];
//enter new game title //enter new game title
char entered[60]; char entered[60];
@ -615,7 +629,7 @@ int GameWindow::MainLoop()
else if(detailsBtn->GetState() == STATE_CLICKED) else if(detailsBtn->GetState() == STATE_CLICKED)
{ {
diskImg->SetState(STATE_DISABLED); diskImg->SetState(STATE_DISABLED);
showGameInfo(gameSelected); showGameInfo(gameSelected, dvdheader);
mainWindow->SetState(STATE_DISABLED); mainWindow->SetState(STATE_DISABLED);
this->SetState(STATE_DEFAULT); this->SetState(STATE_DEFAULT);
diskImg->SetState(STATE_DEFAULT); diskImg->SetState(STATE_DEFAULT);
@ -643,7 +657,8 @@ int GameWindow::MainLoop()
{ {
if(FavoriteBtn[i]->GetState() == STATE_CLICKED) if(FavoriteBtn[i]->GetState() == STATE_CLICKED)
{ {
struct discHdr * header = (mountMethod ? dvdheader : gameList[gameSelected]); // This button can only be clicked when this is not a dvd header
struct discHdr * header = gameList[gameSelected];
int FavoriteRank = (i+1 == GameStatistics.GetFavoriteRank(header->id)) ? 0 : i+1; // Press the current rank to reset the rank int FavoriteRank = (i+1 == GameStatistics.GetFavoriteRank(header->id)) ? 0 : i+1; // Press the current rank to reset the rank
GameStatistics.SetFavoriteRank(header->id, FavoriteRank); GameStatistics.SetFavoriteRank(header->id, FavoriteRank);

View File

@ -11,7 +11,7 @@
class GameWindow : public GuiWindow class GameWindow : public GuiWindow
{ {
public: public:
GameWindow(int GameSelected); GameWindow(int GameSelected, struct discHdr *dvd);
virtual ~GameWindow(); virtual ~GameWindow();
int Run(); int Run();
int GetSelectedGame() { return gameSelected; }; int GetSelectedGame() { return gameSelected; };
@ -30,6 +30,7 @@ class GameWindow : public GuiWindow
int returnVal; int returnVal;
int gameSelected; int gameSelected;
GameBrowseMenu *browserMenu; GameBrowseMenu *browserMenu;
struct discHdr *dvdheader;
GuiTrigger * trigA; GuiTrigger * trigA;
GuiTrigger * trigB; GuiTrigger * trigB;

View File

@ -17,9 +17,9 @@
#include "GUI/gui.h" #include "GUI/gui.h"
#include "prompts/ProgressWindow.h" #include "prompts/ProgressWindow.h"
#include "usbloader/wbfs.h" #include "usbloader/wbfs.h"
#include "usbloader/utils.h"
#include "themes/CTheme.h" #include "themes/CTheme.h"
#include "utils/timer.h" #include "utils/timer.h"
#include "utils/tools.h"
extern float gamesize; extern float gamesize;
extern int install_abort_signal; extern int install_abort_signal;

View File

@ -12,7 +12,6 @@
#include "usbloader/wdvd.h" #include "usbloader/wdvd.h"
#include "usbloader/usbstorage2.h" #include "usbloader/usbstorage2.h"
#include "usbloader/GameList.h" #include "usbloader/GameList.h"
#include "usbloader/utils.h"
#include "language/gettext.h" #include "language/gettext.h"
#include "GUI/gui.h" #include "GUI/gui.h"
#include "GUI/gui_diskcover.h" #include "GUI/gui_diskcover.h"
@ -27,6 +26,7 @@
#include "prompts/gameinfo.h" #include "prompts/gameinfo.h"
#include "themes/CTheme.h" #include "themes/CTheme.h"
#include "utils/StringTools.h" #include "utils/StringTools.h"
#include "utils/tools.h"
#include "mload/mload.h" #include "mload/mload.h"
#include "FileOperations/fileops.h" #include "FileOperations/fileops.h"
#include "menu/menus.h" #include "menu/menus.h"

View File

@ -22,8 +22,7 @@
#include "audio.h" #include "audio.h"
#include "xml/GameTDB.hpp" #include "xml/GameTDB.hpp"
#include "wad/nandtitle.h" #include "wad/nandtitle.h"
#include "../usbloader/utils.h" #include "gecko.h"
#include "../gecko.h"
#include "Controls/DeviceHandler.hpp" #include "Controls/DeviceHandler.hpp"
#include "usbloader/NandEmu.h" #include "usbloader/NandEmu.h"

View File

@ -25,17 +25,15 @@
#include "utils/ShowError.h" #include "utils/ShowError.h"
#include "BoxCover/BoxCover.hpp" #include "BoxCover/BoxCover.hpp"
extern u8 mountMethod;
extern struct discHdr *dvdheader;
/**************************************************************************** /****************************************************************************
* gameinfo * gameinfo
***************************************************************************/ ***************************************************************************/
static int InternalShowGameInfo(char *ID) static int InternalShowGameInfo(struct discHdr *header)
{ {
HaltGui();//put this first to try to get rid of the code dump caused by loading this window at the same time as loading images from the SD card
mainWindow->SetState(STATE_DISABLED); mainWindow->SetState(STATE_DISABLED);
ResumeGui();
char ID[7];
snprintf(ID, sizeof(ID), "%s", (char *) header->id);
char xmlpath[300]; char xmlpath[300];
snprintf(xmlpath, sizeof(xmlpath), "%swiitdb.xml", Settings.titlestxt_path); snprintf(xmlpath, sizeof(xmlpath), "%swiitdb.xml", Settings.titlestxt_path);
@ -180,11 +178,13 @@ static int InternalShowGameInfo(char *ID)
GuiButton LeftBtn(0, 0); GuiButton LeftBtn(0, 0);
LeftBtn.SetTrigger(&trigLeft); LeftBtn.SetTrigger(&trigLeft);
if(mountMethod == 0) gameinfoWindow.Append(&LeftBtn); if(header->type != TYPE_GAME_WII_DISC && header->type != TYPE_GAME_GC_DISC)
gameinfoWindow.Append(&LeftBtn);
GuiButton RightBtn(0, 0); GuiButton RightBtn(0, 0);
RightBtn.SetTrigger(&trigRight); RightBtn.SetTrigger(&trigRight);
if(mountMethod == 0) gameinfoWindow.Append(&RightBtn); if(header->type != TYPE_GAME_WII_DISC && header->type != TYPE_GAME_GC_DISC)
gameinfoWindow.Append(&RightBtn);
GuiButton coverBtn(180, 250); GuiButton coverBtn(180, 250);
coverBtn.SetPosition(20, 20); coverBtn.SetPosition(20, 20);
@ -1040,17 +1040,15 @@ static int InternalShowGameInfo(char *ID)
return choice; return choice;
} }
int showGameInfo(int gameSelected) int showGameInfo(int gameSelected, struct discHdr *dvdheader)
{ {
char gameID[7];
int choice = 5; int choice = 5;
while(choice > 2) while(choice > 2)
{ {
struct discHdr * header = (mountMethod ? dvdheader : gameList[gameSelected]); struct discHdr * header = (dvdheader ? dvdheader : gameList[gameSelected]);
snprintf(gameID, sizeof(gameID), (char *) header->id);
choice = InternalShowGameInfo(gameID); choice = InternalShowGameInfo(header);
if(choice == 3) if(choice == 3)
{ {

View File

@ -8,7 +8,9 @@
#ifndef _GAMEINFO_H_ #ifndef _GAMEINFO_H_
#define _GAMEINFO_H_ #define _GAMEINFO_H_
int showGameInfo(int selectedGame); #include "usbloader/disc.h"
int showGameInfo(int selectedGame, struct discHdr *header);
bool save_gamelist(int txt); bool save_gamelist(int txt);
#endif #endif

View File

@ -79,6 +79,7 @@ void CSettings::SetDefault()
strcpy(unlockCode, ""); strcpy(unlockCode, "");
strcpy(db_language, ""); strcpy(db_language, "");
strcpy(returnTo, ""); strcpy(returnTo, "");
strcpy(GameCubePath, "sd:/games/");
godmode = 1; godmode = 1;
videomode = VIDEO_MODE_DISCDEFAULT; videomode = VIDEO_MODE_DISCDEFAULT;

View File

@ -76,6 +76,7 @@ class CSettings
char WiinnertagPath[100]; char WiinnertagPath[100];
char NandEmuPath[50]; char NandEmuPath[50];
char NandEmuChanPath[50]; char NandEmuChanPath[50];
char GameCubePath[100];
short videomode; short videomode;
short language; short language;
short ocarina; short ocarina;

View File

@ -11,18 +11,21 @@ enum
enum enum
{ {
TYPE_GAME_WII = 0x00, TYPE_GAME_WII_IMG = 0x00,
TYPE_GAME_GC = 0x01, TYPE_GAME_WII_DISC = 0x01,
TYPE_GAME_NANDCHAN = 0x02, TYPE_GAME_GC_IMG = 0x02,
TYPE_GAME_EMUNANDCHAN = 0x03, TYPE_GAME_GC_DISC = 0x03,
TYPE_GAME_NANDCHAN = 0x04,
TYPE_GAME_EMUNANDCHAN = 0x05,
}; };
enum enum
{ {
MODE_NONE = 0x00, MODE_NONE = 0x00,
MODE_WIIGAMES = 0x01, MODE_WIIGAMES = 0x01,
MODE_NANDCHANNELS = 0x02, MODE_GCGAMES = 0x02,
MODE_EMUCHANNELS = 0x04, MODE_NANDCHANNELS = 0x04,
MODE_EMUCHANNELS = 0x08,
MODE_ALL = 0xFF, MODE_ALL = 0xFF,
}; };

View File

@ -255,7 +255,8 @@ int FeatureSettingsMenu::GetMenuInternal()
for(int i = 0; i < gameList.size(); ++i) for(int i = 0; i < gameList.size(); ++i)
{ {
if(gameList[i]->type != TYPE_GAME_WII && gameList[i]->type != TYPE_GAME_NANDCHAN) if( gameList[i]->type != TYPE_GAME_WII_IMG
&& gameList[i]->type != TYPE_GAME_NANDCHAN)
continue; continue;
if(gameList[i]->tid != 0) //! Channels if(gameList[i]->tid != 0) //! Channels

View File

@ -170,60 +170,90 @@ void GameLoadSM::SetOptionNames()
{ {
int Idx = 0; int Idx = 0;
Options->SetName(Idx++, "%s", tr( "Game Lock" ));
Options->SetName(Idx++, "%s", tr( "Video Mode" )); Options->SetName(Idx++, "%s", tr( "Video Mode" ));
Options->SetName(Idx++, "%s", tr( "VIDTV Patch" ));
Options->SetName(Idx++, "%s", tr( "Sneek Video Patch" )); //! Not available on GC
Options->SetName(Idx++, "%s", tr( "Aspect Ratio" )); if(Header->type != TYPE_GAME_GC_IMG && Header->type != TYPE_GAME_GC_DISC)
Options->SetName(Idx++, "%s", tr( "Game Language" ));
Options->SetName(Idx++, "%s", tr( "Patch Country Strings" ));
Options->SetName(Idx++, "%s", tr( "Ocarina" ));
Options->SetName(Idx++, "%s", tr( "Game IOS" ));
Options->SetName(Idx++, "%s", tr( "Parental Control" ));
Options->SetName(Idx++, "%s", tr( "Error 002 fix" ));
Options->SetName(Idx++, "%s", tr( "Return To" ));
if(Header->type == TYPE_GAME_WII)
{ {
Options->SetName(Idx++, "%s", tr( "Alternate DOL" )); Options->SetName(Idx++, "%s", tr( "VIDTV Patch" ));
Options->SetName(Idx++, "%s", tr( "Select DOL Offset" )); Options->SetName(Idx++, "%s", tr( "Sneek Video Patch" ));
Options->SetName(Idx++, "%s", tr( "Aspect Ratio" ));
Options->SetName(Idx++, "%s", tr( "Patch Country Strings" ));
} }
Options->SetName(Idx++, "%s", tr( "Block IOS Reload" ));
if(Header->type == TYPE_GAME_WII || Header->type == TYPE_GAME_EMUNANDCHAN) Options->SetName(Idx++, "%s", tr( "Game Language" ));
Options->SetName(Idx++, "%s", tr( "Ocarina" ));
Options->SetName(Idx++, "%s", tr( "Parental Control" ));
//! Not available on GC
if(Header->type != TYPE_GAME_GC_IMG && Header->type != TYPE_GAME_GC_DISC)
{
Options->SetName(Idx++, "%s", tr( "Hooktype" ));
Options->SetName(Idx++, "%s", tr( "Wiird Debugger" ));
Options->SetName(Idx++, "%s", tr( "Game IOS" ));
Options->SetName(Idx++, "%s", tr( "Error 002 fix" ));
Options->SetName(Idx++, "%s", tr( "Return To" ));
Options->SetName(Idx++, "%s", tr( "Block IOS Reload" ));
}
//! Only wii games and emu nand channels
if( Header->type == TYPE_GAME_WII_IMG
|| Header->type == TYPE_GAME_WII_DISC
|| Header->type == TYPE_GAME_EMUNANDCHAN)
{ {
Options->SetName(Idx++, "%s", tr( "Nand Emulation" )); Options->SetName(Idx++, "%s", tr( "Nand Emulation" ));
Options->SetName(Idx++, "%s", tr( "Nand Emu Path" )); Options->SetName(Idx++, "%s", tr( "Nand Emu Path" ));
} }
Options->SetName(Idx++, "%s", tr( "Hooktype" ));
Options->SetName(Idx++, "%s", tr( "Wiird Debugger" )); //! Only on Wii games
Options->SetName(Idx++, "%s", tr( "Game Lock" )); if(Header->type == TYPE_GAME_WII_IMG || Header->type == TYPE_GAME_WII_DISC)
{
Options->SetName(Idx++, "%s", tr( "Alternate DOL" ));
Options->SetName(Idx++, "%s", tr( "Select DOL Offset" ));
}
} }
void GameLoadSM::SetOptionValues() void GameLoadSM::SetOptionValues()
{ {
int Idx = 0; int Idx = 0;
//! Settings: Game Lock
Options->SetValue(Idx++, "%s", tr( OnOffText[GameConfig.Locked] ));
//! Settings: Video Mode //! Settings: Video Mode
if(GameConfig.video == INHERIT) if(GameConfig.video == INHERIT)
Options->SetValue(Idx++, tr("Use global")); Options->SetValue(Idx++, tr("Use global"));
else else
Options->SetValue(Idx++, "%s", tr(VideoModeText[GameConfig.video])); Options->SetValue(Idx++, "%s", tr(VideoModeText[GameConfig.video]));
//! Settings: VIDTV Patch //! Not available on GC
if(GameConfig.vipatch == INHERIT) if(Header->type != TYPE_GAME_GC_IMG && Header->type != TYPE_GAME_GC_DISC)
Options->SetValue(Idx++, tr("Use global")); {
else //! Settings: VIDTV Patch
Options->SetValue(Idx++, "%s", tr(OnOffText[GameConfig.vipatch])); if(GameConfig.vipatch == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", tr(OnOffText[GameConfig.vipatch]));
//! Settings: Sneek Video Patch //! Settings: Sneek Video Patch
if(GameConfig.sneekVideoPatch == INHERIT) if(GameConfig.sneekVideoPatch == INHERIT)
Options->SetValue(Idx++, tr("Use global")); Options->SetValue(Idx++, tr("Use global"));
else else
Options->SetValue(Idx++, "%s", tr(OnOffText[GameConfig.sneekVideoPatch])); Options->SetValue(Idx++, "%s", tr(OnOffText[GameConfig.sneekVideoPatch]));
//! Settings: Aspect Ratio //! Settings: Aspect Ratio
if(GameConfig.aspectratio == INHERIT) if(GameConfig.aspectratio == INHERIT)
Options->SetValue(Idx++, tr("Use global")); Options->SetValue(Idx++, tr("Use global"));
else else
Options->SetValue(Idx++, "%s", tr(AspectText[GameConfig.aspectratio])); Options->SetValue(Idx++, "%s", tr(AspectText[GameConfig.aspectratio]));
//! Settings: Patch Country Strings
if(GameConfig.patchcountrystrings == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", tr(OnOffText[GameConfig.patchcountrystrings]));
}
//! Settings: Game Language //! Settings: Game Language
if(GameConfig.language == INHERIT) if(GameConfig.language == INHERIT)
@ -231,49 +261,84 @@ void GameLoadSM::SetOptionValues()
else else
Options->SetValue(Idx++, "%s", tr(LanguageText[GameConfig.language])); Options->SetValue(Idx++, "%s", tr(LanguageText[GameConfig.language]));
//! Settings: Patch Country Strings
if(GameConfig.patchcountrystrings == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", tr(OnOffText[GameConfig.patchcountrystrings]));
//! Settings: Ocarina //! Settings: Ocarina
if(GameConfig.ocarina == INHERIT) if(GameConfig.ocarina == INHERIT)
Options->SetValue(Idx++, tr("Use global")); Options->SetValue(Idx++, tr("Use global"));
else else
Options->SetValue(Idx++, "%s", tr(OnOffText[GameConfig.ocarina])); Options->SetValue(Idx++, "%s", tr(OnOffText[GameConfig.ocarina]));
//! Settings: Game IOS
if(GameConfig.ios == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%i", GameConfig.ios);
//! Settings: Parental Control //! Settings: Parental Control
Options->SetValue(Idx++, "%s", tr(ParentalText[GameConfig.parentalcontrol])); Options->SetValue(Idx++, "%s", tr(ParentalText[GameConfig.parentalcontrol]));
//! Settings: Error 002 fix //! Not available on GC
if(GameConfig.errorfix002 == INHERIT) if(Header->type != TYPE_GAME_GC_IMG && Header->type != TYPE_GAME_GC_DISC)
Options->SetValue(Idx++, tr("Use global")); {
else //! Settings: Hooktype
Options->SetValue(Idx++, "%s", tr(Error002Text[GameConfig.errorfix002])); if(GameConfig.Hooktype == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", tr( HooktypeText[GameConfig.Hooktype] ));
//! Settings: Return To //! Settings: Wiird Debugger
if(GameConfig.returnTo) if(GameConfig.WiirdDebugger == INHERIT)
{ Options->SetValue(Idx++, tr("Use global"));
const char* TitleName = NULL; else
u64 tid = NandTitles.FindU32(Settings.returnTo); Options->SetValue(Idx++, "%s", tr( OnOffText[GameConfig.WiirdDebugger] ));
if (tid > 0)
TitleName = NandTitles.NameOf(tid); //! Settings: Game IOS
Options->SetValue(Idx++, "%s", TitleName ? TitleName : strlen(Settings.returnTo) > 0 ? if(GameConfig.ios == INHERIT)
Settings.returnTo : tr( OnOffText[0] )); Options->SetValue(Idx++, tr("Use global"));
} else
else Options->SetValue(Idx++, "%i", GameConfig.ios);
{
Options->SetValue(Idx++, "%s", tr( OnOffText[0] )); //! Settings: Error 002 fix
if(GameConfig.errorfix002 == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", tr(Error002Text[GameConfig.errorfix002]));
//! Settings: Return To
if(GameConfig.returnTo)
{
const char* TitleName = NULL;
u64 tid = NandTitles.FindU32(Settings.returnTo);
if (tid > 0)
TitleName = NandTitles.NameOf(tid);
Options->SetValue(Idx++, "%s", TitleName ? TitleName : strlen(Settings.returnTo) > 0 ?
Settings.returnTo : tr( OnOffText[0] ));
}
else
{
Options->SetValue(Idx++, "%s", tr( OnOffText[0] ));
}
//! Settings: Block IOS Reload
if(GameConfig.iosreloadblock == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", tr( OnOffText[GameConfig.iosreloadblock]) );
} }
if(Header->type == TYPE_GAME_WII) //! Only wii games and emu nand channels
if( Header->type == TYPE_GAME_WII_IMG
|| Header->type == TYPE_GAME_WII_DISC
|| Header->type == TYPE_GAME_EMUNANDCHAN)
{
//! Settings: Nand Emulation
if(GameConfig.NandEmuMode == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", tr( NandEmuText[GameConfig.NandEmuMode] ));
//! Settings: Nand Emu Path
if(GameConfig.NandEmuPath.size() == 0)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", GameConfig.NandEmuPath.c_str());
}
//! Only on Wii games
if(Header->type == TYPE_GAME_WII_IMG || Header->type == TYPE_GAME_WII_DISC)
{ {
//! Settings: Alternate DOL //! Settings: Alternate DOL
Options->SetValue(Idx++, "%s", tr( AlternateDOLText[GameConfig.loadalternatedol] )); Options->SetValue(Idx++, "%s", tr( AlternateDOLText[GameConfig.loadalternatedol] ));
@ -289,42 +354,6 @@ void GameLoadSM::SetOptionValues()
Options->SetValue(Idx++, "%i", GameConfig.alternatedolstart); Options->SetValue(Idx++, "%i", GameConfig.alternatedolstart);
} }
} }
//! Settings: Block IOS Reload
if(GameConfig.iosreloadblock == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", tr( OnOffText[GameConfig.iosreloadblock]) );
if(Header->type == TYPE_GAME_WII || Header->type == TYPE_GAME_EMUNANDCHAN)
{
//! Settings: Nand Emulation
if(GameConfig.NandEmuMode == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", tr( NandEmuText[GameConfig.NandEmuMode] ));
//! Settings: Nand Emu Path
if(GameConfig.NandEmuPath.size() == 0)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", GameConfig.NandEmuPath.c_str());
}
//! Settings: Hooktype
if(GameConfig.Hooktype == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", tr( HooktypeText[GameConfig.Hooktype] ));
//! Settings: Wiird Debugger
if(GameConfig.WiirdDebugger == INHERIT)
Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", tr( OnOffText[GameConfig.WiirdDebugger] ));
//! Settings: Game Lock
Options->SetValue(Idx++, "%s", tr( OnOffText[GameConfig.Locked] ));
} }
int GameLoadSM::GetMenuInternal() int GameLoadSM::GetMenuInternal()
@ -348,200 +377,219 @@ int GameLoadSM::GetMenuInternal()
int Idx = -1; int Idx = -1;
//! Settings: Video Mode //! Settings: Game Lock
if (ret == ++Idx) if (ret == ++Idx)
{
if (++GameConfig.Locked >= MAX_ON_OFF) GameConfig.Locked = 0;
}
//! Settings: Video Mode
else if (ret == ++Idx)
{ {
if (++GameConfig.video >= VIDEO_MODE_MAX) GameConfig.video = INHERIT; if (++GameConfig.video >= VIDEO_MODE_MAX) GameConfig.video = INHERIT;
} }
//! Settings: VIDTV Patch //! Not available on GC
else if (ret == ++Idx) if(Header->type != TYPE_GAME_GC_IMG && Header->type != TYPE_GAME_GC_DISC)
{ {
if (++GameConfig.vipatch >= MAX_ON_OFF) GameConfig.vipatch = INHERIT; //! Settings: VIDTV Patch
} if (ret == ++Idx)
{
if (++GameConfig.vipatch >= MAX_ON_OFF) GameConfig.vipatch = INHERIT;
}
//! Settings: Sneek Video Patch //! Settings: Sneek Video Patch
else if (ret == ++Idx) else if (ret == ++Idx)
{ {
if (++GameConfig.sneekVideoPatch >= MAX_ON_OFF) GameConfig.sneekVideoPatch = INHERIT; if (++GameConfig.sneekVideoPatch >= MAX_ON_OFF) GameConfig.sneekVideoPatch = INHERIT;
} }
//! Settings: Aspect Ratio //! Settings: Aspect Ratio
else if (ret == ++Idx) else if (ret == ++Idx)
{ {
if (++GameConfig.aspectratio >= ASPECT_MAX) GameConfig.aspectratio = INHERIT; if (++GameConfig.aspectratio >= ASPECT_MAX) GameConfig.aspectratio = INHERIT;
}
//! Settings: Patch Country Strings
if (ret == ++Idx)
{
if (++GameConfig.patchcountrystrings >= MAX_ON_OFF) GameConfig.patchcountrystrings = INHERIT;
}
} }
//! Settings: Game Language //! Settings: Game Language
else if (ret == ++Idx) if (ret == ++Idx)
{ {
if (++GameConfig.language >= MAX_LANGUAGE) GameConfig.language = INHERIT; if (++GameConfig.language >= MAX_LANGUAGE) GameConfig.language = INHERIT;
} }
//! Settings: Patch Country Strings
else if (ret == ++Idx)
{
if (++GameConfig.patchcountrystrings >= MAX_ON_OFF) GameConfig.patchcountrystrings = INHERIT;
}
//! Settings: Ocarina //! Settings: Ocarina
else if (ret == ++Idx) else if (ret == ++Idx)
{ {
if (++GameConfig.ocarina >= MAX_ON_OFF) GameConfig.ocarina = INHERIT; if (++GameConfig.ocarina >= MAX_ON_OFF) GameConfig.ocarina = INHERIT;
} }
//! Settings: Game IOS
else if (ret == ++Idx)
{
char entered[4];
snprintf(entered, sizeof(entered), "%i", GameConfig.ios);
if(OnScreenKeyboard(entered, sizeof(entered), 0))
{
GameConfig.ios = atoi(entered) & 0xFF;
if(GameConfig.ios < 200 && GameConfig.ios != INHERIT) GameConfig.ios = 200;
if(GameConfig.ios != INHERIT && NandTitles.IndexOf(TITLE_ID(1, GameConfig.ios)) < 0)
{
WindowPrompt(tr("Warning:"), tr("This IOS was not found on the titles list. If you are sure you have it installed than ignore this warning."), tr("OK"));
}
else if(GameConfig.ios == 254)
{
WindowPrompt(tr("Warning:"), tr("This IOS is the BootMii ios. If you are sure it is not BootMii and you have something else installed there than ignore this warning."), tr("OK"));
}
}
}
//! Settings: Parental Control //! Settings: Parental Control
else if (ret == ++Idx) else if (ret == ++Idx)
{ {
if (++GameConfig.parentalcontrol >= 5) GameConfig.parentalcontrol = 0; if (++GameConfig.parentalcontrol >= 5) GameConfig.parentalcontrol = 0;
} }
//! Settings: Error 002 fix //! Not available on GC
else if (ret == ++Idx) if(Header->type != TYPE_GAME_GC_IMG && Header->type != TYPE_GAME_GC_DISC)
{ {
if (++GameConfig.errorfix002 >= 3) GameConfig.errorfix002 = INHERIT; //! Settings: Hooktype
} if (ret == ++Idx)
//! Settings: Return To
else if (ret == ++Idx)
{
if (++GameConfig.returnTo >= MAX_ON_OFF) GameConfig.returnTo = 0;
}
//! Settings: Alternate DOL
else if ((Header->type == TYPE_GAME_WII) && ret == ++Idx)
{
if (++GameConfig.loadalternatedol >= ALT_DOL_MAX_CHOICE)
GameConfig.loadalternatedol = 0;
}
//! Settings: Select DOL Offset from Game
else if ((Header->type == TYPE_GAME_WII) && ret == ++Idx && GameConfig.loadalternatedol == 1)
{
GuiWindow * parentWindow = (GuiWindow *) parentElement;
if(parentWindow) parentWindow->SetState(STATE_DISABLED);
//alt dol menu for games that require more than a single alt dol
int autodol = autoSelectDolPrompt((char *) GameConfig.id);
if(autodol == 0)
{ {
if(parentWindow) parentWindow->SetState(STATE_DEFAULT); if (++GameConfig.Hooktype >= 8) GameConfig.Hooktype = INHERIT;
return MENU_NONE; //Cancel Button pressed
} }
char tmp[170]; //! Settings: Wiird Debugger
else if (ret == ++Idx)
if (autodol > 0)
{ {
GameConfig.alternatedolstart = autodol; if (++GameConfig.WiirdDebugger >= MAX_ON_OFF) GameConfig.WiirdDebugger = INHERIT;
snprintf(tmp, sizeof(tmp), "%s <%i>", tr( "AUTO" ), autodol);
GameConfig.alternatedolname = tmp;
SetOptionValues();
if(parentWindow) parentWindow->SetState(STATE_DEFAULT);
return MENU_NONE;
} }
int res = DiscBrowse(GameConfig.id, tmp, sizeof(tmp)); //! Settings: Game IOS
if (res >= 0) else if (ret == ++Idx)
{ {
GameConfig.alternatedolname = tmp; char entered[4];
GameConfig.alternatedolstart = res; snprintf(entered, sizeof(entered), "%i", GameConfig.ios);
snprintf(tmp, sizeof(tmp), "%s %.6s - %i", tr( "It seems that you have some information that will be helpful to us. Please pass this information along to the DEV team." ), (char *) GameConfig.id, GameConfig.alternatedolstart); if(OnScreenKeyboard(entered, sizeof(entered), 0))
WindowPrompt(0, tmp, tr( "OK" ));
}
if(GameConfig.alternatedolstart == 0)
GameConfig.loadalternatedol = 0;
if(parentWindow) parentWindow->SetState(STATE_DEFAULT);
}
//! Settings: Block IOS Reload
else if (ret == ++Idx)
{
if(++GameConfig.iosreloadblock >= 3) GameConfig.iosreloadblock = INHERIT;
}
//! Settings: Nand Emulation
else if ((Header->type == TYPE_GAME_WII || Header->type == TYPE_GAME_EMUNANDCHAN) && ret == ++Idx)
{
if(!IosLoader::IsD2X())
WindowPrompt(tr("Error:"), tr("Nand Emulation is only available on D2X cIOS!"), tr("OK"));
else if (++GameConfig.NandEmuMode >= 3) GameConfig.NandEmuMode = INHERIT;
//! On titles from emulated nand path disabling the nand emu mode is not allowed
if(Header->type == TYPE_GAME_EMUNANDCHAN && GameConfig.NandEmuMode == OFF)
GameConfig.NandEmuMode = 1;
}
//! Settings: Nand Emu Path
else if ((Header->type == TYPE_GAME_WII || Header->type == TYPE_GAME_EMUNANDCHAN) && ret == ++Idx)
{
if(!IosLoader::IsD2X())
WindowPrompt(tr("Error:"), tr("Nand Emulation is only available on D2X cIOS!"), tr("OK"));
else
{
char entered[300];
snprintf(entered, sizeof(entered), GameConfig.NandEmuPath.c_str());
HaltGui();
GuiWindow * parent = (GuiWindow *) parentElement;
if(parent) parent->SetState(STATE_DISABLED);
this->SetState(STATE_DEFAULT);
this->Remove(optionBrowser);
ResumeGui();
int result = BrowseDevice(entered, sizeof(entered), FB_DEFAULT, noFILES);
if(parent) parent->SetState(STATE_DEFAULT);
this->Append(optionBrowser);
if (result == 1)
{ {
if (entered[strlen(entered)-1] != '/') GameConfig.ios = atoi(entered) & 0xFF;
strcat(entered, "/"); if(GameConfig.ios < 200 && GameConfig.ios != INHERIT) GameConfig.ios = 200;
GameConfig.NandEmuPath = entered; if(GameConfig.ios != INHERIT && NandTitles.IndexOf(TITLE_ID(1, GameConfig.ios)) < 0)
WindowPrompt(tr( "Path Changed" ), 0, tr( "OK" )); {
WindowPrompt(tr("Warning:"), tr("This IOS was not found on the titles list. If you are sure you have it installed than ignore this warning."), tr("OK"));
}
else if(GameConfig.ios == 254)
{
WindowPrompt(tr("Warning:"), tr("This IOS is the BootMii ios. If you are sure it is not BootMii and you have something else installed there than ignore this warning."), tr("OK"));
}
}
}
//! Settings: Error 002 fix
else if (ret == ++Idx)
{
if (++GameConfig.errorfix002 >= 3) GameConfig.errorfix002 = INHERIT;
}
//! Settings: Return To
else if (ret == ++Idx)
{
if (++GameConfig.returnTo >= MAX_ON_OFF) GameConfig.returnTo = 0;
}
//! Settings: Block IOS Reload
if (ret == ++Idx)
{
if(++GameConfig.iosreloadblock >= 3) GameConfig.iosreloadblock = INHERIT;
}
}
//! Only wii games and emu nand channels
if( Header->type == TYPE_GAME_WII_IMG
|| Header->type == TYPE_GAME_WII_DISC
|| Header->type == TYPE_GAME_EMUNANDCHAN)
{
//! Settings: Nand Emulation
if (ret == ++Idx)
{
if(!IosLoader::IsD2X())
WindowPrompt(tr("Error:"), tr("Nand Emulation is only available on D2X cIOS!"), tr("OK"));
else if (++GameConfig.NandEmuMode >= 3) GameConfig.NandEmuMode = INHERIT;
//! On titles from emulated nand path disabling the nand emu mode is not allowed
if(Header->type == TYPE_GAME_EMUNANDCHAN && GameConfig.NandEmuMode == OFF)
GameConfig.NandEmuMode = 1;
}
//! Settings: Nand Emu Path
else if (ret == ++Idx)
{
if(!IosLoader::IsD2X())
WindowPrompt(tr("Error:"), tr("Nand Emulation is only available on D2X cIOS!"), tr("OK"));
else
{
char entered[300];
snprintf(entered, sizeof(entered), GameConfig.NandEmuPath.c_str());
HaltGui();
GuiWindow * parent = (GuiWindow *) parentElement;
if(parent) parent->SetState(STATE_DISABLED);
this->SetState(STATE_DEFAULT);
this->Remove(optionBrowser);
ResumeGui();
int result = BrowseDevice(entered, sizeof(entered), FB_DEFAULT, noFILES);
if(parent) parent->SetState(STATE_DEFAULT);
this->Append(optionBrowser);
if (result == 1)
{
if (entered[strlen(entered)-1] != '/')
strcat(entered, "/");
GameConfig.NandEmuPath = entered;
WindowPrompt(tr( "Path Changed" ), 0, tr( "OK" ));
}
} }
} }
} }
//! Settings: Hooktype //! Only on Wii games
else if (ret == ++Idx) if(Header->type == TYPE_GAME_WII_IMG || Header->type == TYPE_GAME_WII_DISC)
{ {
if (++GameConfig.Hooktype >= 8) GameConfig.Hooktype = INHERIT; //! Settings: Alternate DOL
} if (ret == ++Idx)
{
if (++GameConfig.loadalternatedol >= ALT_DOL_MAX_CHOICE)
GameConfig.loadalternatedol = 0;
}
//! Settings: Wiird Debugger //! Settings: Select DOL Offset from Game
else if (ret == ++Idx) else if ( (ret == ++Idx)
{ && (GameConfig.loadalternatedol == 1))
if (++GameConfig.WiirdDebugger >= MAX_ON_OFF) GameConfig.WiirdDebugger = INHERIT; {
} GuiWindow * parentWindow = (GuiWindow *) parentElement;
if(parentWindow) parentWindow->SetState(STATE_DISABLED);
//alt dol menu for games that require more than a single alt dol
int autodol = autoSelectDolPrompt((char *) GameConfig.id);
if(autodol == 0)
{
if(parentWindow) parentWindow->SetState(STATE_DEFAULT);
return MENU_NONE; //Cancel Button pressed
}
//! Settings: Game Lock char tmp[170];
else if (ret == ++Idx)
{ if (autodol > 0)
if (++GameConfig.Locked >= MAX_ON_OFF) GameConfig.Locked = 0; {
GameConfig.alternatedolstart = autodol;
snprintf(tmp, sizeof(tmp), "%s <%i>", tr( "AUTO" ), autodol);
GameConfig.alternatedolname = tmp;
SetOptionValues();
if(parentWindow) parentWindow->SetState(STATE_DEFAULT);
return MENU_NONE;
}
int res = DiscBrowse(GameConfig.id, tmp, sizeof(tmp));
if (res >= 0)
{
GameConfig.alternatedolname = tmp;
GameConfig.alternatedolstart = res;
snprintf(tmp, sizeof(tmp), "%s %.6s - %i", tr( "It seems that you have some information that will be helpful to us. Please pass this information along to the DEV team." ), (char *) GameConfig.id, GameConfig.alternatedolstart);
WindowPrompt(0, tmp, tr( "OK" ));
}
if(GameConfig.alternatedolstart == 0)
GameConfig.loadalternatedol = 0;
if(parentWindow) parentWindow->SetState(STATE_DEFAULT);
}
} }
SetOptionValues(); SetOptionValues();

View File

@ -70,7 +70,9 @@ void GameSettingsMenu::SetupMainButtons()
SetMainButton(pos++, tr( "Game Load" ), MainButtonImgData, MainButtonImgOverData); SetMainButton(pos++, tr( "Game Load" ), MainButtonImgData, MainButtonImgOverData);
SetMainButton(pos++, tr( "Ocarina" ), MainButtonImgData, MainButtonImgOverData); SetMainButton(pos++, tr( "Ocarina" ), MainButtonImgData, MainButtonImgOverData);
SetMainButton(pos++, tr( "Categories" ), MainButtonImgData, MainButtonImgOverData); SetMainButton(pos++, tr( "Categories" ), MainButtonImgData, MainButtonImgOverData);
if(DiscHeader->type == TYPE_GAME_WII || DiscHeader->type == TYPE_GAME_NANDCHAN) if( DiscHeader->type == TYPE_GAME_WII_IMG
|| DiscHeader->type == TYPE_GAME_WII_DISC
|| DiscHeader->type == TYPE_GAME_NANDCHAN)
{ {
SetMainButton(pos++, tr( "Extract Save to EmuNand" ), MainButtonImgData, MainButtonImgOverData); SetMainButton(pos++, tr( "Extract Save to EmuNand" ), MainButtonImgData, MainButtonImgOverData);
} }
@ -136,7 +138,10 @@ void GameSettingsMenu::CreateSettingsMenu(int menuNr)
} }
//! Extract Save to EmuNand //! Extract Save to EmuNand
else if((DiscHeader->type == TYPE_GAME_WII || DiscHeader->type == TYPE_GAME_NANDCHAN) && menuNr == Idx++) else if( (DiscHeader->type == TYPE_GAME_WII_IMG
|| DiscHeader->type == TYPE_GAME_WII_DISC
|| DiscHeader->type == TYPE_GAME_NANDCHAN)
&& menuNr == Idx++)
{ {
int choice = WindowPrompt(tr( "Do you want to extract the save game?" ), tr("The save game will be extracted to your emu nand path."), tr( "Yes" ), tr( "Cancel" )); int choice = WindowPrompt(tr( "Do you want to extract the save game?" ), tr("The save game will be extracted to your emu nand path."), tr( "Yes" ), tr( "Cancel" ));
if (choice == 1) if (choice == 1)

View File

@ -30,11 +30,11 @@
#include "language/gettext.h" #include "language/gettext.h"
#include "usbloader/GameList.h" #include "usbloader/GameList.h"
#include "usbloader/wbfs.h" #include "usbloader/wbfs.h"
#include "usbloader/utils.h"
#include "prompts/ProgressWindow.h" #include "prompts/ProgressWindow.h"
#include "settings/GameTitles.h" #include "settings/GameTitles.h"
#include "system/IosLoader.h" #include "system/IosLoader.h"
#include "wad/nandtitle.h" #include "wad/nandtitle.h"
#include "utils/tools.h"
static const char * OnOffText[] = static const char * OnOffText[] =
{ {

View File

@ -24,6 +24,8 @@
#include <unistd.h> #include <unistd.h>
#include "UninstallSM.hpp" #include "UninstallSM.hpp"
#include "FileOperations/fileops.h" #include "FileOperations/fileops.h"
#include "GameCube/GCGames.h"
#include "Channels/channels.h"
#include "settings/CSettings.h" #include "settings/CSettings.h"
#include "settings/CGameSettings.h" #include "settings/CGameSettings.h"
#include "settings/CGameStatistics.h" #include "settings/CGameStatistics.h"
@ -34,8 +36,6 @@
#include "usbloader/GameList.h" #include "usbloader/GameList.h"
#include "wstring.hpp" #include "wstring.hpp"
extern u8 mountMethod;
UninstallSM::UninstallSM(struct discHdr * header) UninstallSM::UninstallSM(struct discHdr * header)
: SettingsMenu(tr("Uninstall Menu"), &GuiOptions, MENU_NONE) : SettingsMenu(tr("Uninstall Menu"), &GuiOptions, MENU_NONE)
{ {
@ -43,7 +43,9 @@ UninstallSM::UninstallSM(struct discHdr * header)
int Idx = 0; int Idx = 0;
if(DiscHeader->type == TYPE_GAME_WII) if( DiscHeader->type == TYPE_GAME_WII_IMG
|| DiscHeader->type == TYPE_GAME_GC_IMG
|| DiscHeader->type == TYPE_GAME_EMUNANDCHAN)
{ {
Options->SetName(Idx++, "%s", tr( "Uninstall Game" )); Options->SetName(Idx++, "%s", tr( "Uninstall Game" ));
} }
@ -60,7 +62,9 @@ void UninstallSM::SetOptionValues()
{ {
int Idx = 0; int Idx = 0;
if(DiscHeader->type == TYPE_GAME_WII) if( DiscHeader->type == TYPE_GAME_WII_IMG
|| DiscHeader->type == TYPE_GAME_GC_IMG
|| DiscHeader->type == TYPE_GAME_EMUNANDCHAN)
{ {
//! Settings: Uninstall Game //! Settings: Uninstall Game
Options->SetValue(Idx++, " "); Options->SetValue(Idx++, " ");
@ -92,7 +96,10 @@ int UninstallSM::GetMenuInternal()
int Idx = -1; int Idx = -1;
//! Settings: Uninstall Game //! Settings: Uninstall Game
if((DiscHeader->type == TYPE_GAME_WII) && ret == ++Idx) if( (DiscHeader->type == TYPE_GAME_WII_IMG
|| DiscHeader->type == TYPE_GAME_GC_IMG
|| DiscHeader->type == TYPE_GAME_EMUNANDCHAN)
&& ret == ++Idx)
{ {
int choice = WindowPrompt(GameTitles.GetTitle(DiscHeader), tr( "What should be deleted for this game title:" ), tr( "Game Only" ), tr("Uninstall all"), tr( "Cancel" )); int choice = WindowPrompt(GameTitles.GetTitle(DiscHeader), tr( "What should be deleted for this game title:" ), tr( "Game Only" ), tr("Uninstall all"), tr( "Cancel" ));
if (choice == 0) if (choice == 0)
@ -106,20 +113,41 @@ int UninstallSM::GetMenuInternal()
GameSettings.Save(); GameSettings.Save();
GameStatistics.Remove(DiscHeader->id); GameStatistics.Remove(DiscHeader->id);
GameStatistics.Save(); GameStatistics.Save();
int ret = 0;
if(!mountMethod)
ret = WBFS_RemoveGame(DiscHeader->id);
if(ret >= 0) int ret = 0;
char filepath[512];
if(DiscHeader->type == TYPE_GAME_WII_IMG)
{ {
wString oldFilter(gameList.GetCurrentFilter()); ret = WBFS_RemoveGame((u8 *) GameID);
gameList.ReadGameList(); if(ret >= 0)
gameList.FilterList(oldFilter.c_str()); {
wString oldFilter(gameList.GetCurrentFilter());
gameList.ReadGameList();
gameList.FilterList(oldFilter.c_str());
}
}
else if(DiscHeader->type == TYPE_GAME_GC_IMG)
{
GCGames::Instance()->RemoveGame(GameID);
// Reload list
GCGames::Instance()->LoadGameList(Settings.GameCubePath);
}
else if(DiscHeader->type == TYPE_GAME_EMUNANDCHAN && DiscHeader->tid != 0)
{
// Remove ticket
snprintf(filepath, sizeof(filepath), "%s/ticket/%08x/%08x.tik", Settings.NandEmuChanPath, (u32) (DiscHeader->tid >> 32), (u32) DiscHeader->tid);
RemoveFile(filepath);
// Remove contents / data
snprintf(filepath, sizeof(filepath), "%s/title/%08x/%08x/", Settings.NandEmuChanPath, (u32) (DiscHeader->tid >> 32), (u32) DiscHeader->tid);
RemoveDirectory(filepath);
Channels::Instance()->GetEmuChannelList();
} }
if(choice == 2) if(choice == 2)
{ {
char filepath[200];
snprintf(filepath, sizeof(filepath), "%s%s.png", Settings.covers_path, GameID); snprintf(filepath, sizeof(filepath), "%s%s.png", Settings.covers_path, GameID);
if (CheckFile(filepath)) remove(filepath); if (CheckFile(filepath)) remove(filepath);
snprintf(filepath, sizeof(filepath), "%s%s.png", Settings.covers2d_path, GameID); snprintf(filepath, sizeof(filepath), "%s%s.png", Settings.covers2d_path, GameID);

View File

@ -14,6 +14,7 @@
#include "utils/ResourceManager.h" #include "utils/ResourceManager.h"
#include "usbloader/playlog.h" #include "usbloader/playlog.h"
#include "usbloader/wbfs.h" #include "usbloader/wbfs.h"
#include "GameCube/GCGames.h"
#include "themes/CTheme.h" #include "themes/CTheme.h"
#include "SoundOperations/SoundHandler.hpp" #include "SoundOperations/SoundHandler.hpp"
#include "utils/ThreadedTask.hpp" #include "utils/ThreadedTask.hpp"
@ -71,8 +72,6 @@ void AppCleanUp(void)
return; return;
app_clean = true; app_clean = true;
extern u8 mountMethod;
gprintf("Exiting main GUI. mountMethod = %d\n", mountMethod);
if(Settings.CacheTitles) if(Settings.CacheTitles)
GameTitles.WriteCachedTitles(Settings.titlestxt_path); GameTitles.WriteCachedTitles(Settings.titlestxt_path);
@ -97,6 +96,7 @@ void AppCleanUp(void)
NewTitles::DestroyInstance(); NewTitles::DestroyInstance();
ThreadedTask::DestroyInstance(); ThreadedTask::DestroyInstance();
SoundHandler::DestroyInstance(); SoundHandler::DestroyInstance();
GCGames::DestroyInstance();
DeinitNetwork(); DeinitNetwork();
GameTitles.SetDefault(); GameTitles.SetDefault();

View File

@ -32,6 +32,7 @@
#include "usbloader/playlog.h" #include "usbloader/playlog.h"
#include "usbloader/MountGamePartition.h" #include "usbloader/MountGamePartition.h"
#include "usbloader/AlternateDOLOffsets.h" #include "usbloader/AlternateDOLOffsets.h"
#include "GameCube/GCGames.h"
#include "settings/newtitles.h" #include "settings/newtitles.h"
#include "network/Wiinnertag.h" #include "network/Wiinnertag.h"
#include "patches/patchcode.h" #include "patches/patchcode.h"
@ -51,13 +52,60 @@
//appentrypoint has to be global because of asm //appentrypoint has to be global because of asm
u32 AppEntrypoint = 0; u32 AppEntrypoint = 0;
struct discHdr *dvdheader = NULL; extern "C"
extern u8 mountMethod;
int GameBooter::BootGCMode()
{ {
syssram* __SYS_LockSram();
u32 __SYS_UnlockSram(u32 write);
u32 __SYS_SyncSram(void);
}
int GameBooter::BootGCMode(struct discHdr *gameHdr)
{
if(gameHdr->type == TYPE_GAME_GC_IMG)
{
char path[50];
snprintf(path, sizeof(path), "%sboot.bin", Settings.GameCubePath);
FILE *f = fopen(path, "wb");
if(f)
{
const char *gamePath = GCGames::Instance()->GetPath((const char *) gameHdr->id);
fwrite(gamePath, 1, strlen(gamePath) + 1, f);
fclose(f);
}
}
ExitApp(); ExitApp();
gprintf("\nLoading BC for GameCube"); gprintf("\nLoading BC for GameCube");
GameCFG * game_cfg = GameSettings.GetGameCFG(gameHdr->id);
u8 videoChoice = game_cfg->video == INHERIT ? Settings.videomode : game_cfg->video;
// Game ID
memcpy((u8 *)0x80000000, gameHdr->id, 6);
DCFlushRange((u8 *)0x80000000, 6);
if(gameHdr->type == TYPE_GAME_GC_IMG)
{
// Tell DML to boot the game from sd card
*(vu32*)0x80001800 = 0xB002D105;
DCFlushRange((u8 *)0x80001800, 4);
ICInvalidateRange((u8 *)0x80001800, 4);
}
*(vu32*)0xCC003024 |= 7;
Disc_SelectVMode(videoChoice, true);
Disc_SetVMode();
syssram *sram = __SYS_LockSram();
if (*Video_Mode == VI_NTSC)
sram->flags &= ~1; // Clear bit 0 to set the video mode to NTSC
else
sram->flags |= 1; // Set bit 0 to set the video mode to PAL
__SYS_UnlockSram(1); // 1 -> write changes
while(!__SYS_SyncSram());
WII_Initialize(); WII_Initialize();
return WII_LaunchTitle(0x0000000100000100ULL); return WII_LaunchTitle(0x0000000100000100ULL);
} }
@ -84,7 +132,7 @@ u32 GameBooter::BootPartition(char * dolpath, u8 videoselected, u8 alternatedol,
Disc_SetLowMem(); Disc_SetLowMem();
/* Setup video mode */ /* Setup video mode */
Disc_SelectVMode(videoselected); Disc_SelectVMode(videoselected, false);
/* Run apploader */ /* Run apploader */
ret = Apploader_Run(&p_entry, dolpath, alternatedol, alternatedoloffset); ret = Apploader_Run(&p_entry, dolpath, alternatedol, alternatedoloffset);
@ -145,9 +193,9 @@ void GameBooter::SetupNandEmu(u8 NandEmuMode, const char *NandEmuPath, struct di
} }
} }
int GameBooter::SetupDisc(u8 * gameID) int GameBooter::SetupDisc(struct discHdr &gameHeader)
{ {
if (mountMethod) if (gameHeader.type == TYPE_GAME_WII_DISC)
{ {
gprintf("\tloading DVD\n"); gprintf("\tloading DVD\n");
return Disc_Open(); return Disc_Open();
@ -158,17 +206,17 @@ int GameBooter::SetupDisc(u8 * gameID)
if(IosLoader::IsWaninkokoIOS() && IOS_GetRevision() < 18) if(IosLoader::IsWaninkokoIOS() && IOS_GetRevision() < 18)
{ {
gprintf("Disc_SetUSB..."); gprintf("Disc_SetUSB...");
ret = Disc_SetUSB(gameID); ret = Disc_SetUSB(gameHeader.id);
gprintf("%d\n", ret); gprintf("%d\n", ret);
if(ret < 0) return ret; if(ret < 0) return ret;
} }
else else
{ {
gprintf("Loading fragment list..."); gprintf("Loading fragment list...");
ret = get_frag_list(gameID); ret = get_frag_list(gameHeader.id);
gprintf("%d\n", ret); gprintf("%d\n", ret);
if(ret < 0) return ret; if(ret < 0) return ret;
ret = set_frag_list(gameID); ret = set_frag_list(gameHeader.id);
if(ret < 0) return ret; if(ret < 0) return ret;
gprintf("\tUSB set to game\n"); gprintf("\tUSB set to game\n");
} }
@ -202,23 +250,22 @@ int GameBooter::BootGame(struct discHdr *gameHdr)
if(!gameHdr) if(!gameHdr)
return -1; return -1;
char gameID[7]; struct discHdr gameHeader;
snprintf(gameID, sizeof(gameID), "%s", gameHdr->id); memcpy(&gameHeader, gameHdr, sizeof(struct discHdr));
gprintf("\tBootGame: %s\n", gameID);
gprintf("\tBootGame: %.6s\n", gameHeader.id);
if(Settings.Wiinnertag) if(Settings.Wiinnertag)
Wiinnertag::TagGame(gameID); Wiinnertag::TagGame((const char *) gameHeader.id);
if(mountMethod == 2) if(gameHeader.type == TYPE_GAME_GC_IMG || gameHeader.type == TYPE_GAME_GC_DISC)
return BootGCMode(); return BootGCMode(&gameHeader);
AppCleanUp(); AppCleanUp();
gprintf("\tSettings.partition: %d\n", Settings.partition); gprintf("\tSettings.partition: %d\n", Settings.partition);
s32 ret = -1; s32 ret = -1;
struct discHdr gameHeader;
memcpy(&gameHeader, gameHdr, sizeof(struct discHdr));
//! Remember game's USB port //! Remember game's USB port
int partition = gameList.GetPartitionNumber(gameHeader.id); int partition = gameList.GetPartitionNumber(gameHeader.id);
@ -284,7 +331,7 @@ int GameBooter::BootGame(struct discHdr *gameHdr)
if(gameHeader.tid == 0) if(gameHeader.tid == 0)
{ {
//! Setup disc in cIOS and open it //! Setup disc in cIOS and open it
ret = SetupDisc(gameHeader.id); ret = SetupDisc(gameHeader);
if (ret < 0) if (ret < 0)
Sys_BackToLoader(); Sys_BackToLoader();
@ -344,7 +391,7 @@ int GameBooter::BootGame(struct discHdr *gameHdr)
// Load dol // Load dol
AppEntrypoint = Channels::LoadChannel(gameHeader.tid); AppEntrypoint = Channels::LoadChannel(gameHeader.tid);
/* Setup video mode */ /* Setup video mode */
Disc_SelectVMode(videoChoice); Disc_SelectVMode(videoChoice, false);
} }
//! No entrypoint found...back to HBC/SystemMenu //! No entrypoint found...back to HBC/SystemMenu

View File

@ -24,11 +24,11 @@ class GameBooter
{ {
public: public:
static int BootGame(struct discHdr *gameHdr); static int BootGame(struct discHdr *gameHdr);
static int BootGCMode(); static int BootGCMode(struct discHdr *gameHdr);
private: private:
static void SetupAltDOL(u8 * gameID, u8 &alternatedol, u32 &alternatedoloffset); static void SetupAltDOL(u8 * gameID, u8 &alternatedol, u32 &alternatedoloffset);
static void SetupNandEmu(u8 NandEmuMode, const char *NandEmuPath, struct discHdr &gameHeader); static void SetupNandEmu(u8 NandEmuMode, const char *NandEmuPath, struct discHdr &gameHeader);
static int SetupDisc(u8 *gameID); static int SetupDisc(struct discHdr &gameHeader);
static u32 BootPartition(char * dolpath, u8 videoselected, u8 alternatedol, u32 alternatedoloffset); static u32 BootPartition(char * dolpath, u8 videoselected, u8 alternatedol, u32 alternatedoloffset);
static void ShutDownDevices(int gameUSBPort); static void ShutDownDevices(int gameUSBPort);
}; };

View File

@ -26,6 +26,7 @@
#include <malloc.h> #include <malloc.h>
#include "GUI/gui_searchbar.h" #include "GUI/gui_searchbar.h"
#include "usbloader/wbfs.h" #include "usbloader/wbfs.h"
#include "GameCube/GCGames.h"
#include "settings/newtitles.h" #include "settings/newtitles.h"
#include "settings/CSettings.h" #include "settings/CSettings.h"
#include "settings/CGameSettings.h" #include "settings/CGameSettings.h"
@ -254,6 +255,10 @@ int GameList::FilterList(const wchar_t * gameFilter)
if(Settings.LoaderMode & MODE_WIIGAMES) if(Settings.LoaderMode & MODE_WIIGAMES)
InternalFilterList(FullGameList); InternalFilterList(FullGameList);
// Filter gc game list if selected
if(Settings.LoaderMode & MODE_GCGAMES)
InternalFilterList(GCGames::Instance()->GetHeaders());
// Filter nand channel list if selected // Filter nand channel list if selected
if(Settings.LoaderMode & MODE_NANDCHANNELS) if(Settings.LoaderMode & MODE_NANDCHANNELS)
InternalFilterList(Channels::Instance()->GetNandHeaders()); InternalFilterList(Channels::Instance()->GetNandHeaders());
@ -295,6 +300,10 @@ int GameList::LoadUnfiltered()
if(Settings.LoaderMode & MODE_WIIGAMES) if(Settings.LoaderMode & MODE_WIIGAMES)
InternalLoadUnfiltered(FullGameList); InternalLoadUnfiltered(FullGameList);
// Filter gc game list if selected
if(Settings.LoaderMode & MODE_GCGAMES)
InternalLoadUnfiltered(GCGames::Instance()->GetHeaders());
// Filter nand channel list if selected // Filter nand channel list if selected
if(Settings.LoaderMode & MODE_NANDCHANNELS) if(Settings.LoaderMode & MODE_NANDCHANNELS)
InternalLoadUnfiltered(Channels::Instance()->GetNandHeaders()); InternalLoadUnfiltered(Channels::Instance()->GetNandHeaders());

View File

@ -55,12 +55,12 @@ void Disc_SetLowMem(void)
memcpy((void *) Online_Check, (void *) Disc_ID, 4); memcpy((void *) Online_Check, (void *) Disc_ID, 4);
} }
void Disc_SelectVMode(u8 videoselected) void Disc_SelectVMode(u8 videoselected, u8 ignore_progressive)
{ {
vmode = VIDEO_GetPreferredMode(0); vmode = VIDEO_GetPreferredMode(0);
/* Get video mode configuration */ /* Get video mode configuration */
bool progressive = (CONF_GetProgressiveScan() > 0) && VIDEO_HaveComponentCable(); bool progressive = (CONF_GetProgressiveScan() > 0) && VIDEO_HaveComponentCable() && !ignore_progressive;
bool PAL60 = CONF_GetEuRGB60() > 0; bool PAL60 = CONF_GetEuRGB60() > 0;
u32 tvmode = CONF_GetVideo(); u32 tvmode = CONF_GetVideo();
@ -107,7 +107,7 @@ void Disc_SelectVMode(u8 videoselected)
if (tvmode != CONF_VIDEO_NTSC) if (tvmode != CONF_VIDEO_NTSC)
{ {
vmode_reg = VI_NTSC; vmode_reg = VI_NTSC;
vmode = progressive ? &TVNtsc480Prog : &TVEurgb60Hz480IntDf; vmode = progressive ? &TVNtsc480Prog : &TVNtsc480IntDf;
} }
break; break;
default: default:
@ -139,7 +139,7 @@ void Disc_SelectVMode(u8 videoselected)
} }
} }
void __Disc_SetVMode(void) void Disc_SetVMode(void)
{ {
/* Set video mode register */ /* Set video mode register */
*Video_Mode = vmode_reg; *Video_Mode = vmode_reg;
@ -265,10 +265,53 @@ s32 Disc_IsWii(void)
return 0; return 0;
} }
s32 Disc_Mount(struct discHdr *header)
{
if(!header)
return -1;
gprintf("\nDiscMount() ");
s32 ret;
u8 tmpBuff[0x60];
memcpy(tmpBuff, diskid, 0x60); // Make a backup of the first 96 bytes at 0x80000000
Disc_SetUSB(NULL);
ret = WDVD_Reset();
if(ret < 0)
return ret;
ret = WDVD_ReadDiskId(diskid);
if(ret < 0)
return ret;
ret = WDVD_UnencryptedRead(diskid, 0x60, 0x00);
if(ret < 0)
return ret;
memcpy(header, diskid, sizeof(struct discHdr));
memcpy(diskid, tmpBuff, 0x60); // Put the backup back, or games won't load
if(header->magic == 0x5D1C9EA3)
{
header->type = TYPE_GAME_WII_DISC;
return 0;
}
if(header->gc_magic == 0xC2339F3D)
{
header->type = TYPE_GAME_GC_DISC;
return 0;
}
return -1;
}
s32 Disc_JumpToEntrypoint(s32 hooktype, u32 dolparameter) s32 Disc_JumpToEntrypoint(s32 hooktype, u32 dolparameter)
{ {
/* Set an appropiate video mode */ /* Set an appropiate video mode */
__Disc_SetVMode(); Disc_SetVMode();
/* Set time */ /* Set time */
__Disc_SetTime(); __Disc_SetTime();

View File

@ -37,7 +37,7 @@ extern "C"
u32 magic; u32 magic;
/* Padding */ /* Padding */
u8 unused2[4]; u32 gc_magic;
/* Game title */ /* Game title */
char title[64]; char title[64];
@ -59,8 +59,10 @@ extern "C"
s32 Disc_ReadHeader(void *); s32 Disc_ReadHeader(void *);
s32 Disc_IsWii(void); s32 Disc_IsWii(void);
s32 Disc_FindPartition(u64 *outbuf); s32 Disc_FindPartition(u64 *outbuf);
s32 Disc_Mount(struct discHdr *header);
void PatchCountryStrings(void *Address, int Size); void PatchCountryStrings(void *Address, int Size);
void Disc_SelectVMode(u8 videoselected); void Disc_SelectVMode(u8 videoselected, u8 ignore_progressive);
void Disc_SetVMode(void);
s32 Disc_JumpToEntrypoint(s32 hooktype, u32 dolparameter); s32 Disc_JumpToEntrypoint(s32 hooktype, u32 dolparameter);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,7 +0,0 @@
#include <stdio.h>
#include <ogcsys.h>
u32 swap32(u32 x)
{
return (x >> 24) | ((x << 8) & 0x00FF0000UL) | ((x >> 8) & 0x0000FF00UL) | (x << 24);
}

View File

@ -1,26 +0,0 @@
#ifndef _UTILS_H_
#define _UTILS_H_
#ifdef __cplusplus
extern "C"
{
#endif
/* Constants */
#define KB_SIZE 1024.0
#define MB_SIZE 1048576.0
#define GB_SIZE 1073741824.0
/* Macros */
#define round_up(x,n) (-(-(x) & -(n)))
#define SAFE_FREE(P) if(P){free(P);P=NULL;}
/* Prototypes */
u32 swap32(u32);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -8,8 +8,9 @@
#include "usbloader/sdhc.h" #include "usbloader/sdhc.h"
#include "usbloader/usbstorage2.h" #include "usbloader/usbstorage2.h"
#include "usbloader/wbfs.h" #include "usbloader/wbfs.h"
#include "wbfs_rw.h" #include "utils/tools.h"
#include "wbfs_rw.h"
#include "wbfs_base.h" #include "wbfs_base.h"
Wbfs::Wbfs(u32 l, u32 s, u32 part, u32 port) Wbfs::Wbfs(u32 l, u32 s, u32 part, u32 port)

View File

@ -2,7 +2,6 @@
#define _H #define _H
#include "libs/libwbfs/libwbfs.h" #include "libs/libwbfs/libwbfs.h"
#include "usbloader/utils.h"
#include "usbloader/frag.h" #include "usbloader/frag.h"
#include "usbloader/wbfs.h" #include "usbloader/wbfs.h"

View File

@ -25,6 +25,7 @@
#include "prompts/ProgressWindow.h" #include "prompts/ProgressWindow.h"
#include "usbloader/wbfs.h" #include "usbloader/wbfs.h"
#include "usbloader/GameList.h" #include "usbloader/GameList.h"
#include "utils/tools.h"
#include "wbfs_rw.h" #include "wbfs_rw.h"
#include "gecko.h" #include "gecko.h"
@ -39,6 +40,15 @@ static const char invalid_path[] = "/\\:|<>?*\"'";
extern u32 hdd_sector_size[2]; extern u32 hdd_sector_size[2];
extern int install_abort_signal; extern int install_abort_signal;
inline bool isGameID(const char *id)
{
for (int i = 0; i < 6; i++)
if (!isalnum((int) id[i]))
return false;
return true;
}
Wbfs_Fat::Wbfs_Fat(u32 lba, u32 size, u32 part, u32 port) : Wbfs_Fat::Wbfs_Fat(u32 lba, u32 size, u32 part, u32 port) :
Wbfs(lba, size, part, port), fat_hdr_list(NULL), fat_hdr_count(0) Wbfs(lba, size, part, port), fat_hdr_list(NULL), fat_hdr_count(0)
{ {
@ -150,7 +160,9 @@ s32 Wbfs_Fat::GetHeaders(struct discHdr *outbuf, u32 cnt, u32 len)
memcpy(outbuf, fat_hdr_list, cnt*len); memcpy(outbuf, fat_hdr_list, cnt*len);
SAFE_FREE(fat_hdr_list); if(fat_hdr_list)
free(fat_hdr_list);
fat_hdr_list = NULL;
fat_hdr_count = 0; fat_hdr_count = 0;
return 0; return 0;
@ -221,7 +233,7 @@ s32 Wbfs_Fat::RemoveGame(u8 *discid)
} }
closedir(dir); closedir(dir);
// remove game subdir // remove game subdir
unlink(path); remove(path);
return 0; return 0;
} }
@ -333,7 +345,7 @@ bool Wbfs_Fat::CheckLayoutB(char *fname, int len, u8* id, char *fname_title)
{ {
if (len <= 8) return false; if (len <= 8) return false;
if (fname[len - 8] != '[' || fname[len - 1] != ']') return false; if (fname[len - 8] != '[' || fname[len - 1] != ']') return false;
if (!is_gameid(&fname[len - 7])) return false; if (!isGameID(&fname[len - 7])) return false;
strncpy(fname_title, fname, TITLE_LEN); strncpy(fname_title, fname, TITLE_LEN);
// cut at '[' // cut at '['
fname_title[len - 8] = 0; fname_title[len - 8] = 0;
@ -388,7 +400,9 @@ s32 Wbfs_Fat::GetHeadersCount()
DIR *dir_iter; DIR *dir_iter;
struct dirent *dirent; struct dirent *dirent;
SAFE_FREE( fat_hdr_list ); if(fat_hdr_list)
free(fat_hdr_list);
fat_hdr_list = NULL;
fat_hdr_count = 0; fat_hdr_count = 0;
strcpy(path, wbfs_fs_drive); strcpy(path, wbfs_fs_drive);
@ -451,7 +465,7 @@ s32 Wbfs_Fat::GetHeadersCount()
// usb:/wbfs/GAMEID_TITLE/GAMEID.wbfs // usb:/wbfs/GAMEID_TITLE/GAMEID.wbfs
memcpy(id, fname, 6); memcpy(id, fname, 6);
if(is_gameid((char*) id)) if(isGameID((char*) id))
{ {
lay_a = 1; lay_a = 1;
snprintf(fname_title, sizeof(fname_title), &fname[7]); snprintf(fname_title, sizeof(fname_title), &fname[7]);
@ -821,16 +835,6 @@ void Wbfs_Fat::title_filename(char *title)
} }
} }
bool Wbfs_Fat::is_gameid(char *id)
{
int i;
for (i = 0; i < 6; i++)
{
if (!isalnum((u32) id[i])) return false;
}
return true;
}
int Wbfs_Fat::GetFragList(u8 *id) int Wbfs_Fat::GetFragList(u8 *id)
{ {
char fname[1024]; char fname[1024];

View File

@ -35,6 +35,7 @@ class Wbfs_Fat: public Wbfs
virtual int GetFragList(u8 *); virtual int GetFragList(u8 *);
virtual u8 GetFSType(void) { return PART_FS_FAT; } virtual u8 GetFSType(void) { return PART_FS_FAT; }
static bool CheckLayoutB(char *fname, int len, u8* id, char *fname_title);
protected: protected:
split_info_t split; split_info_t split;
@ -48,13 +49,11 @@ class Wbfs_Fat: public Wbfs
wbfs_t* CreatePart(u8 *id, char *path); wbfs_t* CreatePart(u8 *id, char *path);
int FindFilename(u8 *id, char *fname, int len); int FindFilename(u8 *id, char *fname, int len);
void Filename(u8 *id, char *fname, int len, char *path); void Filename(u8 *id, char *fname, int len, char *path);
bool CheckLayoutB(char *fname, int len, u8* id, char *fname_title);
s32 GetHeadersCount(); s32 GetHeadersCount();
void GetDir(struct discHdr *header, char *path); void GetDir(struct discHdr *header, char *path);
void mk_gameid_title(struct discHdr *header, char *name, int re_space, int layout); void mk_gameid_title(struct discHdr *header, char *name, int re_space, int layout);
void title_filename(char *title); void title_filename(char *title);
bool is_gameid(char *id);
static int nop_rw_sector(void *_fp, u32 lba, u32 count, void* buf) { return 0; } static int nop_rw_sector(void *_fp, u32 lba, u32 count, void* buf) { return 0; }
}; };

View File

@ -4,6 +4,7 @@
#include "settings/CSettings.h" #include "settings/CSettings.h"
#include "usbloader/wbfs.h" #include "usbloader/wbfs.h"
#include "usbloader/usbstorage2.h" #include "usbloader/usbstorage2.h"
#include "utils/tools.h"
#include "wbfs_rw.h" #include "wbfs_rw.h"
#define MAX_WBFS_SECTORSIZE 4096 #define MAX_WBFS_SECTORSIZE 4096

View File

@ -4,15 +4,16 @@
#include "settings/GameTitles.h" #include "settings/GameTitles.h"
#include "menu/menus.h" #include "menu/menus.h"
void rockout(int gameSelected, int f) void rockout(struct discHdr *header)
{ {
static bool rockoutSet = false; static bool rockoutSet = false;
HaltGui(); HaltGui();
if (gameSelected >= 0 && gameSelected < gameList.size() && !rockoutSet && (strcasestr(GameTitles.GetTitle(gameList[gameSelected]), "guitar") if (!rockoutSet && header &&
|| strcasestr(GameTitles.GetTitle(gameList[gameSelected]), "band") || strcasestr(GameTitles.GetTitle(gameList[gameSelected]), ( strcasestr(GameTitles.GetTitle(header), "guitar")
"rock"))) || strcasestr(GameTitles.GetTitle(header), "band")
|| strcasestr(GameTitles.GetTitle(header), "rock")))
{ {
pointer[0]->SetImage("rplayer1_point.png"); pointer[0]->SetImage("rplayer1_point.png");
pointer[1]->SetImage("rplayer2_point.png"); pointer[1]->SetImage("rplayer2_point.png");

View File

@ -1,6 +1,6 @@
#ifndef ROCKOUT_H_ #ifndef ROCKOUT_H_
#define ROCKOUT_H_ #define ROCKOUT_H_
void rockout(int gameSelected, int f = 0); void rockout(struct discHdr *header);
#endif #endif

View File

@ -1,6 +1,13 @@
#ifndef TOOLS_H_ #ifndef TOOLS_H_
#define TOOLS_H_ #define TOOLS_H_
/* Constants */
#define KB_SIZE 1024.0f
#define MB_SIZE 1048576.0f
#define GB_SIZE 1073741824.0f
#define round_up(x,n) (-(-(x) & -(n)))
#define ABS(x) ( (x) >= (0) ? (x) : (-(x)) ) #define ABS(x) ( (x) >= (0) ? (x) : (-(x)) )
#define LIMIT(x, min, max) \ #define LIMIT(x, min, max) \
({ \ ({ \

View File

@ -1,23 +0,0 @@
#ifndef _UTILS_H_
#define _UTILS_H_
#ifdef __cplusplus
extern "C"
{
#endif
/* Constants */
#define KB_SIZE 1024.0
#define MB_SIZE 1048576.0
#define GB_SIZE 1073741824.0
/* Macros */
#define round_up(x,n) (-(-(x) & -(n)))
/* Prototypes */
unsigned int swap32(unsigned int);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -21,7 +21,7 @@
#include "FileOperations/fileops.h" #include "FileOperations/fileops.h"
#include "language/gettext.h" #include "language/gettext.h"
#include "utils/ShowError.h" #include "utils/ShowError.h"
#include "wad/utils.h" #include "utils/tools.h"
#include "wad.h" #include "wad.h"
extern "C" extern "C"