diff --git a/.ci/scripts/android/build.sh b/.ci/scripts/android/build.sh index 935919b6de..885ebfee4c 100755 --- a/.ci/scripts/android/build.sh +++ b/.ci/scripts/android/build.sh @@ -7,6 +7,8 @@ export NDK_CCACHE="$(which ccache)" ccache -s +git submodule update --init --recursive + BUILD_FLAVOR="mainline" BUILD_TYPE="release" diff --git a/.ci/scripts/clang/docker.sh b/.ci/scripts/clang/docker.sh index 57fbb97544..d59f672087 100755 --- a/.ci/scripts/clang/docker.sh +++ b/.ci/scripts/clang/docker.sh @@ -7,7 +7,9 @@ # Exit on error, rather than continuing with the rest of the script. set -e -ccache -sv +ccache -s + +git submodule update --init --recursive mkdir build || true && cd build cmake .. \ diff --git a/.ci/scripts/linux/docker.sh b/.ci/scripts/linux/docker.sh index 82432bd835..9854429257 100755 --- a/.ci/scripts/linux/docker.sh +++ b/.ci/scripts/linux/docker.sh @@ -6,7 +6,9 @@ # Exit on error, rather than continuing with the rest of the script. set -e -ccache -sv +ccache -s + +git submodule update --init --recursive mkdir build || true && cd build cmake .. \ @@ -52,9 +54,9 @@ DESTDIR="$PWD/AppDir" ninja install rm -vf AppDir/usr/bin/suyu-cmd AppDir/usr/bin/suyu-tester # Download tools needed to build an AppImage -wget -nc https://gitlab.com/suyu-emu/ext-linux-bin/-/raw/main/appimage/deploy-linux.sh -wget -nc https://gitlab.com/suyu-emu/ext-linux-bin/-/raw/main/appimage/exec-x86_64.so -wget -nc https://gitlab.com/suyu-emu/AppImageKit-checkrt/-/raw/old/AppRun.sh +wget -nc https://git.suyu.dev/suyu/ext-linux-bin/raw/branch/main/appimage/deploy-linux.sh +wget -nc https://git.suyu.dev/suyu/ext-linux-bin/raw/branch/main/appimage/exec-x86_64.so +wget -nc https://git.suyu.dev/suyu/AppImageKit-checkrt/raw/branch/gh-workflow/AppRun # Set executable bit chmod 755 \ diff --git a/.ci/scripts/windows/docker.sh b/.ci/scripts/windows/docker.sh index 73e000324c..ba40e5dbbb 100755 --- a/.ci/scripts/windows/docker.sh +++ b/.ci/scripts/windows/docker.sh @@ -8,7 +8,9 @@ set -e #cd /suyu -ccache -sv +ccache -s + +git submodule update --init --recursive rm -rf build mkdir -p build && cd build diff --git a/.forgejo/workflows/verify.yml b/.forgejo/workflows/verify.yml index c858448468..aebb79e616 100644 --- a/.forgejo/workflows/verify.yml +++ b/.forgejo/workflows/verify.yml @@ -8,7 +8,7 @@ name: 'suyu verify' on: pull_request: - branches: [ "dev" ] + # branches: [ "dev" ] paths: - 'src/**' - 'CMakeModules/**' @@ -19,7 +19,7 @@ on: # paths-ignore: # - 'src/android/**' push: - branches: [ "dev" ] + # branches: [ "dev" ] paths: - 'src/**' - 'CMakeModules/**' diff --git a/CMakeLists.txt b/CMakeLists.txt index cbeb2ee689..67bdf6afe9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -279,8 +279,6 @@ endif() # Configure C++ standard # =========================== -# boost asio's concept usage doesn't play nicely with some compilers yet. -add_definitions(-DBOOST_ASIO_DISABLE_CONCEPTS) if (MSVC) add_compile_options($<$:/std:c++20>) diff --git a/MIGRATION.md b/MIGRATION.md index 425e301136..3963b5004f 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,3 +1,7 @@ + # Migrating from yuzu When coming from yuzu, the migration is as easy as renaming some directories. diff --git a/README.md b/README.md index 6fa5ed4d2e..6211f5f1c2 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,10 @@ SPDX-License-Identifier: GPL-3.0-or-later **Note**: We do not support or condone piracy in any form. In order to use suyu, you'll need keys from your real Switch system, and games which you have legally obtained and paid for. We do not intend to make money or profit from this project. -We're in need of developers. Please join our chat below if you want to contribute! -This repo was based on Yuzu EA 4176 but the code is being rewritten from the ground up for legal and performance reasons. +We're in need of developers. Please join our chat below or DM a dev if you want to contribute! +This repo is currently based on Yuzu EA 4176 but the code will be rewritten for legal and performance reasons. +Our only website is suyu.dev so please be cautious when using other sites offering builds/downloads.
@@ -22,12 +23,13 @@ This repo was based on Yuzu EA 4176 but the code is being rewritten from the gro

suyu was the continuation of the world's most popular, open-source Nintendo Switch emulator, yuzu, but is now something more.
-It is written in C++ with portability in mind, and we actively provide builds for Windows, Linux, Android and iOS potentially coming soon. +It is written in C++ with portability in mind, and we actively provide builds for Windows, Linux and Android, iOS may come later.

Chat | + Reddit | Status | Development | Downloads | @@ -54,7 +56,7 @@ We currently have builds over at the [Releases](https://git.suyu.dev/suyu/suyu/r This project is completely free and open source, and anyone can contribute to help improve suyu. -Most of the development happens on the Git. For development discussion, please join us in our [Chat](https://chat.suyu.dev) or contact a developer. +Most of the development happens on Git. For development discussion, please join us in our [Chat](https://chat.suyu.dev) or [Subreddit](reddit.com/r/suyu/), you can also contact a developer. If you want to contribute, please take a look at the [Contributor's Guide](https://git.suyu.dev/suyu/suyu/wiki/Contributing) and [Developer Information](https://git.suyu.dev/suyu/suyu/wiki/Developer-Information). You can also contact any of the developers on the Chat to learn more about the current state of suyu. @@ -65,25 +67,27 @@ You can also contact any of the developers on the Chat to learn more about the c * __Linux__: [Releases](https://git.suyu.dev/suyu/suyu/releases) * __macOS__: [Releases](https://git.suyu.dev/suyu/suyu/releases) * __Android__: [Releases](https://git.suyu.dev/suyu/suyu/releases) -###### We currently do not provide builds for iOS, however if you would like, you could try the experimental [Sudachi](https://github.com/emuPlace/Sudachi/releases)/[Folium](https://github.com/jarrodnorwell/Folium/releases). +###### We currently do not provide builds for iOS, however if you would like, you could try the experimental [Sudachi Emulator](https://sudachi.emuplace.app/) and it's bigger project: [Folium](https://apps.apple.com/us/app/folium/id6498623389). If you want daily builds then [Click here](https://git.suyu.dev/suyu/suyu/actions). If you don't know how to download the daily builds then [Click here](https://git.suyu.dev/suyu/suyu/raw/branch/dev/img/daily-builds.png) -We have official builds [here.](https://git.suyu.dev/suyu/suyu/releases)
If any website or person is claiming to have a build for suyu, take that with a grain of salt. +We have official builds [here.](https://git.suyu.dev/suyu/suyu/releases)
If any website or person is claiming to have a build for suyu, take that with a grain of salt and let us know. + +For Multiplayer, we recommend using the "Yuzu Online" patch, install instructions can be found on Reddit and their Discord. ## Building * __Windows__: [Windows Build](https://git.suyu.dev/suyu/suyu/wiki/Building-For-Windows) * __Linux__: [Linux Build](https://git.suyu.dev/suyu/suyu/wiki/Building-For-Linux) * __Android__: [Android Build](https://git.suyu.dev/suyu/suyu/wiki/Building-For-Android) -* __macOS__: [macOS Build](https://git.suyu.dev/suyu/suyu/wiki/Building-for-macOS) +* __MacOS__: [MacOS Build](https://git.suyu.dev/suyu/suyu/wiki/Building-for-macOS) ## Support -If you have any questions, don't hesitate to ask us in our [chat](https://chat.suyu.dev), make an issue or contact a developer. We don't bite! +If you have any questions, don't hesitate to ask us in our [Chat](https://chat.suyu.dev) or [Subreddit](https://www.reddit.com/r/suyu/), make an issue or contact a developer. We don't bite! ## License diff --git a/img/need to fix bugs.png b/img/need to fix bugs.png new file mode 100644 index 0000000000..124c55c91a Binary files /dev/null and b/img/need to fix bugs.png differ diff --git a/src/audio_core/common/feature_support.h b/src/audio_core/common/feature_support.h index e71905ae84..e2e00769c2 100644 --- a/src/audio_core/common/feature_support.h +++ b/src/audio_core/common/feature_support.h @@ -13,7 +13,7 @@ #include "common/polyfill_ranges.h" namespace AudioCore { -constexpr u32 CurrentRevision = 11; +constexpr u32 CurrentRevision = 12; enum class SupportTags { CommandProcessingTimeEstimatorVersion4, diff --git a/src/audio_core/device/audio_buffers.h b/src/audio_core/device/audio_buffers.h index 9e84a9c059..6e5e27ae3d 100644 --- a/src/audio_core/device/audio_buffers.h +++ b/src/audio_core/device/audio_buffers.h @@ -54,7 +54,8 @@ public: const s32 to_register{std::min(std::min(appended_count, BufferAppendLimit), BufferAppendLimit - registered_count)}; - for (s32 i = 0; i < to_register; i++) { + out_buffers.reserve(to_register); + for (s32 i = 0; i < to_register; ++i) { s32 index{appended_index - appended_count}; if (index < 0) { index += N; @@ -180,6 +181,7 @@ public: return 0; } + buffers_flushed.reserve(registered_count + appended_count); while (registered_count > 0) { auto index{registered_index - registered_count}; if (index < 0) { diff --git a/src/common/logging/formatter.h b/src/common/logging/formatter.h index 88e55505de..16bddde8fe 100644 --- a/src/common/logging/formatter.h +++ b/src/common/logging/formatter.h @@ -14,7 +14,7 @@ template struct fmt::formatter, char>> : formatter> { template - auto format(const T& value, FormatContext& ctx) -> decltype(ctx.out()) { + auto format(const T& value, FormatContext& ctx) const -> decltype(ctx.out()) { return fmt::formatter>::format( static_cast>(value), ctx); } diff --git a/src/common/typed_address.h b/src/common/typed_address.h index d5e743583d..a1deb89a04 100644 --- a/src/common/typed_address.h +++ b/src/common/typed_address.h @@ -262,7 +262,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Common::PhysicalAddress& addr, FormatContext& ctx) { + auto format(const Common::PhysicalAddress& addr, FormatContext& ctx) const { return fmt::format_to(ctx.out(), "{:#x}", static_cast(addr.GetValue())); } }; @@ -273,7 +273,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Common::ProcessAddress& addr, FormatContext& ctx) { + auto format(const Common::ProcessAddress& addr, FormatContext& ctx) const { return fmt::format_to(ctx.out(), "{:#x}", static_cast(addr.GetValue())); } }; @@ -284,7 +284,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Common::VirtualAddress& addr, FormatContext& ctx) { + auto format(const Common::VirtualAddress& addr, FormatContext& ctx) const { return fmt::format_to(ctx.out(), "{:#x}", static_cast(addr.GetValue())); } }; diff --git a/src/core/arm/dynarmic/dynarmic_cp15.cpp b/src/core/arm/dynarmic/dynarmic_cp15.cpp index f3eee0d42a..ee97ac6395 100644 --- a/src/core/arm/dynarmic/dynarmic_cp15.cpp +++ b/src/core/arm/dynarmic/dynarmic_cp15.cpp @@ -22,7 +22,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Dynarmic::A32::CoprocReg& reg, FormatContext& ctx) { + auto format(const Dynarmic::A32::CoprocReg& reg, FormatContext& ctx) const { return fmt::format_to(ctx.out(), "cp{}", static_cast(reg)); } }; diff --git a/src/core/core.cpp b/src/core/core.cpp index 0cb81d6d8f..83517d46cc 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -80,6 +80,7 @@ FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs, if (filename == "00") { const auto dir = vfs->OpenDirectory(dir_name, FileSys::OpenMode::Read); std::vector concat; + concat.reserve(0x10); for (u32 i = 0; i < 0x10; ++i) { const auto file_name = fmt::format("{:02X}", i); diff --git a/src/core/debugger/gdbstub.cpp b/src/core/debugger/gdbstub.cpp index 80091cc7e0..22bc71e4d4 100644 --- a/src/core/debugger/gdbstub.cpp +++ b/src/core/debugger/gdbstub.cpp @@ -9,6 +9,7 @@ #include #include +#include #include "common/hex_util.h" #include "common/logging/log.h" @@ -481,6 +482,7 @@ void GDBStub::HandleQuery(std::string_view command) { // beginning of list const auto& threads = GetProcess()->GetThreadList(); std::vector thread_ids; + thread_ids.reserve(threads.size()); for (const auto& thread : threads) { thread_ids.push_back(fmt::format("{:x}", thread.GetThreadId())); } diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index c208be83f2..fae8e74e44 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp @@ -261,7 +261,7 @@ std::vector PlaceholderCache::List() const { std::vector out; for (const auto& sdir : dir->GetSubdirectories()) { for (const auto& file : sdir->GetFiles()) { - const auto name = file->GetName(); + const auto& name = file->GetName(); if (name.length() == 36 && name.ends_with(".nca")) { out.push_back(Common::HexStringToArray<0x10>(name.substr(0, 32))); } diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp index 68e8ec22fc..4ab7e03590 100644 --- a/src/core/file_sys/submission_package.cpp +++ b/src/core/file_sys/submission_package.cpp @@ -117,7 +117,9 @@ std::vector> NSP::GetNCAsCollapsed() const { if (extracted) LOG_WARNING(Service_FS, "called on an NSP that is of type extracted."); std::vector> out; + out.reserve(ncas.size()); for (const auto& map : ncas) { + out.reserve(map.second.size()); for (const auto& inner_map : map.second) out.push_back(inner_map.second); } diff --git a/src/core/file_sys/system_archive/ng_word.cpp b/src/core/file_sys/system_archive/ng_word.cpp index 1fa67877dd..61b0ed2f7b 100644 --- a/src/core/file_sys/system_archive/ng_word.cpp +++ b/src/core/file_sys/system_archive/ng_word.cpp @@ -10,7 +10,7 @@ namespace FileSys::SystemArchive { namespace NgWord1Data { -constexpr std::size_t NUMBER_WORD_TXT_FILES = 0x10; +[[maybe_unused]] constexpr std::size_t NUMBER_WORD_TXT_FILES = 0x10; // Should this archive replacement mysteriously not work on a future game, consider updating. constexpr std::array VERSION_DAT{0x0, 0x0, 0x0, 0x20}; // 11.0.1 System Version @@ -24,7 +24,7 @@ constexpr std::array WORD_TXT{ VirtualDir NgWord1() { std::vector files; - files.reserve(NgWord1Data::NUMBER_WORD_TXT_FILES); + files.reserve(files.size() + 2); for (std::size_t i = 0; i < files.size(); ++i) { files.push_back(MakeArrayFile(NgWord1Data::WORD_TXT, fmt::format("{}.txt", i))); @@ -54,7 +54,7 @@ constexpr std::array AC_NX_DATA{ VirtualDir NgWord2() { std::vector files; - files.reserve(NgWord2Data::NUMBER_AC_NX_FILES * 3); + files.reserve(NgWord2Data::NUMBER_AC_NX_FILES + 4); for (std::size_t i = 0; i < NgWord2Data::NUMBER_AC_NX_FILES; ++i) { files.push_back(MakeArrayFile(NgWord2Data::AC_NX_DATA, fmt::format("ac_{}_b1_nx", i))); diff --git a/src/core/file_sys/system_archive/time_zone_binary.cpp b/src/core/file_sys/system_archive/time_zone_binary.cpp index 316ff0dc6f..3fa703a6fa 100644 --- a/src/core/file_sys/system_archive/time_zone_binary.cpp +++ b/src/core/file_sys/system_archive/time_zone_binary.cpp @@ -37,6 +37,7 @@ const static std::map& directory, const std::map>& files) { + directory.reserve(files.size()); for (const auto& [filename, data] : files) { const auto data_copy{data}; const std::string filename_copy{filename}; @@ -54,6 +55,7 @@ static std::vector GenerateZoneinfoFiles() { VirtualDir TimeZoneBinary() { std::vector america_sub_dirs; + america_sub_dirs.reserve(tzdb_america_dirs.size()); for (const auto& [dir_name, files] : tzdb_america_dirs) { std::vector vfs_files; GenerateFiles(vfs_files, files); @@ -62,6 +64,7 @@ VirtualDir TimeZoneBinary() { } std::vector zoneinfo_sub_dirs; + zoneinfo_sub_dirs.reserve(tzdb_zoneinfo_dirs.size()); for (const auto& [dir_name, files] : tzdb_zoneinfo_dirs) { std::vector vfs_files; GenerateFiles(vfs_files, files); diff --git a/src/core/file_sys/vfs/vfs_cached.cpp b/src/core/file_sys/vfs/vfs_cached.cpp index 01cd0f1e08..9f570520bb 100644 --- a/src/core/file_sys/vfs/vfs_cached.cpp +++ b/src/core/file_sys/vfs/vfs_cached.cpp @@ -38,7 +38,8 @@ VirtualDir CachedVfsDirectory::GetSubdirectory(std::string_view dir_name) const std::vector CachedVfsDirectory::GetFiles() const { std::vector out; - for (auto& [file_name, file] : files) { + out.reserve(files.size()); + for (const auto& [_, file] : files) { out.push_back(file); } return out; @@ -46,7 +47,8 @@ std::vector CachedVfsDirectory::GetFiles() const { std::vector CachedVfsDirectory::GetSubdirectories() const { std::vector out; - for (auto& [dir_name, dir] : dirs) { + out.reserve(dirs.size()); + for (auto& [_, dir] : dirs) { out.push_back(dir); } return out; diff --git a/src/core/hle/service/am/window_system.cpp b/src/core/hle/service/am/window_system.cpp index 5cf24007cc..ca289a84d1 100644 --- a/src/core/hle/service/am/window_system.cpp +++ b/src/core/hle/service/am/window_system.cpp @@ -121,7 +121,7 @@ void WindowSystem::RequestAppletVisibilityState(Applet& applet, bool visible) { void WindowSystem::OnOperationModeChanged() { std::scoped_lock lk{m_lock}; - for (const auto& [aruid, applet] : m_applets) { + for (const auto& [_, applet] : m_applets) { std::scoped_lock lk2{applet->lock}; applet->lifecycle_manager.OnOperationAndPerformanceModeChanged(); } @@ -130,7 +130,7 @@ void WindowSystem::OnOperationModeChanged() { void WindowSystem::OnExitRequested() { std::scoped_lock lk{m_lock}; - for (const auto& [aruid, applet] : m_applets) { + for (const auto& [_, applet] : m_applets) { std::scoped_lock lk2{applet->lock}; applet->lifecycle_manager.RequestExit(); } @@ -156,7 +156,7 @@ void WindowSystem::OnHomeButtonPressed(ButtonPressDuration type) { void WindowSystem::PruneTerminatedAppletsLocked() { for (auto it = m_applets.begin(); it != m_applets.end(); /* ... */) { - const auto& [aruid, applet] = *it; + const auto& [_, applet] = *it; std::scoped_lock lk{applet->lock}; diff --git a/src/core/hle/service/ldn/lan_discovery.cpp b/src/core/hle/service/ldn/lan_discovery.cpp index b9db19618a..e947a3c2a0 100644 --- a/src/core/hle/service/ldn/lan_discovery.cpp +++ b/src/core/hle/service/ldn/lan_discovery.cpp @@ -119,7 +119,7 @@ Result LANDiscovery::Scan(std::span out_networks, s16& out_count, std::this_thread::sleep_for(std::chrono::seconds(1)); std::scoped_lock lock{packet_mutex}; - for (const auto& [key, info] : scan_results) { + for (const auto& [_, info] : scan_results) { if (out_count >= static_cast(out_networks.size())) { break; } diff --git a/src/core/hle/service/nfc/common/device.cpp b/src/core/hle/service/nfc/common/device.cpp index bf29bb354e..652dff0457 100644 --- a/src/core/hle/service/nfc/common/device.cpp +++ b/src/core/hle/service/nfc/common/device.cpp @@ -15,6 +15,7 @@ #endif #include +#include #include "common/fs/file.h" #include "common/fs/fs.h" diff --git a/src/core/hle/service/ns/application_manager_interface.cpp b/src/core/hle/service/ns/application_manager_interface.cpp index 7a91727f97..df0bd8acce 100644 --- a/src/core/hle/service/ns/application_manager_interface.cpp +++ b/src/core/hle/service/ns/application_manager_interface.cpp @@ -348,7 +348,7 @@ Result IApplicationManagerInterface::ListApplicationRecord( size_t i = 0; u8 ii = 24; - for (const auto& [slot, game] : installed_games) { + for (const auto& [_, game] : installed_games) { if (i >= limit) { break; } diff --git a/src/core/hle/service/psc/time/common.h b/src/core/hle/service/psc/time/common.h index 3e13144a0d..5474e5a0c9 100644 --- a/src/core/hle/service/psc/time/common.h +++ b/src/core/hle/service/psc/time/common.h @@ -167,7 +167,7 @@ constexpr inline Result GetSpanBetweenTimePoints(s64* out_seconds, const SteadyC template <> struct fmt::formatter : fmt::formatter { template - auto format(Service::PSC::Time::TimeType type, FormatContext& ctx) { + auto format(Service::PSC::Time::TimeType type, FormatContext& ctx) const { const string_view name = [type] { using Service::PSC::Time::TimeType; switch (type) { @@ -270,4 +270,4 @@ struct fmt::formatter time_point.rtc_offset, time_point.diff_scale, time_point.shift_amount, time_point.lower, time_point.upper); } -}; \ No newline at end of file +}; diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index 1095dcf6c3..2cf12aba52 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp @@ -28,7 +28,7 @@ ServiceManager::ServiceManager(Kernel::KernelCore& kernel_) : kernel{kernel_} { } ServiceManager::~ServiceManager() { - for (auto& [name, port] : service_ports) { + for (auto& [_, port] : service_ports) { port->Close(); } diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index eea607b66d..20aecf4c76 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp @@ -571,7 +571,7 @@ SDLDriver::~SDLDriver() { std::vector SDLDriver::GetInputDevices() const { std::vector devices; std::unordered_map> joycon_pairs; - for (const auto& [key, value] : joystick_map) { + for (const auto& [_, value] : joystick_map) { for (const auto& joystick : value) { if (!joystick->GetSDLJoystick()) { continue; @@ -591,7 +591,7 @@ std::vector SDLDriver::GetInputDevices() const { } // Add dual controllers - for (const auto& [key, value] : joystick_map) { + for (const auto& [_, value] : joystick_map) { for (const auto& joystick : value) { if (joystick->IsJoyconRight()) { if (!joycon_pairs.contains(joystick->GetPort())) { diff --git a/src/shader_recompiler/backend/glasm/reg_alloc.h b/src/shader_recompiler/backend/glasm/reg_alloc.h index bd6e2d929c..207a075f19 100644 --- a/src/shader_recompiler/backend/glasm/reg_alloc.h +++ b/src/shader_recompiler/backend/glasm/reg_alloc.h @@ -184,7 +184,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(Shader::Backend::GLASM::Id id, FormatContext& ctx) { + auto format(Shader::Backend::GLASM::Id id, FormatContext& ctx) const { return Shader::Backend::GLASM::FormatTo(ctx, id); } }; @@ -195,7 +195,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Shader::Backend::GLASM::Register& value, FormatContext& ctx) { + auto format(const Shader::Backend::GLASM::Register& value, FormatContext& ctx) const { if (value.type != Shader::Backend::GLASM::Type::Register) { throw Shader::InvalidArgument("Register value type is not register"); } @@ -209,7 +209,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Shader::Backend::GLASM::ScalarRegister& value, FormatContext& ctx) { + auto format(const Shader::Backend::GLASM::ScalarRegister& value, FormatContext& ctx) const { if (value.type != Shader::Backend::GLASM::Type::Register) { throw Shader::InvalidArgument("Register value type is not register"); } @@ -223,7 +223,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Shader::Backend::GLASM::ScalarU32& value, FormatContext& ctx) { + auto format(const Shader::Backend::GLASM::ScalarU32& value, FormatContext& ctx) const { switch (value.type) { case Shader::Backend::GLASM::Type::Void: break; @@ -244,7 +244,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Shader::Backend::GLASM::ScalarS32& value, FormatContext& ctx) { + auto format(const Shader::Backend::GLASM::ScalarS32& value, FormatContext& ctx) const { switch (value.type) { case Shader::Backend::GLASM::Type::Void: break; @@ -265,7 +265,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Shader::Backend::GLASM::ScalarF32& value, FormatContext& ctx) { + auto format(const Shader::Backend::GLASM::ScalarF32& value, FormatContext& ctx) const { switch (value.type) { case Shader::Backend::GLASM::Type::Void: break; @@ -286,7 +286,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Shader::Backend::GLASM::ScalarF64& value, FormatContext& ctx) { + auto format(const Shader::Backend::GLASM::ScalarF64& value, FormatContext& ctx) const { switch (value.type) { case Shader::Backend::GLASM::Type::Void: break; diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp index 945cdb42bc..75767448c3 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp @@ -196,8 +196,11 @@ Id Texture(EmitContext& ctx, IR::TextureInstInfo info, [[maybe_unused]] const IR } Id TextureImage(EmitContext& ctx, IR::TextureInstInfo info, const IR::Value& index) { - if (!index.IsImmediate() || index.U32() != 0) { - throw NotImplementedException("Indirect image indexing"); + // if (!index.IsImmediate() || index.Type() != Shader::IR::Type::U32 || index.U32() != 0) { + // throw NotImplementedException("Indirect image indexing"); + // } + if (index.Type() != Shader::IR::Type::U32) { + LOG_WARNING(Shader_SPIRV, "Non-U32 type provided as index: {}", index.Type()); } if (info.type == TextureType::Buffer) { const TextureBufferDefinition& def{ctx.texture_buffers.at(info.descriptor_index)}; @@ -215,8 +218,11 @@ Id TextureImage(EmitContext& ctx, IR::TextureInstInfo info, const IR::Value& ind } std::pair Image(EmitContext& ctx, const IR::Value& index, IR::TextureInstInfo info) { - if (!index.IsImmediate() || index.U32() != 0) { - throw NotImplementedException("Indirect image indexing"); + // if (!index.IsImmediate() || index.Type() != Shader::IR::Type::U32 || index.U32() != 0) { + // throw NotImplementedException("Indirect image indexing"); + // } + if (index.Type() != Shader::IR::Type::U32) { + LOG_WARNING(Shader_SPIRV, "Non-U32 type provided as index: {}", index.Type()); } if (info.type == TextureType::Buffer) { const ImageBufferDefinition def{ctx.image_buffers.at(info.descriptor_index)}; diff --git a/src/shader_recompiler/frontend/ir/attribute.h b/src/shader_recompiler/frontend/ir/attribute.h index 5f039b6f65..407a1f4bc1 100644 --- a/src/shader_recompiler/frontend/ir/attribute.h +++ b/src/shader_recompiler/frontend/ir/attribute.h @@ -250,7 +250,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Shader::IR::Attribute& attribute, FormatContext& ctx) { + auto format(const Shader::IR::Attribute& attribute, FormatContext& ctx) const { return fmt::format_to(ctx.out(), "{}", Shader::IR::NameOf(attribute)); } }; diff --git a/src/shader_recompiler/frontend/ir/condition.h b/src/shader_recompiler/frontend/ir/condition.h index 1cad46b9b9..0b77b6590b 100644 --- a/src/shader_recompiler/frontend/ir/condition.h +++ b/src/shader_recompiler/frontend/ir/condition.h @@ -52,7 +52,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Shader::IR::Condition& cond, FormatContext& ctx) { + auto format(const Shader::IR::Condition& cond, FormatContext& ctx) const { return fmt::format_to(ctx.out(), "{}", Shader::IR::NameOf(cond)); } }; diff --git a/src/shader_recompiler/frontend/ir/flow_test.h b/src/shader_recompiler/frontend/ir/flow_test.h index 88f7c9e82e..f758d13127 100644 --- a/src/shader_recompiler/frontend/ir/flow_test.h +++ b/src/shader_recompiler/frontend/ir/flow_test.h @@ -55,7 +55,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Shader::IR::FlowTest& flow_test, FormatContext& ctx) { + auto format(const Shader::IR::FlowTest& flow_test, FormatContext& ctx) const { return fmt::format_to(ctx.out(), "{}", Shader::IR::NameOf(flow_test)); } }; diff --git a/src/shader_recompiler/frontend/ir/opcodes.h b/src/shader_recompiler/frontend/ir/opcodes.h index e300714f3a..767c5ae15a 100644 --- a/src/shader_recompiler/frontend/ir/opcodes.h +++ b/src/shader_recompiler/frontend/ir/opcodes.h @@ -54,7 +54,7 @@ constexpr Type F64x2{Type::F64x2}; constexpr Type F64x3{Type::F64x3}; constexpr Type F64x4{Type::F64x4}; -constexpr OpcodeMeta META_TABLE[]{ +constexpr OpcodeMeta META_TABLE[] { #define OPCODE(name_token, type_token, ...) \ { \ .name{#name_token}, \ @@ -103,7 +103,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Shader::IR::Opcode& op, FormatContext& ctx) { + auto format(const Shader::IR::Opcode& op, FormatContext& ctx) const { return fmt::format_to(ctx.out(), "{}", Shader::IR::NameOf(op)); } }; diff --git a/src/shader_recompiler/frontend/ir/pred.h b/src/shader_recompiler/frontend/ir/pred.h index a77c1e2a7a..f3f92b063a 100644 --- a/src/shader_recompiler/frontend/ir/pred.h +++ b/src/shader_recompiler/frontend/ir/pred.h @@ -33,7 +33,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Shader::IR::Pred& pred, FormatContext& ctx) { + auto format(const Shader::IR::Pred& pred, FormatContext& ctx) const { if (pred == Shader::IR::Pred::PT) { return fmt::format_to(ctx.out(), "PT"); } else { diff --git a/src/shader_recompiler/frontend/ir/reg.h b/src/shader_recompiler/frontend/ir/reg.h index f7cb716a97..610492759d 100644 --- a/src/shader_recompiler/frontend/ir/reg.h +++ b/src/shader_recompiler/frontend/ir/reg.h @@ -319,7 +319,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Shader::IR::Reg& reg, FormatContext& ctx) { + auto format(const Shader::IR::Reg& reg, FormatContext& ctx) const { if (reg == Shader::IR::Reg::RZ) { return fmt::format_to(ctx.out(), "RZ"); } else if (static_cast(reg) >= 0 && static_cast(reg) < 255) { diff --git a/src/shader_recompiler/frontend/ir/type.h b/src/shader_recompiler/frontend/ir/type.h index 04c8c4ddbe..17b520c6dd 100644 --- a/src/shader_recompiler/frontend/ir/type.h +++ b/src/shader_recompiler/frontend/ir/type.h @@ -54,7 +54,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Shader::IR::Type& type, FormatContext& ctx) { + auto format(const Shader::IR::Type& type, FormatContext& ctx) const { return fmt::format_to(ctx.out(), "{}", NameOf(type)); } }; diff --git a/src/shader_recompiler/frontend/maxwell/location.h b/src/shader_recompiler/frontend/maxwell/location.h index 0c0477e2db..0dd16723a2 100644 --- a/src/shader_recompiler/frontend/maxwell/location.h +++ b/src/shader_recompiler/frontend/maxwell/location.h @@ -102,7 +102,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Shader::Maxwell::Location& location, FormatContext& ctx) { + auto format(const Shader::Maxwell::Location& location, FormatContext& ctx) const { return fmt::format_to(ctx.out(), "{:04x}", location.Offset()); } }; diff --git a/src/shader_recompiler/frontend/maxwell/opcodes.h b/src/shader_recompiler/frontend/maxwell/opcodes.h index 72dd143c2a..b3a493ff6a 100644 --- a/src/shader_recompiler/frontend/maxwell/opcodes.h +++ b/src/shader_recompiler/frontend/maxwell/opcodes.h @@ -23,7 +23,7 @@ struct fmt::formatter { return ctx.begin(); } template - auto format(const Shader::Maxwell::Opcode& opcode, FormatContext& ctx) { + auto format(const Shader::Maxwell::Opcode& opcode, FormatContext& ctx) const { return fmt::format_to(ctx.out(), "{}", NameOf(opcode)); } }; diff --git a/src/suyu/configuration/configure_applets.cpp b/src/suyu/configuration/configure_applets.cpp index a607fa3af8..d5e3520718 100644 --- a/src/suyu/configuration/configure_applets.cpp +++ b/src/suyu/configuration/configure_applets.cpp @@ -69,7 +69,7 @@ void ConfigureApplets::Setup(const ConfigurationShared::Builder& builder) { applets_hold.emplace(setting->Id(), widget); } - for (const auto& [label, widget] : applets_hold) { + for (const auto& [_, widget] : applets_hold) { library_applets_layout.addWidget(widget); } } diff --git a/src/suyu/configuration/configure_audio.cpp b/src/suyu/configuration/configure_audio.cpp index 2341131585..5ecd79ae31 100644 --- a/src/suyu/configuration/configure_audio.cpp +++ b/src/suyu/configuration/configure_audio.cpp @@ -164,7 +164,7 @@ void ConfigureAudio::Setup(const ConfigurationShared::Builder& builder) { } } - for (const auto& [id, widget] : hold) { + for (const auto& [_, widget] : hold) { layout.addWidget(widget); } } diff --git a/src/suyu/configuration/configure_cpu.cpp b/src/suyu/configuration/configure_cpu.cpp index ce266642ff..0a26f531fb 100644 --- a/src/suyu/configuration/configure_cpu.cpp +++ b/src/suyu/configuration/configure_cpu.cpp @@ -79,7 +79,7 @@ void ConfigureCpu::Setup(const ConfigurationShared::Builder& builder) { } } - for (const auto& [label, widget] : unsafe_hold) { + for (const auto& [_, widget] : unsafe_hold) { unsafe_layout->addWidget(widget); } diff --git a/src/suyu/configuration/configure_general.cpp b/src/suyu/configuration/configure_general.cpp index 689d9be2b8..f8007574d4 100644 --- a/src/suyu/configuration/configure_general.cpp +++ b/src/suyu/configuration/configure_general.cpp @@ -81,10 +81,10 @@ void ConfigureGeneral::Setup(const ConfigurationShared::Builder& builder) { } } - for (const auto& [id, widget] : general_hold) { + for (const auto& [_, widget] : general_hold) { general_layout.addWidget(widget); } - for (const auto& [id, widget] : linux_hold) { + for (const auto& [_, widget] : linux_hold) { linux_layout.addWidget(widget); } } diff --git a/src/suyu/configuration/configure_graphics.cpp b/src/suyu/configuration/configure_graphics.cpp index d11110a74a..54cdd8d25f 100644 --- a/src/suyu/configuration/configure_graphics.cpp +++ b/src/suyu/configuration/configure_graphics.cpp @@ -358,7 +358,7 @@ void ConfigureGraphics::Setup(const ConfigurationShared::Builder& builder) { } } - for (const auto& [id, widget] : hold_graphics) { + for (const auto& [_, widget] : hold_graphics) { graphics_layout.addWidget(widget); } diff --git a/src/suyu/configuration/configure_graphics_advanced.cpp b/src/suyu/configuration/configure_graphics_advanced.cpp index 8cdae0a65d..28b3f7c3c8 100644 --- a/src/suyu/configuration/configure_graphics_advanced.cpp +++ b/src/suyu/configuration/configure_graphics_advanced.cpp @@ -53,7 +53,7 @@ void ConfigureGraphicsAdvanced::Setup(const ConfigurationShared::Builder& builde checkbox_enable_compute_pipelines = widget; } } - for (const auto& [id, widget] : hold) { + for (const auto& [_, widget] : hold) { layout.addWidget(widget); } } diff --git a/src/suyu/configuration/configure_linux_tab.cpp b/src/suyu/configuration/configure_linux_tab.cpp index 1db9893b71..488db7b932 100644 --- a/src/suyu/configuration/configure_linux_tab.cpp +++ b/src/suyu/configuration/configure_linux_tab.cpp @@ -50,7 +50,7 @@ void ConfigureLinuxTab::Setup(const ConfigurationShared::Builder& builder) { linux_hold.insert({setting->Id(), widget}); } - for (const auto& [id, widget] : linux_hold) { + for (const auto& [_, widget] : linux_hold) { linux_layout.addWidget(widget); } } diff --git a/src/suyu/configuration/configure_system.cpp b/src/suyu/configuration/configure_system.cpp index 3204303e98..e0312eb6fc 100644 --- a/src/suyu/configuration/configure_system.cpp +++ b/src/suyu/configuration/configure_system.cpp @@ -174,10 +174,10 @@ void ConfigureSystem::Setup(const ConfigurationShared::Builder& builder) { widget->deleteLater(); } } - for (const auto& [label, widget] : core_hold) { + for (const auto& [_, widget] : core_hold) { core_layout.addWidget(widget); } - for (const auto& [id, widget] : system_hold) { + for (const auto& [_, widget] : system_hold) { system_layout.addWidget(widget); } } diff --git a/src/suyu/configuration/configure_ui.cpp b/src/suyu/configuration/configure_ui.cpp index 589c035589..74add9bbd3 100644 --- a/src/suyu/configuration/configure_ui.cpp +++ b/src/suyu/configuration/configure_ui.cpp @@ -83,7 +83,7 @@ static void PopulateResolutionComboBox(QComboBox* screenshot_height, QWidget* pa const auto& enumeration = Settings::EnumMetadata::Canonicalizations(); std::set resolutions{}; - for (const auto& [name, value] : enumeration) { + for (const auto& [_, value] : enumeration) { const float up_factor = GetUpFactor(value); u32 height_undocked = Layout::ScreenUndocked::Height * up_factor; u32 height_docked = Layout::ScreenDocked::Height * up_factor; diff --git a/src/suyu/configuration/input_profiles.cpp b/src/suyu/configuration/input_profiles.cpp index a2ca806899..5add5f057b 100644 --- a/src/suyu/configuration/input_profiles.cpp +++ b/src/suyu/configuration/input_profiles.cpp @@ -61,7 +61,7 @@ std::vector InputProfiles::GetInputProfileNames() { auto it = map_profiles.cbegin(); while (it != map_profiles.cend()) { - const auto& [profile_name, config] = *it; + const auto& [profile_name, _] = *it; if (!ProfileExistsInFilesystem(profile_name)) { it = map_profiles.erase(it); continue; diff --git a/src/suyu/configuration/shared_widget.cpp b/src/suyu/configuration/shared_widget.cpp index 76a6b417cd..8a552d68c9 100644 --- a/src/suyu/configuration/shared_widget.cpp +++ b/src/suyu/configuration/shared_widget.cpp @@ -135,7 +135,7 @@ QWidget* Widget::CreateCombobox(std::function& serializer, const ComboboxTranslations* enumeration{nullptr}; if (combobox_enumerations.contains(type)) { enumeration = &combobox_enumerations.at(type); - for (const auto& [id, name] : *enumeration) { + for (const auto& [_, name] : *enumeration) { combobox->addItem(name); } } else { @@ -223,7 +223,7 @@ QWidget* Widget::CreateRadioGroup(std::function& serializer, }; if (!Settings::IsConfiguringGlobal()) { - for (const auto& [id, button] : radio_buttons) { + for (const auto& [_, button] : radio_buttons) { QObject::connect(button, &QAbstractButton::clicked, [touch]() { touch(); }); } } diff --git a/src/suyu/main.cpp b/src/suyu/main.cpp index fbdea66e78..991ff67768 100644 --- a/src/suyu/main.cpp +++ b/src/suyu/main.cpp @@ -9,6 +9,8 @@ #include #include +#include + #include "core/hle/service/am/applet_manager.h" #include "core/loader/nca.h" #include "core/loader/nro.h" diff --git a/src/suyu/play_time_manager.cpp b/src/suyu/play_time_manager.cpp index 9a046c69a1..ede966da6e 100644 --- a/src/suyu/play_time_manager.cpp +++ b/src/suyu/play_time_manager.cpp @@ -87,7 +87,7 @@ std::optional GetCurrentUserPlayTimePath( std::vector elements; elements.reserve(play_time_db.size()); - for (auto& [program_id, play_time] : play_time_db) { + for (const auto& [program_id, play_time] : play_time_db) { if (program_id != 0) { elements.push_back(PlayTimeElement{program_id, play_time}); } diff --git a/src/tests/video_core/memory_tracker.cpp b/src/tests/video_core/memory_tracker.cpp index 45b1a91dc5..bfdcc8a16c 100644 --- a/src/tests/video_core/memory_tracker.cpp +++ b/src/tests/video_core/memory_tracker.cpp @@ -45,7 +45,7 @@ public: [[nodiscard]] unsigned Count() const noexcept { unsigned count = 0; - for (const auto& [index, value] : page_table) { + for (const auto& [_, value] : page_table) { count += value; } return count; diff --git a/src/video_core/host1x/host1x.h b/src/video_core/host1x/host1x.h index 8debac93dd..6de360d363 100644 --- a/src/video_core/host1x/host1x.h +++ b/src/video_core/host1x/host1x.h @@ -45,7 +45,7 @@ public: // Vic does not know which nvdec is producing frames for it, so search all the fds here for // the given offset. for (auto& map : m_presentation_order) { - for (auto& [offset, frame] : map.second) { + for (auto& [offset, _] : map.second) { if (offset == search_offset) { return map.first; } @@ -53,7 +53,7 @@ public: } for (auto& map : m_decode_order) { - for (auto& [offset, frame] : map.second) { + for (auto& [offset, _] : map.second) { if (offset == search_offset) { return map.first; } diff --git a/src/video_core/texture_cache/formatter.h b/src/video_core/texture_cache/formatter.h index cabbfcb2dd..ea1c2df791 100644 --- a/src/video_core/texture_cache/formatter.h +++ b/src/video_core/texture_cache/formatter.h @@ -13,7 +13,7 @@ template <> struct fmt::formatter : fmt::formatter { template - auto format(VideoCore::Surface::PixelFormat format, FormatContext& ctx) { + auto format(VideoCore::Surface::PixelFormat format, FormatContext& ctx) const { using VideoCore::Surface::PixelFormat; const string_view name = [format] { switch (format) { @@ -234,7 +234,7 @@ struct fmt::formatter : fmt::formatter struct fmt::formatter : fmt::formatter { template - auto format(VideoCommon::ImageType type, FormatContext& ctx) { + auto format(VideoCommon::ImageType type, FormatContext& ctx) const { const string_view name = [type] { using VideoCommon::ImageType; switch (type) { @@ -262,7 +262,7 @@ struct fmt::formatter { } template - auto format(const VideoCommon::Extent3D& extent, FormatContext& ctx) { + auto format(const VideoCommon::Extent3D& extent, FormatContext& ctx) const { return fmt::format_to(ctx.out(), "{{{}, {}, {}}}", extent.width, extent.height, extent.depth); }