From 84f12eea65dd185bc7b849303d515d189efb1642 Mon Sep 17 00:00:00 2001 From: oltolm Date: Mon, 22 Sep 2025 01:25:57 +0200 Subject: [PATCH 1/2] UI: fix sorting after style switch (#1693) --- src/gui/wxgui/components/wxGameList.cpp | 10 +++++++--- src/gui/wxgui/components/wxGameList.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/wxgui/components/wxGameList.cpp b/src/gui/wxgui/components/wxGameList.cpp index f807042c..f760e0b3 100644 --- a/src/gui/wxgui/components/wxGameList.cpp +++ b/src/gui/wxgui/components/wxGameList.cpp @@ -514,6 +514,9 @@ std::weak_ordering wxGameList::SortComparator(uint64 titleId1, uint64 titleId2, return CafeTitleList::GetGameInfo(id).GetRegion(); }; + if (!sortData->asc) + std::swap(titleId1, titleId2); + switch(sortData->column) { default: @@ -542,7 +545,7 @@ std::weak_ordering wxGameList::SortComparator(uint64 titleId1, uint64 titleId2, int wxGameList::SortFunction(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData) { const auto sort_data = (SortData*)sortData; - return sort_data->dir * order_to_int(sort_data->thisptr->SortComparator((uint64)item1, (uint64)item2, sort_data)); + return order_to_int(sort_data->thisptr->SortComparator((uint64)item1, (uint64)item2, sort_data)); } void wxGameList::SortEntries(int column) @@ -566,7 +569,7 @@ void wxGameList::SortEntries(int column) case ColumnRegion: case ColumnTitleID: { - SortData data{this, ItemColumns{column}, ascending ? 1 : -1}; + SortData data{this, ItemColumns{column}, ascending}; SortItems(SortFunction, (wxIntPtr)&data); ShowSortIndicator(column, ascending); break; @@ -1677,7 +1680,8 @@ void wxGameList::CreateShortcut(GameInfo2& gameInfo) hres = shellLinkFile->Save(outputPath.wc_str(), TRUE); } } - if (!SUCCEEDED(hres)) { + if (FAILED(hres)) + { auto errorMsg = formatWxString(_("Failed to save shortcut to {}"), outputPath); wxMessageBox(errorMsg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR); } diff --git a/src/gui/wxgui/components/wxGameList.h b/src/gui/wxgui/components/wxGameList.h index ae2ea245..e4f90ca3 100644 --- a/src/gui/wxgui/components/wxGameList.h +++ b/src/gui/wxgui/components/wxGameList.h @@ -89,7 +89,7 @@ private: { wxGameList* thisptr; ItemColumns column; - int dir; + bool asc; }; int FindInsertPosition(TitleId titleId); From d54fb0ba78ce2ffac3caa399414af19ec1016f05 Mon Sep 17 00:00:00 2001 From: SamoZ256 <96914946+SamoZ256@users.noreply.github.com> Date: Sat, 27 Sep 2025 00:41:17 +0200 Subject: [PATCH 2/2] arm: flush denormals to zero (#1696) --- src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp b/src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp index 2f89000b..19391bbd 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp @@ -15,6 +15,33 @@ #include "util/helpers/helpers.h" +#ifdef __arm64__ +#if defined(__clang__) +#include +#elif defined(_MSC_VER) +#include +#endif +#endif + +namespace { + +void enableFlushDenormalsToZero() +{ +#if defined(ARCH_X86_64) + _mm_setcsr(_mm_getcsr() | 0x8000); +#elif defined(__arm64__) +#if defined(__clang__) + __arm_wsr64("fpcr", __arm_rsr64("fpcr") | (1 << 24)); +#elif defined(__GNUC__) + __builtin_aarch64_set_fpcr(__builtin_aarch64_get_fpcr() | (1 << 24)); +#elif defined(_MSC_VER) + _WriteStatusReg(ARM64_FPCR, _ReadStatusReg(ARM64_FPCR) | (1 << 24)); +#endif +#endif +} + +} + SlimRWLock srwlock_activeThreadList; // public list of active threads @@ -1321,9 +1348,7 @@ namespace coreinit #endif OSHostThread* hostThread = (OSHostThread*)_thread; - #if defined(ARCH_X86_64) - _mm_setcsr(_mm_getcsr() | 0x8000); // flush denormals to zero - #endif + enableFlushDenormalsToZero(); PPCInterpreter_t* hCPU = &hostThread->ppcInstance; __OSLoadThread(hostThread->m_thread, hCPU, hostThread->selectedCore); @@ -1369,9 +1394,8 @@ namespace coreinit { SetThreadName(fmt::format("OSSched[core={}]", (uintptr_t)_assignedCoreIndex).c_str()); t_assignedCoreIndex = (sint32)(uintptr_t)_assignedCoreIndex; - #if defined(ARCH_X86_64) - _mm_setcsr(_mm_getcsr() | 0x8000); // flush denormals to zero - #endif + + enableFlushDenormalsToZero(); #if BOOST_OS_LINUX if (g_gdbstub)