mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-30 14:34:22 +01:00
Preferences now loaded/saved to XML
This commit is contained in:
parent
6d0f044f40
commit
1f8e523ac2
@ -38,34 +38,6 @@ unsigned char DVDreadbuffer[2048] ATTRIBUTE_ALIGN (32);
|
|||||||
unsigned char dvdbuffer[2048];
|
unsigned char dvdbuffer[2048];
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* dvd_driveid
|
|
||||||
*
|
|
||||||
* Gets and returns the dvd driveid
|
|
||||||
**/
|
|
||||||
#ifdef HW_DOL
|
|
||||||
int dvd_driveid()
|
|
||||||
{
|
|
||||||
static unsigned char *inquiry=(unsigned char *)0x80000004;
|
|
||||||
|
|
||||||
dvd[0] = 0x2e;
|
|
||||||
dvd[1] = 0;
|
|
||||||
dvd[2] = 0x12000000;
|
|
||||||
dvd[3] = 0;
|
|
||||||
dvd[4] = 0x20;
|
|
||||||
dvd[5] = 0x80000000;
|
|
||||||
dvd[6] = 0x20;
|
|
||||||
dvd[7] = 3;
|
|
||||||
|
|
||||||
while( dvd[7] & 1 )
|
|
||||||
;
|
|
||||||
DCFlushRange((void *)0x80000000, 32);
|
|
||||||
|
|
||||||
return (int)inquiry[2];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dvd_read
|
* dvd_read
|
||||||
*
|
*
|
||||||
@ -86,9 +58,9 @@ dvd_read (void *dst, unsigned int len, u64 offset)
|
|||||||
if(offset < 0x57057C00 || (isWii == true && offset < 0x118244F00LL)) // don't read past the end of the DVD
|
if(offset < 0x57057C00 || (isWii == true && offset < 0x118244F00LL)) // don't read past the end of the DVD
|
||||||
{
|
{
|
||||||
offset >>= 2;
|
offset >>= 2;
|
||||||
|
|
||||||
#ifdef HW_DOL
|
#ifdef HW_DOL
|
||||||
|
|
||||||
dvd[0] = 0x2E;
|
dvd[0] = 0x2E;
|
||||||
dvd[1] = 0;
|
dvd[1] = 0;
|
||||||
dvd[2] = 0xA8000000;
|
dvd[2] = 0xA8000000;
|
||||||
@ -99,12 +71,12 @@ dvd_read (void *dst, unsigned int len, u64 offset)
|
|||||||
dvd[7] = 3; /*** Enable reading with DMA ***/
|
dvd[7] = 3; /*** Enable reading with DMA ***/
|
||||||
while (dvd[7] & 1);
|
while (dvd[7] & 1);
|
||||||
memcpy (dst, buffer, len);
|
memcpy (dst, buffer, len);
|
||||||
|
|
||||||
if (dvd[0] & 0x4) /* Ensure it has completed */
|
if (dvd[0] & 0x4) /* Ensure it has completed */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
#elif WII_DVD
|
#elif WII_DVD
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
ret = DI_ReadDVD(dst, (u32)len, (u32)offset);
|
ret = DI_ReadDVD(dst, (u32)len, (u32)offset);
|
||||||
@ -114,9 +86,8 @@ dvd_read (void *dst, unsigned int len, u64 offset)
|
|||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else // Let's not read past end of DVD
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Minimal ISO Directory Definition **/
|
/** Minimal ISO Directory Definition **/
|
||||||
@ -542,5 +513,31 @@ void dvd_motor_off( )
|
|||||||
dvd[0] = 0x14;
|
dvd[0] = 0x14;
|
||||||
dvd[1] = 0;
|
dvd[1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dvd_driveid
|
||||||
|
*
|
||||||
|
* Gets and returns the dvd driveid
|
||||||
|
**/
|
||||||
|
|
||||||
|
int dvd_driveid()
|
||||||
|
{
|
||||||
|
static unsigned char *inquiry=(unsigned char *)0x80000004;
|
||||||
|
|
||||||
|
dvd[0] = 0x2e;
|
||||||
|
dvd[1] = 0;
|
||||||
|
dvd[2] = 0x12000000;
|
||||||
|
dvd[3] = 0;
|
||||||
|
dvd[4] = 0x20;
|
||||||
|
dvd[5] = 0x80000000;
|
||||||
|
dvd[6] = 0x20;
|
||||||
|
dvd[7] = 3;
|
||||||
|
|
||||||
|
while( dvd[7] & 1 )
|
||||||
|
;
|
||||||
|
DCFlushRange((void *)0x80000000, 32);
|
||||||
|
|
||||||
|
return (int)inquiry[2];
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -230,11 +230,11 @@ int FileSelector (int method)
|
|||||||
signed char gc_sx = 0;
|
signed char gc_sx = 0;
|
||||||
signed char wm_ay = 0;
|
signed char wm_ay = 0;
|
||||||
signed char wm_sx = 0;
|
signed char wm_sx = 0;
|
||||||
|
|
||||||
int haverom = 0;
|
int haverom = 0;
|
||||||
int redraw = 1;
|
int redraw = 1;
|
||||||
int selectit = 0;
|
int selectit = 0;
|
||||||
|
|
||||||
int scroll_delay = 0;
|
int scroll_delay = 0;
|
||||||
bool move_selection = 0;
|
bool move_selection = 0;
|
||||||
#define SCROLL_INITIAL_DELAY 15
|
#define SCROLL_INITIAL_DELAY 15
|
||||||
@ -250,7 +250,7 @@ int FileSelector (int method)
|
|||||||
|
|
||||||
gc_ay = PAD_StickY (0);
|
gc_ay = PAD_StickY (0);
|
||||||
gc_sx = PAD_SubStickX (0);
|
gc_sx = PAD_SubStickX (0);
|
||||||
|
|
||||||
p = PAD_ButtonsDown (0);
|
p = PAD_ButtonsDown (0);
|
||||||
ph = PAD_ButtonsHeld (0);
|
ph = PAD_ButtonsHeld (0);
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
@ -465,7 +465,7 @@ OpenDVD (int method)
|
|||||||
DI_GetCoverRegister(&val);
|
DI_GetCoverRegister(&val);
|
||||||
if(val & 0x1) // True if no disc inside, use (val & 0x2) for true if disc inside.
|
if(val & 0x1) // True if no disc inside, use (val & 0x2) for true if disc inside.
|
||||||
{
|
{
|
||||||
WaitPrompt("No disc inserted!");
|
WaitPrompt((char *)"No disc inserted!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
DI_Mount();
|
DI_Mount();
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ogcsys.h>
|
#include <ogcsys.h>
|
||||||
|
#include "mxml.h"
|
||||||
|
|
||||||
#include "snes9x.h"
|
#include "snes9x.h"
|
||||||
#include "memmap.h"
|
#include "memmap.h"
|
||||||
@ -34,8 +35,9 @@ extern unsigned int wmpadmap[];
|
|||||||
extern unsigned int ccpadmap[];
|
extern unsigned int ccpadmap[];
|
||||||
extern unsigned int ncpadmap[];
|
extern unsigned int ncpadmap[];
|
||||||
|
|
||||||
#define PREFS_FILE_NAME "snes9xGx.prf"
|
#define PREFS_FILE_NAME "SNES9xGX.xml"
|
||||||
#define PREFSVERSTRING "Snes9x GX 005 Prefs"
|
#define PREFSVERSTRING "Snes9x GX 005 Prefs"
|
||||||
|
#define VERSIONSTRING "005"
|
||||||
|
|
||||||
char prefscomment[2][32] = { {PREFSVERSTRING}, {"Preferences"} };
|
char prefscomment[2][32] = { {PREFSVERSTRING}, {"Preferences"} };
|
||||||
|
|
||||||
@ -44,32 +46,144 @@ char prefscomment[2][32] = { {PREFSVERSTRING}, {"Preferences"} };
|
|||||||
*
|
*
|
||||||
* This sets up the save buffer for saving.
|
* This sets up the save buffer for saving.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int
|
mxml_node_t *xml;
|
||||||
preparePrefsData ()
|
mxml_node_t *data;
|
||||||
|
mxml_node_t *section;
|
||||||
|
mxml_node_t *item;
|
||||||
|
mxml_node_t *elem;
|
||||||
|
|
||||||
|
char temp[200];
|
||||||
|
|
||||||
|
const char * toStr(int i)
|
||||||
{
|
{
|
||||||
|
sprintf(temp, "%d", i);
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void createXMLSection(const char * name, const char * description)
|
||||||
|
{
|
||||||
|
section = mxmlNewElement(data, "section");
|
||||||
|
mxmlElementSetAttr(section, "name", name);
|
||||||
|
mxmlElementSetAttr(section, "description", description);
|
||||||
|
}
|
||||||
|
|
||||||
|
void createXMLSetting(const char * name, const char * description, const char * value)
|
||||||
|
{
|
||||||
|
item = mxmlNewElement(section, "setting");
|
||||||
|
mxmlElementSetAttr(item, "name", name);
|
||||||
|
mxmlElementSetAttr(item, "value", value);
|
||||||
|
mxmlElementSetAttr(item, "description", description);
|
||||||
|
}
|
||||||
|
|
||||||
|
void createXMLController(unsigned int controller[], const char * name, const char * description)
|
||||||
|
{
|
||||||
|
item = mxmlNewElement(section, "controller");
|
||||||
|
mxmlElementSetAttr(item, "name", name);
|
||||||
|
mxmlElementSetAttr(item, "description", description);
|
||||||
|
|
||||||
|
// create buttons
|
||||||
|
for(int i=0; i < 12; i++)
|
||||||
|
{
|
||||||
|
elem = mxmlNewElement(item, "button");
|
||||||
|
mxmlElementSetAttr(elem, "number", toStr(i));
|
||||||
|
mxmlElementSetAttr(elem, "assignment", toStr(controller[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
preparePrefsData (int method)
|
||||||
|
{
|
||||||
|
int offset = 0;
|
||||||
|
memset (savebuffer, 0, SAVEBUFFERSIZE);
|
||||||
|
|
||||||
|
// add save icon and comments for Memory Card saves
|
||||||
|
if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB)
|
||||||
|
{
|
||||||
|
offset = sizeof (saveicon);
|
||||||
|
|
||||||
|
// Copy in save icon
|
||||||
|
memcpy (savebuffer, saveicon, offset);
|
||||||
|
|
||||||
|
// And the comments
|
||||||
|
memcpy (savebuffer + offset, prefscomment, 64);
|
||||||
|
offset += 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
xml = mxmlNewXML("1.0");
|
||||||
|
|
||||||
|
data = mxmlNewElement(xml, "file");
|
||||||
|
mxmlElementSetAttr(data, "version",VERSIONSTRING);
|
||||||
|
|
||||||
|
createXMLSection("File", "File Settings");
|
||||||
|
|
||||||
|
createXMLSetting("AutoLoad", "Auto Load", toStr(GCSettings.AutoLoad));
|
||||||
|
createXMLSetting("AutoSave", "Auto Save", toStr(GCSettings.AutoSave));
|
||||||
|
createXMLSetting("LoadMethod", "Load Method", toStr(GCSettings.LoadMethod));
|
||||||
|
createXMLSetting("SaveMethod", "Save Method", toStr(GCSettings.SaveMethod));
|
||||||
|
createXMLSetting("LoadFolder", "Load Folder", GCSettings.LoadFolder);
|
||||||
|
createXMLSetting("SaveFolder", "Save Folder", GCSettings.SaveFolder);
|
||||||
|
createXMLSetting("CheatFolder", "Cheats Folder", GCSettings.CheatFolder);
|
||||||
|
createXMLSetting("VerifySaves", "Verify Memory Card Saves", toStr(GCSettings.VerifySaves));
|
||||||
|
|
||||||
|
createXMLSection("Network", "Network Settings");
|
||||||
|
|
||||||
|
createXMLSetting("smbip", "Share Computer IP", GCSettings.smbip);
|
||||||
|
createXMLSetting("smbshare", "Share Name", GCSettings.smbshare);
|
||||||
|
createXMLSetting("smbuser", "Share Username", GCSettings.smbuser);
|
||||||
|
createXMLSetting("smbpwd", "Share Password", GCSettings.smbpwd);
|
||||||
|
|
||||||
|
createXMLSection("Emulation", "Emulation Settings");
|
||||||
|
|
||||||
|
createXMLSetting("ReverseStereo", "Reverse Stereo", toStr(Settings.ReverseStereo));
|
||||||
|
createXMLSetting("InterpolatedSound", "Interpolated Sound", toStr(Settings.InterpolatedSound));
|
||||||
|
createXMLSetting("Transparency", "Transparency", toStr(Settings.Transparency));
|
||||||
|
createXMLSetting("DisplayFrameRate", "Display Frame Rate", toStr(Settings.DisplayFrameRate));
|
||||||
|
createXMLSetting("NGCZoom", "C-Stick Zoom", toStr(GCSettings.NGCZoom));
|
||||||
|
createXMLSetting("render", "Video Filtering", toStr(GCSettings.render));
|
||||||
|
|
||||||
|
createXMLSection("Controller", "Controller Settings");
|
||||||
|
|
||||||
|
createXMLSetting("MultiTap", "MultiTap", toStr(Settings.MultiPlayer5Master));
|
||||||
|
createXMLSetting("Superscope", "Superscope", toStr(GCSettings.Superscope));
|
||||||
|
createXMLSetting("Mice", "Mice", toStr(GCSettings.Mouse));
|
||||||
|
createXMLSetting("Justifiers", "Justifiers", toStr(GCSettings.Justifier));
|
||||||
|
|
||||||
|
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, MXML_NO_CALLBACK);
|
||||||
|
|
||||||
|
mxmlDelete(xml);
|
||||||
|
|
||||||
|
return datasize;
|
||||||
|
|
||||||
|
/*
|
||||||
int offset = sizeof (saveicon);
|
int offset = sizeof (saveicon);
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
memset (savebuffer, 0, SAVEBUFFERSIZE);
|
memset (savebuffer, 0, SAVEBUFFERSIZE);
|
||||||
|
|
||||||
/*** Copy in save icon ***/
|
// Copy in save icon
|
||||||
memcpy (savebuffer, saveicon, offset);
|
memcpy (savebuffer, saveicon, offset);
|
||||||
|
|
||||||
/*** And the prefscomments ***/
|
// And the prefscomments
|
||||||
memcpy (savebuffer + offset, prefscomment, 64);
|
memcpy (savebuffer + offset, prefscomment, 64);
|
||||||
offset += 64;
|
offset += 64;
|
||||||
|
|
||||||
/*** Save all settings ***/
|
// Save all settings
|
||||||
size = sizeof (Settings);
|
size = sizeof (Settings);
|
||||||
memcpy (savebuffer + offset, &Settings, size);
|
memcpy (savebuffer + offset, &Settings, size);
|
||||||
offset += size;
|
offset += size;
|
||||||
|
|
||||||
/*** Save GC specific settings ***/
|
// Save GC specific settings
|
||||||
size = sizeof (GCSettings);
|
size = sizeof (GCSettings);
|
||||||
memcpy (savebuffer + offset, &GCSettings, size);
|
memcpy (savebuffer + offset, &GCSettings, size);
|
||||||
offset += size;
|
offset += size;
|
||||||
|
|
||||||
/*** Save buttonmaps ***/
|
// Save buttonmaps
|
||||||
size = sizeof (unsigned int) *12; // this size applies to all padmaps
|
size = sizeof (unsigned int) *12; // this size applies to all padmaps
|
||||||
memcpy (savebuffer + offset, &gcpadmap, size);
|
memcpy (savebuffer + offset, &gcpadmap, size);
|
||||||
offset += size;
|
offset += size;
|
||||||
@ -81,15 +195,116 @@ preparePrefsData ()
|
|||||||
offset += size;
|
offset += size;
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Decode Preferences Data
|
* Decode Preferences Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
bool
|
void loadXMLSetting(char * var, const char * name)
|
||||||
decodePrefsData ()
|
|
||||||
{
|
{
|
||||||
|
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
|
||||||
|
if(item)
|
||||||
|
sprintf(var, "%s", mxmlElementGetAttr(item, "value"));
|
||||||
|
}
|
||||||
|
void loadXMLSetting(int * var, const char * name)
|
||||||
|
{
|
||||||
|
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
|
||||||
|
if(item)
|
||||||
|
*var = atoi(mxmlElementGetAttr(item, "value"));
|
||||||
|
}
|
||||||
|
void loadXMLSetting(bool8 * var, const char * name)
|
||||||
|
{
|
||||||
|
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND);
|
||||||
|
if(item)
|
||||||
|
*var = atoi(mxmlElementGetAttr(item, "value"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadXMLController(unsigned int controller[], const char * name)
|
||||||
|
{
|
||||||
|
item = mxmlFindElement(xml, xml, "controller", "name", name, MXML_DESCEND);
|
||||||
|
|
||||||
|
if(item)
|
||||||
|
{
|
||||||
|
WaitPrompt((char *)name);
|
||||||
|
// populate buttons
|
||||||
|
for(int i=0; i < 12; i++)
|
||||||
|
{
|
||||||
|
elem = mxmlFindElement(item, xml, "button", "number", toStr(i), MXML_DESCEND);
|
||||||
|
if(elem)
|
||||||
|
controller[i] = atoi(mxmlElementGetAttr(elem, "assignment"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
decodePrefsData (int method)
|
||||||
|
{
|
||||||
|
int offset = 0;
|
||||||
|
|
||||||
|
// skip save icon and comments for Memory Card saves
|
||||||
|
if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB)
|
||||||
|
{
|
||||||
|
offset = sizeof (saveicon);
|
||||||
|
offset += 64; // sizeof prefscomment
|
||||||
|
}
|
||||||
|
|
||||||
|
xml = mxmlLoadString(NULL, (char *)savebuffer+offset, MXML_TEXT_CALLBACK);
|
||||||
|
|
||||||
|
// check settings version
|
||||||
|
// we don't do anything with the version #, but we'll store it anyway
|
||||||
|
char * version;
|
||||||
|
item = mxmlFindElement(xml, xml, "file", "version", NULL, MXML_DESCEND);
|
||||||
|
if(item) // a version entry exists
|
||||||
|
version = (char *)mxmlElementGetAttr(item, "version");
|
||||||
|
else // version # not found, must be invalid
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// File Settings
|
||||||
|
|
||||||
|
loadXMLSetting(&GCSettings.AutoLoad, "AutoLoad");
|
||||||
|
loadXMLSetting(&GCSettings.AutoSave, "AutoSave");
|
||||||
|
loadXMLSetting(&GCSettings.LoadMethod, "LoadMethod");
|
||||||
|
loadXMLSetting(&GCSettings.SaveMethod, "SaveMethod");
|
||||||
|
loadXMLSetting(GCSettings.LoadFolder, "LoadFolder");
|
||||||
|
loadXMLSetting(GCSettings.SaveFolder, "SaveFolder");
|
||||||
|
loadXMLSetting(GCSettings.CheatFolder, "CheatFolder");
|
||||||
|
loadXMLSetting(&GCSettings.VerifySaves, "VerifySaves");
|
||||||
|
|
||||||
|
// Network Settings
|
||||||
|
|
||||||
|
loadXMLSetting(GCSettings.smbip, "smbip");
|
||||||
|
loadXMLSetting(GCSettings.smbshare, "smbshare");
|
||||||
|
loadXMLSetting(GCSettings.smbuser, "smbuser");
|
||||||
|
loadXMLSetting(GCSettings.smbpwd, "smbpwd");
|
||||||
|
|
||||||
|
// Emulation Settings
|
||||||
|
|
||||||
|
loadXMLSetting(&Settings.ReverseStereo, "ReverseStereo");
|
||||||
|
loadXMLSetting(&Settings.InterpolatedSound, "InterpolatedSound");
|
||||||
|
loadXMLSetting(&Settings.Transparency, "Transparency");
|
||||||
|
loadXMLSetting(&Settings.DisplayFrameRate, "DisplayFrameRate");
|
||||||
|
loadXMLSetting(&GCSettings.NGCZoom, "NGCZoom");
|
||||||
|
loadXMLSetting(&GCSettings.render, "render");
|
||||||
|
|
||||||
|
// Controller Settings
|
||||||
|
|
||||||
|
loadXMLSetting(&Settings.MultiPlayer5Master, "MultiTap");
|
||||||
|
loadXMLSetting(&GCSettings.Superscope, "Superscope");
|
||||||
|
loadXMLSetting(&GCSettings.Mouse, "Mice");
|
||||||
|
loadXMLSetting(&GCSettings.Justifier, "Justifiers");
|
||||||
|
|
||||||
|
loadXMLController(gcpadmap, "gcpadmap");
|
||||||
|
loadXMLController(wmpadmap, "wmpadmap");
|
||||||
|
loadXMLController(ccpadmap, "ccpadmap");
|
||||||
|
loadXMLController(ncpadmap, "ncpadmap");
|
||||||
|
|
||||||
|
mxmlDelete(xml);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
/*
|
||||||
int offset;
|
int offset;
|
||||||
char prefscomment[32];
|
char prefscomment[32];
|
||||||
int size;
|
int size;
|
||||||
@ -118,6 +333,7 @@ decodePrefsData ()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -129,12 +345,11 @@ SavePrefs (int method, bool silent)
|
|||||||
if(method == METHOD_AUTO)
|
if(method == METHOD_AUTO)
|
||||||
method = autoSaveMethod();
|
method = autoSaveMethod();
|
||||||
|
|
||||||
bool retval = false;
|
|
||||||
char filepath[1024];
|
char filepath[1024];
|
||||||
int datasize;
|
int datasize;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
datasize = preparePrefsData ();
|
datasize = preparePrefsData (method);
|
||||||
|
|
||||||
if (!silent)
|
if (!silent)
|
||||||
ShowAction ((char*) "Saving preferences...");
|
ShowAction ((char*) "Saving preferences...");
|
||||||
@ -163,11 +378,11 @@ SavePrefs (int method, bool silent)
|
|||||||
|
|
||||||
if (offset > 0)
|
if (offset > 0)
|
||||||
{
|
{
|
||||||
retval = decodePrefsData ();
|
if (!silent)
|
||||||
if ( !silent )
|
|
||||||
WaitPrompt ((char *)"Preferences saved");
|
WaitPrompt ((char *)"Preferences saved");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return retval;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -210,7 +425,7 @@ LoadPrefs (int method, bool silent)
|
|||||||
|
|
||||||
if (offset > 0)
|
if (offset > 0)
|
||||||
{
|
{
|
||||||
retval = decodePrefsData ();
|
retval = decodePrefsData (method);
|
||||||
if ( !silent )
|
if ( !silent )
|
||||||
WaitPrompt((char *)"Preferences loaded");
|
WaitPrompt((char *)"Preferences loaded");
|
||||||
}
|
}
|
||||||
|
@ -177,26 +177,16 @@ DefaultSettings ()
|
|||||||
GCSettings.AutoSave = 1;
|
GCSettings.AutoSave = 1;
|
||||||
|
|
||||||
// default SMB settings
|
// default SMB settings
|
||||||
|
strncpy (GCSettings.smbip, "192.168.0.1", 15); // IP Address of share server
|
||||||
|
strncpy (GCSettings.smbuser, "Wiiuser", 19); // Your share user
|
||||||
|
strncpy (GCSettings.smbpwd, "password", 19); // Your share user password
|
||||||
|
strncpy (GCSettings.smbshare, "SNES", 19); // Share name on server
|
||||||
|
|
||||||
#define GC_IP "192.168.0.32" // IP to assign the GameCube
|
GCSettings.gcip[0] = 0;
|
||||||
#define GW_IP "192.168.0.150" // Your gateway IP
|
GCSettings.gwip[0] = 0;
|
||||||
#define MASK "255.255.255.0" // Your subnet mask
|
GCSettings.mask[0] = 0;
|
||||||
#define SMB_USER "Wiiuser" // Your share user
|
GCSettings.smbsvid[0] = 0;
|
||||||
#define SMB_PWD "password" // Your share user password
|
GCSettings.smbgcid[0] = 0;
|
||||||
#define SMB_GCID "Wii" // Machine Name of GameCube
|
|
||||||
#define SMB_SVID "Server" // Machine Name of Server(Share)
|
|
||||||
#define SMB_SHARE "SNES" // Share name on server
|
|
||||||
#define SMB_IP "192.168.0.1" // IP Address of share server
|
|
||||||
|
|
||||||
strncpy (GCSettings.gcip, GC_IP, 15);
|
|
||||||
strncpy (GCSettings.gwip, GW_IP, 15);
|
|
||||||
strncpy (GCSettings.mask, MASK, 15);
|
|
||||||
strncpy (GCSettings.smbip, SMB_IP, 15);
|
|
||||||
strncpy (GCSettings.smbuser, SMB_USER, 19);
|
|
||||||
strncpy (GCSettings.smbpwd, SMB_PWD, 19);
|
|
||||||
strncpy (GCSettings.smbgcid, SMB_GCID, 19);
|
|
||||||
strncpy (GCSettings.smbsvid, SMB_SVID, 19);
|
|
||||||
strncpy (GCSettings.smbshare, SMB_SHARE, 19);
|
|
||||||
|
|
||||||
GCSettings.NGCZoom = 0;
|
GCSettings.NGCZoom = 0;
|
||||||
GCSettings.VerifySaves = 0;
|
GCSettings.VerifySaves = 0;
|
||||||
|
@ -259,7 +259,7 @@ emulate ()
|
|||||||
{
|
{
|
||||||
S9xMainLoop ();
|
S9xMainLoop ();
|
||||||
NGCReportButtons ();
|
NGCReportButtons ();
|
||||||
|
|
||||||
if (ConfigRequested)
|
if (ConfigRequested)
|
||||||
{
|
{
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
@ -283,21 +283,21 @@ emulate ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
mainmenu (3); // go to game menu
|
mainmenu (3); // go to game menu
|
||||||
|
|
||||||
/*** Update any emulation settings changed in the menu ***/
|
/*** Update any emulation settings changed in the menu ***/
|
||||||
ReInitGCVideo(); // update video after reading settings
|
ReInitGCVideo(); // update video after reading settings
|
||||||
FrameTimer = 0;
|
FrameTimer = 0;
|
||||||
setFrameTimerMethod(); // set frametimer method every time a ROM is loaded
|
setFrameTimerMethod(); // set frametimer method every time a ROM is loaded
|
||||||
|
|
||||||
Settings.SuperScopeMaster = (GCSettings.Superscope > 0 ? true : false);
|
Settings.SuperScopeMaster = (GCSettings.Superscope > 0 ? true : false);
|
||||||
Settings.MouseMaster = (GCSettings.Mouse > 0 ? true : false);
|
Settings.MouseMaster = (GCSettings.Mouse > 0 ? true : false);
|
||||||
Settings.JustifierMaster = (GCSettings.Justifier > 0 ? true : false);
|
Settings.JustifierMaster = (GCSettings.Justifier > 0 ? true : false);
|
||||||
SetControllers();
|
SetControllers();
|
||||||
S9xReportControllers(); // FIX
|
S9xReportControllers(); // FIX
|
||||||
|
|
||||||
ConfigRequested = 0;
|
ConfigRequested = 0;
|
||||||
}//if ConfigRequested
|
}//if ConfigRequested
|
||||||
|
|
||||||
}//while
|
}//while
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,10 +327,10 @@ main ()
|
|||||||
#ifdef WII_DVD
|
#ifdef WII_DVD
|
||||||
DI_Init(); // first
|
DI_Init(); // first
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned int save_flags;
|
unsigned int save_flags;
|
||||||
int selectedMenu = -1;
|
int selectedMenu = -1;
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
WPAD_Init();
|
WPAD_Init();
|
||||||
// read wiimote accelerometer and IR data
|
// read wiimote accelerometer and IR data
|
||||||
@ -428,7 +428,7 @@ main ()
|
|||||||
CPU.Flags = save_flags;
|
CPU.Flags = save_flags;
|
||||||
|
|
||||||
/*** Load SRAM ***/
|
/*** Load SRAM ***/
|
||||||
Memory.LoadSRAM ("DVD");
|
//Memory.LoadSRAM ("DVD");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Emulate ***/
|
/*** Emulate ***/
|
||||||
|
@ -177,10 +177,10 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct SGCSettings{
|
struct SGCSettings{
|
||||||
uint8 AutoLoad;
|
int AutoLoad;
|
||||||
uint8 AutoSave;
|
int AutoSave;
|
||||||
uint8 LoadMethod; // For ROMS: Auto, SD, DVD, USB, Network (SMB)
|
int LoadMethod; // For ROMS: Auto, SD, DVD, USB, Network (SMB)
|
||||||
uint8 SaveMethod; // For SRAM, Freeze, Prefs: Auto, SD, Memory Card Slot A, Memory Card Slot B, USB, 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 LoadFolder[200]; // Path to game files
|
||||||
char SaveFolder[200]; // Path to save files
|
char SaveFolder[200]; // Path to save files
|
||||||
char CheatFolder[200]; // Path to cheat files
|
char CheatFolder[200]; // Path to cheat files
|
||||||
@ -193,12 +193,12 @@ struct SGCSettings{
|
|||||||
char smbgcid[20];
|
char smbgcid[20];
|
||||||
char smbsvid[20];
|
char smbsvid[20];
|
||||||
char smbshare[20];
|
char smbshare[20];
|
||||||
bool8 NGCZoom;
|
int NGCZoom; // 0 - off, 1 - on
|
||||||
uint8 VerifySaves;
|
int VerifySaves;
|
||||||
u16 render; // 0 - original, 1 - no AA
|
int render; // 0 - original, 1 - no AA
|
||||||
u16 Superscope;
|
int Superscope;
|
||||||
u16 Mouse;
|
int Mouse;
|
||||||
u16 Justifier;
|
int Justifier;
|
||||||
};
|
};
|
||||||
|
|
||||||
START_EXTERN_C
|
START_EXTERN_C
|
||||||
|
Loading…
Reference in New Issue
Block a user