diff options
author | Anuskuss | 2022-09-12 16:50:50 +0200 |
---|---|---|
committer | Anuskuss | 2022-09-12 16:50:50 +0200 |
commit | 9c02d24480abdd5d60178089b9e3b75d627643a4 (patch) | |
tree | b60ccf3a280aa9756236fbb352bfb8a801ac05a8 | |
parent | 2233bd4934677add244b0c8a0f1ceb5fc886a199 (diff) | |
download | aur-9c02d24480abdd5d60178089b9e3b75d627643a4.tar.gz |
Added gamelist improvement and updated to latest version
-rw-r--r-- | .SRCINFO | 14 | ||||
-rw-r--r-- | PKGBUILD | 26 | ||||
-rw-r--r-- | dark.diff | 8 | ||||
-rw-r--r-- | dsu.diff | 85 | ||||
-rw-r--r-- | gamelist.diff | 462 | ||||
-rw-r--r-- | xdg.diff | 91 |
6 files changed, 569 insertions, 117 deletions
@@ -1,7 +1,7 @@ pkgbase = cemu pkgdesc = Software to emulate Wii U games and applications on PC (with cutting edge Linux patches) - pkgver = 2.0.116 - pkgrel = 2 + pkgver = 2.0.121 + pkgrel = 1 url = https://cemu.info install = cemu.install arch = x86_64 @@ -23,7 +23,7 @@ pkgbase = cemu depends = libpng depends = wxwidgets-gtk3>=3.2 optdepends = vulkan-driver: Vulkan graphics - source = git+https://github.com/cemu-project/Cemu#commit=3349d7b4245e9bee862ee53a04196357fbedc99d + source = git+https://github.com/cemu-project/Cemu#commit=6cf5dc9a569315969aeaec71f058b4fa8bf16993 source = imgui-1.88.tar.gz::https://github.com/ocornut/imgui/archive/refs/tags/v1.88.tar.gz source = imgui.cmake::https://raw.githubusercontent.com/microsoft/vcpkg/master/ports/imgui/CMakeLists.txt source = imgui.conf::https://raw.githubusercontent.com/microsoft/vcpkg/master/ports/imgui/imgui-config.cmake.in @@ -33,8 +33,8 @@ pkgbase = cemu source = git+https://github.com/google/googletest#commit=800f5422ac9d9e0ad59cd860a2ef3a679588acb4 source = xdg.diff source = overlay.diff - source = dsu.diff source = dark.diff + source = gamelist.diff sha256sums = SKIP sha256sums = 9f14c788aee15b777051e48f868c5d4d959bd679fc5050e3d2a29de80d8fd32e sha256sums = 262faed507149c89aab7572fd2c2a968f843ca2900043e30a9c339735ed08a8f @@ -43,9 +43,9 @@ pkgbase = cemu sha256sums = SKIP sha256sums = SKIP sha256sums = SKIP - sha256sums = 4061e28533d391ebc4745cdc47470438b20c64dd11f7308e5acf35d0fbc54326 + sha256sums = 8c108b92d641b404d753b72aecfd7ebfa7609f84e8fa4b1318227a5a33bbe240 sha256sums = f25d13fe76cc6a0b475f0131211a951288160ddae92cd7a815f5aea61d7cfc0f - sha256sums = 9af0cb88f07acad70aa5b7133ccbbaddacca542edea5817e622b4571cc26046d - sha256sums = 15243ffa555559ade19cdb99d42dc10a6b4d1402c9cee045a623dd4b30827a1d + sha256sums = e6209279267e6b3f2550248d6992042b23eeec2501f3df31feb9c4b1fbf2aa15 + sha256sums = c28de51af46ac88d5db4ecae8626b9087f2a34503ced51b25498cbbf7eba306c pkgname = cemu @@ -1,7 +1,7 @@ # Maintainer: Anuskuss <anuskuss@googlemail.com> pkgname=cemu -pkgver=2.0.116 -pkgrel=2 +pkgver=2.0.121 +pkgrel=1 pkgdesc='Software to emulate Wii U games and applications on PC (with cutting edge Linux patches)' arch=(x86_64) url=https://cemu.info @@ -25,7 +25,7 @@ optdepends=( ) install=cemu.install source=( - git+https://github.com/cemu-project/Cemu#commit=3349d7b4245e9bee862ee53a04196357fbedc99d + git+https://github.com/cemu-project/Cemu#commit=6cf5dc9a569315969aeaec71f058b4fa8bf16993 # dependencies imgui-1.88.tar.gz::https://github.com/ocornut/imgui/archive/refs/tags/v1.88.tar.gz imgui.cmake::https://raw.githubusercontent.com/microsoft/vcpkg/master/ports/imgui/CMakeLists.txt @@ -39,10 +39,10 @@ source=( git+https://github.com/arsenm/sanitizers-cmake#commit=aab6948fa863bc1cbe5d0850bc46b9ef02ed4c1a git+https://github.com/google/googletest#commit=800f5422ac9d9e0ad59cd860a2ef3a679588acb4 # patches - xdg.diff # 963f9b38349c5d03b26ab2a50ead2ee4e743ca41 + xdg.diff # 00dbe939f29c6fa6670a6f71946e52b520d51033 overlay.diff # edeb14d4c68ee8bf500b990b13079177e01c25f1 - dsu.diff # dbe8c94dd427585fc2f0c49947fa2d8051d8f218 + 56b140f159f3322cce00bb87f34274d1f62c314b - dark.diff # 557d25c0525fd0dd662f41529c60fb9d722e5a0e + dark.diff # 9a1f7bede33ef2ba334d4d318fd6742512dd7759 + gamelist.diff # 182b40d38964a4c296127c5eb4497b5cccc01802 ) sha256sums=( SKIP @@ -53,10 +53,10 @@ sha256sums=( SKIP SKIP SKIP - 4061e28533d391ebc4745cdc47470438b20c64dd11f7308e5acf35d0fbc54326 + 8c108b92d641b404d753b72aecfd7ebfa7609f84e8fa4b1318227a5a33bbe240 f25d13fe76cc6a0b475f0131211a951288160ddae92cd7a815f5aea61d7cfc0f - 9af0cb88f07acad70aa5b7133ccbbaddacca542edea5817e622b4571cc26046d - 15243ffa555559ade19cdb99d42dc10a6b4d1402c9cee045a623dd4b30827a1d + e6209279267e6b3f2550248d6992042b23eeec2501f3df31feb9c4b1fbf2aa15 + c28de51af46ac88d5db4ecae8626b9087f2a34503ced51b25498cbbf7eba306c ) pkgver() { @@ -105,12 +105,12 @@ prepare() { rm -rf src/util/SystemInfo git apply "$srcdir/overlay.diff" - # experimental: dsu controller (https://github.com/cemu-project/Cemu/pull/234) - rm -f src/input/api/DSU/ReceiveTimeoutSocketOption.h - git apply "$srcdir/dsu.diff" - # experimental: dark mode fix (https://github.com/cemu-project/Cemu/pull/241) git apply "$srcdir/dark.diff" + sed -i 's/wxSYS_COLOUR_MENUHILIGHT/wxSYS_COLOUR_MENU/' src/gui/components/wxGameList.cpp + + # experimental: gamelist auto resize (https://github.com/cemu-project/Cemu/pull/214) + git apply "$srcdir/gamelist.diff" } build() { diff --git a/dark.diff b/dark.diff index ac6baba6b11d..ecd1fad180be 100644 --- a/dark.diff +++ b/dark.diff @@ -11,14 +11,14 @@ else if ((i&1) != 0) - SetItemBackgroundColour(i, kSecondColor); + { -+ SetItemBackgroundColour(i, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); -+ SetItemTextColour(i, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); ++ SetItemBackgroundColour(i, wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR)); ++ SetItemTextColour(i, wxSystemSettings::GetColour(wxSYS_COLOUR_MENUTEXT)); + } else - SetItemBackgroundColour(i, 0xFFFFFFUL); + { -+ SetItemBackgroundColour(i, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWFRAME)); -+ SetItemTextColour(i, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); ++ SetItemBackgroundColour(i, wxSystemSettings::GetColour(wxSYS_COLOUR_MENUHILIGHT)); ++ SetItemTextColour(i, wxSystemSettings::GetColour(wxSYS_COLOUR_MENUTEXT)); + } } } diff --git a/dsu.diff b/dsu.diff deleted file mode 100644 index 61e3e639a1ff..000000000000 --- a/dsu.diff +++ /dev/null @@ -1,85 +0,0 @@ ---- a/src/input/CMakeLists.txt -+++ b/src/input/CMakeLists.txt -@@ -43,6 +43,7 @@ target_sources(CemuInput PRIVATE - api/DSU/DSUControllerProvider.h - api/DSU/DSUMessages.h - api/DSU/DSUMessages.cpp -+ api/DSU/ReceiveTimeoutSocketOption.h - ) - - # Keyboard controller ---- a/src/input/api/DSU/DSUController.cpp -+++ b/src/input/api/DSU/DSUController.cpp -@@ -164,5 +164,8 @@ ControllerState DSUController::raw_state() - result.rotation.y = (float)state.data.ry / std::numeric_limits<uint8>::max(); - result.rotation.y = (result.rotation.y * 2.0f) - 1.0f; - -- return result; -+ result.trigger.x = (float)state.data.l2 / std::numeric_limits<uint8>::max(); -+ result.trigger.y = (float)state.data.r2 / std::numeric_limits<uint8>::max(); -+ -+ return result; - } ---- a/src/input/api/DSU/DSUControllerProvider.cpp -+++ b/src/input/api/DSU/DSUControllerProvider.cpp -@@ -1,5 +1,6 @@ - #include "input/api/DSU/DSUControllerProvider.h" - #include "input/api/DSU/DSUController.h" -+#include "input/api/DSU/ReceiveTimeoutSocketOption.h" - - DSUControllerProvider::DSUControllerProvider() - : base_type(), m_uid(rand()), m_socket(m_io_service) -@@ -77,8 +78,9 @@ bool DSUControllerProvider::connect() - m_socket.close(); - - m_socket.open(ip::udp::v4()); -+ - // set timeout for our threads to give a chance to exit -- m_socket.set_option(boost::asio::detail::socket_option::integer<SOL_SOCKET, SO_RCVTIMEO>{200}); -+ m_socket.set_option(ReceiveTimeoutSocketOption{200}); - - // reset data - m_state = {}; ---- /dev/null -+++ b/src/input/api/DSU/ReceiveTimeoutSocketOption.h -@@ -0,0 +1,39 @@ -+#pragma once -+ -+#if BOOST_OS_WINDOWS -+#include <boost/asio/detail/socket_option.hpp> -+#include <winsock2.h> // For SOL_SOCKET, SO_RCVTIMEO -+using ReceiveTimeoutSocketOption = boost::asio::detail::socket_option::integer<SOL_SOCKET, SO_RCVTIMEO>; -+#elif BOOST_OS_LINUX || BOOST_OS_MACOS -+ -+class ReceiveTimeoutSocketOption { -+ timeval m_data; // POSIX only allows timeeval to be parameter to option SO_RCVTIMEO -+public: -+ constexpr explicit ReceiveTimeoutSocketOption(int time_ms) -+ : m_data(timeval{.tv_usec = time_ms * 1000}){ -+ } -+ ReceiveTimeoutSocketOption& operator=(int time_ms){ -+ m_data = timeval{.tv_usec = time_ms * 1000}; -+ return *this; -+ } -+ template <typename Protocol> -+ int level(const Protocol&) const { -+ return SOL_SOCKET; -+ } -+ -+ template <typename Protocol> -+ int name(const Protocol&) const { -+ return SO_RCVTIMEO; -+ } -+ -+ template <typename Protocol> -+ const timeval* data(Protocol&) const { -+ return &m_data; -+ } -+ -+ template <typename Protocol> -+ std::size_t size(const Protocol&) const { -+ return sizeof(timeval); -+ } -+}; -+#endif -\ No newline at end of file diff --git a/gamelist.diff b/gamelist.diff new file mode 100644 index 000000000000..c5f03adcbb8d --- /dev/null +++ b/gamelist.diff @@ -0,0 +1,462 @@ +--- a/src/config/CemuConfig.cpp ++++ b/src/config/CemuConfig.cpp +@@ -89,12 +89,26 @@ void CemuConfig::Load(XMLConfigParser& parser) + auto gamelist = parser.get("GameList"); + game_list_style = gamelist.get("style", 0); + game_list_column_order = gamelist.get("order", ""); +- column_width.name = gamelist.get("name_width", -3); +- column_width.version = gamelist.get("version_width", -3); +- column_width.dlc = gamelist.get("dlc_width", -3); +- column_width.game_time = gamelist.get("game_time_width", -3); +- column_width.game_started = gamelist.get("game_started_width", -3); +- column_width.region = gamelist.get("region_width", -3); ++ ++ /* ++ * gamelist.get() relies on TinyXML that itself relies on sscanf to read ++ * data. sscanf does succeed when reading a negative number into a ++ * uint32, it's simply cast to an unsigned. This is not what we want ++ * so we read the signed integer and return the default column width if ++ * the value in the config is negative. ++ */ ++ auto loadColumnSize = [&gamelist] (const char *name, uint32 defaultWidth) { ++ sint64 val = gamelist.get(name, DefaultColumnSize::name); ++ if (val < 0 || val > (sint64) std::numeric_limits<uint32>::max) ++ return defaultWidth; ++ return static_cast<uint32>(val); ++ }; ++ column_width.name = loadColumnSize("name_width", DefaultColumnSize::name); ++ column_width.version = loadColumnSize("version_width", DefaultColumnSize::version); ++ column_width.dlc = loadColumnSize("dlc_width", DefaultColumnSize::dlc); ++ column_width.game_time = loadColumnSize("game_time_width", DefaultColumnSize::game_time); ++ column_width.game_started = loadColumnSize("game_started_width", DefaultColumnSize::game_started); ++ column_width.region = loadColumnSize("region_width", DefaultColumnSize::region); + + recent_launch_files.clear(); + auto launch_parser = parser.get("RecentLaunchFiles"); +--- a/src/config/CemuConfig.h ++++ b/src/config/CemuConfig.h +@@ -307,6 +307,16 @@ struct fmt::formatter<CrashDump> : formatter<string_view> { + } + }; + ++namespace DefaultColumnSize { ++ enum : uint32 { ++ name = 500u, ++ version = 60u, ++ dlc = 50u, ++ game_time = 140u, ++ game_started = 160u, ++ region = 80u, ++ }; ++}; + + struct CemuConfig + { +@@ -375,7 +385,12 @@ struct CemuConfig + std::string game_list_column_order; + struct + { +- int name = -3, version = -3, dlc = -3, game_time = -3, game_started = -3, region = -3; ++ uint32 name = DefaultColumnSize::name; ++ uint32 version = DefaultColumnSize::version; ++ uint32 dlc = DefaultColumnSize::dlc; ++ uint32 game_time = DefaultColumnSize::game_time; ++ uint32 game_started = DefaultColumnSize::game_started; ++ uint32 region = DefaultColumnSize::region; + } column_width{}; + + // graphics +--- a/src/gui/components/wxGameList.cpp ++++ b/src/gui/components/wxGameList.cpp +@@ -6,13 +6,14 @@ + + #include <numeric> + +-#include <wx/wupdlock.h> ++#include <wx/imaglist.h> + #include <wx/menu.h> + #include <wx/mstream.h> +-#include <wx/imaglist.h> +-#include <wx/textdlg.h> +-#include <wx/stattext.h> ++#include <wx/settings.h> + #include <wx/sizer.h> ++#include <wx/stattext.h> ++#include <wx/textdlg.h> ++#include <wx/wupdlock.h> + + #include <boost/algorithm/string.hpp> + #include <boost/tokenizer.hpp> +@@ -50,7 +51,16 @@ void _stripPathFilename(fs::path& path) + wxGameList::wxGameList(wxWindow* parent, wxWindowID id) + : wxListCtrl(parent, id, wxDefaultPosition, wxDefaultSize, GetStyleFlags(Style::kList)), m_style(Style::kList) + { +- CreateListColumns(); ++ const auto& config = GetConfig(); ++ ++ InsertColumn(ColumnHiddenName, "", wxLIST_FORMAT_LEFT, 0); ++ InsertColumn(ColumnIcon, "", wxLIST_FORMAT_LEFT, kListIconWidth + 8); ++ InsertColumn(ColumnName, _("Game"), wxLIST_FORMAT_LEFT, config.column_width.name); ++ InsertColumn(ColumnVersion, _("Version"), wxLIST_FORMAT_RIGHT, config.column_width.version); ++ InsertColumn(ColumnDLC, _("DLC"), wxLIST_FORMAT_RIGHT, config.column_width.dlc); ++ InsertColumn(ColumnGameTime, _("You've played"), wxLIST_FORMAT_LEFT, config.column_width.game_time); ++ InsertColumn(ColumnGameStarted, _("Last played"), wxLIST_FORMAT_LEFT, config.column_width.game_started); ++ InsertColumn(ColumnRegion, _("Region"), wxLIST_FORMAT_LEFT, config.column_width.region); + + const char transparent_bitmap[kIconWidth * kIconWidth * 4] = {0}; + wxBitmap blank(transparent_bitmap, kIconWidth, kIconWidth); +@@ -82,6 +92,7 @@ wxGameList::wxGameList(wxWindow* parent, wxWindowID id) + Bind(wxEVT_GAME_ENTRY_ADDED_OR_REMOVED, &wxGameList::OnGameEntryUpdatedByTitleId, this); + Bind(wxEVT_TIMER, &wxGameList::OnTimer, this); + Bind(wxEVT_LEAVE_WINDOW, &wxGameList::OnLeaveWindow, this); ++ Bind(wxEVT_SIZE, &wxGameList::OnWindowSize, this); + + Bind(wxEVT_LIST_COL_CLICK, &wxGameList::OnColumnClick, this); + Bind(wxEVT_LIST_COL_BEGIN_DRAG, &wxGameList::OnColumnBeginResize, this); +@@ -124,7 +135,7 @@ void wxGameList::LoadConfig() + if (!config.game_list_column_order.empty()) + { + wxArrayInt order; +- order.reserve(ColumnFavorite); ++ order.reserve(ColumnMax); + + const auto order_string = std::string_view(config.game_list_column_order).substr(1); + +@@ -135,10 +146,10 @@ void wxGameList::LoadConfig() + order.push_back(ConvertString<int>(token, 10)); + } + +- #ifdef wxHAS_LISTCTRL_COLUMN_ORDER +- if(order.GetCount() == ColumnFavorite) ++#ifdef wxHAS_LISTCTRL_COLUMN_ORDER ++ if(order.GetCount() == ColumnMax) + SetColumnsOrder(order); +- #endif ++#endif + } + } + +@@ -147,9 +158,9 @@ void wxGameList::SaveConfig(bool flush) + auto& config = GetConfig(); + + config.game_list_style = (int)m_style; +- #ifdef wxHAS_LISTCTRL_COLUMN_ORDER ++#ifdef wxHAS_LISTCTRL_COLUMN_ORDER + config.game_list_column_order = fmt::format("{}", GetColumnsOrder()); +- #endif ++#endif + + if (flush) + g_config.Save(); +@@ -355,61 +356,7 @@ void wxGameList::SortEntries(int column) + } + } + +-void wxGameList::CreateListColumns() +-{ +- DeleteAllColumns(); +- +- const auto& config = GetConfig(); +- wxListItem col0; +- col0.SetId(ColumnHiddenName); +- col0.SetWidth(0); +- InsertColumn(ColumnHiddenName, col0); +- +- wxListItem col1; +- col1.SetId(ColumnIcon); +- col1.SetWidth(kListIconWidth); +- InsertColumn(ColumnIcon, col1); +- +- wxListItem col2; +- col2.SetId(ColumnName); +- col2.SetText(_("Game")); +- col2.SetWidth(config.column_width.name); +- InsertColumn(ColumnName, col2); +- +- wxListItem col3; +- col3.SetId(ColumnVersion); +- col3.SetText(_("Version")); +- col3.SetWidth(config.column_width.version); +- col3.SetAlign(wxLIST_FORMAT_RIGHT); +- InsertColumn(ColumnVersion, col3); +- +- wxListItem col4; +- col4.SetId(ColumnDLC); +- col4.SetText(_("DLC")); +- col4.SetWidth(config.column_width.dlc); +- col4.SetAlign(wxLIST_FORMAT_RIGHT); +- InsertColumn(ColumnDLC, col4); +- +- wxListItem col5; +- col5.SetId(ColumnGameTime); +- col5.SetText(_("You've played")); +- col5.SetWidth(config.column_width.game_time); +- InsertColumn(ColumnGameTime, col5); +- +- wxListItem col6; +- col6.SetId(ColumnGameStarted); +- col6.SetText(_("Last played")); +- col6.SetWidth(config.column_width.game_started); +- InsertColumn(ColumnGameStarted, col6); +- +- wxListItem col7; +- col7.SetId(ColumnRegion); +- col7.SetText(_("Region")); +- col7.SetWidth(config.column_width.region); +- InsertColumn(ColumnRegion, col7); +-} +- +-void wxGameList::OnKeyDown(wxListEvent& event) ++void wxGameList::OnKeyDown(wxListEvent& event) + { + event.Skip(); + if (m_style != Style::kList) +@@ -642,6 +599,12 @@ void wxGameList::OnContextMenuSelected(wxCommandEvent& event) + } + } + ++void wxGameList::OnWindowSize(wxSizeEvent& event) ++{ ++ AdjustLastColumnWidth(); ++ event.Skip(); ++} ++ + void wxGameList::OnColumnClick(wxListEvent& event) + { + const int column = event.GetColumn(); +@@ -669,17 +632,16 @@ void wxGameList::OnColumnRightClick(wxListEvent& event) + menu.SetClientObject(new wxCustomData(column)); + + menu.Append(ResetWidth, _("Reset &width")); +- menu.Append(ResetOrder, _("Reset &order")) ; +- ++#ifdef wxHAS_LISTCTRL_COLUMN_ORDER ++ menu.Append(ResetOrder, _("Reset &order")); ++#endif + menu.AppendSeparator(); + menu.AppendCheckItem(ShowName, _("Show &name"))->Check(GetColumnWidth(ColumnName) > 0); + menu.AppendCheckItem(ShowVersion, _("Show &version"))->Check(GetColumnWidth(ColumnVersion) > 0); + menu.AppendCheckItem(ShowDlc, _("Show &dlc"))->Check(GetColumnWidth(ColumnDLC) > 0); + menu.AppendCheckItem(ShowGameTime, _("Show &game time"))->Check(GetColumnWidth(ColumnGameTime) > 0); + menu.AppendCheckItem(ShowLastPlayed, _("Show &last played"))->Check(GetColumnWidth(ColumnGameStarted) > 0); +- menu.AppendCheckItem(ColumnRegion, _("Show ®ion"))->Check(GetColumnWidth(ColumnRegion) > 0); +- //menu.AppendSeparator(); +- //menu.Append(ResetOrder, _("&Reset order")); ++ menu.AppendCheckItem(ShowRegion, _("Show ®ion"))->Check(GetColumnWidth(ColumnRegion) > 0); + + menu.Bind(wxEVT_COMMAND_MENU_SELECTED, + [this](wxCommandEvent& event) { +@@ -692,44 +654,44 @@ void wxGameList::OnColumnRightClick(wxListEvent& event) + switch (event.GetId()) + { + case ShowName: +- config.column_width.name = menu->IsChecked(ShowName) ? 500 : 0; ++ config.column_width.name = menu->IsChecked(ShowName) ? DefaultColumnSize::name : 0; + break; + case ShowVersion: +- config.column_width.version = menu->IsChecked(ShowVersion) ? 60 : 0; ++ config.column_width.version = menu->IsChecked(ShowVersion) ? DefaultColumnSize::version : 0; + break; + case ShowDlc: +- config.column_width.dlc = menu->IsChecked(ShowDlc) ? 50 : 0; ++ config.column_width.dlc = menu->IsChecked(ShowDlc) ? DefaultColumnSize::dlc : 0; + break; + case ShowGameTime: +- config.column_width.game_time = menu->IsChecked(ShowGameTime) ? 140 : 0; ++ config.column_width.game_time = menu->IsChecked(ShowGameTime) ? DefaultColumnSize::game_time : 0; + break; + case ShowLastPlayed: +- config.column_width.game_started = menu->IsChecked(ShowLastPlayed) ? 160 : 0; ++ config.column_width.game_started = menu->IsChecked(ShowLastPlayed) ? DefaultColumnSize::game_started : 0; + break; +- case ColumnRegion: +- config.column_width.region = menu->IsChecked(ColumnRegion) ? 80 : 0; ++ case ShowRegion: ++ config.column_width.region = menu->IsChecked(ShowRegion) ? DefaultColumnSize::region : 0; + break; + case ResetWidth: + { + switch (column) + { + case ColumnName: +- config.column_width.name = 500; ++ config.column_width.name = DefaultColumnSize::name; + break; + case ColumnVersion: +- config.column_width.version = 60; ++ config.column_width.version = DefaultColumnSize::version; + break; + case ColumnDLC: +- config.column_width.dlc = 50; ++ config.column_width.dlc = DefaultColumnSize::dlc; + break; + case ColumnGameTime: +- config.column_width.game_time = 140; ++ config.column_width.game_time = DefaultColumnSize::game_time; + break; + case ColumnGameStarted: +- config.column_width.game_started = 160; ++ config.column_width.game_started = DefaultColumnSize::game_started; + break; + case ColumnRegion: +- config.column_width.region = 80; ++ config.column_width.region = DefaultColumnSize::region; + break; + default: + return; +@@ -740,11 +702,11 @@ void wxGameList::OnColumnRightClick(wxListEvent& event) + case ResetOrder: + { + config.game_list_column_order.clear(); +- wxArrayInt order(ColumnFavorite); ++ wxArrayInt order(ColumnMax); + std::iota(order.begin(), order.end(), 0); +- #ifdef wxHAS_LISTCTRL_COLUMN_ORDER ++#ifdef wxHAS_LISTCTRL_COLUMN_ORDER + SetColumnsOrder(order); +- #endif ++#endif + Refresh(); + return; + } +@@ -758,31 +720,60 @@ void wxGameList::OnColumnRightClick(wxListEvent& event) + event.Skip(); + } + ++void wxGameList::AdjustLastColumnWidth() ++{ ++ int totalWidth = 0; ++ int lastColumn = 0; ++ size_t size; ++ ++#ifdef wxHAS_LISTCTRL_COLUMN_ORDER ++ wxArrayInt order = GetColumnsOrder(); ++ size = order.GetCount(); ++#else ++ std::vector<int> order(ColumnMax); ++ std::iota(order.begin(), order.end(), 0); ++ size = ColumnMax; ++#endif ++ for (size_t i = 0; i < size; ++i) { ++#ifdef wxHAS_LISTCTRL_COLUMN_ORDER ++ int colNum = order.Item(i); ++#else ++ int colNum = order[i]; ++#endif ++ int colWidth = GetColumnWidth(colNum); ++ if (colWidth > 0) { ++ totalWidth += colWidth; ++ lastColumn = colNum; ++ } ++ } ++ ++ totalWidth -= GetColumnWidth(lastColumn); ++ int colWidth = GetClientSize().GetWidth() - totalWidth; ++ if (colWidth > 50) ++ SetColumnWidth(lastColumn, colWidth); ++} ++ + void wxGameList::ApplyGameListColumnWidths() + { +- auto set_width = [this](int id, int width) +- { +- if (width == -3) +- wxAutosizeColumn(this, id); +- else +- this->SetColumnWidth(id, width); +- }; +- + const auto& config = GetConfig(); + wxWindowUpdateLocker lock(this); +- set_width(ColumnName, config.column_width.name); +- set_width(ColumnVersion, config.column_width.version); +- set_width(ColumnDLC, config.column_width.dlc); +- set_width(ColumnGameTime, config.column_width.game_time); +- set_width(ColumnGameStarted, config.column_width.game_started); +- set_width(ColumnRegion, config.column_width.region); ++ ++ SetColumnWidth(ColumnIcon, kListIconWidth + 8); ++ SetColumnWidth(ColumnName, config.column_width.name); ++ SetColumnWidth(ColumnVersion, config.column_width.version); ++ SetColumnWidth(ColumnDLC, config.column_width.dlc); ++ SetColumnWidth(ColumnGameTime, config.column_width.game_time); ++ SetColumnWidth(ColumnGameStarted, config.column_width.game_started); ++ SetColumnWidth(ColumnRegion, config.column_width.region); ++ ++ AdjustLastColumnWidth(); + } + + void wxGameList::OnColumnBeginResize(wxListEvent& event) + { + const int column = event.GetColumn(); + const int width = GetColumnWidth(column); +- if (width == 0) ++ if (width == 0 || column == ColumnIcon) + event.Veto(); + else + event.Skip(); +@@ -812,21 +803,18 @@ void wxGameList::OnColumnResize(wxListEvent& event) + case ColumnGameStarted: + config.column_width.game_started = width; + break; ++ case ColumnRegion: ++ config.column_width.region = width; ++ break; ++ + default: + return; + } ++ AdjustLastColumnWidth(); + + g_config.Save(); + } + +-void wxGameList::OnColumnDrag(wxListEvent& event) +-{ +- const auto column = event.GetColumn(); +- const auto width = GetColumnWidth(column); +- if (column == ColumnHiddenName || width == 0) +- event.Veto(); +-} +- + void wxGameList::OnClose(wxCloseEvent& event) + { + event.Skip(); +@@ -837,8 +825,6 @@ int wxGameList::FindInsertPosition(TitleId titleId) + { + SortData data{ this, s_last_column, s_direction }; + const auto itemCount = GetItemCount(); +- if (itemCount == 0) +- return 0; + // todo - optimize this with binary search + + for (int i = 0; i < itemCount; i++) +--- a/src/gui/components/wxGameList.h ++++ b/src/gui/components/wxGameList.h +@@ -74,7 +74,8 @@ private: + ColumnGameTime, + ColumnGameStarted, + ColumnRegion, +- ColumnFavorite ++ ++ ColumnMax + }; + + int s_last_column = ColumnName; +@@ -124,14 +125,13 @@ private: + std::map<TitleId, std::string> m_name_cache; + + // list mode +- void CreateListColumns(); +- ++ void OnWindowSize(wxSizeEvent& event); + void OnColumnClick(wxListEvent& event); + void OnColumnRightClick(wxListEvent& event); ++ void AdjustLastColumnWidth(); + void ApplyGameListColumnWidths(); + void OnColumnBeginResize(wxListEvent& event); + void OnColumnResize(wxListEvent& event); +- void OnColumnDrag(wxListEvent& event); + + // generic events + void OnKeyDown(wxListEvent& event); @@ -402,9 +402,17 @@ +} --- a/src/config/ActiveSettings.h +++ b/src/config/ActiveSettings.h -@@ -13,6 +13,11 @@ public: +@@ -7,25 +7,30 @@ class ActiveSettings + { + public: + static void LoadOnce(); +- ++ + [[nodiscard]] static fs::path GetFullPath() { return s_full_path; } + [[nodiscard]] static fs::path GetPath() { return s_path; } [[nodiscard]] static fs::path GetFilename() { return s_filename; } - +- ++ [[nodiscard]] static fs::path GetMlcPath(); + [[nodiscard]] static fs::path GetCachePath(); + [[nodiscard]] static fs::path GetConfigPath(); @@ -412,12 +420,57 @@ + [[nodiscard]] static fs::path GetSystemDataPath(); + [[nodiscard]] static std::string GetXDGPath(const char* envVar, const std::string& defaultValue); - [[nodiscard]] static fs::path GetPath(std::string_view p) +- [[nodiscard]] static fs::path GetPath(std::string_view p) ++ [[nodiscard]] static fs::path GetPath(std::string_view p) + { + std::basic_string_view<char8_t> s((const char8_t*)p.data(), p.size()); + return s_path / fs::path(s); + } + +- [[nodiscard]] static fs::path GetMlcPath(std::string_view p) +- { ++ [[nodiscard]] static fs::path GetMlcPath(std::string_view p) ++ { + std::basic_string_view<char8_t> s((const char8_t*)p.data(), p.size()); + return GetMlcPath() / fs::path(s); + } +- ++ + template <typename ...TArgs> + [[nodiscard]] static fs::path GetPath(std::string_view format, TArgs&&... args) + { +@@ -34,14 +39,14 @@ public: + std::basic_string_view<char8_t> s((const char8_t*)tmpPathStr.data(), tmpPathStr.size()); + return s_path / fs::path(s); + } +- ++ + template <typename ...TArgs> + [[nodiscard]] static fs::path GetPath(std::wstring_view format, TArgs&&... args) + { + cemu_assert_debug(format.empty() || (format[0] != L'/' && format[0] != L'\\')); +- return s_path / fmt::format(format, std::forward<TArgs>(args)...); ++ return s_path / fmt::format(fmt::runtime(format), std::forward<TArgs>(args)...); + } +- ++ + template <typename ...TArgs> + [[nodiscard]] static fs::path GetMlcPath(std::string_view format, TArgs&&... args) + { +@@ -49,14 +54,70 @@ public: + auto tmp = fmt::format(fmt::runtime(format), std::forward<TArgs>(args)...); + return GetMlcPath() / _utf8ToPath(tmp); + } +- ++ + template <typename ...TArgs> + [[nodiscard]] static fs::path GetMlcPath(std::wstring_view format, TArgs&&... args) { -@@ -57,6 +62,62 @@ public: + cemu_assert_debug(format.empty() || (format[0] != L'/' && format[0] != L'\\')); return GetMlcPath() / fmt::format(fmt::runtime(format), std::forward<TArgs>(args)...); } - +- ++ + template <typename ...TArgs> + [[nodiscard]] static fs::path GetCachePath(std::string_view format, TArgs&&... args) + { @@ -477,6 +530,28 @@ // get mlc path to default cemu root dir/mlc01 [[nodiscard]] static fs::path GetDefaultMLCPath(); +@@ -66,18 +127,18 @@ private: + inline static fs::path s_filename; // cemu.exe + inline static fs::path s_mlc_path; + +-public: ++public: + // general + [[nodiscard]] static bool LoadSharedLibrariesEnabled(); + [[nodiscard]] static bool DisplayDRCEnabled(); + [[nodiscard]] static bool FullscreenEnabled(); +- ++ + // cpu + [[nodiscard]] static CPUMode GetCPUMode(); + [[nodiscard]] static uint8 GetTimerShiftFactor(); + + static void SetTimerShiftFactor(uint8 shiftFactor); +- ++ + // gpu + [[nodiscard]] static PrecompiledShaderOption GetPrecompiledShadersOption(); + [[nodiscard]] static bool RenderUpsideDownEnabled(); @@ -126,4 +187,3 @@ private: inline static bool s_has_required_online_files = false; @@ -493,7 +568,7 @@ wxMessageBox(_("Cemu can't write to its directory.\nPlease move it to a different location or run Cemu as administrator!"), _("Warning"), wxOK | wxCENTRE | wxICON_EXCLAMATION, nullptr); auto& config = GetConfig(); -@@ -183,7 +183,7 @@ int CemuApp::FilterEvent(wxEvent& event) +@@ -187,7 +187,7 @@ int CemuApp::FilterEvent(wxEvent& event) std::vector<const wxLanguageInfo*> CemuApp::GetAvailableLanguages() { @@ -502,7 +577,7 @@ if (!exists(path)) return {}; -@@ -308,11 +308,15 @@ void CemuApp::CreateDefaultFiles(bool first_start) +@@ -312,11 +312,15 @@ void CemuApp::CreateDefaultFiles(bool first_start) // cemu directories try { @@ -520,7 +595,7 @@ if (!fs::exists(memorySearcherFolder)) fs::create_directories(memorySearcherFolder); } -@@ -399,4 +403,3 @@ void CemuApp::ActivateApp(wxActivateEvent& event) +@@ -403,4 +407,3 @@ void CemuApp::ActivateApp(wxActivateEvent& event) event.Skip(); } |