summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMonsterDruide1 <5958456@gmail.com>2021-06-18 16:20:10 +0200
committerMonsterDruide1 <5958456@gmail.com>2021-09-18 23:22:11 +0200
commitf25d6ebc45dc02904ef3ca6ad8efea9a0853d194 (patch)
tree45ad353f9b1a76e05cee0d9abe4a9642eaa9b3d0
parentinput_common/tas: Base playback & recording system (diff)
downloadyuzu-f25d6ebc45dc02904ef3ca6ad8efea9a0853d194.tar
yuzu-f25d6ebc45dc02904ef3ca6ad8efea9a0853d194.tar.gz
yuzu-f25d6ebc45dc02904ef3ca6ad8efea9a0853d194.tar.bz2
yuzu-f25d6ebc45dc02904ef3ca6ad8efea9a0853d194.tar.lz
yuzu-f25d6ebc45dc02904ef3ca6ad8efea9a0853d194.tar.xz
yuzu-f25d6ebc45dc02904ef3ca6ad8efea9a0853d194.tar.zst
yuzu-f25d6ebc45dc02904ef3ca6ad8efea9a0853d194.zip
Diffstat (limited to '')
-rw-r--r--src/common/fs/path_util.cpp2
-rw-r--r--src/common/fs/path_util.h2
-rw-r--r--src/common/settings.h3
-rw-r--r--src/yuzu/configuration/config.cpp24
-rw-r--r--src/yuzu/configuration/config.h2
-rw-r--r--src/yuzu/configuration/configure_filesystem.cpp10
-rw-r--r--src/yuzu/configuration/configure_filesystem.h1
-rw-r--r--src/yuzu/configuration/configure_filesystem.ui49
-rw-r--r--src/yuzu/main.cpp13
9 files changed, 104 insertions, 2 deletions
diff --git a/src/common/fs/path_util.cpp b/src/common/fs/path_util.cpp
index 6cdd14f13..5f76adedb 100644
--- a/src/common/fs/path_util.cpp
+++ b/src/common/fs/path_util.cpp
@@ -116,6 +116,8 @@ private:
GenerateYuzuPath(YuzuPath::ScreenshotsDir, yuzu_path / SCREENSHOTS_DIR);
GenerateYuzuPath(YuzuPath::SDMCDir, yuzu_path / SDMC_DIR);
GenerateYuzuPath(YuzuPath::ShaderDir, yuzu_path / SHADER_DIR);
+
+ GenerateYuzuPath(YuzuPath::TASFile, fs::path{""});
}
~PathManagerImpl() = default;
diff --git a/src/common/fs/path_util.h b/src/common/fs/path_util.h
index f956ac9a2..6079de4c6 100644
--- a/src/common/fs/path_util.h
+++ b/src/common/fs/path_util.h
@@ -23,6 +23,8 @@ enum class YuzuPath {
ScreenshotsDir, // Where yuzu screenshots are stored.
SDMCDir, // Where the emulated SDMC is stored.
ShaderDir, // Where shaders are stored.
+
+ TASFile, // Where the current script file is stored.
};
/**
diff --git a/src/common/settings.h b/src/common/settings.h
index 29b888f10..884ea55f8 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -550,6 +550,9 @@ struct Values {
BasicSetting<bool> gamecard_current_game{false, "gamecard_current_game"};
BasicSetting<std::string> gamecard_path{std::string(), "gamecard_path"};
+ // TAS
+ bool pauseTasOnLoad;
+
// Debugging
bool record_frame_times;
BasicSetting<bool> use_gdbstub{false, "use_gdbstub"};
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 952e96769..99e318a8f 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -221,7 +221,7 @@ const std::array<int, Settings::NativeKeyboard::NumKeyboardMods> Config::default
// This must be in alphabetical order according to action name as it must have the same order as
// UISetting::values.shortcuts, which is alphabetically ordered.
// clang-format off
-const std::array<UISettings::Shortcut, 18> Config::default_hotkeys{{
+const std::array<UISettings::Shortcut, 21> Config::default_hotkeys{{
{QStringLiteral("Capture Screenshot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+P"), Qt::WidgetWithChildrenShortcut}},
{QStringLiteral("Change Docked Mode"), QStringLiteral("Main Window"), {QStringLiteral("F10"), Qt::ApplicationShortcut}},
{QStringLiteral("Continue/Pause Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F4"), Qt::WindowShortcut}},
@@ -235,6 +235,9 @@ const std::array<UISettings::Shortcut, 18> Config::default_hotkeys{{
{QStringLiteral("Mute Audio"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+M"), Qt::WindowShortcut}},
{QStringLiteral("Restart Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F6"), Qt::WindowShortcut}},
{QStringLiteral("Stop Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F5"), Qt::WindowShortcut}},
+ {QStringLiteral("TAS Start/Stop"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F5"), Qt::ApplicationShortcut}},
+ {QStringLiteral("TAS Reset"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F6"), Qt::ApplicationShortcut}},
+ {QStringLiteral("TAS Record"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F7"), Qt::ApplicationShortcut}},
{QStringLiteral("Toggle Filter Bar"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F"), Qt::WindowShortcut}},
{QStringLiteral("Toggle Framerate Limit"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+U"), Qt::ApplicationShortcut}},
{QStringLiteral("Toggle Mouse Panning"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F9"), Qt::ApplicationShortcut}},
@@ -564,6 +567,9 @@ void Config::ReadControlValues() {
Settings::values.mouse_panning = false;
ReadBasicSetting(Settings::values.mouse_panning_sensitivity);
+ ReadBasicSetting(Settings::values.tas_enable = false);
+ ReadBasicSetting(Settings::values.tas_reset = false);
+
ReadGlobalSetting(Settings::values.use_docked_mode);
// Disable docked mode if handheld is selected
@@ -661,9 +667,20 @@ void Config::ReadDataStorageValues() {
QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::DumpDir)))
.toString()
.toStdString());
+ FS::SetYuzuPath(
+ FS::YuzuPath::TASFile,
+ qt_config
+ ->value(QStringLiteral("tas_path"),
+ QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::TASFile)))
+ .toString()
+ .toStdString());
+
+ ReadBasicSetting(Settings::values.pauseTasOnLoad);
+
ReadBasicSetting(Settings::values.gamecard_inserted);
ReadBasicSetting(Settings::values.gamecard_current_game);
ReadBasicSetting(Settings::values.gamecard_path);
+
qt_config->endGroup();
}
@@ -1215,6 +1232,11 @@ void Config::SaveDataStorageValues() {
WriteSetting(QStringLiteral("dump_directory"),
QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::DumpDir)),
QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::DumpDir)));
+ WriteSetting(QStringLiteral("tas_path"),
+ QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::TASFile)),
+ QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::TASFile)));
+ WriteSetting(QStringLiteral("tas_pause_on_load"), Settings::values.pauseTasOnLoad, true);
+
WriteBasicSetting(Settings::values.gamecard_inserted);
WriteBasicSetting(Settings::values.gamecard_current_game);
WriteBasicSetting(Settings::values.gamecard_path);
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h
index 4733227b6..3ee694e7c 100644
--- a/src/yuzu/configuration/config.h
+++ b/src/yuzu/configuration/config.h
@@ -42,7 +42,7 @@ public:
default_mouse_buttons;
static const std::array<int, Settings::NativeKeyboard::NumKeyboardKeys> default_keyboard_keys;
static const std::array<int, Settings::NativeKeyboard::NumKeyboardMods> default_keyboard_mods;
- static const std::array<UISettings::Shortcut, 18> default_hotkeys;
+ static const std::array<UISettings::Shortcut, 21> default_hotkeys;
private:
void Initialize(const std::string& config_name);
diff --git a/src/yuzu/configuration/configure_filesystem.cpp b/src/yuzu/configuration/configure_filesystem.cpp
index 9cb317822..cd9ba0a90 100644
--- a/src/yuzu/configuration/configure_filesystem.cpp
+++ b/src/yuzu/configuration/configure_filesystem.cpp
@@ -26,6 +26,8 @@ ConfigureFilesystem::ConfigureFilesystem(QWidget* parent)
[this] { SetDirectory(DirectoryTarget::Dump, ui->dump_path_edit); });
connect(ui->load_path_button, &QToolButton::pressed, this,
[this] { SetDirectory(DirectoryTarget::Load, ui->load_path_edit); });
+ connect(ui->tas_path_button, &QToolButton::pressed, this,
+ [this] { SetDirectory(DirectoryTarget::TAS, ui->tas_path_edit); });
connect(ui->reset_game_list_cache, &QPushButton::pressed, this,
&ConfigureFilesystem::ResetMetadata);
@@ -49,9 +51,12 @@ void ConfigureFilesystem::setConfiguration() {
QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::DumpDir)));
ui->load_path_edit->setText(
QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::LoadDir)));
+ ui->tas_path_edit->setText(
+ QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::TASFile)));
ui->gamecard_inserted->setChecked(Settings::values.gamecard_inserted.GetValue());
ui->gamecard_current_game->setChecked(Settings::values.gamecard_current_game.GetValue());
+ ui->tas_pause_on_load->setChecked(Settings::values.pauseTasOnLoad);
ui->dump_exefs->setChecked(Settings::values.dump_exefs.GetValue());
ui->dump_nso->setChecked(Settings::values.dump_nso.GetValue());
@@ -69,9 +74,11 @@ void ConfigureFilesystem::applyConfiguration() {
ui->dump_path_edit->text().toStdString());
Common::FS::SetYuzuPath(Common::FS::YuzuPath::LoadDir,
ui->load_path_edit->text().toStdString());
+ Common::FS::SetYuzuPath(Common::FS::YuzuPath::TASFile, ui->tas_path_edit->text().toStdString());
Settings::values.gamecard_inserted = ui->gamecard_inserted->isChecked();
Settings::values.gamecard_current_game = ui->gamecard_current_game->isChecked();
+ Settings::values.pauseTasOnLoad = ui->tas_pause_on_load->isChecked();
Settings::values.dump_exefs = ui->dump_exefs->isChecked();
Settings::values.dump_nso = ui->dump_nso->isChecked();
@@ -97,6 +104,9 @@ void ConfigureFilesystem::SetDirectory(DirectoryTarget target, QLineEdit* edit)
case DirectoryTarget::Load:
caption = tr("Select Mod Load Directory...");
break;
+ case DirectoryTarget::TAS:
+ caption = tr("Select TAS Directory...");
+ break;
}
QString str;
diff --git a/src/yuzu/configuration/configure_filesystem.h b/src/yuzu/configuration/configure_filesystem.h
index 2147cd405..86dab8684 100644
--- a/src/yuzu/configuration/configure_filesystem.h
+++ b/src/yuzu/configuration/configure_filesystem.h
@@ -32,6 +32,7 @@ private:
Gamecard,
Dump,
Load,
+ TAS,
};
void SetDirectory(DirectoryTarget target, QLineEdit* edit);
diff --git a/src/yuzu/configuration/configure_filesystem.ui b/src/yuzu/configuration/configure_filesystem.ui
index 62b9abc7a..8ac7250fd 100644
--- a/src/yuzu/configuration/configure_filesystem.ui
+++ b/src/yuzu/configuration/configure_filesystem.ui
@@ -219,6 +219,55 @@
</layout>
</widget>
</item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>TAS Directories</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Path</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <widget class="QToolButton" name="tas_path_button">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLineEdit" name="tas_path_edit"/>
+ </item>
+ <item row="0" column="1">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Maximum</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>60</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="0" colspan="4">
+ <widget class="QCheckBox" name="tas_pause_on_load">
+ <property name="text">
+ <string>Pause TAS execution during loads (SMO - 1.3)</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
</layout>
</item>
<item>
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 22489231b..f3529d151 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1015,6 +1015,19 @@ void GMainWindow::InitializeHotkeys() {
render_window->setAttribute(Qt::WA_Hover, true);
}
});
+ connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("TAS Start/Stop"), this),
+ &QShortcut::activated, this, [&] {
+ Settings::values.tas_enable = !Settings::values.tas_enable;
+ LOG_INFO(Frontend, "Tas enabled {}", Settings::values.tas_enable);
+ });
+
+ connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("TAS Reset"), this),
+ &QShortcut::activated, this, [&] { Settings::values.tas_reset = true; });
+ connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("TAS Record"), this),
+ &QShortcut::activated, this, [&] {
+ Settings::values.tas_record = !Settings::values.tas_record;
+ LOG_INFO(Frontend, "Tas recording {}", Settings::values.tas_record);
+ });
}
void GMainWindow::SetDefaultUIGeometry() {