Win32: Switch to a UNICODE build. This took quite a bit of fixing.

This commit is contained in:
Henrik Rydgard
2013-08-26 19:00:16 +02:00
parent fdaff2af98
commit 55aa3d13c7
63 changed files with 572 additions and 517 deletions

View File

@@ -21,6 +21,7 @@
#include "ISOFileSystem.h"
#include "Core/HLE/sceKernel.h"
#include "file/zip_read.h"
#include "util/text/utf8.h"
#ifdef _WIN32
#include "Common/CommonWindows.h"
@@ -184,7 +185,7 @@ bool DirectoryFileHandle::Open(std::string& basePath, std::string& fileName, Fil
openmode = OPEN_EXISTING;
}
//Let's do it!
hFile = CreateFile(fullName.c_str(), desired, sharemode, 0, openmode, 0, 0);
hFile = CreateFile(ConvertUTF8ToWString(fullName).c_str(), desired, sharemode, 0, openmode, 0, 0);
bool success = hFile != INVALID_HANDLE_VALUE;
#else
// Convert flags in access parameter to fopen access mode
@@ -392,7 +393,7 @@ int DirectoryFileSystem::RenameFile(const std::string &from, const std::string &
const char * fullToC = fullTo.c_str();
#ifdef _WIN32
bool retValue = (MoveFile(fullFrom.c_str(), fullToC) == TRUE);
bool retValue = (MoveFile(ConvertUTF8ToWString(fullFrom).c_str(), ConvertUTF8ToWString(fullToC).c_str()) == TRUE);
#else
bool retValue = (0 == rename(fullFrom.c_str(), fullToC));
#endif
@@ -586,7 +587,7 @@ std::vector<PSPFileInfo> DirectoryFileSystem::GetDirListing(std::string path) {
std::string w32path = GetLocalPath(path) + "\\*.*";
hFind = FindFirstFile(w32path.c_str(), &findData);
hFind = FindFirstFile(ConvertUTF8ToWString(w32path).c_str(), &findData);
if (hFind == INVALID_HANDLE_VALUE) {
return myVector; //the empty list
@@ -603,11 +604,11 @@ std::vector<PSPFileInfo> DirectoryFileSystem::GetDirListing(std::string path) {
entry.access = entry.type == FILETYPE_NORMAL ? 0666 : 0777;
// TODO: is this just for .. or all subdirectories? Need to add a directory to the test
// to find out. Also why so different than the old test results?
if (!strcmp(findData.cFileName, "..") )
if (!wcscmp(findData.cFileName, L"..") )
entry.size = 4096;
else
entry.size = findData.nFileSizeLow | ((u64)findData.nFileSizeHigh<<32);
entry.name = findData.cFileName;
entry.name = ConvertWStringToUTF8(findData.cFileName);
tmFromFiletime(entry.atime, findData.ftLastAccessTime);
tmFromFiletime(entry.ctime, findData.ftCreationTime);
tmFromFiletime(entry.mtime, findData.ftLastWriteTime);