diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/hle/service/nvdrv/core/syncpoint_manager.cpp | 2 | ||||
-rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 6 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_master_semaphore.cpp | 11 | ||||
-rw-r--r-- | src/yuzu/configuration/config.cpp | 36 | ||||
-rw-r--r-- | src/yuzu/configuration/config.h | 6 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 185 |
6 files changed, 164 insertions, 82 deletions
diff --git a/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp b/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp index aba51d280..c4c4c2593 100644 --- a/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp +++ b/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp @@ -64,7 +64,7 @@ void SyncpointManager::FreeSyncpoint(u32 id) { } bool SyncpointManager::IsSyncpointAllocated(u32 id) const { - return (id <= SyncpointCount) && syncpoints[id].reserved; + return (id < SyncpointCount) && syncpoints[id].reserved; } bool SyncpointManager::HasSyncpointExpired(u32 id, u32 threshold) const { diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 427afd5fc..f1ad5f7cb 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -1278,7 +1278,7 @@ typename BufferCache<P>::OverlapResult BufferCache<P>::ResolveOverlaps(VAddr cpu const VAddr overlap_cpu_addr = overlap.CpuAddr(); const bool expands_left = overlap_cpu_addr < begin; if (expands_left) { - cpu_addr = begin = overlap_cpu_addr; + begin = overlap_cpu_addr; } const VAddr overlap_end = overlap_cpu_addr + overlap.SizeBytes(); const bool expands_right = overlap_end > end; @@ -1292,7 +1292,7 @@ typename BufferCache<P>::OverlapResult BufferCache<P>::ResolveOverlaps(VAddr cpu has_stream_leap = true; if (expands_right) { begin -= CACHING_PAGESIZE * 256; - cpu_addr = begin; + cpu_addr = begin - CACHING_PAGESIZE; } if (expands_left) { end += CACHING_PAGESIZE * 256; @@ -1315,7 +1315,7 @@ void BufferCache<P>::JoinOverlap(BufferId new_buffer_id, BufferId overlap_id, if (accumulate_stream_score) { new_buffer.IncreaseStreamScore(overlap.StreamScore() + 1); } - boost::container::small_vector<BufferCopy, 1> copies; + boost::container::small_vector<BufferCopy, 10> copies; const size_t dst_base_offset = overlap.CpuAddr() - new_buffer.CpuAddr(); copies.push_back(BufferCopy{ .src_offset = 0, diff --git a/src/video_core/renderer_vulkan/vk_master_semaphore.cpp b/src/video_core/renderer_vulkan/vk_master_semaphore.cpp index 8b65aeaeb..b128c4f6e 100644 --- a/src/video_core/renderer_vulkan/vk_master_semaphore.cpp +++ b/src/video_core/renderer_vulkan/vk_master_semaphore.cpp @@ -128,15 +128,12 @@ VkResult MasterSemaphore::SubmitQueueTimeline(vk::CommandBuffer& cmdbuf, const std::array signal_values{host_tick, u64(0)}; const std::array signal_semaphores{timeline_semaphore, signal_semaphore}; - const u32 num_wait_semaphores = wait_semaphore ? 2 : 1; - const std::array wait_values{host_tick - 1, u64(1)}; - const std::array wait_semaphores{timeline_semaphore, wait_semaphore}; - + const u32 num_wait_semaphores = wait_semaphore ? 1 : 0; const VkTimelineSemaphoreSubmitInfo timeline_si{ .sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO, .pNext = nullptr, - .waitSemaphoreValueCount = num_wait_semaphores, - .pWaitSemaphoreValues = wait_values.data(), + .waitSemaphoreValueCount = 0, + .pWaitSemaphoreValues = nullptr, .signalSemaphoreValueCount = num_signal_semaphores, .pSignalSemaphoreValues = signal_values.data(), }; @@ -144,7 +141,7 @@ VkResult MasterSemaphore::SubmitQueueTimeline(vk::CommandBuffer& cmdbuf, .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO, .pNext = &timeline_si, .waitSemaphoreCount = num_wait_semaphores, - .pWaitSemaphores = wait_semaphores.data(), + .pWaitSemaphores = &wait_semaphore, .pWaitDstStageMask = wait_stage_masks.data(), .commandBufferCount = 1, .pCommandBuffers = cmdbuf.address(), diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 662651196..6288fef62 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -65,6 +65,42 @@ const std::array<int, 2> Config::default_ringcon_analogs{{ Qt::Key_D, }}; +const std::map<Settings::AntiAliasing, QString> Config::anti_aliasing_texts_map = { + {Settings::AntiAliasing::None, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "None"))}, + {Settings::AntiAliasing::Fxaa, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "FXAA"))}, + {Settings::AntiAliasing::Smaa, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "SMAA"))}, +}; + +const std::map<Settings::ScalingFilter, QString> Config::scaling_filter_texts_map = { + {Settings::ScalingFilter::NearestNeighbor, + QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Nearest"))}, + {Settings::ScalingFilter::Bilinear, + QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Bilinear"))}, + {Settings::ScalingFilter::Bicubic, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Bicubic"))}, + {Settings::ScalingFilter::Gaussian, + QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Gaussian"))}, + {Settings::ScalingFilter::ScaleForce, + QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "ScaleForce"))}, + {Settings::ScalingFilter::Fsr, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "FSR"))}, +}; + +const std::map<bool, QString> Config::use_docked_mode_texts_map = { + {true, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Docked"))}, + {false, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Handheld"))}, +}; + +const std::map<Settings::GPUAccuracy, QString> Config::gpu_accuracy_texts_map = { + {Settings::GPUAccuracy::Normal, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Normal"))}, + {Settings::GPUAccuracy::High, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "High"))}, + {Settings::GPUAccuracy::Extreme, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Extreme"))}, +}; + +const std::map<Settings::RendererBackend, QString> Config::renderer_backend_texts_map = { + {Settings::RendererBackend::Vulkan, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Vulkan"))}, + {Settings::RendererBackend::OpenGL, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "OpenGL"))}, + {Settings::RendererBackend::Null, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Null"))}, +}; + // This shouldn't have anything except static initializers (no functions). So // QKeySequence(...).toString() is NOT ALLOWED HERE. // This must be in alphabetical order according to action name as it must have the same order as diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index 9cb9db6cf..ad590ea9e 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h @@ -49,6 +49,12 @@ public: static const std::array<int, Settings::NativeKeyboard::NumKeyboardMods> default_keyboard_mods; static const std::array<UISettings::Shortcut, 22> default_hotkeys; + static const std::map<Settings::AntiAliasing, QString> anti_aliasing_texts_map; + static const std::map<Settings::ScalingFilter, QString> scaling_filter_texts_map; + static const std::map<bool, QString> use_docked_mode_texts_map; + static const std::map<Settings::GPUAccuracy, QString> gpu_accuracy_texts_map; + static const std::map<Settings::RendererBackend, QString> renderer_backend_texts_map; + static constexpr UISettings::Theme default_theme{ #ifdef _WIN32 UISettings::Theme::DarkColorful diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 25cfef6d5..82bce9a3a 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1054,6 +1054,24 @@ void GMainWindow::InitializeWidgets() { bottomLeft.setY(bottomLeft.y() - volume_popup->geometry().height()); volume_popup->setGeometry(QRect(bottomLeft, QSize(rect.width(), rect.height()))); }); + volume_button->setContextMenuPolicy(Qt::CustomContextMenu); + connect(volume_button, &QPushButton::customContextMenuRequested, + [this](const QPoint& menu_location) { + QMenu context_menu; + context_menu.addAction( + Settings::values.audio_muted ? tr("Unmute") : tr("Mute"), [this] { + Settings::values.audio_muted = !Settings::values.audio_muted; + UpdateVolumeUI(); + }); + + context_menu.addAction(tr("Reset Volume"), [this] { + Settings::values.volume.SetValue(100); + UpdateVolumeUI(); + }); + + context_menu.exec(volume_button->mapToGlobal(menu_location)); + volume_button->repaint(); + }); statusBar()->insertPermanentWidget(0, volume_button); // setup AA button @@ -1074,6 +1092,19 @@ void GMainWindow::InitializeWidgets() { UpdateAAText(); aa_status_button->setCheckable(true); aa_status_button->setChecked(true); + aa_status_button->setContextMenuPolicy(Qt::CustomContextMenu); + connect(aa_status_button, &QPushButton::customContextMenuRequested, + [this](const QPoint& menu_location) { + QMenu context_menu; + for (auto const& aa_text_pair : Config::anti_aliasing_texts_map) { + context_menu.addAction(aa_text_pair.second, [this, aa_text_pair] { + Settings::values.anti_aliasing.SetValue(aa_text_pair.first); + UpdateAAText(); + }); + } + context_menu.exec(aa_status_button->mapToGlobal(menu_location)); + aa_status_button->repaint(); + }); statusBar()->insertPermanentWidget(0, aa_status_button); // Setup Filter button @@ -1085,6 +1116,19 @@ void GMainWindow::InitializeWidgets() { UpdateFilterText(); filter_status_button->setCheckable(true); filter_status_button->setChecked(true); + filter_status_button->setContextMenuPolicy(Qt::CustomContextMenu); + connect(filter_status_button, &QPushButton::customContextMenuRequested, + [this](const QPoint& menu_location) { + QMenu context_menu; + for (auto const& filter_text_pair : Config::scaling_filter_texts_map) { + context_menu.addAction(filter_text_pair.second, [this, filter_text_pair] { + Settings::values.scaling_filter.SetValue(filter_text_pair.first); + UpdateFilterText(); + }); + } + context_menu.exec(filter_status_button->mapToGlobal(menu_location)); + filter_status_button->repaint(); + }); statusBar()->insertPermanentWidget(0, filter_status_button); // Setup Dock button @@ -1094,14 +1138,47 @@ void GMainWindow::InitializeWidgets() { connect(dock_status_button, &QPushButton::clicked, this, &GMainWindow::OnToggleDockedMode); dock_status_button->setCheckable(true); UpdateDockedButton(); + dock_status_button->setContextMenuPolicy(Qt::CustomContextMenu); + connect(dock_status_button, &QPushButton::customContextMenuRequested, + [this](const QPoint& menu_location) { + QMenu context_menu; + + for (auto const& docked_mode_pair : Config::use_docked_mode_texts_map) { + context_menu.addAction(docked_mode_pair.second, [this, docked_mode_pair] { + if (docked_mode_pair.first != Settings::values.use_docked_mode.GetValue()) { + OnToggleDockedMode(); + } + }); + } + context_menu.exec(dock_status_button->mapToGlobal(menu_location)); + dock_status_button->repaint(); + }); statusBar()->insertPermanentWidget(0, dock_status_button); + // Setup GPU Accuracy button gpu_accuracy_button = new QPushButton(); gpu_accuracy_button->setObjectName(QStringLiteral("GPUStatusBarButton")); gpu_accuracy_button->setCheckable(true); gpu_accuracy_button->setFocusPolicy(Qt::NoFocus); connect(gpu_accuracy_button, &QPushButton::clicked, this, &GMainWindow::OnToggleGpuAccuracy); UpdateGPUAccuracyButton(); + gpu_accuracy_button->setContextMenuPolicy(Qt::CustomContextMenu); + connect(gpu_accuracy_button, &QPushButton::customContextMenuRequested, + [this](const QPoint& menu_location) { + QMenu context_menu; + + for (auto const& gpu_accuracy_pair : Config::gpu_accuracy_texts_map) { + if (gpu_accuracy_pair.first == Settings::GPUAccuracy::Extreme) { + continue; + } + context_menu.addAction(gpu_accuracy_pair.second, [this, gpu_accuracy_pair] { + Settings::values.gpu_accuracy.SetValue(gpu_accuracy_pair.first); + UpdateGPUAccuracyButton(); + }); + } + context_menu.exec(gpu_accuracy_button->mapToGlobal(menu_location)); + gpu_accuracy_button->repaint(); + }); statusBar()->insertPermanentWidget(0, gpu_accuracy_button); // Setup Renderer API button @@ -1114,6 +1191,24 @@ void GMainWindow::InitializeWidgets() { renderer_status_button->setCheckable(true); renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() == Settings::RendererBackend::Vulkan); + renderer_status_button->setContextMenuPolicy(Qt::CustomContextMenu); + connect(renderer_status_button, &QPushButton::customContextMenuRequested, + [this](const QPoint& menu_location) { + QMenu context_menu; + + for (auto const& renderer_backend_pair : Config::renderer_backend_texts_map) { + if (renderer_backend_pair.first == Settings::RendererBackend::Null) { + continue; + } + context_menu.addAction( + renderer_backend_pair.second, [this, renderer_backend_pair] { + Settings::values.renderer_backend.SetValue(renderer_backend_pair.first); + UpdateAPIText(); + }); + } + context_menu.exec(renderer_status_button->mapToGlobal(menu_location)); + renderer_status_button->repaint(); + }); statusBar()->insertPermanentWidget(0, renderer_status_button); statusBar()->setVisible(true); @@ -1798,6 +1893,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t } system->SetShuttingDown(false); + game_list->setDisabled(true); // Create and start the emulation thread emu_thread = std::make_unique<EmuThread>(*system); @@ -1993,6 +2089,9 @@ void GMainWindow::OnEmulationStopped() { // When closing the game, destroy the GLWindow to clear the context after the game is closed render_window->ReleaseRenderTarget(); + // Enable game list + game_list->setEnabled(true); + Settings::RestoreGlobalState(system->IsPoweredOn()); system->HIDCore().ReloadInputDevices(); UpdateStatusButtons(); @@ -4000,94 +4099,38 @@ void GMainWindow::UpdateStatusBar() { } void GMainWindow::UpdateGPUAccuracyButton() { - switch (Settings::values.gpu_accuracy.GetValue()) { - case Settings::GPUAccuracy::Normal: { - gpu_accuracy_button->setText(tr("GPU NORMAL")); - gpu_accuracy_button->setChecked(false); - break; - } - case Settings::GPUAccuracy::High: { - gpu_accuracy_button->setText(tr("GPU HIGH")); - gpu_accuracy_button->setChecked(true); - break; - } - case Settings::GPUAccuracy::Extreme: { - gpu_accuracy_button->setText(tr("GPU EXTREME")); - gpu_accuracy_button->setChecked(true); - break; - } - default: { - gpu_accuracy_button->setText(tr("GPU ERROR")); - gpu_accuracy_button->setChecked(true); - break; - } - } + const auto gpu_accuracy = Settings::values.gpu_accuracy.GetValue(); + const auto gpu_accuracy_text = Config::gpu_accuracy_texts_map.find(gpu_accuracy)->second; + gpu_accuracy_button->setText(gpu_accuracy_text.toUpper()); + gpu_accuracy_button->setChecked(gpu_accuracy != Settings::GPUAccuracy::Normal); } void GMainWindow::UpdateDockedButton() { const bool is_docked = Settings::values.use_docked_mode.GetValue(); dock_status_button->setChecked(is_docked); - dock_status_button->setText(is_docked ? tr("DOCKED") : tr("HANDHELD")); + dock_status_button->setText( + Config::use_docked_mode_texts_map.find(is_docked)->second.toUpper()); } void GMainWindow::UpdateAPIText() { const auto api = Settings::values.renderer_backend.GetValue(); - switch (api) { - case Settings::RendererBackend::OpenGL: - renderer_status_button->setText(tr("OPENGL")); - break; - case Settings::RendererBackend::Vulkan: - renderer_status_button->setText(tr("VULKAN")); - break; - case Settings::RendererBackend::Null: - renderer_status_button->setText(tr("NULL")); - break; - } + const auto renderer_status_text = Config::renderer_backend_texts_map.find(api)->second; + renderer_status_button->setText(renderer_status_text.toUpper()); } void GMainWindow::UpdateFilterText() { const auto filter = Settings::values.scaling_filter.GetValue(); - switch (filter) { - case Settings::ScalingFilter::NearestNeighbor: - filter_status_button->setText(tr("NEAREST")); - break; - case Settings::ScalingFilter::Bilinear: - filter_status_button->setText(tr("BILINEAR")); - break; - case Settings::ScalingFilter::Bicubic: - filter_status_button->setText(tr("BICUBIC")); - break; - case Settings::ScalingFilter::Gaussian: - filter_status_button->setText(tr("GAUSSIAN")); - break; - case Settings::ScalingFilter::ScaleForce: - filter_status_button->setText(tr("SCALEFORCE")); - break; - case Settings::ScalingFilter::Fsr: - filter_status_button->setText(tr("FSR")); - break; - default: - filter_status_button->setText(tr("BILINEAR")); - break; - } + const auto filter_text = Config::scaling_filter_texts_map.find(filter)->second; + filter_status_button->setText(filter == Settings::ScalingFilter::Fsr ? tr("FSR") + : filter_text.toUpper()); } void GMainWindow::UpdateAAText() { const auto aa_mode = Settings::values.anti_aliasing.GetValue(); - switch (aa_mode) { - case Settings::AntiAliasing::None: - aa_status_button->setText(tr("NO AA")); - break; - case Settings::AntiAliasing::Fxaa: - aa_status_button->setText(tr("FXAA")); - break; - case Settings::AntiAliasing::Smaa: - aa_status_button->setText(tr("SMAA")); - break; - default: - aa_status_button->setText(tr("NO AA")); - break; - } + const auto aa_text = Config::anti_aliasing_texts_map.find(aa_mode)->second; + aa_status_button->setText(aa_mode == Settings::AntiAliasing::None + ? QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "NO AA")) + : aa_text.toUpper()); } void GMainWindow::UpdateVolumeUI() { |