diff options
| -rw-r--r-- | src/core/device_memory_manager.inc | 5 | ||||
| -rw-r--r-- | src/input_common/drivers/sdl_driver.cpp | 26 | ||||
| -rw-r--r-- | src/qt_common/util/game.cpp | 11 | ||||
| -rw-r--r-- | src/tests/core/nup_writer.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/texture_cache/format_lookup_table.cpp | 1 | ||||
| -rw-r--r-- | src/yuzu/main_window.cpp | 37 | ||||
| -rw-r--r-- | src/yuzu/main_window.h | 1 |
9 files changed, 56 insertions, 31 deletions
diff --git a/src/core/device_memory_manager.inc b/src/core/device_memory_manager.inc index 3523e3cf1c..5931fd0882 100644 --- a/src/core/device_memory_manager.inc +++ b/src/core/device_memory_manager.inc @@ -626,6 +626,11 @@ void DeviceMemoryManager<Traits>::UpdatePagesCachedCountNoLock(DAddr addr, size_ const size_t page_end = Common::DivCeil(addr + size, Memory::YUZU_PAGESIZE); size_t page = addr >> Memory::YUZU_PAGEBITS; auto [asid, base_vaddress] = ExtractCPUBacking(page); + // Sem processo registrado nao ha o que marcar, e asid.id 0 indexaria um vetor vazio. Acontece + // no alvo de testes, que chama UpdatePagesCachedBatch num DeviceMemoryManager recem-criado. + if (asid.id >= registered_processes.size()) { + return; + } auto* memory_device_inter = registered_processes[asid.id]; const auto release_pending = [&] { if (uncache_bytes > 0) { diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index c3e9a066b3..a308554071 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp @@ -3,6 +3,7 @@ // SPDX-FileCopyrightText: 2018 Citra Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include <algorithm> #include <array> #include <numbers> #include "common/logging.h" @@ -115,7 +116,15 @@ public: } } - LOG_INFO(Input, "Controller motion capabilities: accel={} gyro={}", has_accel, has_gyro); + // EnableMotion is also called to recover a stalled sensor, so only log when the reported + // capabilities actually change instead of on every restart. + if (!motion_capabilities_logged || logged_accel != has_accel || logged_gyro != has_gyro) { + LOG_INFO(Input, "Controller motion capabilities: accel={} gyro={}", has_accel, + has_gyro); + motion_capabilities_logged = true; + logged_accel = has_accel; + logged_gyro = has_gyro; + } } bool HasMotion() const { @@ -163,16 +172,21 @@ public: // Motion data is invalid if (motion.accel_x == 0 && motion.gyro_x == 0 && motion.accel_y == 0 && motion.gyro_y == 0 && motion.accel_z == 0 && motion.gyro_z == 0) { - if (motion_error_count++ < 200) { + if (motion_error_count++ < motion_restart_threshold) { return false; } - // Try restarting the sensor + // Try restarting the sensor. Back off exponentially so a sensor that keeps reporting + // zeros (observed on the Steam Deck) isn't toggled several times a + // second for the whole session. motion_error_count = 0; + motion_restart_threshold = + std::min(motion_restart_threshold * 2, MaxMotionRestartThreshold); EnableMotion(); return false; } motion_error_count = 0; + motion_restart_threshold = InitialMotionRestartThreshold; motion.delta_timestamp = time_difference; return true; } @@ -393,7 +407,13 @@ private: mutable std::mutex mutex; u64 last_motion_update{}; + static constexpr std::size_t InitialMotionRestartThreshold = 200; + static constexpr std::size_t MaxMotionRestartThreshold = 200 * 64; std::size_t motion_error_count{}; + std::size_t motion_restart_threshold{InitialMotionRestartThreshold}; + bool motion_capabilities_logged{false}; + bool logged_accel{false}; + bool logged_gyro{false}; bool has_gyro{false}; bool has_accel{false}; bool has_vibration{false}; diff --git a/src/qt_common/util/game.cpp b/src/qt_common/util/game.cpp index ddbe979765..ba669c3acf 100644 --- a/src/qt_common/util/game.cpp +++ b/src/qt_common/util/game.cpp @@ -430,8 +430,10 @@ void CreateShortcut(const std::string& game_path, const u64 program_id, game_title = fmt::format("{:016X}", program_id); if (control.first != nullptr) { game_title = control.first->GetApplicationName(); - } else { + } else if (loader != nullptr) { loader->ReadTitle(game_title); + } else { + LOG_WARNING(Frontend, "Could not load game title from {:s}", game_path); } } @@ -448,7 +450,8 @@ void CreateShortcut(const std::string& game_path, const u64 program_id, std::vector<u8> icon_image_file{}; if (control.second != nullptr) { icon_image_file = control.second->ReadAllBytes(); - } else if (loader->ReadIcon(icon_image_file) != Loader::ResultStatus::Success) { + } else if (loader == nullptr || + loader->ReadIcon(icon_image_file) != Loader::ResultStatus::Success) { LOG_WARNING(Frontend, "Could not read icon from {:s}", game_path); } @@ -535,6 +538,10 @@ void CreateHomeMenuShortcut(ShortcutTarget target) { } bool SaveIconToFile(const std::filesystem::path& icon_path, const QImage& image) { + if (image.isNull()) { + return false; + } + #if defined(WIN32) #pragma pack(push, 2) struct IconDir { diff --git a/src/tests/core/nup_writer.cpp b/src/tests/core/nup_writer.cpp index 3167a28baf..1ce9661218 100644 --- a/src/tests/core/nup_writer.cpp +++ b/src/tests/core/nup_writer.cpp @@ -228,7 +228,7 @@ TEST_CASE("NUP packs base, updates and add-ons and reads back through NupContain REQUIRE(packages[3].kind == NupContainer::PackageKind::Addon); REQUIRE(packages[3].title_id == 0x0400ABCD00011001ULL); REQUIRE(packages[3].exefs_dir == 0xFFFFFFFF); - REQUIRE(nup.FindBestUpdatePackage() == 2); + REQUIRE(nup.FindBestUpdatePackage() == std::size_t{2}); REQUIRE(PackedTree(nup.GetExeFSDir(0)) == SourceTree(root / "Base/ExeFS")); REQUIRE(PackedTree(nup.GetRomFSDir(0)) == SourceTree(root / "Base/RomFS")); diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index ac750ab747..fd27fb1805 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp @@ -54,7 +54,7 @@ using VideoCommon::LoadPipelines; using VideoCommon::SerializePipeline; using Context = ShaderContext::Context; -constexpr u32 CACHE_VERSION = 15; +constexpr u32 CACHE_VERSION = 16; template <typename Container> auto MakeSpan(Container& container) { diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 0223f56ff1..b651bfc9ba 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -66,7 +66,7 @@ using VideoCommon::FileEnvironment; using VideoCommon::GenericEnvironment; using VideoCommon::GraphicsEnvironment; -constexpr u32 CACHE_VERSION = 18; +constexpr u32 CACHE_VERSION = 19; constexpr size_t VULKAN_CACHE_FLUSH_PIPELINES = 128; constexpr size_t VULKAN_CACHE_FLUSH_MIN_SECONDS = 30; constexpr std::array<char, 8> VULKAN_CACHE_MAGIC_NUMBER{'y', 'u', 'z', 'u', 'v', 'k', 'c', 'h'}; diff --git a/src/video_core/texture_cache/format_lookup_table.cpp b/src/video_core/texture_cache/format_lookup_table.cpp index 20bb96aae3..18be2dcbf3 100644 --- a/src/video_core/texture_cache/format_lookup_table.cpp +++ b/src/video_core/texture_cache/format_lookup_table.cpp @@ -150,6 +150,7 @@ PixelFormat PixelFormatFromTextureInfo(TextureFormat format, ComponentType red, case Hash(TextureFormat::X8Z24, UNORM): return PixelFormat::X8_D24_UNORM; case Hash(TextureFormat::X8Z24, UNORM, UINT, UINT, UINT, LINEAR): + case Hash(TextureFormat::X8Z24, UNORM, UINT, UNORM, UNORM, LINEAR): return PixelFormat::X8_D24_UNORM; case Hash(TextureFormat::Z24S8, UINT, UNORM, UNORM, UNORM, LINEAR): return PixelFormat::S8_UINT_D24_UNORM; diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp index 8fa39e07e3..dbe5ea2334 100644 --- a/src/yuzu/main_window.cpp +++ b/src/yuzu/main_window.cpp @@ -459,29 +459,6 @@ MainWindow::MainWindow(bool has_broken_vulkan) // Gen keys if necessary OnCheckFirmwareDecryption(false); - auto* recommendations = new QMessageBox( - QMessageBox::Question, tr("Recommended Mario Kart World settings"), - tr("Use the recommended settings for Mario Kart World?\n\n" - "Vulkan, 1x resolution, GPU Fast, asynchronous shaders, BC3, conservative VRAM, " - "reactive flushing off, FIFO Relaxed VSync, handheld mode, ScaleForce, and FXAA.\n\n" - "Yes replaces your saved settings. No or closing this window keeps your settings."), - QMessageBox::Yes | QMessageBox::No, this); - recommendations->setAttribute(Qt::WA_DeleteOnClose); - recommendations->setDefaultButton(QMessageBox::No); - recommendations->setEscapeButton(QMessageBox::No); - recommendations->setWindowModality(Qt::NonModal); - connect(recommendations, &QMessageBox::finished, this, [this](int result) { - use_recommended_mkw_settings = result == QMessageBox::Yes; - if (use_recommended_mkw_settings && !emulation_running && !boot_in_progress) { - Settings::SetMarioKartWorldRecommendedSettings(Settings::values, true); - config->SaveAllValues(); - QtCommon::system->ApplySettings(); - UpdateStatusButtons(); - } - LOG_INFO(Config, "MKW recommended settings accepted: {}", use_recommended_mkw_settings); - }); - recommendations->show(); - #ifdef __unix__ OnCheckGraphicsBackend(); #endif @@ -1989,6 +1966,20 @@ void MainWindow::BootGame(const QString& filename, Service::AM::FrontendAppletPa QtCommon::system->ApplySettings(); } + if (title_id == Settings::MarioKartWorldProgramId && !asked_recommended_mkw_settings) { + asked_recommended_mkw_settings = true; + use_recommended_mkw_settings = + QMessageBox::question( + this, tr("Recommended Mario Kart World settings"), + tr("Use the recommended settings for Mario Kart World?\n\n" + "Vulkan, 1x resolution, GPU Fast, asynchronous shaders, BC3, conservative VRAM, " + "reactive flushing off, FIFO Relaxed VSync, handheld mode, ScaleForce, and " + "FXAA.\n\n" + "They apply to Mario Kart World until Eglantine is closed. Your saved settings " + "are not changed."), + QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes; + LOG_INFO(Config, "MKW recommended settings accepted: {}", use_recommended_mkw_settings); + } if (Settings::ApplyMarioKartWorldPreset(Settings::values, title_id, use_recommended_mkw_settings)) { QtCommon::system->ApplySettings(); diff --git a/src/yuzu/main_window.h b/src/yuzu/main_window.h index d6b0e5b312..1bd04a4d8b 100644 --- a/src/yuzu/main_window.h +++ b/src/yuzu/main_window.h @@ -504,6 +504,7 @@ private: MultiplayerState* multiplayer_state = nullptr; bool use_recommended_mkw_settings = false; + bool asked_recommended_mkw_settings = false; GRenderWindow* render_window = nullptr; GameList* game_list = nullptr; |
