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.
This commit is contained in:
Auxy6858 2024-03-26 00:03:57 +00:00
parent 93d5f9901d
commit 1a13795d5d
4 changed files with 24 additions and 5 deletions

View file

@ -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()

View file

@ -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();
};

View file

@ -40,6 +40,7 @@ void EmulatorConfig::load() {
discordRpcEnabled = toml::find_or<toml::boolean>(general, "EnableDiscordRPC", false);
usePortableBuild = toml::find_or<toml::boolean>(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;
}

View file

@ -142,16 +142,23 @@ 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)"));
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() {