add wii power/reset button support, wiimote power button support

This commit is contained in:
dborth 2008-11-17 00:08:51 +00:00
parent a6b0249a78
commit f0a5f35508
6 changed files with 87 additions and 46 deletions

View File

@ -24,6 +24,7 @@
#define ROOTFATDIR "fat:/"
void UnmountAllFAT();
bool ChangeFATInterface(int method, bool silent);
int ParseFATdirectory(int method);
int LoadFATSzFile(char * filepath, unsigned char * rbuffer);

View File

@ -32,8 +32,6 @@
#include "video.h"
#include "input.h"
extern int ConfigRequested;
/****************************************************************************
* Controller Functions
*

View File

@ -56,40 +56,6 @@ extern "C" {
#include "input.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
***************************************************************************/

View File

@ -9,13 +9,6 @@
* menudraw.cpp
*
* 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>
@ -576,6 +569,11 @@ RunMenu (char items[][50], int maxitems, char *title, int fontsize, int x)
while (quit == 0)
{
#ifdef HW_RVL
if(ShutdownRequested)
ShutdownWii();
#endif
if (redraw)
{
DrawMenu (&items[0], title, maxitems, menu, fontsize);

View File

@ -62,6 +62,8 @@ extern "C" {
#include "gui.h"
int ConfigRequested = 0;
int ShutdownRequested = 0;
int ResetRequested = 0;
FILE* debughandle;
extern int FrameTimer;
@ -69,6 +71,60 @@ extern int FrameTimer;
extern long long prev;
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
* lowlevel Qoob Modchip disable
@ -92,6 +148,7 @@ void ipl_set_config(unsigned char c)
exi[0] &= 0x405; //deselect IPL
}
#endif
/****************************************************************************
* setFrameTimerMethod()
@ -143,6 +200,12 @@ emulate ()
S9xMainLoop ();
NGCReportButtons ();
if(ResetRequested)
{
S9xSoftReset (); // reset game
ResetRequested = 0;
}
if (ConfigRequested)
{
// change to menu video mode
@ -166,6 +229,11 @@ emulate ()
}
}
#ifdef HW_RVL
if(ShutdownRequested)
ShutdownWii();
#endif
// GUI Stuff
/*
gui_alloc();
@ -200,8 +268,6 @@ emulate ()
CheckVideo = 1; // force video update
prevRenderedFrameCount = IPPU.RenderedFramesCount;
}//if ConfigRequested
}//while
@ -247,6 +313,13 @@ main ()
PAD_Init ();
// Wii Power/Reset buttons
#ifdef HW_RVL
WPAD_SetPowerButtonCallback((WPADShutdownCallback)ShutdownCB);
SYS_SetPowerCallback(ShutdownCB);
SYS_SetResetCallback(ResetCB);
#endif
// Audio
AUDIO_Init (NULL);

View File

@ -71,6 +71,11 @@ struct SGCSettings{
int yshift;
};
void ExitToLoader();
void Reboot();
void ShutdownWii();
extern struct SGCSettings GCSettings;
extern int ConfigRequested;
extern int ShutdownRequested;
#endif