2008-09-02 03:57:21 +02:00
|
|
|
/****************************************************************************
|
2009-07-22 04:05:49 +02:00
|
|
|
* FCE Ultra
|
2008-09-02 03:57:21 +02:00
|
|
|
* Nintendo Wii/Gamecube Port
|
|
|
|
*
|
2009-03-28 18:23:08 +01:00
|
|
|
* Tantric 2008-2009
|
2008-09-02 03:57:21 +02:00
|
|
|
*
|
2009-06-07 20:02:11 +02:00
|
|
|
* menu.cpp
|
2008-09-02 03:57:21 +02:00
|
|
|
*
|
|
|
|
* Main menu flow control
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <gccore.h>
|
|
|
|
#include <ogcsys.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <wiiuse/wpad.h>
|
2009-04-02 08:05:59 +02:00
|
|
|
#include <sys/stat.h>
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2008-12-30 01:05:57 +01:00
|
|
|
#ifdef HW_RVL
|
2008-09-02 03:57:21 +02:00
|
|
|
#include <di/di.h>
|
|
|
|
#endif
|
|
|
|
|
2009-07-17 19:27:04 +02:00
|
|
|
#include "fceusupport.h"
|
2008-11-17 01:09:31 +01:00
|
|
|
#include "fceugx.h"
|
2009-07-21 08:26:38 +02:00
|
|
|
#include "videofilter.h"
|
2008-09-02 03:57:21 +02:00
|
|
|
#include "pad.h"
|
2009-03-28 18:23:08 +01:00
|
|
|
#include "gcvideo.h"
|
|
|
|
#include "filebrowser.h"
|
2008-09-02 03:57:21 +02:00
|
|
|
#include "gcunzip.h"
|
2008-12-24 08:58:23 +01:00
|
|
|
#include "networkop.h"
|
2008-09-02 03:57:21 +02:00
|
|
|
#include "fileop.h"
|
2009-03-28 18:23:08 +01:00
|
|
|
#include "fceuram.h"
|
2008-09-02 03:57:21 +02:00
|
|
|
#include "fceustate.h"
|
|
|
|
#include "preferences.h"
|
2009-03-28 18:23:08 +01:00
|
|
|
#include "button_mapping.h"
|
2010-01-25 22:04:44 +01:00
|
|
|
#include "gettext.h"
|
2009-03-28 18:23:08 +01:00
|
|
|
#include "filelist.h"
|
|
|
|
#include "gui/gui.h"
|
|
|
|
#include "menu.h"
|
2008-09-06 20:24:52 +02:00
|
|
|
#include "fceuload.h"
|
2009-07-21 08:26:38 +02:00
|
|
|
#include "filelist.h"
|
2009-07-22 03:58:45 +02:00
|
|
|
#include "cheatmgr.h"
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-05-06 08:33:34 +02:00
|
|
|
#define THREAD_SLEEP 100
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
#ifdef HW_RVL
|
|
|
|
static GuiImageData * pointer[4];
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static GuiButton * btnLogo = NULL;
|
|
|
|
static GuiImage * gameScreenImg = NULL;
|
|
|
|
static GuiImage * bgImg = NULL;
|
|
|
|
static GuiImage * bgTopImg = NULL;
|
|
|
|
static GuiImage * bgBottomImg = NULL;
|
|
|
|
static GuiSound * bgMusic = NULL;
|
2009-04-05 05:11:38 +02:00
|
|
|
static GuiSound * enterSound = NULL;
|
|
|
|
static GuiSound * exitSound = NULL;
|
2009-03-28 18:23:08 +01:00
|
|
|
static GuiWindow * mainWindow = NULL;
|
|
|
|
static GuiText * settingText = NULL;
|
2009-11-16 09:14:38 +01:00
|
|
|
static GuiText * settingText2 = NULL;
|
2009-03-28 18:23:08 +01:00
|
|
|
static int lastMenu = MENU_NONE;
|
|
|
|
static int mapMenuCtrl = 0;
|
|
|
|
static int mapMenuCtrlNES = 0;
|
|
|
|
|
|
|
|
static lwp_t guithread = LWP_THREAD_NULL;
|
|
|
|
static lwp_t progressthread = LWP_THREAD_NULL;
|
2009-04-01 07:48:01 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
static lwp_t updatethread = LWP_THREAD_NULL;
|
|
|
|
#endif
|
|
|
|
static bool guiHalt = true;
|
2009-03-28 18:23:08 +01:00
|
|
|
static int showProgress = 0;
|
|
|
|
|
|
|
|
static char progressTitle[100];
|
|
|
|
static char progressMsg[200];
|
|
|
|
static int progressDone = 0;
|
|
|
|
static int progressTotal = 0;
|
|
|
|
|
2009-07-20 08:18:06 +02:00
|
|
|
bool GuiLoaded()
|
|
|
|
{
|
|
|
|
if(mainWindow)
|
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-04-01 07:48:01 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* ResumeGui
|
|
|
|
*
|
|
|
|
* Signals the GUI thread to start, and resumes the thread. This is called
|
|
|
|
* after finishing the removal/insertion of new elements, and after initial
|
|
|
|
* GUI setup.
|
|
|
|
***************************************************************************/
|
2009-03-28 18:23:08 +01:00
|
|
|
static void
|
|
|
|
ResumeGui()
|
|
|
|
{
|
|
|
|
guiHalt = false;
|
|
|
|
LWP_ResumeThread (guithread);
|
|
|
|
}
|
|
|
|
|
2009-04-01 07:48:01 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* HaltGui
|
|
|
|
*
|
|
|
|
* Signals the GUI thread to stop, and waits for GUI thread to stop
|
|
|
|
* This is necessary whenever removing/inserting new elements into the GUI.
|
|
|
|
* This eliminates the possibility that the GUI is in the middle of accessing
|
|
|
|
* an element that is being changed.
|
|
|
|
***************************************************************************/
|
2009-03-28 18:23:08 +01:00
|
|
|
static void
|
|
|
|
HaltGui()
|
|
|
|
{
|
|
|
|
guiHalt = true;
|
|
|
|
|
|
|
|
// wait for thread to finish
|
|
|
|
while(!LWP_ThreadIsSuspended(guithread))
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
|
2010-01-25 22:04:44 +01:00
|
|
|
void ResetText()
|
|
|
|
{
|
|
|
|
LoadLanguage();
|
|
|
|
|
|
|
|
if(mainWindow)
|
|
|
|
mainWindow->ResetText();
|
|
|
|
}
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* WindowPrompt
|
2009-04-01 07:48:01 +02:00
|
|
|
*
|
|
|
|
* Displays a prompt window to user, with information, an error message, or
|
|
|
|
* presenting a user with a choice
|
2009-03-28 18:23:08 +01:00
|
|
|
***************************************************************************/
|
|
|
|
int
|
|
|
|
WindowPrompt(const char *title, const char *msg, const char *btn1Label, const char *btn2Label)
|
|
|
|
{
|
|
|
|
int choice = -1;
|
|
|
|
|
|
|
|
GuiWindow promptWindow(448,288);
|
|
|
|
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
promptWindow.SetPosition(0, -10);
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiImageData dialogBox(dialogue_box_png);
|
|
|
|
GuiImage dialogBoxImg(&dialogBox);
|
|
|
|
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiText titleTxt(title, 26, (GXColor){70, 70, 10, 255});
|
2009-03-28 18:23:08 +01:00
|
|
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(0,14);
|
|
|
|
GuiText msgTxt(msg, 26, (GXColor){0, 0, 0, 255});
|
|
|
|
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
msgTxt.SetPosition(0,-20);
|
2009-06-27 21:12:47 +02:00
|
|
|
msgTxt.SetWrap(true, 430);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
GuiText btn1Txt(btn1Label, 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage btn1Img(&btnOutline);
|
|
|
|
GuiImage btn1ImgOver(&btnOutlineOver);
|
|
|
|
GuiButton btn1(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
|
|
|
|
if(btn2Label)
|
|
|
|
{
|
|
|
|
btn1.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(20, -25);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
btn1.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
btn1.SetPosition(0, -25);
|
|
|
|
}
|
|
|
|
|
|
|
|
btn1.SetLabel(&btn1Txt);
|
|
|
|
btn1.SetImage(&btn1Img);
|
|
|
|
btn1.SetImageOver(&btn1ImgOver);
|
|
|
|
btn1.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
btn1.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
btn1.SetTrigger(&trigA);
|
|
|
|
btn1.SetState(STATE_SELECTED);
|
|
|
|
btn1.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText btn2Txt(btn2Label, 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage btn2Img(&btnOutline);
|
|
|
|
GuiImage btn2ImgOver(&btnOutlineOver);
|
|
|
|
GuiButton btn2(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
btn2.SetPosition(-20, -25);
|
|
|
|
btn2.SetLabel(&btn2Txt);
|
|
|
|
btn2.SetImage(&btn2Img);
|
|
|
|
btn2.SetImageOver(&btn2ImgOver);
|
|
|
|
btn2.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
btn2.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
btn2.SetTrigger(&trigA);
|
|
|
|
btn2.SetEffectGrow();
|
|
|
|
|
|
|
|
promptWindow.Append(&dialogBoxImg);
|
|
|
|
promptWindow.Append(&titleTxt);
|
|
|
|
promptWindow.Append(&msgTxt);
|
|
|
|
promptWindow.Append(&btn1);
|
|
|
|
|
|
|
|
if(btn2Label)
|
|
|
|
promptWindow.Append(&btn2);
|
|
|
|
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
|
|
|
|
CancelAction();
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
mainWindow->Append(&promptWindow);
|
|
|
|
mainWindow->ChangeFocus(&promptWindow);
|
2009-07-28 00:37:56 +02:00
|
|
|
if(btn2Label)
|
|
|
|
{
|
|
|
|
btn1.ResetState();
|
|
|
|
btn2.SetState(STATE_SELECTED);
|
|
|
|
}
|
2009-03-28 18:23:08 +01:00
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(choice == -1)
|
|
|
|
{
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
if(btn1.GetState() == STATE_CLICKED)
|
|
|
|
choice = 1;
|
|
|
|
else if(btn2.GetState() == STATE_CLICKED)
|
|
|
|
choice = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
2009-05-06 08:33:34 +02:00
|
|
|
while(promptWindow.GetEffect() > 0) usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&promptWindow);
|
|
|
|
mainWindow->SetState(STATE_DEFAULT);
|
|
|
|
ResumeGui();
|
|
|
|
return choice;
|
|
|
|
}
|
|
|
|
|
2009-04-01 07:48:01 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
/****************************************************************************
|
|
|
|
* EmulatorUpdate
|
|
|
|
*
|
|
|
|
* Prompts for confirmation, and downloads/installs updates
|
|
|
|
***************************************************************************/
|
|
|
|
static void *
|
|
|
|
EmulatorUpdate (void *arg)
|
|
|
|
{
|
|
|
|
bool installUpdate = WindowPrompt(
|
|
|
|
"Update Available",
|
|
|
|
"An update is available!",
|
|
|
|
"Update now",
|
|
|
|
"Update later");
|
|
|
|
if(installUpdate)
|
|
|
|
if(DownloadUpdate())
|
|
|
|
ExitRequested = 1;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* UpdateGUI
|
2009-04-01 07:48:01 +02:00
|
|
|
*
|
|
|
|
* Primary thread to allow GUI to respond to state changes, and draws GUI
|
2009-03-28 18:23:08 +01:00
|
|
|
***************************************************************************/
|
|
|
|
static void *
|
|
|
|
UpdateGUI (void *arg)
|
|
|
|
{
|
2009-06-02 08:47:03 +02:00
|
|
|
int i;
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
if(guiHalt)
|
|
|
|
LWP_SuspendThread(guithread);
|
|
|
|
|
2009-10-12 21:24:54 +02:00
|
|
|
UpdatePads();
|
2009-10-06 21:59:05 +02:00
|
|
|
mainWindow->Draw();
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2010-01-25 09:23:03 +01:00
|
|
|
if (mainWindow->GetState() != STATE_DISABLED)
|
|
|
|
mainWindow->DrawTooltip();
|
|
|
|
|
2009-10-06 21:59:05 +02:00
|
|
|
#ifdef HW_RVL
|
2010-01-25 08:33:35 +01:00
|
|
|
i = 3;
|
|
|
|
do
|
2009-10-06 21:59:05 +02:00
|
|
|
{
|
2009-10-13 02:40:02 +02:00
|
|
|
if(userInput[i].wpad->ir.valid)
|
|
|
|
Menu_DrawImg(userInput[i].wpad->ir.x-48, userInput[i].wpad->ir.y-48,
|
|
|
|
96, 96, pointer[i]->GetImage(), userInput[i].wpad->ir.angle, 1, 1, 255);
|
2009-10-06 21:59:05 +02:00
|
|
|
DoRumble(i);
|
2010-01-25 08:33:35 +01:00
|
|
|
--i;
|
|
|
|
} while(i>=0);
|
2009-10-06 21:59:05 +02:00
|
|
|
#endif
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-10-06 21:59:05 +02:00
|
|
|
Menu_Render();
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2010-01-25 08:33:35 +01:00
|
|
|
mainWindow->Update(&userInput[3]);
|
|
|
|
mainWindow->Update(&userInput[2]);
|
|
|
|
mainWindow->Update(&userInput[1]);
|
|
|
|
mainWindow->Update(&userInput[0]);
|
2009-10-06 21:59:05 +02:00
|
|
|
|
|
|
|
#ifdef HW_RVL
|
|
|
|
if(updateFound)
|
|
|
|
{
|
|
|
|
updateFound = false;
|
|
|
|
LWP_CreateThread (&updatethread, EmulatorUpdate, NULL, NULL, 0, 70);
|
|
|
|
}
|
|
|
|
#endif
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-10-06 21:59:05 +02:00
|
|
|
if(ExitRequested || ShutdownRequested)
|
|
|
|
{
|
|
|
|
for(i = 0; i < 255; i += 15)
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
2009-10-06 21:59:05 +02:00
|
|
|
mainWindow->Draw();
|
|
|
|
Menu_DrawRectangle(0,0,screenwidth,screenheight,(GXColor){0, 0, 0, i},1);
|
|
|
|
Menu_Render();
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
2009-10-06 21:59:05 +02:00
|
|
|
ExitApp();
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* ProgressWindow
|
2009-04-01 07:48:01 +02:00
|
|
|
*
|
|
|
|
* Opens a window, which displays progress to the user. Can either display a
|
|
|
|
* progress bar showing % completion, or a throbber that only shows that an
|
|
|
|
* action is in progress.
|
2009-03-28 18:23:08 +01:00
|
|
|
***************************************************************************/
|
2009-07-09 19:47:28 +02:00
|
|
|
static int progsleep = 0;
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
static void
|
|
|
|
ProgressWindow(char *title, char *msg)
|
|
|
|
{
|
|
|
|
GuiWindow promptWindow(448,288);
|
|
|
|
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
promptWindow.SetPosition(0, -10);
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiImageData dialogBox(dialogue_box_png);
|
|
|
|
GuiImage dialogBoxImg(&dialogBox);
|
|
|
|
|
|
|
|
GuiImageData progressbarOutline(progressbar_outline_png);
|
|
|
|
GuiImage progressbarOutlineImg(&progressbarOutline);
|
|
|
|
progressbarOutlineImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
progressbarOutlineImg.SetPosition(25, 40);
|
|
|
|
|
|
|
|
GuiImageData progressbarEmpty(progressbar_empty_png);
|
|
|
|
GuiImage progressbarEmptyImg(&progressbarEmpty);
|
|
|
|
progressbarEmptyImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
progressbarEmptyImg.SetPosition(25, 40);
|
|
|
|
progressbarEmptyImg.SetTile(100);
|
|
|
|
|
|
|
|
GuiImageData progressbar(progressbar_png);
|
|
|
|
GuiImage progressbarImg(&progressbar);
|
|
|
|
progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
progressbarImg.SetPosition(25, 40);
|
|
|
|
|
|
|
|
GuiImageData throbber(throbber_png);
|
|
|
|
GuiImage throbberImg(&throbber);
|
|
|
|
throbberImg.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
throbberImg.SetPosition(0, 40);
|
|
|
|
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiText titleTxt(title, 26, (GXColor){70, 70, 10, 255});
|
2009-03-28 18:23:08 +01:00
|
|
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(0,14);
|
|
|
|
GuiText msgTxt(msg, 26, (GXColor){0, 0, 0, 255});
|
|
|
|
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
msgTxt.SetPosition(0,80);
|
|
|
|
|
|
|
|
promptWindow.Append(&dialogBoxImg);
|
|
|
|
promptWindow.Append(&titleTxt);
|
|
|
|
promptWindow.Append(&msgTxt);
|
|
|
|
|
|
|
|
if(showProgress == 1)
|
|
|
|
{
|
|
|
|
promptWindow.Append(&progressbarEmptyImg);
|
|
|
|
promptWindow.Append(&progressbarImg);
|
|
|
|
promptWindow.Append(&progressbarOutlineImg);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
promptWindow.Append(&throbberImg);
|
|
|
|
}
|
|
|
|
|
2009-07-09 19:47:28 +02:00
|
|
|
// wait to see if progress flag changes soon
|
|
|
|
progsleep = 400000;
|
|
|
|
|
|
|
|
while(progsleep > 0)
|
|
|
|
{
|
|
|
|
if(!showProgress)
|
|
|
|
break;
|
|
|
|
usleep(THREAD_SLEEP);
|
|
|
|
progsleep -= THREAD_SLEEP;
|
|
|
|
}
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
if(!showProgress)
|
|
|
|
return;
|
|
|
|
|
|
|
|
HaltGui();
|
2009-04-22 00:08:23 +02:00
|
|
|
int oldState = mainWindow->GetState();
|
2009-03-28 18:23:08 +01:00
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
mainWindow->Append(&promptWindow);
|
|
|
|
mainWindow->ChangeFocus(&promptWindow);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
float angle = 0;
|
|
|
|
u32 count = 0;
|
|
|
|
|
|
|
|
while(showProgress)
|
|
|
|
{
|
2009-07-09 19:47:28 +02:00
|
|
|
progsleep = 20000;
|
|
|
|
|
|
|
|
while(progsleep > 0)
|
|
|
|
{
|
|
|
|
if(!showProgress)
|
|
|
|
break;
|
|
|
|
usleep(THREAD_SLEEP);
|
|
|
|
progsleep -= THREAD_SLEEP;
|
|
|
|
}
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
if(showProgress == 1)
|
|
|
|
{
|
|
|
|
progressbarImg.SetTile(100*progressDone/progressTotal);
|
|
|
|
}
|
|
|
|
else if(showProgress == 2)
|
|
|
|
{
|
|
|
|
if(count % 5 == 0)
|
|
|
|
{
|
2010-01-25 08:33:35 +01:00
|
|
|
angle+=45.0f;
|
|
|
|
if(angle >= 360.0f)
|
2009-03-28 18:23:08 +01:00
|
|
|
angle = 0;
|
|
|
|
throbberImg.SetAngle(angle);
|
|
|
|
}
|
2010-01-25 08:33:35 +01:00
|
|
|
++count;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&promptWindow);
|
2009-04-22 00:08:23 +02:00
|
|
|
mainWindow->SetState(oldState);
|
2009-03-28 18:23:08 +01:00
|
|
|
ResumeGui();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void * ProgressThread (void *arg)
|
|
|
|
{
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
if(!showProgress)
|
|
|
|
LWP_SuspendThread (progressthread);
|
|
|
|
|
|
|
|
ProgressWindow(progressTitle, progressMsg);
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* InitGUIThread
|
2009-04-01 07:48:01 +02:00
|
|
|
*
|
|
|
|
* Startup GUI threads
|
2009-03-28 18:23:08 +01:00
|
|
|
***************************************************************************/
|
|
|
|
void
|
|
|
|
InitGUIThreads()
|
|
|
|
{
|
|
|
|
LWP_CreateThread (&guithread, UpdateGUI, NULL, NULL, 0, 70);
|
|
|
|
LWP_CreateThread (&progressthread, ProgressThread, NULL, NULL, 0, 40);
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2009-04-01 07:48:01 +02:00
|
|
|
* CancelAction
|
2009-03-28 18:23:08 +01:00
|
|
|
*
|
2009-04-01 07:48:01 +02:00
|
|
|
* Signals the GUI progress window thread to halt, and waits for it to
|
|
|
|
* finish. Prevents multiple progress window events from interfering /
|
|
|
|
* overriding each other.
|
2009-03-28 18:23:08 +01:00
|
|
|
***************************************************************************/
|
|
|
|
void
|
|
|
|
CancelAction()
|
|
|
|
{
|
|
|
|
showProgress = 0;
|
|
|
|
|
|
|
|
// wait for thread to finish
|
|
|
|
while(!LWP_ThreadIsSuspended(progressthread))
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
|
2009-04-01 07:48:01 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* ShowProgress
|
|
|
|
*
|
|
|
|
* Updates the variables used by the progress window for drawing a progress
|
|
|
|
* bar. Also resumes the progress window thread if it is suspended.
|
|
|
|
***************************************************************************/
|
2009-03-28 18:23:08 +01:00
|
|
|
void
|
|
|
|
ShowProgress (const char *msg, int done, int total)
|
|
|
|
{
|
2009-07-09 19:47:28 +02:00
|
|
|
if(!mainWindow || ExitRequested || ShutdownRequested)
|
2009-07-07 06:47:36 +02:00
|
|
|
return;
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
if(total < (256*1024))
|
|
|
|
return;
|
|
|
|
else if(done > total) // this shouldn't happen
|
|
|
|
done = total;
|
|
|
|
|
|
|
|
if(done/total > 0.99)
|
|
|
|
done = total;
|
|
|
|
|
|
|
|
if(showProgress != 1)
|
|
|
|
CancelAction(); // wait for previous progress window to finish
|
|
|
|
|
|
|
|
strncpy(progressMsg, msg, 200);
|
|
|
|
sprintf(progressTitle, "Please Wait");
|
|
|
|
showProgress = 1;
|
|
|
|
progressTotal = total;
|
|
|
|
progressDone = done;
|
|
|
|
LWP_ResumeThread (progressthread);
|
|
|
|
}
|
|
|
|
|
2009-04-01 07:48:01 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* ShowAction
|
|
|
|
*
|
|
|
|
* Shows that an action is underway. Also resumes the progress window thread
|
|
|
|
* if it is suspended.
|
|
|
|
***************************************************************************/
|
2009-03-28 18:23:08 +01:00
|
|
|
void
|
|
|
|
ShowAction (const char *msg)
|
|
|
|
{
|
2009-07-09 19:47:28 +02:00
|
|
|
if(!mainWindow || ExitRequested || ShutdownRequested)
|
2009-07-07 06:47:36 +02:00
|
|
|
return;
|
|
|
|
|
2009-05-30 08:28:00 +02:00
|
|
|
if(showProgress != 0)
|
2009-03-28 18:23:08 +01:00
|
|
|
CancelAction(); // wait for previous progress window to finish
|
|
|
|
|
|
|
|
strncpy(progressMsg, msg, 200);
|
|
|
|
sprintf(progressTitle, "Please Wait");
|
|
|
|
showProgress = 2;
|
|
|
|
progressDone = 0;
|
|
|
|
progressTotal = 0;
|
|
|
|
LWP_ResumeThread (progressthread);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ErrorPrompt(const char *msg)
|
|
|
|
{
|
|
|
|
WindowPrompt("Error", msg, "OK", NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
int ErrorPromptRetry(const char *msg)
|
|
|
|
{
|
|
|
|
return WindowPrompt("Error", msg, "Retry", "Cancel");
|
|
|
|
}
|
|
|
|
|
|
|
|
void InfoPrompt(const char *msg)
|
|
|
|
{
|
|
|
|
WindowPrompt("Information", msg, "OK", NULL);
|
|
|
|
}
|
|
|
|
|
2009-04-01 07:48:01 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* AutoSave
|
|
|
|
*
|
|
|
|
* Automatically saves RAM/state when returning from in-game to the menu
|
|
|
|
***************************************************************************/
|
2009-03-28 18:23:08 +01:00
|
|
|
void AutoSave()
|
|
|
|
{
|
|
|
|
if (GCSettings.AutoSave == 1)
|
|
|
|
{
|
2009-10-02 00:21:25 +02:00
|
|
|
SaveRAMAuto(SILENT);
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
else if (GCSettings.AutoSave == 2)
|
|
|
|
{
|
|
|
|
if (WindowPrompt("Save", "Save State?", "Save", "Don't Save") )
|
2009-10-02 00:21:25 +02:00
|
|
|
SaveStateAuto(NOTSILENT);
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
else if (GCSettings.AutoSave == 3)
|
|
|
|
{
|
|
|
|
if (WindowPrompt("Save", "Save RAM and State?", "Save", "Don't Save") )
|
|
|
|
{
|
2009-10-02 00:21:25 +02:00
|
|
|
SaveRAMAuto(NOTSILENT);
|
|
|
|
SaveStateAuto(NOTSILENT);
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-01 07:48:01 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* OnScreenKeyboard
|
|
|
|
*
|
|
|
|
* Opens an on-screen keyboard window, with the data entered being stored
|
|
|
|
* into the specified variable.
|
|
|
|
***************************************************************************/
|
2009-04-06 08:30:47 +02:00
|
|
|
static void OnScreenKeyboard(char * var, u32 maxlen)
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
|
|
|
int save = -1;
|
|
|
|
|
2009-03-30 10:22:55 +02:00
|
|
|
GuiKeyboard keyboard(var, maxlen);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiText okBtnTxt("OK", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage okBtnImg(&btnOutline);
|
|
|
|
GuiImage okBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton okBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
|
|
|
|
okBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
okBtn.SetPosition(25, -25);
|
|
|
|
|
|
|
|
okBtn.SetLabel(&okBtnTxt);
|
|
|
|
okBtn.SetImage(&okBtnImg);
|
|
|
|
okBtn.SetImageOver(&okBtnImgOver);
|
|
|
|
okBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
okBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
okBtn.SetTrigger(&trigA);
|
|
|
|
okBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText cancelBtnTxt("Cancel", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage cancelBtnImg(&btnOutline);
|
|
|
|
GuiImage cancelBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton cancelBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
cancelBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
cancelBtn.SetPosition(-25, -25);
|
|
|
|
cancelBtn.SetLabel(&cancelBtnTxt);
|
|
|
|
cancelBtn.SetImage(&cancelBtnImg);
|
|
|
|
cancelBtn.SetImageOver(&cancelBtnImgOver);
|
|
|
|
cancelBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
cancelBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
cancelBtn.SetTrigger(&trigA);
|
|
|
|
cancelBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
keyboard.Append(&okBtn);
|
|
|
|
keyboard.Append(&cancelBtn);
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
mainWindow->Append(&keyboard);
|
|
|
|
mainWindow->ChangeFocus(&keyboard);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(save == -1)
|
|
|
|
{
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
if(okBtn.GetState() == STATE_CLICKED)
|
|
|
|
save = 1;
|
|
|
|
else if(cancelBtn.GetState() == STATE_CLICKED)
|
|
|
|
save = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(save)
|
|
|
|
{
|
2009-04-09 09:49:28 +02:00
|
|
|
snprintf(var, maxlen, "%s", keyboard.kbtextstr);
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&keyboard);
|
|
|
|
mainWindow->SetState(STATE_DEFAULT);
|
|
|
|
ResumeGui();
|
|
|
|
}
|
|
|
|
|
2009-04-01 07:48:01 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* SettingWindow
|
|
|
|
*
|
|
|
|
* Opens a new window, with the specified window element appended. Allows
|
|
|
|
* for a customizable prompted setting.
|
|
|
|
***************************************************************************/
|
2009-03-28 18:23:08 +01:00
|
|
|
static int
|
|
|
|
SettingWindow(const char * title, GuiWindow * w)
|
|
|
|
{
|
|
|
|
int save = -1;
|
|
|
|
|
|
|
|
GuiWindow promptWindow(448,288);
|
|
|
|
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiImageData dialogBox(dialogue_box_png);
|
|
|
|
GuiImage dialogBoxImg(&dialogBox);
|
|
|
|
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiText titleTxt(title, 26, (GXColor){70, 70, 10, 255});
|
2009-03-28 18:23:08 +01:00
|
|
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(0,14);
|
|
|
|
|
|
|
|
GuiText okBtnTxt("OK", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage okBtnImg(&btnOutline);
|
|
|
|
GuiImage okBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton okBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
|
|
|
|
okBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
okBtn.SetPosition(20, -25);
|
|
|
|
|
|
|
|
okBtn.SetLabel(&okBtnTxt);
|
|
|
|
okBtn.SetImage(&okBtnImg);
|
|
|
|
okBtn.SetImageOver(&okBtnImgOver);
|
|
|
|
okBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
okBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
okBtn.SetTrigger(&trigA);
|
|
|
|
okBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText cancelBtnTxt("Cancel", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage cancelBtnImg(&btnOutline);
|
|
|
|
GuiImage cancelBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton cancelBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
cancelBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
cancelBtn.SetPosition(-20, -25);
|
|
|
|
cancelBtn.SetLabel(&cancelBtnTxt);
|
|
|
|
cancelBtn.SetImage(&cancelBtnImg);
|
|
|
|
cancelBtn.SetImageOver(&cancelBtnImgOver);
|
|
|
|
cancelBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
cancelBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
cancelBtn.SetTrigger(&trigA);
|
|
|
|
cancelBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
promptWindow.Append(&dialogBoxImg);
|
|
|
|
promptWindow.Append(&titleTxt);
|
|
|
|
promptWindow.Append(&okBtn);
|
|
|
|
promptWindow.Append(&cancelBtn);
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
mainWindow->Append(&promptWindow);
|
|
|
|
mainWindow->Append(w);
|
|
|
|
mainWindow->ChangeFocus(w);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(save == -1)
|
|
|
|
{
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
if(okBtn.GetState() == STATE_CLICKED)
|
|
|
|
save = 1;
|
|
|
|
else if(cancelBtn.GetState() == STATE_CLICKED)
|
|
|
|
save = 0;
|
|
|
|
}
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&promptWindow);
|
|
|
|
mainWindow->Remove(w);
|
|
|
|
mainWindow->SetState(STATE_DEFAULT);
|
|
|
|
ResumeGui();
|
|
|
|
return save;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* WindowCredits
|
|
|
|
* Display credits, legal copyright and licence
|
|
|
|
*
|
|
|
|
* THIS MUST NOT BE REMOVED OR DISABLED IN ANY DERIVATIVE WORK
|
|
|
|
***************************************************************************/
|
|
|
|
static void WindowCredits(void * ptr)
|
|
|
|
{
|
|
|
|
if(btnLogo->GetState() != STATE_CLICKED)
|
|
|
|
return;
|
|
|
|
|
|
|
|
btnLogo->ResetState();
|
|
|
|
|
|
|
|
bool exit = false;
|
|
|
|
int i = 0;
|
|
|
|
int y = 20;
|
|
|
|
|
|
|
|
GuiWindow creditsWindow(screenwidth,screenheight);
|
|
|
|
GuiWindow creditsWindowBox(580,448);
|
|
|
|
creditsWindowBox.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
|
|
|
|
GuiImageData creditsBox(credits_box_png);
|
|
|
|
GuiImage creditsBoxImg(&creditsBox);
|
|
|
|
creditsBoxImg.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
creditsWindowBox.Append(&creditsBoxImg);
|
|
|
|
|
2009-03-31 09:13:20 +02:00
|
|
|
int numEntries = 24;
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiText * txt[numEntries];
|
|
|
|
|
|
|
|
txt[i] = new GuiText("Credits", 30, (GXColor){0, 0, 0, 255});
|
|
|
|
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(0,y); i++; y+=32;
|
|
|
|
|
|
|
|
txt[i] = new GuiText("Official Site: http://code.google.com/p/fceugc/", 20, (GXColor){0, 0, 0, 255});
|
|
|
|
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(0,y); i++; y+=40;
|
|
|
|
|
|
|
|
txt[i]->SetPresets(22, (GXColor){0, 0, 0, 255}, 0,
|
|
|
|
FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP, ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
|
|
|
|
txt[i] = new GuiText("Coding & menu design");
|
|
|
|
txt[i]->SetPosition(50,y); i++;
|
|
|
|
txt[i] = new GuiText("Tantric");
|
|
|
|
txt[i]->SetPosition(320,y); i++; y+=24;
|
|
|
|
txt[i] = new GuiText("Menu artwork");
|
|
|
|
txt[i]->SetPosition(50,y); i++;
|
|
|
|
txt[i] = new GuiText("the3seashells");
|
|
|
|
txt[i]->SetPosition(320,y); i++; y+=24;
|
|
|
|
txt[i] = new GuiText("Menu sound");
|
|
|
|
txt[i]->SetPosition(50,y); i++;
|
|
|
|
txt[i] = new GuiText("Peter de Man");
|
2009-03-31 09:13:20 +02:00
|
|
|
txt[i]->SetPosition(320,y); i++; y+=24;
|
|
|
|
txt[i] = new GuiText("Logo");
|
|
|
|
txt[i]->SetPosition(50,y); i++;
|
|
|
|
txt[i] = new GuiText("mvit");
|
2009-03-28 18:23:08 +01:00
|
|
|
txt[i]->SetPosition(320,y); i++; y+=48;
|
|
|
|
|
|
|
|
txt[i] = new GuiText("FCE Ultra GX GameCube");
|
|
|
|
txt[i]->SetPosition(50,y); i++;
|
|
|
|
txt[i] = new GuiText("SoftDev, askot,");
|
|
|
|
txt[i]->SetPosition(320,y); i++; y+=24;
|
|
|
|
txt[i] = new GuiText("dsbomb, others");
|
|
|
|
txt[i]->SetPosition(320,y); i++; y+=24;
|
|
|
|
txt[i] = new GuiText("FCE Ultra");
|
|
|
|
txt[i]->SetPosition(50,y); i++;
|
|
|
|
txt[i] = new GuiText("Xodnizel");
|
|
|
|
txt[i]->SetPosition(320,y); i++; y+=24;
|
|
|
|
txt[i] = new GuiText("Original FCE");
|
|
|
|
txt[i]->SetPosition(50,y); i++;
|
|
|
|
txt[i] = new GuiText("BERO");
|
|
|
|
txt[i]->SetPosition(320,y); i++; y+=24;
|
|
|
|
|
|
|
|
txt[i] = new GuiText("libogc / devkitPPC");
|
|
|
|
txt[i]->SetPosition(50,y); i++;
|
|
|
|
txt[i] = new GuiText("shagkur & wintermute");
|
|
|
|
txt[i]->SetPosition(320,y); i++; y+=24;
|
|
|
|
txt[i] = new GuiText("FreeTypeGX");
|
|
|
|
txt[i]->SetPosition(50,y); i++;
|
|
|
|
txt[i] = new GuiText("Armin Tamzarian");
|
|
|
|
txt[i]->SetPosition(320,y); i++; y+=48;
|
|
|
|
|
|
|
|
txt[i]->SetPresets(18, (GXColor){0, 0, 0, 255}, 0,
|
|
|
|
FTGX_JUSTIFY_CENTER | FTGX_ALIGN_TOP, ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
|
|
|
|
txt[i] = new GuiText("This software is open source and may be copied,");
|
|
|
|
txt[i]->SetPosition(0,y); i++; y+=20;
|
|
|
|
txt[i] = new GuiText("distributed, or modified under the terms of the");
|
|
|
|
txt[i]->SetPosition(0,y); i++; y+=20;
|
|
|
|
txt[i] = new GuiText("GNU General Public License (GPL) Version 2.");
|
|
|
|
txt[i]->SetPosition(0,y); i++; y+=20;
|
|
|
|
|
|
|
|
for(i=0; i < numEntries; i++)
|
|
|
|
creditsWindowBox.Append(txt[i]);
|
|
|
|
|
|
|
|
creditsWindow.Append(&creditsWindowBox);
|
|
|
|
|
|
|
|
while(!exit)
|
|
|
|
{
|
2009-10-12 21:24:54 +02:00
|
|
|
UpdatePads();
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
if(gameScreenImg)
|
|
|
|
gameScreenImg->Draw();
|
|
|
|
else
|
|
|
|
bgImg->Draw();
|
|
|
|
|
|
|
|
bgBottomImg->Draw();
|
|
|
|
bgTopImg->Draw();
|
|
|
|
creditsWindow.Draw();
|
|
|
|
|
2010-01-25 08:33:35 +01:00
|
|
|
#ifdef HW_RVL
|
|
|
|
i = 3;
|
|
|
|
do {
|
|
|
|
if(userInput[i].wpad->ir.valid)
|
|
|
|
Menu_DrawImg(userInput[i].wpad->ir.x-48, userInput[i].wpad->ir.y-48,
|
|
|
|
96, 96, pointer[i]->GetImage(), userInput[i].wpad->ir.angle, 1, 1, 255);
|
2009-03-28 18:23:08 +01:00
|
|
|
DoRumble(i);
|
2010-01-25 08:33:35 +01:00
|
|
|
--i;
|
|
|
|
} while(i >= 0);
|
|
|
|
#endif
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
Menu_Render();
|
|
|
|
|
2010-01-25 08:33:35 +01:00
|
|
|
if((userInput[0].wpad->btns_d || userInput[0].pad.btns_d) ||
|
|
|
|
(userInput[1].wpad->btns_d || userInput[1].pad.btns_d) ||
|
|
|
|
(userInput[2].wpad->btns_d || userInput[2].pad.btns_d) ||
|
|
|
|
(userInput[3].wpad->btns_d || userInput[3].pad.btns_d))
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
2010-01-25 08:33:35 +01:00
|
|
|
exit = true;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// clear buttons pressed
|
|
|
|
for(i=0; i < 4; i++)
|
|
|
|
{
|
2009-10-13 02:40:02 +02:00
|
|
|
userInput[i].wpad->btns_d = 0;
|
2009-03-28 18:23:08 +01:00
|
|
|
userInput[i].pad.btns_d = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i=0; i < numEntries; i++)
|
|
|
|
delete txt[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* MenuGameSelection
|
2009-04-01 07:48:01 +02:00
|
|
|
*
|
|
|
|
* Displays a list of games on the specified load device, and allows the user
|
|
|
|
* to browse and select from this list.
|
2009-03-28 18:23:08 +01:00
|
|
|
***************************************************************************/
|
|
|
|
static int MenuGameSelection()
|
|
|
|
{
|
|
|
|
int menu = MENU_NONE;
|
2009-06-02 08:47:03 +02:00
|
|
|
int i;
|
|
|
|
bool res;
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
GuiText titleTxt("Choose Game", 28, (GXColor){255, 255, 255, 255});
|
|
|
|
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(50,50);
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData iconHome(icon_home_png);
|
|
|
|
GuiImageData iconSettings(icon_settings_png);
|
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
GuiTrigger trigHome;
|
|
|
|
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
|
|
|
|
|
|
|
|
GuiText settingsBtnTxt("Settings", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage settingsBtnIcon(&iconSettings);
|
|
|
|
settingsBtnIcon.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
settingsBtnIcon.SetPosition(20,0);
|
|
|
|
GuiImage settingsBtnImg(&btnOutline);
|
|
|
|
GuiImage settingsBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton settingsBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
settingsBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
settingsBtn.SetPosition(100, -35);
|
|
|
|
settingsBtn.SetLabel(&settingsBtnTxt);
|
|
|
|
settingsBtn.SetIcon(&settingsBtnIcon);
|
|
|
|
settingsBtn.SetImage(&settingsBtnImg);
|
|
|
|
settingsBtn.SetImageOver(&settingsBtnImgOver);
|
|
|
|
settingsBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
settingsBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
settingsBtn.SetTrigger(&trigA);
|
|
|
|
settingsBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText exitBtnTxt("Exit", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage exitBtnIcon(&iconHome);
|
|
|
|
exitBtnIcon.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
exitBtnIcon.SetPosition(20,0);
|
|
|
|
GuiImage exitBtnImg(&btnOutline);
|
|
|
|
GuiImage exitBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton exitBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
exitBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
exitBtn.SetPosition(-100, -35);
|
|
|
|
exitBtn.SetLabel(&exitBtnTxt);
|
|
|
|
exitBtn.SetIcon(&exitBtnIcon);
|
|
|
|
exitBtn.SetImage(&exitBtnImg);
|
|
|
|
exitBtn.SetImageOver(&exitBtnImgOver);
|
|
|
|
exitBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
exitBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
exitBtn.SetTrigger(&trigA);
|
|
|
|
exitBtn.SetTrigger(&trigHome);
|
|
|
|
exitBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiWindow buttonWindow(screenwidth, screenheight);
|
|
|
|
buttonWindow.Append(&settingsBtn);
|
|
|
|
buttonWindow.Append(&exitBtn);
|
|
|
|
|
2009-06-18 07:48:32 +02:00
|
|
|
GuiFileBrowser gameBrowser(424, 268);
|
|
|
|
gameBrowser.SetPosition(50, 98);
|
2009-05-30 08:28:00 +02:00
|
|
|
ResetBrowser();
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
btnLogo->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
2009-04-22 20:15:36 +02:00
|
|
|
btnLogo->SetPosition(-50, 24);
|
2009-03-28 18:23:08 +01:00
|
|
|
mainWindow->Append(&titleTxt);
|
|
|
|
mainWindow->Append(&gameBrowser);
|
|
|
|
mainWindow->Append(&buttonWindow);
|
|
|
|
ResumeGui();
|
|
|
|
|
2009-05-30 08:28:00 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
ShutoffRumble();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// populate initial directory listing
|
2009-12-23 01:26:54 +01:00
|
|
|
selectLoadedFile = 1;
|
2009-10-02 00:21:25 +02:00
|
|
|
OpenGameList();
|
2009-10-27 07:01:20 +01:00
|
|
|
|
2009-10-02 00:21:25 +02:00
|
|
|
gameBrowser.ResetState();
|
|
|
|
gameBrowser.fileList[0]->SetState(STATE_SELECTED);
|
|
|
|
gameBrowser.TriggerUpdate();
|
2009-05-30 08:28:00 +02:00
|
|
|
|
2009-10-02 00:21:25 +02:00
|
|
|
while(menu == MENU_NONE)
|
2009-05-30 08:28:00 +02:00
|
|
|
{
|
2009-10-02 00:21:25 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-12-23 01:26:54 +01:00
|
|
|
if(selectLoadedFile == 2)
|
|
|
|
{
|
|
|
|
selectLoadedFile = 0;
|
|
|
|
mainWindow->ChangeFocus(&gameBrowser);
|
|
|
|
gameBrowser.TriggerUpdate();
|
|
|
|
}
|
|
|
|
|
2009-10-02 00:21:25 +02:00
|
|
|
// update gameWindow based on arrow buttons
|
|
|
|
// set MENU_EXIT if A button pressed on a game
|
|
|
|
for(i=0; i < FILE_PAGESIZE; i++)
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
2009-10-02 00:21:25 +02:00
|
|
|
if(gameBrowser.fileList[i]->GetState() == STATE_CLICKED)
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
2009-10-02 00:21:25 +02:00
|
|
|
gameBrowser.fileList[i]->ResetState();
|
|
|
|
// check corresponding browser entry
|
|
|
|
if(browserList[browser.selIndex].isdir || IsSz())
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
2009-10-02 00:21:25 +02:00
|
|
|
if(IsSz())
|
|
|
|
res = BrowserLoadSz();
|
|
|
|
else
|
|
|
|
res = BrowserChangeFolder();
|
|
|
|
|
|
|
|
if(res)
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
2009-10-02 00:21:25 +02:00
|
|
|
gameBrowser.ResetState();
|
|
|
|
gameBrowser.fileList[0]->SetState(STATE_SELECTED);
|
|
|
|
gameBrowser.TriggerUpdate();
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-10-02 00:21:25 +02:00
|
|
|
menu = MENU_GAMESELECTION;
|
|
|
|
break;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
}
|
2009-10-02 00:21:25 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
#ifdef HW_RVL
|
|
|
|
ShutoffRumble();
|
|
|
|
#endif
|
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
if(BrowserLoadFile())
|
|
|
|
menu = MENU_EXIT;
|
|
|
|
else
|
|
|
|
mainWindow->SetState(STATE_DEFAULT);
|
|
|
|
}
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
2009-05-30 08:28:00 +02:00
|
|
|
}
|
2009-10-02 00:21:25 +02:00
|
|
|
|
|
|
|
if(settingsBtn.GetState() == STATE_CLICKED)
|
|
|
|
menu = MENU_SETTINGS;
|
|
|
|
else if(exitBtn.GetState() == STATE_CLICKED)
|
|
|
|
ExitRequested = 1;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
2009-10-02 00:21:25 +02:00
|
|
|
|
2009-10-06 08:38:32 +02:00
|
|
|
HaltParseThread(); // halt parsing
|
2009-03-28 18:23:08 +01:00
|
|
|
HaltGui();
|
2009-10-27 07:01:20 +01:00
|
|
|
ResetBrowser();
|
2009-03-28 18:23:08 +01:00
|
|
|
mainWindow->Remove(&titleTxt);
|
|
|
|
mainWindow->Remove(&buttonWindow);
|
|
|
|
mainWindow->Remove(&gameBrowser);
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
2009-04-01 07:48:01 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* ControllerWindowUpdate
|
|
|
|
*
|
|
|
|
* Callback for controller window. Responds to clicks on window elements.
|
|
|
|
***************************************************************************/
|
2009-03-28 18:23:08 +01:00
|
|
|
static void ControllerWindowUpdate(void * ptr, int dir)
|
|
|
|
{
|
|
|
|
GuiButton * b = (GuiButton *)ptr;
|
|
|
|
if(b->GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
GCSettings.Controller += dir;
|
|
|
|
|
2009-03-28 20:33:14 +01:00
|
|
|
if(GCSettings.Controller > CTRL_PAD4)
|
|
|
|
GCSettings.Controller = CTRL_ZAPPER;
|
|
|
|
else if(GCSettings.Controller < CTRL_ZAPPER)
|
|
|
|
GCSettings.Controller = CTRL_PAD4;
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
settingText->SetText(ctrlName[GCSettings.Controller]);
|
|
|
|
b->ResetState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-01 07:48:01 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* ControllerWindowLeftClick / ControllerWindowRightsClick
|
|
|
|
*
|
|
|
|
* Callbacks for controller window arrows. Responds arrow clicks.
|
|
|
|
***************************************************************************/
|
2009-03-28 18:23:08 +01:00
|
|
|
static void ControllerWindowLeftClick(void * ptr) { ControllerWindowUpdate(ptr, -1); }
|
|
|
|
static void ControllerWindowRightClick(void * ptr) { ControllerWindowUpdate(ptr, +1); }
|
|
|
|
|
2009-04-01 07:48:01 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* ControllerWindow
|
|
|
|
*
|
|
|
|
* Opens a window to allow the user to select the controller to be used.
|
|
|
|
***************************************************************************/
|
2009-03-28 18:23:08 +01:00
|
|
|
static void ControllerWindow()
|
|
|
|
{
|
2009-03-28 20:33:14 +01:00
|
|
|
GuiWindow * w = new GuiWindow(300,250);
|
2009-03-28 18:23:08 +01:00
|
|
|
w->SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiTrigger trigLeft;
|
|
|
|
trigLeft.SetButtonOnlyInFocusTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
|
|
|
|
|
|
|
|
GuiTrigger trigRight;
|
|
|
|
trigRight.SetButtonOnlyInFocusTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
|
|
|
|
|
|
|
|
GuiImageData arrowLeft(button_arrow_left_png);
|
|
|
|
GuiImage arrowLeftImg(&arrowLeft);
|
|
|
|
GuiImageData arrowLeftOver(button_arrow_left_over_png);
|
|
|
|
GuiImage arrowLeftOverImg(&arrowLeftOver);
|
|
|
|
GuiButton arrowLeftBtn(arrowLeft.GetWidth(), arrowLeft.GetHeight());
|
|
|
|
arrowLeftBtn.SetImage(&arrowLeftImg);
|
|
|
|
arrowLeftBtn.SetImageOver(&arrowLeftOverImg);
|
|
|
|
arrowLeftBtn.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
arrowLeftBtn.SetTrigger(0, &trigA);
|
|
|
|
arrowLeftBtn.SetTrigger(1, &trigLeft);
|
|
|
|
arrowLeftBtn.SetSelectable(false);
|
|
|
|
arrowLeftBtn.SetUpdateCallback(ControllerWindowLeftClick);
|
|
|
|
|
|
|
|
GuiImageData arrowRight(button_arrow_right_png);
|
|
|
|
GuiImage arrowRightImg(&arrowRight);
|
|
|
|
GuiImageData arrowRightOver(button_arrow_right_over_png);
|
|
|
|
GuiImage arrowRightOverImg(&arrowRightOver);
|
|
|
|
GuiButton arrowRightBtn(arrowRight.GetWidth(), arrowRight.GetHeight());
|
|
|
|
arrowRightBtn.SetImage(&arrowRightImg);
|
|
|
|
arrowRightBtn.SetImageOver(&arrowRightOverImg);
|
|
|
|
arrowRightBtn.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
|
|
|
arrowRightBtn.SetTrigger(0, &trigA);
|
|
|
|
arrowRightBtn.SetTrigger(1, &trigRight);
|
|
|
|
arrowRightBtn.SetSelectable(false);
|
|
|
|
arrowRightBtn.SetUpdateCallback(ControllerWindowRightClick);
|
|
|
|
|
|
|
|
settingText = new GuiText(ctrlName[GCSettings.Controller], 24, (GXColor){0, 0, 0, 255});
|
|
|
|
|
|
|
|
int currentController = GCSettings.Controller;
|
|
|
|
|
|
|
|
w->Append(&arrowLeftBtn);
|
|
|
|
w->Append(&arrowRightBtn);
|
|
|
|
w->Append(settingText);
|
|
|
|
|
|
|
|
if(!SettingWindow("Controller",w))
|
|
|
|
GCSettings.Controller = currentController; // undo changes
|
|
|
|
|
|
|
|
delete(w);
|
|
|
|
delete(settingText);
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* MenuGame
|
2009-04-01 07:48:01 +02:00
|
|
|
*
|
|
|
|
* Menu displayed when returning to the menu from in-game.
|
2009-03-28 18:23:08 +01:00
|
|
|
***************************************************************************/
|
|
|
|
static int MenuGame()
|
|
|
|
{
|
|
|
|
int menu = MENU_NONE;
|
|
|
|
|
|
|
|
GuiText titleTxt((char *)romFilename, 24, (GXColor){255, 255, 255, 255});
|
|
|
|
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(50,50);
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiImageData btnCloseOutline(button_small_png);
|
|
|
|
GuiImageData btnCloseOutlineOver(button_small_over_png);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnLargeOutline(button_large_png);
|
|
|
|
GuiImageData btnLargeOutlineOver(button_large_over_png);
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiImageData iconGameSettings(icon_game_settings_png);
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiImageData iconLoad(icon_game_load_png);
|
|
|
|
GuiImageData iconSave(icon_game_save_png);
|
|
|
|
GuiImageData iconReset(icon_game_reset_png);
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData battery(battery_png);
|
|
|
|
GuiImageData batteryRed(battery_red_png);
|
|
|
|
GuiImageData batteryBar(battery_bar_png);
|
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiTrigger trigHome;
|
|
|
|
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
|
|
|
|
|
|
|
|
GuiText saveBtnTxt("Save", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage saveBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage saveBtnImgOver(&btnLargeOutlineOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiImage saveBtnIcon(&iconSave);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiButton saveBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
2009-03-28 19:26:47 +01:00
|
|
|
saveBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
saveBtn.SetPosition(-125, 120);
|
2009-03-28 18:23:08 +01:00
|
|
|
saveBtn.SetLabel(&saveBtnTxt);
|
|
|
|
saveBtn.SetImage(&saveBtnImg);
|
|
|
|
saveBtn.SetImageOver(&saveBtnImgOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
saveBtn.SetIcon(&saveBtnIcon);
|
2009-03-28 18:23:08 +01:00
|
|
|
saveBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
saveBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
saveBtn.SetTrigger(&trigA);
|
|
|
|
saveBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText loadBtnTxt("Load", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage loadBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage loadBtnImgOver(&btnLargeOutlineOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiImage loadBtnIcon(&iconLoad);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiButton loadBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
|
|
|
loadBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-03-28 19:26:47 +01:00
|
|
|
loadBtn.SetPosition(125, 120);
|
2009-03-28 18:23:08 +01:00
|
|
|
loadBtn.SetLabel(&loadBtnTxt);
|
|
|
|
loadBtn.SetImage(&loadBtnImg);
|
|
|
|
loadBtn.SetImageOver(&loadBtnImgOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
loadBtn.SetIcon(&loadBtnIcon);
|
2009-03-28 18:23:08 +01:00
|
|
|
loadBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
loadBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
loadBtn.SetTrigger(&trigA);
|
|
|
|
loadBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText resetBtnTxt("Reset", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage resetBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage resetBtnImgOver(&btnLargeOutlineOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiImage resetBtnIcon(&iconReset);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiButton resetBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
2009-03-28 19:26:47 +01:00
|
|
|
resetBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-04-01 10:02:59 +02:00
|
|
|
resetBtn.SetPosition(125, 250);
|
2009-03-28 18:23:08 +01:00
|
|
|
resetBtn.SetLabel(&resetBtnTxt);
|
|
|
|
resetBtn.SetImage(&resetBtnImg);
|
|
|
|
resetBtn.SetImageOver(&resetBtnImgOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
resetBtn.SetIcon(&resetBtnIcon);
|
2009-03-28 18:23:08 +01:00
|
|
|
resetBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
resetBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
resetBtn.SetTrigger(&trigA);
|
|
|
|
resetBtn.SetEffectGrow();
|
|
|
|
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiText gameSettingsBtnTxt("Game Settings", 24, (GXColor){0, 0, 0, 255});
|
2009-06-27 21:12:47 +02:00
|
|
|
gameSettingsBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-30);
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiImage gameSettingsBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage gameSettingsBtnImgOver(&btnLargeOutlineOver);
|
|
|
|
GuiImage gameSettingsBtnIcon(&iconGameSettings);
|
|
|
|
GuiButton gameSettingsBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
|
|
|
gameSettingsBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
gameSettingsBtn.SetPosition(-125, 250);
|
|
|
|
gameSettingsBtn.SetLabel(&gameSettingsBtnTxt);
|
|
|
|
gameSettingsBtn.SetImage(&gameSettingsBtnImg);
|
|
|
|
gameSettingsBtn.SetImageOver(&gameSettingsBtnImgOver);
|
|
|
|
gameSettingsBtn.SetIcon(&gameSettingsBtnIcon);
|
|
|
|
gameSettingsBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
gameSettingsBtn.SetSoundClick(&btnSoundClick);
|
|
|
|
gameSettingsBtn.SetTrigger(&trigA);
|
|
|
|
gameSettingsBtn.SetEffectGrow();
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
GuiText mainmenuBtnTxt("Main Menu", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage mainmenuBtnImg(&btnOutline);
|
|
|
|
GuiImage mainmenuBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton mainmenuBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
mainmenuBtn.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
mainmenuBtn.SetPosition(0, -35);
|
|
|
|
mainmenuBtn.SetLabel(&mainmenuBtnTxt);
|
|
|
|
mainmenuBtn.SetImage(&mainmenuBtnImg);
|
|
|
|
mainmenuBtn.SetImageOver(&mainmenuBtnImgOver);
|
|
|
|
mainmenuBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
mainmenuBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
mainmenuBtn.SetTrigger(&trigA);
|
|
|
|
mainmenuBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText closeBtnTxt("Close", 22, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage closeBtnImg(&btnCloseOutline);
|
|
|
|
GuiImage closeBtnImgOver(&btnCloseOutlineOver);
|
|
|
|
GuiButton closeBtn(btnCloseOutline.GetWidth(), btnCloseOutline.GetHeight());
|
|
|
|
closeBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
2009-04-22 20:15:36 +02:00
|
|
|
closeBtn.SetPosition(-50, 35);
|
2009-03-28 18:23:08 +01:00
|
|
|
closeBtn.SetLabel(&closeBtnTxt);
|
|
|
|
closeBtn.SetImage(&closeBtnImg);
|
|
|
|
closeBtn.SetImageOver(&closeBtnImgOver);
|
|
|
|
closeBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
closeBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
closeBtn.SetTrigger(&trigA);
|
|
|
|
closeBtn.SetTrigger(&trigHome);
|
|
|
|
closeBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
#ifdef HW_RVL
|
2009-06-17 09:45:46 +02:00
|
|
|
int i;
|
2009-03-28 18:23:08 +01:00
|
|
|
char txt[3];
|
2009-06-17 09:45:46 +02:00
|
|
|
bool status[4] = { false, false, false, false };
|
|
|
|
int level[4] = { 0, 0, 0, 0 };
|
|
|
|
bool newStatus;
|
|
|
|
int newLevel;
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiText * batteryTxt[4];
|
|
|
|
GuiImage * batteryImg[4];
|
|
|
|
GuiImage * batteryBarImg[4];
|
|
|
|
GuiButton * batteryBtn[4];
|
|
|
|
|
|
|
|
for(i=0; i < 4; i++)
|
|
|
|
{
|
|
|
|
if(i == 0)
|
|
|
|
sprintf(txt, "P %d", i+1);
|
|
|
|
else
|
|
|
|
sprintf(txt, "P%d", i+1);
|
|
|
|
|
|
|
|
batteryTxt[i] = new GuiText(txt, 22, (GXColor){255, 255, 255, 255});
|
|
|
|
batteryTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
batteryImg[i] = new GuiImage(&battery);
|
|
|
|
batteryImg[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
batteryImg[i]->SetPosition(30, 0);
|
|
|
|
batteryBarImg[i] = new GuiImage(&batteryBar);
|
|
|
|
batteryBarImg[i]->SetTile(0);
|
|
|
|
batteryBarImg[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
batteryBarImg[i]->SetPosition(34, 0);
|
|
|
|
|
|
|
|
batteryBtn[i] = new GuiButton(70, 20);
|
|
|
|
batteryBtn[i]->SetLabel(batteryTxt[i]);
|
|
|
|
batteryBtn[i]->SetImage(batteryImg[i]);
|
|
|
|
batteryBtn[i]->SetIcon(batteryBarImg[i]);
|
|
|
|
batteryBtn[i]->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
batteryBtn[i]->SetRumble(false);
|
2009-09-15 09:19:09 +02:00
|
|
|
batteryBtn[i]->SetSelectable(false);
|
2009-03-28 18:23:08 +01:00
|
|
|
batteryBtn[i]->SetAlpha(150);
|
|
|
|
}
|
|
|
|
|
|
|
|
batteryBtn[0]->SetPosition(45, -65);
|
|
|
|
batteryBtn[1]->SetPosition(135, -65);
|
|
|
|
batteryBtn[2]->SetPosition(45, -40);
|
|
|
|
batteryBtn[3]->SetPosition(135, -40);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
w.Append(&titleTxt);
|
|
|
|
w.Append(&saveBtn);
|
|
|
|
w.Append(&loadBtn);
|
|
|
|
w.Append(&resetBtn);
|
2009-04-13 21:48:24 +02:00
|
|
|
w.Append(&gameSettingsBtn);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
#ifdef HW_RVL
|
|
|
|
w.Append(batteryBtn[0]);
|
|
|
|
w.Append(batteryBtn[1]);
|
|
|
|
w.Append(batteryBtn[2]);
|
|
|
|
w.Append(batteryBtn[3]);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
w.Append(&mainmenuBtn);
|
|
|
|
w.Append(&closeBtn);
|
|
|
|
|
|
|
|
btnLogo->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
2009-04-22 20:15:36 +02:00
|
|
|
btnLogo->SetPosition(-50, -40);
|
2009-03-28 18:23:08 +01:00
|
|
|
mainWindow->Append(&w);
|
|
|
|
|
|
|
|
if(lastMenu == MENU_NONE)
|
|
|
|
{
|
2009-04-05 05:11:38 +02:00
|
|
|
enterSound->Play();
|
2009-03-28 18:23:08 +01:00
|
|
|
bgTopImg->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 35);
|
|
|
|
closeBtn.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 35);
|
|
|
|
titleTxt.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 35);
|
|
|
|
mainmenuBtn.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 35);
|
|
|
|
bgBottomImg->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 35);
|
|
|
|
btnLogo->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 35);
|
|
|
|
#ifdef HW_RVL
|
|
|
|
batteryBtn[0]->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 35);
|
|
|
|
batteryBtn[1]->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 35);
|
|
|
|
batteryBtn[2]->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 35);
|
|
|
|
batteryBtn[3]->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 35);
|
|
|
|
#endif
|
|
|
|
|
2009-04-13 21:48:24 +02:00
|
|
|
w.SetEffect(EFFECT_FADE, 15);
|
2009-03-28 18:23:08 +01:00
|
|
|
AutoSave();
|
|
|
|
}
|
|
|
|
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
|
|
|
{
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
#ifdef HW_RVL
|
|
|
|
for(i=0; i < 4; i++)
|
|
|
|
{
|
2009-06-17 09:45:46 +02:00
|
|
|
if(WPAD_Probe(i, NULL) == WPAD_ERR_NONE)
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
2009-06-17 09:45:46 +02:00
|
|
|
newStatus = true;
|
2010-01-25 08:33:35 +01:00
|
|
|
newLevel = int(userInput[i].wpad->battery_level / 100.0) << 2;
|
2009-06-17 09:45:46 +02:00
|
|
|
if(newLevel > 4) newLevel = 4;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
2009-06-17 09:45:46 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
newStatus = false;
|
|
|
|
newLevel = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(status[i] != newStatus || level[i] != newLevel)
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
2009-06-17 09:45:46 +02:00
|
|
|
if(newStatus == true) // controller connected
|
|
|
|
{
|
|
|
|
batteryBtn[i]->SetAlpha(255);
|
|
|
|
batteryBarImg[i]->SetTile(newLevel);
|
|
|
|
|
|
|
|
if(newLevel == 0)
|
|
|
|
batteryImg[i]->SetImage(&batteryRed);
|
|
|
|
else
|
|
|
|
batteryImg[i]->SetImage(&battery);
|
|
|
|
}
|
|
|
|
else // controller not connected
|
|
|
|
{
|
|
|
|
batteryBtn[i]->SetAlpha(150);
|
|
|
|
batteryBarImg[i]->SetTile(0);
|
|
|
|
batteryImg[i]->SetImage(&battery);
|
|
|
|
}
|
|
|
|
status[i] = newStatus;
|
|
|
|
level[i] = newLevel;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if(saveBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_GAME_SAVE;
|
|
|
|
}
|
|
|
|
else if(loadBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_GAME_LOAD;
|
|
|
|
}
|
|
|
|
else if(resetBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-04-27 08:59:03 +02:00
|
|
|
if (WindowPrompt("Reset Game", "Are you sure that you want to reset this game? Any unsaved progress will be lost.", "OK", "Cancel"))
|
|
|
|
{
|
|
|
|
PowerNES();
|
|
|
|
menu = MENU_EXIT;
|
|
|
|
}
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
2009-04-13 21:48:24 +02:00
|
|
|
else if(gameSettingsBtn.GetState() == STATE_CLICKED)
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
2009-04-13 21:48:24 +02:00
|
|
|
menu = MENU_GAMESETTINGS;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
else if(mainmenuBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-04-27 08:59:03 +02:00
|
|
|
if (WindowPrompt("Quit Game", "Quit this game? Any unsaved progress will be lost.", "OK", "Cancel"))
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
2009-04-27 08:59:03 +02:00
|
|
|
if(gameScreenImg)
|
|
|
|
{
|
|
|
|
mainWindow->Remove(gameScreenImg);
|
|
|
|
delete gameScreenImg;
|
|
|
|
gameScreenImg = NULL;
|
|
|
|
}
|
|
|
|
if(gameScreenTex)
|
|
|
|
{
|
|
|
|
free(gameScreenTex);
|
|
|
|
gameScreenTex = NULL;
|
|
|
|
}
|
|
|
|
bgImg->SetVisible(true);
|
|
|
|
#ifndef NO_SOUND
|
|
|
|
bgMusic->Play(); // startup music
|
|
|
|
#endif
|
|
|
|
menu = MENU_GAMESELECTION;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(closeBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_EXIT;
|
|
|
|
|
2009-04-05 05:11:38 +02:00
|
|
|
exitSound->Play();
|
2009-04-19 09:34:07 +02:00
|
|
|
bgTopImg->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 15);
|
|
|
|
closeBtn.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 15);
|
|
|
|
titleTxt.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 15);
|
|
|
|
mainmenuBtn.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 15);
|
|
|
|
bgBottomImg->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 15);
|
|
|
|
btnLogo->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 15);
|
2009-03-28 18:23:08 +01:00
|
|
|
#ifdef HW_RVL
|
2009-04-19 09:34:07 +02:00
|
|
|
batteryBtn[0]->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 15);
|
|
|
|
batteryBtn[1]->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 15);
|
|
|
|
batteryBtn[2]->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 15);
|
|
|
|
batteryBtn[3]->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 15);
|
2009-03-28 18:23:08 +01:00
|
|
|
#endif
|
|
|
|
|
2009-04-19 09:34:07 +02:00
|
|
|
w.SetEffect(EFFECT_FADE, -15);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-04-19 09:34:07 +02:00
|
|
|
usleep(350000); // wait for effects to finish
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
|
|
|
|
#ifdef HW_RVL
|
|
|
|
for(i=0; i < 4; i++)
|
|
|
|
{
|
|
|
|
delete batteryTxt[i];
|
|
|
|
delete batteryImg[i];
|
|
|
|
delete batteryBarImg[i];
|
|
|
|
delete batteryBtn[i];
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
2009-06-28 09:06:14 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* FindGameSaveNum
|
|
|
|
*
|
|
|
|
* Determines the save file number of the given file name
|
|
|
|
* Returns -1 if none is found
|
|
|
|
***************************************************************************/
|
|
|
|
static int FindGameSaveNum(char * savefile, int method)
|
|
|
|
{
|
|
|
|
int n = -1;
|
|
|
|
int romlen = strlen(romFilename);
|
|
|
|
int savelen = strlen(savefile);
|
|
|
|
|
|
|
|
int diff = savelen-romlen;
|
|
|
|
|
|
|
|
if(strncmp(savefile, romFilename, romlen) != 0)
|
|
|
|
return -1;
|
|
|
|
|
2009-11-29 08:55:21 +01:00
|
|
|
if(savefile[romlen] == ' ')
|
2009-06-28 09:06:14 +02:00
|
|
|
{
|
2009-06-29 08:54:27 +02:00
|
|
|
if(diff == 5 && strncmp(&savefile[romlen+1], "Auto", 4) == 0)
|
2009-06-28 09:06:14 +02:00
|
|
|
n = 0; // found Auto save
|
|
|
|
else if(diff == 2 || diff == 3)
|
|
|
|
n = atoi(&savefile[romlen+1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(n >= 0 && n < MAX_SAVES)
|
|
|
|
return n;
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* MenuGameSaves
|
2009-04-01 07:48:01 +02:00
|
|
|
*
|
|
|
|
* Allows the user to load or save progress.
|
2009-03-28 18:23:08 +01:00
|
|
|
***************************************************************************/
|
|
|
|
static int MenuGameSaves(int action)
|
|
|
|
{
|
|
|
|
int menu = MENU_NONE;
|
2009-06-02 08:47:03 +02:00
|
|
|
int ret, result;
|
2009-06-28 09:06:14 +02:00
|
|
|
int i, n, type, len, len2;
|
2009-03-28 18:23:08 +01:00
|
|
|
int j = 0;
|
|
|
|
SaveList saves;
|
|
|
|
char filepath[1024];
|
2009-04-02 08:05:59 +02:00
|
|
|
char scrfile[1024];
|
2009-06-28 09:06:14 +02:00
|
|
|
char tmp[MAXJOLIET];
|
2009-04-02 08:05:59 +02:00
|
|
|
struct stat filestat;
|
|
|
|
struct tm * timeinfo;
|
2009-03-28 18:23:08 +01:00
|
|
|
int method = GCSettings.SaveMethod;
|
|
|
|
|
2009-10-02 00:21:25 +02:00
|
|
|
if(method == DEVICE_AUTO)
|
2009-03-28 18:23:08 +01:00
|
|
|
autoSaveMethod(NOTSILENT);
|
|
|
|
|
|
|
|
if(!ChangeInterface(method, NOTSILENT))
|
|
|
|
return MENU_GAME;
|
|
|
|
|
|
|
|
GuiText titleTxt(NULL, 28, (GXColor){255, 255, 255, 255});
|
|
|
|
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(50,50);
|
|
|
|
|
|
|
|
if(action == 0)
|
|
|
|
titleTxt.SetText("Load Game");
|
|
|
|
else
|
|
|
|
titleTxt.SetText("Save Game");
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiImageData btnCloseOutline(button_small_png);
|
|
|
|
GuiImageData btnCloseOutlineOver(button_small_over_png);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiTrigger trigHome;
|
|
|
|
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
|
|
|
|
|
|
|
|
GuiText backBtnTxt("Go Back", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage backBtnImg(&btnOutline);
|
|
|
|
GuiImage backBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
2009-06-27 21:12:47 +02:00
|
|
|
backBtn.SetPosition(50, -35);
|
2009-03-28 18:23:08 +01:00
|
|
|
backBtn.SetLabel(&backBtnTxt);
|
|
|
|
backBtn.SetImage(&backBtnImg);
|
|
|
|
backBtn.SetImageOver(&backBtnImgOver);
|
|
|
|
backBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
backBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
backBtn.SetTrigger(&trigA);
|
|
|
|
backBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText closeBtnTxt("Close", 22, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage closeBtnImg(&btnCloseOutline);
|
|
|
|
GuiImage closeBtnImgOver(&btnCloseOutlineOver);
|
|
|
|
GuiButton closeBtn(btnCloseOutline.GetWidth(), btnCloseOutline.GetHeight());
|
|
|
|
closeBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
2009-04-22 20:15:36 +02:00
|
|
|
closeBtn.SetPosition(-50, 35);
|
2009-03-28 18:23:08 +01:00
|
|
|
closeBtn.SetLabel(&closeBtnTxt);
|
|
|
|
closeBtn.SetImage(&closeBtnImg);
|
|
|
|
closeBtn.SetImageOver(&closeBtnImgOver);
|
|
|
|
closeBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
closeBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
closeBtn.SetTrigger(&trigA);
|
|
|
|
closeBtn.SetTrigger(&trigHome);
|
|
|
|
closeBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
w.Append(&backBtn);
|
|
|
|
w.Append(&closeBtn);
|
|
|
|
mainWindow->Append(&w);
|
|
|
|
mainWindow->Append(&titleTxt);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
memset(&saves, 0, sizeof(saves));
|
|
|
|
|
2009-11-29 08:55:21 +01:00
|
|
|
sprintf(browser.dir, "%s%s", pathPrefix[GCSettings.SaveMethod], GCSettings.SaveFolder);
|
|
|
|
ParseDirectory(true);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-06-28 09:06:14 +02:00
|
|
|
len = strlen(romFilename);
|
|
|
|
|
|
|
|
// find matching files
|
2009-10-27 07:01:20 +01:00
|
|
|
AllocSaveBuffer();
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
for(i=0; i < browser.numEntries; i++)
|
|
|
|
{
|
|
|
|
len2 = strlen(browserList[i].filename);
|
|
|
|
|
2009-06-28 09:06:14 +02:00
|
|
|
if(len2 < 6 || len2-len < 5)
|
|
|
|
continue;
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-06-28 09:06:14 +02:00
|
|
|
if(strncmp(&browserList[i].filename[len2-4], ".sav", 4) == 0)
|
|
|
|
type = FILE_RAM;
|
|
|
|
else if(strncmp(&browserList[i].filename[len2-4], ".fcs", 4) == 0)
|
|
|
|
type = FILE_STATE;
|
|
|
|
else
|
|
|
|
continue;
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-06-28 09:06:14 +02:00
|
|
|
strncpy(tmp, browserList[i].filename, MAXJOLIET);
|
|
|
|
tmp[len2-4] = 0;
|
|
|
|
n = FindGameSaveNum(tmp, method);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-06-28 09:06:14 +02:00
|
|
|
if(n >= 0)
|
|
|
|
{
|
|
|
|
saves.type[j] = type;
|
|
|
|
saves.files[saves.type[j]][n] = 1;
|
|
|
|
strncpy(saves.filename[j], browserList[i].filename, MAXJOLIET);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-11-29 08:55:21 +01:00
|
|
|
if(saves.type[j] == FILE_STATE)
|
2009-06-28 09:06:14 +02:00
|
|
|
{
|
2009-11-29 08:55:21 +01:00
|
|
|
sprintf(scrfile, "%s%s/%s.png", pathPrefix[GCSettings.SaveMethod], GCSettings.SaveFolder, tmp);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-11-29 08:55:21 +01:00
|
|
|
memset(savebuffer, 0, SAVEBUFFERSIZE);
|
|
|
|
if(LoadFile(scrfile, SILENT))
|
|
|
|
saves.previewImg[j] = new GuiImageData(savebuffer);
|
|
|
|
FreeSaveBuffer();
|
|
|
|
}
|
|
|
|
snprintf(filepath, 1024, "%s%s/%s", pathPrefix[GCSettings.SaveMethod], GCSettings.SaveFolder, saves.filename[j]);
|
|
|
|
if (stat(filepath, &filestat) == 0)
|
|
|
|
{
|
|
|
|
timeinfo = localtime(&filestat.st_mtime);
|
|
|
|
strftime(saves.date[j], 20, "%a %b %d", timeinfo);
|
|
|
|
strftime(saves.time[j], 10, "%I:%M %p", timeinfo);
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
2009-06-28 09:06:14 +02:00
|
|
|
j++;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-27 07:01:20 +01:00
|
|
|
FreeSaveBuffer();
|
2009-03-28 18:23:08 +01:00
|
|
|
saves.length = j;
|
|
|
|
|
|
|
|
if(saves.length == 0 && action == 0)
|
|
|
|
{
|
|
|
|
InfoPrompt("No game saves found.");
|
|
|
|
menu = MENU_GAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
GuiSaveBrowser saveBrowser(552, 248, &saves, action);
|
|
|
|
saveBrowser.SetPosition(0, 108);
|
|
|
|
saveBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Append(&saveBrowser);
|
2009-05-28 09:16:15 +02:00
|
|
|
mainWindow->ChangeFocus(&saveBrowser);
|
2009-03-28 18:23:08 +01:00
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
|
|
|
{
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
ret = saveBrowser.GetClickedSave();
|
|
|
|
|
|
|
|
// load or save game
|
2009-04-15 07:56:33 +02:00
|
|
|
if(ret > -3)
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
2009-06-02 08:47:03 +02:00
|
|
|
result = 0;
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
if(action == 0) // load
|
|
|
|
{
|
2009-10-02 00:21:25 +02:00
|
|
|
MakeFilePath(filepath, saves.type[ret], saves.filename[ret]);
|
2009-03-28 18:23:08 +01:00
|
|
|
switch(saves.type[ret])
|
|
|
|
{
|
|
|
|
case FILE_RAM:
|
2009-10-02 00:21:25 +02:00
|
|
|
result = LoadRAM(filepath, NOTSILENT);
|
2009-03-28 18:23:08 +01:00
|
|
|
break;
|
|
|
|
case FILE_STATE:
|
2009-10-02 00:21:25 +02:00
|
|
|
result = LoadState(filepath, NOTSILENT);
|
2009-03-28 18:23:08 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if(result)
|
|
|
|
menu = MENU_EXIT;
|
|
|
|
}
|
|
|
|
else // save
|
|
|
|
{
|
2009-04-15 07:56:33 +02:00
|
|
|
if(ret == -2) // new RAM
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
|
|
|
for(i=1; i < 100; i++)
|
|
|
|
if(saves.files[FILE_RAM][i] == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if(i < 100)
|
|
|
|
{
|
2009-10-02 00:21:25 +02:00
|
|
|
MakeFilePath(filepath, FILE_RAM, romFilename, i);
|
|
|
|
SaveRAM(filepath, NOTSILENT);
|
2009-03-28 18:23:08 +01:00
|
|
|
menu = MENU_GAME_SAVE;
|
|
|
|
}
|
|
|
|
}
|
2009-04-15 07:56:33 +02:00
|
|
|
else if(ret == -1) // new State
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
|
|
|
for(i=1; i < 100; i++)
|
|
|
|
if(saves.files[FILE_STATE][i] == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if(i < 100)
|
|
|
|
{
|
2009-10-02 00:21:25 +02:00
|
|
|
MakeFilePath(filepath, FILE_STATE, romFilename, i);
|
|
|
|
SaveState(filepath, NOTSILENT);
|
2009-03-28 18:23:08 +01:00
|
|
|
menu = MENU_GAME_SAVE;
|
|
|
|
}
|
|
|
|
}
|
2009-04-01 10:02:59 +02:00
|
|
|
else // overwrite RAM/State
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
2009-10-02 00:21:25 +02:00
|
|
|
MakeFilePath(filepath, saves.type[ret], saves.filename[ret]);
|
2009-04-15 07:56:33 +02:00
|
|
|
switch(saves.type[ret])
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
|
|
|
case FILE_RAM:
|
2009-10-02 00:21:25 +02:00
|
|
|
SaveRAM(filepath, NOTSILENT);
|
2009-03-28 18:23:08 +01:00
|
|
|
break;
|
|
|
|
case FILE_STATE:
|
2009-10-02 00:21:25 +02:00
|
|
|
SaveState(filepath, NOTSILENT);
|
2009-03-28 18:23:08 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
menu = MENU_GAME_SAVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(backBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_GAME;
|
|
|
|
}
|
|
|
|
else if(closeBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_EXIT;
|
|
|
|
|
2009-04-05 05:11:38 +02:00
|
|
|
exitSound->Play();
|
2009-04-19 09:34:07 +02:00
|
|
|
bgTopImg->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 15);
|
|
|
|
closeBtn.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 15);
|
|
|
|
titleTxt.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 15);
|
|
|
|
backBtn.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 15);
|
|
|
|
bgBottomImg->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 15);
|
|
|
|
btnLogo->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 15);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-04-19 09:34:07 +02:00
|
|
|
w.SetEffect(EFFECT_FADE, -15);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-04-19 09:34:07 +02:00
|
|
|
usleep(350000); // wait for effects to finish
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
|
|
|
|
for(i=0; i < saves.length; i++)
|
|
|
|
if(saves.previewImg[i])
|
|
|
|
delete saves.previewImg[i];
|
|
|
|
|
|
|
|
mainWindow->Remove(&saveBrowser);
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
mainWindow->Remove(&titleTxt);
|
2009-10-27 07:01:20 +01:00
|
|
|
ResetBrowser();
|
2009-03-28 18:23:08 +01:00
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2009-04-13 21:48:24 +02:00
|
|
|
* MenuGameSettings
|
2009-03-28 18:23:08 +01:00
|
|
|
***************************************************************************/
|
2009-04-13 21:48:24 +02:00
|
|
|
static int MenuGameSettings()
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
|
|
|
int menu = MENU_NONE;
|
|
|
|
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiText titleTxt("Game Settings", 28, (GXColor){255, 255, 255, 255});
|
2009-03-28 18:23:08 +01:00
|
|
|
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(50,50);
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiImageData btnLargeOutline(button_large_png);
|
|
|
|
GuiImageData btnLargeOutlineOver(button_large_over_png);
|
|
|
|
GuiImageData iconMappings(icon_settings_mappings_png);
|
|
|
|
GuiImageData iconVideo(icon_settings_video_png);
|
|
|
|
GuiImageData iconController(icon_game_controllers_png);
|
|
|
|
GuiImageData iconCheats(icon_game_cheats_png);
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiImageData btnCloseOutline(button_small_png);
|
|
|
|
GuiImageData btnCloseOutlineOver(button_small_over_png);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiTrigger trigHome;
|
|
|
|
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
|
|
|
|
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiText mappingBtnTxt("Button Mappings", 24, (GXColor){0, 0, 0, 255});
|
2009-06-27 21:12:47 +02:00
|
|
|
mappingBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-30);
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiImage mappingBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage mappingBtnImgOver(&btnLargeOutlineOver);
|
|
|
|
GuiImage mappingBtnIcon(&iconMappings);
|
|
|
|
GuiButton mappingBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
|
|
|
mappingBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
mappingBtn.SetPosition(-125, 120);
|
|
|
|
mappingBtn.SetLabel(&mappingBtnTxt);
|
|
|
|
mappingBtn.SetImage(&mappingBtnImg);
|
|
|
|
mappingBtn.SetImageOver(&mappingBtnImgOver);
|
|
|
|
mappingBtn.SetIcon(&mappingBtnIcon);
|
|
|
|
mappingBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
mappingBtn.SetSoundClick(&btnSoundClick);
|
|
|
|
mappingBtn.SetTrigger(&trigA);
|
|
|
|
mappingBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText videoBtnTxt("Video", 24, (GXColor){0, 0, 0, 255});
|
2009-06-27 21:12:47 +02:00
|
|
|
videoBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-30);
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiImage videoBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage videoBtnImgOver(&btnLargeOutlineOver);
|
|
|
|
GuiImage videoBtnIcon(&iconVideo);
|
|
|
|
GuiButton videoBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
|
|
|
videoBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
videoBtn.SetPosition(125, 120);
|
|
|
|
videoBtn.SetLabel(&videoBtnTxt);
|
|
|
|
videoBtn.SetImage(&videoBtnImg);
|
|
|
|
videoBtn.SetImageOver(&videoBtnImgOver);
|
|
|
|
videoBtn.SetIcon(&videoBtnIcon);
|
|
|
|
videoBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
videoBtn.SetSoundClick(&btnSoundClick);
|
|
|
|
videoBtn.SetTrigger(&trigA);
|
|
|
|
videoBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText controllerBtnTxt("Controller", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage controllerBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage controllerBtnImgOver(&btnLargeOutlineOver);
|
|
|
|
GuiImage controllerBtnIcon(&iconController);
|
|
|
|
GuiButton controllerBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
|
|
|
controllerBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-07-22 03:58:45 +02:00
|
|
|
controllerBtn.SetPosition(-125, 250);
|
2009-04-13 21:48:24 +02:00
|
|
|
controllerBtn.SetLabel(&controllerBtnTxt);
|
|
|
|
controllerBtn.SetImage(&controllerBtnImg);
|
|
|
|
controllerBtn.SetImageOver(&controllerBtnImgOver);
|
|
|
|
controllerBtn.SetIcon(&controllerBtnIcon);
|
|
|
|
controllerBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
controllerBtn.SetSoundClick(&btnSoundClick);
|
|
|
|
controllerBtn.SetTrigger(&trigA);
|
|
|
|
controllerBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText cheatsBtnTxt("Cheats", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage cheatsBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage cheatsBtnImgOver(&btnLargeOutlineOver);
|
|
|
|
GuiImage cheatsBtnIcon(&iconCheats);
|
|
|
|
GuiButton cheatsBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
|
|
|
cheatsBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
cheatsBtn.SetPosition(125, 250);
|
|
|
|
cheatsBtn.SetLabel(&cheatsBtnTxt);
|
|
|
|
cheatsBtn.SetImage(&cheatsBtnImg);
|
|
|
|
cheatsBtn.SetImageOver(&cheatsBtnImgOver);
|
|
|
|
cheatsBtn.SetIcon(&cheatsBtnIcon);
|
|
|
|
cheatsBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
cheatsBtn.SetSoundClick(&btnSoundClick);
|
|
|
|
cheatsBtn.SetTrigger(&trigA);
|
|
|
|
cheatsBtn.SetEffectGrow();
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
GuiText closeBtnTxt("Close", 22, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage closeBtnImg(&btnCloseOutline);
|
|
|
|
GuiImage closeBtnImgOver(&btnCloseOutlineOver);
|
|
|
|
GuiButton closeBtn(btnCloseOutline.GetWidth(), btnCloseOutline.GetHeight());
|
|
|
|
closeBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
2009-04-22 20:15:36 +02:00
|
|
|
closeBtn.SetPosition(-50, 35);
|
2009-03-28 18:23:08 +01:00
|
|
|
closeBtn.SetLabel(&closeBtnTxt);
|
|
|
|
closeBtn.SetImage(&closeBtnImg);
|
|
|
|
closeBtn.SetImageOver(&closeBtnImgOver);
|
|
|
|
closeBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
closeBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
closeBtn.SetTrigger(&trigA);
|
|
|
|
closeBtn.SetTrigger(&trigHome);
|
|
|
|
closeBtn.SetEffectGrow();
|
|
|
|
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiText backBtnTxt("Go Back", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage backBtnImg(&btnOutline);
|
|
|
|
GuiImage backBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
2009-06-27 21:12:47 +02:00
|
|
|
backBtn.SetPosition(50, -35);
|
2009-04-13 21:48:24 +02:00
|
|
|
backBtn.SetLabel(&backBtnTxt);
|
|
|
|
backBtn.SetImage(&backBtnImg);
|
|
|
|
backBtn.SetImageOver(&backBtnImgOver);
|
|
|
|
backBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
backBtn.SetSoundClick(&btnSoundClick);
|
|
|
|
backBtn.SetTrigger(&trigA);
|
|
|
|
backBtn.SetEffectGrow();
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
2009-04-13 21:48:24 +02:00
|
|
|
w.Append(&titleTxt);
|
|
|
|
w.Append(&mappingBtn);
|
|
|
|
w.Append(&videoBtn);
|
|
|
|
w.Append(&controllerBtn);
|
2009-07-22 03:58:45 +02:00
|
|
|
w.Append(&cheatsBtn);
|
2009-03-28 18:23:08 +01:00
|
|
|
w.Append(&closeBtn);
|
2009-04-13 21:48:24 +02:00
|
|
|
w.Append(&backBtn);
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
mainWindow->Append(&w);
|
2009-04-13 21:48:24 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
|
|
|
{
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-04-13 21:48:24 +02:00
|
|
|
if(mappingBtn.GetState() == STATE_CLICKED)
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
2009-04-13 21:48:24 +02:00
|
|
|
menu = MENU_GAMESETTINGS_MAPPINGS;
|
|
|
|
}
|
|
|
|
else if(videoBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_GAMESETTINGS_VIDEO;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
2009-04-13 21:48:24 +02:00
|
|
|
else if(controllerBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
ControllerWindow();
|
|
|
|
}
|
2009-07-22 03:58:45 +02:00
|
|
|
else if(cheatsBtn.GetState() == STATE_CLICKED)
|
2009-04-13 21:48:24 +02:00
|
|
|
{
|
|
|
|
cheatsBtn.ResetState();
|
2009-07-22 03:58:45 +02:00
|
|
|
if(numcheats > 0)
|
2009-04-13 21:48:24 +02:00
|
|
|
menu = MENU_GAMESETTINGS_CHEATS;
|
|
|
|
else
|
|
|
|
InfoPrompt("Cheats file not found!");
|
2009-07-22 03:58:45 +02:00
|
|
|
}
|
2009-03-28 18:23:08 +01:00
|
|
|
else if(closeBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_EXIT;
|
|
|
|
|
2009-04-05 05:11:38 +02:00
|
|
|
exitSound->Play();
|
2009-04-19 09:34:07 +02:00
|
|
|
bgTopImg->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 15);
|
|
|
|
closeBtn.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 15);
|
|
|
|
titleTxt.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 15);
|
|
|
|
backBtn.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 15);
|
|
|
|
bgBottomImg->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 15);
|
|
|
|
btnLogo->SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_OUT, 15);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-04-19 09:34:07 +02:00
|
|
|
w.SetEffect(EFFECT_FADE, -15);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-04-19 09:34:07 +02:00
|
|
|
usleep(350000); // wait for effects to finish
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
2009-04-13 21:48:24 +02:00
|
|
|
else if(backBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_GAME;
|
|
|
|
}
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
2009-04-13 21:48:24 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
HaltGui();
|
2009-04-13 21:48:24 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
mainWindow->Remove(&w);
|
|
|
|
return menu;
|
|
|
|
}
|
2009-04-13 21:48:24 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
/****************************************************************************
|
2009-04-13 21:48:24 +02:00
|
|
|
* MenuGameCheats
|
|
|
|
*
|
|
|
|
* Displays a list of cheats available, and allows the user to enable/disable
|
|
|
|
* them.
|
2009-03-28 18:23:08 +01:00
|
|
|
***************************************************************************/
|
2009-07-22 03:58:45 +02:00
|
|
|
|
2009-04-13 21:48:24 +02:00
|
|
|
static int MenuGameCheats()
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
|
|
|
int menu = MENU_NONE;
|
2009-04-13 21:48:24 +02:00
|
|
|
int ret;
|
|
|
|
u16 i = 0;
|
|
|
|
OptionList options;
|
2009-07-22 03:58:45 +02:00
|
|
|
char *name; // cheat name
|
|
|
|
int status; // cheat status (on/off)
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-07-22 03:58:45 +02:00
|
|
|
for(i=0; i < numcheats; i++)
|
|
|
|
{
|
|
|
|
FCEUI_GetCheat(i,&name,NULL,NULL,NULL,&status,NULL);
|
|
|
|
sprintf (options.name[i], "%s", name);
|
|
|
|
sprintf (options.value[i], status ? "On" : "Off");
|
|
|
|
}
|
2009-04-13 21:48:24 +02:00
|
|
|
|
|
|
|
options.length = i;
|
|
|
|
|
|
|
|
GuiText titleTxt("Game Settings - Cheats", 28, (GXColor){255, 255, 255, 255});
|
2009-03-28 18:23:08 +01:00
|
|
|
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(50,50);
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiImageData btnCloseOutline(button_small_png);
|
|
|
|
GuiImageData btnCloseOutlineOver(button_small_over_png);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiTrigger trigHome;
|
|
|
|
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
GuiText backBtnTxt("Go Back", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage backBtnImg(&btnOutline);
|
|
|
|
GuiImage backBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
2009-06-27 21:12:47 +02:00
|
|
|
backBtn.SetPosition(50, -35);
|
2009-03-28 18:23:08 +01:00
|
|
|
backBtn.SetLabel(&backBtnTxt);
|
|
|
|
backBtn.SetImage(&backBtnImg);
|
|
|
|
backBtn.SetImageOver(&backBtnImgOver);
|
|
|
|
backBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
backBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
backBtn.SetTrigger(&trigA);
|
|
|
|
backBtn.SetEffectGrow();
|
|
|
|
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiOptionBrowser optionBrowser(552, 248, &options);
|
|
|
|
optionBrowser.SetPosition(0, 108);
|
|
|
|
optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-07-22 03:58:45 +02:00
|
|
|
optionBrowser.SetCol2Position(350);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
w.Append(&backBtn);
|
2009-04-13 21:48:24 +02:00
|
|
|
mainWindow->Append(&optionBrowser);
|
2009-03-28 18:23:08 +01:00
|
|
|
mainWindow->Append(&w);
|
2009-04-13 21:48:24 +02:00
|
|
|
mainWindow->Append(&titleTxt);
|
2009-03-28 18:23:08 +01:00
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
|
|
|
{
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-04-13 21:48:24 +02:00
|
|
|
ret = optionBrowser.GetClickedOption();
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-07-22 03:58:45 +02:00
|
|
|
if(ret >= 0)
|
|
|
|
{
|
|
|
|
FCEUI_ToggleCheat(ret);
|
|
|
|
sprintf (options.value[ret], "%s", options.value[ret][1] == 'f' ? "On" : "Off");
|
2009-07-28 00:37:56 +02:00
|
|
|
optionBrowser.TriggerUpdate();
|
2009-07-22 03:58:45 +02:00
|
|
|
}
|
2009-04-13 21:48:24 +02:00
|
|
|
|
|
|
|
if(backBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_GAMESETTINGS;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
HaltGui();
|
2009-04-13 21:48:24 +02:00
|
|
|
mainWindow->Remove(&optionBrowser);
|
2009-03-28 18:23:08 +01:00
|
|
|
mainWindow->Remove(&w);
|
2009-04-13 21:48:24 +02:00
|
|
|
mainWindow->Remove(&titleTxt);
|
2009-03-28 18:23:08 +01:00
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* MenuSettingsMappings
|
|
|
|
***************************************************************************/
|
|
|
|
static int MenuSettingsMappings()
|
|
|
|
{
|
|
|
|
int menu = MENU_NONE;
|
|
|
|
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiText titleTxt("Game Settings - Button Mappings", 28, (GXColor){255, 255, 255, 255});
|
2009-03-28 18:23:08 +01:00
|
|
|
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(50,50);
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
|
|
|
GuiImageData btnLargeOutline(button_large_png);
|
|
|
|
GuiImageData btnLargeOutlineOver(button_large_over_png);
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiImageData iconNESController(icon_settings_nescontroller_png);
|
|
|
|
GuiImageData iconZapper(icon_settings_zapper_png);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiText nesBtnTxt("NES Controller", 24, (GXColor){0, 0, 0, 255});
|
2009-06-27 21:12:47 +02:00
|
|
|
nesBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-30);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImage nesBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage nesBtnImgOver(&btnLargeOutlineOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiImage nesBtnIcon(&iconNESController);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiButton nesBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
|
|
|
nesBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
nesBtn.SetPosition(-125, 120);
|
|
|
|
nesBtn.SetLabel(&nesBtnTxt);
|
|
|
|
nesBtn.SetImage(&nesBtnImg);
|
|
|
|
nesBtn.SetImageOver(&nesBtnImgOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
nesBtn.SetIcon(&nesBtnIcon);
|
2009-03-28 18:23:08 +01:00
|
|
|
nesBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
nesBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
nesBtn.SetTrigger(&trigA);
|
|
|
|
nesBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText zapperBtnTxt("Zapper", 24, (GXColor){0, 0, 0, 255});
|
2009-06-27 21:12:47 +02:00
|
|
|
zapperBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-30);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImage zapperBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage zapperBtnImgOver(&btnLargeOutlineOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiImage zapperBtnIcon(&iconZapper);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiButton zapperBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
|
|
|
zapperBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
zapperBtn.SetPosition(125, 120);
|
|
|
|
zapperBtn.SetLabel(&zapperBtnTxt);
|
|
|
|
zapperBtn.SetImage(&zapperBtnImg);
|
|
|
|
zapperBtn.SetImageOver(&zapperBtnImgOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
zapperBtn.SetIcon(&zapperBtnIcon);
|
2009-03-28 18:23:08 +01:00
|
|
|
zapperBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
zapperBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
zapperBtn.SetTrigger(&trigA);
|
|
|
|
zapperBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText backBtnTxt("Go Back", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage backBtnImg(&btnOutline);
|
|
|
|
GuiImage backBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
2009-06-27 21:12:47 +02:00
|
|
|
backBtn.SetPosition(50, -35);
|
2009-03-28 18:23:08 +01:00
|
|
|
backBtn.SetLabel(&backBtnTxt);
|
|
|
|
backBtn.SetImage(&backBtnImg);
|
|
|
|
backBtn.SetImageOver(&backBtnImgOver);
|
|
|
|
backBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
backBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
backBtn.SetTrigger(&trigA);
|
|
|
|
backBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
w.Append(&titleTxt);
|
|
|
|
w.Append(&nesBtn);
|
|
|
|
w.Append(&zapperBtn);
|
|
|
|
|
|
|
|
w.Append(&backBtn);
|
|
|
|
|
|
|
|
mainWindow->Append(&w);
|
|
|
|
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
|
|
|
{
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
if(nesBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-04-13 21:48:24 +02:00
|
|
|
menu = MENU_GAMESETTINGS_MAPPINGS_CTRL;
|
2009-03-28 18:23:08 +01:00
|
|
|
mapMenuCtrlNES = CTRL_PAD;
|
|
|
|
}
|
|
|
|
else if(zapperBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-04-13 21:48:24 +02:00
|
|
|
menu = MENU_GAMESETTINGS_MAPPINGS_CTRL;
|
2009-03-28 18:23:08 +01:00
|
|
|
mapMenuCtrlNES = CTRL_ZAPPER;
|
|
|
|
}
|
|
|
|
else if(backBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-04-13 21:48:24 +02:00
|
|
|
menu = MENU_GAMESETTINGS;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int MenuSettingsMappingsController()
|
|
|
|
{
|
|
|
|
int menu = MENU_NONE;
|
|
|
|
char menuTitle[100];
|
|
|
|
char menuSubtitle[100];
|
|
|
|
|
2009-04-13 21:48:24 +02:00
|
|
|
sprintf(menuTitle, "Game Settings - Button Mappings");
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiText titleTxt(menuTitle, 28, (GXColor){255, 255, 255, 255});
|
|
|
|
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(50,30);
|
|
|
|
|
|
|
|
sprintf(menuSubtitle, "%s", ctrlName[mapMenuCtrlNES]);
|
|
|
|
GuiText subtitleTxt(menuSubtitle, 22, (GXColor){255, 255, 255, 255});
|
|
|
|
subtitleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
subtitleTxt.SetPosition(50,60);
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
|
|
|
GuiImageData btnLargeOutline(button_large_png);
|
|
|
|
GuiImageData btnLargeOutlineOver(button_large_over_png);
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiImageData iconWiimote(icon_settings_wiimote_png);
|
|
|
|
GuiImageData iconClassic(icon_settings_classic_png);
|
|
|
|
GuiImageData iconGamecube(icon_settings_gamecube_png);
|
|
|
|
GuiImageData iconNunchuk(icon_settings_nunchuk_png);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiText gamecubeBtnTxt("GameCube Controller", 24, (GXColor){0, 0, 0, 255});
|
2009-06-27 21:12:47 +02:00
|
|
|
gamecubeBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-30);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImage gamecubeBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage gamecubeBtnImgOver(&btnLargeOutlineOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiImage gamecubeBtnIcon(&iconGamecube);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiButton gamecubeBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
|
|
|
gamecubeBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
gamecubeBtn.SetPosition(-125, 120);
|
|
|
|
gamecubeBtn.SetLabel(&gamecubeBtnTxt);
|
|
|
|
gamecubeBtn.SetImage(&gamecubeBtnImg);
|
|
|
|
gamecubeBtn.SetImageOver(&gamecubeBtnImgOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
gamecubeBtn.SetIcon(&gamecubeBtnIcon);
|
2009-03-28 18:23:08 +01:00
|
|
|
gamecubeBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
gamecubeBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
gamecubeBtn.SetTrigger(&trigA);
|
|
|
|
gamecubeBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText wiimoteBtnTxt("Wiimote", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage wiimoteBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage wiimoteBtnImgOver(&btnLargeOutlineOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiImage wiimoteBtnIcon(&iconWiimote);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiButton wiimoteBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
|
|
|
wiimoteBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
wiimoteBtn.SetPosition(125, 120);
|
|
|
|
wiimoteBtn.SetLabel(&wiimoteBtnTxt);
|
|
|
|
wiimoteBtn.SetImage(&wiimoteBtnImg);
|
|
|
|
wiimoteBtn.SetImageOver(&wiimoteBtnImgOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
wiimoteBtn.SetIcon(&wiimoteBtnIcon);
|
2009-03-28 18:23:08 +01:00
|
|
|
wiimoteBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
wiimoteBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
wiimoteBtn.SetTrigger(&trigA);
|
|
|
|
wiimoteBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText classicBtnTxt("Classic Controller", 24, (GXColor){0, 0, 0, 255});
|
2009-06-27 21:12:47 +02:00
|
|
|
classicBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-30);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImage classicBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage classicBtnImgOver(&btnLargeOutlineOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiImage classicBtnIcon(&iconClassic);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiButton classicBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
|
|
|
classicBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
classicBtn.SetPosition(-125, 250);
|
|
|
|
classicBtn.SetLabel(&classicBtnTxt);
|
|
|
|
classicBtn.SetImage(&classicBtnImg);
|
|
|
|
classicBtn.SetImageOver(&classicBtnImgOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
classicBtn.SetIcon(&classicBtnIcon);
|
2009-03-28 18:23:08 +01:00
|
|
|
classicBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
classicBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
classicBtn.SetTrigger(&trigA);
|
|
|
|
classicBtn.SetEffectGrow();
|
|
|
|
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiText nunchukBtnTxt1("Wiimote", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiText nunchukBtnTxt2("&", 18, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiText nunchukBtnTxt3("Nunchuk", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
nunchukBtnTxt1.SetPosition(0, -20);
|
|
|
|
nunchukBtnTxt3.SetPosition(0, +20);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImage nunchukBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage nunchukBtnImgOver(&btnLargeOutlineOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiImage nunchukBtnIcon(&iconNunchuk);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiButton nunchukBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
|
|
|
nunchukBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
nunchukBtn.SetPosition(125, 250);
|
2009-03-31 09:13:20 +02:00
|
|
|
nunchukBtn.SetLabel(&nunchukBtnTxt1, 0);
|
|
|
|
nunchukBtn.SetLabel(&nunchukBtnTxt2, 1);
|
|
|
|
nunchukBtn.SetLabel(&nunchukBtnTxt3, 2);
|
2009-03-28 18:23:08 +01:00
|
|
|
nunchukBtn.SetImage(&nunchukBtnImg);
|
|
|
|
nunchukBtn.SetImageOver(&nunchukBtnImgOver);
|
2009-03-31 09:13:20 +02:00
|
|
|
nunchukBtn.SetIcon(&nunchukBtnIcon);
|
2009-03-28 18:23:08 +01:00
|
|
|
nunchukBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
nunchukBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
nunchukBtn.SetTrigger(&trigA);
|
|
|
|
nunchukBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText backBtnTxt("Go Back", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage backBtnImg(&btnOutline);
|
|
|
|
GuiImage backBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
2009-06-27 21:12:47 +02:00
|
|
|
backBtn.SetPosition(50, -35);
|
2009-03-28 18:23:08 +01:00
|
|
|
backBtn.SetLabel(&backBtnTxt);
|
|
|
|
backBtn.SetImage(&backBtnImg);
|
|
|
|
backBtn.SetImageOver(&backBtnImgOver);
|
|
|
|
backBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
backBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
backBtn.SetTrigger(&trigA);
|
|
|
|
backBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
w.Append(&titleTxt);
|
|
|
|
w.Append(&subtitleTxt);
|
|
|
|
|
|
|
|
w.Append(&gamecubeBtn);
|
|
|
|
#ifdef HW_RVL
|
|
|
|
w.Append(&wiimoteBtn);
|
|
|
|
|
|
|
|
if(mapMenuCtrlNES == CTRL_PAD)
|
|
|
|
{
|
|
|
|
w.Append(&nunchukBtn);
|
|
|
|
w.Append(&classicBtn);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
w.Append(&backBtn);
|
|
|
|
|
|
|
|
mainWindow->Append(&w);
|
|
|
|
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
|
|
|
{
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
if(wiimoteBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-04-13 21:48:24 +02:00
|
|
|
menu = MENU_GAMESETTINGS_MAPPINGS_MAP;
|
2009-03-28 18:23:08 +01:00
|
|
|
mapMenuCtrl = CTRLR_WIIMOTE;
|
|
|
|
}
|
|
|
|
else if(nunchukBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-04-13 21:48:24 +02:00
|
|
|
menu = MENU_GAMESETTINGS_MAPPINGS_MAP;
|
2009-03-28 18:23:08 +01:00
|
|
|
mapMenuCtrl = CTRLR_NUNCHUK;
|
|
|
|
}
|
|
|
|
else if(classicBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-04-13 21:48:24 +02:00
|
|
|
menu = MENU_GAMESETTINGS_MAPPINGS_MAP;
|
2009-03-28 18:23:08 +01:00
|
|
|
mapMenuCtrl = CTRLR_CLASSIC;
|
|
|
|
}
|
|
|
|
else if(gamecubeBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-04-13 21:48:24 +02:00
|
|
|
menu = MENU_GAMESETTINGS_MAPPINGS_MAP;
|
2009-03-28 18:23:08 +01:00
|
|
|
mapMenuCtrl = CTRLR_GCPAD;
|
|
|
|
}
|
|
|
|
else if(backBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-04-13 21:48:24 +02:00
|
|
|
menu = MENU_GAMESETTINGS_MAPPINGS;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* ButtonMappingWindow
|
|
|
|
***************************************************************************/
|
|
|
|
static u32
|
|
|
|
ButtonMappingWindow()
|
|
|
|
{
|
|
|
|
GuiWindow promptWindow(448,288);
|
|
|
|
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
promptWindow.SetPosition(0, -10);
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiImageData dialogBox(dialogue_box_png);
|
|
|
|
GuiImage dialogBoxImg(&dialogBox);
|
|
|
|
|
2009-03-31 09:13:20 +02:00
|
|
|
GuiText titleTxt("Button Mapping", 26, (GXColor){70, 70, 10, 255});
|
2009-03-28 18:23:08 +01:00
|
|
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(0,14);
|
|
|
|
|
|
|
|
char msg[200];
|
|
|
|
|
|
|
|
switch(mapMenuCtrl)
|
|
|
|
{
|
|
|
|
case CTRLR_GCPAD:
|
|
|
|
#ifdef HW_RVL
|
2009-06-18 06:48:02 +02:00
|
|
|
sprintf(msg, "Press any button on the GameCube Controller now. Press Home or the C-Stick in any direction to clear the existing mapping.");
|
2009-03-28 18:23:08 +01:00
|
|
|
#else
|
2009-06-18 06:48:02 +02:00
|
|
|
sprintf(msg, "Press any button on the GameCube Controller now. Press the C-Stick in any direction to clear the existing mapping.");
|
2009-03-28 18:23:08 +01:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case CTRLR_WIIMOTE:
|
2009-06-18 06:48:02 +02:00
|
|
|
sprintf(msg, "Press any button on the Wiimote now. Press Home to clear the existing mapping.");
|
2009-03-28 18:23:08 +01:00
|
|
|
break;
|
|
|
|
case CTRLR_CLASSIC:
|
2009-06-18 06:48:02 +02:00
|
|
|
sprintf(msg, "Press any button on the Classic Controller now. Press Home to clear the existing mapping.");
|
2009-03-28 18:23:08 +01:00
|
|
|
break;
|
|
|
|
case CTRLR_NUNCHUK:
|
2009-06-18 06:48:02 +02:00
|
|
|
sprintf(msg, "Press any button on the Wiimote or Nunchuk now. Press Home to clear the existing mapping.");
|
2009-03-28 18:23:08 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
GuiText msgTxt(msg, 26, (GXColor){0, 0, 0, 255});
|
|
|
|
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
msgTxt.SetPosition(0,-20);
|
2009-06-27 21:12:47 +02:00
|
|
|
msgTxt.SetWrap(true, 430);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
promptWindow.Append(&dialogBoxImg);
|
|
|
|
promptWindow.Append(&titleTxt);
|
|
|
|
promptWindow.Append(&msgTxt);
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
|
|
mainWindow->Append(&promptWindow);
|
|
|
|
mainWindow->ChangeFocus(&promptWindow);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
u32 pressed = 0;
|
|
|
|
|
|
|
|
while(pressed == 0)
|
|
|
|
{
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
if(mapMenuCtrl == CTRLR_GCPAD)
|
|
|
|
{
|
|
|
|
pressed = userInput[0].pad.btns_d;
|
|
|
|
|
|
|
|
|
|
|
|
if(userInput[0].pad.substickX < -70 ||
|
|
|
|
userInput[0].pad.substickX > 70 ||
|
|
|
|
userInput[0].pad.substickY < -70 ||
|
|
|
|
userInput[0].pad.substickY > 70)
|
|
|
|
pressed = WPAD_BUTTON_HOME;
|
|
|
|
|
2009-10-13 02:40:02 +02:00
|
|
|
if(userInput[0].wpad->btns_d == WPAD_BUTTON_HOME)
|
2009-03-28 18:23:08 +01:00
|
|
|
pressed = WPAD_BUTTON_HOME;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-10-13 02:40:02 +02:00
|
|
|
pressed = userInput[0].wpad->btns_d;
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
// always allow Home button to be pressed to cancel
|
|
|
|
if(pressed != WPAD_BUTTON_HOME)
|
|
|
|
{
|
|
|
|
switch(mapMenuCtrl)
|
|
|
|
{
|
|
|
|
case CTRLR_WIIMOTE:
|
|
|
|
if(pressed > 0x1000)
|
|
|
|
pressed = 0; // not a valid input
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CTRLR_CLASSIC:
|
2009-10-13 02:40:02 +02:00
|
|
|
if(userInput[0].wpad->exp.type != WPAD_EXP_CLASSIC)
|
2009-03-28 18:23:08 +01:00
|
|
|
pressed = 0; // not a valid input
|
|
|
|
else if(pressed <= 0x1000)
|
|
|
|
pressed = 0; // not a valid input
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CTRLR_NUNCHUK:
|
2009-10-13 02:40:02 +02:00
|
|
|
if(userInput[0].wpad->exp.type != WPAD_EXP_NUNCHUK)
|
2009-03-28 18:23:08 +01:00
|
|
|
pressed = 0; // not a valid input
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(pressed == WPAD_BUTTON_HOME
|
|
|
|
|| pressed == WPAD_CLASSIC_BUTTON_HOME)
|
|
|
|
pressed = 0;
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&promptWindow);
|
|
|
|
mainWindow->SetState(STATE_DEFAULT);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
return pressed;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int MenuSettingsMappingsMap()
|
|
|
|
{
|
|
|
|
int menu = MENU_NONE;
|
|
|
|
int ret,i,j;
|
|
|
|
OptionList options;
|
2009-07-28 00:37:56 +02:00
|
|
|
bool firstRun = true;
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
char menuTitle[100];
|
|
|
|
char menuSubtitle[100];
|
2009-04-13 21:48:24 +02:00
|
|
|
sprintf(menuTitle, "Game Settings - Button Mappings");
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
GuiText titleTxt(menuTitle, 28, (GXColor){255, 255, 255, 255});
|
|
|
|
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(50,30);
|
|
|
|
|
|
|
|
sprintf(menuSubtitle, "%s - %s", ctrlName[mapMenuCtrlNES], ctrlrName[mapMenuCtrl]);
|
|
|
|
GuiText subtitleTxt(menuSubtitle, 22, (GXColor){255, 255, 255, 255});
|
|
|
|
subtitleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
subtitleTxt.SetPosition(50,60);
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
2009-06-27 21:12:47 +02:00
|
|
|
GuiImageData btnShortOutline(button_short_png);
|
|
|
|
GuiImageData btnShortOutlineOver(button_short_over_png);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiText backBtnTxt("Go Back", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage backBtnImg(&btnOutline);
|
|
|
|
GuiImage backBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
2009-06-27 21:12:47 +02:00
|
|
|
backBtn.SetPosition(50, -35);
|
2009-03-28 18:23:08 +01:00
|
|
|
backBtn.SetLabel(&backBtnTxt);
|
|
|
|
backBtn.SetImage(&backBtnImg);
|
|
|
|
backBtn.SetImageOver(&backBtnImgOver);
|
|
|
|
backBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
backBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
backBtn.SetTrigger(&trigA);
|
|
|
|
backBtn.SetEffectGrow();
|
|
|
|
|
2009-06-27 21:12:47 +02:00
|
|
|
GuiText resetBtnTxt("Reset", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage resetBtnImg(&btnShortOutline);
|
|
|
|
GuiImage resetBtnImgOver(&btnShortOutlineOver);
|
|
|
|
GuiButton resetBtn(btnShortOutline.GetWidth(), btnShortOutline.GetHeight());
|
|
|
|
resetBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
resetBtn.SetPosition(260, -35);
|
|
|
|
resetBtn.SetLabel(&resetBtnTxt);
|
|
|
|
resetBtn.SetImage(&resetBtnImg);
|
|
|
|
resetBtn.SetImageOver(&resetBtnImgOver);
|
|
|
|
resetBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
resetBtn.SetSoundClick(&btnSoundClick);
|
|
|
|
resetBtn.SetTrigger(&trigA);
|
|
|
|
resetBtn.SetEffectGrow();
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
i=0;
|
|
|
|
|
|
|
|
switch(mapMenuCtrlNES)
|
|
|
|
{
|
|
|
|
case CTRL_PAD:
|
|
|
|
sprintf(options.name[i++], "B");
|
|
|
|
sprintf(options.name[i++], "A");
|
|
|
|
sprintf(options.name[i++], "B (Rapid)");
|
|
|
|
sprintf(options.name[i++], "A (Rapid)");
|
|
|
|
sprintf(options.name[i++], "Select");
|
|
|
|
sprintf(options.name[i++], "Start");
|
|
|
|
sprintf(options.name[i++], "Up");
|
|
|
|
sprintf(options.name[i++], "Down");
|
|
|
|
sprintf(options.name[i++], "Left");
|
|
|
|
sprintf(options.name[i++], "Right");
|
|
|
|
sprintf(options.name[i++], "Insert Coin / Switch Disk");
|
|
|
|
options.length = i;
|
|
|
|
break;
|
|
|
|
case CTRL_ZAPPER:
|
|
|
|
sprintf(options.name[i++], "Fire");
|
|
|
|
sprintf(options.name[i++], "Insert Coin");
|
|
|
|
options.length = i;
|
|
|
|
break;
|
|
|
|
};
|
|
|
|
|
2009-06-27 21:12:47 +02:00
|
|
|
for(i=0; i < options.length; i++)
|
|
|
|
options.value[i][0] = 0;
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiOptionBrowser optionBrowser(552, 248, &options);
|
|
|
|
optionBrowser.SetPosition(0, 108);
|
|
|
|
optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-04-01 10:02:59 +02:00
|
|
|
optionBrowser.SetCol2Position(280);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
w.Append(&backBtn);
|
2009-06-27 21:12:47 +02:00
|
|
|
w.Append(&resetBtn);
|
2009-03-28 18:23:08 +01:00
|
|
|
mainWindow->Append(&optionBrowser);
|
|
|
|
mainWindow->Append(&w);
|
|
|
|
mainWindow->Append(&titleTxt);
|
|
|
|
mainWindow->Append(&subtitleTxt);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
|
|
|
{
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
if(backBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-04-13 21:48:24 +02:00
|
|
|
menu = MENU_GAMESETTINGS_MAPPINGS_CTRL;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
2009-06-27 21:12:47 +02:00
|
|
|
else if(resetBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
resetBtn.ResetState();
|
|
|
|
|
|
|
|
int choice = WindowPrompt(
|
|
|
|
"Reset Mappings",
|
|
|
|
"Are you sure that you want to reset your mappings?",
|
|
|
|
"Yes",
|
|
|
|
"No");
|
|
|
|
|
|
|
|
if(choice == 1)
|
2009-07-28 00:37:56 +02:00
|
|
|
{
|
2009-06-27 21:12:47 +02:00
|
|
|
ResetControls(mapMenuCtrlNES, mapMenuCtrl);
|
2009-07-28 00:37:56 +02:00
|
|
|
firstRun = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = optionBrowser.GetClickedOption();
|
|
|
|
|
|
|
|
if(ret >= 0)
|
|
|
|
{
|
|
|
|
// get a button selection from user
|
|
|
|
btnmap[mapMenuCtrlNES][mapMenuCtrl][ret] = ButtonMappingWindow();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ret >= 0 || firstRun)
|
|
|
|
{
|
|
|
|
firstRun = false;
|
|
|
|
|
|
|
|
for(i=0; i < options.length; i++)
|
|
|
|
{
|
|
|
|
for(j=0; j < ctrlr_def[mapMenuCtrl].num_btns; j++)
|
|
|
|
{
|
|
|
|
if(btnmap[mapMenuCtrlNES][mapMenuCtrl][i] == 0)
|
|
|
|
{
|
|
|
|
options.value[i][0] = 0;
|
|
|
|
}
|
|
|
|
else if(btnmap[mapMenuCtrlNES][mapMenuCtrl][i] ==
|
|
|
|
ctrlr_def[mapMenuCtrl].map[j].btn)
|
|
|
|
{
|
|
|
|
if(strcmp(options.value[i], ctrlr_def[mapMenuCtrl].map[j].name) != 0)
|
|
|
|
sprintf(options.value[i], ctrlr_def[mapMenuCtrl].map[j].name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
optionBrowser.TriggerUpdate();
|
2009-06-27 21:12:47 +02:00
|
|
|
}
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&optionBrowser);
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
mainWindow->Remove(&titleTxt);
|
|
|
|
mainWindow->Remove(&subtitleTxt);
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* MenuSettingsVideo
|
|
|
|
***************************************************************************/
|
2009-11-16 09:14:38 +01:00
|
|
|
static void ScreenZoomWindowUpdate(void * ptr, float h, float v)
|
2009-03-28 18:23:08 +01:00
|
|
|
{
|
|
|
|
GuiButton * b = (GuiButton *)ptr;
|
|
|
|
if(b->GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-11-16 09:14:38 +01:00
|
|
|
GCSettings.zoomHor += h;
|
|
|
|
GCSettings.zoomVert += v;
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
char zoom[10];
|
2009-11-16 09:14:38 +01:00
|
|
|
sprintf(zoom, "%.2f%%", GCSettings.zoomHor*100);
|
2009-03-28 18:23:08 +01:00
|
|
|
settingText->SetText(zoom);
|
2009-11-16 09:14:38 +01:00
|
|
|
sprintf(zoom, "%.2f%%", GCSettings.zoomVert*100);
|
|
|
|
settingText2->SetText(zoom);
|
2009-03-28 18:23:08 +01:00
|
|
|
b->ResetState();
|
|
|
|
}
|
2009-01-25 07:53:21 +01:00
|
|
|
}
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-11-16 09:14:38 +01:00
|
|
|
static void ScreenZoomWindowLeftClick(void * ptr) { ScreenZoomWindowUpdate(ptr, -0.01, 0); }
|
|
|
|
static void ScreenZoomWindowRightClick(void * ptr) { ScreenZoomWindowUpdate(ptr, +0.01, 0); }
|
|
|
|
static void ScreenZoomWindowUpClick(void * ptr) { ScreenZoomWindowUpdate(ptr, 0, +0.01); }
|
|
|
|
static void ScreenZoomWindowDownClick(void * ptr) { ScreenZoomWindowUpdate(ptr, 0, -0.01); }
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
static void ScreenZoomWindow()
|
2008-09-02 03:57:21 +02:00
|
|
|
{
|
2009-11-16 09:14:38 +01:00
|
|
|
GuiWindow * w = new GuiWindow(200,200);
|
2009-03-28 18:23:08 +01:00
|
|
|
w->SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiTrigger trigLeft;
|
|
|
|
trigLeft.SetButtonOnlyInFocusTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
|
|
|
|
|
|
|
|
GuiTrigger trigRight;
|
|
|
|
trigRight.SetButtonOnlyInFocusTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
|
|
|
|
|
2009-11-16 09:14:38 +01:00
|
|
|
GuiTrigger trigUp;
|
|
|
|
trigUp.SetButtonOnlyInFocusTrigger(-1, WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP, PAD_BUTTON_UP);
|
|
|
|
|
|
|
|
GuiTrigger trigDown;
|
|
|
|
trigDown.SetButtonOnlyInFocusTrigger(-1, WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_DOWN, PAD_BUTTON_DOWN);
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData arrowLeft(button_arrow_left_png);
|
|
|
|
GuiImage arrowLeftImg(&arrowLeft);
|
|
|
|
GuiImageData arrowLeftOver(button_arrow_left_over_png);
|
|
|
|
GuiImage arrowLeftOverImg(&arrowLeftOver);
|
|
|
|
GuiButton arrowLeftBtn(arrowLeft.GetWidth(), arrowLeft.GetHeight());
|
|
|
|
arrowLeftBtn.SetImage(&arrowLeftImg);
|
|
|
|
arrowLeftBtn.SetImageOver(&arrowLeftOverImg);
|
2009-11-16 09:14:38 +01:00
|
|
|
arrowLeftBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
arrowLeftBtn.SetPosition(50, 0);
|
2009-03-28 18:23:08 +01:00
|
|
|
arrowLeftBtn.SetTrigger(0, &trigA);
|
|
|
|
arrowLeftBtn.SetTrigger(1, &trigLeft);
|
|
|
|
arrowLeftBtn.SetSelectable(false);
|
|
|
|
arrowLeftBtn.SetUpdateCallback(ScreenZoomWindowLeftClick);
|
|
|
|
|
|
|
|
GuiImageData arrowRight(button_arrow_right_png);
|
|
|
|
GuiImage arrowRightImg(&arrowRight);
|
|
|
|
GuiImageData arrowRightOver(button_arrow_right_over_png);
|
|
|
|
GuiImage arrowRightOverImg(&arrowRightOver);
|
|
|
|
GuiButton arrowRightBtn(arrowRight.GetWidth(), arrowRight.GetHeight());
|
|
|
|
arrowRightBtn.SetImage(&arrowRightImg);
|
|
|
|
arrowRightBtn.SetImageOver(&arrowRightOverImg);
|
2009-11-16 09:14:38 +01:00
|
|
|
arrowRightBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
arrowRightBtn.SetPosition(164, 0);
|
2009-03-28 18:23:08 +01:00
|
|
|
arrowRightBtn.SetTrigger(0, &trigA);
|
|
|
|
arrowRightBtn.SetTrigger(1, &trigRight);
|
|
|
|
arrowRightBtn.SetSelectable(false);
|
|
|
|
arrowRightBtn.SetUpdateCallback(ScreenZoomWindowRightClick);
|
|
|
|
|
2009-11-16 09:14:38 +01:00
|
|
|
GuiImageData arrowUp(button_arrow_up_png);
|
|
|
|
GuiImage arrowUpImg(&arrowUp);
|
|
|
|
GuiImageData arrowUpOver(button_arrow_up_over_png);
|
|
|
|
GuiImage arrowUpOverImg(&arrowUpOver);
|
|
|
|
GuiButton arrowUpBtn(arrowUp.GetWidth(), arrowUp.GetHeight());
|
|
|
|
arrowUpBtn.SetImage(&arrowUpImg);
|
|
|
|
arrowUpBtn.SetImageOver(&arrowUpOverImg);
|
|
|
|
arrowUpBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
arrowUpBtn.SetPosition(-76, -27);
|
|
|
|
arrowUpBtn.SetTrigger(0, &trigA);
|
|
|
|
arrowUpBtn.SetTrigger(1, &trigUp);
|
|
|
|
arrowUpBtn.SetSelectable(false);
|
|
|
|
arrowUpBtn.SetUpdateCallback(ScreenZoomWindowUpClick);
|
|
|
|
|
|
|
|
GuiImageData arrowDown(button_arrow_down_png);
|
|
|
|
GuiImage arrowDownImg(&arrowDown);
|
|
|
|
GuiImageData arrowDownOver(button_arrow_down_over_png);
|
|
|
|
GuiImage arrowDownOverImg(&arrowDownOver);
|
|
|
|
GuiButton arrowDownBtn(arrowDown.GetWidth(), arrowDown.GetHeight());
|
|
|
|
arrowDownBtn.SetImage(&arrowDownImg);
|
|
|
|
arrowDownBtn.SetImageOver(&arrowDownOverImg);
|
|
|
|
arrowDownBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
arrowDownBtn.SetPosition(-76, 27);
|
|
|
|
arrowDownBtn.SetTrigger(0, &trigA);
|
|
|
|
arrowDownBtn.SetTrigger(1, &trigDown);
|
|
|
|
arrowDownBtn.SetSelectable(false);
|
|
|
|
arrowDownBtn.SetUpdateCallback(ScreenZoomWindowDownClick);
|
|
|
|
|
|
|
|
GuiImageData screenPosition(screen_position_png);
|
|
|
|
GuiImage screenPositionImg(&screenPosition);
|
|
|
|
screenPositionImg.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
screenPositionImg.SetPosition(0, 0);
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
settingText = new GuiText(NULL, 22, (GXColor){0, 0, 0, 255});
|
2009-11-16 09:14:38 +01:00
|
|
|
settingText2 = new GuiText(NULL, 22, (GXColor){0, 0, 0, 255});
|
2009-03-28 18:23:08 +01:00
|
|
|
char zoom[10];
|
2009-11-16 09:14:38 +01:00
|
|
|
sprintf(zoom, "%.2f%%", GCSettings.zoomHor*100);
|
2009-03-28 18:23:08 +01:00
|
|
|
settingText->SetText(zoom);
|
2009-11-16 09:14:38 +01:00
|
|
|
settingText->SetPosition(108, 0);
|
|
|
|
sprintf(zoom, "%.2f%%", GCSettings.zoomVert*100);
|
|
|
|
settingText2->SetText(zoom);
|
|
|
|
settingText2->SetPosition(-76, 0);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-11-16 09:14:38 +01:00
|
|
|
float currentZoomHor = GCSettings.zoomHor;
|
|
|
|
float currentZoomVert = GCSettings.zoomVert;
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
w->Append(&arrowLeftBtn);
|
|
|
|
w->Append(&arrowRightBtn);
|
2009-11-16 09:14:38 +01:00
|
|
|
w->Append(&arrowUpBtn);
|
|
|
|
w->Append(&arrowDownBtn);
|
|
|
|
w->Append(&screenPositionImg);
|
2009-03-28 18:23:08 +01:00
|
|
|
w->Append(settingText);
|
2009-11-16 09:14:38 +01:00
|
|
|
w->Append(settingText2);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
if(!SettingWindow("Screen Zoom",w))
|
2009-11-16 09:14:38 +01:00
|
|
|
{
|
|
|
|
// undo changes
|
|
|
|
GCSettings.zoomHor = currentZoomHor;
|
|
|
|
GCSettings.zoomVert = currentZoomVert;
|
|
|
|
}
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
delete(w);
|
|
|
|
delete(settingText);
|
2009-11-16 09:14:38 +01:00
|
|
|
delete(settingText2);
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
static void ScreenPositionWindowUpdate(void * ptr, int x, int y)
|
|
|
|
{
|
|
|
|
GuiButton * b = (GuiButton *)ptr;
|
|
|
|
if(b->GetState() == STATE_CLICKED)
|
2008-09-02 03:57:21 +02:00
|
|
|
{
|
2009-03-28 18:23:08 +01:00
|
|
|
GCSettings.xshift += x;
|
|
|
|
GCSettings.yshift += y;
|
2008-09-06 05:30:42 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
char shift[10];
|
|
|
|
sprintf(shift, "%i, %i", GCSettings.xshift, GCSettings.yshift);
|
|
|
|
settingText->SetText(shift);
|
|
|
|
b->ResetState();
|
2008-09-02 03:57:21 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
static void ScreenPositionWindowLeftClick(void * ptr) { ScreenPositionWindowUpdate(ptr, -1, 0); }
|
|
|
|
static void ScreenPositionWindowRightClick(void * ptr) { ScreenPositionWindowUpdate(ptr, +1, 0); }
|
|
|
|
static void ScreenPositionWindowUpClick(void * ptr) { ScreenPositionWindowUpdate(ptr, 0, -1); }
|
|
|
|
static void ScreenPositionWindowDownClick(void * ptr) { ScreenPositionWindowUpdate(ptr, 0, +1); }
|
2008-11-19 08:11:06 +01:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
static void ScreenPositionWindow()
|
2008-09-02 03:57:21 +02:00
|
|
|
{
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiWindow * w = new GuiWindow(150,150);
|
|
|
|
w->SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
w->SetPosition(0, -10);
|
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiTrigger trigLeft;
|
|
|
|
trigLeft.SetButtonOnlyInFocusTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
|
|
|
|
|
|
|
|
GuiTrigger trigRight;
|
|
|
|
trigRight.SetButtonOnlyInFocusTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
|
|
|
|
|
|
|
|
GuiTrigger trigUp;
|
|
|
|
trigUp.SetButtonOnlyInFocusTrigger(-1, WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP, PAD_BUTTON_UP);
|
|
|
|
|
|
|
|
GuiTrigger trigDown;
|
|
|
|
trigDown.SetButtonOnlyInFocusTrigger(-1, WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_DOWN, PAD_BUTTON_DOWN);
|
|
|
|
|
|
|
|
GuiImageData arrowLeft(button_arrow_left_png);
|
|
|
|
GuiImage arrowLeftImg(&arrowLeft);
|
|
|
|
GuiImageData arrowLeftOver(button_arrow_left_over_png);
|
|
|
|
GuiImage arrowLeftOverImg(&arrowLeftOver);
|
|
|
|
GuiButton arrowLeftBtn(arrowLeft.GetWidth(), arrowLeft.GetHeight());
|
|
|
|
arrowLeftBtn.SetImage(&arrowLeftImg);
|
|
|
|
arrowLeftBtn.SetImageOver(&arrowLeftOverImg);
|
|
|
|
arrowLeftBtn.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
arrowLeftBtn.SetTrigger(0, &trigA);
|
|
|
|
arrowLeftBtn.SetTrigger(1, &trigLeft);
|
|
|
|
arrowLeftBtn.SetSelectable(false);
|
|
|
|
arrowLeftBtn.SetUpdateCallback(ScreenPositionWindowLeftClick);
|
|
|
|
|
|
|
|
GuiImageData arrowRight(button_arrow_right_png);
|
|
|
|
GuiImage arrowRightImg(&arrowRight);
|
|
|
|
GuiImageData arrowRightOver(button_arrow_right_over_png);
|
|
|
|
GuiImage arrowRightOverImg(&arrowRightOver);
|
|
|
|
GuiButton arrowRightBtn(arrowRight.GetWidth(), arrowRight.GetHeight());
|
|
|
|
arrowRightBtn.SetImage(&arrowRightImg);
|
|
|
|
arrowRightBtn.SetImageOver(&arrowRightOverImg);
|
|
|
|
arrowRightBtn.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
|
|
|
arrowRightBtn.SetTrigger(0, &trigA);
|
|
|
|
arrowRightBtn.SetTrigger(1, &trigRight);
|
|
|
|
arrowRightBtn.SetSelectable(false);
|
|
|
|
arrowRightBtn.SetUpdateCallback(ScreenPositionWindowRightClick);
|
|
|
|
|
|
|
|
GuiImageData arrowUp(button_arrow_up_png);
|
|
|
|
GuiImage arrowUpImg(&arrowUp);
|
|
|
|
GuiImageData arrowUpOver(button_arrow_up_over_png);
|
|
|
|
GuiImage arrowUpOverImg(&arrowUpOver);
|
|
|
|
GuiButton arrowUpBtn(arrowUp.GetWidth(), arrowUp.GetHeight());
|
|
|
|
arrowUpBtn.SetImage(&arrowUpImg);
|
|
|
|
arrowUpBtn.SetImageOver(&arrowUpOverImg);
|
|
|
|
arrowUpBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
arrowUpBtn.SetTrigger(0, &trigA);
|
|
|
|
arrowUpBtn.SetTrigger(1, &trigUp);
|
|
|
|
arrowUpBtn.SetSelectable(false);
|
|
|
|
arrowUpBtn.SetUpdateCallback(ScreenPositionWindowUpClick);
|
|
|
|
|
|
|
|
GuiImageData arrowDown(button_arrow_down_png);
|
|
|
|
GuiImage arrowDownImg(&arrowDown);
|
|
|
|
GuiImageData arrowDownOver(button_arrow_down_over_png);
|
|
|
|
GuiImage arrowDownOverImg(&arrowDownOver);
|
|
|
|
GuiButton arrowDownBtn(arrowDown.GetWidth(), arrowDown.GetHeight());
|
|
|
|
arrowDownBtn.SetImage(&arrowDownImg);
|
|
|
|
arrowDownBtn.SetImageOver(&arrowDownOverImg);
|
|
|
|
arrowDownBtn.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
|
|
arrowDownBtn.SetTrigger(0, &trigA);
|
|
|
|
arrowDownBtn.SetTrigger(1, &trigDown);
|
|
|
|
arrowDownBtn.SetSelectable(false);
|
|
|
|
arrowDownBtn.SetUpdateCallback(ScreenPositionWindowDownClick);
|
|
|
|
|
|
|
|
GuiImageData screenPosition(screen_position_png);
|
|
|
|
GuiImage screenPositionImg(&screenPosition);
|
|
|
|
screenPositionImg.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
|
|
|
|
|
|
settingText = new GuiText(NULL, 22, (GXColor){0, 0, 0, 255});
|
|
|
|
char shift[10];
|
|
|
|
sprintf(shift, "%i, %i", GCSettings.xshift, GCSettings.yshift);
|
|
|
|
settingText->SetText(shift);
|
|
|
|
|
|
|
|
int currentX = GCSettings.xshift;
|
|
|
|
int currentY = GCSettings.yshift;
|
|
|
|
|
|
|
|
w->Append(&arrowLeftBtn);
|
|
|
|
w->Append(&arrowRightBtn);
|
|
|
|
w->Append(&arrowUpBtn);
|
|
|
|
w->Append(&arrowDownBtn);
|
|
|
|
w->Append(&screenPositionImg);
|
|
|
|
w->Append(settingText);
|
|
|
|
|
|
|
|
if(!SettingWindow("Screen Position",w))
|
|
|
|
{
|
2009-11-16 09:14:38 +01:00
|
|
|
// undo changes
|
|
|
|
GCSettings.xshift = currentX;
|
2009-03-28 18:23:08 +01:00
|
|
|
GCSettings.yshift = currentY;
|
|
|
|
}
|
2008-12-30 01:05:57 +01:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
delete(w);
|
|
|
|
delete(settingText);
|
|
|
|
}
|
2008-12-30 01:05:57 +01:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
static int MenuSettingsVideo()
|
|
|
|
{
|
|
|
|
int menu = MENU_NONE;
|
|
|
|
int ret;
|
|
|
|
int i = 0;
|
|
|
|
OptionList options;
|
2009-07-28 00:37:56 +02:00
|
|
|
bool firstRun = true;
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
sprintf(options.name[i++], "Rendering");
|
|
|
|
sprintf(options.name[i++], "Scaling");
|
2009-07-21 08:26:38 +02:00
|
|
|
sprintf(options.name[i++], "Filtering");
|
2009-03-28 18:23:08 +01:00
|
|
|
sprintf(options.name[i++], "Cropping");
|
|
|
|
sprintf(options.name[i++], "Palette");
|
2009-04-22 20:15:36 +02:00
|
|
|
sprintf(options.name[i++], "Game Timing");
|
2009-03-28 18:23:08 +01:00
|
|
|
sprintf(options.name[i++], "Screen Zoom");
|
|
|
|
sprintf(options.name[i++], "Screen Position");
|
2009-04-22 00:08:23 +02:00
|
|
|
sprintf(options.name[i++], "Zapper Crosshair");
|
|
|
|
sprintf(options.name[i++], "Sprite Limit");
|
2009-04-22 20:15:36 +02:00
|
|
|
sprintf(options.name[i++], "Video Mode");
|
2009-03-28 18:23:08 +01:00
|
|
|
options.length = i;
|
|
|
|
|
2009-07-24 08:05:38 +02:00
|
|
|
options.name[2][0] = 0; // hide hq2x since it's not working
|
|
|
|
|
2009-06-27 21:12:47 +02:00
|
|
|
for(i=0; i < options.length; i++)
|
|
|
|
options.value[i][0] = 0;
|
|
|
|
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiText titleTxt("Game Settings - Video", 28, (GXColor){255, 255, 255, 255});
|
2009-03-28 18:23:08 +01:00
|
|
|
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(50,50);
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiText backBtnTxt("Go Back", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage backBtnImg(&btnOutline);
|
|
|
|
GuiImage backBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
2009-06-27 21:12:47 +02:00
|
|
|
backBtn.SetPosition(50, -35);
|
2009-03-28 18:23:08 +01:00
|
|
|
backBtn.SetLabel(&backBtnTxt);
|
|
|
|
backBtn.SetImage(&backBtnImg);
|
|
|
|
backBtn.SetImageOver(&backBtnImgOver);
|
|
|
|
backBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
backBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
backBtn.SetTrigger(&trigA);
|
|
|
|
backBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiOptionBrowser optionBrowser(552, 248, &options);
|
|
|
|
optionBrowser.SetPosition(0, 108);
|
2009-04-22 20:15:36 +02:00
|
|
|
optionBrowser.SetCol2Position(200);
|
2009-03-28 18:23:08 +01:00
|
|
|
optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
w.Append(&backBtn);
|
|
|
|
mainWindow->Append(&optionBrowser);
|
|
|
|
mainWindow->Append(&w);
|
|
|
|
mainWindow->Append(&titleTxt);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
2008-09-02 03:57:21 +02:00
|
|
|
{
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
ret = optionBrowser.GetClickedOption();
|
2008-09-02 03:57:21 +02:00
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
2008-10-23 10:18:40 +02:00
|
|
|
case 0:
|
|
|
|
GCSettings.render++;
|
2008-11-10 04:36:21 +01:00
|
|
|
if (GCSettings.render > 2)
|
2008-10-23 10:18:40 +02:00
|
|
|
GCSettings.render = 0;
|
2008-09-02 03:57:21 +02:00
|
|
|
break;
|
|
|
|
|
2008-10-23 10:18:40 +02:00
|
|
|
case 1:
|
|
|
|
GCSettings.widescreen ^= 1;
|
|
|
|
break;
|
|
|
|
|
2008-11-10 04:36:21 +01:00
|
|
|
case 2:
|
2009-07-21 08:26:38 +02:00
|
|
|
GCSettings.FilterMethod++;
|
|
|
|
if (GCSettings.FilterMethod >= NUM_FILTERS)
|
|
|
|
GCSettings.FilterMethod = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2008-11-10 04:36:21 +01:00
|
|
|
GCSettings.hideoverscan++;
|
2009-01-26 07:36:19 +01:00
|
|
|
if (GCSettings.hideoverscan > 3)
|
2008-11-10 04:36:21 +01:00
|
|
|
GCSettings.hideoverscan = 0;
|
|
|
|
break;
|
|
|
|
|
2009-07-21 08:26:38 +02:00
|
|
|
case 4: // palette
|
2008-09-02 03:57:21 +02:00
|
|
|
if ( ++GCSettings.currpal > MAXPAL )
|
|
|
|
GCSettings.currpal = 0;
|
|
|
|
break;
|
|
|
|
|
2009-07-21 08:26:38 +02:00
|
|
|
case 5: // timing
|
2008-09-02 03:57:21 +02:00
|
|
|
GCSettings.timing ^= 1;
|
|
|
|
break;
|
|
|
|
|
2009-07-21 08:26:38 +02:00
|
|
|
case 6:
|
2009-03-28 18:23:08 +01:00
|
|
|
ScreenZoomWindow();
|
|
|
|
break;
|
|
|
|
|
2009-07-21 08:26:38 +02:00
|
|
|
case 7:
|
2009-03-28 18:23:08 +01:00
|
|
|
ScreenPositionWindow();
|
2008-09-02 03:57:21 +02:00
|
|
|
break;
|
2009-04-22 00:08:23 +02:00
|
|
|
|
2009-07-21 08:26:38 +02:00
|
|
|
case 8:
|
2009-04-22 00:08:23 +02:00
|
|
|
GCSettings.crosshair ^= 1;
|
|
|
|
break;
|
|
|
|
|
2009-07-21 08:26:38 +02:00
|
|
|
case 9:
|
2009-04-22 00:08:23 +02:00
|
|
|
GCSettings.spritelimit ^= 1;
|
|
|
|
break;
|
2009-07-21 08:26:38 +02:00
|
|
|
|
|
|
|
case 10:
|
2009-04-22 20:15:36 +02:00
|
|
|
GCSettings.videomode++;
|
|
|
|
if(GCSettings.videomode > 4)
|
|
|
|
GCSettings.videomode = 0;
|
|
|
|
break;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-07-28 00:37:56 +02:00
|
|
|
if(ret >= 0 || firstRun)
|
|
|
|
{
|
|
|
|
firstRun = false;
|
|
|
|
|
|
|
|
// don't allow original render mode if progressive video mode detected
|
|
|
|
if (GCSettings.render==0 && progressive)
|
|
|
|
GCSettings.render++;
|
|
|
|
|
|
|
|
if (GCSettings.render == 0)
|
|
|
|
sprintf (options.value[0], "Original");
|
|
|
|
else if (GCSettings.render == 1)
|
|
|
|
sprintf (options.value[0], "Filtered");
|
|
|
|
else if (GCSettings.render == 2)
|
|
|
|
sprintf (options.value[0], "Unfiltered");
|
|
|
|
|
|
|
|
if(GCSettings.widescreen)
|
|
|
|
sprintf (options.value[1], "16:9 Correction");
|
|
|
|
else
|
|
|
|
sprintf (options.value[1], "Default");
|
|
|
|
|
|
|
|
sprintf (options.value[2], "%s", GetFilterName((RenderFilter)GCSettings.FilterMethod));
|
|
|
|
|
|
|
|
switch(GCSettings.hideoverscan)
|
|
|
|
{
|
|
|
|
case 0: sprintf (options.value[3], "Off"); break;
|
|
|
|
case 1: sprintf (options.value[3], "Vertical"); break;
|
|
|
|
case 2: sprintf (options.value[3], "Horizontal"); break;
|
|
|
|
case 3: sprintf (options.value[3], "Both"); break;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintf (options.value[4], "%s",
|
2009-09-21 07:17:10 +02:00
|
|
|
GCSettings.currpal ? palettes[GCSettings.currpal-1].desc : "Default");
|
2009-07-28 00:37:56 +02:00
|
|
|
|
|
|
|
sprintf (options.value[5], "%s", GCSettings.timing == 1 ? "PAL" : "NTSC");
|
2009-11-16 09:14:38 +01:00
|
|
|
sprintf (options.value[6], "%.2f%%, %.2f%%", GCSettings.zoomHor*100, GCSettings.zoomVert*100);
|
2009-07-28 00:37:56 +02:00
|
|
|
sprintf (options.value[7], "%d, %d", GCSettings.xshift, GCSettings.yshift);
|
|
|
|
sprintf (options.value[8], "%s", GCSettings.crosshair == 1 ? "On" : "Off");
|
|
|
|
sprintf (options.value[9], "%s", GCSettings.spritelimit == 1 ? "On" : "Off");
|
|
|
|
|
|
|
|
switch(GCSettings.videomode)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
sprintf (options.value[10], "Automatic (Recommended)"); break;
|
|
|
|
case 1:
|
|
|
|
sprintf (options.value[10], "NTSC (480i)"); break;
|
|
|
|
case 2:
|
|
|
|
sprintf (options.value[10], "Progressive (480p)"); break;
|
|
|
|
case 3:
|
|
|
|
sprintf (options.value[10], "PAL (50Hz)"); break;
|
|
|
|
case 4:
|
|
|
|
sprintf (options.value[10], "PAL (60Hz)"); break;
|
|
|
|
}
|
|
|
|
optionBrowser.TriggerUpdate();
|
|
|
|
}
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
if(backBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-04-13 21:48:24 +02:00
|
|
|
menu = MENU_GAMESETTINGS;
|
2008-09-02 03:57:21 +02:00
|
|
|
}
|
|
|
|
}
|
2009-03-28 18:23:08 +01:00
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&optionBrowser);
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
mainWindow->Remove(&titleTxt);
|
|
|
|
return menu;
|
2008-09-02 03:57:21 +02:00
|
|
|
}
|
|
|
|
|
2009-04-13 21:48:24 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* MenuSettings
|
|
|
|
***************************************************************************/
|
|
|
|
static int MenuSettings()
|
|
|
|
{
|
|
|
|
int menu = MENU_NONE;
|
2009-10-07 08:59:10 +02:00
|
|
|
char s[10];
|
2009-04-13 21:48:24 +02:00
|
|
|
|
|
|
|
GuiText titleTxt("Settings", 28, (GXColor){255, 255, 255, 255});
|
|
|
|
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(50,50);
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
|
|
|
GuiImageData btnLargeOutline(button_large_png);
|
|
|
|
GuiImageData btnLargeOutlineOver(button_large_over_png);
|
|
|
|
GuiImageData iconFile(icon_settings_file_png);
|
|
|
|
GuiImageData iconMenu(icon_settings_menu_png);
|
|
|
|
GuiImageData iconNetwork(icon_settings_network_png);
|
2009-10-07 08:59:10 +02:00
|
|
|
GuiImageData iconCheats(icon_game_cheats_png);
|
2009-04-13 21:48:24 +02:00
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiText savingBtnTxt1("Saving", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiText savingBtnTxt2("&", 18, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiText savingBtnTxt3("Loading", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
savingBtnTxt1.SetPosition(0, -20);
|
|
|
|
savingBtnTxt3.SetPosition(0, +20);
|
|
|
|
GuiImage savingBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage savingBtnImgOver(&btnLargeOutlineOver);
|
|
|
|
GuiImage fileBtnIcon(&iconFile);
|
|
|
|
GuiButton savingBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
|
|
|
savingBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
savingBtn.SetPosition(-125, 120);
|
|
|
|
savingBtn.SetLabel(&savingBtnTxt1, 0);
|
|
|
|
savingBtn.SetLabel(&savingBtnTxt2, 1);
|
|
|
|
savingBtn.SetLabel(&savingBtnTxt3, 2);
|
|
|
|
savingBtn.SetImage(&savingBtnImg);
|
|
|
|
savingBtn.SetImageOver(&savingBtnImgOver);
|
|
|
|
savingBtn.SetIcon(&fileBtnIcon);
|
|
|
|
savingBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
savingBtn.SetSoundClick(&btnSoundClick);
|
|
|
|
savingBtn.SetTrigger(&trigA);
|
|
|
|
savingBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText menuBtnTxt("Menu", 24, (GXColor){0, 0, 0, 255});
|
2009-06-27 21:12:47 +02:00
|
|
|
menuBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-30);
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiImage menuBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage menuBtnImgOver(&btnLargeOutlineOver);
|
|
|
|
GuiImage menuBtnIcon(&iconMenu);
|
|
|
|
GuiButton menuBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
|
|
|
menuBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
menuBtn.SetPosition(125, 120);
|
|
|
|
menuBtn.SetLabel(&menuBtnTxt);
|
|
|
|
menuBtn.SetImage(&menuBtnImg);
|
|
|
|
menuBtn.SetImageOver(&menuBtnImgOver);
|
|
|
|
menuBtn.SetIcon(&menuBtnIcon);
|
|
|
|
menuBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
menuBtn.SetSoundClick(&btnSoundClick);
|
|
|
|
menuBtn.SetTrigger(&trigA);
|
|
|
|
menuBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText networkBtnTxt("Network", 24, (GXColor){0, 0, 0, 255});
|
2009-06-27 21:12:47 +02:00
|
|
|
networkBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-30);
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiImage networkBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage networkBtnImgOver(&btnLargeOutlineOver);
|
|
|
|
GuiImage networkBtnIcon(&iconNetwork);
|
|
|
|
GuiButton networkBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
|
|
|
networkBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-10-07 08:59:10 +02:00
|
|
|
networkBtn.SetPosition(-125, 250);
|
2009-04-13 21:48:24 +02:00
|
|
|
networkBtn.SetLabel(&networkBtnTxt);
|
|
|
|
networkBtn.SetImage(&networkBtnImg);
|
|
|
|
networkBtn.SetImageOver(&networkBtnImgOver);
|
|
|
|
networkBtn.SetIcon(&networkBtnIcon);
|
|
|
|
networkBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
networkBtn.SetSoundClick(&btnSoundClick);
|
|
|
|
networkBtn.SetTrigger(&trigA);
|
|
|
|
networkBtn.SetEffectGrow();
|
|
|
|
|
2009-10-07 08:59:10 +02:00
|
|
|
if(!FindGameGenie()) sprintf(s, "DISABLED");
|
|
|
|
else if(GCSettings.gamegenie) sprintf(s, "ON");
|
|
|
|
else sprintf(s, "OFF");
|
|
|
|
GuiText cheatsBtnTxt("Game Genie", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiText cheatsBtnTxt2(s, 18, (GXColor){0, 0, 0, 255});
|
|
|
|
cheatsBtnTxt.SetPosition(0, -16);
|
|
|
|
cheatsBtnTxt2.SetPosition(0, +8);
|
|
|
|
GuiImage cheatsBtnImg(&btnLargeOutline);
|
|
|
|
GuiImage cheatsBtnImgOver(&btnLargeOutlineOver);
|
|
|
|
GuiImage cheatsBtnIcon(&iconCheats);
|
|
|
|
GuiButton cheatsBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
|
|
|
|
cheatsBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
cheatsBtn.SetPosition(125, 250);
|
|
|
|
cheatsBtn.SetLabel(&cheatsBtnTxt, 0);
|
|
|
|
cheatsBtn.SetLabel(&cheatsBtnTxt2, 1);
|
|
|
|
cheatsBtn.SetImage(&cheatsBtnImg);
|
|
|
|
cheatsBtn.SetImageOver(&cheatsBtnImgOver);
|
|
|
|
cheatsBtn.SetIcon(&cheatsBtnIcon);
|
|
|
|
cheatsBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
cheatsBtn.SetSoundClick(&btnSoundClick);
|
|
|
|
cheatsBtn.SetTrigger(&trigA);
|
|
|
|
cheatsBtn.SetEffectGrow();
|
|
|
|
|
2009-04-13 21:48:24 +02:00
|
|
|
GuiText backBtnTxt("Go Back", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage backBtnImg(&btnOutline);
|
|
|
|
GuiImage backBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
backBtn.SetPosition(100, -35);
|
|
|
|
backBtn.SetLabel(&backBtnTxt);
|
|
|
|
backBtn.SetImage(&backBtnImg);
|
|
|
|
backBtn.SetImageOver(&backBtnImgOver);
|
|
|
|
backBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
backBtn.SetSoundClick(&btnSoundClick);
|
|
|
|
backBtn.SetTrigger(&trigA);
|
|
|
|
backBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText resetBtnTxt("Reset Settings", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage resetBtnImg(&btnOutline);
|
|
|
|
GuiImage resetBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton resetBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
resetBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
resetBtn.SetPosition(-100, -35);
|
|
|
|
resetBtn.SetLabel(&resetBtnTxt);
|
|
|
|
resetBtn.SetImage(&resetBtnImg);
|
|
|
|
resetBtn.SetImageOver(&resetBtnImgOver);
|
|
|
|
resetBtn.SetSoundOver(&btnSoundOver);
|
|
|
|
resetBtn.SetSoundClick(&btnSoundClick);
|
|
|
|
resetBtn.SetTrigger(&trigA);
|
|
|
|
resetBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
w.Append(&titleTxt);
|
|
|
|
w.Append(&savingBtn);
|
|
|
|
w.Append(&menuBtn);
|
|
|
|
|
|
|
|
#ifdef HW_RVL
|
|
|
|
w.Append(&networkBtn);
|
|
|
|
#endif
|
|
|
|
|
2009-10-07 08:59:10 +02:00
|
|
|
w.Append(&cheatsBtn);
|
2009-04-13 21:48:24 +02:00
|
|
|
w.Append(&backBtn);
|
|
|
|
w.Append(&resetBtn);
|
|
|
|
|
|
|
|
mainWindow->Append(&w);
|
|
|
|
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
|
|
|
{
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-04-13 21:48:24 +02:00
|
|
|
|
|
|
|
if(savingBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_SETTINGS_FILE;
|
|
|
|
}
|
|
|
|
else if(menuBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_SETTINGS_MENU;
|
|
|
|
}
|
|
|
|
else if(networkBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_SETTINGS_NETWORK;
|
|
|
|
}
|
2009-10-07 08:59:10 +02:00
|
|
|
else if(cheatsBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
cheatsBtn.ResetState();
|
|
|
|
|
|
|
|
if(!FindGameGenie())
|
|
|
|
{
|
|
|
|
ErrorPrompt("Game Genie ROM not found!");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GCSettings.gamegenie ^= 1;
|
|
|
|
if (GCSettings.gamegenie) sprintf(s, "ON");
|
|
|
|
else sprintf(s, "OFF");
|
|
|
|
cheatsBtnTxt2.SetText(s);
|
|
|
|
}
|
|
|
|
}
|
2009-04-13 21:48:24 +02:00
|
|
|
else if(backBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_GAMESELECTION;
|
|
|
|
}
|
|
|
|
else if(resetBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
resetBtn.ResetState();
|
|
|
|
|
|
|
|
int choice = WindowPrompt(
|
|
|
|
"Reset Settings",
|
|
|
|
"Are you sure that you want to reset your settings?",
|
|
|
|
"Yes",
|
|
|
|
"No");
|
|
|
|
|
|
|
|
if(choice == 1)
|
|
|
|
DefaultSettings();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
2008-09-02 03:57:21 +02:00
|
|
|
/****************************************************************************
|
2009-03-28 18:23:08 +01:00
|
|
|
* MenuSettingsFile
|
|
|
|
***************************************************************************/
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
static int MenuSettingsFile()
|
2008-12-30 01:05:57 +01:00
|
|
|
{
|
2009-03-28 18:23:08 +01:00
|
|
|
int menu = MENU_NONE;
|
|
|
|
int ret;
|
|
|
|
int i = 0;
|
2009-07-28 00:37:56 +02:00
|
|
|
bool firstRun = true;
|
2009-03-28 18:23:08 +01:00
|
|
|
OptionList options;
|
2009-03-30 10:22:55 +02:00
|
|
|
sprintf(options.name[i++], "Load Device");
|
|
|
|
sprintf(options.name[i++], "Save Device");
|
2009-03-28 18:23:08 +01:00
|
|
|
sprintf(options.name[i++], "Load Folder");
|
|
|
|
sprintf(options.name[i++], "Save Folder");
|
2009-03-30 10:22:55 +02:00
|
|
|
sprintf(options.name[i++], "Cheats Folder");
|
2009-03-28 18:23:08 +01:00
|
|
|
sprintf(options.name[i++], "Auto Load");
|
|
|
|
sprintf(options.name[i++], "Auto Save");
|
|
|
|
options.length = i;
|
|
|
|
|
2009-06-27 21:12:47 +02:00
|
|
|
for(i=0; i < options.length; i++)
|
|
|
|
options.value[i][0] = 0;
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiText titleTxt("Settings - Saving & Loading", 28, (GXColor){255, 255, 255, 255});
|
|
|
|
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(50,50);
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiText backBtnTxt("Go Back", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage backBtnImg(&btnOutline);
|
|
|
|
GuiImage backBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
backBtn.SetPosition(100, -35);
|
|
|
|
backBtn.SetLabel(&backBtnTxt);
|
|
|
|
backBtn.SetImage(&backBtnImg);
|
|
|
|
backBtn.SetImageOver(&backBtnImgOver);
|
|
|
|
backBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
backBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
backBtn.SetTrigger(&trigA);
|
|
|
|
backBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiOptionBrowser optionBrowser(552, 248, &options);
|
|
|
|
optionBrowser.SetPosition(0, 108);
|
|
|
|
optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
2009-03-30 10:22:55 +02:00
|
|
|
optionBrowser.SetCol2Position(185);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
w.Append(&backBtn);
|
|
|
|
mainWindow->Append(&optionBrowser);
|
|
|
|
mainWindow->Append(&w);
|
|
|
|
mainWindow->Append(&titleTxt);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
2008-09-02 03:57:21 +02:00
|
|
|
{
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2009-03-28 18:23:08 +01:00
|
|
|
|
|
|
|
ret = optionBrowser.GetClickedOption();
|
2008-09-02 03:57:21 +02:00
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
2009-03-30 10:22:55 +02:00
|
|
|
GCSettings.LoadMethod++;
|
2008-09-02 03:57:21 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2009-03-30 10:22:55 +02:00
|
|
|
GCSettings.SaveMethod++;
|
2008-09-02 03:57:21 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2009-07-08 07:57:43 +02:00
|
|
|
OnScreenKeyboard(GCSettings.LoadFolder, MAXPATHLEN);
|
2008-09-02 03:57:21 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2009-07-08 07:57:43 +02:00
|
|
|
OnScreenKeyboard(GCSettings.SaveFolder, MAXPATHLEN);
|
2008-09-02 03:57:21 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
2009-07-08 07:57:43 +02:00
|
|
|
OnScreenKeyboard(GCSettings.CheatFolder, MAXPATHLEN);
|
2009-03-30 10:22:55 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
GCSettings.AutoLoad++;
|
2008-09-06 05:30:42 +02:00
|
|
|
if (GCSettings.AutoLoad > 2)
|
2008-09-02 03:57:21 +02:00
|
|
|
GCSettings.AutoLoad = 0;
|
|
|
|
break;
|
|
|
|
|
2009-03-30 10:22:55 +02:00
|
|
|
case 6:
|
|
|
|
GCSettings.AutoSave++;
|
2008-09-06 05:30:42 +02:00
|
|
|
if (GCSettings.AutoSave > 3)
|
2008-09-02 03:57:21 +02:00
|
|
|
GCSettings.AutoSave = 0;
|
|
|
|
break;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-07-28 00:37:56 +02:00
|
|
|
if(ret >= 0 || firstRun)
|
|
|
|
{
|
|
|
|
firstRun = false;
|
|
|
|
|
|
|
|
// some load/save methods are not implemented - here's where we skip them
|
|
|
|
// they need to be skipped in the order they were enumerated in snes9xGX.h
|
|
|
|
|
|
|
|
// no USB ports on GameCube
|
|
|
|
#ifdef HW_DOL
|
2009-10-02 00:21:25 +02:00
|
|
|
if(GCSettings.LoadMethod == DEVICE_USB)
|
2009-07-28 00:37:56 +02:00
|
|
|
GCSettings.LoadMethod++;
|
2009-10-02 00:21:25 +02:00
|
|
|
if(GCSettings.SaveMethod == DEVICE_USB)
|
2009-07-28 00:37:56 +02:00
|
|
|
GCSettings.SaveMethod++;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// saving to DVD is impossible
|
2009-10-02 00:21:25 +02:00
|
|
|
if(GCSettings.SaveMethod == DEVICE_DVD)
|
2009-07-28 00:37:56 +02:00
|
|
|
GCSettings.SaveMethod++;
|
|
|
|
|
|
|
|
// disable SMB in GC mode (stalls out)
|
|
|
|
#ifdef HW_DOL
|
2009-10-02 00:21:25 +02:00
|
|
|
if(GCSettings.LoadMethod == DEVICE_SMB)
|
2009-07-28 00:37:56 +02:00
|
|
|
GCSettings.LoadMethod++;
|
2009-10-02 00:21:25 +02:00
|
|
|
if(GCSettings.SaveMethod == DEVICE_SMB)
|
2009-07-28 00:37:56 +02:00
|
|
|
GCSettings.SaveMethod++;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// correct load/save methods out of bounds
|
|
|
|
if(GCSettings.LoadMethod > 4)
|
|
|
|
GCSettings.LoadMethod = 0;
|
2009-12-02 07:42:30 +01:00
|
|
|
if(GCSettings.SaveMethod > 4)
|
2009-07-28 00:37:56 +02:00
|
|
|
GCSettings.SaveMethod = 0;
|
|
|
|
|
2009-10-02 00:21:25 +02:00
|
|
|
if (GCSettings.LoadMethod == DEVICE_AUTO) sprintf (options.value[0],"Auto Detect");
|
|
|
|
else if (GCSettings.LoadMethod == DEVICE_SD) sprintf (options.value[0],"SD");
|
|
|
|
else if (GCSettings.LoadMethod == DEVICE_USB) sprintf (options.value[0],"USB");
|
|
|
|
else if (GCSettings.LoadMethod == DEVICE_DVD) sprintf (options.value[0],"DVD");
|
|
|
|
else if (GCSettings.LoadMethod == DEVICE_SMB) sprintf (options.value[0],"Network");
|
|
|
|
|
|
|
|
if (GCSettings.SaveMethod == DEVICE_AUTO) sprintf (options.value[1],"Auto Detect");
|
|
|
|
else if (GCSettings.SaveMethod == DEVICE_SD) sprintf (options.value[1],"SD");
|
|
|
|
else if (GCSettings.SaveMethod == DEVICE_USB) sprintf (options.value[1],"USB");
|
|
|
|
else if (GCSettings.SaveMethod == DEVICE_SMB) sprintf (options.value[1],"Network");
|
2009-07-28 00:37:56 +02:00
|
|
|
|
|
|
|
snprintf (options.value[2], 30, "%s", GCSettings.LoadFolder);
|
|
|
|
snprintf (options.value[3], 30, "%s", GCSettings.SaveFolder);
|
|
|
|
snprintf (options.value[4], 30, "%s", GCSettings.CheatFolder);
|
|
|
|
|
|
|
|
if (GCSettings.AutoLoad == 0) sprintf (options.value[5],"Off");
|
|
|
|
else if (GCSettings.AutoLoad == 1) sprintf (options.value[5],"RAM");
|
|
|
|
else if (GCSettings.AutoLoad == 2) sprintf (options.value[5],"State");
|
|
|
|
|
|
|
|
if (GCSettings.AutoSave == 0) sprintf (options.value[6],"Off");
|
|
|
|
else if (GCSettings.AutoSave == 1) sprintf (options.value[6],"RAM");
|
|
|
|
else if (GCSettings.AutoSave == 2) sprintf (options.value[6],"State");
|
|
|
|
else if (GCSettings.AutoSave == 3) sprintf (options.value[6],"Both");
|
|
|
|
|
|
|
|
optionBrowser.TriggerUpdate();
|
|
|
|
}
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
if(backBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_SETTINGS;
|
2008-09-02 03:57:21 +02:00
|
|
|
}
|
|
|
|
}
|
2009-03-28 18:23:08 +01:00
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&optionBrowser);
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
mainWindow->Remove(&titleTxt);
|
|
|
|
return menu;
|
2008-09-02 03:57:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2009-03-28 18:23:08 +01:00
|
|
|
* MenuSettingsMenu
|
|
|
|
***************************************************************************/
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
static int MenuSettingsMenu()
|
|
|
|
{
|
|
|
|
int menu = MENU_NONE;
|
|
|
|
int ret;
|
|
|
|
int i = 0;
|
2009-07-28 00:37:56 +02:00
|
|
|
bool firstRun = true;
|
2009-03-28 18:23:08 +01:00
|
|
|
OptionList options;
|
|
|
|
|
|
|
|
sprintf(options.name[i++], "Exit Action");
|
|
|
|
sprintf(options.name[i++], "Wiimote Orientation");
|
|
|
|
sprintf(options.name[i++], "Music Volume");
|
|
|
|
sprintf(options.name[i++], "Sound Effects Volume");
|
2009-05-20 07:26:32 +02:00
|
|
|
sprintf(options.name[i++], "Rumble");
|
2010-01-25 22:04:44 +01:00
|
|
|
sprintf(options.name[i++], "Language");
|
2009-03-28 18:23:08 +01:00
|
|
|
options.length = i;
|
|
|
|
|
2009-06-27 21:12:47 +02:00
|
|
|
for(i=0; i < options.length; i++)
|
|
|
|
options.value[i][0] = 0;
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiText titleTxt("Settings - Menu", 28, (GXColor){255, 255, 255, 255});
|
|
|
|
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(50,50);
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiText backBtnTxt("Go Back", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage backBtnImg(&btnOutline);
|
|
|
|
GuiImage backBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
backBtn.SetPosition(100, -35);
|
|
|
|
backBtn.SetLabel(&backBtnTxt);
|
|
|
|
backBtn.SetImage(&backBtnImg);
|
|
|
|
backBtn.SetImageOver(&backBtnImgOver);
|
|
|
|
backBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
backBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
backBtn.SetTrigger(&trigA);
|
|
|
|
backBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiOptionBrowser optionBrowser(552, 248, &options);
|
|
|
|
optionBrowser.SetPosition(0, 108);
|
|
|
|
optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
w.Append(&backBtn);
|
|
|
|
mainWindow->Append(&optionBrowser);
|
|
|
|
mainWindow->Append(&w);
|
|
|
|
mainWindow->Append(&titleTxt);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
2008-09-02 03:57:21 +02:00
|
|
|
{
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2008-10-09 06:51:14 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
ret = optionBrowser.GetClickedOption();
|
2008-09-02 03:57:21 +02:00
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
2009-03-28 18:23:08 +01:00
|
|
|
case 0:
|
|
|
|
GCSettings.ExitAction++;
|
2009-05-20 07:26:32 +02:00
|
|
|
if(GCSettings.ExitAction > 3)
|
2009-03-28 18:23:08 +01:00
|
|
|
GCSettings.ExitAction = 0;
|
2008-09-06 05:30:42 +02:00
|
|
|
break;
|
2009-03-28 18:23:08 +01:00
|
|
|
case 1:
|
|
|
|
GCSettings.WiimoteOrientation ^= 1;
|
2008-09-02 03:57:21 +02:00
|
|
|
break;
|
2009-03-28 18:23:08 +01:00
|
|
|
case 2:
|
|
|
|
GCSettings.MusicVolume += 10;
|
|
|
|
if(GCSettings.MusicVolume > 100)
|
|
|
|
GCSettings.MusicVolume = 0;
|
|
|
|
bgMusic->SetVolume(GCSettings.MusicVolume);
|
2008-09-02 03:57:21 +02:00
|
|
|
break;
|
2009-03-28 18:23:08 +01:00
|
|
|
case 3:
|
|
|
|
GCSettings.SFXVolume += 10;
|
|
|
|
if(GCSettings.SFXVolume > 100)
|
|
|
|
GCSettings.SFXVolume = 0;
|
2008-10-24 07:38:46 +02:00
|
|
|
break;
|
2009-05-20 07:26:32 +02:00
|
|
|
case 4:
|
|
|
|
GCSettings.Rumble ^= 1;
|
|
|
|
break;
|
2010-01-25 22:04:44 +01:00
|
|
|
case 5:
|
|
|
|
GCSettings.language++;
|
|
|
|
if(GCSettings.language > LANG_KOREAN)
|
|
|
|
GCSettings.language = 0;
|
|
|
|
break;
|
2009-03-28 18:23:08 +01:00
|
|
|
}
|
2008-10-24 07:38:46 +02:00
|
|
|
|
2009-07-28 00:37:56 +02:00
|
|
|
if(ret >= 0 || firstRun)
|
|
|
|
{
|
|
|
|
firstRun = false;
|
|
|
|
|
|
|
|
#ifdef HW_RVL
|
|
|
|
if (GCSettings.ExitAction == 1)
|
|
|
|
sprintf (options.value[0], "Return to Wii Menu");
|
|
|
|
else if (GCSettings.ExitAction == 2)
|
|
|
|
sprintf (options.value[0], "Power off Wii");
|
|
|
|
else if (GCSettings.ExitAction == 3)
|
|
|
|
sprintf (options.value[0], "Return to Loader");
|
|
|
|
else
|
|
|
|
sprintf (options.value[0], "Auto");
|
|
|
|
#else // GameCube
|
|
|
|
if(GCSettings.ExitAction > 1)
|
|
|
|
GCSettings.ExitAction = 0;
|
|
|
|
if (GCSettings.ExitAction == 0)
|
|
|
|
sprintf (options.value[0], "Return to Loader");
|
|
|
|
else
|
|
|
|
sprintf (options.value[0], "Reboot");
|
|
|
|
|
|
|
|
options.name[1][0] = 0; // Wiimote
|
|
|
|
options.name[2][0] = 0; // Music
|
|
|
|
options.name[3][0] = 0; // Sound Effects
|
|
|
|
options.name[4][0] = 0; // Rumble
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (GCSettings.WiimoteOrientation == 0)
|
|
|
|
sprintf (options.value[1], "Vertical");
|
|
|
|
else if (GCSettings.WiimoteOrientation == 1)
|
|
|
|
sprintf (options.value[1], "Horizontal");
|
|
|
|
|
|
|
|
if(GCSettings.MusicVolume > 0)
|
|
|
|
sprintf(options.value[2], "%d%%", GCSettings.MusicVolume);
|
|
|
|
else
|
|
|
|
sprintf(options.value[2], "Mute");
|
|
|
|
|
|
|
|
if(GCSettings.SFXVolume > 0)
|
|
|
|
sprintf(options.value[3], "%d%%", GCSettings.SFXVolume);
|
|
|
|
else
|
|
|
|
sprintf(options.value[3], "Mute");
|
|
|
|
|
|
|
|
if (GCSettings.Rumble == 1)
|
|
|
|
sprintf (options.value[4], "Enabled");
|
|
|
|
else
|
|
|
|
sprintf (options.value[4], "Disabled");
|
|
|
|
|
2010-01-25 22:04:44 +01:00
|
|
|
switch(GCSettings.language)
|
|
|
|
{
|
|
|
|
case LANG_JAPANESE: sprintf(options.value[5], "Japanese"); break;
|
|
|
|
case LANG_ENGLISH: sprintf(options.value[5], "English"); break;
|
|
|
|
case LANG_GERMAN: sprintf(options.value[5], "German"); break;
|
|
|
|
case LANG_FRENCH: sprintf(options.value[5], "French"); break;
|
|
|
|
case LANG_SPANISH: sprintf(options.value[5], "Spanish"); break;
|
|
|
|
case LANG_ITALIAN: sprintf(options.value[5], "Italian"); break;
|
|
|
|
case LANG_DUTCH: sprintf(options.value[5], "Dutch"); break;
|
|
|
|
case LANG_SIMP_CHINESE: sprintf(options.value[5], "Chinese (Simplified)"); break;
|
|
|
|
case LANG_TRAD_CHINESE: sprintf(options.value[5], "Chinese (Traditional)"); break;
|
|
|
|
case LANG_KOREAN: sprintf(options.value[5], "Korean"); break;
|
|
|
|
}
|
|
|
|
|
2009-07-28 00:37:56 +02:00
|
|
|
optionBrowser.TriggerUpdate();
|
|
|
|
}
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
if(backBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_SETTINGS;
|
2008-09-02 03:57:21 +02:00
|
|
|
}
|
|
|
|
}
|
2009-03-28 18:23:08 +01:00
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&optionBrowser);
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
mainWindow->Remove(&titleTxt);
|
2010-01-25 22:04:44 +01:00
|
|
|
ResetText();
|
2009-03-28 18:23:08 +01:00
|
|
|
return menu;
|
2008-09-02 03:57:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2009-03-28 18:23:08 +01:00
|
|
|
* MenuSettingsNetwork
|
|
|
|
***************************************************************************/
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
static int MenuSettingsNetwork()
|
|
|
|
{
|
|
|
|
int menu = MENU_NONE;
|
2008-09-02 03:57:21 +02:00
|
|
|
#ifdef HW_RVL
|
2009-03-28 18:23:08 +01:00
|
|
|
int ret;
|
|
|
|
int i = 0;
|
2009-07-28 00:37:56 +02:00
|
|
|
bool firstRun = true;
|
2009-03-28 18:23:08 +01:00
|
|
|
OptionList options;
|
|
|
|
sprintf(options.name[i++], "SMB Share IP");
|
|
|
|
sprintf(options.name[i++], "SMB Share Name");
|
|
|
|
sprintf(options.name[i++], "SMB Share Username");
|
|
|
|
sprintf(options.name[i++], "SMB Share Password");
|
|
|
|
options.length = i;
|
|
|
|
|
2009-06-27 21:12:47 +02:00
|
|
|
for(i=0; i < options.length; i++)
|
|
|
|
options.value[i][0] = 0;
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiText titleTxt("Settings - Network", 28, (GXColor){255, 255, 255, 255});
|
|
|
|
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
|
|
|
titleTxt.SetPosition(50,50);
|
|
|
|
|
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
2009-04-05 05:11:38 +02:00
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData btnOutline(button_png);
|
|
|
|
GuiImageData btnOutlineOver(button_over_png);
|
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
|
|
|
GuiText backBtnTxt("Go Back", 24, (GXColor){0, 0, 0, 255});
|
|
|
|
GuiImage backBtnImg(&btnOutline);
|
|
|
|
GuiImage backBtnImgOver(&btnOutlineOver);
|
|
|
|
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
backBtn.SetPosition(100, -35);
|
|
|
|
backBtn.SetLabel(&backBtnTxt);
|
|
|
|
backBtn.SetImage(&backBtnImg);
|
|
|
|
backBtn.SetImageOver(&backBtnImgOver);
|
|
|
|
backBtn.SetSoundOver(&btnSoundOver);
|
2009-04-05 05:11:38 +02:00
|
|
|
backBtn.SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
backBtn.SetTrigger(&trigA);
|
|
|
|
backBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiOptionBrowser optionBrowser(552, 248, &options);
|
|
|
|
optionBrowser.SetPosition(0, 108);
|
|
|
|
optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w(screenwidth, screenheight);
|
|
|
|
w.Append(&backBtn);
|
|
|
|
mainWindow->Append(&optionBrowser);
|
|
|
|
mainWindow->Append(&w);
|
|
|
|
mainWindow->Append(&titleTxt);
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while(menu == MENU_NONE)
|
2008-09-02 03:57:21 +02:00
|
|
|
{
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
ret = optionBrowser.GetClickedOption();
|
2008-09-02 03:57:21 +02:00
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
2009-12-23 23:55:25 +01:00
|
|
|
OnScreenKeyboard(GCSettings.smbip, 80);
|
2009-03-28 18:23:08 +01:00
|
|
|
break;
|
|
|
|
|
2008-09-02 03:57:21 +02:00
|
|
|
case 1:
|
2009-03-30 10:22:55 +02:00
|
|
|
OnScreenKeyboard(GCSettings.smbshare, 20);
|
2009-03-28 18:23:08 +01:00
|
|
|
break;
|
|
|
|
|
2008-09-02 03:57:21 +02:00
|
|
|
case 2:
|
2009-03-30 10:22:55 +02:00
|
|
|
OnScreenKeyboard(GCSettings.smbuser, 20);
|
2008-09-02 03:57:21 +02:00
|
|
|
break;
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
case 3:
|
2009-03-30 10:22:55 +02:00
|
|
|
OnScreenKeyboard(GCSettings.smbpwd, 20);
|
2008-09-02 03:57:21 +02:00
|
|
|
break;
|
|
|
|
}
|
2009-03-28 18:23:08 +01:00
|
|
|
|
2009-07-28 00:37:56 +02:00
|
|
|
if(ret >= 0 || firstRun)
|
|
|
|
{
|
|
|
|
firstRun = false;
|
|
|
|
|
2009-12-23 23:55:25 +01:00
|
|
|
strncpy (options.value[0], GCSettings.smbip, 25);
|
|
|
|
options.value[0][25] = 0;
|
2009-07-28 00:37:56 +02:00
|
|
|
strncpy (options.value[1], GCSettings.smbshare, 19);
|
|
|
|
strncpy (options.value[2], GCSettings.smbuser, 19);
|
|
|
|
strncpy (options.value[3], GCSettings.smbpwd, 19);
|
|
|
|
|
|
|
|
optionBrowser.TriggerUpdate();
|
|
|
|
}
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
if(backBtn.GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
menu = MENU_SETTINGS;
|
|
|
|
}
|
2008-09-02 03:57:21 +02:00
|
|
|
}
|
2009-03-28 18:23:08 +01:00
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove(&optionBrowser);
|
|
|
|
mainWindow->Remove(&w);
|
|
|
|
mainWindow->Remove(&titleTxt);
|
|
|
|
#endif
|
|
|
|
return menu;
|
|
|
|
}
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* MainMenu
|
|
|
|
***************************************************************************/
|
2008-12-30 01:05:57 +01:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
void
|
|
|
|
MainMenu (int menu)
|
|
|
|
{
|
|
|
|
int currentMenu = menu;
|
|
|
|
lastMenu = MENU_NONE;
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
#ifdef HW_RVL
|
|
|
|
pointer[0] = new GuiImageData(player1_point_png);
|
|
|
|
pointer[1] = new GuiImageData(player2_point_png);
|
|
|
|
pointer[2] = new GuiImageData(player3_point_png);
|
|
|
|
pointer[3] = new GuiImageData(player4_point_png);
|
2008-09-02 03:57:21 +02:00
|
|
|
#endif
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
mainWindow = new GuiWindow(screenwidth, screenheight);
|
2008-09-04 04:46:04 +02:00
|
|
|
|
2009-03-31 09:13:20 +02:00
|
|
|
bgImg = new GuiImage(screenwidth, screenheight, (GXColor){240, 225, 230, 255});
|
2009-03-28 18:23:08 +01:00
|
|
|
bgImg->ColorStripe(10);
|
|
|
|
mainWindow->Append(bgImg);
|
2008-09-04 04:46:04 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
if(gameScreenTex)
|
|
|
|
{
|
|
|
|
gameScreenImg = new GuiImage(gameScreenTex, screenwidth, screenheight);
|
|
|
|
gameScreenImg->SetAlpha(192);
|
|
|
|
//gameScreenImg->SetStripe(100);
|
|
|
|
gameScreenImg->ColorStripe(30);
|
|
|
|
mainWindow->Append(gameScreenImg);
|
|
|
|
bgImg->SetVisible(false);
|
|
|
|
}
|
2008-10-01 23:00:12 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiTrigger trigA;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
2009-04-06 08:30:47 +02:00
|
|
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
|
|
|
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
2009-03-28 18:23:08 +01:00
|
|
|
GuiImageData bgTop(bg_top_png);
|
|
|
|
bgTopImg = new GuiImage(&bgTop);
|
|
|
|
GuiImageData bgBottom(bg_bottom_png);
|
|
|
|
bgBottomImg = new GuiImage(&bgBottom);
|
|
|
|
bgBottomImg->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
GuiImageData logo(logo_png);
|
|
|
|
GuiImage logoImg(&logo);
|
|
|
|
GuiImageData logoOver(logo_over_png);
|
|
|
|
GuiImage logoImgOver(&logoOver);
|
|
|
|
GuiText logoTxt(APPVERSION, 18, (GXColor){255, 255, 255, 255});
|
2009-03-31 09:13:20 +02:00
|
|
|
logoTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
2009-03-28 18:23:08 +01:00
|
|
|
btnLogo = new GuiButton(logoImg.GetWidth(), logoImg.GetHeight());
|
|
|
|
btnLogo->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
2009-04-22 20:15:36 +02:00
|
|
|
btnLogo->SetPosition(-50, 24);
|
2009-03-28 18:23:08 +01:00
|
|
|
btnLogo->SetImage(&logoImg);
|
|
|
|
btnLogo->SetImageOver(&logoImgOver);
|
|
|
|
btnLogo->SetLabel(&logoTxt);
|
2009-04-06 08:30:47 +02:00
|
|
|
btnLogo->SetSoundOver(&btnSoundOver);
|
|
|
|
btnLogo->SetSoundClick(&btnSoundClick);
|
2009-03-28 18:23:08 +01:00
|
|
|
btnLogo->SetTrigger(&trigA);
|
|
|
|
btnLogo->SetUpdateCallback(WindowCredits);
|
|
|
|
|
|
|
|
mainWindow->Append(bgTopImg);
|
|
|
|
mainWindow->Append(bgBottomImg);
|
|
|
|
mainWindow->Append(btnLogo);
|
|
|
|
|
|
|
|
if(currentMenu == MENU_GAMESELECTION)
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
// Load preferences
|
|
|
|
if(!LoadPrefs())
|
|
|
|
SavePrefs(SILENT);
|
|
|
|
|
|
|
|
#ifndef NO_SOUND
|
|
|
|
bgMusic = new GuiSound(bg_music_ogg, bg_music_ogg_size, SOUND_OGG);
|
|
|
|
bgMusic->SetVolume(GCSettings.MusicVolume);
|
2009-04-05 05:11:38 +02:00
|
|
|
bgMusic->SetLoop(true);
|
|
|
|
enterSound = new GuiSound(enter_ogg, enter_ogg_size, SOUND_OGG);
|
|
|
|
enterSound->SetVolume(GCSettings.SFXVolume);
|
|
|
|
exitSound = new GuiSound(exit_ogg, exit_ogg_size, SOUND_OGG);
|
|
|
|
exitSound->SetVolume(GCSettings.SFXVolume);
|
2009-03-28 18:23:08 +01:00
|
|
|
if(currentMenu == MENU_GAMESELECTION) bgMusic->Play(); // startup music
|
|
|
|
#endif
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
while(currentMenu != MENU_EXIT || !romLoaded)
|
|
|
|
{
|
|
|
|
switch (currentMenu)
|
2008-09-02 03:57:21 +02:00
|
|
|
{
|
2009-03-28 18:23:08 +01:00
|
|
|
case MENU_GAMESELECTION:
|
|
|
|
currentMenu = MenuGameSelection();
|
2008-09-04 04:46:04 +02:00
|
|
|
break;
|
2009-03-28 18:23:08 +01:00
|
|
|
case MENU_GAME:
|
|
|
|
currentMenu = MenuGame();
|
2008-09-04 04:46:04 +02:00
|
|
|
break;
|
2009-03-28 18:23:08 +01:00
|
|
|
case MENU_GAME_LOAD:
|
|
|
|
currentMenu = MenuGameSaves(0);
|
2008-10-01 23:00:12 +02:00
|
|
|
break;
|
2009-03-28 18:23:08 +01:00
|
|
|
case MENU_GAME_SAVE:
|
|
|
|
currentMenu = MenuGameSaves(1);
|
2008-09-02 03:57:21 +02:00
|
|
|
break;
|
2009-04-13 21:48:24 +02:00
|
|
|
case MENU_GAMESETTINGS:
|
|
|
|
currentMenu = MenuGameSettings();
|
2008-09-02 03:57:21 +02:00
|
|
|
break;
|
2009-04-13 21:48:24 +02:00
|
|
|
case MENU_GAMESETTINGS_MAPPINGS:
|
2009-03-28 18:23:08 +01:00
|
|
|
currentMenu = MenuSettingsMappings();
|
2008-09-02 03:57:21 +02:00
|
|
|
break;
|
2009-04-13 21:48:24 +02:00
|
|
|
case MENU_GAMESETTINGS_MAPPINGS_CTRL:
|
2009-03-28 18:23:08 +01:00
|
|
|
currentMenu = MenuSettingsMappingsController();
|
2008-09-02 03:57:21 +02:00
|
|
|
break;
|
2009-04-13 21:48:24 +02:00
|
|
|
case MENU_GAMESETTINGS_MAPPINGS_MAP:
|
2009-03-28 18:23:08 +01:00
|
|
|
currentMenu = MenuSettingsMappingsMap();
|
2008-10-24 07:38:46 +02:00
|
|
|
break;
|
2009-04-13 21:48:24 +02:00
|
|
|
case MENU_GAMESETTINGS_VIDEO:
|
2009-03-28 18:23:08 +01:00
|
|
|
currentMenu = MenuSettingsVideo();
|
2008-10-24 07:38:46 +02:00
|
|
|
break;
|
2009-07-22 03:58:45 +02:00
|
|
|
case MENU_GAMESETTINGS_CHEATS:
|
2009-04-13 21:48:24 +02:00
|
|
|
currentMenu = MenuGameCheats();
|
2009-07-22 03:58:45 +02:00
|
|
|
break;
|
2009-04-13 21:48:24 +02:00
|
|
|
case MENU_SETTINGS:
|
|
|
|
currentMenu = MenuSettings();
|
|
|
|
break;
|
2009-03-28 18:23:08 +01:00
|
|
|
case MENU_SETTINGS_FILE:
|
|
|
|
currentMenu = MenuSettingsFile();
|
2008-10-24 07:38:46 +02:00
|
|
|
break;
|
2009-03-28 18:23:08 +01:00
|
|
|
case MENU_SETTINGS_MENU:
|
|
|
|
currentMenu = MenuSettingsMenu();
|
2008-10-24 07:38:46 +02:00
|
|
|
break;
|
2009-03-28 18:23:08 +01:00
|
|
|
case MENU_SETTINGS_NETWORK:
|
|
|
|
currentMenu = MenuSettingsNetwork();
|
2008-09-02 03:57:21 +02:00
|
|
|
break;
|
2009-03-28 18:23:08 +01:00
|
|
|
default: // unrecognized menu
|
|
|
|
currentMenu = MenuGameSelection();
|
2008-09-02 03:57:21 +02:00
|
|
|
break;
|
|
|
|
}
|
2009-03-28 18:23:08 +01:00
|
|
|
lastMenu = currentMenu;
|
2009-05-06 08:33:34 +02:00
|
|
|
usleep(THREAD_SLEEP);
|
2008-09-02 03:57:21 +02:00
|
|
|
}
|
|
|
|
|
2008-11-13 09:01:25 +01:00
|
|
|
#ifdef HW_RVL
|
2009-03-28 18:23:08 +01:00
|
|
|
ShutoffRumble();
|
2008-11-13 09:01:25 +01:00
|
|
|
#endif
|
|
|
|
|
2009-05-28 06:16:11 +02:00
|
|
|
// wait for keys to be depressed
|
|
|
|
while(MenuRequested())
|
|
|
|
usleep(100);
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
CancelAction();
|
|
|
|
HaltGui();
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-06-30 09:11:56 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
if(updatethread != LWP_THREAD_NULL)
|
|
|
|
LWP_JoinThread(updatethread, NULL);
|
|
|
|
#endif
|
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
#ifndef NO_SOUND
|
|
|
|
delete bgMusic;
|
2009-04-05 05:11:38 +02:00
|
|
|
delete enterSound;
|
|
|
|
delete exitSound;
|
2009-03-28 18:23:08 +01:00
|
|
|
#endif
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
delete btnLogo;
|
|
|
|
delete bgImg;
|
|
|
|
delete bgTopImg;
|
|
|
|
delete bgBottomImg;
|
|
|
|
delete mainWindow;
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
#ifdef HW_RVL
|
|
|
|
delete pointer[0];
|
|
|
|
delete pointer[1];
|
|
|
|
delete pointer[2];
|
|
|
|
delete pointer[3];
|
|
|
|
#endif
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
mainWindow = NULL;
|
2008-09-02 03:57:21 +02:00
|
|
|
|
2009-03-28 18:23:08 +01:00
|
|
|
if(gameScreenImg)
|
|
|
|
{
|
|
|
|
delete gameScreenImg;
|
|
|
|
gameScreenImg = NULL;
|
2008-09-02 03:57:21 +02:00
|
|
|
}
|
2009-03-28 18:23:08 +01:00
|
|
|
if(gameScreenTex)
|
2008-10-04 04:32:54 +02:00
|
|
|
{
|
2009-03-28 18:23:08 +01:00
|
|
|
free(gameScreenTex);
|
|
|
|
gameScreenTex = NULL;
|
|
|
|
}
|
|
|
|
if(gameScreenTex2)
|
|
|
|
{
|
|
|
|
free(gameScreenTex2);
|
|
|
|
gameScreenTex2 = NULL;
|
2008-10-04 04:32:54 +02:00
|
|
|
}
|
2008-09-02 03:57:21 +02:00
|
|
|
}
|