From 429dc2a94474eb15304c45938dcfb3ad72db4b51 Mon Sep 17 00:00:00 2001 From: Auxy6858 <71662994+Auxy6858@users.noreply.github.com> Date: Tue, 26 Mar 2024 16:40:10 +0000 Subject: [PATCH] Added rom path (#474) * Added app icon to the window * Added Roms path Added an option to the config to set a folder that opens when selecting a game instead of having to navigate to the folder manually every time. * Clear up PR * Clear up PR --------- Co-authored-by: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> --- include/config.hpp | 4 +++- src/config.cpp | 2 ++ src/panda_qt/main_window.cpp | 6 ++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/config.hpp b/include/config.hpp index 8c0d2e12..2333c682 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -6,7 +6,7 @@ // Remember to initialize every field here to its default value otherwise bad things will happen struct EmulatorConfig { - // Only enable the shader JIT by default on platforms where it's completely tested + // Only enable the shader JIT by default on platforms where it's completely tested #ifdef PANDA3DS_X64_HOST static constexpr bool shaderJitDefault = true; #else @@ -29,6 +29,8 @@ struct EmulatorConfig { // Default to 3% battery to make users suffer int batteryPercentage = 3; + // Default ROM path to open in Qt and misc frontends + std::filesystem::path defaultRomPath = ""; std::filesystem::path filePath; EmulatorConfig(const std::filesystem::path& path); diff --git a/src/config.cpp b/src/config.cpp index 299ef594..2f9b7e00 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -40,6 +40,7 @@ void EmulatorConfig::load() { discordRpcEnabled = toml::find_or(general, "EnableDiscordRPC", false); usePortableBuild = toml::find_or(general, "UsePortableBuild", false); + defaultRomPath = toml::find_or(general, "DefaultRomPath", ""); } } @@ -120,6 +121,7 @@ void EmulatorConfig::save() { data["General"]["EnableDiscordRPC"] = discordRpcEnabled; data["General"]["UsePortableBuild"] = usePortableBuild; + data["General"]["DefaultRomPath"] = defaultRomPath.string(); data["GPU"]["EnableShaderJIT"] = shaderJitEnabled; data["GPU"]["Renderer"] = std::string(Renderer::typeToString(rendererType)); data["GPU"]["EnableVSync"] = vsyncEnabled; diff --git a/src/panda_qt/main_window.cpp b/src/panda_qt/main_window.cpp index 17f9ff26..3ff1049c 100644 --- a/src/panda_qt/main_window.cpp +++ b/src/panda_qt/main_window.cpp @@ -139,8 +139,10 @@ void MainWindow::swapEmuBuffer() { } void MainWindow::selectROM() { - auto path = - QFileDialog::getOpenFileName(this, tr("Select 3DS ROM to load"), "", tr("Nintendo 3DS ROMs (*.3ds *.cci *.cxi *.app *.3dsx *.elf *.axf)")); + auto path = QFileDialog::getOpenFileName( + this, tr("Select 3DS ROM to load"), QString::fromStdU16String(emu->getConfig().defaultRomPath.u16string()), + tr("Nintendo 3DS ROMs (*.3ds *.cci *.cxi *.app *.3dsx *.elf *.axf)") + ); if (!path.isEmpty()) { std::filesystem::path* p = new std::filesystem::path(path.toStdU16String());