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

This commit is contained in:
dborth 2008-11-17 00:09:31 +00:00
parent 91c2756420
commit 59c0c77853
19 changed files with 187 additions and 118 deletions

View File

@ -22,7 +22,7 @@
#include "menudraw.h"
#include "gcunzip.h"
#include "fceuconfig.h"
#include "fceugx.h"
u64 dvddir = 0; // offset of currently selected file or folder
int dvddirlength = 0; // length of currently selected file or folder

View File

@ -15,7 +15,7 @@
#include <string.h>
#include "common.h"
#include "fceuconfig.h"
#include "fceugx.h"
struct SGCSettings GCSettings;

View File

@ -15,65 +15,4 @@
void DefaultSettings ();
#define VERSIONNUM "2.0.6"
#define VERSIONSTR "FCE Ultra GX 2.0.6"
#define PREF_FILE_NAME "FCEUGX.xml"
#define NOTSILENT 0
#define SILENT 1
enum {
METHOD_AUTO,
METHOD_SD,
METHOD_USB,
METHOD_DVD,
METHOD_SMB,
METHOD_MC_SLOTA,
METHOD_MC_SLOTB
};
enum {
FILE_ROM,
FILE_RAM,
FILE_STATE,
FILE_FDSBIOS,
FILE_CHEAT,
FILE_PREF
};
struct SGCSettings{
int AutoLoad;
int AutoSave;
int LoadMethod; // For ROMS: Auto, SD, DVD, USB, Network (SMB)
int SaveMethod; // For SRAM, Freeze, Prefs: Auto, SD, Memory Card Slot A, Memory Card Slot B, USB, SMB
char LoadFolder[200]; // Path to game files
char SaveFolder[200]; // Path to save files
char CheatFolder[200]; // Path to cheat files
char gcip[16];
char gwip[16];
char mask[16];
char smbip[16];
char smbuser[20];
char smbpwd[20];
char smbgcid[20];
char smbsvid[20];
char smbshare[20];
int Zoom; // 0 - off, 1 - on
float ZoomLevel; // zoom amount
int VerifySaves;
int render; // 0 - original, 1 - filtered, 2 - unfiltered
int widescreen;
int hideoverscan;
int currpal;
int timing;
int FSDisable;
int zapper;
int crosshair;
int slimit;
};
extern struct SGCSettings GCSettings;
extern int ConfigRequested;
extern int frameskip;
#endif

View File

@ -4,7 +4,7 @@
*
* Tantric September 2008
*
* fceugc.c
* fceugx.c
*
* This file controls overall program flow. Most things start and end here!
****************************************************************************/
@ -20,6 +20,7 @@
#include "types.h"
#include "fceugx.h"
#include "fceuconfig.h"
#include "fceuload.h"
#include "fceustate.h"
@ -28,6 +29,7 @@
#include "menudraw.h"
#include "menu.h"
#include "preferences.h"
#include "fileop.h"
#include "gcaudio.h"
#include "gcvideo.h"
#include "pad.h"
@ -38,6 +40,8 @@
unsigned char * nesrom = NULL;
int ConfigRequested = 0;
int ShutdownRequested = 0;
int ResetRequested = 0;
bool isWii;
uint8 *xbsave=NULL;
int frameskip = 0;
@ -45,11 +49,65 @@ int frameskip = 0;
extern bool romLoaded;
extern int cleanSFMDATA();
extern void ResetNES(void);
extern void PowerNES(void);
extern uint8 FDSBIOS[8192];
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
/****************************************************************************
* 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
@ -73,6 +131,7 @@ void ipl_set_config(unsigned char c)
exi[0] &= 0x405; //deselect IPL
}
#endif
/****************************************************************************
* main
@ -100,7 +159,15 @@ int main(int argc, char *argv[])
PAD_Init();
// Wii Power/Reset buttons
#ifdef HW_RVL
WPAD_SetPowerButtonCallback((WPADShutdownCallback)ShutdownCB);
SYS_SetPowerCallback(ShutdownCB);
SYS_SetResetCallback(ResetCB);
#endif
InitGCVideo ();
ResetVideo_Menu (); // change to menu video mode
/*** Initialise freetype ***/
if (FT_Init ())
@ -119,9 +186,10 @@ int main(int argc, char *argv[])
nesrom = (unsigned char *)malloc(1024*1024*3); // 3 MB should be plenty
/*** Minimal Emulation Loop ***/
if ( !FCEUI_Initialize() ) {
printf("Unable to initialize system\n");
return 1;
if ( !FCEUI_Initialize() )
{
WaitPrompt((char *)"Unable to initialize FCE Ultra\n");
ExitToLoader();
}
FCEUI_SetGameGenie(0); // 0 - OFF, 1 - ON
@ -145,7 +213,11 @@ int main(int argc, char *argv[])
while (1) // main loop
{
ResetVideo_Menu();
#ifdef HW_RVL
if(ShutdownRequested)
ShutdownWii();
#endif
MainMenu(selectedMenu);
selectedMenu = 2; // return to game menu from now on
@ -174,8 +246,15 @@ int main(int argc, char *argv[])
FCEUD_Update(gfx, sound, ssize);
}
if(ResetRequested)
{
PowerNES(); // reset game
ResetRequested = 0;
}
if(ConfigRequested)
{
ResetVideo_Menu();
if (GCSettings.AutoSave == 1)
{
SaveRAM(GCSettings.SaveMethod, SILENT);

80
source/ngc/fceugx.h Normal file
View File

@ -0,0 +1,80 @@
/****************************************************************************
* FCE Ultra 0.98.12
* Nintendo Wii/Gamecube Port
*
* Tantric September 2008
*
* fceugx.h
*
* This file controls overall program flow. Most things start and end here!
****************************************************************************/
#ifndef _FCEUGX_H_
#define _FCEUGX_H_
#define VERSIONNUM "2.0.6"
#define VERSIONSTR "FCE Ultra GX 2.0.6"
#define PREF_FILE_NAME "FCEUGX.xml"
#define NOTSILENT 0
#define SILENT 1
enum {
METHOD_AUTO,
METHOD_SD,
METHOD_USB,
METHOD_DVD,
METHOD_SMB,
METHOD_MC_SLOTA,
METHOD_MC_SLOTB
};
enum {
FILE_ROM,
FILE_RAM,
FILE_STATE,
FILE_FDSBIOS,
FILE_CHEAT,
FILE_PREF
};
struct SGCSettings{
int AutoLoad;
int AutoSave;
int LoadMethod; // For ROMS: Auto, SD, DVD, USB, Network (SMB)
int SaveMethod; // For SRAM, Freeze, Prefs: Auto, SD, Memory Card Slot A, Memory Card Slot B, USB, SMB
char LoadFolder[200]; // Path to game files
char SaveFolder[200]; // Path to save files
char CheatFolder[200]; // Path to cheat files
char gcip[16];
char gwip[16];
char mask[16];
char smbip[16];
char smbuser[20];
char smbpwd[20];
char smbgcid[20];
char smbsvid[20];
char smbshare[20];
int Zoom; // 0 - off, 1 - on
float ZoomLevel; // zoom amount
int VerifySaves;
int render; // 0 - original, 1 - filtered, 2 - unfiltered
int widescreen;
int hideoverscan;
int currpal;
int timing;
int FSDisable;
int zapper;
int crosshair;
int slimit;
};
void ExitToLoader();
void Reboot();
void ShutdownWii();
extern struct SGCSettings GCSettings;
extern int ConfigRequested;
extern int ShutdownRequested;
extern int frameskip;
#endif

View File

@ -24,11 +24,11 @@
#include "sound.h"
#include "file.h"
#include "fceugx.h"
#include "gcaudio.h"
#include "common.h"
#include "pad.h"
#include "menudraw.h"
#include "fceuconfig.h"
#include "fileop.h"
#include "filesel.h"
#include "smbop.h"

View File

@ -31,7 +31,7 @@
#include "general.h"
#include "fceuconfig.h"
#include "fceugx.h"
#include "intl.h"
#include "menudraw.h"
#include "filesel.h"

View File

@ -21,7 +21,7 @@
#include "state.h"
#include "images/saveicon.h"
#include "fceuconfig.h"
#include "fceugx.h"
#include "intl.h"
#include "menudraw.h"
#include "filesel.h"

View File

@ -17,7 +17,7 @@
#include <zlib.h>
#include "common.h"
#include "fceuconfig.h"
#include "fceugx.h"
#include "fileop.h"
#include "gcunzip.h"
#include "menudraw.h"

View File

@ -22,6 +22,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

@ -20,7 +20,7 @@
#endif
#include "common.h"
#include "fceuconfig.h"
#include "fceugx.h"
#include "dvd.h"
#include "menudraw.h"
#include "filesel.h"

View File

@ -19,7 +19,7 @@
#include "../sz/7zIn.h"
#include "../sz/7zExtract.h"
#include "fceuconfig.h"
#include "fceugx.h"
#include "dvd.h"
#include "smbop.h"
#include "fileop.h"

View File

@ -19,7 +19,7 @@
#include "driver.h"
#include "gcvideo.h"
#include "fceuconfig.h"
#include "fceugx.h"
#include "menudraw.h"
#include "images/nesback.h"

View File

@ -18,7 +18,7 @@
#include "common.h"
#include "menudraw.h"
#include "fceuconfig.h"
#include "fceugx.h"
#include "menu.h"
#include "memcardop.h"
#include "fileop.h"

View File

@ -21,6 +21,7 @@
#endif
#include "common.h"
#include "fceugx.h"
#include "fceuconfig.h"
#include "pad.h"
#include "button_mapping.h"
@ -43,42 +44,6 @@ extern void PowerNES(void);
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
****************************************************************************/

View File

@ -20,7 +20,7 @@
#include <zlib.h>
#include FT_FREETYPE_H
#include "fceuconfig.h"
#include "fceugx.h"
#include "gcvideo.h"
#include "menudraw.h"
#include "filesel.h"
@ -501,7 +501,12 @@ RunMenu (char items[][50], int maxitems, char *title, int fontsize, int x)
while (quit == 0)
{
if (redraw)
#ifdef HW_RVL
if(ShutdownRequested)
ShutdownWii();
#endif
if (redraw)
{
DrawMenu (&items[0], title, maxitems, menu, fontsize, -1);
redraw = 0;

View File

@ -16,7 +16,7 @@
#include "fceu.h"
#include "input.h"
#include "fceuconfig.h"
#include "fceugx.h"
#include "pad.h"
#include "gcaudio.h"
#include "menu.h"

View File

@ -20,7 +20,7 @@
#include "fileop.h"
#include "smbop.h"
#include "filesel.h"
#include "fceuconfig.h"
#include "fceugx.h"
#include "pad.h"
extern const unsigned short saveicon[1024];

View File

@ -20,7 +20,7 @@
#include <errno.h>
#include "common.h"
#include "fceuconfig.h"
#include "fceugx.h"
#include "smbop.h"
#include "gcunzip.h"
#include "menudraw.h"