From 2c6b601333cbf24681d4726d49566eb97d8b478a Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:09:57 +0200 Subject: [PATCH] Clear up PR --- CMakeLists.txt | 6 +-- docs/icon/NewPand.svg | 81 ------------------------------------ include/config.hpp | 7 ++-- src/config.cpp | 7 +--- src/panda_qt/main_window.cpp | 20 +++------ 5 files changed, 13 insertions(+), 108 deletions(-) delete mode 100644 docs/icon/NewPand.svg diff --git a/CMakeLists.txt b/CMakeLists.txt index 729016ce..dc230bf6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -475,7 +475,7 @@ if(NOT BUILD_HYDRA_CORE) qt_add_resources(AlberCore "app_images" PREFIX "/" FILES - docs/img/rsob_icon.png docs/img/rstarstruck_icon.png docs/icon/NewPand.svg + docs/img/rsob_icon.png docs/img/rstarstruck_icon.png ) else() set(FRONTEND_SOURCE_FILES src/panda_sdl/main.cpp src/panda_sdl/frontend_sdl.cpp src/panda_sdl/mappings.cpp) @@ -487,9 +487,7 @@ if(NOT BUILD_HYDRA_CORE) elseif(BUILD_HYDRA_CORE) target_compile_definitions(AlberCore PRIVATE PANDA3DS_HYDRA_CORE=1) include_directories(third_party/hydra_core/include) - add_library(Alber SHARED src/hydra_core.cpp - src/panda_qt/main.cpp - ) + add_library(Alber SHARED src/hydra_core.cpp) target_link_libraries(Alber PUBLIC AlberCore) endif() diff --git a/docs/icon/NewPand.svg b/docs/icon/NewPand.svg deleted file mode 100644 index ce911c1b..00000000 --- a/docs/icon/NewPand.svg +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/include/config.hpp b/include/config.hpp index bb4791b9..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,12 +29,11 @@ struct EmulatorConfig { // Default to 3% battery to make users suffer int batteryPercentage = 3; - std::string romsPath = ""; - + // Default ROM path to open in Qt and misc frontends + std::filesystem::path defaultRomPath = ""; std::filesystem::path filePath; EmulatorConfig(const std::filesystem::path& path); void load(); void save(); - std::string getRomsPath(); }; \ No newline at end of file diff --git a/src/config.cpp b/src/config.cpp index 9899bd28..09338e49 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -40,7 +40,7 @@ void EmulatorConfig::load() { discordRpcEnabled = toml::find_or(general, "EnableDiscordRPC", false); usePortableBuild = toml::find_or(general, "UsePortableBuild", false); - romsPath = toml::find_or(general, "RomsPath",""); + defaultRomPath = toml::find_or(general, "DefaultRomPath", ""); } } @@ -121,7 +121,7 @@ void EmulatorConfig::save() { data["General"]["EnableDiscordRPC"] = discordRpcEnabled; data["General"]["UsePortableBuild"] = usePortableBuild; - data["General"]["RomsPath"] = romsPath; + data["General"]["DefaultRomPath"] = defaultRomPath.string(); data["GPU"]["EnableShaderJIT"] = shaderJitEnabled; data["GPU"]["Renderer"] = std::string(Renderer::typeToString(rendererType)); data["GPU"]["EnableVSync"] = vsyncEnabled; @@ -137,9 +137,6 @@ void EmulatorConfig::save() { std::ofstream file(path, std::ios::out); file << data; file.close(); -} std::string EmulatorConfig::getRomsPath() { - return EmulatorConfig::romsPath; } - diff --git a/src/panda_qt/main_window.cpp b/src/panda_qt/main_window.cpp index 30a9ae9b..3ff1049c 100644 --- a/src/panda_qt/main_window.cpp +++ b/src/panda_qt/main_window.cpp @@ -3,18 +3,15 @@ #include #include #include -#include #include #include #include - #include "cheats.hpp" #include "input_mappings.hpp" MainWindow::MainWindow(QApplication* app, QWidget* parent) : QMainWindow(parent), keyboardMappings(InputMappings::defaultKeyboardMappings()), screen(this) { - setWindowTitle("Panda3DS"); - setWindowIcon(QIcon(":docs/icon/NewPand.svg")); + setWindowTitle("Alber"); // Enable drop events for loading ROMs setAcceptDrops(true); resize(800, 240 * 4); @@ -142,23 +139,18 @@ void MainWindow::swapEmuBuffer() { } void MainWindow::selectROM() { - if (emu->getConfig().getRomsPath() == "") { - auto path = - QFileDialog::getOpenFileName(this, tr("Select 3DS ROM to load"),"", tr("Nintendo 3DS ROMs (*.3ds *.cci *.cxi *.app *.3dsx *.elf *.axf)")); - } else { - QString Rompath = QString::fromStdString(emu->getConfig().getRomsPath()); - auto path = - QFileDialog::getOpenFileName(this, tr("Select 3DS ROM to load"), Rompath, 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()); EmulatorMessage message{.type = MessageType::LoadROM}; message.path.p = p; sendMessage(message); } - - - } void MainWindow::selectLuaFile() {