third unicode fix for issue #496. please go away.
This commit is contained in:
parent
af06cc4aca
commit
747f369483
|
@ -129,20 +129,20 @@ void MakeBitmapPseudoTransparent(HBITMAP hBmp, COLORREF cKeyColor, COLORREF cNew
|
|||
// Window class handling
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
vector<string> ReggedWndClasses;
|
||||
vector<wstring> ReggedWndClasses;
|
||||
|
||||
bool RegWndClass(string name, WNDPROC wndProc, UINT style, int extraSize)
|
||||
bool RegWndClass(wstring name, WNDPROC wndProc, UINT style, int extraSize)
|
||||
{
|
||||
return RegWndClass(name, wndProc, style, NULL, extraSize);
|
||||
}
|
||||
|
||||
bool RegWndClass(string name, WNDPROC wndProc, UINT style, HICON icon, int extraSize)
|
||||
bool RegWndClass(wstring name, WNDPROC wndProc, UINT style, HICON icon, int extraSize)
|
||||
{
|
||||
// If the class is already regged, don't re-reg it
|
||||
if (find(ReggedWndClasses.begin(), ReggedWndClasses.end(), name) != ReggedWndClasses.end())
|
||||
return true;
|
||||
|
||||
WNDCLASSEX wc;
|
||||
WNDCLASSEXW wc;
|
||||
|
||||
wc.cbSize = sizeof(wc);
|
||||
wc.lpszClassName = name.c_str();
|
||||
|
@ -157,7 +157,7 @@ bool RegWndClass(string name, WNDPROC wndProc, UINT style, HICON icon, int extra
|
|||
wc.cbWndExtra = DWLP_USER + extraSize;
|
||||
wc.hIconSm = 0;
|
||||
|
||||
if (RegisterClassEx(&wc) != 0)
|
||||
if (RegisterClassExW(&wc) != 0)
|
||||
{
|
||||
// If registration succeeded, add the class name into the list
|
||||
ReggedWndClasses.push_back(name);
|
||||
|
@ -167,9 +167,9 @@ bool RegWndClass(string name, WNDPROC wndProc, UINT style, HICON icon, int extra
|
|||
return false;
|
||||
}
|
||||
|
||||
void UnregWndClass(string name)
|
||||
void UnregWndClass(wstring name)
|
||||
{
|
||||
vector<string>::iterator it = find(ReggedWndClasses.begin(), ReggedWndClasses.end(), name);
|
||||
vector<wstring>::iterator it = find(ReggedWndClasses.begin(), ReggedWndClasses.end(), name);
|
||||
|
||||
// If the class wasn't regged, we can't unreg it :P
|
||||
if (it == ReggedWndClasses.end())
|
||||
|
@ -178,7 +178,7 @@ void UnregWndClass(string name)
|
|||
// Otherwise unreg the class and remove its name from the list
|
||||
// ONLY if unregging was successful. Unregging will fail if one
|
||||
// or more windows using the class still exist.
|
||||
if (UnregisterClass(name.c_str(), hAppInst) != 0)
|
||||
if (UnregisterClassW(name.c_str(), hAppInst) != 0)
|
||||
ReggedWndClasses.erase(it);
|
||||
}
|
||||
|
||||
|
@ -553,6 +553,18 @@ WINCLASS::WINCLASS(LPSTR rclass, HINSTANCE hInst)
|
|||
minHeight = 0;
|
||||
}
|
||||
|
||||
WINCLASS::WINCLASS(LPWSTR rclass, HINSTANCE hInst)
|
||||
{
|
||||
wcscpy(regclassW,rclass);
|
||||
|
||||
hwnd = NULL;
|
||||
hmenu = NULL;
|
||||
hInstance = hInst;
|
||||
|
||||
minWidth = 0;
|
||||
minHeight = 0;
|
||||
}
|
||||
|
||||
WINCLASS::~WINCLASS()
|
||||
{
|
||||
}
|
||||
|
@ -567,6 +579,16 @@ bool WINCLASS::create(LPSTR caption, int x, int y, int width, int height, int st
|
|||
return false;
|
||||
}
|
||||
|
||||
bool WINCLASS::createW(LPWSTR caption, int x, int y, int width, int height, int style, HMENU menu)
|
||||
{
|
||||
if (hwnd != NULL) return false;
|
||||
|
||||
hwnd = CreateWindowW(regclassW, caption, style, x, y, width, height, NULL, menu, hInstance, NULL);
|
||||
|
||||
if (hwnd != NULL) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WINCLASS::createEx(LPSTR caption, int x, int y, int width, int height, int style, int styleEx, HMENU menu)
|
||||
{
|
||||
if (hwnd != NULL) return false;
|
||||
|
|
|
@ -84,14 +84,14 @@ void MakeBitmapPseudoTransparent(HBITMAP hBmp, COLORREF cKeyColor, COLORREF cNew
|
|||
// Incase the class was already registered, the function
|
||||
// just does nothing and returns true.
|
||||
// Returns false if registration failed.
|
||||
bool RegWndClass(string name, WNDPROC wndProc, UINT style, int extraSize = 0);
|
||||
bool RegWndClass(string name, WNDPROC wndProc, UINT style, HICON icon, int extraSize = 0);
|
||||
bool RegWndClass(wstring wname, WNDPROC wndProc, UINT style, int extraSize = 0);
|
||||
bool RegWndClass(wstring wname, WNDPROC wndProc, UINT style, HICON icon, int extraSize = 0);
|
||||
|
||||
// UnregWndClass()
|
||||
// Unregisters a previously registered window class.
|
||||
// This function will silently fail if one or more windows
|
||||
// using the class still exist.
|
||||
void UnregWndClass(string name);
|
||||
void UnregWndClass(wstring name);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Base toolwindow class
|
||||
|
@ -228,13 +228,17 @@ private:
|
|||
HMENU hmenu;
|
||||
HINSTANCE hInstance;
|
||||
char regclass[256];
|
||||
wchar_t regclassW[256];
|
||||
int minWidth, minHeight;
|
||||
public:
|
||||
WINCLASS(LPSTR rclass, HINSTANCE hInst);
|
||||
WINCLASS(LPWSTR rclass, HINSTANCE hInst);
|
||||
~WINCLASS();
|
||||
|
||||
bool create(LPSTR caption, int x, int y, int width, int height, int style,
|
||||
HMENU menu);
|
||||
bool createW(LPWSTR caption, int x, int y, int width, int height, int style,
|
||||
HMENU menu);
|
||||
bool createEx(LPSTR caption, int x, int y, int width, int height, int style, int styleEx,
|
||||
HMENU menu);
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ CIORegView::CIORegView()
|
|||
CIORegView::~CIORegView()
|
||||
{
|
||||
DestroyWindow(hWnd);
|
||||
UnregWndClass("DeSmuME_IORegView");
|
||||
UnregWndClass(L"DeSmuME_IORegView");
|
||||
//TODO - is this thread safe? which thread do these calls come from
|
||||
liveIORegViews.erase(std::find(liveIORegViews.begin(),liveIORegViews.end(),this));
|
||||
if(liveIORegViews.size()==0) anyLiveIORegViews = false;
|
||||
|
@ -608,7 +608,7 @@ LRESULT CALLBACK IORegView_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
{
|
||||
CIORegView* wnd = (CIORegView*)GetWindowLongPtr(hWnd, DWLP_USER);
|
||||
if ((wnd == NULL) && (uMsg != WM_CREATE))
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
|
|
|
@ -251,7 +251,7 @@ BOOL CALLBACK ViewFSNitroProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
case ID_FSNITRO_VIEW:
|
||||
if (currentFileID < 0xF000)
|
||||
{
|
||||
if (RegWndClass("MemView_ViewBox", MemView_ViewBoxProc, 0, sizeof(CMemView*)))
|
||||
if (RegWndClass(L"MemView_ViewBox", MemView_ViewBoxProc, 0, sizeof(CMemView*)))
|
||||
OpenToolWindow(new CMemView(MEMVIEW_ROM, fs->getStartAddrById(currentFileID)));
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ BOOL CALLBACK ViewFSNitroProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
case NM_DBLCLK:
|
||||
if (currentFileID < 0xF000)
|
||||
{
|
||||
if (RegWndClass("MemView_ViewBox", MemView_ViewBoxProc, 0, sizeof(CMemView*)))
|
||||
if (RegWndClass(L"MemView_ViewBox", MemView_ViewBoxProc, 0, sizeof(CMemView*)))
|
||||
OpenToolWindow(new CMemView(MEMVIEW_ROM, fs->getStartAddrById(currentFileID)));
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
Copyright (C) 2006 Theo Berkau
|
||||
Copyright (C) 2006-2019 DeSmuME team
|
||||
|
||||
|
@ -1490,7 +1490,7 @@ bool NDS_Pause(bool showMsg)
|
|||
while (!paused) {}
|
||||
if (showMsg) INFO("Emulation paused\n");
|
||||
|
||||
SetWindowText(MainWindow->getHWnd(), "Paused");
|
||||
SetWindowTextW(MainWindow->getHWnd(), L"Paused");
|
||||
MainWindowToolbar->ChangeButtonBitmap(IDM_PAUSE, IDB_PLAY);
|
||||
return true;
|
||||
}
|
||||
|
@ -1978,7 +1978,7 @@ int _main()
|
|||
CommonSettings.backupSave = GetPrivateProfileBool("General", "backupSave", false, IniName);
|
||||
|
||||
ColorCtrl_Register();
|
||||
if (!RegWndClass("DeSmuME", WindowProcedure, CS_DBLCLKS, LoadIcon(hAppInst, MAKEINTRESOURCE(ICONDESMUME))))
|
||||
if (!RegWndClass(L"DeSmuME", WindowProcedure, CS_DBLCLKS, LoadIcon(hAppInst, MAKEINTRESOURCE(ICONDESMUME))))
|
||||
{
|
||||
MessageBox(NULL, "Error registering windows class", DESMUME_NAME, MB_OK);
|
||||
exit(-1);
|
||||
|
@ -2114,8 +2114,15 @@ int _main()
|
|||
if(CommonSettings.single_core())
|
||||
SetProcessAffinityMask(GetCurrentProcess(),1);
|
||||
|
||||
MainWindow = new WINCLASS("DeSmuME", hAppInst);
|
||||
if (!MainWindow->create((char*)EMU_DESMUME_NAME_AND_VERSION(), WndX, WndY, video.width,video.height+video.screengap,
|
||||
wchar_t boffo[256];
|
||||
const char* emu_desmume_name_and_version = EMU_DESMUME_NAME_AND_VERSION();
|
||||
size_t len = strlen(emu_desmume_name_and_version);
|
||||
for(int i=0;i<len;i++)
|
||||
boffo[i] = emu_desmume_name_and_version[i];
|
||||
boffo[len] = 0;
|
||||
|
||||
MainWindow = new WINCLASS(L"DeSmuME", hAppInst);
|
||||
if (!MainWindow->createW(boffo, WndX, WndY, video.width,video.height+video.screengap,
|
||||
WS_CAPTION | WS_SYSMENU | WS_SIZEBOX | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
|
||||
NULL))
|
||||
{
|
||||
|
@ -2607,7 +2614,7 @@ int _main()
|
|||
|
||||
ddraw.release();
|
||||
|
||||
UnregWndClass("DeSmuME");
|
||||
UnregWndClass(L"DeSmuME");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -4996,7 +5003,7 @@ DOKEYDOWN:
|
|||
return 0;
|
||||
case IDM_IOREG:
|
||||
//ViewRegisters->open();
|
||||
if (!RegWndClass("DeSmuME_IORegView", IORegView_Proc, CS_DBLCLKS, LoadIcon(hAppInst, MAKEINTRESOURCE(ICONDESMUME)), sizeof(CIORegView*)))
|
||||
if (!RegWndClass(L"DeSmuME_IORegView", IORegView_Proc, CS_DBLCLKS, LoadIcon(hAppInst, MAKEINTRESOURCE(ICONDESMUME)), sizeof(CIORegView*)))
|
||||
return 0;
|
||||
|
||||
OpenToolWindow(new CIORegView());
|
||||
|
@ -5004,7 +5011,7 @@ DOKEYDOWN:
|
|||
case IDM_MEMORY:
|
||||
//if(!MemView_IsOpened(ARMCPU_ARM9)) MemView_DlgOpen(HWND_DESKTOP, "ARM9 memory", ARMCPU_ARM9);
|
||||
//if(!MemView_IsOpened(ARMCPU_ARM7)) MemView_DlgOpen(HWND_DESKTOP, "ARM7 memory", ARMCPU_ARM7);
|
||||
if (!RegWndClass("MemView_ViewBox", MemView_ViewBoxProc, 0, sizeof(CMemView*)))
|
||||
if (!RegWndClass(L"MemView_ViewBox", MemView_ViewBoxProc, 0, sizeof(CMemView*)))
|
||||
return 0;
|
||||
|
||||
OpenToolWindow(new CMemView());
|
||||
|
@ -5735,7 +5742,7 @@ DOKEYDOWN:
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
return DefWindowProc (hwnd, message, wParam, lParam);
|
||||
return DefWindowProcW (hwnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
void Change3DCoreWithFallbackAndSave(int newCore)
|
||||
|
|
|
@ -229,7 +229,7 @@ CMemView::~CMemView()
|
|||
DestroyWindow(hWnd);
|
||||
hWnd = NULL;
|
||||
|
||||
UnregWndClass("MemView_ViewBox");
|
||||
UnregWndClass(L"MemView_ViewBox");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1217,7 +1217,7 @@ LRESULT CALLBACK MemView_ViewBoxProc(HWND hCtl, UINT uMsg, WPARAM wParam, LPARAM
|
|||
if(((ch >= '0') && (ch <= '9')) || ((ch >= 'A') && (ch <= 'F')) || ((ch >= 'a') && (ch <= 'f')))
|
||||
{
|
||||
if (!memIsAvailable((MemRegionType)wnd->region, wnd->selAddress))
|
||||
return DefWindowProc(hCtl, uMsg, wParam, lParam);
|
||||
return DefWindowProcW(hCtl, uMsg, wParam, lParam);
|
||||
|
||||
u8 maxSelPart[3] = {2, 4, 8};
|
||||
|
||||
|
@ -1328,7 +1328,7 @@ LRESULT CALLBACK MemView_ViewBoxProc(HWND hCtl, UINT uMsg, WPARAM wParam, LPARAM
|
|||
return 1;
|
||||
}
|
||||
|
||||
return DefWindowProc(hCtl, uMsg, wParam, lParam);
|
||||
return DefWindowProcW(hCtl, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue