mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-09-09 00:53:19 +02:00
![dimok321](/assets/img/avatar_default.png)
*Rewrote the whole Settings.cpp into 11 classes. Each settings menu has it's own class now *Reworked the whole sound system. Supported formats AIF/MP3/OGG/BNS/WAV now with no file size limit (streaming). *Changed button click/over sounds to wav from raw pcm *Lot's of bug fixes
122 lines
3.3 KiB
C++
122 lines
3.3 KiB
C++
/****************************************************************************
|
|
* 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.
|
|
***************************************************************************/
|
|
#include "GameSettingsMenu.hpp"
|
|
#include "themes/CTheme.h"
|
|
#include "prompts/PromptWindows.h"
|
|
#include "settings/GameTitles.h"
|
|
#include "language/gettext.h"
|
|
#include "wad/nandtitle.h"
|
|
#include "cheats/cheatmenu.h"
|
|
#include "IndGameLoadSM.hpp"
|
|
#include "UninstallSM.hpp"
|
|
|
|
GameSettingsMenu::GameSettingsMenu(struct discHdr * header)
|
|
: FlyingButtonsMenu(GameTitles.GetTitle(header))
|
|
{
|
|
DiscHeader = header;
|
|
}
|
|
|
|
GameSettingsMenu::~GameSettingsMenu()
|
|
{
|
|
}
|
|
|
|
void GameSettingsMenu::SetupMainButtons()
|
|
{
|
|
int pos = 0;
|
|
|
|
SetMainButton(pos++, tr( "Game Load" ), MainButtonImgData, MainButtonImgOverData);
|
|
SetMainButton(pos++, tr( "Ocarina" ), MainButtonImgData, MainButtonImgOverData);
|
|
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();
|
|
CurrentMenu = new IndGameLoadSM((const char *) DiscHeader->id);
|
|
Append(CurrentMenu);
|
|
}
|
|
|
|
//! Ocarina
|
|
else if(menuNr == Idx++)
|
|
{
|
|
char ID[7];
|
|
snprintf(ID, sizeof(ID), "%s", (char *) DiscHeader->id);
|
|
CheatMenu(ID);
|
|
}
|
|
|
|
//! 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)
|
|
{
|
|
case CIndGameLoadSM:
|
|
delete ((IndGameLoadSM *) CurrentMenu);
|
|
break;
|
|
case CUninstallSM:
|
|
delete ((UninstallSM *) CurrentMenu);
|
|
break;
|
|
case CSettingsMenu:
|
|
default:
|
|
delete CurrentMenu;
|
|
break;
|
|
}
|
|
|
|
CurrentMenu = NULL;
|
|
}
|