diff --git a/CMakeLists.txt b/CMakeLists.txt index dc230bf6..729016ce 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/img/rsob_icon.png docs/img/rstarstruck_icon.png docs/icon/NewPand.svg ) else() set(FRONTEND_SOURCE_FILES src/panda_sdl/main.cpp src/panda_sdl/frontend_sdl.cpp src/panda_sdl/mappings.cpp) @@ -487,7 +487,9 @@ 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) + add_library(Alber SHARED src/hydra_core.cpp + src/panda_qt/main.cpp + ) target_link_libraries(Alber PUBLIC AlberCore) endif() diff --git a/include/config.hpp b/include/config.hpp index 8c0d2e12..bb4791b9 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -29,9 +29,12 @@ struct EmulatorConfig { // Default to 3% battery to make users suffer int batteryPercentage = 3; + std::string romsPath = ""; + 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 299ef594..9899bd28 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); + romsPath = toml::find_or(general, "RomsPath",""); } } @@ -120,6 +121,7 @@ void EmulatorConfig::save() { data["General"]["EnableDiscordRPC"] = discordRpcEnabled; data["General"]["UsePortableBuild"] = usePortableBuild; + data["General"]["RomsPath"] = romsPath; data["GPU"]["EnableShaderJIT"] = shaderJitEnabled; data["GPU"]["Renderer"] = std::string(Renderer::typeToString(rendererType)); data["GPU"]["EnableVSync"] = vsyncEnabled; @@ -135,4 +137,9 @@ 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 d093c16a..30a9ae9b 100644 --- a/src/panda_qt/main_window.cpp +++ b/src/panda_qt/main_window.cpp @@ -142,16 +142,23 @@ 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)")); + 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)")); - 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() {