summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/mame/ui/inifile.cpp27
-rw-r--r--src/frontend/mame/ui/miscmenu.cpp12
2 files changed, 34 insertions, 5 deletions
diff --git a/src/frontend/mame/ui/inifile.cpp b/src/frontend/mame/ui/inifile.cpp
index 6cf9886324d..4475210db74 100644
--- a/src/frontend/mame/ui/inifile.cpp
+++ b/src/frontend/mame/ui/inifile.cpp
@@ -24,6 +24,7 @@
#include <algorithm>
#include <cstring>
#include <iterator>
+#include <locale>
namespace {
@@ -56,7 +57,17 @@ inifile_manager::inifile_manager(ui_options &options)
}
}
}
- std::stable_sort(m_ini_index.begin(), m_ini_index.end(), [] (auto const &x, auto const &y) { return 0 > core_stricmp(x.first.c_str(), y.first.c_str()); });
+ std::collate<wchar_t> const &coll = std::use_facet<std::collate<wchar_t>>(std::locale());
+ std::stable_sort(
+ m_ini_index.begin(),
+ m_ini_index.end(),
+ [&coll] (auto const &x, auto const &y)
+ {
+ std::wstring const wx = wstring_from_utf8(x.first);
+ std::wstring const wy = wstring_from_utf8(y.first);
+ return 0 > coll.compare(wx.data(), wx.data() + wx.size(), wy.data(), wy.data() + wy.size());
+ }
+ );
}
//-------------------------------------------------
@@ -118,9 +129,21 @@ void inifile_manager::init_category(std::string &&filename, util::core_file &fil
}
}
}
- std::stable_sort(index.begin(), index.end(), [] (auto const &x, auto const &y) { return 0 > core_stricmp(x.first.c_str(), y.first.c_str()); });
if (!index.empty())
+ {
+ std::collate<wchar_t> const &coll = std::use_facet<std::collate<wchar_t>>(std::locale());
+ std::stable_sort(
+ index.begin(),
+ index.end(),
+ [&coll] (auto const &x, auto const &y)
+ {
+ std::wstring const wx = wstring_from_utf8(x.first);
+ std::wstring const wy = wstring_from_utf8(y.first);
+ return 0 > coll.compare(wx.data(), wx.data() + wx.size(), wy.data(), wy.data() + wy.size());
+ }
+ );
m_ini_index.emplace_back(std::move(filename), std::move(index));
+ }
}
diff --git a/src/frontend/mame/ui/miscmenu.cpp b/src/frontend/mame/ui/miscmenu.cpp
index 55a2aab986f..b621581ee89 100644
--- a/src/frontend/mame/ui/miscmenu.cpp
+++ b/src/frontend/mame/ui/miscmenu.cpp
@@ -28,12 +28,11 @@
#include "romload.h"
#include "uiinput.h"
-#include "corestr.h"
-
#include <algorithm>
#include <cstring>
#include <fstream>
#include <iterator>
+#include <locale>
namespace ui {
@@ -445,10 +444,17 @@ void menu_crosshair::populate(float &customtop, float &custombottom)
if ((length > 4) && core_filename_ends_with(dir->name, ".png"))
m_pics.emplace_back(dir->name, length - 4);
}
+ std::collate<wchar_t> const &coll = std::use_facet<std::collate<wchar_t>>(std::locale());
std::stable_sort(
m_pics.begin(),
m_pics.end(),
- [] (std::string const &a, std::string const &b) { return 0 > core_stricmp(a.c_str(), b.c_str()); });
+ [&coll] (auto const &x, auto const &y)
+ {
+ std::wstring const wx = wstring_from_utf8(x);
+ std::wstring const wy = wstring_from_utf8(y);
+ return 0 > coll.compare(wx.data(), wx.data() + wx.size(), wy.data(), wy.data() + wy.size());
+ }
+ );
}
// Make sure to keep these matched to the CROSSHAIR_VISIBILITY_xxx types