2008-08-06 03:09:59 +02:00
|
|
|
/****************************************************************************
|
2008-09-12 07:28:40 +02:00
|
|
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
2008-08-06 03:09:59 +02:00
|
|
|
*
|
|
|
|
* softdev July 2006
|
|
|
|
* crunchy2 May-June 2007
|
2008-09-23 06:13:33 +02:00
|
|
|
* Michniewski 2008
|
2008-08-14 00:44:59 +02:00
|
|
|
* Tantric August 2008
|
|
|
|
*
|
|
|
|
* menu.cpp
|
|
|
|
*
|
2008-09-12 07:28:40 +02:00
|
|
|
* Menu flow routines - handles all menu logic
|
|
|
|
***************************************************************************/
|
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
#include <gccore.h>
|
|
|
|
#include <ogcsys.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2008-08-06 03:39:43 +02:00
|
|
|
#include <wiiuse/wpad.h>
|
2008-08-10 05:14:39 +02:00
|
|
|
|
2008-08-19 08:05:57 +02:00
|
|
|
#ifdef WII_DVD
|
2008-08-23 05:20:54 +02:00
|
|
|
extern "C" {
|
2008-08-19 08:05:57 +02:00
|
|
|
#include <di/di.h>
|
2008-08-23 05:20:54 +02:00
|
|
|
}
|
|
|
|
#endif
|
2008-08-19 08:05:57 +02:00
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
#include "snes9x.h"
|
|
|
|
#include "memmap.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "cpuexec.h"
|
|
|
|
#include "ppu.h"
|
|
|
|
#include "apu.h"
|
|
|
|
#include "display.h"
|
|
|
|
#include "gfx.h"
|
|
|
|
#include "soundux.h"
|
|
|
|
#include "spc700.h"
|
|
|
|
#include "spc7110.h"
|
|
|
|
#include "controls.h"
|
2008-08-10 05:14:39 +02:00
|
|
|
#include "cheats.h"
|
|
|
|
|
2008-09-09 19:36:48 +02:00
|
|
|
#include "snes9xGX.h"
|
2008-08-06 03:09:59 +02:00
|
|
|
#include "aram.h"
|
|
|
|
#include "video.h"
|
|
|
|
#include "filesel.h"
|
2008-08-06 03:55:59 +02:00
|
|
|
#include "unzip.h"
|
2008-08-10 05:14:39 +02:00
|
|
|
#include "smbop.h"
|
2008-08-12 05:25:16 +02:00
|
|
|
#include "memcardop.h"
|
2008-08-07 07:19:17 +02:00
|
|
|
#include "fileop.h"
|
2008-08-12 05:25:16 +02:00
|
|
|
#include "freeze.h"
|
2008-08-06 03:09:59 +02:00
|
|
|
#include "dvd.h"
|
|
|
|
#include "s9xconfig.h"
|
|
|
|
#include "sram.h"
|
|
|
|
#include "preferences.h"
|
2008-08-06 03:45:56 +02:00
|
|
|
#include "button_mapping.h"
|
2008-08-07 07:19:17 +02:00
|
|
|
#include "menudraw.h"
|
2008-08-07 05:25:02 +02:00
|
|
|
#include "cheatmgr.h"
|
2008-08-20 06:07:38 +02:00
|
|
|
#include "input.h"
|
2008-08-07 05:25:02 +02:00
|
|
|
|
|
|
|
extern void DrawMenu (char items[][50], char *title, int maxitems, int selected, int fontsize);
|
|
|
|
|
|
|
|
extern SCheatData Cheat;
|
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
extern int menu;
|
|
|
|
extern unsigned long ARAM_ROMSIZE;
|
|
|
|
|
|
|
|
#define SOFTRESET_ADR ((volatile u32*)0xCC003024)
|
|
|
|
|
2008-08-07 05:25:02 +02:00
|
|
|
/****************************************************************************
|
2008-08-12 05:25:16 +02:00
|
|
|
* Reboot / Exit
|
2008-09-12 07:28:40 +02:00
|
|
|
***************************************************************************/
|
2008-08-06 03:09:59 +02:00
|
|
|
|
2008-08-12 05:25:16 +02:00
|
|
|
#ifndef HW_RVL
|
|
|
|
#define PSOSDLOADID 0x7c6000a6
|
|
|
|
int *psoid = (int *) 0x80001800;
|
|
|
|
void (*PSOReload) () = (void (*)()) 0x80001800;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void Reboot()
|
|
|
|
{
|
2008-08-06 04:31:44 +02:00
|
|
|
#ifdef HW_RVL
|
2008-08-06 03:39:43 +02:00
|
|
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
|
|
|
#else
|
|
|
|
#define SOFTRESET_ADR ((volatile u32*)0xCC003024)
|
|
|
|
*SOFTRESET_ADR = 0x00000000;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Load Manager
|
2008-09-12 07:28:40 +02:00
|
|
|
***************************************************************************/
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
int
|
|
|
|
LoadManager ()
|
|
|
|
{
|
2008-08-07 05:25:02 +02:00
|
|
|
int loadROM = OpenROM(GCSettings.LoadMethod);
|
|
|
|
|
|
|
|
/***
|
|
|
|
* check for autoloadsram / freeze
|
2008-08-06 03:39:43 +02:00
|
|
|
***/
|
2008-08-07 05:25:02 +02:00
|
|
|
if ( loadROM == 1 ) // if ROM was loaded, load the SRAM & settings
|
2008-08-06 03:39:43 +02:00
|
|
|
{
|
|
|
|
if ( GCSettings.AutoLoad == 1 )
|
2008-08-10 05:14:39 +02:00
|
|
|
LoadSRAM(GCSettings.SaveMethod, SILENT);
|
2008-08-06 03:39:43 +02:00
|
|
|
else if ( GCSettings.AutoLoad == 2 )
|
2008-08-10 05:14:39 +02:00
|
|
|
NGCUnfreezeGame (GCSettings.SaveMethod, SILENT);
|
2008-08-07 07:19:17 +02:00
|
|
|
|
2008-08-07 05:25:02 +02:00
|
|
|
// setup cheats
|
|
|
|
SetupCheats();
|
2008-09-23 06:54:53 +02:00
|
|
|
|
|
|
|
// reset zoom
|
|
|
|
zoom_reset ();
|
2008-08-06 03:39:43 +02:00
|
|
|
}
|
2008-08-06 03:09:59 +02:00
|
|
|
|
2008-08-07 05:25:02 +02:00
|
|
|
return loadROM;
|
2008-08-06 03:09:59 +02:00
|
|
|
}
|
|
|
|
|
2008-08-07 05:25:02 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Cheat Menu
|
2008-09-12 07:28:40 +02:00
|
|
|
***************************************************************************/
|
2008-08-07 05:25:02 +02:00
|
|
|
static int cheatmenuCount = 0;
|
|
|
|
static char cheatmenu[MAX_CHEATS][50];
|
2008-08-14 00:44:59 +02:00
|
|
|
static char cheatmenuvalue[MAX_CHEATS][50];
|
|
|
|
|
2008-08-07 05:25:02 +02:00
|
|
|
void CheatMenu()
|
|
|
|
{
|
|
|
|
int ret = -1;
|
|
|
|
int oldmenu = menu;
|
|
|
|
menu = 0;
|
2008-08-07 07:19:17 +02:00
|
|
|
|
2008-08-14 00:44:59 +02:00
|
|
|
int selection = 0;
|
|
|
|
int offset = 0;
|
|
|
|
int redraw = 1;
|
|
|
|
int selectit = 0;
|
2008-08-23 05:20:54 +02:00
|
|
|
|
2008-08-20 06:07:38 +02:00
|
|
|
u32 p = 0;
|
|
|
|
u32 wp = 0;
|
|
|
|
u32 ph = 0;
|
|
|
|
u32 wh = 0;
|
|
|
|
signed char gc_ay = 0;
|
|
|
|
signed char gc_sx = 0;
|
|
|
|
signed char wm_ay = 0;
|
|
|
|
signed char wm_sx = 0;
|
|
|
|
|
2008-08-14 00:44:59 +02:00
|
|
|
int scroll_delay = 0;
|
|
|
|
bool move_selection = 0;
|
|
|
|
#define SCROLL_INITIAL_DELAY 15
|
|
|
|
#define SCROLL_LOOP_DELAY 2
|
|
|
|
|
2008-08-07 05:25:02 +02:00
|
|
|
if(Cheat.num_cheats > 0)
|
|
|
|
{
|
|
|
|
cheatmenuCount = Cheat.num_cheats + 1;
|
2008-08-07 07:19:17 +02:00
|
|
|
|
2008-08-14 00:44:59 +02:00
|
|
|
for(uint16 i=0; i < Cheat.num_cheats; i++)
|
|
|
|
sprintf (cheatmenu[i], "%s", Cheat.c[i].name);
|
|
|
|
|
2008-08-07 05:25:02 +02:00
|
|
|
sprintf (cheatmenu[cheatmenuCount-1], "Back to Game Menu");
|
2008-08-07 07:19:17 +02:00
|
|
|
|
2008-08-07 05:25:02 +02:00
|
|
|
while(ret != cheatmenuCount-1)
|
|
|
|
{
|
|
|
|
if(ret >= 0)
|
|
|
|
{
|
|
|
|
if(Cheat.c[ret].enabled)
|
|
|
|
S9xDisableCheat(ret);
|
|
|
|
else
|
|
|
|
S9xEnableCheat(ret);
|
2008-08-14 00:44:59 +02:00
|
|
|
|
|
|
|
ret = -1;
|
2008-08-07 05:25:02 +02:00
|
|
|
}
|
2008-08-07 07:19:17 +02:00
|
|
|
|
2008-08-07 05:25:02 +02:00
|
|
|
for(uint16 i=0; i < Cheat.num_cheats; i++)
|
2008-08-14 00:44:59 +02:00
|
|
|
sprintf (cheatmenuvalue[i], "%s", Cheat.c[i].enabled == true ? "ON" : "OFF");
|
|
|
|
|
|
|
|
if (redraw)
|
|
|
|
ShowCheats (cheatmenu, cheatmenuvalue, cheatmenuCount, offset, selection);
|
|
|
|
|
|
|
|
redraw = 0;
|
|
|
|
|
|
|
|
VIDEO_WaitVSync(); // slow things down a bit so we don't overread the pads
|
|
|
|
|
2008-08-20 06:07:38 +02:00
|
|
|
gc_ay = PAD_StickY (0);
|
|
|
|
gc_sx = PAD_SubStickX (0);
|
|
|
|
p = PAD_ButtonsDown (0);
|
2008-08-14 00:44:59 +02:00
|
|
|
ph = PAD_ButtonsHeld (0);
|
2008-08-23 05:20:54 +02:00
|
|
|
|
2008-08-20 06:07:38 +02:00
|
|
|
#ifdef HW_RVL
|
2008-10-03 23:52:57 +02:00
|
|
|
wm_ay = WPAD_Stick (0, 0, 1);
|
|
|
|
wm_sx = WPAD_Stick (0, 1, 0);
|
2008-08-14 00:44:59 +02:00
|
|
|
wp = WPAD_ButtonsDown (0);
|
|
|
|
wh = WPAD_ButtonsHeld (0);
|
2008-08-20 06:07:38 +02:00
|
|
|
#endif
|
2008-08-14 00:44:59 +02:00
|
|
|
|
|
|
|
/*** Check for exit combo ***/
|
2008-08-20 06:07:38 +02:00
|
|
|
if ( (gc_sx < -70) || (wm_sx < -70) || (wp & WPAD_BUTTON_HOME) || (wp & WPAD_CLASSIC_BUTTON_HOME) )
|
2008-08-14 00:44:59 +02:00
|
|
|
break;
|
|
|
|
|
2008-09-10 07:57:37 +02:00
|
|
|
if ( (p & PAD_BUTTON_B) || (wp & (WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B)) )
|
|
|
|
break;
|
|
|
|
|
2008-08-14 00:44:59 +02:00
|
|
|
/*** Check buttons, perform actions ***/
|
|
|
|
if ( (p & PAD_BUTTON_A) || selectit || (wp & (WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A)) )
|
|
|
|
{
|
|
|
|
if ( selectit )
|
|
|
|
selectit = 0;
|
|
|
|
|
|
|
|
redraw = 1;
|
|
|
|
ret = selection;
|
|
|
|
} // End of A
|
2008-08-07 07:19:17 +02:00
|
|
|
|
2008-08-20 06:07:38 +02:00
|
|
|
if ( ((p | ph) & PAD_BUTTON_DOWN) || ((wp | wh) & (WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_DOWN)) || (gc_ay < -PADCAL) || (wm_ay < -PADCAL) )
|
2008-08-14 00:44:59 +02:00
|
|
|
{
|
|
|
|
if ( (p & PAD_BUTTON_DOWN) || (wp & (WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_DOWN)) ) { /*** Button just pressed ***/
|
|
|
|
scroll_delay = SCROLL_INITIAL_DELAY; // reset scroll delay.
|
|
|
|
move_selection = 1; //continue (move selection)
|
|
|
|
}
|
|
|
|
else if (scroll_delay == 0) { /*** Button is held ***/
|
|
|
|
scroll_delay = SCROLL_LOOP_DELAY;
|
|
|
|
move_selection = 1; //continue (move selection)
|
|
|
|
} else {
|
|
|
|
scroll_delay--; // wait
|
|
|
|
}
|
|
|
|
|
|
|
|
if (move_selection)
|
|
|
|
{
|
|
|
|
selection++;
|
|
|
|
if (selection == cheatmenuCount)
|
|
|
|
selection = offset = 0;
|
|
|
|
if ((selection - offset) >= PAGESIZE)
|
|
|
|
offset += PAGESIZE;
|
|
|
|
redraw = 1;
|
|
|
|
move_selection = 0;
|
|
|
|
}
|
|
|
|
} // End of down
|
2008-08-20 06:07:38 +02:00
|
|
|
if ( ((p | ph) & PAD_BUTTON_UP) || ((wp | wh) & (WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP)) || (gc_ay > PADCAL) || (wm_ay > PADCAL) )
|
2008-08-14 00:44:59 +02:00
|
|
|
{
|
|
|
|
if ( (p & PAD_BUTTON_UP) || (wp & (WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP)) ) { /*** Button just pressed***/
|
|
|
|
scroll_delay = SCROLL_INITIAL_DELAY; // reset scroll delay.
|
|
|
|
move_selection = 1; //continue (move selection)
|
|
|
|
}
|
|
|
|
else if (scroll_delay == 0) { /*** Button is held ***/
|
|
|
|
scroll_delay = SCROLL_LOOP_DELAY;
|
|
|
|
move_selection = 1; //continue (move selection)
|
|
|
|
} else {
|
|
|
|
scroll_delay--; // wait
|
|
|
|
}
|
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
if (move_selection)
|
|
|
|
{
|
|
|
|
selection--;
|
|
|
|
if (selection < 0) {
|
|
|
|
selection = cheatmenuCount - 1;
|
|
|
|
offset = selection - PAGESIZE + 1;
|
|
|
|
}
|
|
|
|
if (selection < offset)
|
|
|
|
offset -= PAGESIZE;
|
|
|
|
if (offset < 0)
|
|
|
|
offset = 0;
|
|
|
|
redraw = 1;
|
|
|
|
move_selection = 0;
|
|
|
|
}
|
|
|
|
} // End of Up
|
|
|
|
if ( (p & PAD_BUTTON_LEFT) || (wp & (WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT)) )
|
|
|
|
{
|
|
|
|
/*** Go back a page ***/
|
|
|
|
selection -= PAGESIZE;
|
|
|
|
if (selection < 0)
|
|
|
|
{
|
|
|
|
selection = cheatmenuCount - 1;
|
|
|
|
offset = selection - PAGESIZE + 1;
|
|
|
|
}
|
|
|
|
if (selection < offset)
|
|
|
|
offset -= PAGESIZE;
|
|
|
|
if (offset < 0)
|
|
|
|
offset = 0;
|
|
|
|
redraw = 1;
|
|
|
|
}
|
|
|
|
if ( (p & PAD_BUTTON_RIGHT) || (wp & (WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT)) )
|
|
|
|
{
|
|
|
|
/*** Go forward a page ***/
|
|
|
|
selection += PAGESIZE;
|
|
|
|
if (selection > cheatmenuCount - 1)
|
|
|
|
selection = offset = 0;
|
|
|
|
if ((selection - offset) >= PAGESIZE)
|
|
|
|
offset += PAGESIZE;
|
|
|
|
redraw = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WaitPrompt((char*)"No cheats found!");
|
|
|
|
}
|
|
|
|
menu = oldmenu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Game Options Menu
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
int
|
|
|
|
GameMenu ()
|
|
|
|
{
|
|
|
|
int gamemenuCount = 10;
|
|
|
|
char gamemenu[][50] = {
|
|
|
|
"Return to Game",
|
|
|
|
"Reset Game",
|
|
|
|
"ROM Information",
|
|
|
|
"Cheats",
|
|
|
|
"Load SRAM", "Save SRAM",
|
|
|
|
"Load Game Snapshot", "Save Game Snapshot",
|
|
|
|
"Reset Zoom",
|
|
|
|
"Back to Main Menu"
|
|
|
|
};
|
|
|
|
|
|
|
|
int ret, retval = 0;
|
|
|
|
int quit = 0;
|
|
|
|
int oldmenu = menu;
|
|
|
|
menu = 0;
|
|
|
|
|
|
|
|
while (quit == 0)
|
|
|
|
{
|
|
|
|
// disable SRAM/SNAPSHOT saving/loading if AUTO is on
|
|
|
|
|
|
|
|
if (GCSettings.AutoLoad == 1) // Auto Load SRAM
|
|
|
|
gamemenu[4][0] = '\0';
|
|
|
|
else if (GCSettings.AutoLoad == 2) // Auto Load SNAPSHOT
|
|
|
|
gamemenu[6][0] = '\0';
|
|
|
|
|
|
|
|
if (GCSettings.AutoSave == 1) // Auto Save SRAM
|
|
|
|
gamemenu[5][0] = '\0';
|
|
|
|
else if (GCSettings.AutoSave == 2) // Auto Save SNAPSHOT
|
|
|
|
gamemenu[7][0] = '\0';
|
|
|
|
else if (GCSettings.AutoSave == 3) // Auto Save BOTH
|
|
|
|
{
|
|
|
|
gamemenu[5][0] = '\0';
|
|
|
|
gamemenu[7][0] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
// hide cheats menu if cheats file not present
|
|
|
|
if(Cheat.num_cheats == 0)
|
|
|
|
gamemenu[3][0] = '\0';
|
|
|
|
|
|
|
|
ret = RunMenu (gamemenu, gamemenuCount, (char*)"Game Menu");
|
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0: // Return to Game
|
|
|
|
quit = retval = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: // Reset Game
|
|
|
|
zoom_reset ();
|
|
|
|
S9xSoftReset ();
|
|
|
|
quit = retval = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: // ROM Information
|
|
|
|
RomInfo();
|
|
|
|
WaitButtonA ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: // load cheats
|
|
|
|
CheatMenu();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4: // Load SRAM
|
|
|
|
zoom_reset ();
|
|
|
|
quit = retval = LoadSRAM(GCSettings.SaveMethod, NOTSILENT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5: // Save SRAM
|
|
|
|
SaveSRAM(GCSettings.SaveMethod, NOTSILENT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 6: // Load Freeze
|
|
|
|
zoom_reset ();
|
|
|
|
quit = retval = NGCUnfreezeGame (GCSettings.SaveMethod, NOTSILENT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 7: // Save Freeze
|
|
|
|
NGCFreezeGame (GCSettings.SaveMethod, NOTSILENT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 8: // Reset Zoom
|
|
|
|
zoom_reset ();
|
|
|
|
quit = retval = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case -1: // Button B
|
|
|
|
case 9: // Return to previous menu
|
|
|
|
retval = 0;
|
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
menu = oldmenu;
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* File Options Menu
|
|
|
|
***************************************************************************/
|
|
|
|
static int filemenuCount = 8;
|
|
|
|
static char filemenu[][50] = {
|
|
|
|
"Load Method",
|
|
|
|
"Load Folder",
|
|
|
|
"Save Method",
|
|
|
|
"Save Folder",
|
|
|
|
|
|
|
|
"Auto Load",
|
|
|
|
"Auto Save",
|
|
|
|
"Verify MC Saves",
|
|
|
|
|
|
|
|
"Back to Preferences Menu"
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
FileOptions ()
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
int quit = 0;
|
|
|
|
int oldmenu = menu;
|
|
|
|
menu = 0;
|
|
|
|
while (quit == 0)
|
|
|
|
{
|
|
|
|
// 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
|
|
|
|
#ifndef HW_RVL
|
|
|
|
if(GCSettings.LoadMethod == METHOD_USB)
|
|
|
|
GCSettings.LoadMethod++;
|
|
|
|
if(GCSettings.SaveMethod == METHOD_USB)
|
|
|
|
GCSettings.SaveMethod++;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// saving to DVD is impossible
|
|
|
|
if(GCSettings.SaveMethod == METHOD_DVD)
|
|
|
|
GCSettings.SaveMethod++;
|
|
|
|
|
|
|
|
// disable SMB in GC mode (stalls out)
|
|
|
|
#ifndef HW_RVL
|
|
|
|
if(GCSettings.LoadMethod == METHOD_SMB)
|
|
|
|
GCSettings.LoadMethod++;
|
|
|
|
if(GCSettings.SaveMethod == METHOD_SMB)
|
|
|
|
GCSettings.SaveMethod++;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// disable MC saving in Wii mode - does not work for some reason!
|
|
|
|
#ifdef HW_RVL
|
|
|
|
if(GCSettings.SaveMethod == METHOD_MC_SLOTA)
|
|
|
|
GCSettings.SaveMethod++;
|
|
|
|
if(GCSettings.SaveMethod == METHOD_MC_SLOTB)
|
|
|
|
GCSettings.SaveMethod++;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// correct load/save methods out of bounds
|
|
|
|
if(GCSettings.LoadMethod > 4)
|
|
|
|
GCSettings.LoadMethod = 0;
|
|
|
|
if(GCSettings.SaveMethod > 6)
|
|
|
|
GCSettings.SaveMethod = 0;
|
|
|
|
|
|
|
|
if (GCSettings.LoadMethod == METHOD_AUTO) sprintf (filemenu[0],"Load Method AUTO");
|
|
|
|
else if (GCSettings.LoadMethod == METHOD_SD) sprintf (filemenu[0],"Load Method SD");
|
|
|
|
else if (GCSettings.LoadMethod == METHOD_USB) sprintf (filemenu[0],"Load Method USB");
|
|
|
|
else if (GCSettings.LoadMethod == METHOD_DVD) sprintf (filemenu[0],"Load Method DVD");
|
|
|
|
else if (GCSettings.LoadMethod == METHOD_SMB) sprintf (filemenu[0],"Load Method Network");
|
|
|
|
|
|
|
|
sprintf (filemenu[1], "Load Folder %s", GCSettings.LoadFolder);
|
|
|
|
|
|
|
|
if (GCSettings.SaveMethod == METHOD_AUTO) sprintf (filemenu[2],"Save Method AUTO");
|
|
|
|
else if (GCSettings.SaveMethod == METHOD_SD) sprintf (filemenu[2],"Save Method SD");
|
|
|
|
else if (GCSettings.SaveMethod == METHOD_USB) sprintf (filemenu[2],"Save Method USB");
|
|
|
|
else if (GCSettings.SaveMethod == METHOD_SMB) sprintf (filemenu[2],"Save Method Network");
|
|
|
|
else if (GCSettings.SaveMethod == METHOD_MC_SLOTA) sprintf (filemenu[2],"Save Method MC Slot A");
|
|
|
|
else if (GCSettings.SaveMethod == METHOD_MC_SLOTB) sprintf (filemenu[2],"Save Method MC Slot B");
|
|
|
|
|
|
|
|
sprintf (filemenu[3], "Save Folder %s", GCSettings.SaveFolder);
|
|
|
|
|
|
|
|
// disable changing load/save directories for now
|
|
|
|
filemenu[1][0] = '\0';
|
|
|
|
filemenu[3][0] = '\0';
|
|
|
|
|
|
|
|
if (GCSettings.AutoLoad == 0) sprintf (filemenu[4],"Auto Load OFF");
|
|
|
|
else if (GCSettings.AutoLoad == 1) sprintf (filemenu[4],"Auto Load SRAM");
|
|
|
|
else if (GCSettings.AutoLoad == 2) sprintf (filemenu[4],"Auto Load SNAPSHOT");
|
|
|
|
|
|
|
|
if (GCSettings.AutoSave == 0) sprintf (filemenu[5],"Auto Save OFF");
|
|
|
|
else if (GCSettings.AutoSave == 1) sprintf (filemenu[5],"Auto Save SRAM");
|
|
|
|
else if (GCSettings.AutoSave == 2) sprintf (filemenu[5],"Auto Save SNAPSHOT");
|
|
|
|
else if (GCSettings.AutoSave == 3) sprintf (filemenu[5],"Auto Save BOTH");
|
|
|
|
|
|
|
|
sprintf (filemenu[6], "Verify MC Saves %s",
|
|
|
|
GCSettings.VerifySaves == true ? " ON" : "OFF");
|
|
|
|
|
|
|
|
ret = RunMenu (filemenu, filemenuCount, (char*)"Save/Load Options", 16);
|
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
GCSettings.LoadMethod ++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
GCSettings.SaveMethod ++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
GCSettings.AutoLoad ++;
|
|
|
|
if (GCSettings.AutoLoad > 2)
|
|
|
|
GCSettings.AutoLoad = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
GCSettings.AutoSave ++;
|
|
|
|
if (GCSettings.AutoSave > 3)
|
|
|
|
GCSettings.AutoSave = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 6:
|
|
|
|
GCSettings.VerifySaves ^= 1;
|
|
|
|
break;
|
|
|
|
case -1: /*** Button B ***/
|
|
|
|
case 7:
|
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
}
|
|
|
|
}
|
2008-08-07 05:25:02 +02:00
|
|
|
menu = oldmenu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2008-09-30 07:31:46 +02:00
|
|
|
* Video Options
|
2008-09-12 07:28:40 +02:00
|
|
|
***************************************************************************/
|
2008-10-04 03:02:05 +02:00
|
|
|
static int videomenuCount = 12;
|
2008-09-30 07:31:46 +02:00
|
|
|
static char videomenu[][50] = {
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
"Transparency",
|
|
|
|
"Display Frame Rate",
|
|
|
|
"Enable Zooming",
|
|
|
|
"Video Filtering",
|
|
|
|
"Widescreen",
|
2008-08-13 07:47:04 +02:00
|
|
|
|
2008-09-30 08:43:34 +02:00
|
|
|
"Shift Video Up",
|
|
|
|
"Shift Video Down",
|
|
|
|
"Shift Video Left",
|
|
|
|
"Shift Video Right",
|
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
"Shift: ",
|
|
|
|
"Reset Video Shift",
|
|
|
|
|
|
|
|
"Back to Preferences Menu"
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
VideoOptions ()
|
|
|
|
{
|
|
|
|
int ret = 0;
|
2008-08-07 05:25:02 +02:00
|
|
|
int quit = 0;
|
|
|
|
int oldmenu = menu;
|
|
|
|
menu = 0;
|
|
|
|
while (quit == 0)
|
|
|
|
{
|
2008-09-30 07:31:46 +02:00
|
|
|
sprintf (videomenu[0], "Transparency %s",
|
|
|
|
Settings.Transparency == true ? " ON" : "OFF");
|
2008-08-13 07:47:04 +02:00
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
sprintf (videomenu[1], "Display Frame Rate %s",
|
|
|
|
Settings.DisplayFrameRate == true ? " ON" : "OFF");
|
2008-08-13 07:47:04 +02:00
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
sprintf (videomenu[2], "Enable Zooming %s",
|
|
|
|
GCSettings.NGCZoom == true ? " ON" : "OFF");
|
2008-08-13 07:47:04 +02:00
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
// don't allow original render mode if progressive video mode detected
|
|
|
|
if (GCSettings.render==0 && progressive)
|
|
|
|
GCSettings.render++;
|
2008-08-13 07:47:04 +02:00
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
if ( GCSettings.render == 0 )
|
|
|
|
sprintf (videomenu[3], "Video Rendering Original");
|
|
|
|
if ( GCSettings.render == 1 )
|
|
|
|
sprintf (videomenu[3], "Video Rendering Filtered");
|
|
|
|
if ( GCSettings.render == 2 )
|
|
|
|
sprintf (videomenu[3], "Video Rendering Unfiltered");
|
|
|
|
|
|
|
|
sprintf (videomenu[4], "Video Scaling %s",
|
|
|
|
GCSettings.widescreen == true ? "16:9 Correction" : "Default");
|
|
|
|
|
|
|
|
sprintf (videomenu[9], "Video Shift: %d, %d", GCSettings.xshift, GCSettings.yshift);
|
|
|
|
|
|
|
|
ret = RunMenu (videomenu, videomenuCount, (char*)"Video Options", 16);
|
2008-08-07 05:25:02 +02:00
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
2008-09-30 07:31:46 +02:00
|
|
|
case 0:
|
|
|
|
Settings.Transparency ^= 1;
|
2008-08-07 05:25:02 +02:00
|
|
|
break;
|
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
case 1:
|
|
|
|
Settings.DisplayFrameRate ^= 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
GCSettings.NGCZoom ^= 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
GCSettings.render++;
|
|
|
|
if (GCSettings.render > 2 )
|
|
|
|
GCSettings.render = 0;
|
|
|
|
// reset zoom
|
2008-09-23 06:54:53 +02:00
|
|
|
zoom_reset ();
|
2008-08-07 05:25:02 +02:00
|
|
|
break;
|
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
case 4:
|
|
|
|
GCSettings.widescreen ^= 1;
|
2008-08-07 05:25:02 +02:00
|
|
|
break;
|
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
case 5:
|
2008-09-30 08:43:34 +02:00
|
|
|
// Move up
|
|
|
|
GCSettings.yshift--;
|
2008-08-07 05:25:02 +02:00
|
|
|
break;
|
2008-09-30 07:31:46 +02:00
|
|
|
case 6:
|
2008-09-30 08:43:34 +02:00
|
|
|
// Move down
|
|
|
|
GCSettings.yshift++;
|
2008-08-07 05:25:02 +02:00
|
|
|
break;
|
2008-09-30 07:31:46 +02:00
|
|
|
case 7:
|
2008-09-30 08:43:34 +02:00
|
|
|
// Move left
|
|
|
|
GCSettings.xshift--;
|
2008-08-07 05:25:02 +02:00
|
|
|
break;
|
2008-09-30 07:31:46 +02:00
|
|
|
case 8:
|
2008-09-30 08:43:34 +02:00
|
|
|
// Move right
|
|
|
|
GCSettings.xshift++;
|
2008-08-07 05:25:02 +02:00
|
|
|
break;
|
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
case 9:
|
2008-08-07 05:25:02 +02:00
|
|
|
break;
|
2008-09-23 06:54:53 +02:00
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
case 10:
|
|
|
|
// reset video shifts
|
|
|
|
GCSettings.xshift = GCSettings.yshift = 0;
|
|
|
|
WaitPrompt((char *)"Video Shift Reset");
|
|
|
|
break;
|
|
|
|
|
2008-08-07 05:25:02 +02:00
|
|
|
case -1: // Button B
|
2008-10-04 03:02:05 +02:00
|
|
|
case 11:
|
2008-08-07 05:25:02 +02:00
|
|
|
quit = 1;
|
|
|
|
break;
|
2008-09-30 07:31:46 +02:00
|
|
|
|
2008-08-07 05:25:02 +02:00
|
|
|
}
|
|
|
|
}
|
2008-08-06 03:09:59 +02:00
|
|
|
menu = oldmenu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2008-08-06 03:45:56 +02:00
|
|
|
* Controller Configuration
|
2008-08-06 03:09:59 +02:00
|
|
|
*
|
2008-09-12 07:28:40 +02:00
|
|
|
* Snes9x 1.51 uses a cmd system to work out which button has been pressed.
|
|
|
|
* Here, I simply move the designated value to the gcpadmaps array, which
|
|
|
|
* saves on updating the cmd sequences.
|
|
|
|
***************************************************************************/
|
2008-08-06 03:45:56 +02:00
|
|
|
u32
|
|
|
|
GetInput (u16 ctrlr_type)
|
|
|
|
{
|
2008-08-07 05:25:02 +02:00
|
|
|
//u32 exp_type;
|
|
|
|
u32 pressed;
|
2008-08-06 03:45:56 +02:00
|
|
|
pressed=0;
|
2008-08-06 03:55:59 +02:00
|
|
|
s8 gc_px = 0;
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-06 03:45:56 +02:00
|
|
|
while( PAD_ButtonsHeld(0)
|
|
|
|
#ifdef HW_RVL
|
|
|
|
| WPAD_ButtonsHeld(0)
|
|
|
|
#endif
|
|
|
|
) VIDEO_WaitVSync(); // button 'debounce'
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-06 03:45:56 +02:00
|
|
|
while (pressed == 0)
|
|
|
|
{
|
|
|
|
VIDEO_WaitVSync();
|
|
|
|
// get input based on controller type
|
2008-08-07 05:25:02 +02:00
|
|
|
if (ctrlr_type == CTRLR_GCPAD)
|
2008-08-06 03:55:59 +02:00
|
|
|
{
|
2008-08-06 03:45:56 +02:00
|
|
|
pressed = PAD_ButtonsHeld (0);
|
2008-08-06 03:55:59 +02:00
|
|
|
gc_px = PAD_SubStickX (0);
|
2008-08-07 05:25:02 +02:00
|
|
|
}
|
2008-08-06 03:45:56 +02:00
|
|
|
#ifdef HW_RVL
|
2008-08-07 05:25:02 +02:00
|
|
|
else
|
|
|
|
{
|
2008-08-06 03:45:56 +02:00
|
|
|
// if ( WPAD_Probe( 0, &exp_type) == 0) // check wiimote and expansion status (first if wiimote is connected & no errors)
|
|
|
|
// {
|
|
|
|
pressed = WPAD_ButtonsHeld (0);
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-06 03:45:56 +02:00
|
|
|
// if (ctrlr_type != CTRLR_WIIMOTE && exp_type != ctrlr_type+1) // if we need input from an expansion, and its not connected...
|
|
|
|
// pressed = 0;
|
|
|
|
// }
|
2008-08-06 03:55:59 +02:00
|
|
|
}
|
2008-08-06 03:45:56 +02:00
|
|
|
#endif
|
2008-08-06 03:55:59 +02:00
|
|
|
/*** check for exit sequence (c-stick left OR home button) ***/
|
|
|
|
if ( (gc_px < -70) || (pressed & WPAD_BUTTON_HOME) || (pressed & WPAD_CLASSIC_BUTTON_HOME) )
|
|
|
|
return 0;
|
2008-08-06 03:45:56 +02:00
|
|
|
} // end while
|
2008-08-07 05:25:02 +02:00
|
|
|
while( pressed == (PAD_ButtonsHeld(0)
|
2008-08-06 03:45:56 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
| WPAD_ButtonsHeld(0)
|
|
|
|
#endif
|
|
|
|
) ) VIDEO_WaitVSync();
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-06 03:45:56 +02:00
|
|
|
return pressed;
|
|
|
|
} // end GetInput()
|
|
|
|
|
2008-08-06 03:55:59 +02:00
|
|
|
int cfg_text_count = 7;
|
2008-08-07 05:25:02 +02:00
|
|
|
char cfg_text[][50] = {
|
2008-08-06 03:55:59 +02:00
|
|
|
"Remapping ",
|
2008-08-06 03:45:56 +02:00
|
|
|
"Press Any Button",
|
|
|
|
"on the",
|
2008-08-06 03:55:59 +02:00
|
|
|
" ", // identify controller
|
|
|
|
" ",
|
|
|
|
"Press C-Left or",
|
|
|
|
"Home to exit"
|
2008-08-06 03:09:59 +02:00
|
|
|
};
|
|
|
|
|
2008-08-06 03:45:56 +02:00
|
|
|
u32
|
|
|
|
GetButtonMap(u16 ctrlr_type, char* btn_name)
|
|
|
|
{
|
|
|
|
u32 pressed, previous;
|
2008-08-07 05:25:02 +02:00
|
|
|
char temp[50] = "";
|
2008-08-12 05:25:16 +02:00
|
|
|
uint k;
|
2008-08-06 03:45:56 +02:00
|
|
|
pressed = 0; previous = 1;
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-06 03:45:56 +02:00
|
|
|
switch (ctrlr_type) {
|
|
|
|
case CTRLR_NUNCHUK:
|
|
|
|
strncpy (cfg_text[3], (char*)"NUNCHUK", 7);
|
|
|
|
break;
|
|
|
|
case CTRLR_CLASSIC:
|
|
|
|
strncpy (cfg_text[3], (char*)"CLASSIC", 7);
|
|
|
|
break;
|
|
|
|
case CTRLR_GCPAD:
|
|
|
|
strncpy (cfg_text[3], (char*)"GC PAD", 7);
|
|
|
|
break;
|
|
|
|
case CTRLR_WIIMOTE:
|
|
|
|
strncpy (cfg_text[3], (char*)"WIIMOTE", 7);
|
|
|
|
break;
|
2008-08-07 05:25:02 +02:00
|
|
|
};
|
|
|
|
|
2008-08-06 03:55:59 +02:00
|
|
|
/*** note which button we are remapping ***/
|
|
|
|
sprintf (temp, (char*)"Remapping ");
|
2008-08-12 05:25:16 +02:00
|
|
|
for (k=0; k<9-strlen(btn_name); k++) strcat(temp, " "); // add whitespace padding to align text
|
2008-08-06 03:55:59 +02:00
|
|
|
strncat (temp, btn_name, 9); // snes button we are remapping
|
|
|
|
strncpy (cfg_text[0], temp, 19); // copy this all back to the text we wish to display
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-06 03:55:59 +02:00
|
|
|
DrawMenu(&cfg_text[0], NULL, cfg_text_count, 1); // display text
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-06 03:45:56 +02:00
|
|
|
// while (previous != pressed && pressed == 0); // get two consecutive button presses (which are the same)
|
|
|
|
// {
|
|
|
|
// previous = pressed;
|
|
|
|
// VIDEO_WaitVSync(); // slow things down a bit so we don't overread the pads
|
|
|
|
pressed = GetInput(ctrlr_type);
|
|
|
|
// }
|
|
|
|
return pressed;
|
|
|
|
} // end getButtonMap()
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-06 03:45:56 +02:00
|
|
|
int cfg_btns_count = 13;
|
2008-08-07 05:25:02 +02:00
|
|
|
char cfg_btns_menu[][50] = {
|
2008-08-06 03:45:56 +02:00
|
|
|
"A - ",
|
|
|
|
"B - ",
|
|
|
|
"X - ",
|
|
|
|
"Y - ",
|
|
|
|
"L TRIG - ",
|
|
|
|
"R TRIG - ",
|
|
|
|
"SELECT - ",
|
|
|
|
"START - ",
|
|
|
|
"UP - ",
|
|
|
|
"DOWN - ",
|
|
|
|
"LEFT - ",
|
|
|
|
"RIGHT - ",
|
|
|
|
"Return to previous"
|
2008-08-06 03:09:59 +02:00
|
|
|
};
|
|
|
|
|
2008-08-06 03:45:56 +02:00
|
|
|
extern unsigned int gcpadmap[];
|
|
|
|
extern unsigned int wmpadmap[];
|
|
|
|
extern unsigned int ccpadmap[];
|
|
|
|
extern unsigned int ncpadmap[];
|
2008-08-06 03:09:59 +02:00
|
|
|
|
|
|
|
void
|
2008-08-06 03:45:56 +02:00
|
|
|
ConfigureButtons (u16 ctrlr_type)
|
2008-08-06 03:09:59 +02:00
|
|
|
{
|
|
|
|
int quit = 0;
|
|
|
|
int ret = 0;
|
|
|
|
int oldmenu = menu;
|
|
|
|
menu = 0;
|
2008-08-12 05:25:16 +02:00
|
|
|
char* menu_title = NULL;
|
2008-08-06 03:45:56 +02:00
|
|
|
u32 pressed;
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-12 05:25:16 +02:00
|
|
|
unsigned int* currentpadmap = 0;
|
2008-08-07 05:25:02 +02:00
|
|
|
char temp[50] = "";
|
2008-08-12 05:25:16 +02:00
|
|
|
int i, j;
|
|
|
|
uint k;
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-06 03:45:56 +02:00
|
|
|
/*** Update Menu Title (based on controller we're configuring) ***/
|
|
|
|
switch (ctrlr_type) {
|
|
|
|
case CTRLR_NUNCHUK:
|
|
|
|
menu_title = (char*)"SNES - NUNCHUK";
|
|
|
|
currentpadmap = ncpadmap;
|
|
|
|
break;
|
|
|
|
case CTRLR_CLASSIC:
|
|
|
|
menu_title = (char*)"SNES - CLASSIC";
|
|
|
|
currentpadmap = ccpadmap;
|
|
|
|
break;
|
|
|
|
case CTRLR_GCPAD:
|
|
|
|
menu_title = (char*)"SNES - GC PAD";
|
|
|
|
currentpadmap = gcpadmap;
|
|
|
|
break;
|
|
|
|
case CTRLR_WIIMOTE:
|
|
|
|
menu_title = (char*)"SNES - WIIMOTE";
|
|
|
|
currentpadmap = wmpadmap;
|
|
|
|
break;
|
|
|
|
};
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
while (quit == 0)
|
2008-08-07 05:25:02 +02:00
|
|
|
{
|
2008-08-06 03:45:56 +02:00
|
|
|
/*** Update Menu with Current ButtonMap ***/
|
|
|
|
for (i=0; i<12; i++) // snes pad has 12 buttons to config (go thru them)
|
|
|
|
{
|
|
|
|
// get current padmap button name to display
|
2008-08-07 05:25:02 +02:00
|
|
|
for ( j=0;
|
2008-08-06 03:55:59 +02:00
|
|
|
j < ctrlr_def[ctrlr_type].num_btns &&
|
2008-08-06 03:45:56 +02:00
|
|
|
currentpadmap[i] != ctrlr_def[ctrlr_type].map[j].btn // match padmap button press with button names
|
|
|
|
; j++ );
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-06 03:45:56 +02:00
|
|
|
memset (temp, 0, sizeof(temp));
|
|
|
|
strncpy (temp, cfg_btns_menu[i], 12); // copy snes button information
|
|
|
|
if (currentpadmap[i] == ctrlr_def[ctrlr_type].map[j].btn) // check if a match was made
|
2008-08-06 03:55:59 +02:00
|
|
|
{
|
|
|
|
for (k=0; k<7-strlen(ctrlr_def[ctrlr_type].map[j].name) ;k++) strcat(temp, " "); // add whitespace padding to align text
|
2008-08-06 03:45:56 +02:00
|
|
|
strncat (temp, ctrlr_def[ctrlr_type].map[j].name, 6); // update button map display
|
2008-08-06 03:55:59 +02:00
|
|
|
}
|
2008-08-06 03:45:56 +02:00
|
|
|
else
|
|
|
|
strcat (temp, (char*)"---"); // otherwise, button is 'unmapped'
|
|
|
|
strncpy (cfg_btns_menu[i], temp, 19); // move back updated information
|
|
|
|
|
|
|
|
}
|
2008-08-07 05:25:02 +02:00
|
|
|
|
|
|
|
ret = RunMenu (cfg_btns_menu, cfg_btns_count, menu_title, 16);
|
|
|
|
|
2008-08-06 03:45:56 +02:00
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
case 7:
|
|
|
|
case 8:
|
|
|
|
case 9:
|
|
|
|
case 10:
|
|
|
|
case 11:
|
|
|
|
/*** Change button map ***/
|
|
|
|
// wait for input
|
|
|
|
memset (temp, 0, sizeof(temp));
|
|
|
|
strncpy(temp, cfg_btns_menu[ret], 6); // get the name of the snes button we're changing
|
|
|
|
pressed = GetButtonMap(ctrlr_type, temp); // get a button selection from user
|
|
|
|
// FIX: check if input is valid for this controller
|
2008-08-06 03:55:59 +02:00
|
|
|
if (pressed != 0) // check if a the button was configured, or if the user exited.
|
|
|
|
currentpadmap[ret] = pressed; // update mapping
|
2008-08-06 03:45:56 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case -1: /*** Button B ***/
|
|
|
|
case 12:
|
|
|
|
/*** Return ***/
|
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
menu = oldmenu;
|
|
|
|
} // end configurebuttons()
|
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
int ctlrmenucount = 9;
|
2008-08-07 05:25:02 +02:00
|
|
|
char ctlrmenu[][50] = {
|
2008-08-08 04:09:02 +02:00
|
|
|
// toggle:
|
2008-08-07 05:25:02 +02:00
|
|
|
"MultiTap",
|
|
|
|
"SuperScope",
|
2008-08-08 04:09:02 +02:00
|
|
|
"Snes Mice",
|
|
|
|
"Justifiers",
|
|
|
|
// config:
|
2008-08-07 05:25:02 +02:00
|
|
|
"Nunchuk",
|
2008-08-06 03:45:56 +02:00
|
|
|
"Classic Controller",
|
|
|
|
"Wiimote",
|
2008-08-08 04:09:02 +02:00
|
|
|
"Gamecube Pad",
|
2008-09-30 07:31:46 +02:00
|
|
|
"Back to Preferences Menu"
|
2008-08-06 03:45:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
ConfigureControllers ()
|
|
|
|
{
|
|
|
|
int quit = 0;
|
|
|
|
int ret = 0;
|
|
|
|
int oldmenu = menu;
|
|
|
|
menu = 0;
|
2008-08-07 05:25:02 +02:00
|
|
|
|
|
|
|
// disable unavailable controller options if in GC mode
|
|
|
|
#ifndef HW_RVL
|
|
|
|
ctlrmenu[4][0] = '\0';
|
2008-08-08 04:09:02 +02:00
|
|
|
ctlrmenu[5][0] = '\0';
|
|
|
|
ctlrmenu[6][0] = '\0';
|
2008-08-07 05:25:02 +02:00
|
|
|
#endif
|
|
|
|
|
2008-08-06 03:45:56 +02:00
|
|
|
while (quit == 0)
|
2008-08-07 05:25:02 +02:00
|
|
|
{
|
|
|
|
sprintf (ctlrmenu[0], "MultiTap %s", Settings.MultiPlayer5Master == true ? " ON" : "OFF");
|
2008-08-07 07:19:17 +02:00
|
|
|
|
2008-08-08 04:09:02 +02:00
|
|
|
if (GCSettings.Superscope > 0) sprintf (ctlrmenu[1], "Superscope: Pad %d", GCSettings.Superscope);
|
|
|
|
else sprintf (ctlrmenu[1], "Superscope OFF");
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-08 04:09:02 +02:00
|
|
|
if (GCSettings.Mouse > 0) sprintf (ctlrmenu[2], "Mice: %d", GCSettings.Mouse);
|
|
|
|
else sprintf (ctlrmenu[2], "Mice: OFF");
|
2008-08-08 09:57:01 +02:00
|
|
|
|
2008-08-08 04:09:02 +02:00
|
|
|
if (GCSettings.Justifier > 0) sprintf (ctlrmenu[3], "Justifiers: %d", GCSettings.Justifier);
|
|
|
|
else sprintf (ctlrmenu[3], "Justifiers: OFF");
|
2008-08-07 08:46:36 +02:00
|
|
|
|
2008-08-07 05:25:02 +02:00
|
|
|
/*** Controller Config Menu ***/
|
|
|
|
ret = RunMenu (ctlrmenu, ctlrmenucount, (char*)"Configure Controllers");
|
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
2008-08-08 04:09:02 +02:00
|
|
|
Settings.MultiPlayer5Master ^= 1;
|
2008-08-07 05:25:02 +02:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
GCSettings.Superscope ++;
|
|
|
|
if (GCSettings.Superscope > 4)
|
|
|
|
GCSettings.Superscope = 0;
|
2008-08-07 08:46:36 +02:00
|
|
|
break;
|
2008-08-07 05:25:02 +02:00
|
|
|
case 2:
|
2008-08-07 08:46:36 +02:00
|
|
|
GCSettings.Mouse ++;
|
2008-08-08 04:09:02 +02:00
|
|
|
if (GCSettings.Mouse > 2)
|
2008-08-07 08:46:36 +02:00
|
|
|
GCSettings.Mouse = 0;
|
|
|
|
break;
|
|
|
|
case 3:
|
2008-08-08 04:09:02 +02:00
|
|
|
GCSettings.Justifier ++;
|
|
|
|
if (GCSettings.Justifier > 2)
|
|
|
|
GCSettings.Justifier = 0;
|
|
|
|
break;
|
2008-08-08 09:57:01 +02:00
|
|
|
|
2008-08-08 04:09:02 +02:00
|
|
|
case 4:
|
2008-08-06 03:45:56 +02:00
|
|
|
/*** Configure Nunchuk ***/
|
|
|
|
ConfigureButtons (CTRLR_NUNCHUK);
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-08 04:09:02 +02:00
|
|
|
case 5:
|
2008-08-06 03:45:56 +02:00
|
|
|
/*** Configure Classic ***/
|
|
|
|
ConfigureButtons (CTRLR_CLASSIC);
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
2008-08-08 09:57:01 +02:00
|
|
|
|
2008-08-07 08:46:36 +02:00
|
|
|
case 6:
|
2008-08-06 03:45:56 +02:00
|
|
|
/*** Configure Wiimote ***/
|
|
|
|
ConfigureButtons (CTRLR_WIIMOTE);
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
2008-08-06 03:45:56 +02:00
|
|
|
|
2008-08-07 08:46:36 +02:00
|
|
|
case 7:
|
2008-08-08 04:09:02 +02:00
|
|
|
/*** Configure GC Pad ***/
|
|
|
|
ConfigureButtons (CTRLR_GCPAD);
|
|
|
|
break;
|
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
case -1: /*** Button B ***/
|
2008-08-08 04:09:02 +02:00
|
|
|
case 8:
|
2008-09-30 07:31:46 +02:00
|
|
|
/*** Return ***/
|
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
menu = oldmenu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Preferences Menu
|
|
|
|
***************************************************************************/
|
|
|
|
static int prefmenuCount = 5;
|
|
|
|
static char prefmenu[][50] = {
|
|
|
|
"Controllers",
|
2008-10-04 03:02:05 +02:00
|
|
|
"Video",
|
2008-09-30 07:31:46 +02:00
|
|
|
"Saving / Loading",
|
|
|
|
"Reset Preferences",
|
|
|
|
"Back to Main Menu"
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
PreferencesMenu ()
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
int quit = 0;
|
|
|
|
int oldmenu = menu;
|
|
|
|
menu = 0;
|
|
|
|
while (quit == 0)
|
|
|
|
{
|
|
|
|
ret = RunMenu (prefmenu, prefmenuCount, (char*)"Preferences");
|
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
ConfigureControllers ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
VideoOptions ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
FileOptions ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
DefaultSettings ();
|
|
|
|
WaitPrompt((char *)"Preferences Reset");
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case -1: /*** Button B ***/
|
2008-09-30 07:31:46 +02:00
|
|
|
case 4:
|
2008-10-03 23:19:45 +02:00
|
|
|
SavePrefs(GCSettings.SaveMethod, SILENT);
|
2008-08-06 03:09:59 +02:00
|
|
|
quit = 1;
|
|
|
|
break;
|
2008-09-30 07:31:46 +02:00
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
menu = oldmenu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Main Menu
|
2008-09-12 07:28:40 +02:00
|
|
|
***************************************************************************/
|
2008-09-30 07:31:46 +02:00
|
|
|
int menucount = 7;
|
2008-08-07 05:25:02 +02:00
|
|
|
char menuitems[][50] = {
|
2008-09-30 07:31:46 +02:00
|
|
|
"Choose Game",
|
2008-09-28 04:13:19 +02:00
|
|
|
"Preferences",
|
2008-08-07 05:25:02 +02:00
|
|
|
"Game Menu",
|
2008-09-30 07:31:46 +02:00
|
|
|
"Credits",
|
2008-09-28 05:12:15 +02:00
|
|
|
"DVD Motor Off",
|
2008-09-30 07:31:46 +02:00
|
|
|
"Reset System",
|
2008-09-28 04:13:19 +02:00
|
|
|
"Return to Loader"
|
2008-08-06 03:09:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
void
|
2008-09-30 07:31:46 +02:00
|
|
|
MainMenu (int selectedMenu)
|
2008-08-06 03:09:59 +02:00
|
|
|
{
|
|
|
|
int quit = 0;
|
|
|
|
int ret;
|
2008-08-07 05:25:02 +02:00
|
|
|
|
|
|
|
// disable game-specific menu items if a ROM isn't loaded
|
|
|
|
if ( ARAM_ROMSIZE == 0 )
|
2008-09-30 07:31:46 +02:00
|
|
|
menuitems[2][0] = '\0';
|
2008-08-06 03:09:59 +02:00
|
|
|
else
|
2008-09-30 07:31:46 +02:00
|
|
|
sprintf (menuitems[2], "Game Menu");
|
|
|
|
|
2008-09-28 05:12:15 +02:00
|
|
|
#ifndef HW_DOL
|
|
|
|
// don't show dvd motor off on the wii
|
2008-09-30 07:31:46 +02:00
|
|
|
menuitems[4][0] = '\0';
|
2008-09-28 05:12:15 +02:00
|
|
|
#endif
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
VIDEO_WaitVSync ();
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
while (quit == 0)
|
|
|
|
{
|
2008-08-07 05:25:02 +02:00
|
|
|
if(selectedMenu >= 0)
|
|
|
|
{
|
|
|
|
ret = selectedMenu;
|
|
|
|
selectedMenu = -1; // default back to main menu
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ret = RunMenu (menuitems, menucount, (char*)"Main Menu");
|
|
|
|
}
|
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
2008-08-07 05:25:02 +02:00
|
|
|
// Load ROM Menu
|
2008-08-06 03:09:59 +02:00
|
|
|
quit = LoadManager ();
|
|
|
|
break;
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
case 1:
|
2008-08-07 05:25:02 +02:00
|
|
|
// Preferences
|
|
|
|
PreferencesMenu ();
|
|
|
|
break;
|
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
case 2:
|
2008-08-07 05:25:02 +02:00
|
|
|
// Game Options
|
|
|
|
quit = GameMenu ();
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
2008-09-28 04:13:19 +02:00
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
case 3:
|
2008-08-07 05:25:02 +02:00
|
|
|
// Credits
|
|
|
|
Credits ();
|
|
|
|
WaitButtonA ();
|
|
|
|
break;
|
2008-09-30 07:31:46 +02:00
|
|
|
|
|
|
|
case 4:
|
2008-09-28 05:12:15 +02:00
|
|
|
// turn the dvd motor off (GC only)
|
|
|
|
#ifdef HW_DOL
|
|
|
|
dvd_motor_off ();
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
case 5:
|
2008-08-07 05:25:02 +02:00
|
|
|
// Reset the Gamecube/Wii
|
|
|
|
Reboot();
|
|
|
|
break;
|
|
|
|
|
2008-09-30 07:31:46 +02:00
|
|
|
case 6:
|
2008-08-07 05:25:02 +02:00
|
|
|
// Exit to Loader
|
2008-08-06 04:31:44 +02:00
|
|
|
#ifdef HW_RVL
|
2008-08-19 08:05:57 +02:00
|
|
|
#ifdef WII_DVD
|
|
|
|
DI_Close();
|
|
|
|
#endif
|
2008-08-07 05:25:02 +02:00
|
|
|
exit(0);
|
2008-08-06 03:39:43 +02:00
|
|
|
#else // gamecube
|
2008-08-07 05:25:02 +02:00
|
|
|
if (psoid[0] == PSOSDLOADID)
|
|
|
|
PSOReload ();
|
2008-08-06 03:39:43 +02:00
|
|
|
#endif
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
2008-08-07 05:25:02 +02:00
|
|
|
|
|
|
|
case -1: // Button B
|
|
|
|
// Return to Game
|
2008-08-06 03:09:59 +02:00
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-08-07 05:25:02 +02:00
|
|
|
|
2008-10-04 03:02:05 +02:00
|
|
|
// Wait for buttons to be released
|
|
|
|
int count = 0; // how long we've been waiting for the user to release the button
|
|
|
|
while(count < 50 && (
|
|
|
|
PAD_ButtonsHeld(0)
|
|
|
|
#ifdef HW_RVL
|
|
|
|
|| WPAD_ButtonsHeld(0)
|
|
|
|
#endif
|
|
|
|
))
|
|
|
|
{
|
|
|
|
VIDEO_WaitVSync();
|
|
|
|
count++;
|
|
|
|
}
|
2008-08-06 03:09:59 +02:00
|
|
|
}
|