mirror of
https://github.com/dborth/fceugx.git
synced 2024-10-31 22:45:05 +01:00
zapper support, button map fix, pref fixes
This commit is contained in:
parent
f40cf39e21
commit
7f7b2c2300
@ -25,6 +25,7 @@ DefaultSettings ()
|
||||
GCSettings.currpal = 0;
|
||||
GCSettings.timing = 0;
|
||||
GCSettings.FSDisable = 1;
|
||||
GCSettings.zapper = 0;
|
||||
GCSettings.slimit = 1;
|
||||
GCSettings.screenscaler = 2;
|
||||
|
||||
|
@ -52,6 +52,7 @@ struct SGCSettings{
|
||||
int currpal;
|
||||
int timing;
|
||||
int FSDisable;
|
||||
int zapper;
|
||||
int slimit;
|
||||
int screenscaler;
|
||||
};
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "menu.h"
|
||||
#include "fceuconfig.h"
|
||||
#include "preferences.h"
|
||||
#include "gcaudio.h"
|
||||
|
||||
#ifdef WII_DVD
|
||||
#include <di/di.h>
|
||||
@ -38,7 +39,6 @@ bool isWii;
|
||||
/* Some timing-related variables. */
|
||||
static int fullscreen=0;
|
||||
static int genie=0;
|
||||
static int palyo=0;
|
||||
|
||||
static volatile int nofocus=0;
|
||||
static volatile int userpause=0;
|
||||
@ -61,8 +61,6 @@ int eoptions=EO_BGRUN | EO_FORCEISCALE;
|
||||
|
||||
extern int cleanSFMDATA();
|
||||
extern void ResetNES(void);
|
||||
extern void InitialiseSound();
|
||||
extern void PlaySound( void *Buf, int samples );
|
||||
long long basetime;
|
||||
|
||||
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
|
||||
@ -104,8 +102,7 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
palyo=0;
|
||||
FCEUI_SetVidSystem(palyo);
|
||||
FCEUI_SetVidSystem(0); // 0 - NTSC, 1 - PAL
|
||||
genie&=1;
|
||||
FCEUI_SetGameGenie(genie);
|
||||
fullscreen&=1;
|
||||
@ -121,7 +118,8 @@ int main(int argc, char *argv[])
|
||||
DefaultSettings();
|
||||
|
||||
// Load preferences
|
||||
if(!LoadPrefs(GCSettings.SaveMethod, SILENT))
|
||||
|
||||
if(!LoadPrefs())
|
||||
{
|
||||
WaitPrompt((char*) "Preferences reset - check settings!");
|
||||
selectedMenu = 3; // change to preferences menu
|
||||
|
@ -10,8 +10,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <gccore.h>
|
||||
|
||||
#define SAMPLERATE 48000
|
||||
static unsigned char audiobuffer[2][64 * 1024] __attribute__((__aligned__(32)));
|
||||
unsigned char audiobuffer[2][64 * 1024] ATTRIBUTE_ALIGN(32);
|
||||
/*** Allow for up to 1 full second ***/
|
||||
|
||||
/****************************************************************************
|
||||
@ -28,7 +29,7 @@ static void AudioSwitchBuffers()
|
||||
if ( buffSize[whichab] ) {
|
||||
AUDIO_StopDMA();
|
||||
AUDIO_InitDMA((u32)audiobuffer[whichab], buffSize[whichab]);
|
||||
DCFlushRange(&audiobuffer[whichab], buffSize[whichab]);
|
||||
DCFlushRange(audiobuffer[whichab], buffSize[whichab]);
|
||||
AUDIO_StartDMA();
|
||||
isPlaying = 0;
|
||||
}
|
||||
@ -54,6 +55,7 @@ void StartAudio()
|
||||
void StopAudio()
|
||||
{
|
||||
AUDIO_StopDMA();
|
||||
buffSize[0] = buffSize[1] = 0;
|
||||
}
|
||||
|
||||
static inline unsigned short FLIP16(unsigned short b)
|
||||
|
14
source/ngc/gcaudio.h
Normal file
14
source/ngc/gcaudio.h
Normal file
@ -0,0 +1,14 @@
|
||||
/****************************************************************************
|
||||
* FCE Ultra 0.98.12
|
||||
* Nintendo Wii/Gamecube Port
|
||||
*
|
||||
* Tantric September 2008
|
||||
*
|
||||
* audio.h
|
||||
*
|
||||
* Audio driver
|
||||
****************************************************************************/
|
||||
|
||||
void InitialiseSound();
|
||||
void StopAudio();
|
||||
void PlaySound( void *Buf, int samples );
|
@ -68,7 +68,7 @@ bool TestCard(int slot, bool silent)
|
||||
|
||||
/*** Initialize Card System ***/
|
||||
memset (SysArea, 0, CARD_WORKAREA);
|
||||
CARD_Init ("SNES", "00");
|
||||
CARD_Init ("FCEU", "00");
|
||||
|
||||
/*** Try to mount the card ***/
|
||||
if (MountCard(slot, silent) == 0)
|
||||
@ -136,7 +136,7 @@ VerifyMCFile (unsigned char *buf, int slot, char *filename, int datasize)
|
||||
|
||||
/*** Initialize Card System ***/
|
||||
memset (SysArea, 0, CARD_WORKAREA);
|
||||
CARD_Init ("SNES", "00");
|
||||
CARD_Init ("FCEU", "00");
|
||||
|
||||
/*** Try to mount the card ***/
|
||||
CardError = MountCard(slot, NOTSILENT);
|
||||
@ -216,7 +216,7 @@ LoadBufferFromMC (unsigned char *buf, int slot, char *filename, bool silent)
|
||||
|
||||
/*** Initialize Card System ***/
|
||||
memset (SysArea, 0, CARD_WORKAREA);
|
||||
CARD_Init ("SNES", "00");
|
||||
CARD_Init ("FCEU", "00");
|
||||
|
||||
/*** Try to mount the card ***/
|
||||
CardError = MountCard(slot, NOTSILENT);
|
||||
@ -280,7 +280,7 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
|
||||
|
||||
/*** Initialize Card System ***/
|
||||
memset (SysArea, 0, CARD_WORKAREA);
|
||||
CARD_Init ("SNES", "00");
|
||||
CARD_Init ("FCEU", "00");
|
||||
|
||||
/*** Try to mount the card ***/
|
||||
CardError = MountCard(slot, NOTSILENT);
|
||||
@ -405,7 +405,7 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
|
||||
}
|
||||
else
|
||||
if ( !silent )
|
||||
WaitPrompt((char*) "This game does not appear to use SRAM");
|
||||
WaitPrompt((char*) "No to data to save!");
|
||||
}
|
||||
else
|
||||
if (slot == CARD_SLOTA)
|
||||
|
@ -89,14 +89,13 @@ LoadManager ()
|
||||
/****************************************************************************
|
||||
* Emulator Menu
|
||||
****************************************************************************/
|
||||
static int emulatormenuCount = 7;
|
||||
static int emulatormenuCount = 6;
|
||||
static char emulatormenu[][50] = {
|
||||
|
||||
"Screen Scaler",
|
||||
"Palette",
|
||||
"8 Sprite Limit",
|
||||
"Timing",
|
||||
"Four Score",
|
||||
|
||||
"Save Preferences",
|
||||
"Back to Main Menu"
|
||||
@ -123,9 +122,6 @@ EmulatorMenu ()
|
||||
sprintf (emulatormenu[3], "Timing - %s",
|
||||
GCSettings.timing == true ? " PAL" : "NTSC");
|
||||
|
||||
sprintf (emulatormenu[4], "Four Score - %s",
|
||||
GCSettings.FSDisable == true ? " ON" : "OFF");
|
||||
|
||||
ret = RunMenu (emulatormenu, emulatormenuCount, (char*)"Emulator Options", 16, -1);
|
||||
|
||||
switch (ret)
|
||||
@ -172,17 +168,12 @@ EmulatorMenu ()
|
||||
FCEUI_SetVidSystem(GCSettings.timing);
|
||||
break;
|
||||
|
||||
case 4: // four score
|
||||
GCSettings.FSDisable ^= 1;
|
||||
FCEUI_DisableFourScore(GCSettings.FSDisable);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
case 4:
|
||||
SavePrefs(GCSettings.SaveMethod, NOTSILENT);
|
||||
break;
|
||||
|
||||
case -1: // Button B
|
||||
case 6:
|
||||
case 5:
|
||||
quit = 1;
|
||||
break;
|
||||
|
||||
@ -366,9 +357,9 @@ GameMenu ()
|
||||
{
|
||||
// disable state saving/loading if AUTO is on
|
||||
|
||||
if (GCSettings.AutoLoad == 1) // Auto Load SRAM
|
||||
if (GCSettings.AutoLoad == 1) // Auto Load State
|
||||
gamemenu[3][0] = '\0';
|
||||
if (GCSettings.AutoSave == 1) // Auto Save SRAM
|
||||
if (GCSettings.AutoSave == 1) // Auto Save State
|
||||
gamemenu[4][0] = '\0';
|
||||
|
||||
ret = RunMenu (gamemenu, gamemenuCount, (char*)"Game Menu", 20, -1);
|
||||
@ -625,8 +616,10 @@ ConfigureButtons (u16 ctrlr_type)
|
||||
menu = oldmenu;
|
||||
} // end configurebuttons()
|
||||
|
||||
int ctlrmenucount = 6;
|
||||
int ctlrmenucount = 8;
|
||||
char ctlrmenu[][50] = {
|
||||
"Four Score",
|
||||
"Zapper",
|
||||
"Nunchuk",
|
||||
"Classic Controller",
|
||||
"Wiimote",
|
||||
@ -645,45 +638,64 @@ ConfigureControllers ()
|
||||
|
||||
// disable unavailable controller options if in GC mode
|
||||
#ifndef HW_RVL
|
||||
ctlrmenu[2][0] = '\0';
|
||||
ctlrmenu[3][0] = '\0';
|
||||
ctlrmenu[4][0] = '\0';
|
||||
ctlrmenu[5][0] = '\0';
|
||||
ctlrmenu[6][0] = '\0';
|
||||
#endif
|
||||
|
||||
while (quit == 0)
|
||||
{
|
||||
sprintf (ctlrmenu[0], "Four Score - %s",
|
||||
GCSettings.FSDisable == true ? " ON" : "OFF");
|
||||
|
||||
if (GCSettings.zapper == 0) sprintf (ctlrmenu[1],"Zapper - Disabled");
|
||||
else if (GCSettings.zapper == 1) sprintf (ctlrmenu[1],"Zapper - Port 1");
|
||||
else if (GCSettings.zapper == 2) sprintf (ctlrmenu[1],"Zapper - Port 2");
|
||||
|
||||
/*** Controller Config Menu ***/
|
||||
ret = RunMenu (ctlrmenu, ctlrmenucount, (char*)"Configure Controllers", 20, -1);
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case 0:
|
||||
case 0: // four score
|
||||
GCSettings.FSDisable ^= 1;
|
||||
ToggleFourScore(GCSettings.FSDisable);
|
||||
break;
|
||||
|
||||
case 1: // zapper
|
||||
GCSettings.zapper -= 1; // we do this so Port 2 is first option shown
|
||||
if(GCSettings.zapper < 0)
|
||||
GCSettings.zapper = 2;
|
||||
ToggleZapper(GCSettings.zapper);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/*** Configure Nunchuk ***/
|
||||
ConfigureButtons (CTRLR_NUNCHUK);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case 3:
|
||||
/*** Configure Classic ***/
|
||||
ConfigureButtons (CTRLR_CLASSIC);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 4:
|
||||
/*** Configure Wiimote ***/
|
||||
ConfigureButtons (CTRLR_WIIMOTE);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
case 5:
|
||||
/*** Configure GC Pad ***/
|
||||
ConfigureButtons (CTRLR_GCPAD);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
case 6:
|
||||
/*** Save Preferences Now ***/
|
||||
SavePrefs(GCSettings.SaveMethod, NOTSILENT);
|
||||
break;
|
||||
|
||||
case -1: /*** Button B ***/
|
||||
case 5:
|
||||
case 7:
|
||||
/*** Return ***/
|
||||
quit = 1;
|
||||
break;
|
||||
|
139
source/ngc/pad.c
139
source/ngc/pad.c
@ -14,9 +14,11 @@
|
||||
#include <math.h>
|
||||
#include "driver.h"
|
||||
#include "fceu.h"
|
||||
#include "input.h"
|
||||
|
||||
#include "fceuconfig.h"
|
||||
#include "pad.h"
|
||||
#include "gcaudio.h"
|
||||
#include "menu.h"
|
||||
#include "fceustate.h"
|
||||
|
||||
@ -24,7 +26,7 @@
|
||||
// All other pads are mapped to this
|
||||
unsigned int nespadmap[] = {
|
||||
JOY_B, JOY_A,
|
||||
JOY_START, JOY_SELECT,
|
||||
JOY_SELECT, JOY_START,
|
||||
JOY_UP, JOY_DOWN,
|
||||
JOY_LEFT, JOY_RIGHT
|
||||
};
|
||||
@ -59,6 +61,12 @@ unsigned int ncpadmap[] = {
|
||||
};
|
||||
|
||||
static uint32 JSReturn = 0;
|
||||
void *InputDPR;
|
||||
|
||||
INPUTC *zapperdata[2];
|
||||
unsigned int myzappers[2][3];
|
||||
|
||||
extern INPUTC *FCEU_InitZapper(int w);
|
||||
|
||||
/****************************************************************************
|
||||
* Initialise Pads
|
||||
@ -66,13 +74,40 @@ static uint32 JSReturn = 0;
|
||||
void InitialisePads()
|
||||
{
|
||||
int attrib = 0;
|
||||
void *InputDPR;
|
||||
|
||||
FCEUI_DisableFourScore(1);
|
||||
|
||||
InputDPR = &JSReturn;
|
||||
FCEUI_SetInput(0, SI_GAMEPAD, InputDPR, attrib);
|
||||
FCEUI_SetInput(1, SI_GAMEPAD, InputDPR, attrib);
|
||||
|
||||
ToggleZapper(GCSettings.zapper);
|
||||
}
|
||||
|
||||
void ToggleFourScore(int set)
|
||||
{
|
||||
FCEUI_DisableFourScore(set);
|
||||
}
|
||||
|
||||
void ToggleZapper(int set)
|
||||
{
|
||||
// set defaults
|
||||
zapperdata[0]=NULL;
|
||||
zapperdata[1]=NULL;
|
||||
myzappers[0][0]=myzappers[1][0]=128;
|
||||
myzappers[0][1]=myzappers[1][1]=120;
|
||||
myzappers[0][2]=myzappers[1][2]=0;
|
||||
|
||||
// Default ports back to gamepad
|
||||
FCEUI_SetInput(0, SI_GAMEPAD, InputDPR, 0);
|
||||
FCEUI_SetInput(1, SI_GAMEPAD, InputDPR, 0);
|
||||
|
||||
if(set)
|
||||
{
|
||||
// enable Zapper
|
||||
zapperdata[set-1] = FCEU_InitZapper(set-1);
|
||||
FCEUI_SetInput(set-1, SI_ZAPPER, myzappers[set-1], 1);
|
||||
}
|
||||
}
|
||||
|
||||
s8 WPAD_StickX(u8 chan,u8 right)
|
||||
@ -159,6 +194,70 @@ s8 WPAD_StickY(u8 chan, u8 right)
|
||||
return (s8)(val * 128.0f);
|
||||
}
|
||||
|
||||
// hold zapper cursor positions
|
||||
int pos_x = 0;
|
||||
int pos_y = 0;
|
||||
|
||||
void UpdateCursorPosition (int pad)
|
||||
{
|
||||
#define ZAPPERPADCAL 20
|
||||
|
||||
// gc left joystick
|
||||
signed char pad_x = PAD_StickX (pad);
|
||||
signed char pad_y = PAD_StickY (pad);
|
||||
|
||||
if (pad_x > ZAPPERPADCAL){
|
||||
pos_x += (pad_x*1.0)/ZAPPERPADCAL;
|
||||
if (pos_x > 256) pos_x = 256;
|
||||
}
|
||||
if (pad_x < -ZAPPERPADCAL){
|
||||
pos_x -= (pad_x*-1.0)/ZAPPERPADCAL;
|
||||
if (pos_x < 0) pos_x = 0;
|
||||
}
|
||||
|
||||
if (pad_y < -ZAPPERPADCAL){
|
||||
pos_y += (pad_y*-1.0)/ZAPPERPADCAL;
|
||||
if (pos_y > 224) pos_y = 224;
|
||||
}
|
||||
if (pad_y > ZAPPERPADCAL){
|
||||
pos_y -= (pad_y*1.0)/ZAPPERPADCAL;
|
||||
if (pos_y < 0) pos_y = 0;
|
||||
}
|
||||
|
||||
#ifdef HW_RVL
|
||||
struct ir_t ir; // wiimote ir
|
||||
WPAD_IR(pad, &ir);
|
||||
if (ir.valid)
|
||||
{
|
||||
pos_x = (ir.x * 256) / 640;
|
||||
pos_y = (ir.y * 224) / 480;
|
||||
}
|
||||
else
|
||||
{
|
||||
signed char wm_ax = WPAD_StickX (pad, 0);
|
||||
signed char wm_ay = WPAD_StickY (pad, 0);
|
||||
|
||||
if (wm_ax > ZAPPERPADCAL){
|
||||
pos_x += (wm_ax*1.0)/ZAPPERPADCAL;
|
||||
if (pos_x > 256) pos_x = 256;
|
||||
}
|
||||
if (wm_ax < -ZAPPERPADCAL){
|
||||
pos_x -= (wm_ax*-1.0)/ZAPPERPADCAL;
|
||||
if (pos_x < 0) pos_x = 0;
|
||||
}
|
||||
|
||||
if (wm_ay < -ZAPPERPADCAL){
|
||||
pos_y += (wm_ay*-1.0)/ZAPPERPADCAL;
|
||||
if (pos_y > 224) pos_y = 224;
|
||||
}
|
||||
if (wm_ay > ZAPPERPADCAL){
|
||||
pos_y -= (wm_ay*1.0)/ZAPPERPADCAL;
|
||||
if (pos_y < 0) pos_y = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Convert GC Joystick Readings to JOY
|
||||
****************************************************************************/
|
||||
@ -269,10 +368,38 @@ unsigned char DecodeJoy( unsigned short pad )
|
||||
|| ( (exp_type == WPAD_EXP_CLASSIC) && (wp & ccpadmap[i]) ) // classic controller
|
||||
|| ( (exp_type == WPAD_EXP_NUNCHUK) && (wp & ncpadmap[i]) ) // nunchuk + wiimote
|
||||
#endif
|
||||
)
|
||||
J |= nespadmap[i];
|
||||
)
|
||||
J |= nespadmap[i];
|
||||
}
|
||||
return J;
|
||||
|
||||
// zapper enabled
|
||||
if(GCSettings.zapper)
|
||||
{
|
||||
int z = GCSettings.zapper-1; // NES port # (0 or 1)
|
||||
|
||||
myzappers[z][2] = 0; // reset trigger to not pressed
|
||||
|
||||
// is trigger pressed?
|
||||
if ( (jp & PAD_BUTTON_A) // gamecube controller
|
||||
#ifdef HW_RVL
|
||||
|| (wp & WPAD_BUTTON_A) // wiimote
|
||||
#endif
|
||||
)
|
||||
{
|
||||
// report trigger press
|
||||
myzappers[z][2] |= 2;
|
||||
}
|
||||
|
||||
// cursor position
|
||||
UpdateCursorPosition(0); // update cursor for wiimote 1
|
||||
myzappers[z][0] = pos_x;
|
||||
myzappers[z][1] = pos_y;
|
||||
|
||||
// Report changes to FCE Ultra
|
||||
zapperdata[z]->Update(z,myzappers[z],0);
|
||||
}
|
||||
|
||||
return J;
|
||||
}
|
||||
|
||||
void GetJoy()
|
||||
@ -297,7 +424,7 @@ void GetJoy()
|
||||
#endif
|
||||
)
|
||||
{
|
||||
AUDIO_StopDMA();
|
||||
StopAudio();
|
||||
|
||||
if (GCSettings.AutoLoad == 1)
|
||||
SaveState(GCSettings.SaveMethod, SILENT);
|
||||
|
@ -27,6 +27,9 @@ s8 WPAD_StickX(u8 chan,u8 right);
|
||||
s8 WPAD_StickY(u8 chan, u8 right);
|
||||
void InitialisePads();
|
||||
void GetJoy();
|
||||
void ToggleFourScore(int set);
|
||||
void ToggleZapper(int set);
|
||||
void DrawCursor();
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -164,18 +164,18 @@ preparePrefsData (int method)
|
||||
|
||||
createXMLSetting("currpal", "Palette", toStr(GCSettings.currpal));
|
||||
createXMLSetting("timing", "Timing", toStr(GCSettings.timing));
|
||||
createXMLSetting("FSDisable", "Four Score", toStr(GCSettings.FSDisable));
|
||||
createXMLSetting("slimit", "8 Sprite Limit", toStr(GCSettings.slimit));
|
||||
createXMLSetting("screenscaler", "Screen Scaler", toStr(GCSettings.screenscaler));
|
||||
|
||||
createXMLSection("Controller", "Controller Settings");
|
||||
|
||||
createXMLSetting("FSDisable", "Four Score", toStr(GCSettings.FSDisable));
|
||||
createXMLSetting("zapper", "Zapper", toStr(GCSettings.zapper));
|
||||
createXMLController(gcpadmap, "gcpadmap", "GameCube Pad");
|
||||
createXMLController(wmpadmap, "wmpadmap", "Wiimote");
|
||||
createXMLController(ccpadmap, "ccpadmap", "Classic Controller");
|
||||
createXMLController(ncpadmap, "ncpadmap", "Nunchuk");
|
||||
|
||||
memset (savebuffer + offset, 0, SAVEBUFFERSIZE);
|
||||
int datasize = mxmlSaveString(xml, (char *)savebuffer, SAVEBUFFERSIZE, XMLSaveCallback);
|
||||
|
||||
mxmlDelete(xml);
|
||||
@ -207,6 +207,7 @@ void loadXMLSettingBool(bool * var, const char * name)
|
||||
}
|
||||
|
||||
void loadXMLController(unsigned int controller[], const char * name)
|
||||
|
||||
{
|
||||
item = mxmlFindElement(xml, xml, "controller", "name", name, MXML_DESCEND);
|
||||
|
||||
@ -271,7 +272,7 @@ decodePrefsData (int method)
|
||||
loadXMLSettingInt(&GCSettings.FSDisable, "FSDisable");
|
||||
loadXMLSettingInt(&GCSettings.slimit, "slimit");
|
||||
loadXMLSettingInt(&GCSettings.screenscaler, "screenscaler");
|
||||
|
||||
loadXMLSettingInt(&GCSettings.zapper, "zapper");
|
||||
// Controller Settings
|
||||
|
||||
loadXMLController(gcpadmap, "gcpadmap");
|
||||
@ -334,48 +335,62 @@ SavePrefs (int method, bool silent)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Load Preferences
|
||||
* Load Preferences from specified method
|
||||
****************************************************************************/
|
||||
bool
|
||||
LoadPrefs (int method, bool silent)
|
||||
{
|
||||
if(method == METHOD_AUTO)
|
||||
method = autoSaveMethod(); // we use 'Save' folder because preferences need R/W
|
||||
|
||||
bool
|
||||
LoadPrefsFromMethod (int method)
|
||||
{
|
||||
bool retval = false;
|
||||
char filepath[1024];
|
||||
int offset = 0;
|
||||
|
||||
if ( !silent )
|
||||
ShowAction ((char*) "Loading preferences...");
|
||||
|
||||
if(method == METHOD_SD || method == METHOD_USB)
|
||||
{
|
||||
if(ChangeFATInterface(method, NOTSILENT))
|
||||
{
|
||||
sprintf (filepath, "%s/%s/%s", ROOTFATDIR, GCSettings.SaveFolder, PREFS_FILE_NAME);
|
||||
offset = LoadBufferFromFAT (filepath, silent);
|
||||
offset = LoadBufferFromFAT (filepath, SILENT);
|
||||
}
|
||||
}
|
||||
else if(method == METHOD_SMB)
|
||||
{
|
||||
sprintf (filepath, "%s/%s", GCSettings.SaveFolder, PREFS_FILE_NAME);
|
||||
offset = LoadSaveBufferFromSMB (filepath, silent);
|
||||
offset = LoadSaveBufferFromSMB (filepath, SILENT);
|
||||
}
|
||||
else if(method == METHOD_MC_SLOTA)
|
||||
{
|
||||
offset = LoadBufferFromMC (savebuffer, CARD_SLOTA, (char *)PREFS_FILE_NAME, silent);
|
||||
offset = LoadBufferFromMC (savebuffer, CARD_SLOTA, (char *)PREFS_FILE_NAME, SILENT);
|
||||
}
|
||||
else if(method == METHOD_MC_SLOTB)
|
||||
{
|
||||
offset = LoadBufferFromMC (savebuffer, CARD_SLOTB, (char *)PREFS_FILE_NAME, silent);
|
||||
offset = LoadBufferFromMC (savebuffer, CARD_SLOTB, (char *)PREFS_FILE_NAME, SILENT);
|
||||
}
|
||||
|
||||
if (offset > 0)
|
||||
{
|
||||
retval = decodePrefsData (method);
|
||||
if ( !silent )
|
||||
WaitPrompt((char *)"Preferences loaded");
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Load Preferences
|
||||
* Checks sources consecutively until we find a preference file
|
||||
****************************************************************************/
|
||||
|
||||
bool LoadPrefs()
|
||||
{
|
||||
bool prefFound = false;
|
||||
if(ChangeFATInterface(METHOD_SD, SILENT))
|
||||
prefFound = LoadPrefsFromMethod(METHOD_SD);
|
||||
if(!prefFound && ChangeFATInterface(METHOD_USB, SILENT))
|
||||
prefFound = LoadPrefsFromMethod(METHOD_USB);
|
||||
if(!prefFound && TestCard(CARD_SLOTA, SILENT))
|
||||
prefFound = LoadPrefsFromMethod(METHOD_MC_SLOTA);
|
||||
if(!prefFound && TestCard(CARD_SLOTB, SILENT))
|
||||
prefFound = LoadPrefsFromMethod(METHOD_MC_SLOTB);
|
||||
if(!prefFound && ConnectShare (SILENT))
|
||||
prefFound = LoadPrefsFromMethod(METHOD_SMB);
|
||||
|
||||
return prefFound;
|
||||
}
|
||||
|
@ -10,4 +10,4 @@
|
||||
****************************************************************************/
|
||||
|
||||
bool SavePrefs (int method, bool silent);
|
||||
bool LoadPrefs (int method, bool silent);
|
||||
bool LoadPrefs ();
|
||||
|
Loading…
Reference in New Issue
Block a user