2008-08-06 03:09:59 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Snes9x 1.50
|
|
|
|
*
|
|
|
|
* Nintendo Gamecube Menu
|
|
|
|
*
|
|
|
|
* softdev July 2006
|
|
|
|
* crunchy2 May-June 2007
|
|
|
|
****************************************************************************/
|
|
|
|
#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-06 03:09:59 +02:00
|
|
|
#include "snes9x.h"
|
|
|
|
#include "snes9xGx.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"
|
|
|
|
#include "aram.h"
|
|
|
|
#include "ftfont.h"
|
|
|
|
#include "video.h"
|
|
|
|
#include "mcsave.h"
|
|
|
|
#include "filesel.h"
|
2008-08-06 03:55:59 +02:00
|
|
|
#include "unzip.h"
|
2008-08-06 03:09:59 +02:00
|
|
|
#include "smbload.h"
|
|
|
|
#include "mcsave.h"
|
|
|
|
#include "sdload.h"
|
|
|
|
#include "memfile.h"
|
|
|
|
#include "dvd.h"
|
|
|
|
#include "s9xconfig.h"
|
|
|
|
#include "sram.h"
|
|
|
|
#include "preferences.h"
|
|
|
|
|
2008-08-06 03:45:56 +02:00
|
|
|
#include "button_mapping.h"
|
|
|
|
#include "ftfont.h"
|
|
|
|
|
2008-08-06 03:55:59 +02:00
|
|
|
extern void DrawMenu (char items[][20], char *title, int maxitems, int selected, int fontsize);
|
2008-08-06 03:45:56 +02:00
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
#define PSOSDLOADID 0x7c6000a6
|
|
|
|
extern int menu;
|
|
|
|
extern unsigned long ARAM_ROMSIZE;
|
|
|
|
|
|
|
|
#define SOFTRESET_ADR ((volatile u32*)0xCC003024)
|
|
|
|
|
|
|
|
|
2008-08-06 03:39:43 +02:00
|
|
|
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
|
|
|
/****************************************************************************
|
|
|
|
* Freeze Manager
|
|
|
|
****************************************************************************/
|
2008-08-06 03:39:43 +02:00
|
|
|
int freezecountwii = 7;
|
|
|
|
char freezemenuwii[][20] = { "Freeze to SD", "Thaw from SD",
|
|
|
|
"Freeze to MC Slot A", "Thaw from MC Slot A",
|
2008-08-06 03:09:59 +02:00
|
|
|
"Freeze to MC Slot B", "Thaw from MC Slot B",
|
|
|
|
"Return to previous"
|
|
|
|
};
|
2008-08-06 03:39:43 +02:00
|
|
|
int freezecount = 9;
|
|
|
|
char freezemenu[][20] = { "Freeze to SD", "Thaw from SD",
|
|
|
|
"Freeze to MC Slot A", "Thaw from MC Slot A",
|
2008-08-06 03:09:59 +02:00
|
|
|
"Freeze to MC Slot B", "Thaw from MC Slot B",
|
|
|
|
"Freeze to SMB", "Thaw from SMB",
|
|
|
|
"Return to previous"
|
|
|
|
};
|
|
|
|
int
|
|
|
|
FreezeManager ()
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
int loaded = 0;
|
|
|
|
int quit = 0;
|
|
|
|
int oldmenu = menu;
|
|
|
|
menu = 0;
|
|
|
|
|
|
|
|
|
|
|
|
while (quit == 0)
|
|
|
|
{
|
|
|
|
if ( isWii ) /* Wii menu */
|
|
|
|
{
|
2008-08-06 03:45:56 +02:00
|
|
|
ret = RunMenu (freezemenuwii, freezecountwii, (char*)"Freeze Manager");
|
2008-08-06 03:09:59 +02:00
|
|
|
if (ret >= freezecountwii-1)
|
|
|
|
ret = freezecount-1;
|
|
|
|
}
|
|
|
|
else /* Gamecube menu */
|
2008-08-06 03:45:56 +02:00
|
|
|
ret = RunMenu (freezemenu, freezecount, (char*)"Freeze Manager");
|
2008-08-06 03:09:59 +02:00
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
2008-08-06 03:39:43 +02:00
|
|
|
case 0:/*** Freeze to SDCard ***/
|
|
|
|
NGCFreezeGame (2, NOTSILENT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:/*** Thaw from SDCard***/
|
|
|
|
quit = loaded = NGCUnfreezeGame (2, NOTSILENT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:/*** Freeze to MC in slot A ***/
|
2008-08-06 03:09:59 +02:00
|
|
|
NGCFreezeGame (0, NOTSILENT);
|
|
|
|
break;
|
|
|
|
|
2008-08-06 03:39:43 +02:00
|
|
|
case 3:/*** Thaw from MC in slot A ***/
|
2008-08-06 03:09:59 +02:00
|
|
|
quit = loaded = NGCUnfreezeGame (0, NOTSILENT);
|
|
|
|
break;
|
|
|
|
|
2008-08-06 03:39:43 +02:00
|
|
|
case 4:/*** Freeze to MC in slot B ***/
|
2008-08-06 03:09:59 +02:00
|
|
|
NGCFreezeGame (1, NOTSILENT);
|
|
|
|
break;
|
|
|
|
|
2008-08-06 03:39:43 +02:00
|
|
|
case 5:/*** Thaw from MC in slot B ***/
|
2008-08-06 03:09:59 +02:00
|
|
|
quit = loaded = NGCUnfreezeGame (1, NOTSILENT);
|
|
|
|
break;
|
|
|
|
|
2008-08-06 03:39:43 +02:00
|
|
|
case 6:/*** Freeze to SMB ***/
|
2008-08-06 03:09:59 +02:00
|
|
|
if ( !isWii )
|
|
|
|
NGCFreezeGame (4, NOTSILENT);
|
|
|
|
break;
|
|
|
|
|
2008-08-06 03:39:43 +02:00
|
|
|
case 7:/*** Thaw from SMB ***/
|
2008-08-06 03:09:59 +02:00
|
|
|
if ( !isWii )
|
|
|
|
quit = loaded = NGCUnfreezeGame (4, NOTSILENT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case -1: /*** Button B ***/
|
2008-08-06 03:39:43 +02:00
|
|
|
case 8:
|
2008-08-06 03:09:59 +02:00
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
menu = oldmenu;
|
|
|
|
return loaded;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Load Manager
|
|
|
|
****************************************************************************/
|
2008-08-06 04:31:44 +02:00
|
|
|
int loadmancountwii = 3;
|
2008-08-06 03:39:43 +02:00
|
|
|
char loadmanwii[][20] = { "Load from SD",
|
2008-08-06 04:31:44 +02:00
|
|
|
"Load from USB", "Return to previous"
|
2008-08-06 03:09:59 +02:00
|
|
|
};
|
2008-08-06 03:39:43 +02:00
|
|
|
int loadmancount = 4;
|
|
|
|
char loadman[][20] = { "Load from SD",
|
|
|
|
"Load from DVD", "Load from SMB", "Return to previous"
|
2008-08-06 03:09:59 +02:00
|
|
|
};
|
|
|
|
int
|
|
|
|
LoadManager ()
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
int quit = 0;
|
|
|
|
int oldmenu = menu;
|
2008-08-06 03:39:43 +02:00
|
|
|
int retval = 1;
|
2008-08-06 03:09:59 +02:00
|
|
|
menu = 0;
|
|
|
|
|
|
|
|
while (quit == 0)
|
|
|
|
{
|
2008-08-06 04:31:44 +02:00
|
|
|
#ifdef HW_RVL
|
|
|
|
/* Wii menu */
|
|
|
|
ret = RunMenu (loadmanwii, loadmancountwii, (char*)"Load Manager");
|
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
/*** Load from SD ***/
|
|
|
|
quit = OpenSD ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
/*** Load from USB ***/
|
|
|
|
quit = OpenUSB ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case -1: /*** Button B ***/
|
|
|
|
case 2:
|
|
|
|
retval = 0;
|
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
/* Gamecube menu */
|
|
|
|
ret = RunMenu (loadman, loadmancount, (char*)"Load Manager");
|
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
switch (ret)
|
|
|
|
{
|
2008-08-06 03:39:43 +02:00
|
|
|
case 0:
|
|
|
|
/*** Load from SD ***/
|
2008-08-06 03:55:59 +02:00
|
|
|
quit = OpenSD ();
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
2008-08-06 03:39:43 +02:00
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
case 1:
|
2008-08-06 03:39:43 +02:00
|
|
|
/*** Load from DVD ***/
|
|
|
|
quit = OpenDVD ();
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2008-08-06 03:39:43 +02:00
|
|
|
/*** Load from SMB ***/ //(gamecube option)
|
|
|
|
quit = OpenSMB ();
|
|
|
|
break;
|
2008-08-06 03:09:59 +02:00
|
|
|
|
|
|
|
case -1: /*** Button B ***/
|
2008-08-06 03:39:43 +02:00
|
|
|
case 3:
|
2008-08-06 03:09:59 +02:00
|
|
|
retval = 0;
|
|
|
|
quit = 1;
|
|
|
|
break;
|
2008-08-06 04:31:44 +02:00
|
|
|
}
|
|
|
|
#endif
|
2008-08-06 03:09:59 +02:00
|
|
|
}
|
2008-08-06 03:39:43 +02:00
|
|
|
|
|
|
|
/***
|
|
|
|
* check for autoloadsram / freeze
|
|
|
|
***/
|
|
|
|
if ( retval == 1 ) // if ROM was loaded, load the SRAM & settings
|
|
|
|
{
|
|
|
|
if ( GCSettings.AutoLoad == 1 )
|
2008-08-06 03:55:59 +02:00
|
|
|
{
|
2008-08-06 03:39:43 +02:00
|
|
|
quickLoadSRAM ( SILENT );
|
2008-08-06 03:55:59 +02:00
|
|
|
S9xSoftReset(); // reset after loading sram
|
|
|
|
}
|
2008-08-06 03:39:43 +02:00
|
|
|
else if ( GCSettings.AutoLoad == 2 )
|
|
|
|
{
|
|
|
|
quickLoadFreeze ( SILENT );
|
|
|
|
}
|
|
|
|
}
|
2008-08-06 03:09:59 +02:00
|
|
|
|
|
|
|
menu = oldmenu;
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Save Manager
|
|
|
|
****************************************************************************/
|
2008-08-06 03:39:43 +02:00
|
|
|
int savecountwii = 7;
|
|
|
|
char savemenuwii[][20] = { "Save to SD", "Load from SD",
|
|
|
|
"Save to MC SLOT A", "Load from MC SLOT A",
|
2008-08-06 03:09:59 +02:00
|
|
|
"Save to MC SLOT B", "Load from MC SLOT B",
|
|
|
|
"Return to previous"
|
|
|
|
};
|
2008-08-06 03:39:43 +02:00
|
|
|
int savecount = 9;
|
|
|
|
char savemenu[][20] = { "Save to SD", "Load from SD",
|
|
|
|
"Save to MC SLOT A", "Load from MC SLOT A",
|
2008-08-06 03:09:59 +02:00
|
|
|
"Save to MC SLOT B", "Load from MC SLOT B",
|
|
|
|
"Save to SMB", "Load from SMB",
|
|
|
|
"Return to previous"
|
|
|
|
};
|
|
|
|
void
|
|
|
|
SaveManager ()
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
int quit = 0;
|
|
|
|
int oldmenu = menu;
|
|
|
|
menu = 0;
|
|
|
|
|
|
|
|
while (quit == 0)
|
|
|
|
{
|
|
|
|
if ( isWii ) /* Wii menu */
|
|
|
|
{
|
2008-08-06 03:55:59 +02:00
|
|
|
ret = RunMenu (savemenuwii, savecountwii, (char*)"SRAM Manager");
|
2008-08-06 03:09:59 +02:00
|
|
|
if (ret >= savecountwii-1)
|
|
|
|
ret = savecount-1;
|
|
|
|
}
|
|
|
|
else /* Gamecube menu */
|
2008-08-06 03:55:59 +02:00
|
|
|
ret = RunMenu (savemenu, savecount, (char*)"SRAM Manager");
|
2008-08-06 03:09:59 +02:00
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
2008-08-06 03:39:43 +02:00
|
|
|
case 0:
|
|
|
|
/*** Save to SD***/
|
2008-08-06 03:55:59 +02:00
|
|
|
SaveSRAMToSD (NOTSILENT);
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2008-08-06 03:39:43 +02:00
|
|
|
/*** Load from SD***/
|
2008-08-06 03:55:59 +02:00
|
|
|
LoadSRAMFromSD (NOTSILENT);
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2008-08-06 03:39:43 +02:00
|
|
|
/*** Save to MC slot A ***/
|
|
|
|
SaveSRAMToMC (CARD_SLOTA, NOTSILENT);
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2008-08-06 03:39:43 +02:00
|
|
|
/*** Load from MC slot A ***/
|
|
|
|
LoadSRAMFromMC (CARD_SLOTA, NOTSILENT);
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
2008-08-06 03:39:43 +02:00
|
|
|
/*** Save to MC slot B ***/
|
|
|
|
SaveSRAMToMC (CARD_SLOTB, NOTSILENT);
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
2008-08-06 03:39:43 +02:00
|
|
|
/*** Load from MC slot B ***/
|
|
|
|
LoadSRAMFromMC (CARD_SLOTB, NOTSILENT);
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
2008-08-06 03:39:43 +02:00
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
case 6:
|
|
|
|
/*** Save to SMB **/
|
|
|
|
SaveSRAMToSMB (NOTSILENT);
|
|
|
|
break;
|
|
|
|
|
2008-08-06 03:39:43 +02:00
|
|
|
case 7:
|
2008-08-06 03:09:59 +02:00
|
|
|
/*** Load from SMB ***/
|
|
|
|
LoadSRAMFromSMB (NOTSILENT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case -1: /*** Button B ***/
|
2008-08-06 03:39:43 +02:00
|
|
|
case 8:
|
2008-08-06 03:09:59 +02:00
|
|
|
/*** Return ***/
|
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
menu = oldmenu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Emulator Options
|
|
|
|
****************************************************************************/
|
2008-08-06 04:31:44 +02:00
|
|
|
static int emuCount = 12;
|
2008-08-06 03:09:59 +02:00
|
|
|
static char emulatorOptions[][20] = { "Reverse Stereo OFF",
|
|
|
|
"Interp. Sound ON", "Transparency ON", "FPS Display OFF",
|
|
|
|
"MultiTap 5 OFF", "C-Stick Zoom OFF",
|
|
|
|
"Auto Load OFF", "Auto Save OFF", "Verify MC Saves OFF",
|
2008-08-06 16:40:28 +02:00
|
|
|
"Video Filtering OFF", "Superscope OFF",
|
|
|
|
"Save Prefs Now", "Return to previous"
|
2008-08-06 03:09:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
EmulatorOptions ()
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
int quit = 0;
|
|
|
|
int oldmenu = menu;
|
|
|
|
menu = 0;
|
|
|
|
|
|
|
|
while (quit == 0)
|
|
|
|
{
|
|
|
|
sprintf (emulatorOptions[0], "Reverse Stereo %s",
|
|
|
|
Settings.ReverseStereo == true ? " ON" : "OFF");
|
|
|
|
|
|
|
|
sprintf (emulatorOptions[1], "Interp. Sound %s",
|
|
|
|
Settings.InterpolatedSound == true ? " ON" : "OFF");
|
|
|
|
|
|
|
|
sprintf (emulatorOptions[2], "Transparency %s",
|
|
|
|
Settings.Transparency == true ? " ON" : "OFF");
|
|
|
|
|
|
|
|
sprintf (emulatorOptions[3], "FPS Display %s",
|
|
|
|
Settings.DisplayFrameRate == true ? " ON" : "OFF");
|
|
|
|
|
|
|
|
sprintf (emulatorOptions[4], "MultiTap 5 %s",
|
|
|
|
Settings.MultiPlayer5Master == true ? " ON" : "OFF");
|
|
|
|
|
|
|
|
sprintf (emulatorOptions[5], "C-Stick Zoom %s",
|
|
|
|
GCSettings.NGCZoom == true ? " ON" : "OFF");
|
|
|
|
|
|
|
|
if (GCSettings.AutoLoad == 0) sprintf (emulatorOptions[6],"Auto Load OFF");
|
|
|
|
else if (GCSettings.AutoLoad == 1) sprintf (emulatorOptions[6],"Auto Load SRAM");
|
|
|
|
else if (GCSettings.AutoLoad == 2) sprintf (emulatorOptions[6],"Auto Load FREEZE");
|
|
|
|
|
|
|
|
if (GCSettings.AutoSave == 0) sprintf (emulatorOptions[7],"Auto Save OFF");
|
|
|
|
else if (GCSettings.AutoSave == 1) sprintf (emulatorOptions[7],"Auto Save SRAM");
|
|
|
|
else if (GCSettings.AutoSave == 2) sprintf (emulatorOptions[7],"Auto Save FREEZE");
|
|
|
|
else if (GCSettings.AutoSave == 3) sprintf (emulatorOptions[7],"Auto Save BOTH");
|
|
|
|
|
|
|
|
sprintf (emulatorOptions[8], "Verify MC Saves %s",
|
|
|
|
GCSettings.VerifySaves == true ? " ON" : "OFF");
|
2008-08-06 04:31:44 +02:00
|
|
|
|
|
|
|
sprintf (emulatorOptions[9], "Video Filtering %s",
|
|
|
|
GCSettings.render == true ? " ON" : "OFF");
|
2008-08-06 16:40:28 +02:00
|
|
|
|
|
|
|
if (GCSettings.Superscope > 0) sprintf (emulatorOptions[10], "Superscope: Pad %d", GCSettings.Superscope);
|
|
|
|
else sprintf (emulatorOptions[10], "Superscope OFF");
|
2008-08-06 03:09:59 +02:00
|
|
|
|
2008-08-06 16:40:28 +02:00
|
|
|
ret = RunMenu (emulatorOptions, emuCount, (char*)"Emulator Options", 18);
|
2008-08-06 03:09:59 +02:00
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
2008-08-06 04:31:44 +02:00
|
|
|
Settings.ReverseStereo ^= 1;
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2008-08-06 04:31:44 +02:00
|
|
|
Settings.InterpolatedSound ^= 1;
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2008-08-06 04:31:44 +02:00
|
|
|
Settings.Transparency ^= 1;
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2008-08-06 04:31:44 +02:00
|
|
|
Settings.DisplayFrameRate ^= 1;
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
2008-08-06 04:31:44 +02:00
|
|
|
Settings.MultiPlayer5Master ^= 1;
|
2008-08-06 03:09:59 +02:00
|
|
|
|
|
|
|
if (Settings.MultiPlayer5Master)
|
|
|
|
{
|
|
|
|
S9xSetController (1, CTL_MP5, 1, 2, 3, -1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
S9xSetController (1, CTL_JOYPAD, 1, 0, 0, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
2008-08-06 04:31:44 +02:00
|
|
|
GCSettings.NGCZoom ^= 1;
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 6:
|
|
|
|
GCSettings.AutoLoad ++;
|
|
|
|
if (GCSettings.AutoLoad > 2)
|
|
|
|
GCSettings.AutoLoad = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 7:
|
|
|
|
GCSettings.AutoSave ++;
|
|
|
|
if (GCSettings.AutoSave > 3)
|
|
|
|
GCSettings.AutoSave = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
2008-08-06 04:31:44 +02:00
|
|
|
GCSettings.VerifySaves ^= 1;
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
2008-08-06 04:31:44 +02:00
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
case 9:
|
2008-08-06 04:31:44 +02:00
|
|
|
GCSettings.render ^= 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 10:
|
2008-08-06 16:40:28 +02:00
|
|
|
GCSettings.Superscope ++;
|
|
|
|
if (GCSettings.Superscope > 4)
|
|
|
|
GCSettings.Superscope = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 11:
|
2008-08-06 03:09:59 +02:00
|
|
|
quickSavePrefs(NOTSILENT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case -1: /*** Button B ***/
|
2008-08-06 16:40:28 +02:00
|
|
|
case 12:
|
2008-08-06 03:09:59 +02:00
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
menu = oldmenu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2008-08-06 03:45:56 +02:00
|
|
|
* Controller Configuration
|
2008-08-06 03:09:59 +02:00
|
|
|
*
|
|
|
|
* Snes9x 1.50 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)
|
|
|
|
{
|
|
|
|
u32 exp_type, pressed;
|
|
|
|
pressed=0;
|
2008-08-06 03:55:59 +02:00
|
|
|
s8 gc_px = 0;
|
2008-08-06 03:45:56 +02:00
|
|
|
|
|
|
|
while( PAD_ButtonsHeld(0)
|
|
|
|
#ifdef HW_RVL
|
|
|
|
| WPAD_ButtonsHeld(0)
|
|
|
|
#endif
|
|
|
|
) VIDEO_WaitVSync(); // button 'debounce'
|
|
|
|
|
|
|
|
while (pressed == 0)
|
|
|
|
{
|
|
|
|
VIDEO_WaitVSync();
|
|
|
|
// get input based on controller type
|
2008-08-06 03:55:59 +02:00
|
|
|
if (ctrlr_type == CTRLR_GCPAD)
|
|
|
|
{
|
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-06 03:45:56 +02:00
|
|
|
#ifdef HW_RVL
|
2008-08-06 03:55:59 +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);
|
|
|
|
|
|
|
|
// 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
|
|
|
|
while( pressed == (PAD_ButtonsHeld(0)
|
|
|
|
#ifdef HW_RVL
|
|
|
|
| WPAD_ButtonsHeld(0)
|
|
|
|
#endif
|
|
|
|
) ) VIDEO_WaitVSync();
|
|
|
|
|
|
|
|
return pressed;
|
|
|
|
} // end GetInput()
|
|
|
|
|
2008-08-06 03:55:59 +02:00
|
|
|
int cfg_text_count = 7;
|
2008-08-06 03:45:56 +02:00
|
|
|
char cfg_text[][20] = {
|
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-06 03:55:59 +02:00
|
|
|
char temp[20] = "";
|
|
|
|
int k;
|
2008-08-06 03:45:56 +02:00
|
|
|
pressed = 0; previous = 1;
|
|
|
|
|
|
|
|
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-06 03:55:59 +02:00
|
|
|
/*** note which button we are remapping ***/
|
|
|
|
sprintf (temp, (char*)"Remapping ");
|
|
|
|
for (k=0; k<9-strlen(btn_name) ;k++) strcat(temp, " "); // add whitespace padding to align text
|
|
|
|
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-06 03:45:56 +02:00
|
|
|
|
2008-08-06 03:55:59 +02:00
|
|
|
DrawMenu(&cfg_text[0], NULL, cfg_text_count, 1); // display text
|
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()
|
|
|
|
|
|
|
|
int cfg_btns_count = 13;
|
|
|
|
char cfg_btns_menu[][20] = {
|
|
|
|
"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-06 03:45:56 +02:00
|
|
|
char* menu_title;
|
|
|
|
u32 pressed;
|
|
|
|
|
|
|
|
unsigned int* currentpadmap;
|
|
|
|
char temp[20] = "";
|
2008-08-06 03:55:59 +02:00
|
|
|
int i, j, k;
|
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-06 03:09:59 +02:00
|
|
|
|
|
|
|
while (quit == 0)
|
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
|
|
|
|
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++ );
|
|
|
|
|
|
|
|
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-06 03:55:59 +02:00
|
|
|
ret = RunMenu (cfg_btns_menu, cfg_btns_count, menu_title, 18);
|
2008-08-06 03:09:59 +02:00
|
|
|
|
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()
|
|
|
|
|
|
|
|
int cfg_ctrlr_count_wii = 6;
|
|
|
|
char cfg_ctrlr_menu_wii[][20] = { "Nunchuk",
|
|
|
|
"Classic Controller",
|
|
|
|
"Gamecube Pad",
|
|
|
|
"Wiimote",
|
|
|
|
"Save Prefs Now",
|
|
|
|
"Return to previous"
|
|
|
|
};
|
|
|
|
|
|
|
|
int cfg_ctrlr_count_gc = 3;
|
|
|
|
char cfg_ctrlr_menu_gc[][20] = { "Gamecube Pad",
|
|
|
|
"Save Prefs Now",
|
|
|
|
"Return to previous"
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
ConfigureControllers ()
|
|
|
|
{
|
|
|
|
int quit = 0;
|
|
|
|
int ret = 0;
|
|
|
|
int oldmenu = menu;
|
|
|
|
menu = 0;
|
|
|
|
|
|
|
|
while (quit == 0)
|
|
|
|
{
|
|
|
|
#ifdef HW_RVL
|
|
|
|
/*** Wii Controller Config Menu ***/
|
|
|
|
ret = RunMenu (cfg_ctrlr_menu_wii, cfg_ctrlr_count_wii, (char*)"Configure Controllers");
|
2008-08-06 03:09:59 +02:00
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
2008-08-06 03:45:56 +02:00
|
|
|
/*** Configure Nunchuk ***/
|
|
|
|
ConfigureButtons (CTRLR_NUNCHUK);
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2008-08-06 03:45:56 +02:00
|
|
|
/*** Configure Classic ***/
|
|
|
|
ConfigureButtons (CTRLR_CLASSIC);
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2008-08-06 03:45:56 +02:00
|
|
|
/*** Configure GC Pad ***/
|
|
|
|
ConfigureButtons (CTRLR_GCPAD);
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
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-06 03:09:59 +02:00
|
|
|
case 4:
|
2008-08-06 03:45:56 +02:00
|
|
|
/*** Save Preferences Now ***/
|
|
|
|
quickSavePrefs(NOTSILENT);
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
2008-08-06 03:45:56 +02:00
|
|
|
|
|
|
|
case -1: /*** Button B ***/
|
2008-08-06 03:09:59 +02:00
|
|
|
case 5:
|
2008-08-06 03:45:56 +02:00
|
|
|
/*** Return ***/
|
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
/*** Gamecube Controller Config Menu ***/
|
|
|
|
ret = RunMenu (cfg_ctrlr_menu_gc, cfg_ctrlr_count_gc, (char*)"Configure Controllers");
|
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
/*** Configure Nunchuk ***/
|
|
|
|
ConfigureButtons (CTRLR_GCPAD);
|
|
|
|
break;
|
2008-08-06 03:09:59 +02:00
|
|
|
|
2008-08-06 03:45:56 +02:00
|
|
|
case 1:
|
|
|
|
/*** Save Preferences Now ***/
|
|
|
|
quickSavePrefs(NOTSILENT);
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case -1: /*** Button B ***/
|
2008-08-06 03:45:56 +02:00
|
|
|
case 2:
|
2008-08-06 03:09:59 +02:00
|
|
|
/*** Return ***/
|
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
}
|
2008-08-06 03:45:56 +02:00
|
|
|
#endif
|
2008-08-06 03:09:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
menu = oldmenu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Main Menu
|
|
|
|
****************************************************************************/
|
|
|
|
int menucount = 10;
|
|
|
|
char menuitems[][20] = { "Choose Game",
|
|
|
|
"SRAM Manager", "Freeze Manager",
|
2008-08-06 03:45:56 +02:00
|
|
|
"Config Controllers", "Emulator Options",
|
2008-08-06 03:39:43 +02:00
|
|
|
"Reset Game", "Stop DVD Drive", "Exit to Loader",
|
|
|
|
"Reboot System", "Return to Game"
|
2008-08-06 03:09:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
mainmenu ()
|
|
|
|
{
|
|
|
|
int quit = 0;
|
|
|
|
int ret;
|
|
|
|
int *psoid = (int *) 0x80001800;
|
|
|
|
void (*PSOReload) () = (void (*)()) 0x80001800;
|
|
|
|
|
|
|
|
if ( isWii )
|
|
|
|
sprintf (menuitems[8],"Reset Wii");
|
|
|
|
else
|
|
|
|
sprintf (menuitems[8],"Reset Gamecube");
|
|
|
|
|
|
|
|
VIDEO_WaitVSync ();
|
|
|
|
|
|
|
|
while (quit == 0)
|
|
|
|
{
|
2008-08-06 03:39:43 +02:00
|
|
|
ret = RunMenu (menuitems, menucount, (char*)"Main Menu");
|
2008-08-06 03:09:59 +02:00
|
|
|
|
|
|
|
switch (ret)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
/*** Load ROM Menu ***/
|
|
|
|
quit = LoadManager ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
/*** SRAM Manager Menu ***/
|
|
|
|
if ( ARAM_ROMSIZE > 0 )
|
|
|
|
SaveManager ();
|
|
|
|
else
|
2008-08-06 03:39:43 +02:00
|
|
|
WaitPrompt((char*) "No ROM is loaded!");
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
/*** Do Freeze / Thaw Menu ***/
|
|
|
|
if ( ARAM_ROMSIZE > 0 )
|
|
|
|
quit = FreezeManager ();
|
|
|
|
else
|
2008-08-06 03:39:43 +02:00
|
|
|
WaitPrompt((char*) "No ROM is loaded!");
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2008-08-06 03:45:56 +02:00
|
|
|
/*** Configure Controllers ***/
|
|
|
|
ConfigureControllers ();
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
/*** Emulator Options ***/
|
|
|
|
EmulatorOptions ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
/*** Soft reset ***/
|
|
|
|
S9xSoftReset ();
|
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 6:
|
|
|
|
/*** Turn off DVD motor ***/
|
|
|
|
dvd_motor_off();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 7:
|
2008-08-06 03:39:43 +02:00
|
|
|
/*** Exit to Loader ***/
|
2008-08-06 04:31:44 +02:00
|
|
|
#ifdef HW_RVL
|
2008-08-06 03:39:43 +02:00
|
|
|
exit(0);
|
|
|
|
#else // gamecube
|
2008-08-06 03:09:59 +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;
|
|
|
|
|
|
|
|
case 8:
|
2008-08-06 03:39:43 +02:00
|
|
|
/*** Reset the Gamecube/Wii ***/
|
|
|
|
Reboot();
|
2008-08-06 03:09:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case -1: /*** Button B ***/
|
|
|
|
case 9:
|
|
|
|
/*** Return to Game ***/
|
|
|
|
quit = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** Remove any still held buttons ***/
|
2008-08-06 03:45:56 +02:00
|
|
|
#ifdef HW_RVL
|
2008-08-06 03:39:43 +02:00
|
|
|
while( PAD_ButtonsHeld(0) || WPAD_ButtonsHeld(0) )
|
2008-08-06 03:09:59 +02:00
|
|
|
VIDEO_WaitVSync();
|
2008-08-06 03:45:56 +02:00
|
|
|
#else
|
|
|
|
while( PAD_ButtonsHeld(0) )
|
|
|
|
VIDEO_WaitVSync();
|
|
|
|
#endif
|
2008-08-06 03:09:59 +02:00
|
|
|
|
2008-08-06 04:31:44 +02:00
|
|
|
ReInitGCVideo(); // update video after reading settings
|
2008-08-06 16:40:28 +02:00
|
|
|
Settings.SuperScopeMaster = (GCSettings.Superscope > 0 ? true : false); // update superscope settings
|
|
|
|
// update mouse/justifier info?
|
|
|
|
SetControllers();
|
2008-08-06 03:09:59 +02:00
|
|
|
}
|