summaryrefslogtreecommitdiff
path: root/src/yuzu/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r--src/yuzu/main.cpp57
1 files changed, 50 insertions, 7 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 524650144..571eacf9f 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1839,9 +1839,11 @@ void GMainWindow::OnEmulationStopTimeExpired() {
void GMainWindow::OnEmulationStopped() {
shutdown_timer.stop();
- emu_thread->disconnect();
- emu_thread->wait();
- emu_thread = nullptr;
+ if (emu_thread) {
+ emu_thread->disconnect();
+ emu_thread->wait();
+ emu_thread.reset();
+ }
if (shutdown_dialog) {
shutdown_dialog->deleteLater();
@@ -2229,8 +2231,10 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ
}
switch (target) {
- case GameListRemoveTarget::GlShaderCache:
case GameListRemoveTarget::VkShaderCache:
+ RemoveVulkanDriverPipelineCache(program_id);
+ [[fallthrough]];
+ case GameListRemoveTarget::GlShaderCache:
RemoveTransferableShaderCache(program_id, target);
break;
case GameListRemoveTarget::AllShaderCache:
@@ -2271,6 +2275,22 @@ void GMainWindow::RemoveTransferableShaderCache(u64 program_id, GameListRemoveTa
}
}
+void GMainWindow::RemoveVulkanDriverPipelineCache(u64 program_id) {
+ static constexpr std::string_view target_file_name = "vulkan_pipelines.bin";
+
+ const auto shader_cache_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir);
+ const auto shader_cache_folder_path = shader_cache_dir / fmt::format("{:016x}", program_id);
+ const auto target_file = shader_cache_folder_path / target_file_name;
+
+ if (!Common::FS::Exists(target_file)) {
+ return;
+ }
+ if (!Common::FS::RemoveFile(target_file)) {
+ QMessageBox::warning(this, tr("Error Removing Vulkan Driver Pipeline Cache"),
+ tr("Failed to remove the driver pipeline cache."));
+ }
+}
+
void GMainWindow::RemoveAllTransferableShaderCaches(u64 program_id) {
const auto shader_cache_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir);
const auto program_shader_cache_dir = shader_cache_dir / fmt::format("{:016x}", program_id);
@@ -3011,6 +3031,8 @@ void GMainWindow::OnStopGame() {
if (OnShutdownBegin()) {
OnShutdownBeginDialog();
+ } else {
+ OnEmulationStopped();
}
}
@@ -3708,15 +3730,36 @@ void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_vie
}
}
+std::string GMainWindow::CreateTASFramesString(
+ std::array<size_t, InputCommon::TasInput::PLAYER_NUMBER> frames) const {
+ std::string string = "";
+ size_t maxPlayerIndex = 0;
+ for (size_t i = 0; i < frames.size(); i++) {
+ if (frames[i] != 0) {
+ if (maxPlayerIndex != 0)
+ string += ", ";
+ while (maxPlayerIndex++ != i)
+ string += "0, ";
+ string += std::to_string(frames[i]);
+ }
+ }
+ return string;
+}
+
QString GMainWindow::GetTasStateDescription() const {
auto [tas_status, current_tas_frame, total_tas_frames] = input_subsystem->GetTas()->GetStatus();
+ std::string tas_frames_string = CreateTASFramesString(total_tas_frames);
switch (tas_status) {
case InputCommon::TasInput::TasState::Running:
- return tr("TAS state: Running %1/%2").arg(current_tas_frame).arg(total_tas_frames);
+ return tr("TAS state: Running %1/%2")
+ .arg(current_tas_frame)
+ .arg(QString::fromStdString(tas_frames_string));
case InputCommon::TasInput::TasState::Recording:
- return tr("TAS state: Recording %1").arg(total_tas_frames);
+ return tr("TAS state: Recording %1").arg(total_tas_frames[0]);
case InputCommon::TasInput::TasState::Stopped:
- return tr("TAS state: Idle %1/%2").arg(current_tas_frame).arg(total_tas_frames);
+ return tr("TAS state: Idle %1/%2")
+ .arg(current_tas_frame)
+ .arg(QString::fromStdString(tas_frames_string));
default:
return tr("TAS State: Invalid");
}