2010-11-13 23:34:53 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Copyright (C) 2010
|
|
|
|
* by Dimok
|
|
|
|
*
|
|
|
|
* This software is provided 'as-is', without any express or implied
|
|
|
|
* warranty. In no event will the authors be held liable for any
|
|
|
|
* damages arising from the use of this software.
|
|
|
|
*
|
|
|
|
* Permission is granted to anyone to use this software for any
|
|
|
|
* purpose, including commercial applications, and to alter it and
|
|
|
|
* redistribute it freely, subject to the following restrictions:
|
|
|
|
*
|
|
|
|
* 1. The origin of this software must not be misrepresented; you
|
|
|
|
* must not claim that you wrote the original software. If you use
|
|
|
|
* this software in a product, an acknowledgment in the product
|
|
|
|
* documentation would be appreciated but is not required.
|
|
|
|
*
|
|
|
|
* 2. Altered source versions must be plainly marked as such, and
|
|
|
|
* must not be misrepresented as being the original software.
|
|
|
|
*
|
|
|
|
* 3. This notice may not be removed or altered from any source
|
|
|
|
* distribution.
|
|
|
|
***************************************************************************/
|
2011-06-03 22:31:09 +02:00
|
|
|
#include <unistd.h>
|
2010-11-13 23:34:53 +01:00
|
|
|
#include "GameSettingsMenu.hpp"
|
|
|
|
#include "themes/CTheme.h"
|
|
|
|
#include "prompts/PromptWindows.h"
|
2011-06-03 22:31:09 +02:00
|
|
|
#include "prompts/CategorySelectPrompt.hpp"
|
2010-11-13 23:34:53 +01:00
|
|
|
#include "settings/GameTitles.h"
|
2011-06-03 22:31:09 +02:00
|
|
|
#include "usbloader/GameList.h"
|
2010-11-13 23:34:53 +01:00
|
|
|
#include "language/gettext.h"
|
|
|
|
#include "wad/nandtitle.h"
|
|
|
|
#include "cheats/cheatmenu.h"
|
2011-01-09 11:45:29 +01:00
|
|
|
#include "GameLoadSM.hpp"
|
2010-11-13 23:34:53 +01:00
|
|
|
#include "UninstallSM.hpp"
|
|
|
|
|
2011-06-03 22:31:09 +02:00
|
|
|
GameSettingsMenu::GameSettingsMenu(GameBrowseMenu *parent, struct discHdr * header)
|
|
|
|
: FlyingButtonsMenu(GameTitles.GetTitle(header)), browserMenu(parent)
|
2010-11-13 23:34:53 +01:00
|
|
|
{
|
|
|
|
DiscHeader = header;
|
2010-12-05 20:09:32 +01:00
|
|
|
//! Don't switch menu's by default but return to disc window.
|
|
|
|
ParentMenu = -2;
|
2010-11-13 23:34:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
GameSettingsMenu::~GameSettingsMenu()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-06-03 22:31:09 +02:00
|
|
|
int GameSettingsMenu::Show(GameBrowseMenu *parent, struct discHdr * header)
|
|
|
|
{
|
|
|
|
GameSettingsMenu * Menu = new GameSettingsMenu(parent, header);
|
|
|
|
mainWindow->Append(Menu);
|
|
|
|
|
|
|
|
Menu->ShowMenu();
|
|
|
|
|
|
|
|
int returnMenu = MENU_NONE;
|
|
|
|
|
|
|
|
while((returnMenu = Menu->MainLoop()) == MENU_NONE);
|
|
|
|
|
|
|
|
delete Menu;
|
|
|
|
|
|
|
|
return returnMenu;
|
|
|
|
}
|
|
|
|
|
2010-11-13 23:34:53 +01:00
|
|
|
void GameSettingsMenu::SetupMainButtons()
|
|
|
|
{
|
|
|
|
int pos = 0;
|
|
|
|
|
|
|
|
SetMainButton(pos++, tr( "Game Load" ), MainButtonImgData, MainButtonImgOverData);
|
|
|
|
SetMainButton(pos++, tr( "Ocarina" ), MainButtonImgData, MainButtonImgOverData);
|
2011-06-03 22:31:09 +02:00
|
|
|
SetMainButton(pos++, tr( "Categories" ), MainButtonImgData, MainButtonImgOverData);
|
2010-11-13 23:34:53 +01:00
|
|
|
SetMainButton(pos++, tr( "Uninstall Menu" ), MainButtonImgData, MainButtonImgOverData);
|
|
|
|
SetMainButton(pos++, tr( "Default Gamesettings" ), MainButtonImgData, MainButtonImgOverData);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GameSettingsMenu::CreateSettingsMenu(int menuNr)
|
|
|
|
{
|
|
|
|
if(CurrentMenu)
|
|
|
|
return;
|
|
|
|
|
|
|
|
int Idx = 0;
|
|
|
|
|
|
|
|
//! Game Load
|
|
|
|
if(menuNr == Idx++)
|
|
|
|
{
|
|
|
|
HideMenu();
|
|
|
|
ResumeGui();
|
2011-01-09 11:45:29 +01:00
|
|
|
CurrentMenu = new GameLoadSM((const char *) DiscHeader->id);
|
2010-11-13 23:34:53 +01:00
|
|
|
Append(CurrentMenu);
|
|
|
|
}
|
|
|
|
|
|
|
|
//! Ocarina
|
|
|
|
else if(menuNr == Idx++)
|
|
|
|
{
|
|
|
|
char ID[7];
|
|
|
|
snprintf(ID, sizeof(ID), "%s", (char *) DiscHeader->id);
|
|
|
|
CheatMenu(ID);
|
|
|
|
}
|
|
|
|
|
2011-06-03 22:31:09 +02:00
|
|
|
//! Categories
|
|
|
|
else if(menuNr == Idx++)
|
|
|
|
{
|
|
|
|
HideMenu();
|
|
|
|
titleTxt = new GuiText(MenuTitle.c_str(), 28, ( GXColor ) {0, 0, 0, 255});
|
|
|
|
titleTxt->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
titleTxt->SetPosition(0, 40);
|
|
|
|
titleTxt->SetMaxWidth(310, SCROLL_HORIZONTAL);
|
|
|
|
Append(titleTxt);
|
|
|
|
Remove(backBtn);
|
|
|
|
ResumeGui();
|
|
|
|
SetState(STATE_DISABLED);
|
|
|
|
CategorySelectPrompt promptMenu(DiscHeader);
|
|
|
|
promptMenu.SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
|
|
|
|
promptMenu.SetEffect(EFFECT_FADE, 20);
|
|
|
|
mainWindow->Append(&promptMenu);
|
|
|
|
|
|
|
|
promptMenu.Show();
|
|
|
|
|
|
|
|
promptMenu.SetEffect(EFFECT_FADE, -20);
|
|
|
|
while(promptMenu.GetEffect() > 0) usleep(100);
|
|
|
|
mainWindow->Remove(&promptMenu);
|
|
|
|
if(promptMenu.categoriesChanged())
|
|
|
|
{
|
|
|
|
wString oldFilter(gameList.GetCurrentFilter());
|
|
|
|
gameList.FilterList(oldFilter.c_str());
|
|
|
|
browserMenu->ReloadBrowser();
|
|
|
|
}
|
|
|
|
SetState(STATE_DEFAULT);
|
|
|
|
Remove(titleTxt);
|
|
|
|
delete titleTxt;
|
|
|
|
titleTxt = NULL;
|
|
|
|
Append(backBtn);
|
|
|
|
ShowMenu();
|
|
|
|
}
|
|
|
|
|
2010-11-13 23:34:53 +01:00
|
|
|
//! Uninstall Menu
|
|
|
|
else if(menuNr == Idx++)
|
|
|
|
{
|
|
|
|
HideMenu();
|
|
|
|
ResumeGui();
|
|
|
|
CurrentMenu = new UninstallSM(DiscHeader);
|
|
|
|
Append(CurrentMenu);
|
|
|
|
}
|
|
|
|
|
|
|
|
//! Default Gamesettings
|
|
|
|
else if(menuNr == Idx++)
|
|
|
|
{
|
|
|
|
int choice = WindowPrompt(tr( "Are you sure?" ), 0, tr( "Yes" ), tr( "Cancel" ));
|
|
|
|
if (choice == 1)
|
|
|
|
{
|
|
|
|
GameSettings.Remove(DiscHeader->id);
|
|
|
|
GameSettings.Save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void GameSettingsMenu::DeleteSettingsMenu()
|
|
|
|
{
|
|
|
|
if(!CurrentMenu)
|
|
|
|
return;
|
|
|
|
|
|
|
|
int type = CurrentMenu->GetType();
|
|
|
|
|
|
|
|
switch(type)
|
|
|
|
{
|
2011-01-09 11:45:29 +01:00
|
|
|
case CGameLoadSM:
|
|
|
|
delete ((GameLoadSM *) CurrentMenu);
|
2010-11-13 23:34:53 +01:00
|
|
|
break;
|
|
|
|
case CUninstallSM:
|
|
|
|
delete ((UninstallSM *) CurrentMenu);
|
|
|
|
break;
|
|
|
|
case CSettingsMenu:
|
|
|
|
default:
|
|
|
|
delete CurrentMenu;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
CurrentMenu = NULL;
|
|
|
|
}
|