]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
use uae_tfopen instead of _tfopen (FS-UAE uses a custom fopen function)
authorFrode Solheim <frode@fs-uae.net>
Sat, 5 Sep 2015 08:40:27 +0000 (10:40 +0200)
committerFrode Solheim <frode@fs-uae.net>
Sat, 5 Sep 2015 08:40:27 +0000 (10:40 +0200)
debug.cpp
epsonprinter.cpp
fsdb.cpp
include/uae/io.h [new file with mode: 0644]
moduleripper.cpp
zfile.cpp

index 82e20e3e2582a3ea4d1d6dd13a297e59464f9dc7..dc73b731b9d340a9b0026a38be0de4c71f9be807 100644 (file)
--- a/debug.cpp
+++ b/debug.cpp
@@ -41,6 +41,7 @@
 #include "ar.h"
 #include "pci.h"
 #include "ppc/ppcd.h"
+#include "uae/io.h"
 #include "uae/ppc.h"
 
 int debugger_active;
@@ -3735,7 +3736,7 @@ static void savemem (TCHAR **cc)
        if (!more_params (cc))
                goto S_argh;
        len2 = len = readhex (cc);
-       fp = _tfopen (name, _T("wb"));
+       fp = uae_tfopen (name, _T("wb"));
        if (fp == NULL) {
                console_out_f (_T("Couldn't open file '%s'\n"), name);
                return;
index a5adcbff9154abba24c32d07bf92aeac241fdffc..84dd2cc225ffe4147c89d5a81b1e466dcac6dd0c 100644 (file)
@@ -33,6 +33,7 @@
 #include "win32.h"
 #include "parser.h"
 #include "threaddep/thread.h"
+#include "uae/io.h"
 
 #include <math.h>
 
@@ -680,7 +681,7 @@ static void getfname (TCHAR *fname)
        for (;;) {
                FILE *fp;
                _stprintf (fname, _T("%sPRINT_%03d.png"), tmp, number);
-               if ((fp = _tfopen (fname, _T("rb"))) == NULL)
+               if ((fp = uae_tfopen(fname, _T("rb"))) == NULL)
                        return;
                number++;
                fclose (fp);
@@ -797,7 +798,7 @@ static void *prt_thread (void *p)
 
                getfname (fname);
                /* Open the actual file */
-               fp=_tfopen(fname,_T("wb"));
+               fp = uae_tfopen(fname, _T("wb"));
                if (!fp) 
                {
                        write_log(_T("EPSONPRINTER: Can't open file %s for printer output\n"), fname);
index 45bb3627d24d86842ef387fe358e2feeed8ba4c8..4bfaa51c9c9c92b39672740fe9151dc2b7e18872 100644 (file)
--- a/fsdb.cpp
+++ b/fsdb.cpp
@@ -20,6 +20,7 @@
 #include "fsusage.h"
 #include "scsidev.h"
 #include "fsdb.h"
+#include "uae/io.h"
 
 /* The on-disk format is as follows:
 * Offset 0, 1 byte, valid
@@ -81,7 +82,7 @@ static FILE *get_fsdb (a_inode *dir, const TCHAR *mode)
        if (!dir->nname)
                return NULL;
        n = build_nname (dir->nname, FSDB_FILE);
-       f = _tfopen (n, mode);
+       f = uae_tfopen (n, mode);
        xfree (n);
        return f;
 }
@@ -127,7 +128,7 @@ void fsdb_clean_dir (a_inode *dir)
        if (!dir->nname)
                return;
        n = build_nname (dir->nname, FSDB_FILE);
-       f = _tfopen (n, _T("r+b"));
+       f = uae_tfopen (n, _T("r+b"));
        if (f == 0) {
                xfree (n);
                return;
diff --git a/include/uae/io.h b/include/uae/io.h
new file mode 100644 (file)
index 0000000..34be183
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef UAE_IO_H
+#define UAE_IO_H
+
+#include "uae/types.h"
+#include <stdio.h>
+
+#ifdef WINUAE
+#define uae_tfopen _tfopen
+#else
+FILE *uae_tfopen(const TCHAR *path, const TCHAR *mode);
+#endif
+
+#endif /* UAE_IO_H */
index 50014d99b345506e9a84268842a9f505f52fc184..5323858b3404f8e60fb1b9a1d5c88dff23fb6e30 100644 (file)
@@ -12,7 +12,9 @@
 #ifdef PROWIZARD
 
 #include "options.h"
+#include "uae/io.h"
 #include "memory.h"
+#include "uae/seh.h"
 #include "moduleripper.h"
 #include "gui.h"
 #include "uae.h"
@@ -139,7 +141,7 @@ FILE *moduleripper_fopen (const char *aname, const char *amode)
        moduleripper_filename(aname, outname, true);
 
        mode = au (amode);
-       f = _tfopen (outname, mode);
+       f = uae_tfopen (outname, mode);
        xfree (mode);
        return f;
 }
@@ -170,7 +172,6 @@ FILE *moduleripper2_fopen (const char *name, const char *mode, const char *aid,
 void pw_write_log (const char *format,...)
 {
 }
-
 }
 
 #else
index e530bfbcb1d6fc33d457afa63c79c9c6ed06b8bd..bf6c5fac6317302c642ef31760bc248133b10c70 100644 (file)
--- a/zfile.cpp
+++ b/zfile.cpp
@@ -23,6 +23,7 @@
 #include "zarchive.h"
 #include "diskutil.h"
 #include "fdi2raw.h"
+#include "uae/io.h"
 
 #include "archivers/zip/unzip.h"
 #include "archivers/dms/pfile.h"
@@ -1619,7 +1620,7 @@ static struct zfile *zfile_fopen_nozip (const TCHAR *name, const TCHAR *mode)
        l = zfile_create (NULL, name);
        l->name = my_strdup (name);
        l->mode = my_strdup (mode);
-       f = _tfopen (name, mode);
+       f = uae_tfopen (name, mode);
        if (!f) {
                zfile_fclose (l);
                return 0;
@@ -1699,7 +1700,7 @@ static struct zfile *zfile_fopen_2 (const TCHAR *name, const TCHAR *mode, int ma
                        f = my_opentext (l->name);
                        l->textmode = 1;
                } else {
-                       f = _tfopen (l->name, mode);
+                       f = uae_tfopen (l->name, mode);
                }
                if (!f) {
                        zfile_fclose (l);
@@ -1992,7 +1993,7 @@ struct zfile *zfile_dup (struct zfile *zf)
                }
                if (!zf->name || !zf->mode)
                        return NULL;
-               FILE *ff = _tfopen (zf->name, zf->mode);
+               FILE *ff = uae_tfopen (zf->name, zf->mode);
                if (!ff)
                        return NULL;
                nzf = zfile_create (zf, NULL);