From ad09c5e12f21128627e4cac7fc8379e1f10b94a8 Mon Sep 17 00:00:00 2001 From: dborth Date: Sun, 29 Nov 2009 08:12:40 +0000 Subject: [PATCH] trash old memcard / aram code --- Makefile.wii | 2 +- source/ngc/aram.cpp | 83 -------- source/ngc/aram.h | 22 --- source/ngc/filebrowser.cpp | 48 +---- source/ngc/fileop.cpp | 169 +++++++--------- source/ngc/freeze.cpp | 2 +- source/ngc/memcardop.cpp | 386 ------------------------------------- source/ngc/memcardop.h | 22 --- source/ngc/menu.cpp | 75 ++----- source/ngc/preferences.cpp | 22 +-- source/ngc/s9xconfig.cpp | 2 - source/ngc/snes9xGX.cpp | 60 +----- source/ngc/snes9xGX.h | 5 +- source/ngc/sram.cpp | 1 - source/ngc/video.cpp | 1 - 15 files changed, 99 insertions(+), 801 deletions(-) delete mode 100644 source/ngc/aram.cpp delete mode 100644 source/ngc/aram.h delete mode 100644 source/ngc/memcardop.cpp delete mode 100644 source/ngc/memcardop.h diff --git a/Makefile.wii b/Makefile.wii index 90cdd95..bab2927 100644 --- a/Makefile.wii +++ b/Makefile.wii @@ -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 diff --git a/source/ngc/aram.cpp b/source/ngc/aram.cpp deleted file mode 100644 index 8f49c7f..0000000 --- a/source/ngc/aram.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** - * Snes9x 1.51 Nintendo Wii/Gamecube Port - * - * softdev July 2006 - * - * aram.cpp - * - * Gamecube Audio RAM storage - ***************************************************************************/ - -#ifdef HW_DOL - -#include -#include - -#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 diff --git a/source/ngc/aram.h b/source/ngc/aram.h deleted file mode 100644 index cb18fac..0000000 --- a/source/ngc/aram.h +++ /dev/null @@ -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 diff --git a/source/ngc/filebrowser.cpp b/source/ngc/filebrowser.cpp index 6c90c0a..7cbd3e2 100644 --- a/source/ngc/filebrowser.cpp +++ b/source/ngc/filebrowser.cpp @@ -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) @@ -292,32 +286,12 @@ bool MakeFilePath(char filepath[], int type, char * filename, int filenum) 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); - } - } + if(filenum == -1) + sprintf(file, "%s.%s", filename, ext); + else if(filenum == 0) + sprintf(file, "%s Auto.%s", filename, ext); else - { - if(filenum == -1) - sprintf(file, "%s.%s", filename, ext); - else if(filenum == 0) - sprintf(file, "%s Auto.%s", filename, ext); - else - sprintf(file, "%s %i.%s", filename, filenum, ext); - } + sprintf(file, "%s %i.%s", filename, filenum, ext); } else { @@ -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; - } + sprintf (temppath, "%s%s/%s", pathPrefix[GCSettings.SaveMethod], folder, file); } CleanupPath(temppath); // cleanup path strncpy(filepath, temppath, MAXPATHLEN); diff --git a/source/ngc/fileop.cpp b/source/ngc/fileop.cpp index 2cc71d3..34e5473 100644 --- a/source/ngc/fileop.cpp +++ b/source/ngc/fileop.cpp @@ -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,74 +701,63 @@ LoadFile (char * rbuffer, char *filepath, size_t length, bool silent) // halt parsing HaltParseThread(); - if(device == DEVICE_MC_SLOTA) + // open the file + while(!size && retry) { - 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) + if(!ChangeInterface(device, silent)) + break; + + file = fopen (filepath, "rb"); + + if(!file) { - if(!ChangeInterface(device, silent)) + if(silent) break; - file = fopen (filepath, "rb"); + retry = ErrorPromptRetry("Error opening file!"); + continue; + } - if(!file) + if(length > 0 && length <= 2048) // do a partial read (eg: to check file header) + { + size = fread (rbuffer, 1, length, file); + } + else // load whole file + { + readsize = fread (zipbuffer, 1, 32, file); + + if(!readsize) { - if(silent) - break; - - retry = ErrorPromptRetry("Error opening file!"); + unmountRequired[device] = true; + retry = ErrorPromptRetry("Error reading file!"); continue; } - if(length > 0 && length <= 2048) // do a partial read (eg: to check file header) + if (IsZipFile (zipbuffer)) { - size = fread (rbuffer, 1, length, file); + size = UnZipBuffer ((unsigned char *)rbuffer); // unzip } - else // load whole file + else { - readsize = fread (zipbuffer, 1, 32, file); + fseeko(file,0,SEEK_END); + size = ftello(file); + fseeko(file,0,SEEK_SET); - if(!readsize) + while(!feof(file)) { - unmountRequired[device] = true; - retry = ErrorPromptRetry("Error reading file!"); - continue; - } - - if (IsZipFile (zipbuffer)) - { - size = UnZipBuffer ((unsigned char *)rbuffer); // unzip - } - else - { - fseeko(file,0,SEEK_END); - size = ftello(file); - fseeko(file,0,SEEK_SET); - - while(!feof(file)) - { - ShowProgress ("Loading...", offset, size); - readsize = fread (rbuffer + offset, 1, 4096, file); // read in next chunk - - if(readsize <= 0) - break; // reading finished (or failed) - - offset += readsize; - } - size = offset; - CancelAction(); + ShowProgress ("Loading...", offset, size); + readsize = fread (rbuffer + offset, 1, 4096, file); // read in next chunk + + if(readsize <= 0) + break; // reading finished (or failed) + + offset += readsize; } + size = offset; + CancelAction(); } - fclose (file); } + fclose (file); } // go back to checking if devices were inserted/removed @@ -826,49 +798,38 @@ SaveFile (char * buffer, char *filepath, size_t datasize, bool silent) ShowAction("Saving..."); - if(device == DEVICE_MC_SLOTA) + while(!written && retry == 1) { - 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)) + break; + + file = fopen (filepath, "wb"); + + if(!file) { - if(!ChangeInterface(device, silent)) + if(silent) break; - file = fopen (filepath, "wb"); + retry = ErrorPromptRetry("Error creating file!"); + continue; + } - if(!file) - { - if(silent) - break; + 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 + written += writesize; + } + fclose (file); - retry = ErrorPromptRetry("Error creating file!"); - continue; - } + if(written != datasize) written = 0; - 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 - written += writesize; - } - fclose (file); - - if(written != datasize) written = 0; - - if(!written) - { - unmountRequired[device] = true; - retry = ErrorPromptRetry("Error saving file!"); - } + if(!written) + { + unmountRequired[device] = true; + retry = ErrorPromptRetry("Error saving file!"); } } diff --git a/source/ngc/freeze.cpp b/source/ngc/freeze.cpp index 62463d8..3cb0900 100644 --- a/source/ngc/freeze.cpp +++ b/source/ngc/freeze.cpp @@ -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 (); diff --git a/source/ngc/memcardop.cpp b/source/ngc/memcardop.cpp deleted file mode 100644 index 73c2b93..0000000 --- a/source/ngc/memcardop.cpp +++ /dev/null @@ -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 -#include -#include -#include -#include -#include - -#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); -} diff --git a/source/ngc/memcardop.h b/source/ngc/memcardop.h deleted file mode 100644 index 1b36f28..0000000 --- a/source/ngc/memcardop.h +++ /dev/null @@ -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 diff --git a/source/ngc/menu.cpp b/source/ngc/menu.cpp index 5483646..82b854b 100644 --- a/source/ngc/menu.cpp +++ b/source/ngc/menu.cpp @@ -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); - } + sprintf(browser.dir, "%s%s", pathPrefix[GCSettings.SaveMethod], GCSettings.SaveFolder); + ParseDirectory(true); len = strlen(Memory.ROMFilename); @@ -1640,23 +1618,20 @@ 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) { - if(saves.type[j] == FILE_SNAPSHOT) - { - sprintf(scrfile, "%s%s/%s.png", pathPrefix[GCSettings.SaveMethod], GCSettings.SaveFolder, tmp); + sprintf(scrfile, "%s%s/%s.png", pathPrefix[GCSettings.SaveMethod], GCSettings.SaveFolder, tmp); - memset(savebuffer, 0, SAVEBUFFERSIZE); - if(LoadFile(scrfile, SILENT)) - saves.previewImg[j] = new GuiImageData(savebuffer); - } - snprintf(filepath, 1024, "%s%s/%s", pathPrefix[GCSettings.SaveMethod], GCSettings.SaveFolder, saves.filename[j]); - if (stat(filepath, &filestat) == 0) - { - timeinfo = localtime(&filestat.st_mtime); - strftime(saves.date[j], 20, "%a %b %d", timeinfo); - strftime(saves.time[j], 10, "%I:%M %p", timeinfo); - } + memset(savebuffer, 0, SAVEBUFFERSIZE); + if(LoadFile(scrfile, SILENT)) + saves.previewImg[j] = new GuiImageData(savebuffer); + } + snprintf(filepath, 1024, "%s%s/%s", pathPrefix[GCSettings.SaveMethod], GCSettings.SaveFolder, saves.filename[j]); + if (stat(filepath, &filestat) == 0) + { + timeinfo = localtime(&filestat.st_mtime); + 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(); } diff --git a/source/ngc/preferences.cpp b/source/ngc/preferences.cpp index 73dc72c..c034a37 100644 --- a/source/ngc/preferences.cpp +++ b/source/ngc/preferences.cpp @@ -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,10 +372,7 @@ 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); + sprintf(filepath, "%s%s/%s", pathPrefix[device], APPFOLDER, PREF_FILE_NAME); } if(device == 0) @@ -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 (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 } diff --git a/source/ngc/snes9xGX.h b/source/ngc/snes9xGX.h index 543352f..7d08a55 100644 --- a/source/ngc/snes9xGX.h +++ b/source/ngc/snes9xGX.h @@ -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 diff --git a/source/ngc/sram.cpp b/source/ngc/sram.cpp index 4375ad0..134add8 100644 --- a/source/ngc/sram.cpp +++ b/source/ngc/sram.cpp @@ -20,7 +20,6 @@ #include "srtc.h" #include "snes9xGX.h" -#include "memcardop.h" #include "menu.h" #include "fileop.h" #include "filebrowser.h" diff --git a/source/ngc/video.cpp b/source/ngc/video.cpp index f7dda5a..7f8a3a0 100644 --- a/source/ngc/video.cpp +++ b/source/ngc/video.cpp @@ -22,7 +22,6 @@ #include "snes9x.h" #include "memmap.h" -#include "aram.h" #include "snes9xGX.h" #include "menu.h" #include "filter.h"