Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Src/OSD/SDL/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,13 +778,14 @@ static void GUI(const ImGuiIO& io, Util::Config::Node& config, const std::map<st
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
}

static std::string GetRomPath(int selectedGame, const std::map<std::string, Game>& games)
static std::string GetRomPath(int selectedGame, const std::map<std::string, Game>& 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++;
}
Expand Down Expand Up @@ -868,6 +869,8 @@ std::vector<std::string> RunGUI(const std::string& configPath, Util::Config::Nod
ImGui_ImplOpenGL3_Init("#version 410");

std::string xmlFile = config["GameXMLFile"].ValueAs<std::string>();
std::string romsDirectory = config["RomsDirectory"].ValueAs<std::string>();

GameLoader loader(xmlFile);
auto& games = loader.GetGames();
int selectedGame = -1; // -1 means no selection
Expand Down Expand Up @@ -903,8 +906,9 @@ std::vector<std::string> 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);
}
Expand Down
1 change: 1 addition & 0 deletions Src/OSD/SDL/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down