From 8bfe851446a06f25714cbbbc0e83a2a780b92aee Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Thu, 28 Jan 2021 13:47:35 +0100 Subject: [PATCH] GS: finish unicode conversion, fix signature inheritance and non wchar external import --- plugins/GSdx/GSCapture.cpp | 2 +- plugins/GSdx/Window/GSWndDX.cpp | 7 +++++-- plugins/GSdx/Window/GSWndDX.h | 2 +- plugins/GSdx/Window/GSWndWGL.cpp | 7 +++++-- plugins/GSdx/Window/GSWndWGL.h | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/plugins/GSdx/GSCapture.cpp b/plugins/GSdx/GSCapture.cpp index 21495e72d2..a10ece3f93 100644 --- a/plugins/GSdx/GSCapture.cpp +++ b/plugins/GSdx/GSCapture.cpp @@ -197,7 +197,7 @@ GSSource : public CBaseFilter, private CCritSec, public IGSSource public: GSSource(int w, int h, float fps, IUnknown* pUnk, HRESULT& hr, int colorspace) - : CBaseFilter(NAME("GSSource"), pUnk, this, __uuidof(this), &hr) + : CBaseFilter("GSSource", pUnk, this, __uuidof(this), &hr) , m_output(NULL) , m_size(w, h) , m_atpf((REFERENCE_TIME)(10000000.0f / fps)) diff --git a/plugins/GSdx/Window/GSWndDX.cpp b/plugins/GSdx/Window/GSWndDX.cpp index 8bd4f047c1..88da4b77bc 100644 --- a/plugins/GSdx/Window/GSWndDX.cpp +++ b/plugins/GSdx/Window/GSWndDX.cpp @@ -177,11 +177,14 @@ 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 wchar_t* title) +bool GSWndDX::SetWindowText(const char* title) { if(!m_managed) return false; - ::SetWindowText(m_hWnd, title); + const size_t tmp_size = strlen(title) + 1; + std::wstring tmp(tmp_size, L'#'); + mbstowcs(&tmp[0], title, tmp_size); + ::SetWindowText(m_hWnd, tmp.c_str()); return m_frame; } diff --git a/plugins/GSdx/Window/GSWndDX.h b/plugins/GSdx/Window/GSWndDX.h index bc5011603a..c2e0119549 100644 --- a/plugins/GSdx/Window/GSWndDX.h +++ b/plugins/GSdx/Window/GSWndDX.h @@ -43,7 +43,7 @@ public: void* GetDisplay() {return m_hWnd;} void* GetHandle() {return m_hWnd;} GSVector4i GetClientRect(); - bool SetWindowText(const wchar_t* title); + bool SetWindowText(const char* title); void Show(); void Hide(); diff --git a/plugins/GSdx/Window/GSWndWGL.cpp b/plugins/GSdx/Window/GSWndWGL.cpp index 345fb78e2d..cf9e02e031 100644 --- a/plugins/GSdx/Window/GSWndWGL.cpp +++ b/plugins/GSdx/Window/GSWndWGL.cpp @@ -376,12 +376,15 @@ 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 wchar_t* title) +bool GSWndWGL::SetWindowText(const char* title) { if (!m_managed) return false; + const size_t tmp_size = strlen(title) + 1; + std::wstring tmp(tmp_size, L'#'); + mbstowcs(&tmp[0], title, tmp_size); // Used by GSReplay. - ::SetWindowText(m_NativeWindow, title); + ::SetWindowText(m_NativeWindow, tmp.c_str()); return true; } diff --git a/plugins/GSdx/Window/GSWndWGL.h b/plugins/GSdx/Window/GSWndWGL.h index efb371bb39..feb1ba7b2a 100644 --- a/plugins/GSdx/Window/GSWndWGL.h +++ b/plugins/GSdx/Window/GSWndWGL.h @@ -54,7 +54,7 @@ public: void* GetDisplay() {return m_NativeWindow;} void* GetHandle() {return m_NativeWindow;} GSVector4i GetClientRect(); - bool SetWindowText(const wchar_t* title); + bool SetWindowText(const char* title); void AttachContext(); void DetachContext();