mirror of https://github.com/snes9xgit/snes9x.git
win32: fix snapshot load (Unicode)
This commit is contained in:
parent
9bc3bdf5aa
commit
842a1e40a8
|
@ -203,4 +203,65 @@ extern "C" int _twremove(const char *filename ) {
|
|||
return _wremove(Utf8ToWide(filename));
|
||||
}
|
||||
|
||||
extern "C" int _twopen(const char *filename, int oflag, int pmode) {
|
||||
return _wopen(Utf8ToWide(filename), oflag, pmode);
|
||||
}
|
||||
|
||||
extern "C" int _twaccess(const char *_Filename, int _AccessMode) {
|
||||
return _waccess(Utf8ToWide(_Filename), _AccessMode);
|
||||
}
|
||||
|
||||
extern "C" int _twrename(const char *_OldFilename, const char *_NewFilename) {
|
||||
return _wrename(Utf8ToWide(_OldFilename), Utf8ToWide(_NewFilename));
|
||||
}
|
||||
|
||||
extern "C" int _twunlink(const char *_Filename) {
|
||||
return _wunlink(Utf8ToWide(_Filename));
|
||||
}
|
||||
|
||||
extern "C" int _twchdir(const char *_Path) {
|
||||
return _wchdir(Utf8ToWide(_Path));
|
||||
}
|
||||
|
||||
extern "C" int _twmkdir(const char *_Path) {
|
||||
return _wmkdir(Utf8ToWide(_Path));
|
||||
}
|
||||
|
||||
extern "C" int _twrmdir(const char *_Path) {
|
||||
return _wrmdir(Utf8ToWide(_Path));
|
||||
}
|
||||
|
||||
extern "C" void _twsplitpath(const char *_FullPath, char *_Drive, char *_Dir, char *_Filename, char *_Ext) {
|
||||
wchar_t _wDrive[_MAX_PATH];
|
||||
wchar_t _wDir[_MAX_PATH];
|
||||
wchar_t _wFilename[_MAX_PATH];
|
||||
wchar_t _wExt[_MAX_PATH];
|
||||
_wsplitpath(Utf8ToWide(_FullPath), _wDrive, _wDir, _wFilename, _wExt);
|
||||
strcpy(_Drive, WideToUtf8(_wDrive));
|
||||
strcpy(_Dir, WideToUtf8(_wDir));
|
||||
strcpy(_Filename, WideToUtf8(_wFilename));
|
||||
strcpy(_Ext, WideToUtf8(_wExt));
|
||||
}
|
||||
|
||||
extern "C" void _twmakepath(char *_Path, const char *_Drive, const char *_Dir, const char *_Filename, const char *_Ext) {
|
||||
wchar_t wResultPath[_MAX_PATH];
|
||||
wcscpy(wResultPath, L"");
|
||||
_wmakepath(wResultPath, Utf8ToWide(_Drive), Utf8ToWide(_Dir), Utf8ToWide(_Filename), Utf8ToWide(_Ext));
|
||||
strcpy(_Path, WideToUtf8(wResultPath));
|
||||
}
|
||||
|
||||
extern "C" char *_twcsrchr(const char *_Str, int _Ch) {
|
||||
wchar_t *wStr = Utf8ToWide(_Str);
|
||||
wchar_t *wResult = wcsrchr(wStr, (wchar_t) _Ch);
|
||||
if (wResult != NULL)
|
||||
{
|
||||
wResult[0] = L'\0';
|
||||
return (char*) &_Str[strlen(WideToUtf8(wResult))];
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // UNICODE
|
||||
|
|
|
@ -181,6 +181,9 @@
|
|||
#define _TFWOPEN_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <io.h>
|
||||
#include <string.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -188,6 +191,16 @@ extern "C" {
|
|||
|
||||
FILE *_tfwopen(const char *filename, const char *mode );
|
||||
int _twremove(const char *filename );
|
||||
int _twopen(const char *filename, int oflag, int pmode);
|
||||
int _twaccess(const char *_Filename, int _AccessMode);
|
||||
int _twrename(const char *_OldFilename, const char *_NewFilename);
|
||||
int _twunlink(const char *_Filename);
|
||||
int _twchdir(const char *_Path);
|
||||
int _twmkdir(const char *_Path);
|
||||
int _twrmdir(const char *_Path);
|
||||
void _twsplitpath(const char *_FullPath, char *_Drive, char *_Dir, char *_Filename, char *_Ext);
|
||||
void _twmakepath(char *_Path, const char *_Drive, const char *_Dir, const char *_Filename, const char *_Ext);
|
||||
char *_twcsrchr(const char *_Str, int _Ch);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -256,7 +269,24 @@ public:
|
|||
#endif // __cplusplus
|
||||
|
||||
#define fopen _tfwopen
|
||||
#define remove _twremove
|
||||
#undef remove
|
||||
__inline int remove(const char *filename) {
|
||||
return _twremove(filename);
|
||||
}
|
||||
#undef open
|
||||
__inline int open(const char *filename, int oflag, int pmode) {
|
||||
return _twopen(filename, oflag, pmode);
|
||||
}
|
||||
#define _access _twaccess
|
||||
#define _rename _twrename
|
||||
#define _unlink _twunlink
|
||||
#define _chdir _twchdir
|
||||
#define _mkdir _twmkdir
|
||||
#define _rmdir _twrmdir
|
||||
#define _splitpath _twsplitpath
|
||||
#define _makepath _twmakepath
|
||||
//#define strrchr _twcsrchr
|
||||
|
||||
#endif // _TFWOPEN_H
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="Snes9X"
|
||||
ProjectGUID="{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}"
|
||||
RootNamespace="Snes9X"
|
||||
|
@ -482,7 +482,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libpngdmt.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibdmtu.lib msxml2.lib"
|
||||
AdditionalDependencies="libpngdmtu.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibdmtu.lib msxml2.lib"
|
||||
OutputFile=".\snes9x-debug.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
|
@ -583,7 +583,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libpngdmtx64.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibdmtux64.lib msxml2.lib"
|
||||
AdditionalDependencies="libpngdmtux64.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibdmtux64.lib msxml2.lib"
|
||||
OutputFile=".\snes9x-debug-x64.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
|
@ -690,7 +690,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libpngmt.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibmtu.lib msxml2.lib"
|
||||
AdditionalDependencies="libpngmtu.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibmtu.lib msxml2.lib"
|
||||
OutputFile=".\snes9x.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
|
@ -795,7 +795,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libpngmtx64.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibmtux64.lib msxml2.lib"
|
||||
AdditionalDependencies="libpngmtux64.lib comctl32.lib winmm.lib opengl32.lib glu32.lib wsock32.lib ddraw.lib dsound.lib dxguid.lib delayimp.lib vfw32.lib zlibmtux64.lib msxml2.lib"
|
||||
OutputFile=".\snes9x-x64.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
|
|
|
@ -3506,6 +3506,7 @@ void FreezeUnfreeze (int slot, bool8 freeze)
|
|||
#endif
|
||||
|
||||
_splitpath (Memory.ROMFilename, drive, dir, fname, ext);
|
||||
strcpy(filename, "");
|
||||
static char *digits = "t123456789";
|
||||
for(int oldDir = 0; oldDir <= 1; oldDir++)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue