mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-22 10:39:18 +01:00
trash memcard code
This commit is contained in:
parent
ecb132c10c
commit
03a41bf40a
@ -42,7 +42,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref
|
||||
# any extra libraries we wish to link with
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -ldb -ldi -liso9660 -lpng -lmxml -lwiikeyboard \
|
||||
-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
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "video.h"
|
||||
#include "networkop.h"
|
||||
#include "fileop.h"
|
||||
#include "memcardop.h"
|
||||
#include "input.h"
|
||||
#include "gcunzip.h"
|
||||
#include "wiiusbsupport.h"
|
||||
@ -86,10 +85,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)
|
||||
@ -284,25 +279,6 @@ bool MakeFilePath(char filepath[], int type, char * filename, int filenum)
|
||||
else sprintf(ext, "sgm");
|
||||
|
||||
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);
|
||||
@ -311,24 +287,13 @@ bool MakeFilePath(char filepath[], int type, char * filename, int filenum)
|
||||
else
|
||||
sprintf(file, "%s %i.%s", filename, filenum, ext);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(file, "%s", filename);
|
||||
}
|
||||
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);
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "vbasupport.h"
|
||||
#include "fileop.h"
|
||||
#include "networkop.h"
|
||||
#include "memcardop.h"
|
||||
#include "gcunzip.h"
|
||||
#include "menu.h"
|
||||
#include "filebrowser.h"
|
||||
@ -391,16 +390,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;
|
||||
}
|
||||
|
||||
@ -440,12 +429,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;
|
||||
@ -716,16 +699,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)
|
||||
{
|
||||
@ -784,7 +757,6 @@ LoadFile (char * rbuffer, char *filepath, size_t length, bool silent)
|
||||
}
|
||||
fclose (file);
|
||||
}
|
||||
}
|
||||
|
||||
// go back to checking if devices were inserted/removed
|
||||
ResumeDeviceThread();
|
||||
@ -824,16 +796,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))
|
||||
@ -850,17 +812,27 @@ SaveFile (char * buffer, char *filepath, size_t datasize, bool silent)
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("datasize: %d\n", datasize);
|
||||
|
||||
while(written < datasize)
|
||||
{
|
||||
if(datasize - written > 4096) nextwrite=4096;
|
||||
else nextwrite = datasize-written;
|
||||
writesize = fwrite (buffer+written, 1, nextwrite, file);
|
||||
if(writesize != nextwrite) break; // write failure
|
||||
if(writesize != nextwrite)
|
||||
{
|
||||
printf("writesize (%d) != nextwrite (%d)!\n", writesize, nextwrite);
|
||||
break; // write failure
|
||||
}
|
||||
written += writesize;
|
||||
}
|
||||
fclose (file);
|
||||
|
||||
if(written != datasize) written = 0;
|
||||
if(written != datasize)
|
||||
{
|
||||
printf("wrote 0!\n");
|
||||
written = 0;
|
||||
}
|
||||
|
||||
if(!written)
|
||||
{
|
||||
@ -868,7 +840,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();
|
||||
|
@ -1,384 +0,0 @@
|
||||
/****************************************************************************
|
||||
* Visual Boy Advance GX
|
||||
*
|
||||
* Tantric September 2008
|
||||
*
|
||||
* memcardop.cpp
|
||||
*
|
||||
* Memory Card routines
|
||||
***************************************************************************/
|
||||
|
||||
#include <gccore.h>
|
||||
#include <ogcsys.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "vba.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 ("VBA0", "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,20 +0,0 @@
|
||||
/****************************************************************************
|
||||
* Visual Boy Advance GX
|
||||
*
|
||||
* Tantric September 2008
|
||||
*
|
||||
* 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
|
@ -26,7 +26,6 @@
|
||||
#include "filebrowser.h"
|
||||
#include "gcunzip.h"
|
||||
#include "networkop.h"
|
||||
#include "memcardop.h"
|
||||
#include "fileop.h"
|
||||
#include "vbaconfig.h"
|
||||
#include "preferences.h"
|
||||
@ -1433,22 +1432,12 @@ static int FindGameSaveNum(char * savefile, int method)
|
||||
int romlen = strlen(ROMFilename);
|
||||
int savelen = strlen(savefile);
|
||||
|
||||
if(romlen > 26 && (method == DEVICE_MC_SLOTA || method == DEVICE_MC_SLOTB))
|
||||
romlen = 26; // memory card filenames are a maximum of 32 chars
|
||||
|
||||
int diff = savelen-romlen;
|
||||
|
||||
if(strncmp(savefile, ROMFilename, romlen) != 0)
|
||||
return -1;
|
||||
|
||||
if(method == DEVICE_MC_SLOTA || method == 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
|
||||
@ -1551,19 +1540,8 @@ static int MenuGameSaves(int action)
|
||||
|
||||
memset(&saves, 0, sizeof(saves));
|
||||
|
||||
if(method == DEVICE_MC_SLOTA)
|
||||
{
|
||||
ParseMCDirectory(CARD_SLOTA);
|
||||
}
|
||||
else if(method == DEVICE_MC_SLOTB)
|
||||
{
|
||||
ParseMCDirectory(CARD_SLOTB);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(browser.dir, "%s%s", pathPrefix[GCSettings.SaveMethod], GCSettings.SaveFolder);
|
||||
ParseDirectory(true);
|
||||
}
|
||||
|
||||
len = strlen(ROMFilename);
|
||||
|
||||
@ -1594,8 +1572,6 @@ static int MenuGameSaves(int action)
|
||||
saves.files[saves.type[j]][n] = 1;
|
||||
strncpy(saves.filename[j], browserList[i].filename, MAXJOLIET);
|
||||
|
||||
if(method != DEVICE_MC_SLOTA && method != DEVICE_MC_SLOTB)
|
||||
{
|
||||
if(saves.type[j] == FILE_SNAPSHOT)
|
||||
{
|
||||
sprintf(scrfile, "%s%s/%s.png", pathPrefix[GCSettings.SaveMethod], GCSettings.SaveFolder, tmp);
|
||||
@ -1611,7 +1587,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++;
|
||||
}
|
||||
}
|
||||
@ -3121,7 +3096,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;
|
||||
options.name[4][0] = 0; // hide cheats folder (not implemented)
|
||||
|
||||
@ -3209,10 +3183,6 @@ static int MenuSettingsFile()
|
||||
if (GCSettings.AutoSave > 3)
|
||||
GCSettings.AutoSave = 0;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
GCSettings.VerifySaves ^= 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if(ret >= 0 || firstRun)
|
||||
@ -3242,19 +3212,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 methods 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");
|
||||
@ -3267,8 +3228,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);
|
||||
@ -3283,8 +3242,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 "vba.h"
|
||||
#include "vbaconfig.h"
|
||||
#include "menu.h"
|
||||
#include "memcardop.h"
|
||||
#include "fileop.h"
|
||||
#include "filebrowser.h"
|
||||
#include "input.h"
|
||||
@ -168,7 +167,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");
|
||||
|
||||
@ -468,7 +466,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
|
||||
|
||||
@ -581,9 +578,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);
|
||||
}
|
||||
|
||||
@ -598,16 +592,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 ();
|
||||
@ -668,11 +652,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++)
|
||||
@ -715,9 +697,6 @@ bool SavePalettes(bool silent)
|
||||
if(device == 0)
|
||||
return false;
|
||||
|
||||
if(device == DEVICE_MC_SLOTA || device == DEVICE_MC_SLOTB)
|
||||
sprintf(filepath, "%s%s", pathPrefix[device], PAL_FILE_NAME);
|
||||
else
|
||||
sprintf(filepath, "%s%s/%s", pathPrefix[device], APPFOLDER, PAL_FILE_NAME);
|
||||
}
|
||||
|
||||
@ -732,16 +711,6 @@ bool SavePalettes(bool silent)
|
||||
AllocSaveBuffer();
|
||||
datasize = preparePalData(palettes, loadedPalettes);
|
||||
|
||||
if (device == DEVICE_MC_SLOTA || device == DEVICE_MC_SLOTB)
|
||||
{
|
||||
// Set the comments
|
||||
char prefscomment[2][32];
|
||||
memset(prefscomment, 0, 64);
|
||||
sprintf(prefscomment[0], "%s Pal", APPNAME);
|
||||
sprintf(prefscomment[1], "Palette");
|
||||
SetMCSaveComments(prefscomment);
|
||||
}
|
||||
|
||||
offset = SaveFile(filepath, datasize, silent);
|
||||
|
||||
FreeSaveBuffer();
|
||||
@ -805,11 +774,9 @@ bool LoadPalettes()
|
||||
sprintf(filepath[1], "sd:/%s/%s", APPFOLDER, PAL_FILE_NAME);
|
||||
sprintf(filepath[2], "usb:/%s/%s", APPFOLDER, PAL_FILE_NAME);
|
||||
#else
|
||||
numDevices = 4;
|
||||
numDevices = 2;
|
||||
sprintf(filepath[0], "carda:/%s/%s", APPFOLDER, PAL_FILE_NAME);
|
||||
sprintf(filepath[1], "cardb:/%s/%s", APPFOLDER, PAL_FILE_NAME);
|
||||
sprintf(filepath[2], "mca:/%s", PAL_FILE_NAME);
|
||||
sprintf(filepath[3], "mcb:/%s", PAL_FILE_NAME);
|
||||
#endif
|
||||
|
||||
for(i=0; i<numDevices; i++)
|
||||
|
@ -25,7 +25,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,
|
||||
@ -33,8 +33,6 @@ enum {
|
||||
DEVICE_USB,
|
||||
DEVICE_DVD,
|
||||
DEVICE_SMB,
|
||||
DEVICE_MC_SLOTA,
|
||||
DEVICE_MC_SLOTB,
|
||||
DEVICE_SD_SLOTA,
|
||||
DEVICE_SD_SLOTB
|
||||
};
|
||||
@ -53,7 +51,6 @@ struct SGCSettings{
|
||||
char LoadFolder[MAXPATHLEN]; // Path to game files
|
||||
char SaveFolder[MAXPATHLEN]; // Path to save files
|
||||
char CheatFolder[MAXPATHLEN]; // Path to cheat files
|
||||
int VerifySaves;
|
||||
|
||||
char smbip[16];
|
||||
char smbuser[20];
|
||||
|
@ -78,7 +78,6 @@ DefaultSettings ()
|
||||
|
||||
GCSettings.WiimoteOrientation = 0;
|
||||
|
||||
GCSettings.VerifySaves = 0;
|
||||
GCSettings.gbaZoomHor = 1.0; // GBA horizontal zoom level
|
||||
GCSettings.gbaZoomVert = 1.0; // GBA vertical zoom level
|
||||
GCSettings.gbZoomHor = 1.0; // GBA horizontal zoom level
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "vba.h"
|
||||
#include "fileop.h"
|
||||
#include "filebrowser.h"
|
||||
#include "memcardop.h"
|
||||
#include "audio.h"
|
||||
#include "vmmem.h"
|
||||
#include "input.h"
|
||||
@ -359,7 +358,7 @@ bool SaveBatteryOrState(char * filepath, int action, bool silent)
|
||||
return 0;
|
||||
|
||||
// save screenshot - I would prefer to do this from gameScreenTex
|
||||
if(action == FILE_SNAPSHOT && gameScreenTex2 != NULL && device != DEVICE_MC_SLOTA && device != DEVICE_MC_SLOTB)
|
||||
if(action == FILE_SNAPSHOT && gameScreenTex2 != NULL)
|
||||
{
|
||||
AllocSaveBuffer ();
|
||||
|
||||
@ -385,23 +384,6 @@ bool SaveBatteryOrState(char * filepath, int action, bool silent)
|
||||
|
||||
AllocSaveBuffer();
|
||||
|
||||
// set comments for Memory Card saves
|
||||
if(device == DEVICE_MC_SLOTA || device == DEVICE_MC_SLOTB)
|
||||
{
|
||||
char savecomments[2][32];
|
||||
char savetype[10];
|
||||
memset(savecomments, 0, 64);
|
||||
|
||||
if(action == FILE_SRAM)
|
||||
sprintf(savetype, "SRAM");
|
||||
else
|
||||
sprintf(savetype, "Snapshot");
|
||||
|
||||
sprintf (savecomments[0], "%s %s", APPNAME, savetype);
|
||||
snprintf (savecomments[1], 32, ROMFilename);
|
||||
SetMCSaveComments(savecomments);
|
||||
}
|
||||
|
||||
// put VBA memory into savebuffer, sets datasize to size of memory written
|
||||
if(action == FILE_SRAM)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user