From 6cffaa98ee53789479002bf89808eac8420a7e2b Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Sun, 13 Jul 2008 05:03:17 +0000 Subject: [PATCH] sdl now builds, but archives are currently broken. --- src/file.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/file.cpp b/src/file.cpp index 2bab4746..5f05e82a 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -250,7 +250,7 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext //try to setup the ips file if(ipsfn && read) ipsfile=FCEUD_UTF8fopen(ipsfn,"rb"); - + #ifdef WIN32 if(read) { ArchiveScanRecord asr = FCEUD_ScanArchive(fileToOpen); @@ -281,6 +281,22 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext return fceufp; } } + #else + std::fstream* fp = FCEUD_UTF8_fstream(fileToOpen,mode); + if(!fp) + { + return 0; + } + fceufp = new FCEUFILE(); + fceufp->filename = fileToOpen; + fceufp->archiveIndex = -1; + fceufp->stream = (std::iostream*)fp; + FCEU_fseek(fceufp,0,SEEK_END); + fceufp->size = FCEU_ftell(fceufp); + FCEU_fseek(fceufp,0,SEEK_SET); + return fceufp; + #endif + return 0; }