diff --git a/source/ngc/dvd.cpp b/source/ngc/dvd.cpp index 7180376..f58ba64 100644 --- a/source/ngc/dvd.cpp +++ b/source/ngc/dvd.cpp @@ -22,6 +22,8 @@ extern "C" { } #endif +#include "memmap.h" + #include "menudraw.h" #include "snes9xGX.h" #include "unzip.h" @@ -436,13 +438,14 @@ bool SwitchDVDFolder(char origdir[]) ***************************************************************************/ int -LoadDVDFile (unsigned char *buffer) +LoadDVDFile () { int offset; int blocks; int i; u64 discoffset; char readbuffer[2048]; + unsigned char *rbuffer = (unsigned char *) Memory.ROM; // How many 2k blocks to read blocks = dvddirlength / 2048; @@ -456,7 +459,7 @@ LoadDVDFile (unsigned char *buffer) for (i = 0; i < blocks; i++) { dvd_read (readbuffer, 2048, discoffset); - memcpy (buffer + offset, readbuffer, 2048); + memcpy (rbuffer + offset, readbuffer, 2048); offset += 2048; discoffset += 2048; } @@ -466,12 +469,12 @@ LoadDVDFile (unsigned char *buffer) { i = dvddirlength % 2048; dvd_read (readbuffer, 2048, discoffset); - memcpy (buffer + offset, readbuffer, i); + memcpy (rbuffer + offset, readbuffer, i); } } else { - return UnZipFile (buffer, discoffset); // unzip from dvd + return UnZipFile (rbuffer, discoffset); // unzip from dvd } return dvddirlength; } diff --git a/source/ngc/dvd.h b/source/ngc/dvd.h index 6ec2a74..ca63166 100644 --- a/source/ngc/dvd.h +++ b/source/ngc/dvd.h @@ -15,7 +15,7 @@ int getpvd (); int ParseDVDdirectory (); -int LoadDVDFile (unsigned char *buffer); +int LoadDVDFile (); bool TestDVD(); int dvd_read (void *dst, unsigned int len, u64 offset); bool SwitchDVDFolder(char dir[]); diff --git a/source/ngc/fileop.cpp b/source/ngc/fileop.cpp index 1c42c61..7c31400 100644 --- a/source/ngc/fileop.cpp +++ b/source/ngc/fileop.cpp @@ -166,16 +166,14 @@ ParseFATdirectory(int method) * LoadFATFile ***************************************************************************/ int -LoadFATFile (char *filename, int length) +LoadFATFile () { char zipbuffer[2048]; char filepath[MAXPATHLEN]; FILE *handle; - unsigned char *rbuffer; + unsigned char *rbuffer = (unsigned char *) Memory.ROM; u32 size; - rbuffer = (unsigned char *) Memory.ROM; - /* Check filename length */ if ((strlen(currentdir)+1+strlen(filelist[selection].filename)) < MAXPATHLEN) sprintf(filepath, "%s/%s",currentdir,filelist[selection].filename); @@ -198,11 +196,10 @@ LoadFATFile (char *filename, int length) { // Just load the file up fseek(handle, 0, SEEK_END); - length = ftell(handle); // get filesize + size = ftell(handle); // get filesize fseek(handle, 2048, SEEK_SET); // seek back to point where we left off memcpy (rbuffer, zipbuffer, 2048); // copy what we already read - fread (rbuffer + 2048, 1, length - 2048, handle); - size = length; + fread (rbuffer + 2048, 1, size - 2048, handle); } fclose (handle); return size; diff --git a/source/ngc/fileop.h b/source/ngc/fileop.h index a9be227..875310f 100644 --- a/source/ngc/fileop.h +++ b/source/ngc/fileop.h @@ -26,7 +26,7 @@ bool ChangeFATInterface(int method, bool silent); int ParseFATdirectory(int method); -int LoadFATFile (char *filename, int length); +int LoadFATFile (); int SaveBufferToFAT (char *filepath, int datasize, bool silent); int LoadBufferFromFAT (char *filepath, bool silent); diff --git a/source/ngc/filesel.cpp b/source/ngc/filesel.cpp index 3198151..9e0816d 100644 --- a/source/ngc/filesel.cpp +++ b/source/ngc/filesel.cpp @@ -322,20 +322,18 @@ int FileSelector (int method) { case METHOD_SD: case METHOD_USB: - ARAM_ROMSIZE = LoadFATFile (filelist[selection].filename, - filelist[selection].length); + ARAM_ROMSIZE = LoadFATFile (); break; case METHOD_DVD: dvddir = filelist[selection].offset; dvddirlength = filelist[selection].length; - ARAM_ROMSIZE = LoadDVDFile (Memory.ROM); + ARAM_ROMSIZE = LoadDVDFile (); break; case METHOD_SMB: ARAM_ROMSIZE = - LoadSMBFile (filelist[selection].filename, - filelist[selection].length); + LoadSMBFile (); break; } diff --git a/source/ngc/smbop.cpp b/source/ngc/smbop.cpp index 164fd74..db36e77 100644 --- a/source/ngc/smbop.cpp +++ b/source/ngc/smbop.cpp @@ -216,7 +216,7 @@ ParseSMBdirectory () * Load SMB file ****************************************************************************/ int -LoadSMBFile (char *filename, int length) +LoadSMBFile () { char filepath[MAXPATHLEN]; @@ -236,7 +236,7 @@ LoadSMBFile (char *filename, int length) * Write savebuffer to SMB file ****************************************************************************/ int -SaveBufferToSMB (char *filepath, int datasize, bool8 silent) +SaveBufferToSMB (char *filepath, int datasize, bool silent) { if(!ConnectShare (NOTSILENT)) return 0; @@ -282,14 +282,14 @@ SaveBufferToSMB (char *filepath, int datasize, bool8 silent) // no buffer is specified - so use savebuffer int -LoadBufferFromSMB (char *filepath, bool8 silent) +LoadBufferFromSMB (char *filepath, bool silent) { ClearSaveBuffer (); return LoadBufferFromSMB((char *)savebuffer, filepath, silent); } int -LoadBufferFromSMB (char * sbuffer, char *filepath, bool8 silent) +LoadBufferFromSMB (char * sbuffer, char *filepath, bool silent) { if(!ConnectShare (NOTSILENT)) return 0; diff --git a/source/ngc/smbop.h b/source/ngc/smbop.h index 7f66035..27a0582 100644 --- a/source/ngc/smbop.h +++ b/source/ngc/smbop.h @@ -19,9 +19,9 @@ bool ConnectShare (bool silent); char * SMBPath(char * path); int UpdateSMBdirname(); int ParseSMBdirectory (); -int LoadSMBFile (char *filename, int length); -int LoadBufferFromSMB (char *filepath, bool8 silent); -int LoadBufferFromSMB (char * sbuffer, char *filepath, bool8 silent); -int SaveBufferToSMB (char *filepath, int datasize, bool8 silent); +int LoadSMBFile (); +int LoadBufferFromSMB (char *filepath, bool silent); +int LoadBufferFromSMB (char * sbuffer, char *filepath, bool silent); +int SaveBufferToSMB (char *filepath, int datasize, bool silent); #endif