From 2506d63dedb66c39e9a4f0afe276ad5afaac611c Mon Sep 17 00:00:00 2001 From: Hywel Andrews Date: Thu, 6 Aug 2026 23:33:24 +0700 Subject: [PATCH] Add new config key RomsDirectory to Supermodel.ini, defaults to existing ROMs/ folder --- Src/OSD/SDL/Gui.cpp | 12 ++++++++---- Src/OSD/SDL/Main.cpp | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Src/OSD/SDL/Gui.cpp b/Src/OSD/SDL/Gui.cpp index b3705baa..60ab32d8 100644 --- a/Src/OSD/SDL/Gui.cpp +++ b/Src/OSD/SDL/Gui.cpp @@ -778,13 +778,14 @@ static void GUI(const ImGuiIO& io, Util::Config::Node& config, const std::map& games) +static std::string GetRomPath(int selectedGame, const std::map& games, std::string romsDirectory) { if (selectedGame >= 0) { int index = 0; + for (auto& g : games) { if (selectedGame == index) { - return (std::filesystem::path("ROMs") / (g.second.name + ".zip")).string(); // todo config rom directory? File dialog will be a bit more tricky cross platform but we can specifiy edit box for manual path entry + return (std::filesystem::path(romsDirectory) / (g.second.name + ".zip")).string(); } index++; } @@ -868,6 +869,8 @@ std::vector RunGUI(const std::string& configPath, Util::Config::Nod ImGui_ImplOpenGL3_Init("#version 410"); std::string xmlFile = config["GameXMLFile"].ValueAs(); + std::string romsDirectory = config["RomsDirectory"].ValueAs(); + GameLoader loader(xmlFile); auto& games = loader.GetGames(); int selectedGame = -1; // -1 means no selection @@ -903,8 +906,9 @@ std::vector RunGUI(const std::string& configPath, Util::Config::Nod break; } } - - path = GetRomPath(selectedGame, games); + + path = GetRomPath(selectedGame, games, romsDirectory); + if (!path.empty()) { romFiles.emplace_back(path); } diff --git a/Src/OSD/SDL/Main.cpp b/Src/OSD/SDL/Main.cpp index 77072d09..b2a24171 100644 --- a/Src/OSD/SDL/Main.cpp +++ b/Src/OSD/SDL/Main.cpp @@ -1505,6 +1505,7 @@ Util::Config::Node DefaultConfig() config.Set("GameXMLFile", s_gameXMLFilePath); config.Set("InitStateFile", ""); + config.Set("RomsDirectory", "ROMs"); // CModel3 config.Set("PowerPCFrequency", 0u, "Core", 0u, 200u); config.Set("MultiThreaded", true,"Core");