From e604631413e9be65c7a0b321474db2f630e3b1f0 Mon Sep 17 00:00:00 2001 From: zeromus Date: Wed, 12 Dec 2018 15:50:24 -0500 Subject: [PATCH] =?UTF-8?q?winport=20-=20fix=20things=20named=20like=20Blo?= =?UTF-8?q?rk=C3=A9nflarge=20in=20the=20recent=20roms=20menu=20(#238)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- desmume/src/frontend/windows/recentroms.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/desmume/src/frontend/windows/recentroms.cpp b/desmume/src/frontend/windows/recentroms.cpp index bf5b25e9b..d5d213753 100644 --- a/desmume/src/frontend/windows/recentroms.cpp +++ b/desmume/src/frontend/windows/recentroms.cpp @@ -24,7 +24,7 @@ #include "resource.h" #include "winutil.h" - +#include "utils/xstring.h" std::vector RecentRoms; //The list of recent ROM filenames HMENU recentromsmenu; //Handle to the recent ROMs submenu @@ -88,9 +88,13 @@ void PopulateRecentRomsMenu() for(int x = RecentRoms.size()-1; x >= 0; x--) //Must loop in reverse order since InsertMenuItem will insert as the first on the list { string tmp = RecentRoms[x]; - LPSTR tmp2 = (LPSTR)tmp.c_str(); - PathCompactPath(dc, tmp2, 500); + //the recent roms are UTF-8, so convert to windows stupid codepage + auto wtmp = mbstowcs(tmp); + char garbage[1024]; + WideCharToMultiByte(CP_ACP,0,wtmp.c_str(),-1,garbage,1024,NULL,NULL); + + PathCompactPath(dc, garbage, 500); moo.cbSize = sizeof(moo); moo.fMask = MIIM_DATA | MIIM_ID | MIIM_TYPE; @@ -98,7 +102,7 @@ void PopulateRecentRomsMenu() moo.cch = tmp.size(); moo.fType = 0; moo.wID = recentRoms_baseid + x; - moo.dwTypeData = tmp2; + moo.dwTypeData = garbage; //LOG("Inserting: %s\n",tmp.c_str()); //Debug InsertMenuItem(GetSubMenu(recentromsmenu, 0), 0, 1, &moo); }