mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-01-22 22:06:58 +00:00
Fix some unicode bugs (open file dialog)
This commit is contained in:
parent
09baf1f4f6
commit
b6ce0b3d3b
@ -36,8 +36,8 @@ namespace W32Util
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
// function WinBrowseForFileName
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
bool BrowseForFileName (bool _bLoad, HWND _hParent, const char *_pTitle,
|
||||
const char *_pInitialFolder,const char *_pFilter,const char *_pExtension,
|
||||
bool BrowseForFileName (bool _bLoad, HWND _hParent, const wchar_t *_pTitle,
|
||||
const wchar_t *_pInitialFolder,const wchar_t *_pFilter,const wchar_t *_pExtension,
|
||||
std::string& _strFileName)
|
||||
{
|
||||
wchar_t szFile [MAX_PATH+1] = {0};
|
||||
@ -48,18 +48,18 @@ namespace W32Util
|
||||
ZeroMemory (&ofn,sizeof (ofn));
|
||||
|
||||
ofn.lStructSize = sizeof (OPENFILENAME);
|
||||
ofn.lpstrInitialDir = ConvertUTF8ToWString(_pInitialFolder).c_str();
|
||||
ofn.lpstrFilter = ConvertUTF8ToWString(_pFilter).c_str();
|
||||
ofn.lpstrInitialDir = _pInitialFolder;
|
||||
ofn.lpstrFilter = _pFilter;
|
||||
ofn.nMaxFile = sizeof (szFile);
|
||||
ofn.lpstrFile = szFile;
|
||||
ofn.lpstrFileTitle = szFileTitle;
|
||||
ofn.nMaxFileTitle = sizeof (szFileTitle);
|
||||
ofn.lpstrDefExt = ConvertUTF8ToWString(_pExtension).c_str();
|
||||
ofn.lpstrDefExt = _pExtension;
|
||||
ofn.hwndOwner = _hParent;
|
||||
ofn.Flags = OFN_NOCHANGEDIR | OFN_EXPLORER | OFN_HIDEREADONLY;
|
||||
|
||||
if (_strFileName.size () != 0)
|
||||
ofn.lpstrFile = (wchar_t *)_strFileName.c_str();
|
||||
wcscpy(ofn.lpstrFile, ConvertUTF8ToWString(_strFileName).c_str());
|
||||
|
||||
if (((_bLoad) ? GetOpenFileName(&ofn) : GetSaveFileName (&ofn)))
|
||||
{
|
||||
@ -70,8 +70,8 @@ namespace W32Util
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::string> BrowseForFileNameMultiSelect(bool _bLoad, HWND _hParent, const char *_pTitle,
|
||||
const char *_pInitialFolder,const char *_pFilter,const char *_pExtension)
|
||||
std::vector<std::string> BrowseForFileNameMultiSelect(bool _bLoad, HWND _hParent, const wchar_t *_pTitle,
|
||||
const wchar_t *_pInitialFolder,const wchar_t *_pFilter,const wchar_t *_pExtension)
|
||||
{
|
||||
wchar_t szFile [MAX_PATH+1+2048*2] = {0};
|
||||
wchar_t szFileTitle [MAX_PATH+1] = {0};
|
||||
@ -81,13 +81,13 @@ namespace W32Util
|
||||
ZeroMemory (&ofn,sizeof (ofn));
|
||||
|
||||
ofn.lStructSize = sizeof (OPENFILENAME);
|
||||
ofn.lpstrInitialDir = ConvertUTF8ToWString(_pInitialFolder).c_str();
|
||||
ofn.lpstrFilter = ConvertUTF8ToWString(_pFilter).c_str();
|
||||
ofn.lpstrInitialDir = _pInitialFolder;
|
||||
ofn.lpstrFilter = _pFilter;
|
||||
ofn.nMaxFile = sizeof (szFile);
|
||||
ofn.lpstrFile = szFile;
|
||||
ofn.lpstrFileTitle = szFileTitle;
|
||||
ofn.nMaxFileTitle = sizeof (szFileTitle);
|
||||
ofn.lpstrDefExt = ConvertUTF8ToWString(_pExtension).c_str();
|
||||
ofn.lpstrDefExt = _pExtension;
|
||||
ofn.hwndOwner = _hParent;
|
||||
ofn.Flags = OFN_NOCHANGEDIR | OFN_EXPLORER | OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT ;
|
||||
|
||||
@ -116,10 +116,5 @@ namespace W32Util
|
||||
}
|
||||
else
|
||||
return std::vector<std::string>(); // empty vector;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -7,9 +7,9 @@
|
||||
namespace W32Util
|
||||
{
|
||||
std::string BrowseForFolder(HWND parent, char *title);
|
||||
bool BrowseForFileName (bool _bLoad, HWND _hParent, const char *_pTitle,
|
||||
const char *_pInitialFolder,const char *_pFilter,const char *_pExtension,
|
||||
bool BrowseForFileName (bool _bLoad, HWND _hParent, const wchar_t*_pTitle,
|
||||
const wchar_t *_pInitialFolder,const wchar_t *_pFilter,const wchar_t*_pExtension,
|
||||
std::string& _strFileName);
|
||||
std::vector<std::string> BrowseForFileNameMultiSelect(bool _bLoad, HWND _hParent, const char *_pTitle,
|
||||
const char *_pInitialFolder,const char *_pFilter,const char *_pExtension);
|
||||
std::vector<std::string> BrowseForFileNameMultiSelect(bool _bLoad, HWND _hParent, const wchar_t*_pTitle,
|
||||
const wchar_t*_pInitialFolder,const wchar_t*_pFilter,const wchar_t*_pExtension);
|
||||
}
|
@ -414,7 +414,7 @@ namespace MainWindow
|
||||
NativeMessageReceived("boot", dir.c_str());
|
||||
}
|
||||
}
|
||||
else if (W32Util::BrowseForFileName(true, GetHWND(), "Load File", defaultPath.size() ? defaultPath.c_str() : 0, filter.c_str(),"*.pbp;*.elf;*.iso;*.cso;",fn))
|
||||
else if (W32Util::BrowseForFileName(true, GetHWND(), L"Load File", defaultPath.size() ? ConvertUTF8ToWString(defaultPath).c_str() : 0, ConvertUTF8ToWString(filter).c_str(), L"*.pbp;*.elf;*.iso;*.cso;",fn))
|
||||
{
|
||||
if (globalUIState == UISTATE_INGAME || globalUIState == UISTATE_PAUSEMENU) {
|
||||
Core_EnableStepping(false);
|
||||
@ -736,14 +736,14 @@ namespace MainWindow
|
||||
break;
|
||||
|
||||
case ID_FILE_LOADSTATEFILE:
|
||||
if (W32Util::BrowseForFileName(true, hWnd, "Load state",0,"Save States (*.ppst)\0*.ppst\0All files\0*.*\0\0","ppst",fn)) {
|
||||
if (W32Util::BrowseForFileName(true, hWnd, L"Load state",0,L"Save States (*.ppst)\0*.ppst\0All files\0*.*\0\0",L"ppst",fn)) {
|
||||
SetCursor(LoadCursor(0, IDC_WAIT));
|
||||
SaveState::Load(fn, SaveStateActionFinished);
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_FILE_SAVESTATEFILE:
|
||||
if (W32Util::BrowseForFileName(false, hWnd, "Save state",0,"Save States (*.ppst)\0*.ppst\0All files\0*.*\0\0","ppst",fn)) {
|
||||
if (W32Util::BrowseForFileName(false, hWnd, L"Save state",0,L"Save States (*.ppst)\0*.ppst\0All files\0*.*\0\0",L"ppst",fn)) {
|
||||
SetCursor(LoadCursor(0, IDC_WAIT));
|
||||
SaveState::Save(fn, SaveStateActionFinished);
|
||||
}
|
||||
@ -951,7 +951,7 @@ namespace MainWindow
|
||||
break;
|
||||
|
||||
case ID_DEBUG_LOADMAPFILE:
|
||||
if (W32Util::BrowseForFileName(true, hWnd, "Load .MAP",0,"Maps\0*.map\0All files\0*.*\0\0","map",fn)) {
|
||||
if (W32Util::BrowseForFileName(true, hWnd, L"Load .MAP",0,L"Maps\0*.map\0All files\0*.*\0\0",L"map",fn)) {
|
||||
symbolMap.LoadSymbolMap(fn.c_str());
|
||||
|
||||
if (disasmWindow[0])
|
||||
@ -963,7 +963,7 @@ namespace MainWindow
|
||||
break;
|
||||
|
||||
case ID_DEBUG_SAVEMAPFILE:
|
||||
if (W32Util::BrowseForFileName(false, hWnd, "Save .MAP",0,"Maps\0*.map\0All files\0*.*\0\0","map",fn))
|
||||
if (W32Util::BrowseForFileName(false, hWnd, L"Save .MAP",0,L"Maps\0*.map\0All files\0*.*\0\0",L"map",fn))
|
||||
symbolMap.SaveSymbolMap(fn.c_str());
|
||||
break;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user