mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-27 13:04:21 +01:00
trash old memcard / aram code
This commit is contained in:
parent
e7d0b3df78
commit
ad09c5e12f
@ -42,7 +42,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -ldb -ldi -liso9660 -lpng -lmxml \
|
||||
-lfat -lwiiuse -lz -lbte -logc -lasnd -lvorbisidec -lfreetype -ltinysmb
|
||||
-lfat -lwiiuse -lz -lbte -lasnd -logc -lvorbisidec -lfreetype -ltinysmb
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
|
@ -1,83 +0,0 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||
*
|
||||
* softdev July 2006
|
||||
*
|
||||
* aram.cpp
|
||||
*
|
||||
* Gamecube Audio RAM storage
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef HW_DOL
|
||||
|
||||
#include <gccore.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "aram.h"
|
||||
|
||||
#define ARAM_READ 1
|
||||
#define ARAM_WRITE 0
|
||||
|
||||
#define TEMPSIZE 32768
|
||||
static char tempbuffer[TEMPSIZE] ATTRIBUTE_ALIGN (32);
|
||||
|
||||
/****************************************************************************
|
||||
* ARAMPut
|
||||
*
|
||||
* Move data from MAIN memory to ARAM
|
||||
***************************************************************************/
|
||||
void
|
||||
ARAMPut (char *src, char *dst, int len)
|
||||
{
|
||||
DCFlushRange (src, len);
|
||||
AR_StartDMA (ARAM_WRITE, (u32) src, (u32) dst, len);
|
||||
while (AR_GetDMAStatus());
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* ARAMFetch
|
||||
*
|
||||
* This function will move data from ARAM to MAIN memory
|
||||
***************************************************************************/
|
||||
void
|
||||
ARAMFetch (char *dst, char *src, int len)
|
||||
{
|
||||
DCInvalidateRange (dst, len);
|
||||
AR_StartDMA (ARAM_READ, (u32) dst, (u32) src, len);
|
||||
while (AR_GetDMAStatus ());
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* ARAMFetchSlow
|
||||
*
|
||||
* Required as SNES memory may NOT be 32-byte aligned
|
||||
***************************************************************************/
|
||||
void ARAMFetchSlow(char *dst, char *src, int len)
|
||||
{
|
||||
int t;
|
||||
|
||||
if (len > TEMPSIZE)
|
||||
{
|
||||
t = 0;
|
||||
while (t < len)
|
||||
{
|
||||
ARAMFetch(tempbuffer, src + t, TEMPSIZE);
|
||||
|
||||
if (t + TEMPSIZE > len)
|
||||
{
|
||||
memcpy(dst + t, tempbuffer, len - t);
|
||||
}
|
||||
else
|
||||
memcpy(dst + t, tempbuffer, TEMPSIZE);
|
||||
|
||||
t += TEMPSIZE;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ARAMFetch(tempbuffer, src, len);
|
||||
memcpy(dst, tempbuffer, len);
|
||||
}
|
||||
}
|
||||
#endif
|
@ -1,22 +0,0 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||
*
|
||||
* softdev July 2006
|
||||
*
|
||||
* aram.h
|
||||
*
|
||||
* Gamecube Audio RAM storage
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _GCARAMI_
|
||||
|
||||
#define _GCARAMI_
|
||||
|
||||
#define AR_BACKDROP 0x8000
|
||||
#define AR_SNESROM 0x200000
|
||||
|
||||
void ARAMPut (char *src, char *dst, int len);
|
||||
void ARAMFetch (char *dst, char *src, int len);
|
||||
void ARAMFetchSlow (char *dst, char *src, int len);
|
||||
|
||||
#endif
|
@ -32,10 +32,8 @@
|
||||
#include "snes9xGX.h"
|
||||
#include "menu.h"
|
||||
#include "video.h"
|
||||
#include "aram.h"
|
||||
#include "networkop.h"
|
||||
#include "fileop.h"
|
||||
#include "memcardop.h"
|
||||
#include "input.h"
|
||||
#include "gcunzip.h"
|
||||
#include "freeze.h"
|
||||
@ -93,10 +91,6 @@ int autoSaveMethod(bool silent)
|
||||
device = DEVICE_SD;
|
||||
else if(ChangeInterface(DEVICE_USB, SILENT))
|
||||
device = DEVICE_USB;
|
||||
else if(ChangeInterface(DEVICE_MC_SLOTA, SILENT))
|
||||
device = DEVICE_MC_SLOTA;
|
||||
else if(ChangeInterface(DEVICE_MC_SLOTB, SILENT))
|
||||
device = DEVICE_MC_SLOTB;
|
||||
else if(ChangeInterface(DEVICE_SMB, SILENT))
|
||||
device = DEVICE_SMB;
|
||||
else if(!silent)
|
||||
@ -291,25 +285,6 @@ bool MakeFilePath(char filepath[], int type, char * filename, int filenum)
|
||||
else sprintf(ext, "frz");
|
||||
|
||||
if(filenum >= -1)
|
||||
{
|
||||
if(GCSettings.SaveMethod == DEVICE_MC_SLOTA || GCSettings.SaveMethod == DEVICE_MC_SLOTB)
|
||||
{
|
||||
if(filenum > 9)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(filenum == -1)
|
||||
{
|
||||
filename[27] = 0; // truncate filename
|
||||
sprintf(file, "%s.%s", filename, ext);
|
||||
}
|
||||
else
|
||||
{
|
||||
filename[26] = 0; // truncate filename
|
||||
sprintf(file, "%s%i.%s", filename, filenum, ext);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(filenum == -1)
|
||||
sprintf(file, "%s.%s", filename, ext);
|
||||
@ -318,7 +293,6 @@ bool MakeFilePath(char filepath[], int type, char * filename, int filenum)
|
||||
else
|
||||
sprintf(file, "%s %i.%s", filename, filenum, ext);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(file, "%s", filename);
|
||||
@ -329,17 +303,7 @@ bool MakeFilePath(char filepath[], int type, char * filename, int filenum)
|
||||
sprintf(file, "%s.cht", Memory.ROMFilename);
|
||||
break;
|
||||
}
|
||||
switch(GCSettings.SaveMethod)
|
||||
{
|
||||
case DEVICE_MC_SLOTA:
|
||||
case DEVICE_MC_SLOTB:
|
||||
sprintf (temppath, "%s%s", pathPrefix[GCSettings.SaveMethod], file);
|
||||
temppath[31] = 0; // truncate filename
|
||||
break;
|
||||
default:
|
||||
sprintf (temppath, "%s%s/%s", pathPrefix[GCSettings.SaveMethod], folder, file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
CleanupPath(temppath); // cleanup path
|
||||
strncpy(filepath, temppath, MAXPATHLEN);
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "snes9xGX.h"
|
||||
#include "fileop.h"
|
||||
#include "networkop.h"
|
||||
#include "memcardop.h"
|
||||
#include "gcunzip.h"
|
||||
#include "menu.h"
|
||||
#include "filebrowser.h"
|
||||
@ -393,16 +392,6 @@ bool FindDevice(char * filepath, int * device)
|
||||
*device = DEVICE_SD_SLOTB;
|
||||
return true;
|
||||
}
|
||||
else if(strncmp(filepath, "mca:", 4) == 0)
|
||||
{
|
||||
*device = DEVICE_MC_SLOTA;
|
||||
return true;
|
||||
}
|
||||
else if(strncmp(filepath, "mcb:", 4) == 0)
|
||||
{
|
||||
*device = DEVICE_MC_SLOTB;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -442,12 +431,6 @@ bool ChangeInterface(int device, bool silent)
|
||||
case DEVICE_SMB:
|
||||
mounted = ConnectShare(silent);
|
||||
break;
|
||||
case DEVICE_MC_SLOTA:
|
||||
mounted = TestMC(CARD_SLOTA, silent);
|
||||
break;
|
||||
case DEVICE_MC_SLOTB:
|
||||
mounted = TestMC(CARD_SLOTB, silent);
|
||||
break;
|
||||
}
|
||||
|
||||
return mounted;
|
||||
@ -718,16 +701,6 @@ LoadFile (char * rbuffer, char *filepath, size_t length, bool silent)
|
||||
// halt parsing
|
||||
HaltParseThread();
|
||||
|
||||
if(device == DEVICE_MC_SLOTA)
|
||||
{
|
||||
size = LoadMCFile (rbuffer, CARD_SLOTA, StripDevice(filepath), silent);
|
||||
}
|
||||
else if(device == DEVICE_MC_SLOTB)
|
||||
{
|
||||
size = LoadMCFile (rbuffer, CARD_SLOTB, StripDevice(filepath), silent);
|
||||
}
|
||||
else
|
||||
{
|
||||
// open the file
|
||||
while(!size && retry)
|
||||
{
|
||||
@ -786,7 +759,6 @@ LoadFile (char * rbuffer, char *filepath, size_t length, bool silent)
|
||||
}
|
||||
fclose (file);
|
||||
}
|
||||
}
|
||||
|
||||
// go back to checking if devices were inserted/removed
|
||||
ResumeDeviceThread();
|
||||
@ -826,16 +798,6 @@ SaveFile (char * buffer, char *filepath, size_t datasize, bool silent)
|
||||
|
||||
ShowAction("Saving...");
|
||||
|
||||
if(device == DEVICE_MC_SLOTA)
|
||||
{
|
||||
written = SaveMCFile (buffer, CARD_SLOTA, StripDevice(filepath), datasize, silent);
|
||||
}
|
||||
else if(device == DEVICE_MC_SLOTB)
|
||||
{
|
||||
written = SaveMCFile (buffer, CARD_SLOTB, StripDevice(filepath), datasize, silent);
|
||||
}
|
||||
else
|
||||
{
|
||||
while(!written && retry == 1)
|
||||
{
|
||||
if(!ChangeInterface(device, silent))
|
||||
@ -870,7 +832,6 @@ SaveFile (char * buffer, char *filepath, size_t datasize, bool silent)
|
||||
retry = ErrorPromptRetry("Error saving file!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// go back to checking if devices were inserted/removed
|
||||
ResumeDeviceThread();
|
||||
|
@ -49,7 +49,7 @@ SaveSnapshot (char * filepath, bool silent)
|
||||
return 0;
|
||||
|
||||
// save screenshot - I would prefer to do this from gameScreenTex
|
||||
if(gameScreenTex2 != NULL && device != DEVICE_MC_SLOTA && device != DEVICE_MC_SLOTB)
|
||||
if(gameScreenTex2 != NULL)
|
||||
{
|
||||
AllocSaveBuffer ();
|
||||
|
||||
|
@ -1,386 +0,0 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||
*
|
||||
* softdev July 2006
|
||||
* crunchy2 May-June 2007
|
||||
* Tantric 2008-2009
|
||||
*
|
||||
* memcardop.cpp
|
||||
*
|
||||
* Memory Card routines
|
||||
***************************************************************************/
|
||||
|
||||
#include <gccore.h>
|
||||
#include <ogcsys.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "snes9xGX.h"
|
||||
#include "video.h"
|
||||
#include "menu.h"
|
||||
#include "preferences.h"
|
||||
#include "filebrowser.h"
|
||||
#include "fileop.h"
|
||||
#include "images/saveicon.h"
|
||||
|
||||
static u8 * SysArea = NULL;
|
||||
static char savecomments[2][32];
|
||||
static u8 * verifybuffer = NULL;
|
||||
|
||||
/****************************************************************************
|
||||
* MountMC
|
||||
*
|
||||
* Mounts the memory card in the given slot.
|
||||
* Returns the result of the last attempted CARD_Mount command.
|
||||
***************************************************************************/
|
||||
static int MountMC(int slot, bool silent)
|
||||
{
|
||||
int ret = -1;
|
||||
int tries = 0;
|
||||
|
||||
// Initialize Card System
|
||||
SysArea = (u8 *)memalign(32, CARD_WORKAREA);
|
||||
memset (SysArea, 0, CARD_WORKAREA);
|
||||
CARD_Init ("SNES", "00");
|
||||
|
||||
// Mount the card
|
||||
while(tries < 10 && ret != 0)
|
||||
{
|
||||
EXI_ProbeReset();
|
||||
ret = CARD_Mount (slot, SysArea, NULL);
|
||||
VIDEO_WaitVSync();
|
||||
tries++;
|
||||
}
|
||||
|
||||
if(ret != 0 && !silent)
|
||||
{
|
||||
if (slot == CARD_SLOTA)
|
||||
ErrorPrompt("Unable to mount Slot A Memory Card!");
|
||||
else
|
||||
ErrorPrompt("Unable to mount Slot B Memory Card!");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* TestMC
|
||||
*
|
||||
* Checks to see if a card is in the card slot specified
|
||||
***************************************************************************/
|
||||
bool TestMC(int slot, bool silent)
|
||||
{
|
||||
// Memory Cards do not work in Wii mode - disable
|
||||
#ifdef HW_RVL
|
||||
return false;
|
||||
#endif
|
||||
|
||||
bool ret = false;
|
||||
|
||||
// Try to mount the card
|
||||
if (MountMC(slot, silent) == 0)
|
||||
{
|
||||
// Mount successful!
|
||||
CARD_Unmount (slot);
|
||||
ret = true;
|
||||
}
|
||||
free(SysArea);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* ParseMCDirectory
|
||||
*
|
||||
* Parses a list of all files on the specified memory card
|
||||
***************************************************************************/
|
||||
int
|
||||
ParseMCDirectory (int slot)
|
||||
{
|
||||
card_dir CardDir;
|
||||
int CardError;
|
||||
int entryNum = 0;
|
||||
|
||||
HaltDeviceThread();
|
||||
|
||||
// Try to mount the card
|
||||
CardError = MountMC(slot, NOTSILENT);
|
||||
|
||||
if (CardError == 0)
|
||||
{
|
||||
CardError = CARD_FindFirst (slot, &CardDir, TRUE);
|
||||
while (CardError != CARD_ERROR_NOFILE)
|
||||
{
|
||||
if(!AddBrowserEntry())
|
||||
{
|
||||
entryNum = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
strncpy(browserList[entryNum].filename, (char *)CardDir.filename, MAXJOLIET);
|
||||
StripExt(browserList[entryNum].displayname, browserList[entryNum].filename); // hide file extension
|
||||
browserList[entryNum].length = CardDir.filelen;
|
||||
|
||||
entryNum++;
|
||||
|
||||
CardError = CARD_FindNext (&CardDir);
|
||||
}
|
||||
CARD_Unmount(slot);
|
||||
}
|
||||
|
||||
ResumeDeviceThread();
|
||||
|
||||
// Sort the file list
|
||||
qsort(browserList, entryNum, sizeof(BROWSERENTRY), FileSortCallback);
|
||||
|
||||
CancelAction();
|
||||
|
||||
browser.numEntries = entryNum;
|
||||
return entryNum;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Verify Memory Card file against buffer
|
||||
***************************************************************************/
|
||||
static int
|
||||
VerifyMCFile (char *buf, int slot, char *filename, int datasize)
|
||||
{
|
||||
card_file CardFile;
|
||||
int CardError;
|
||||
unsigned int blocks;
|
||||
unsigned int SectorSize;
|
||||
int bytesleft = 0;
|
||||
int bytesread = 0;
|
||||
|
||||
verifybuffer = (u8 *)memalign(32, 262144);
|
||||
memset (verifybuffer, 0, 262144);
|
||||
|
||||
// Get Sector Size
|
||||
CARD_GetSectorSize (slot, &SectorSize);
|
||||
|
||||
memset (&CardFile, 0, sizeof (CardFile));
|
||||
CardError = CARD_Open (slot, filename, &CardFile);
|
||||
|
||||
if(CardError)
|
||||
{
|
||||
ErrorPrompt("Unable to open file!");
|
||||
}
|
||||
else
|
||||
{
|
||||
blocks = CardFile.len;
|
||||
|
||||
if (blocks < SectorSize)
|
||||
blocks = SectorSize;
|
||||
|
||||
if (blocks % SectorSize)
|
||||
blocks += SectorSize;
|
||||
|
||||
if (blocks > (unsigned int)datasize)
|
||||
blocks = datasize;
|
||||
|
||||
bytesleft = blocks;
|
||||
bytesread = 0;
|
||||
while (bytesleft > 0)
|
||||
{
|
||||
CardError = CARD_Read (&CardFile, verifybuffer, SectorSize, bytesread);
|
||||
if (CardError || memcmp (buf + bytesread, verifybuffer, (unsigned int)bytesleft < SectorSize ? bytesleft : SectorSize) )
|
||||
{
|
||||
bytesread = 0;
|
||||
ErrorPrompt("File integrity could not be verified!");
|
||||
break;
|
||||
}
|
||||
|
||||
bytesleft -= SectorSize;
|
||||
bytesread += SectorSize;
|
||||
ShowProgress ("Verifying...", bytesread, blocks);
|
||||
}
|
||||
CARD_Close (&CardFile);
|
||||
CancelAction();
|
||||
}
|
||||
free(verifybuffer);
|
||||
return bytesread;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* LoadMCFile
|
||||
* Load savebuffer from Memory Card file
|
||||
***************************************************************************/
|
||||
int
|
||||
LoadMCFile (char *buf, int slot, char *filename, bool silent)
|
||||
{
|
||||
card_file CardFile;
|
||||
int CardError;
|
||||
unsigned int blocks;
|
||||
unsigned int SectorSize;
|
||||
int bytesleft = 0;
|
||||
int bytesread = 0;
|
||||
|
||||
// Try to mount the card
|
||||
CardError = MountMC(slot, NOTSILENT);
|
||||
|
||||
if (CardError == 0)
|
||||
{
|
||||
// Get Sector Size
|
||||
CARD_GetSectorSize (slot, &SectorSize);
|
||||
|
||||
memset (&CardFile, 0, sizeof (CardFile));
|
||||
CardError = CARD_Open (slot, filename, &CardFile);
|
||||
|
||||
if(CardError)
|
||||
{
|
||||
if(!silent)
|
||||
ErrorPrompt("Unable to open file!");
|
||||
}
|
||||
else
|
||||
{
|
||||
blocks = CardFile.len;
|
||||
|
||||
if (blocks < SectorSize)
|
||||
blocks = SectorSize;
|
||||
|
||||
if (blocks % SectorSize)
|
||||
blocks += SectorSize;
|
||||
|
||||
bytesleft = blocks;
|
||||
bytesread = 0;
|
||||
while (bytesleft > 0)
|
||||
{
|
||||
CardError = CARD_Read (&CardFile, buf + bytesread, SectorSize, bytesread);
|
||||
|
||||
if(CardError)
|
||||
{
|
||||
ErrorPrompt("Error loading file!");
|
||||
bytesread = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
bytesleft -= SectorSize;
|
||||
bytesread += SectorSize;
|
||||
ShowProgress ("Loading...", bytesread, blocks);
|
||||
}
|
||||
CARD_Close (&CardFile);
|
||||
CancelAction();
|
||||
}
|
||||
CARD_Unmount(slot);
|
||||
}
|
||||
|
||||
// discard save icon and comments
|
||||
memmove(buf, buf+sizeof(saveicon)+64, bytesread);
|
||||
bytesread -= (sizeof(saveicon)+64);
|
||||
|
||||
free(SysArea);
|
||||
return bytesread;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* SaveMCFile
|
||||
* Write savebuffer to Memory Card file
|
||||
***************************************************************************/
|
||||
int
|
||||
SaveMCFile (char *buf, int slot, char *filename, int datasize, bool silent)
|
||||
{
|
||||
card_file CardFile;
|
||||
card_stat CardStatus;
|
||||
int CardError;
|
||||
unsigned int blocks;
|
||||
unsigned int SectorSize;
|
||||
int byteswritten = 0;
|
||||
int bytesleft = 0;
|
||||
|
||||
if(datasize <= 0)
|
||||
return 0;
|
||||
|
||||
// add save icon and comments
|
||||
memmove(buf+sizeof(saveicon)+64, buf, datasize);
|
||||
memcpy(buf, saveicon, sizeof(saveicon));
|
||||
memcpy(buf+sizeof(saveicon), savecomments, 64);
|
||||
datasize += (sizeof(saveicon)+64);
|
||||
|
||||
// Try to mount the card
|
||||
CardError = MountMC(slot, NOTSILENT);
|
||||
|
||||
if (CardError == 0)
|
||||
{
|
||||
// Get Sector Size
|
||||
CARD_GetSectorSize (slot, &SectorSize);
|
||||
|
||||
// Calculate number of blocks required
|
||||
blocks = (datasize / SectorSize) * SectorSize;
|
||||
if (datasize % SectorSize)
|
||||
blocks += SectorSize;
|
||||
|
||||
// Delete existing file (if present)
|
||||
memset(&CardStatus, 0, sizeof(card_stat));
|
||||
CardError = CARD_Open (slot, filename, &CardFile);
|
||||
|
||||
if(CardError == 0)
|
||||
{
|
||||
CARD_Close (&CardFile);
|
||||
CardError = CARD_Delete(slot, filename);
|
||||
if (CardError)
|
||||
{
|
||||
ErrorPrompt("Unable to delete existing file!");
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
// Create new file
|
||||
memset(&CardStatus, 0, sizeof(card_stat));
|
||||
CardError = CARD_Create (slot, filename, blocks, &CardFile);
|
||||
if (CardError)
|
||||
{
|
||||
if (CardError == CARD_ERROR_INSSPACE)
|
||||
ErrorPrompt("Insufficient space to create file!");
|
||||
else
|
||||
ErrorPrompt("Unable to create card file!");
|
||||
goto done;
|
||||
}
|
||||
|
||||
// Now, have an open file handle, ready to send out the data
|
||||
CARD_GetStatus (slot, CardFile.filenum, &CardStatus);
|
||||
CardStatus.icon_addr = 0x0;
|
||||
CardStatus.icon_fmt = 2;
|
||||
CardStatus.icon_speed = 1;
|
||||
CardStatus.comment_addr = 2048;
|
||||
CARD_SetStatus (slot, CardFile.filenum, &CardStatus);
|
||||
|
||||
bytesleft = blocks;
|
||||
|
||||
while (bytesleft > 0)
|
||||
{
|
||||
CardError =
|
||||
CARD_Write (&CardFile, buf + byteswritten, SectorSize, byteswritten);
|
||||
|
||||
if(CardError)
|
||||
{
|
||||
ErrorPrompt("Error writing file!");
|
||||
byteswritten = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
bytesleft -= SectorSize;
|
||||
byteswritten += SectorSize;
|
||||
|
||||
ShowProgress ("Saving...", byteswritten, blocks);
|
||||
}
|
||||
CARD_Close (&CardFile);
|
||||
CancelAction();
|
||||
|
||||
if (byteswritten > 0 && GCSettings.VerifySaves)
|
||||
{
|
||||
// Verify the written file
|
||||
if (!VerifyMCFile (buf, slot, filename, byteswritten) )
|
||||
byteswritten = 0;
|
||||
}
|
||||
done:
|
||||
CARD_Unmount (slot);
|
||||
}
|
||||
|
||||
free(SysArea);
|
||||
return byteswritten;
|
||||
}
|
||||
|
||||
void SetMCSaveComments(char comments[2][32])
|
||||
{
|
||||
memcpy(savecomments, comments, 64);
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||
*
|
||||
* softdev July 2006
|
||||
* crunchy2 May-June 2007
|
||||
* Tantric 2008-2009
|
||||
*
|
||||
* memcardop.cpp
|
||||
*
|
||||
* Memory Card routines
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _MEMCARDOP_
|
||||
#define _MEMCARDOP_
|
||||
|
||||
int ParseMCDirectory (int slot);
|
||||
int LoadMCFile (char *buf, int slot, char *filename, bool silent);
|
||||
int SaveMCFile (char *buf, int slot, char *filename, int datasize, bool silent);
|
||||
bool TestMC(int slot, bool silent);
|
||||
void SetMCSaveComments(char comments[2][32]);
|
||||
|
||||
#endif
|
@ -29,7 +29,6 @@
|
||||
#include "filebrowser.h"
|
||||
#include "gcunzip.h"
|
||||
#include "networkop.h"
|
||||
#include "memcardop.h"
|
||||
#include "fileop.h"
|
||||
#include "s9xconfig.h"
|
||||
#include "sram.h"
|
||||
@ -1479,22 +1478,12 @@ static int FindGameSaveNum(char * savefile, int device)
|
||||
int romlen = strlen(Memory.ROMFilename);
|
||||
int savelen = strlen(savefile);
|
||||
|
||||
if(romlen > 26 && (device == DEVICE_MC_SLOTA || device == DEVICE_MC_SLOTB))
|
||||
romlen = 26; // memory card filenames are a maximum of 32 chars
|
||||
|
||||
int diff = savelen-romlen;
|
||||
|
||||
if(strncmp(savefile, Memory.ROMFilename, romlen) != 0)
|
||||
return -1;
|
||||
|
||||
if(device == DEVICE_MC_SLOTA || device == DEVICE_MC_SLOTB)
|
||||
{
|
||||
if(diff == 2)
|
||||
n = atoi(&savefile[savelen-2]);
|
||||
else if(diff == 1)
|
||||
n = atoi(&savefile[savelen-1]);
|
||||
}
|
||||
else if(savefile[romlen] == ' ')
|
||||
if(savefile[romlen] == ' ')
|
||||
{
|
||||
if(diff == 5 && strncmp(&savefile[romlen+1], "Auto", 4) == 0)
|
||||
n = 0; // found Auto save
|
||||
@ -1597,19 +1586,8 @@ static int MenuGameSaves(int action)
|
||||
|
||||
memset(&saves, 0, sizeof(saves));
|
||||
|
||||
if(device == DEVICE_MC_SLOTA)
|
||||
{
|
||||
ParseMCDirectory(CARD_SLOTA);
|
||||
}
|
||||
else if(device == DEVICE_MC_SLOTB)
|
||||
{
|
||||
ParseMCDirectory(CARD_SLOTB);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(browser.dir, "%s%s", pathPrefix[GCSettings.SaveMethod], GCSettings.SaveFolder);
|
||||
ParseDirectory(true);
|
||||
}
|
||||
|
||||
len = strlen(Memory.ROMFilename);
|
||||
|
||||
@ -1640,8 +1618,6 @@ static int MenuGameSaves(int action)
|
||||
saves.files[saves.type[j]][n] = 1;
|
||||
strncpy(saves.filename[j], browserList[i].filename, MAXJOLIET);
|
||||
|
||||
if(device != DEVICE_MC_SLOTA && device != DEVICE_MC_SLOTB)
|
||||
{
|
||||
if(saves.type[j] == FILE_SNAPSHOT)
|
||||
{
|
||||
sprintf(scrfile, "%s%s/%s.png", pathPrefix[GCSettings.SaveMethod], GCSettings.SaveFolder, tmp);
|
||||
@ -1657,7 +1633,6 @@ static int MenuGameSaves(int action)
|
||||
strftime(saves.date[j], 20, "%a %b %d", timeinfo);
|
||||
strftime(saves.time[j], 10, "%I:%M %p", timeinfo);
|
||||
}
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
@ -3317,7 +3292,6 @@ static int MenuSettingsFile()
|
||||
sprintf(options.name[i++], "Cheats Folder");
|
||||
sprintf(options.name[i++], "Auto Load");
|
||||
sprintf(options.name[i++], "Auto Save");
|
||||
sprintf(options.name[i++], "Verify MC Saves");
|
||||
options.length = i;
|
||||
|
||||
for(i=0; i < options.length; i++)
|
||||
@ -3404,10 +3378,6 @@ static int MenuSettingsFile()
|
||||
if (GCSettings.AutoSave > 3)
|
||||
GCSettings.AutoSave = 0;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
GCSettings.VerifySaves ^= 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if(ret >= 0 || firstRun)
|
||||
@ -3437,19 +3407,10 @@ static int MenuSettingsFile()
|
||||
GCSettings.SaveMethod++;
|
||||
#endif
|
||||
|
||||
// disable MC saving in Wii mode - does not work for some reason!
|
||||
#ifdef HW_RVL
|
||||
if(GCSettings.SaveMethod == DEVICE_MC_SLOTA)
|
||||
GCSettings.SaveMethod++;
|
||||
if(GCSettings.SaveMethod == DEVICE_MC_SLOTB)
|
||||
GCSettings.SaveMethod++;
|
||||
options.name[7][0] = 0;
|
||||
#endif
|
||||
|
||||
// correct load/save devices out of bounds
|
||||
if(GCSettings.LoadMethod > 4)
|
||||
GCSettings.LoadMethod = 0;
|
||||
if(GCSettings.SaveMethod > 6)
|
||||
if(GCSettings.SaveMethod > 5)
|
||||
GCSettings.SaveMethod = 0;
|
||||
|
||||
if (GCSettings.LoadMethod == DEVICE_AUTO) sprintf (options.value[0],"Auto Detect");
|
||||
@ -3462,8 +3423,6 @@ static int MenuSettingsFile()
|
||||
else if (GCSettings.SaveMethod == DEVICE_SD) sprintf (options.value[1],"SD");
|
||||
else if (GCSettings.SaveMethod == DEVICE_USB) sprintf (options.value[1],"USB");
|
||||
else if (GCSettings.SaveMethod == DEVICE_SMB) sprintf (options.value[1],"Network");
|
||||
else if (GCSettings.SaveMethod == DEVICE_MC_SLOTA) sprintf (options.value[1],"MC Slot A");
|
||||
else if (GCSettings.SaveMethod == DEVICE_MC_SLOTB) sprintf (options.value[1],"MC Slot B");
|
||||
|
||||
snprintf (options.value[2], 30, "%s", GCSettings.LoadFolder);
|
||||
snprintf (options.value[3], 30, "%s", GCSettings.SaveFolder);
|
||||
@ -3478,8 +3437,6 @@ static int MenuSettingsFile()
|
||||
else if (GCSettings.AutoSave == 2) sprintf (options.value[6],"Snapshot");
|
||||
else if (GCSettings.AutoSave == 3) sprintf (options.value[6],"Both");
|
||||
|
||||
sprintf (options.value[7], "%s", GCSettings.VerifySaves == true ? "On" : "Off");
|
||||
|
||||
optionBrowser.TriggerUpdate();
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "snes9xGX.h"
|
||||
#include "s9xconfig.h"
|
||||
#include "menu.h"
|
||||
#include "memcardop.h"
|
||||
#include "fileop.h"
|
||||
#include "filebrowser.h"
|
||||
#include "input.h"
|
||||
@ -124,7 +123,6 @@ preparePrefsData ()
|
||||
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");
|
||||
|
||||
@ -297,7 +295,6 @@ decodePrefsData ()
|
||||
loadXMLSetting(GCSettings.LoadFolder, "LoadFolder", sizeof(GCSettings.LoadFolder));
|
||||
loadXMLSetting(GCSettings.SaveFolder, "SaveFolder", sizeof(GCSettings.SaveFolder));
|
||||
loadXMLSetting(GCSettings.CheatFolder, "CheatFolder", sizeof(GCSettings.CheatFolder));
|
||||
loadXMLSetting(&GCSettings.VerifySaves, "VerifySaves");
|
||||
|
||||
// Network Settings
|
||||
|
||||
@ -375,9 +372,6 @@ SavePrefs (bool silent)
|
||||
if(device == 0)
|
||||
return false;
|
||||
|
||||
if(device == DEVICE_MC_SLOTA || device == DEVICE_MC_SLOTB)
|
||||
sprintf(filepath, "%s%s", pathPrefix[device], PREF_FILE_NAME);
|
||||
else
|
||||
sprintf(filepath, "%s%s/%s", pathPrefix[device], APPFOLDER, PREF_FILE_NAME);
|
||||
}
|
||||
|
||||
@ -392,16 +386,6 @@ SavePrefs (bool silent)
|
||||
AllocSaveBuffer ();
|
||||
datasize = preparePrefsData ();
|
||||
|
||||
if(device == DEVICE_MC_SLOTA || device == DEVICE_MC_SLOTB)
|
||||
{
|
||||
// Set the comments
|
||||
char prefscomment[2][32];
|
||||
memset(prefscomment, 0, 64);
|
||||
sprintf (prefscomment[0], "%s Prefs", APPNAME);
|
||||
sprintf (prefscomment[1], "Preferences");
|
||||
SetMCSaveComments(prefscomment);
|
||||
}
|
||||
|
||||
offset = SaveFile(filepath, datasize, silent);
|
||||
|
||||
FreeSaveBuffer ();
|
||||
@ -464,11 +448,9 @@ bool LoadPrefs()
|
||||
sprintf(filepath[1], "sd:/%s/%s", APPFOLDER, PREF_FILE_NAME);
|
||||
sprintf(filepath[2], "usb:/%s/%s", APPFOLDER, PREF_FILE_NAME);
|
||||
#else
|
||||
numDevices = 4;
|
||||
numDevices = 2;
|
||||
sprintf(filepath[0], "carda:/%s/%s", APPFOLDER, PREF_FILE_NAME);
|
||||
sprintf(filepath[1], "cardb:/%s/%s", APPFOLDER, PREF_FILE_NAME);
|
||||
sprintf(filepath[2], "mca:/%s", PREF_FILE_NAME);
|
||||
sprintf(filepath[3], "mcb:/%s", PREF_FILE_NAME);
|
||||
#endif
|
||||
|
||||
for(int i=0; i<numDevices; i++)
|
||||
|
@ -68,8 +68,6 @@ DefaultSettings ()
|
||||
GCSettings.AutoLoad = 1;
|
||||
GCSettings.AutoSave = 1;
|
||||
|
||||
GCSettings.VerifySaves = 0;
|
||||
|
||||
// custom SMB settings
|
||||
strncpy (GCSettings.smbip, "", 15); // IP Address of share server
|
||||
strncpy (GCSettings.smbuser, "", 19); // Your share user
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "controls.h"
|
||||
|
||||
#include "snes9xGX.h"
|
||||
#include "aram.h"
|
||||
#include "networkop.h"
|
||||
#include "video.h"
|
||||
#include "s9xconfig.h"
|
||||
@ -349,58 +348,26 @@ main(int argc, char *argv[])
|
||||
DI_Init(); // first
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_WII
|
||||
//DEBUG_Init(GDBSTUB_DEVICE_USB, 1); // init debugging
|
||||
//_break();
|
||||
#endif
|
||||
|
||||
InitDeviceThread();
|
||||
InitGCVideo(); // Initialise video
|
||||
ResetVideo_Menu (); // change to menu video mode
|
||||
SetupPads();
|
||||
|
||||
#ifdef HW_RVL
|
||||
// Wii Power/Reset buttons
|
||||
WPAD_SetPowerButtonCallback((WPADShutdownCallback)ShutdownCB);
|
||||
SYS_SetPowerCallback(ShutdownCB);
|
||||
SYS_SetResetCallback(ResetCB);
|
||||
#endif
|
||||
|
||||
// GameCube only - Injected ROM
|
||||
// Before going any further, let's copy any injected ROM image
|
||||
// We'll put it in ARAM for safe storage
|
||||
|
||||
#ifdef HW_DOL
|
||||
AR_Init (NULL, 0);
|
||||
|
||||
int *romptr = (int *) 0x81000000; // location of injected rom
|
||||
|
||||
if (memcmp ((char *) romptr, "SNESROM0", 8) == 0)
|
||||
{
|
||||
SNESROMSize = romptr[2];
|
||||
|
||||
if(SNESROMSize > (1024*128) && SNESROMSize < (1024*1024*8))
|
||||
{
|
||||
romptr = (int *) 0x81000020;
|
||||
ARAMPut ((char *) romptr, (char *) AR_SNESROM, SNESROMSize);
|
||||
}
|
||||
else // not a valid ROM size
|
||||
{
|
||||
SNESROMSize = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Initialize DVD subsystem (GameCube only)
|
||||
#ifdef HW_DOL
|
||||
DVD_Init ();
|
||||
#endif
|
||||
|
||||
#ifdef HW_RVL
|
||||
// Wii Power/Reset buttons
|
||||
WPAD_SetPowerButtonCallback((WPADShutdownCallback)ShutdownCB);
|
||||
SYS_SetPowerCallback(ShutdownCB);
|
||||
SYS_SetResetCallback(ResetCB);
|
||||
|
||||
// store path app was loaded from
|
||||
#ifdef HW_RVL
|
||||
if(argc > 0 && argv[0] != NULL)
|
||||
CreateAppPath(argv[0]);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Initialize libFAT for SD and USB
|
||||
MountAllFAT();
|
||||
@ -438,18 +405,5 @@ main(int argc, char *argv[])
|
||||
|
||||
InitGUIThreads();
|
||||
|
||||
// GameCube only - Injected ROM
|
||||
// Everything's been initialized, we can copy our ROM back
|
||||
// from ARAM into main memory
|
||||
|
||||
#ifdef HW_DOL
|
||||
if(SNESROMSize > 0)
|
||||
{
|
||||
ARAMFetchSlow( (char *)Memory.ROM, (char *)AR_SNESROM, SNESROMSize);
|
||||
Memory.LoadROM ("BLANK.SMC");
|
||||
Memory.LoadSRAM ("BLANK");
|
||||
}
|
||||
#endif
|
||||
|
||||
emulate(); // main loop
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
#define SILENT 1
|
||||
|
||||
const char pathPrefix[9][8] =
|
||||
{ "", "sd:/", "usb:/", "dvd:/", "smb:/", "mca:/", "mcb:/", "carda:/", "cardb:/" };
|
||||
{ "", "sd:/", "usb:/", "dvd:/", "smb:/", "carda:/", "cardb:/" };
|
||||
|
||||
enum {
|
||||
DEVICE_AUTO,
|
||||
@ -36,8 +36,6 @@ enum {
|
||||
DEVICE_USB,
|
||||
DEVICE_DVD,
|
||||
DEVICE_SMB,
|
||||
DEVICE_MC_SLOTA,
|
||||
DEVICE_MC_SLOTB,
|
||||
DEVICE_SD_SLOTA,
|
||||
DEVICE_SD_SLOTB
|
||||
};
|
||||
@ -79,7 +77,6 @@ struct SGCSettings{
|
||||
|
||||
float zoomHor; // horizontal zoom amount
|
||||
float zoomVert; // vertical zoom amount
|
||||
int VerifySaves;
|
||||
int videomode; // 0 - automatic, 1 - NTSC (480i), 2 - Progressive (480p), 3 - PAL (50Hz), 4 - PAL (60Hz)
|
||||
int render; // 0 - original, 1 - filtered, 2 - unfiltered
|
||||
int FilterMethod; // convert to RenderFilter
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "srtc.h"
|
||||
|
||||
#include "snes9xGX.h"
|
||||
#include "memcardop.h"
|
||||
#include "menu.h"
|
||||
#include "fileop.h"
|
||||
#include "filebrowser.h"
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
|
||||
#include "aram.h"
|
||||
#include "snes9xGX.h"
|
||||
#include "menu.h"
|
||||
#include "filter.h"
|
||||
|
Loading…
Reference in New Issue
Block a user