mirror of https://github.com/PCSX2/pcsx2.git
GS: initial switch to unicode
This commit is contained in:
parent
7512c01ca6
commit
5917029788
|
@ -942,7 +942,8 @@ public:
|
|||
|
||||
AllocConsole();
|
||||
|
||||
SetConsoleTitle(m_title.c_str());
|
||||
std::wstring tmp = std::wstring(m_title.begin(), m_title.end());
|
||||
SetConsoleTitle(tmp.c_str());
|
||||
|
||||
m_console = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "stdafx.h"
|
||||
#include "GSUtil.h"
|
||||
#include <locale>
|
||||
#include <codecvt>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "Renderers/DX11/GSDevice11.h"
|
||||
|
@ -267,7 +269,7 @@ bool GSUtil::CheckDXGI()
|
|||
{
|
||||
if (0 == s_DXGI)
|
||||
{
|
||||
HMODULE hmod = LoadLibrary("dxgi.dll");
|
||||
HMODULE hmod = LoadLibrary(L"dxgi.dll");
|
||||
s_DXGI = hmod ? 1 : -1;
|
||||
if (hmod)
|
||||
FreeLibrary(hmod);
|
||||
|
@ -283,7 +285,7 @@ bool GSUtil::CheckD3D11()
|
|||
|
||||
if (0 == s_D3D11)
|
||||
{
|
||||
HMODULE hmod = LoadLibrary("d3d11.dll");
|
||||
HMODULE hmod = LoadLibrary(L"d3d11.dll");
|
||||
s_D3D11 = hmod ? 1 : -1;
|
||||
if (hmod)
|
||||
FreeLibrary(hmod);
|
||||
|
@ -328,7 +330,7 @@ GSRendererType GSUtil::GetBestRenderer()
|
|||
|
||||
#endif
|
||||
|
||||
void GSmkdir(const char* dir)
|
||||
void GSmkdir(const wchar_t* dir)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (!CreateDirectory(dir, nullptr)) {
|
||||
|
@ -347,9 +349,13 @@ void GSmkdir(const char* dir)
|
|||
std::string GStempdir()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
char path[MAX_PATH + 1];
|
||||
wchar_t path[MAX_PATH + 1];
|
||||
GetTempPath(MAX_PATH, path);
|
||||
return {path};
|
||||
std::wstring tmp(path);
|
||||
using convert_type = std::codecvt_utf8<wchar_t>;
|
||||
std::wstring_convert<convert_type, wchar_t> converter;
|
||||
|
||||
return converter.to_bytes(tmp);
|
||||
#else
|
||||
return "/tmp";
|
||||
#endif
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
#endif
|
||||
};
|
||||
|
||||
void GSmkdir(const char* dir);
|
||||
void GSmkdir(const wchar_t* dir);
|
||||
std::string GStempdir();
|
||||
|
||||
const char* psm_str(int psm);
|
||||
|
|
|
@ -43,10 +43,10 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
bool GSdxApp::LoadResource(int id, std::vector<char>& buff, const char* type)
|
||||
bool GSdxApp::LoadResource(int id, std::vector<char>& buff, const wchar_t* type)
|
||||
{
|
||||
buff.clear();
|
||||
HRSRC hRsrc = FindResource((HMODULE)s_hModule, MAKEINTRESOURCE(id), type != NULL ? type : RT_RCDATA);
|
||||
HRSRC hRsrc = FindResource((HMODULE)s_hModule, MAKEINTRESOURCE(id), type != NULL ? type : (LPWSTR)RT_RCDATA);
|
||||
if(!hRsrc) return false;
|
||||
HGLOBAL hGlobal = ::LoadResource((HMODULE)s_hModule, hRsrc);
|
||||
if(!hGlobal) return false;
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
bool WriteIniString(const char* lpAppName, const char* lpKeyName, const char* pString, const char* lpFileName);
|
||||
int GetIniInt(const char* lpAppName, const char* lpKeyName, int nDefault, const char* lpFileName);
|
||||
|
||||
bool LoadResource(int id, std::vector<char>& buff, const char* type = nullptr);
|
||||
bool LoadResource(int id, std::vector<char>& buff, const wchar_t* type = nullptr);
|
||||
|
||||
void SetConfig(const char* entry, const char* value);
|
||||
void SetConfig(const char* entry, int value);
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization Condition="$(Configuration.Contains(Release))">true</WholeProgramOptimization>
|
||||
<UseDebugLibraries Condition="$(Configuration.Contains(Debug))">true</UseDebugLibraries>
|
||||
<UseDebugLibraries Condition="!$(Configuration.Contains(Debug))">false</UseDebugLibraries>
|
||||
|
|
|
@ -497,7 +497,8 @@ void GSDevice11::BeforeDraw()
|
|||
if (tex->Equal(m_state.rt_texture) || tex->Equal(m_state.rt_ds))
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
OutputDebugString(format("WARNING: FB read detected on slot %i, copying...", i).c_str());
|
||||
std::wstring tmp(L"WARNING: FB read detected on slot " + std::to_wstring(i) + L", copying...");
|
||||
OutputDebugString(tmp.c_str());
|
||||
#endif
|
||||
GSTexture* cp = nullptr;
|
||||
|
||||
|
@ -518,7 +519,8 @@ void GSDevice11::AfterDraw()
|
|||
while (_BitScanForward(&i, m_state.ps_sr_bitfield))
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
OutputDebugString(format("WARNING: Cleaning up copied texture on slot %i", i).c_str());
|
||||
std::wstring tmp(L"WARNING: Cleaning up copied texture on slot " + std::to_wstring(i));
|
||||
OutputDebugString(tmp.c_str());
|
||||
#endif
|
||||
Recycle(m_state.ps_sr_texture[i]);
|
||||
PSSetShaderResource(i, NULL);
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "stdafx.h"
|
||||
#include "GSdx.h"
|
||||
#include "GSCaptureDlg.h"
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
|
||||
#define BeginEnumSysDev(clsid, pMoniker) \
|
||||
{CComPtr<ICreateDevEnum> pDevEnum4$##clsid; \
|
||||
|
@ -37,9 +39,9 @@
|
|||
|
||||
void GSCaptureDlg::InvalidFile()
|
||||
{
|
||||
char tmp[512];
|
||||
sprintf_s(tmp, "GSdx couldn't open file for capturing: %s.\nCapture aborted.", m_filename.c_str());
|
||||
MessageBox(GetActiveWindow(), tmp, "GSdx System Message", MB_OK | MB_SETFOREGROUND);
|
||||
wchar_t tmp[512];
|
||||
swprintf_s(tmp, L"GSdx couldn't open file for capturing: %s.\nCapture aborted.", m_filename.c_str());
|
||||
MessageBox(GetActiveWindow(), tmp, L"GSdx System Message", MB_OK | MB_SETFOREGROUND);
|
||||
}
|
||||
|
||||
GSCaptureDlg::GSCaptureDlg()
|
||||
|
@ -103,7 +105,8 @@ void GSCaptureDlg::OnInit()
|
|||
|
||||
SetTextAsInt(IDC_WIDTH, m_width);
|
||||
SetTextAsInt(IDC_HEIGHT, m_height);
|
||||
SetText(IDC_FILENAME, m_filename.c_str());
|
||||
std::wstring tmp = std::wstring(m_filename.begin(), m_filename.end());
|
||||
SetText(IDC_FILENAME, tmp.c_str());
|
||||
|
||||
m_codecs.clear();
|
||||
|
||||
|
@ -169,7 +172,7 @@ bool GSCaptureDlg::OnCommand(HWND hWnd, UINT id, UINT code)
|
|||
{
|
||||
if (code == BN_CLICKED)
|
||||
{
|
||||
char buff[MAX_PATH] = { 0 };
|
||||
wchar_t buff[MAX_PATH] = { 0 };
|
||||
|
||||
OPENFILENAME ofn;
|
||||
memset(&ofn, 0, sizeof(ofn));
|
||||
|
@ -178,14 +181,18 @@ bool GSCaptureDlg::OnCommand(HWND hWnd, UINT id, UINT code)
|
|||
ofn.hwndOwner = m_hWnd;
|
||||
ofn.lpstrFile = buff;
|
||||
ofn.nMaxFile = countof(buff);
|
||||
ofn.lpstrFilter = "Avi files (*.avi)\0*.avi\0";
|
||||
ofn.lpstrFilter = L"Avi files (*.avi)\0*.avi\0";
|
||||
ofn.Flags = OFN_EXPLORER | OFN_ENABLESIZING | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST;
|
||||
|
||||
strcpy(ofn.lpstrFile, m_filename.c_str());
|
||||
std::wstring tmp = std::wstring(m_filename.begin(), m_filename.end());
|
||||
wcscpy(ofn.lpstrFile, tmp.c_str());
|
||||
if (GetSaveFileName(&ofn))
|
||||
{
|
||||
m_filename = ofn.lpstrFile;
|
||||
SetText(IDC_FILENAME, m_filename.c_str());
|
||||
tmp = ofn.lpstrFile;
|
||||
using convert_type = std::codecvt_utf8<wchar_t>;
|
||||
std::wstring_convert<convert_type, wchar_t> converter;
|
||||
m_filename = converter.to_bytes(tmp);
|
||||
SetText(IDC_FILENAME, tmp.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -90,7 +90,7 @@ INT_PTR CALLBACK GSDialog::DialogProc(HWND hWnd, UINT message, WPARAM wParam, LP
|
|||
// correct size.
|
||||
UINT GSDialog::GetTooltipStructSize()
|
||||
{
|
||||
DLLGETVERSIONPROC dllGetVersion = (DLLGETVERSIONPROC)GetProcAddress(GetModuleHandle("ComCtl32.dll"), "DllGetVersion");
|
||||
DLLGETVERSIONPROC dllGetVersion = (DLLGETVERSIONPROC)GetProcAddress(GetModuleHandle(L"ComCtl32.dll"), "DllGetVersion");
|
||||
if (dllGetVersion) {
|
||||
DLLVERSIONINFO2 dllversion = { 0 };
|
||||
dllversion.info1.cbSize = sizeof(DLLVERSIONINFO2);
|
||||
|
@ -129,15 +129,16 @@ std::string GSDialog::GetText(UINT id)
|
|||
{
|
||||
std::string s;
|
||||
|
||||
char* buff = NULL;
|
||||
wchar_t* buff = NULL;
|
||||
|
||||
for(int size = 256, limit = 65536; size < limit; size <<= 1)
|
||||
{
|
||||
buff = new char[size];
|
||||
buff = new wchar_t[size];
|
||||
|
||||
if(GetDlgItemText(m_hWnd, id, buff, size))
|
||||
{
|
||||
s = buff;
|
||||
std::wstring tmp(buff);
|
||||
s = std::string(tmp.begin(), tmp.end());
|
||||
size = limit;
|
||||
}
|
||||
|
||||
|
@ -152,15 +153,15 @@ int GSDialog::GetTextAsInt(UINT id)
|
|||
return atoi(GetText(id).c_str());
|
||||
}
|
||||
|
||||
void GSDialog::SetText(UINT id, const char* str)
|
||||
void GSDialog::SetText(UINT id, const wchar_t* str)
|
||||
{
|
||||
SetDlgItemText(m_hWnd, id, str);
|
||||
}
|
||||
|
||||
void GSDialog::SetTextAsInt(UINT id, int i)
|
||||
{
|
||||
char buff[32] = {0};
|
||||
itoa(i, buff, 10);
|
||||
wchar_t buff[32] = {0};
|
||||
_itow(i, buff, 10);
|
||||
SetText(id, buff);
|
||||
}
|
||||
|
||||
|
@ -259,13 +260,13 @@ void GSDialog::ComboBoxFixDroppedWidth(UINT id)
|
|||
|
||||
if(len > 0)
|
||||
{
|
||||
char* buff = new char[len + 1];
|
||||
wchar_t* buff = new wchar_t[len + 1];
|
||||
|
||||
SendMessage(hWnd, CB_GETLBTEXT, i, (LPARAM)buff);
|
||||
|
||||
SIZE size;
|
||||
|
||||
if(GetTextExtentPoint32(hDC, buff, strlen(buff), &size))
|
||||
if(GetTextExtentPoint32(hDC, buff, wcslen(buff), &size))
|
||||
{
|
||||
size.cx += 10;
|
||||
|
||||
|
@ -285,9 +286,9 @@ void GSDialog::ComboBoxFixDroppedWidth(UINT id)
|
|||
}
|
||||
}
|
||||
|
||||
void GSDialog::OpenFileDialog(UINT id, const char *title)
|
||||
void GSDialog::OpenFileDialog(UINT id, const wchar_t *title)
|
||||
{
|
||||
char filename[512];
|
||||
wchar_t filename[512];
|
||||
OPENFILENAME ofn = { 0 };
|
||||
ofn.lStructSize = sizeof(OPENFILENAME);
|
||||
ofn.hwndOwner = m_hWnd;
|
||||
|
@ -300,7 +301,7 @@ void GSDialog::OpenFileDialog(UINT id, const char *title)
|
|||
// GetOpenFileName changes the current directory, so we need to save and
|
||||
// restore the current directory or everything using relative paths will
|
||||
// break.
|
||||
char current_directory[512];
|
||||
wchar_t current_directory[512];
|
||||
GetCurrentDirectory(512, current_directory);
|
||||
|
||||
if (GetOpenFileName(&ofn))
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
std::string GetText(UINT id);
|
||||
int GetTextAsInt(UINT id);
|
||||
|
||||
void SetText(UINT id, const char* str);
|
||||
void SetText(UINT id, const wchar_t* str);
|
||||
void SetTextAsInt(UINT id, int i);
|
||||
|
||||
void ComboBoxInit(UINT id, const std::vector<GSSetting>& settings, int32_t selectionValue, int32_t maxValue = INT32_MAX);
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
bool ComboBoxGetSelData(UINT id, INT_PTR& data);
|
||||
void ComboBoxFixDroppedWidth(UINT id);
|
||||
|
||||
void OpenFileDialog(UINT id, const char *title);
|
||||
void OpenFileDialog(UINT id, const wchar_t *title);
|
||||
|
||||
void AddTooltip(UINT id);
|
||||
|
||||
|
|
|
@ -421,13 +421,13 @@ void GSShaderDlg::UpdateControls()
|
|||
SendMessage(GetDlgItem(m_hWnd, IDC_BRIGHTNESS_SLIDER), TBM_SETPOS, TRUE, m_brightness);
|
||||
SendMessage(GetDlgItem(m_hWnd, IDC_CONTRAST_SLIDER), TBM_SETPOS, TRUE, m_contrast);
|
||||
|
||||
char text[8] = {0};
|
||||
wchar_t text[8] = {0};
|
||||
|
||||
sprintf(text, "%d", m_saturation);
|
||||
wprintf(text, "%d", m_saturation);
|
||||
SetDlgItemText(m_hWnd, IDC_SATURATION_VALUE, text);
|
||||
sprintf(text, "%d", m_brightness);
|
||||
wprintf(text, "%d", m_brightness);
|
||||
SetDlgItemText(m_hWnd, IDC_BRIGHTNESS_VALUE, text);
|
||||
sprintf(text, "%d", m_contrast);
|
||||
wprintf(text, "%d", m_contrast);
|
||||
SetDlgItemText(m_hWnd, IDC_CONTRAST_VALUE, text);
|
||||
|
||||
// Shader Settings
|
||||
|
@ -458,29 +458,29 @@ bool GSShaderDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
if((HWND)lParam == GetDlgItem(m_hWnd, IDC_SATURATION_SLIDER))
|
||||
{
|
||||
char text[8] = {0};
|
||||
wchar_t text[8] = {0};
|
||||
|
||||
m_saturation = (int)SendMessage(GetDlgItem(m_hWnd, IDC_SATURATION_SLIDER),TBM_GETPOS,0,0);
|
||||
|
||||
sprintf(text, "%d", m_saturation);
|
||||
wprintf(text, "%d", m_saturation);
|
||||
SetDlgItemText(m_hWnd, IDC_SATURATION_VALUE, text);
|
||||
}
|
||||
else if((HWND)lParam == GetDlgItem(m_hWnd, IDC_BRIGHTNESS_SLIDER))
|
||||
{
|
||||
char text[8] = {0};
|
||||
wchar_t text[8] = {0};
|
||||
|
||||
m_brightness = (int)SendMessage(GetDlgItem(m_hWnd, IDC_BRIGHTNESS_SLIDER),TBM_GETPOS,0,0);
|
||||
|
||||
sprintf(text, "%d", m_brightness);
|
||||
wprintf(text, "%d", m_brightness);
|
||||
SetDlgItemText(m_hWnd, IDC_BRIGHTNESS_VALUE, text);
|
||||
}
|
||||
else if((HWND)lParam == GetDlgItem(m_hWnd, IDC_CONTRAST_SLIDER))
|
||||
{
|
||||
char text[8] = {0};
|
||||
wchar_t text[8] = {0};
|
||||
|
||||
m_contrast = (int)SendMessage(GetDlgItem(m_hWnd, IDC_CONTRAST_SLIDER),TBM_GETPOS,0,0);
|
||||
|
||||
sprintf(text, "%d", m_contrast);
|
||||
wprintf(text, "%d", m_contrast);
|
||||
SetDlgItemText(m_hWnd, IDC_CONTRAST_VALUE, text);
|
||||
}
|
||||
} break;
|
||||
|
@ -535,12 +535,12 @@ bool GSShaderDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
case IDC_SHADER_FX_BUTTON:
|
||||
if (HIWORD(wParam) == BN_CLICKED)
|
||||
OpenFileDialog(IDC_SHADER_FX_EDIT, "Select External Shader");
|
||||
OpenFileDialog(IDC_SHADER_FX_EDIT, L"Select External Shader");
|
||||
break;
|
||||
|
||||
case IDC_SHADER_FX_CONF_BUTTON:
|
||||
if (HIWORD(wParam) == BN_CLICKED)
|
||||
OpenFileDialog(IDC_SHADER_FX_CONF_EDIT, "Select External Shader Config");
|
||||
OpenFileDialog(IDC_SHADER_FX_CONF_EDIT, L"Select External Shader Config");
|
||||
break;
|
||||
|
||||
case IDCANCEL:
|
||||
|
@ -855,17 +855,17 @@ void GSOSDDlg::UpdateControls()
|
|||
SendMessage(GetDlgItem(m_hWnd, IDC_OSD_COLOR_GREEN_SLIDER), TBM_SETPOS, TRUE, m_color.g);
|
||||
SendMessage(GetDlgItem(m_hWnd, IDC_OSD_COLOR_BLUE_SLIDER), TBM_SETPOS, TRUE, m_color.b);
|
||||
|
||||
char text[8] = { 0 };
|
||||
sprintf(text, "%d", m_color.a);
|
||||
wchar_t text[8] = { 0 };
|
||||
wprintf(text, "%d", m_color.a);
|
||||
SetDlgItemText(m_hWnd, IDC_OSD_OPACITY_AMOUNT, text);
|
||||
|
||||
sprintf(text, "%d", m_color.r);
|
||||
wprintf(text, "%d", m_color.r);
|
||||
SetDlgItemText(m_hWnd, IDC_OSD_COLOR_RED_AMOUNT, text);
|
||||
|
||||
sprintf(text, "%d", m_color.g);
|
||||
wprintf(text, "%d", m_color.g);
|
||||
SetDlgItemText(m_hWnd, IDC_OSD_COLOR_GREEN_AMOUNT, text);
|
||||
|
||||
sprintf(text, "%d", m_color.b);
|
||||
wprintf(text, "%d", m_color.b);
|
||||
SetDlgItemText(m_hWnd, IDC_OSD_COLOR_BLUE_AMOUNT, text);
|
||||
|
||||
const bool monitor_enabled = IsDlgButtonChecked(m_hWnd, IDC_OSD_MONITOR) == BST_CHECKED;
|
||||
|
@ -912,38 +912,38 @@ bool GSOSDDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
if ((HWND)lParam == GetDlgItem(m_hWnd, IDC_OSD_OPACITY_SLIDER))
|
||||
{
|
||||
char text[8] = { 0 };
|
||||
wchar_t text[8] = { 0 };
|
||||
|
||||
m_color.a = (int)SendMessage(GetDlgItem(m_hWnd, IDC_OSD_OPACITY_SLIDER), TBM_GETPOS, 0, 0);
|
||||
|
||||
sprintf(text, "%d", m_color.a);
|
||||
wprintf(text, "%d", m_color.a);
|
||||
SetDlgItemText(m_hWnd, IDC_OSD_OPACITY_AMOUNT, text);
|
||||
}
|
||||
else if ((HWND)lParam == GetDlgItem(m_hWnd, IDC_OSD_COLOR_RED_SLIDER))
|
||||
{
|
||||
char text[8] = { 0 };
|
||||
wchar_t text[8] = { 0 };
|
||||
|
||||
m_color.r = (int)SendMessage(GetDlgItem(m_hWnd, IDC_OSD_COLOR_RED_SLIDER), TBM_GETPOS, 0, 0);
|
||||
|
||||
sprintf(text, "%d", m_color.r);
|
||||
wprintf(text, "%d", m_color.r);
|
||||
SetDlgItemText(m_hWnd, IDC_OSD_COLOR_RED_AMOUNT, text);
|
||||
}
|
||||
else if ((HWND)lParam == GetDlgItem(m_hWnd, IDC_OSD_COLOR_GREEN_SLIDER))
|
||||
{
|
||||
char text[8] = { 0 };
|
||||
wchar_t text[8] = { 0 };
|
||||
|
||||
m_color.g = (int)SendMessage(GetDlgItem(m_hWnd, IDC_OSD_COLOR_GREEN_SLIDER), TBM_GETPOS, 0, 0);
|
||||
|
||||
sprintf(text, "%d", m_color.g);
|
||||
wprintf(text, "%d", m_color.g);
|
||||
SetDlgItemText(m_hWnd, IDC_OSD_COLOR_GREEN_AMOUNT, text);
|
||||
}
|
||||
else if ((HWND)lParam == GetDlgItem(m_hWnd, IDC_OSD_COLOR_BLUE_SLIDER))
|
||||
{
|
||||
char text[8] = { 0 };
|
||||
wchar_t text[8] = { 0 };
|
||||
|
||||
m_color.b = (int)SendMessage(GetDlgItem(m_hWnd, IDC_OSD_COLOR_BLUE_SLIDER), TBM_GETPOS, 0, 0);
|
||||
|
||||
sprintf(text, "%d", m_color.b);
|
||||
wprintf(text, "%d", m_color.b);
|
||||
SetDlgItemText(m_hWnd, IDC_OSD_COLOR_BLUE_AMOUNT, text);
|
||||
}
|
||||
} break;
|
||||
|
|
|
@ -96,7 +96,7 @@ bool GSWndDX::Create(const std::string& title, int w, int h)
|
|||
// TODO: wc.hIcon = ;
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
|
||||
wc.lpszClassName = "GSWndDX";
|
||||
wc.lpszClassName = L"GSWndDX";
|
||||
|
||||
if(!GetClassInfo(wc.hInstance, wc.lpszClassName, &wc))
|
||||
{
|
||||
|
@ -132,8 +132,8 @@ bool GSWndDX::Create(const std::string& title, int w, int h)
|
|||
r.bottom = r.top + h;
|
||||
|
||||
AdjustWindowRect(r, style, FALSE);
|
||||
|
||||
m_hWnd = CreateWindow(wc.lpszClassName, title.c_str(), style, r.left, r.top, r.width(), r.height(), NULL, NULL, wc.hInstance, (LPVOID)this);
|
||||
std::wstring tmp = std::wstring(title.begin(), title.end());
|
||||
m_hWnd = CreateWindow(wc.lpszClassName, tmp.c_str(), style, r.left, r.top, r.width(), r.height(), NULL, NULL, wc.hInstance, (LPVOID)this);
|
||||
|
||||
if (!m_hWnd)
|
||||
throw GSDXRecoverableError();
|
||||
|
@ -177,7 +177,7 @@ GSVector4i GSWndDX::GetClientRect()
|
|||
// Returns FALSE if the window has no title, or if th window title is under the strict
|
||||
// management of the emulator.
|
||||
|
||||
bool GSWndDX::SetWindowText(const char* title)
|
||||
bool GSWndDX::SetWindowText(const wchar_t* title)
|
||||
{
|
||||
if(!m_managed) return false;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
void* GetDisplay() {return m_hWnd;}
|
||||
void* GetHandle() {return m_hWnd;}
|
||||
GSVector4i GetClientRect();
|
||||
bool SetWindowText(const char* title);
|
||||
bool SetWindowText(const wchar_t* title);
|
||||
|
||||
void Show();
|
||||
void Hide();
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
|
||||
static void win_error(const char* msg, bool fatal = true)
|
||||
static void win_error(const wchar_t* msg, bool fatal = true)
|
||||
{
|
||||
DWORD errorID = ::GetLastError();
|
||||
if (errorID)
|
||||
fprintf(stderr, "WIN API ERROR:%ld\t", errorID);
|
||||
|
||||
if (fatal) {
|
||||
MessageBox(NULL, msg, "ERROR", MB_OK | MB_ICONEXCLAMATION);
|
||||
MessageBox(NULL, msg, L"ERROR", MB_OK | MB_ICONEXCLAMATION);
|
||||
throw GSDXRecoverableError();
|
||||
} else {
|
||||
fprintf(stderr, "ERROR:%s\n", msg);
|
||||
|
@ -65,7 +65,7 @@ void GSWndWGL::CreateContext(int major, int minor)
|
|||
{
|
||||
if (!m_NativeDisplay || !m_NativeWindow)
|
||||
{
|
||||
win_error("Wrong display/window", false);
|
||||
win_error(L"Wrong display/window", false);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ void GSWndWGL::CreateContext(int major, int minor)
|
|||
// GL2 context are quite easy but we need GL3 which is another painful story...
|
||||
m_context = wglCreateContext(m_NativeDisplay);
|
||||
if (!m_context)
|
||||
win_error("Failed to create a 2.0 context");
|
||||
win_error(L"Failed to create a 2.0 context");
|
||||
|
||||
// FIXME test it
|
||||
// Note: albeit every tutorial said that we need an opengl context to use the GL function wglCreateContextAttribsARB
|
||||
|
@ -102,11 +102,11 @@ void GSWndWGL::CreateContext(int major, int minor)
|
|||
|
||||
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
|
||||
if (!wglCreateContextAttribsARB)
|
||||
win_error("Failed to init wglCreateContextAttribsARB function pointer");
|
||||
win_error(L"Failed to init wglCreateContextAttribsARB function pointer");
|
||||
|
||||
HGLRC context30 = wglCreateContextAttribsARB(m_NativeDisplay, NULL, context_attribs);
|
||||
if (!context30) {
|
||||
win_error("Failed to create a 3.x context with standard flags", false);
|
||||
win_error(L"Failed to create a 3.x context with standard flags", false);
|
||||
// retry with more compatible option for (Mesa on Windows, OpenGL on WINE)
|
||||
context_attribs[2*2+1] = 0;
|
||||
|
||||
|
@ -117,7 +117,7 @@ void GSWndWGL::CreateContext(int major, int minor)
|
|||
wglDeleteContext(m_context);
|
||||
|
||||
if (!context30)
|
||||
win_error("Failed to create a 3.x context with compatible flags");
|
||||
win_error(L"Failed to create a 3.x context with compatible flags");
|
||||
|
||||
m_context = context30;
|
||||
fprintf(stdout, "3.x GL context successfully created\n");
|
||||
|
@ -215,20 +215,20 @@ void GSWndWGL::OpenWGLDisplay()
|
|||
|
||||
m_NativeDisplay = GetDC(m_NativeWindow);
|
||||
if (!m_NativeDisplay)
|
||||
win_error("(1) Can't Create A GL Device Context.");
|
||||
win_error(L"(1) Can't Create A GL Device Context.");
|
||||
|
||||
PixelFormat = ChoosePixelFormat(m_NativeDisplay, &pfd);
|
||||
if (!PixelFormat)
|
||||
win_error("(2) Can't Find A Suitable PixelFormat.");
|
||||
win_error(L"(2) Can't Find A Suitable PixelFormat.");
|
||||
|
||||
if (!SetPixelFormat(m_NativeDisplay, PixelFormat, &pfd))
|
||||
win_error("(3) Can't Set The PixelFormat.", false);
|
||||
win_error(L"(3) Can't Set The PixelFormat.", false);
|
||||
}
|
||||
|
||||
void GSWndWGL::CloseWGLDisplay()
|
||||
{
|
||||
if (m_NativeDisplay && !ReleaseDC(m_NativeWindow, m_NativeDisplay))
|
||||
win_error("Release Device Context Failed.");
|
||||
win_error(L"Release Device Context Failed.");
|
||||
|
||||
m_NativeDisplay = NULL;
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ bool GSWndWGL::Create(const std::string& title, int w, int h)
|
|||
wc.hInstance = theApp.GetModuleHandle();
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
|
||||
wc.lpszClassName = "GSWndOGL";
|
||||
wc.lpszClassName = L"GSWndOGL";
|
||||
|
||||
if (!GetClassInfo(wc.hInstance, wc.lpszClassName, &wc))
|
||||
{
|
||||
|
@ -290,7 +290,8 @@ bool GSWndWGL::Create(const std::string& title, int w, int h)
|
|||
|
||||
AdjustWindowRect(r, style, FALSE);
|
||||
|
||||
m_NativeWindow = CreateWindow(wc.lpszClassName, title.c_str(), style, r.left, r.top, r.width(), r.height(), NULL, NULL, wc.hInstance, (LPVOID)this);
|
||||
std::wstring tmp = std::wstring(title.begin(), title.end());
|
||||
m_NativeWindow = CreateWindow(wc.lpszClassName, tmp.c_str(), style, r.left, r.top, r.width(), r.height(), NULL, NULL, wc.hInstance, (LPVOID)this);
|
||||
|
||||
if (m_NativeWindow == NULL) return false;
|
||||
|
||||
|
@ -375,7 +376,7 @@ void GSWndWGL::HideFrame()
|
|||
// Returns FALSE if the window has no title, or if th window title is under the strict
|
||||
// management of the emulator.
|
||||
|
||||
bool GSWndWGL::SetWindowText(const char* title)
|
||||
bool GSWndWGL::SetWindowText(const wchar_t* title)
|
||||
{
|
||||
if (!m_managed) return false;
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
void* GetDisplay() {return m_NativeWindow;}
|
||||
void* GetHandle() {return m_NativeWindow;}
|
||||
GSVector4i GetClientRect();
|
||||
bool SetWindowText(const char* title);
|
||||
bool SetWindowText(const wchar_t* title);
|
||||
|
||||
void AttachContext();
|
||||
void DetachContext();
|
||||
|
|
Loading…
Reference in New Issue