mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2024-11-22 13:55:41 +01:00
settings: File selector & other settings
First of all, TASing requires a script to play back. The user can select the parent directory at `System -> Filesystem`, next to an option to pause TAS during loads: This requires a "hacky" setup deeper in the code and will be added in the last commit. Also, Hotkeys are being introduced: CTRL+F5 for playback start/stop, CTRL+F6 for re-reading the script and CTRL+F7 for recording a new script.
This commit is contained in:
parent
b42c3ce21d
commit
f25d6ebc45
@ -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;
|
||||
|
@ -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.
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -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"};
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -32,6 +32,7 @@ private:
|
||||
Gamecard,
|
||||
Dump,
|
||||
Load,
|
||||
TAS,
|
||||
};
|
||||
|
||||
void SetDirectory(DirectoryTarget target, QLineEdit* edit);
|
||||
|
@ -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>
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user