use uae_tfopen instead of _tfopen (FS-UAE uses a custom fopen function)

This commit is contained in:
Frode Solheim 2015-09-05 10:40:27 +02:00
parent e5ed7cec7a
commit 3573df534f
6 changed files with 28 additions and 10 deletions

View File

@ -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;

View 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);

View File

@ -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;

13
include/uae/io.h Normal file
View File

@ -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 */

View 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

View File

@ -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);