add option to disable rumble, auto-determine if HBC stub is present

This commit is contained in:
dborth 2009-05-20 05:22:50 +00:00
parent a8ad004214
commit bb53cadc3a
5 changed files with 49 additions and 32 deletions

View File

@ -183,6 +183,7 @@ void ShutoffRumble()
***************************************************************************/ ***************************************************************************/
void DoRumble(int i) void DoRumble(int i)
{ {
if(!GCSettings.Rumble) return;
if(rumbleRequest[i] && rumbleCount[i] < 3) if(rumbleRequest[i] && rumbleCount[i] < 3)
{ {
WPAD_Rumble(i, 1); // rumble on WPAD_Rumble(i, 1); // rumble on

View File

@ -17,9 +17,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HW_RVL #ifdef HW_RVL
extern "C" {
#include <di/di.h> #include <di/di.h>
}
#endif #endif
#include "snes9x.h" #include "snes9x.h"
@ -259,11 +257,6 @@ EmulatorUpdate (void *arg)
* Primary thread to allow GUI to respond to state changes, and draws GUI * Primary thread to allow GUI to respond to state changes, and draws GUI
***************************************************************************/ ***************************************************************************/
/*static u32 arena1mem = 0;
static u32 arena2mem = 0;
static char mem[150] = { 0 };
static GuiText * memTxt = NULL;*/
static void * static void *
UpdateGUI (void *arg) UpdateGUI (void *arg)
{ {
@ -275,13 +268,6 @@ UpdateGUI (void *arg)
} }
else else
{ {
/*arena1mem = (u32)SYS_GetArena1Hi() - (u32)SYS_GetArena1Lo();
#ifdef HW_RVL
arena2mem = (u32)SYS_GetArena2Hi() - (u32)SYS_GetArena2Lo();
#endif
sprintf(mem, "A1: %u / A2: %u", arena1mem, arena2mem);
if(memTxt) memTxt->SetText(mem);*/
mainWindow->Draw(); mainWindow->Draw();
#ifdef HW_RVL #ifdef HW_RVL
@ -3338,6 +3324,7 @@ static int MenuSettingsMenu()
sprintf(options.name[i++], "Wiimote Orientation"); sprintf(options.name[i++], "Wiimote Orientation");
sprintf(options.name[i++], "Music Volume"); sprintf(options.name[i++], "Music Volume");
sprintf(options.name[i++], "Sound Effects Volume"); sprintf(options.name[i++], "Sound Effects Volume");
sprintf(options.name[i++], "Rumble");
options.length = i; options.length = i;
GuiText titleTxt("Settings - Menu", 28, (GXColor){255, 255, 255, 255}); GuiText titleTxt("Settings - Menu", 28, (GXColor){255, 255, 255, 255});
@ -3390,13 +3377,10 @@ static int MenuSettingsMenu()
sprintf (options.value[0], "Return to Wii Menu"); sprintf (options.value[0], "Return to Wii Menu");
else if (GCSettings.ExitAction == 2) else if (GCSettings.ExitAction == 2)
sprintf (options.value[0], "Power off Wii"); sprintf (options.value[0], "Power off Wii");
else else if (GCSettings.ExitAction == 3)
sprintf (options.value[0], "Return to Loader"); sprintf (options.value[0], "Return to Loader");
else
if (GCSettings.WiimoteOrientation == 0) sprintf (options.value[0], "Auto");
sprintf (options.value[1], "Vertical");
else if (GCSettings.WiimoteOrientation == 1)
sprintf (options.value[1], "Horizontal");
#else // GameCube #else // GameCube
if(GCSettings.ExitAction > 1) if(GCSettings.ExitAction > 1)
GCSettings.ExitAction = 0; GCSettings.ExitAction = 0;
@ -3408,8 +3392,14 @@ static int MenuSettingsMenu()
options.name[1][0] = 0; // Wiimote options.name[1][0] = 0; // Wiimote
options.name[2][0] = 0; // Music options.name[2][0] = 0; // Music
options.name[3][0] = 0; // Sound Effects options.name[3][0] = 0; // Sound Effects
options.name[4][0] = 0; // Rumble
#endif #endif
if (GCSettings.WiimoteOrientation == 0)
sprintf (options.value[1], "Vertical");
else if (GCSettings.WiimoteOrientation == 1)
sprintf (options.value[1], "Horizontal");
if(GCSettings.MusicVolume > 0) if(GCSettings.MusicVolume > 0)
sprintf(options.value[2], "%d%%", GCSettings.MusicVolume); sprintf(options.value[2], "%d%%", GCSettings.MusicVolume);
else else
@ -3420,13 +3410,18 @@ static int MenuSettingsMenu()
else else
sprintf(options.value[3], "Mute"); sprintf(options.value[3], "Mute");
if (GCSettings.Rumble == 1)
sprintf (options.value[4], "Enabled");
else
sprintf (options.value[4], "Disabled");
ret = optionBrowser.GetClickedOption(); ret = optionBrowser.GetClickedOption();
switch (ret) switch (ret)
{ {
case 0: case 0:
GCSettings.ExitAction++; GCSettings.ExitAction++;
if(GCSettings.ExitAction > 2) if(GCSettings.ExitAction > 3)
GCSettings.ExitAction = 0; GCSettings.ExitAction = 0;
break; break;
case 1: case 1:
@ -3442,6 +3437,8 @@ static int MenuSettingsMenu()
GCSettings.SFXVolume += 10; GCSettings.SFXVolume += 10;
if(GCSettings.SFXVolume > 100) if(GCSettings.SFXVolume > 100)
GCSettings.SFXVolume = 0; GCSettings.SFXVolume = 0;
case 4:
GCSettings.Rumble ^= 1;
break; break;
} }

View File

@ -94,6 +94,7 @@ DefaultSettings ()
GCSettings.ExitAction = 0; GCSettings.ExitAction = 0;
GCSettings.MusicVolume = 40; GCSettings.MusicVolume = 40;
GCSettings.SFXVolume = 40; GCSettings.SFXVolume = 40;
GCSettings.Rumble = 1;
/****************** SNES9x Settings ***********************/ /****************** SNES9x Settings ***********************/

View File

@ -23,9 +23,7 @@
#include <debug.h> #include <debug.h>
#ifdef HW_RVL #ifdef HW_RVL
extern "C" {
#include <di/di.h> #include <di/di.h>
}
#endif #endif
#include "FreeTypeGX.h" #include "FreeTypeGX.h"
@ -102,16 +100,26 @@ void ExitApp()
{ {
ExitCleanup(); ExitCleanup();
if(GCSettings.ExitAction == 0) // Exit to Loader #ifdef HW_RVL
if(GCSettings.ExitAction == 0) // Auto
{ {
#ifdef HW_RVL char * sig = (char *)0x80001804;
exit(0); if(
#else sig[0] == 'S' &&
if (psoid[0] == PSOSDLOADID) sig[1] == 'T' &&
PSOReload (); sig[2] == 'U' &&
#endif sig[3] == 'B' &&
sig[4] == 'H' &&
sig[5] == 'A' &&
sig[6] == 'X' &&
sig[7] == 'X')
GCSettings.ExitAction = 3; // Exit to HBC
else
GCSettings.ExitAction = 1; // HBC not found
} }
else if(GCSettings.ExitAction == 1) // Exit to Menu #endif
if(GCSettings.ExitAction == 1) // Exit to Menu
{ {
#ifdef HW_RVL #ifdef HW_RVL
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
@ -120,10 +128,19 @@ void ExitApp()
*SOFTRESET_ADR = 0x00000000; *SOFTRESET_ADR = 0x00000000;
#endif #endif
} }
else // Shutdown Wii else if(GCSettings.ExitAction == 2) // Shutdown Wii
{ {
SYS_ResetSystem(SYS_POWEROFF, 0, 0); SYS_ResetSystem(SYS_POWEROFF, 0, 0);
} }
else // Exit to Loader
{
#ifdef HW_RVL
exit(0);
#else
if (psoid[0] == PSOSDLOADID)
PSOReload();
#endif
}
} }
#ifdef HW_RVL #ifdef HW_RVL

View File

@ -88,6 +88,7 @@ struct SGCSettings{
int ExitAction; int ExitAction;
int MusicVolume; int MusicVolume;
int SFXVolume; int SFXVolume;
int Rumble;
}; };
void ExitApp(); void ExitApp();