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

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