mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-01 00:15:14 +01:00
-add functions to auto-determine load/save device
-libfat cleanup, add sd gecko support -tweak to mouse code
This commit is contained in:
parent
c3bead1447
commit
09cb10dfb6
@ -30,10 +30,11 @@ SetupCheats()
|
|||||||
|
|
||||||
char cheatFile[150] = { '\0' };
|
char cheatFile[150] = { '\0' };
|
||||||
|
|
||||||
if(GCSettings.SaveMethod == METHOD_SD)
|
if(GCSettings.SaveMethod == METHOD_SD || GCSettings.SaveMethod == METHOD_USB)
|
||||||
sprintf (cheatFile, "%s/snes9x/cheats/%s.cht", ROOTSDDIR, Memory.ROMFilename);
|
{
|
||||||
else if(GCSettings.SaveMethod == METHOD_USB)
|
changeFATInterface(GCSettings.SaveMethod);
|
||||||
sprintf (cheatFile, "%s/snes9x/cheats/%s.cht", ROOTUSBDIR, Memory.ROMFilename);
|
sprintf (cheatFile, "%s/snes9x/cheats/%s.cht", ROOTFATDIR, Memory.ROMFilename);
|
||||||
|
}
|
||||||
|
|
||||||
// load cheat file if present
|
// load cheat file if present
|
||||||
if(strlen(cheatFile) > 0)
|
if(strlen(cheatFile) > 0)
|
||||||
|
@ -51,6 +51,52 @@ bool fat_is_mounted(PARTITION_INTERFACE partition) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* changeFATInterface
|
||||||
|
* Checks if the device (method) specified is available, and
|
||||||
|
* sets libfat to use the device
|
||||||
|
****************************************************************************/
|
||||||
|
bool changeFATInterface(int method)
|
||||||
|
{
|
||||||
|
bool devFound = false;
|
||||||
|
|
||||||
|
if(method == METHOD_SD)
|
||||||
|
{
|
||||||
|
// check which SD device is loaded
|
||||||
|
|
||||||
|
#ifdef HW_RVL
|
||||||
|
if (fat_is_mounted(PI_INTERNAL_SD))
|
||||||
|
{
|
||||||
|
devFound = true;
|
||||||
|
fatSetDefaultInterface(PI_INTERNAL_SD);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!devFound && fat_is_mounted(PI_SDGECKO_A))
|
||||||
|
{
|
||||||
|
devFound = true;
|
||||||
|
fatSetDefaultInterface(PI_SDGECKO_A);
|
||||||
|
}
|
||||||
|
if(!devFound && fat_is_mounted(PI_SDGECKO_B))
|
||||||
|
{
|
||||||
|
devFound = true;
|
||||||
|
fatSetDefaultInterface(PI_SDGECKO_B);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(method == METHOD_USB)
|
||||||
|
{
|
||||||
|
#ifdef HW_RVL
|
||||||
|
if(fat_is_mounted(PI_USBSTORAGE))
|
||||||
|
{
|
||||||
|
devFound = true;
|
||||||
|
fatSetDefaultInterface(PI_USBSTORAGE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return devFound;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* fat_enable_readahead_all
|
* fat_enable_readahead_all
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -160,10 +206,7 @@ int updateFATdirname(int method)
|
|||||||
sprintf(temp, "/%s/..", GCSettings.LoadFolder);
|
sprintf(temp, "/%s/..", GCSettings.LoadFolder);
|
||||||
if (strcmp(currFATdir, temp) == 0)
|
if (strcmp(currFATdir, temp) == 0)
|
||||||
{
|
{
|
||||||
if(method == METHOD_SD)
|
sprintf(currFATdir,"%s",ROOTFATDIR);
|
||||||
sprintf(currFATdir,"%s",ROOTSDDIR);
|
|
||||||
else
|
|
||||||
sprintf(currFATdir,"%s",ROOTUSBDIR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update current directory name */
|
/* update current directory name */
|
||||||
@ -200,10 +243,7 @@ int parseFATdirectory(int method)
|
|||||||
WaitPrompt(msg);
|
WaitPrompt(msg);
|
||||||
|
|
||||||
// if we can't open the previous dir, open root dir
|
// if we can't open the previous dir, open root dir
|
||||||
if(method == METHOD_SD)
|
sprintf(currFATdir,"%s",ROOTFATDIR);
|
||||||
sprintf(currFATdir,"%s",ROOTSDDIR);
|
|
||||||
else
|
|
||||||
sprintf(currFATdir,"%s",ROOTUSBDIR);
|
|
||||||
|
|
||||||
fatdir = diropen(currFATdir);
|
fatdir = diropen(currFATdir);
|
||||||
|
|
||||||
|
@ -21,10 +21,11 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define ROOTSDDIR "fat3:/"
|
#define ROOTFATDIR "fat:/"
|
||||||
#define ROOTUSBDIR "fat4:/"
|
|
||||||
|
|
||||||
bool fat_remount(PARTITION_INTERFACE partition);
|
bool fat_remount(PARTITION_INTERFACE partition);
|
||||||
|
bool fat_is_mounted(PARTITION_INTERFACE partition);
|
||||||
|
bool changeFATInterface(int method);
|
||||||
static int FileSortCallback(const void *f1, const void *f2);
|
static int FileSortCallback(const void *f1, const void *f2);
|
||||||
int updateFATdirname(int method);
|
int updateFATdirname(int method);
|
||||||
int parseFATdirectory(int method);
|
int parseFATdirectory(int method);
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
|
|
||||||
#include <fat.h>
|
|
||||||
#include <sys/dir.h>
|
#include <sys/dir.h>
|
||||||
#include "snes9x.h"
|
#include "snes9x.h"
|
||||||
#include "memmap.h"
|
#include "memmap.h"
|
||||||
@ -51,67 +50,43 @@ extern int screenheight;
|
|||||||
extern FILEENTRIES filelist[MAXFILES];
|
extern FILEENTRIES filelist[MAXFILES];
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Auto-determines the load method
|
* autoLoadMethod()
|
||||||
* THIS CODE STILL NEEDS WORK
|
* Auto-determines and sets the load method
|
||||||
|
* Returns method set
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int autoLoadMethod()
|
int autoLoadMethod()
|
||||||
{
|
{
|
||||||
return METHOD_SD;
|
if(changeFATInterface(METHOD_SD))
|
||||||
|
return METHOD_SD;
|
||||||
|
else if(changeFATInterface(METHOD_USB))
|
||||||
|
return METHOD_USB;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WaitPrompt((char*) "Unable to auto-determine load method!");
|
||||||
|
return 0; // no method found
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Auto-determines the save method
|
* autoSaveMethod()
|
||||||
* THIS CODE STILL NEEDS WORK
|
* Auto-determines and sets the save method
|
||||||
|
* Returns method set
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int autoSaveMethod()
|
int autoSaveMethod()
|
||||||
{
|
{
|
||||||
return METHOD_SD;
|
if(changeFATInterface(METHOD_SD))
|
||||||
int method = -1;
|
return METHOD_SD;
|
||||||
|
else if(changeFATInterface(METHOD_USB))
|
||||||
while(method < 0)
|
return METHOD_USB;
|
||||||
|
else if(TestCard(CARD_SLOTA, NOTSILENT))
|
||||||
|
return METHOD_MC_SLOTA;
|
||||||
|
else if(TestCard(CARD_SLOTB, NOTSILENT))
|
||||||
|
return METHOD_MC_SLOTB;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
WaitPrompt((char*) "Checking SD");
|
WaitPrompt((char*) "Unable to auto-determine save method!");
|
||||||
|
return 0; // no method found
|
||||||
if(diropen(ROOTSDDIR))
|
|
||||||
{
|
|
||||||
WaitPrompt((char*) "Found SD!");
|
|
||||||
method = METHOD_SD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
WaitPrompt((char*) "Checking USB");
|
|
||||||
|
|
||||||
if(diropen(ROOTUSBDIR))
|
|
||||||
{
|
|
||||||
WaitPrompt((char*) "Found USB!");
|
|
||||||
method = METHOD_USB;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
WaitPrompt((char*) "Checking Slot A");
|
|
||||||
|
|
||||||
// check Memory Card Slot A
|
|
||||||
if(MountCard(CARD_SLOTA, SILENT) == 0)
|
|
||||||
{
|
|
||||||
WaitPrompt((char*) "Found Memory Card A!");
|
|
||||||
method = METHOD_MC_SLOTA;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
WaitPrompt((char*) "Checking Slot B");
|
|
||||||
|
|
||||||
// check Memory Card Slot B
|
|
||||||
if(MountCard(CARD_SLOTB, SILENT) == 0)
|
|
||||||
{
|
|
||||||
WaitPrompt((char*) "Found Memory Card B!");
|
|
||||||
method = METHOD_MC_SLOTB;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// no method found
|
|
||||||
WaitPrompt((char*) "Error: Could not determine save method.");
|
|
||||||
method = 0;
|
|
||||||
}
|
}
|
||||||
return method;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -534,10 +509,8 @@ OpenFAT (int method)
|
|||||||
havedir = 0; // gamecube only
|
havedir = 0; // gamecube only
|
||||||
|
|
||||||
/* change current dir to snes roms directory */
|
/* change current dir to snes roms directory */
|
||||||
if(method == METHOD_SD)
|
changeFATInterface(GCSettings.LoadMethod);
|
||||||
sprintf ( currFATdir, "%s/%s", ROOTSDDIR, GCSettings.LoadFolder );
|
sprintf ( currFATdir, "%s/%s", ROOTFATDIR, GCSettings.LoadFolder );
|
||||||
else
|
|
||||||
sprintf ( currFATdir, "%s/%s", ROOTUSBDIR, GCSettings.LoadFolder );
|
|
||||||
|
|
||||||
/* Parse initial root directory and get entries list */
|
/* Parse initial root directory and get entries list */
|
||||||
if ((maxfiles = parseFATdirectory (method)))
|
if ((maxfiles = parseFATdirectory (method)))
|
||||||
|
@ -66,18 +66,57 @@ ClearSaveBuffer ()
|
|||||||
int
|
int
|
||||||
CardFileExists (char *filename, int slot)
|
CardFileExists (char *filename, int slot)
|
||||||
{
|
{
|
||||||
int CardError;
|
int CardError;
|
||||||
|
|
||||||
CardError = CARD_FindFirst (slot, &CardDir, TRUE);
|
CardError = CARD_FindFirst (slot, &CardDir, TRUE);
|
||||||
while (CardError != CARD_ERROR_NOFILE)
|
while (CardError != CARD_ERROR_NOFILE)
|
||||||
{
|
{
|
||||||
CardError = CARD_FindNext (&CardDir);
|
CardError = CARD_FindNext (&CardDir);
|
||||||
|
|
||||||
if (strcmp ((char *) CardDir.filename, filename) == 0)
|
if (strcmp ((char *) CardDir.filename, filename) == 0)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* TestCard
|
||||||
|
*
|
||||||
|
* Checks to see if a card is in the card slot specified
|
||||||
|
****************************************************************************/
|
||||||
|
bool TestCard(int slot, bool silent)
|
||||||
|
{
|
||||||
|
/*** Initialize Card System ***/
|
||||||
|
memset (SysArea, 0, CARD_WORKAREA);
|
||||||
|
CARD_Init ("SNES", "00");
|
||||||
|
|
||||||
|
/*** Try to mount the card ***/
|
||||||
|
if (MountCard(slot, silent) == 0)
|
||||||
|
{
|
||||||
|
// Mount successful!
|
||||||
|
if(!silent)
|
||||||
|
{
|
||||||
|
if (slot == CARD_SLOTA)
|
||||||
|
WaitPrompt((char*) "Mounted Slot A Memory Card!");
|
||||||
|
else
|
||||||
|
WaitPrompt((char*) "Mounted Slot B Memory Card!");
|
||||||
|
}
|
||||||
|
CARD_Unmount (slot);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!silent)
|
||||||
|
{
|
||||||
|
if (slot == CARD_SLOTA)
|
||||||
|
WaitPrompt((char*) "Unable to Mount Slot A Memory Card!");
|
||||||
|
else
|
||||||
|
WaitPrompt((char*) "Unable to Mount Slot B Memory Card!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -87,7 +126,7 @@ CardFileExists (char *filename, int slot)
|
|||||||
* workarounds implemented for when the mount fails.
|
* workarounds implemented for when the mount fails.
|
||||||
* Returns the result of the last attempted CARD_Mount command.
|
* Returns the result of the last attempted CARD_Mount command.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int MountCard(int cslot, bool8 silent)
|
int MountCard(int cslot, bool silent)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int tries;
|
int tries;
|
||||||
|
@ -21,6 +21,7 @@ int VerifyMCFile (unsigned char *buf, int slot, char *filename, int datasize);
|
|||||||
|
|
||||||
int LoadBufferFromMC (unsigned char *buf, int slot, char *filename, bool8 silent);
|
int LoadBufferFromMC (unsigned char *buf, int slot, char *filename, bool8 silent);
|
||||||
int SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool8 silent);
|
int SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool8 silent);
|
||||||
int MountCard(int cslot, bool8 silent);
|
int MountCard(int cslot, bool silent);
|
||||||
|
bool TestCard(int slot, bool silent);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -145,13 +145,10 @@ NGCFreezeGame (int method, bool8 silent)
|
|||||||
int offset = 0;
|
int offset = 0;
|
||||||
char msg[100];
|
char msg[100];
|
||||||
|
|
||||||
if (method == METHOD_SD) // SD
|
if (method == METHOD_SD || method == METHOD_USB) // SD
|
||||||
{
|
{
|
||||||
sprintf (filename, "%s/%s/%s.frz", ROOTSDDIR, GCSettings.SaveFolder, Memory.ROMFilename);
|
changeFATInterface(GCSettings.SaveMethod);
|
||||||
}
|
sprintf (filename, "%s/%s/%s.frz", ROOTFATDIR, GCSettings.SaveFolder, Memory.ROMFilename);
|
||||||
if (method == METHOD_USB) // USB
|
|
||||||
{
|
|
||||||
sprintf (filename, "%s/%s/%s.frz", ROOTUSBDIR, GCSettings.SaveFolder, Memory.ROMFilename);
|
|
||||||
}
|
}
|
||||||
else if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB) // MC Slot A or B
|
else if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB) // MC Slot A or B
|
||||||
{
|
{
|
||||||
@ -192,14 +189,12 @@ NGCFreezeGame (int method, bool8 silent)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(method == METHOD_SD)
|
changeFATInterface(GCSettings.SaveMethod);
|
||||||
sprintf(msg, "Couldn't save to %s/%s/", ROOTSDDIR, GCSettings.SaveFolder);
|
sprintf(msg, "Couldn't save to %s/%s/", ROOTFATDIR, GCSettings.SaveFolder);
|
||||||
else
|
|
||||||
sprintf(msg, "Couldn't save to %s/%s/", ROOTUSBDIR, GCSettings.SaveFolder);
|
|
||||||
WaitPrompt (msg);
|
WaitPrompt (msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTA) // MC Slot A or B
|
else if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB) // MC Slot A or B
|
||||||
{
|
{
|
||||||
if (!silent)
|
if (!silent)
|
||||||
ShowAction ((char*) "Saving freeze game...");
|
ShowAction ((char*) "Saving freeze game...");
|
||||||
@ -353,10 +348,8 @@ NGCUnfreezeGame (int method, bool8 silent)
|
|||||||
|
|
||||||
if (method == METHOD_SD || method == METHOD_USB) // SD & USB
|
if (method == METHOD_SD || method == METHOD_USB) // SD & USB
|
||||||
{
|
{
|
||||||
if(method == METHOD_SD)
|
changeFATInterface(GCSettings.SaveMethod);
|
||||||
sprintf (filename, "%s/%s/%s.frz", ROOTSDDIR, GCSettings.SaveFolder, Memory.ROMFilename);
|
sprintf (filename, "%s/%s/%s.frz", ROOTFATDIR, GCSettings.SaveFolder, Memory.ROMFilename);
|
||||||
else
|
|
||||||
sprintf (filename, "%s/%s/%s.frz", ROOTUSBDIR, GCSettings.SaveFolder, Memory.ROMFilename);
|
|
||||||
|
|
||||||
handle = fopen (filename, "rb");
|
handle = fopen (filename, "rb");
|
||||||
|
|
||||||
|
@ -617,7 +617,7 @@ ConfigureButtons (u16 ctrlr_type)
|
|||||||
menu = oldmenu;
|
menu = oldmenu;
|
||||||
} // end configurebuttons()
|
} // end configurebuttons()
|
||||||
|
|
||||||
int ctlrmenucount = 9;
|
int ctlrmenucount = 10;
|
||||||
char ctlrmenu[][50] = {
|
char ctlrmenu[][50] = {
|
||||||
// toggle:
|
// toggle:
|
||||||
"MultiTap",
|
"MultiTap",
|
||||||
@ -657,7 +657,7 @@ ConfigureControllers ()
|
|||||||
|
|
||||||
if (GCSettings.Mouse > 0) sprintf (ctlrmenu[2], "Mice: %d", GCSettings.Mouse);
|
if (GCSettings.Mouse > 0) sprintf (ctlrmenu[2], "Mice: %d", GCSettings.Mouse);
|
||||||
else sprintf (ctlrmenu[2], "Mice: OFF");
|
else sprintf (ctlrmenu[2], "Mice: OFF");
|
||||||
|
|
||||||
if (GCSettings.Justifier > 0) sprintf (ctlrmenu[3], "Justifiers: %d", GCSettings.Justifier);
|
if (GCSettings.Justifier > 0) sprintf (ctlrmenu[3], "Justifiers: %d", GCSettings.Justifier);
|
||||||
else sprintf (ctlrmenu[3], "Justifiers: OFF");
|
else sprintf (ctlrmenu[3], "Justifiers: OFF");
|
||||||
|
|
||||||
@ -684,7 +684,7 @@ ConfigureControllers ()
|
|||||||
if (GCSettings.Justifier > 2)
|
if (GCSettings.Justifier > 2)
|
||||||
GCSettings.Justifier = 0;
|
GCSettings.Justifier = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
/*** Configure Nunchuk ***/
|
/*** Configure Nunchuk ***/
|
||||||
ConfigureButtons (CTRLR_NUNCHUK);
|
ConfigureButtons (CTRLR_NUNCHUK);
|
||||||
@ -694,7 +694,7 @@ ConfigureControllers ()
|
|||||||
/*** Configure Classic ***/
|
/*** Configure Classic ***/
|
||||||
ConfigureButtons (CTRLR_CLASSIC);
|
ConfigureButtons (CTRLR_CLASSIC);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
/*** Configure Wiimote ***/
|
/*** Configure Wiimote ***/
|
||||||
ConfigureButtons (CTRLR_WIIMOTE);
|
ConfigureButtons (CTRLR_WIIMOTE);
|
||||||
@ -807,7 +807,6 @@ mainmenu (int selectedMenu)
|
|||||||
quit = 1;
|
quit = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Remove any still held buttons ***/
|
/*** Remove any still held buttons ***/
|
||||||
|
@ -45,40 +45,40 @@ char prefscomment[2][32] = { {PREFSVERSTRING}, {"Preferences"} };
|
|||||||
int
|
int
|
||||||
preparePrefsData ()
|
preparePrefsData ()
|
||||||
{
|
{
|
||||||
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;
|
||||||
memcpy (savebuffer + offset, &wmpadmap, size);
|
memcpy (savebuffer + offset, &wmpadmap, size);
|
||||||
offset += size;
|
offset += size;
|
||||||
memcpy (savebuffer + offset, &ccpadmap, size);
|
memcpy (savebuffer + offset, &ccpadmap, size);
|
||||||
offset += size;
|
offset += size;
|
||||||
memcpy (savebuffer + offset, &ncpadmap, size);
|
memcpy (savebuffer + offset, &ncpadmap, size);
|
||||||
offset += size;
|
offset += size;
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -118,7 +118,6 @@ decodePrefsData ()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Save Preferences
|
* Save Preferences
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -140,10 +139,8 @@ SavePrefs (int method, bool silent)
|
|||||||
|
|
||||||
if(method == METHOD_SD || method == METHOD_USB)
|
if(method == METHOD_SD || method == METHOD_USB)
|
||||||
{
|
{
|
||||||
if(method == METHOD_SD)
|
changeFATInterface(GCSettings.SaveMethod);
|
||||||
sprintf (filepath, "%s/%s/%s", ROOTSDDIR, GCSettings.SaveFolder, PREFS_FILE_NAME);
|
sprintf (filepath, "%s/%s/%s", ROOTFATDIR, GCSettings.SaveFolder, PREFS_FILE_NAME);
|
||||||
else
|
|
||||||
sprintf (filepath, "%s/%s/%s", ROOTUSBDIR, GCSettings.SaveFolder, PREFS_FILE_NAME);
|
|
||||||
offset = SaveBufferToFAT (filepath, datasize, silent);
|
offset = SaveBufferToFAT (filepath, datasize, silent);
|
||||||
}
|
}
|
||||||
else if(method == METHOD_SMB)
|
else if(method == METHOD_SMB)
|
||||||
@ -190,10 +187,8 @@ LoadPrefs (int method, bool silent)
|
|||||||
|
|
||||||
if(method == METHOD_SD || method == METHOD_USB)
|
if(method == METHOD_SD || method == METHOD_USB)
|
||||||
{
|
{
|
||||||
if(method == METHOD_SD)
|
changeFATInterface(GCSettings.SaveMethod);
|
||||||
sprintf (filepath, "%s/%s/%s", ROOTSDDIR, GCSettings.SaveFolder, PREFS_FILE_NAME);
|
sprintf (filepath, "%s/%s/%s", ROOTFATDIR, GCSettings.SaveFolder, PREFS_FILE_NAME);
|
||||||
else
|
|
||||||
sprintf (filepath, "%s/%s/%s", ROOTUSBDIR, GCSettings.SaveFolder, PREFS_FILE_NAME);
|
|
||||||
offset = LoadBufferFromFAT (filepath, silent);
|
offset = LoadBufferFromFAT (filepath, silent);
|
||||||
}
|
}
|
||||||
else if(method == METHOD_SMB)
|
else if(method == METHOD_SMB)
|
||||||
|
@ -201,7 +201,7 @@ extern unsigned int timediffallowed;
|
|||||||
|
|
||||||
// hold superscope/mouse/justifier cursor positions
|
// hold superscope/mouse/justifier cursor positions
|
||||||
int cursor_x[5] = {0,0,0,0,0};
|
int cursor_x[5] = {0,0,0,0,0};
|
||||||
int cursor_y[5] = {0,0,0,0,0};
|
int cursor_y[5] = {0,0,0,0,0};
|
||||||
|
|
||||||
extern void fat_enable_readahead_all();
|
extern void fat_enable_readahead_all();
|
||||||
|
|
||||||
@ -646,7 +646,6 @@ void SetControllers ()
|
|||||||
{
|
{
|
||||||
if (Settings.MultiPlayer5Master == true)
|
if (Settings.MultiPlayer5Master == true)
|
||||||
{
|
{
|
||||||
|
|
||||||
S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0);
|
S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0);
|
||||||
S9xSetController (1, CTL_MP5, 1, 2, 3, -1);
|
S9xSetController (1, CTL_MP5, 1, 2, 3, -1);
|
||||||
}
|
}
|
||||||
@ -657,8 +656,9 @@ void SetControllers ()
|
|||||||
}
|
}
|
||||||
else if (Settings.MouseMaster == true)
|
else if (Settings.MouseMaster == true)
|
||||||
{
|
{
|
||||||
S9xSetController (0, CTL_JOYPAD, 0, 0, 0, 0);
|
// some games (eg: Mario Paint) don't allow the mouse in port 2
|
||||||
S9xSetController (1, CTL_MOUSE, (GCSettings.Mouse == 2), 0, 0, 0);
|
S9xSetController (0, CTL_MOUSE, (GCSettings.Mouse == 2), 0, 0, 0);
|
||||||
|
S9xSetController (1, CTL_JOYPAD, 1, 0, 0, 0);
|
||||||
}
|
}
|
||||||
else if (Settings.JustifierMaster == true)
|
else if (Settings.JustifierMaster == true)
|
||||||
{
|
{
|
||||||
@ -749,14 +749,14 @@ SetDefaultButtonMap ()
|
|||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Cursor");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Cursor");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope ToggleTurbo");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope ToggleTurbo");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Pause");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Pause");
|
||||||
|
|
||||||
maxcode = 0x60;
|
maxcode = 0x60;
|
||||||
/*** Mouse ***/
|
/*** Mouse ***/
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Mouse1 L");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Mouse1 L");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Mouse1 R");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Mouse1 R");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Mouse2 L");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Mouse2 L");
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Mouse2 R");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Mouse2 R");
|
||||||
|
|
||||||
maxcode = 0x70;
|
maxcode = 0x70;
|
||||||
/*** Justifier ***/
|
/*** Justifier ***/
|
||||||
ASSIGN_BUTTON_FALSE (maxcode++, "Justifier1 AimOffscreen");
|
ASSIGN_BUTTON_FALSE (maxcode++, "Justifier1 AimOffscreen");
|
||||||
@ -835,7 +835,9 @@ main ()
|
|||||||
/*** Initialize libFAT for SD and USB ***/
|
/*** Initialize libFAT for SD and USB ***/
|
||||||
fatInitDefault();
|
fatInitDefault();
|
||||||
//fatInit(8192, false);
|
//fatInit(8192, false);
|
||||||
|
#ifdef HW_RVL
|
||||||
//fat_enable_readahead_all();
|
//fat_enable_readahead_all();
|
||||||
|
#endif
|
||||||
|
|
||||||
/*** Initialize DVD subsystem ***/
|
/*** Initialize DVD subsystem ***/
|
||||||
DVD_Init ();
|
DVD_Init ();
|
||||||
|
@ -250,11 +250,8 @@ LoadSRAM (int method, bool silent)
|
|||||||
|
|
||||||
if(method == METHOD_SD || method == METHOD_USB)
|
if(method == METHOD_SD || method == METHOD_USB)
|
||||||
{
|
{
|
||||||
if(method == METHOD_SD)
|
changeFATInterface(GCSettings.SaveMethod);
|
||||||
sprintf (filepath, "%s/%s/%s.srm", ROOTSDDIR, GCSettings.SaveFolder, Memory.ROMFilename);
|
sprintf (filepath, "%s/%s/%s.srm", ROOTFATDIR, GCSettings.SaveFolder, Memory.ROMFilename);
|
||||||
else
|
|
||||||
sprintf (filepath, "%s/%s/%s.srm", ROOTUSBDIR, GCSettings.SaveFolder, Memory.ROMFilename);
|
|
||||||
|
|
||||||
offset = LoadBufferFromFAT (filepath, silent);
|
offset = LoadBufferFromFAT (filepath, silent);
|
||||||
}
|
}
|
||||||
else if(method == METHOD_SMB)
|
else if(method == METHOD_SMB)
|
||||||
@ -313,10 +310,8 @@ SaveSRAM (int method, bool silent)
|
|||||||
{
|
{
|
||||||
if(method == METHOD_SD || method == METHOD_USB)
|
if(method == METHOD_SD || method == METHOD_USB)
|
||||||
{
|
{
|
||||||
if(method == METHOD_SD)
|
changeFATInterface(GCSettings.SaveMethod);
|
||||||
sprintf (filepath, "%s/%s/%s.srm", ROOTSDDIR, GCSettings.SaveFolder, Memory.ROMFilename);
|
sprintf (filepath, "%s/%s/%s.srm", ROOTFATDIR, GCSettings.SaveFolder, Memory.ROMFilename);
|
||||||
else
|
|
||||||
sprintf (filepath, "%s/%s/%s.srm", ROOTUSBDIR, GCSettings.SaveFolder, Memory.ROMFilename);
|
|
||||||
offset = SaveBufferToFAT (filepath, datasize, silent);
|
offset = SaveBufferToFAT (filepath, datasize, silent);
|
||||||
}
|
}
|
||||||
else if(method == METHOD_SMB)
|
else if(method == METHOD_SMB)
|
||||||
|
Loading…
Reference in New Issue
Block a user