win32: lua-engine.cpp should use CRT fopen rather than the one replaced by _tfwopen.h

Still, lua-engine.cpp might want to use ANSIToWide function.
Therefore, I redefined those functions in lua-engine.cpp
It looks ugly. I wish I could know a better solution.
This commit is contained in:
gocha 2012-07-27 10:23:47 +09:00
parent 4de0dd491c
commit e5d08c9a03
2 changed files with 70 additions and 2 deletions

View File

@ -16,6 +16,21 @@
#include "win32/wsnes9x.h"
#define g_hWnd GUI.hWnd
#ifdef UNICODE
#define fopen fopenA
#define open openA
#define _access _accessA
#define rename renameA
#define _unlink _unlinkA
#define _chdir _chdirA
#define _mkdir _mkdirA
#define _rmdir _rmdirA
#define _splitpath _splitpathA
#define _makepath _makepathA
//#define strrchr strrchrA
#endif
#endif
// the emulator must provide these so that we can implement

View File

@ -176,13 +176,15 @@
#ifdef UNICODE
#ifndef _TFWOPEN_H
#define _TFWOPEN_H
#ifdef UNICODE
#include <stdio.h>
#include <io.h>
#include <string.h>
#include <direct.h>
#include <tchar.h>
#ifdef __cplusplus
@ -295,6 +297,43 @@ public:
#define ifstream u8nifstream
#endif // __cplusplus
static __forceinline FILE *fopenA(const char *filename, const char *mode) {
return fopen(filename, mode);
}
static __forceinline int removeA(const char *filename) {
return remove(filename);
}
static __forceinline int openA(const char *filename, int oflag, int pmode) {
return open(filename, oflag, pmode);
}
static __forceinline int _accessA(const char *path, int mode) {
return _access(path, mode);
}
static __forceinline int renameA(const char *oldname, const char *newname) {
return rename(oldname, newname);
}
static __forceinline int _unlinkA(const char *filename) {
return _unlink(filename);
}
static __forceinline int _chdirA(const char *dirname) {
return _chdir(dirname);
}
static __forceinline int _mkdirA(const char *dirname) {
return _mkdir(dirname);
}
static __forceinline int _rmdirA(const char *dirname) {
return _rmdir(dirname);
}
static __forceinline void _splitpathA(const char *path, char *drive, char *dir, char *fname, char *ext) {
_splitpath(path, drive, dir, fname, ext);
}
static __forceinline void _makepathA(char *path, const char *drive, const char *dir, const char *fname, const char *ext) {
_makepath(path, drive, dir, fname, ext);
}
//static __forceinline char *strrchrA(const char *str, int c) {
// return strrchr(str, c);
//}
#define fopen _tfwopen
#undef remove
static __forceinline int remove(const char *filename) {
@ -314,6 +353,20 @@ static __forceinline int open(const char *filename, int oflag, int pmode) {
#define _makepath _twmakepath
//#define strrchr _twcsrchr
#endif // _TFWOPEN_H
#else
#define fopenA fopen
#define openA open
#define _accessA _access
#define renameA rename
#define _unlinkA _unlink
#define _chdirA _chdir
#define _mkdirA _mkdir
#define _rmdirA _rmdir
#define _splitpathA _splitpath
#define _makepathA _makepath
//#define strrchrA strrchr
#endif
#endif // _TFWOPEN_H