mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-01 00:15:10 +01:00
add wii power/reset button support, wiimote power button support
This commit is contained in:
parent
ae8f09d9a3
commit
8200baf3bb
@ -21,6 +21,7 @@
|
||||
|
||||
#define ROOTFATDIR "fat:/"
|
||||
|
||||
void UnmountAllFAT();
|
||||
bool ChangeFATInterface(int method, bool silent);
|
||||
int ParseFATdirectory(int method);
|
||||
int LoadFATSzFile(char * filepath, unsigned char * rbuffer);
|
||||
|
@ -47,42 +47,6 @@ extern void DrawMenu (char items[][50], char *title, int maxitems, int selected,
|
||||
extern int menu;
|
||||
extern bool ROMLoaded;
|
||||
|
||||
#define SOFTRESET_ADR ((volatile u32*)0xCC003024)
|
||||
|
||||
/****************************************************************************
|
||||
* Reboot / Exit
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef HW_RVL
|
||||
#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
|
||||
***************************************************************************/
|
||||
|
@ -6,13 +6,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>
|
||||
@ -533,6 +526,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);
|
||||
|
@ -32,7 +32,7 @@ extern "C" {
|
||||
#include "preferences.h"
|
||||
#include "audio.h"
|
||||
#include "dvd.h"
|
||||
#include "smbop.h"
|
||||
#include "fileop.h"
|
||||
#include "menu.h"
|
||||
#include "menudraw.h"
|
||||
#include "input.h"
|
||||
@ -42,7 +42,63 @@ extern "C" {
|
||||
extern bool ROMLoaded;
|
||||
extern int emulating;
|
||||
int ConfigRequested = 0;
|
||||
int ShutdownRequested = 0;
|
||||
int ResetRequested = 0;
|
||||
|
||||
/****************************************************************************
|
||||
* 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
|
||||
@ -66,6 +122,7 @@ void ipl_set_config(unsigned char c)
|
||||
|
||||
exi[0] &= 0x405; //deselect IPL
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* main
|
||||
@ -91,9 +148,17 @@ int main()
|
||||
#endif
|
||||
PAD_Init ();
|
||||
|
||||
// Wii Power/Reset buttons
|
||||
#ifdef HW_RVL
|
||||
WPAD_SetPowerButtonCallback((WPADShutdownCallback)ShutdownCB);
|
||||
SYS_SetPowerCallback(ShutdownCB);
|
||||
SYS_SetResetCallback(ResetCB);
|
||||
#endif
|
||||
|
||||
int selectedMenu = -1;
|
||||
|
||||
InitialiseVideo();
|
||||
ResetVideo_Menu (); // change to menu video mode
|
||||
|
||||
// Initialise freetype font system
|
||||
if (FT_Init ())
|
||||
@ -129,7 +194,11 @@ int main()
|
||||
|
||||
while(1) // main loop
|
||||
{
|
||||
ResetVideo_Menu (); // change to menu video mode
|
||||
#ifdef HW_RVL
|
||||
if(ShutdownRequested)
|
||||
ShutdownWii();
|
||||
#endif
|
||||
|
||||
MainMenu(selectedMenu);
|
||||
selectedMenu = 3; // return to game menu from now on
|
||||
|
||||
@ -139,8 +208,16 @@ int main()
|
||||
{
|
||||
emulator.emuMain(emulator.emuCount);
|
||||
|
||||
if(ResetRequested)
|
||||
{
|
||||
emulator.emuReset(); // reset game
|
||||
ResetRequested = 0;
|
||||
}
|
||||
|
||||
if(ConfigRequested)
|
||||
{
|
||||
ResetVideo_Menu (); // change to menu video mode
|
||||
|
||||
if (GCSettings.AutoSave == 1)
|
||||
{
|
||||
SaveBatteryOrState(GCSettings.SaveMethod, FILE_SRAM, SILENT); // save battery
|
||||
|
@ -61,7 +61,11 @@ struct SGCSettings{
|
||||
int VerifySaves;
|
||||
};
|
||||
|
||||
void ExitToLoader();
|
||||
void Reboot();
|
||||
void ShutdownWii();
|
||||
extern struct SGCSettings GCSettings;
|
||||
extern int ConfigRequested;
|
||||
extern int ShutdownRequested;
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user