mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-01 00:15:14 +01:00
add wii power/reset button support, wiimote power button support
This commit is contained in:
parent
a6b0249a78
commit
f0a5f35508
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#define ROOTFATDIR "fat:/"
|
#define ROOTFATDIR "fat:/"
|
||||||
|
|
||||||
|
void UnmountAllFAT();
|
||||||
bool ChangeFATInterface(int method, bool silent);
|
bool ChangeFATInterface(int method, bool silent);
|
||||||
int ParseFATdirectory(int method);
|
int ParseFATdirectory(int method);
|
||||||
int LoadFATSzFile(char * filepath, unsigned char * rbuffer);
|
int LoadFATSzFile(char * filepath, unsigned char * rbuffer);
|
||||||
|
@ -32,8 +32,6 @@
|
|||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
extern int ConfigRequested;
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Controller Functions
|
* Controller Functions
|
||||||
*
|
*
|
||||||
|
@ -56,40 +56,6 @@ extern "C" {
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "patch.h"
|
#include "patch.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Reboot / Exit
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifdef HW_DOL
|
|
||||||
#define PSOSDLOADID 0x7c6000a6
|
|
||||||
int *psoid = (int *) 0x80001800;
|
|
||||||
void (*PSOReload) () = (void (*)()) 0x80001800;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void Reboot()
|
|
||||||
{
|
|
||||||
#ifdef HW_RVL
|
|
||||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
|
||||||
#else
|
|
||||||
#define SOFTRESET_ADR ((volatile u32*)0xCC003024)
|
|
||||||
*SOFTRESET_ADR = 0x00000000;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void ExitToLoader()
|
|
||||||
{
|
|
||||||
// Exit to Loader
|
|
||||||
#ifdef HW_RVL
|
|
||||||
#ifdef WII_DVD
|
|
||||||
DI_Close();
|
|
||||||
#endif
|
|
||||||
exit(0);
|
|
||||||
#else // gamecube
|
|
||||||
if (psoid[0] == PSOSDLOADID)
|
|
||||||
PSOReload ();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Load Manager
|
* Load Manager
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
@ -9,13 +9,6 @@
|
|||||||
* menudraw.cpp
|
* menudraw.cpp
|
||||||
*
|
*
|
||||||
* Menu drawing routines
|
* Menu drawing routines
|
||||||
*
|
|
||||||
* Uses libfreetype 2.2.1 compiled for GC with TTF support only.
|
|
||||||
* TTF only reduces the library by some 900k bytes!
|
|
||||||
*
|
|
||||||
* **WARNING***
|
|
||||||
*
|
|
||||||
* ONLY USE GUARANTEED PATENT FREE FONTS.
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include <gccore.h>
|
#include <gccore.h>
|
||||||
@ -576,6 +569,11 @@ RunMenu (char items[][50], int maxitems, char *title, int fontsize, int x)
|
|||||||
|
|
||||||
while (quit == 0)
|
while (quit == 0)
|
||||||
{
|
{
|
||||||
|
#ifdef HW_RVL
|
||||||
|
if(ShutdownRequested)
|
||||||
|
ShutdownWii();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (redraw)
|
if (redraw)
|
||||||
{
|
{
|
||||||
DrawMenu (&items[0], title, maxitems, menu, fontsize);
|
DrawMenu (&items[0], title, maxitems, menu, fontsize);
|
||||||
|
@ -62,6 +62,8 @@ extern "C" {
|
|||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
|
||||||
int ConfigRequested = 0;
|
int ConfigRequested = 0;
|
||||||
|
int ShutdownRequested = 0;
|
||||||
|
int ResetRequested = 0;
|
||||||
FILE* debughandle;
|
FILE* debughandle;
|
||||||
|
|
||||||
extern int FrameTimer;
|
extern int FrameTimer;
|
||||||
@ -69,6 +71,60 @@ extern int FrameTimer;
|
|||||||
extern long long prev;
|
extern long long prev;
|
||||||
extern unsigned int timediffallowed;
|
extern unsigned int timediffallowed;
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Shutdown / Reboot / Exit
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifdef HW_DOL
|
||||||
|
#define PSOSDLOADID 0x7c6000a6
|
||||||
|
int *psoid = (int *) 0x80001800;
|
||||||
|
void (*PSOReload) () = (void (*)()) 0x80001800;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void Reboot()
|
||||||
|
{
|
||||||
|
UnmountAllFAT();
|
||||||
|
#ifdef HW_RVL
|
||||||
|
DI_Close();
|
||||||
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||||
|
#else
|
||||||
|
#define SOFTRESET_ADR ((volatile u32*)0xCC003024)
|
||||||
|
*SOFTRESET_ADR = 0x00000000;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExitToLoader()
|
||||||
|
{
|
||||||
|
UnmountAllFAT();
|
||||||
|
// Exit to Loader
|
||||||
|
#ifdef HW_RVL
|
||||||
|
DI_Close();
|
||||||
|
exit(0);
|
||||||
|
#else // gamecube
|
||||||
|
if (psoid[0] == PSOSDLOADID)
|
||||||
|
PSOReload ();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HW_RVL
|
||||||
|
void ShutdownCB()
|
||||||
|
{
|
||||||
|
ConfigRequested = 1;
|
||||||
|
ShutdownRequested = 1;
|
||||||
|
}
|
||||||
|
void ResetCB()
|
||||||
|
{
|
||||||
|
ResetRequested = 1;
|
||||||
|
}
|
||||||
|
void ShutdownWii()
|
||||||
|
{
|
||||||
|
UnmountAllFAT();
|
||||||
|
DI_Close();
|
||||||
|
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HW_DOL
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* ipl_set_config
|
* ipl_set_config
|
||||||
* lowlevel Qoob Modchip disable
|
* lowlevel Qoob Modchip disable
|
||||||
@ -92,6 +148,7 @@ void ipl_set_config(unsigned char c)
|
|||||||
|
|
||||||
exi[0] &= 0x405; //deselect IPL
|
exi[0] &= 0x405; //deselect IPL
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* setFrameTimerMethod()
|
* setFrameTimerMethod()
|
||||||
@ -143,6 +200,12 @@ emulate ()
|
|||||||
S9xMainLoop ();
|
S9xMainLoop ();
|
||||||
NGCReportButtons ();
|
NGCReportButtons ();
|
||||||
|
|
||||||
|
if(ResetRequested)
|
||||||
|
{
|
||||||
|
S9xSoftReset (); // reset game
|
||||||
|
ResetRequested = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (ConfigRequested)
|
if (ConfigRequested)
|
||||||
{
|
{
|
||||||
// change to menu video mode
|
// change to menu video mode
|
||||||
@ -166,6 +229,11 @@ emulate ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HW_RVL
|
||||||
|
if(ShutdownRequested)
|
||||||
|
ShutdownWii();
|
||||||
|
#endif
|
||||||
|
|
||||||
// GUI Stuff
|
// GUI Stuff
|
||||||
/*
|
/*
|
||||||
gui_alloc();
|
gui_alloc();
|
||||||
@ -200,8 +268,6 @@ emulate ()
|
|||||||
|
|
||||||
CheckVideo = 1; // force video update
|
CheckVideo = 1; // force video update
|
||||||
prevRenderedFrameCount = IPPU.RenderedFramesCount;
|
prevRenderedFrameCount = IPPU.RenderedFramesCount;
|
||||||
|
|
||||||
|
|
||||||
}//if ConfigRequested
|
}//if ConfigRequested
|
||||||
|
|
||||||
}//while
|
}//while
|
||||||
@ -247,6 +313,13 @@ main ()
|
|||||||
|
|
||||||
PAD_Init ();
|
PAD_Init ();
|
||||||
|
|
||||||
|
// Wii Power/Reset buttons
|
||||||
|
#ifdef HW_RVL
|
||||||
|
WPAD_SetPowerButtonCallback((WPADShutdownCallback)ShutdownCB);
|
||||||
|
SYS_SetPowerCallback(ShutdownCB);
|
||||||
|
SYS_SetResetCallback(ResetCB);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
AUDIO_Init (NULL);
|
AUDIO_Init (NULL);
|
||||||
|
|
||||||
|
@ -71,6 +71,11 @@ struct SGCSettings{
|
|||||||
int yshift;
|
int yshift;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void ExitToLoader();
|
||||||
|
void Reboot();
|
||||||
|
void ShutdownWii();
|
||||||
extern struct SGCSettings GCSettings;
|
extern struct SGCSettings GCSettings;
|
||||||
|
extern int ConfigRequested;
|
||||||
|
extern int ShutdownRequested;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user