mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
Win 98 VFS Fixes (by BirdFlu)
- add ini option to disable UNICODE in VFS (and use the current codepage) - when UNICODE disabled in VFS, open files with default encoding (instead of UTF8/16) filenames git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3118 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
#include "../Interface/vfs_directory_interface.h"
|
||||
#include "../iteratedir.h"
|
||||
|
||||
extern bool g_VFS_NO_UNICODE;
|
||||
|
||||
vfs::Path vfs::CVFSFile::GetFullPath()
|
||||
{
|
||||
if(_pLoc_)
|
||||
@@ -65,7 +67,10 @@ bool vfs::CVFSFile::OpenRead()
|
||||
// try to open
|
||||
Mode = std::ios::in|std::ios::binary;
|
||||
#ifdef WIN32
|
||||
m_oFile.open(sFileName().c_wcs().c_str(),Mode);
|
||||
utf8string::str_t const& fname = sFileName().c_wcs();
|
||||
g_VFS_NO_UNICODE ?
|
||||
m_oFile.open(utf8string::narrow(fname.c_str(),fname.length()).c_str(),Mode) :
|
||||
m_oFile.open(fname.c_str(),Mode);
|
||||
#else
|
||||
m_oFile.open(sFileName().utf8().c_str(),Mode);
|
||||
#endif
|
||||
@@ -106,7 +111,10 @@ bool vfs::CVFSFile::OpenWrite(bool bCreateWhenNotExist, bool bTruncate)
|
||||
Mode |= std::ios::trunc;
|
||||
}
|
||||
#ifdef WIN32
|
||||
m_oFile.open(sFileName().c_wcs().c_str(),Mode);
|
||||
utf8string::str_t const& fname = sFileName().c_wcs();
|
||||
g_VFS_NO_UNICODE ?
|
||||
m_oFile.open(utf8string::narrow(fname.c_str(),fname.length()).c_str(),Mode) :
|
||||
m_oFile.open(fname.c_str(),Mode);
|
||||
#else
|
||||
m_oFile.open(sFileName().utf8().c_str(),Mode);
|
||||
#endif
|
||||
@@ -122,7 +130,9 @@ bool vfs::CVFSFile::OpenWrite(bool bCreateWhenNotExist, bool bTruncate)
|
||||
Mode |= std::ios::trunc;
|
||||
}
|
||||
#ifdef WIN32
|
||||
m_oFile.open(sFileName().c_wcs().c_str(),Mode);
|
||||
g_VFS_NO_UNICODE ?
|
||||
m_oFile.open(utf8string::narrow(fname.c_str(),fname.length()).c_str(),Mode) :
|
||||
m_oFile.open(fname.c_str(),Mode);
|
||||
#else
|
||||
m_oFile.open(sFileName().utf8().c_str(),Mode);
|
||||
#endif
|
||||
@@ -133,7 +143,9 @@ bool vfs::CVFSFile::OpenWrite(bool bCreateWhenNotExist, bool bTruncate)
|
||||
m_oFile.close();
|
||||
Mode |= std::ios::in;
|
||||
#ifdef WIN32
|
||||
m_oFile.open(sFileName().c_wcs().c_str(),Mode);
|
||||
g_VFS_NO_UNICODE ?
|
||||
m_oFile.open(utf8string::narrow(fname.c_str(),fname.length()).c_str(),Mode) :
|
||||
m_oFile.open(fname.c_str(),Mode);
|
||||
#else
|
||||
m_oFile.open(sFileName().utf8().c_str(),Mode);
|
||||
#endif
|
||||
@@ -185,7 +197,10 @@ bool vfs::CVFSTextFile::OpenRead()
|
||||
std::ios::openmode Mode;
|
||||
Mode = std::ios::in;
|
||||
#ifdef WIN32
|
||||
m_oFile.open(sFileName().c_wcs().c_str(),Mode);
|
||||
utf8string::str_t const& fname = sFileName().c_wcs();
|
||||
g_VFS_NO_UNICODE ?
|
||||
m_oFile.open(utf8string::narrow(fname.c_str(),fname.length()).c_str(),Mode) :
|
||||
m_oFile.open(fname.c_str(),Mode);
|
||||
#else
|
||||
m_oFile.open(sFileName().utf8().c_str(),Mode);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user