@@ -334,11 +334,18 @@ static Info<std::string> MakeISOPathConfigInfo(size_t idx)
334334 " " };
335335}
336336
337+ // Functions below DO work when the launcher path is set manually instead of pulling from Config; try to find why these functions can't pull the path properly
338+
337339std::vector<std::string> GetIsoPaths ()
338340{
339- size_t count = MathUtil::SaturatingCast<size_t >(Config::Get (Config::MAIN_ISO_PATH_COUNT));
340341 std::vector<std::string> paths;
341- paths.reserve (count);
342+
343+ // Always insert the launcher path — even if it's empty
344+ paths.emplace_back (Config::Get (Config::MAIN_LAUNCHER_PATH));
345+
346+ size_t count = MathUtil::SaturatingCast<size_t >(Config::Get (Config::MAIN_ISO_PATH_COUNT));
347+ paths.reserve (count + 1 );
348+
342349 for (size_t i = 0 ; i < count; ++i)
343350 {
344351 std::string iso_path = Config::Get (MakeISOPathConfigInfo (i));
@@ -352,28 +359,29 @@ std::vector<std::string> GetIsoPaths()
352359void SetIsoPaths (const std::vector<std::string>& paths)
353360{
354361 size_t old_size = MathUtil::SaturatingCast<size_t >(Config::Get (Config::MAIN_ISO_PATH_COUNT));
355- size_t new_size = paths. size ( );
362+ std::string launcher_path = Config::Get (Config::MAIN_LAUNCHER_PATH );
356363
357364 size_t current_path_idx = 0 ;
358- for (const std::string& p : paths)
365+
366+ // Start from index 1, assuming launcher path is at index 0
367+ for (size_t i = 1 ; i < paths.size (); ++i)
359368 {
369+ const std::string& p = paths[i];
370+
360371 if (p.empty ())
361- {
362- --new_size;
363372 continue ;
364- }
365373
366374 Config::SetBase (MakeISOPathConfigInfo (current_path_idx), p);
367375 ++current_path_idx;
368376 }
369377
378+ // Clear out old entries if any
370379 for (size_t i = current_path_idx; i < old_size; ++i)
371380 {
372- // TODO: This actually needs a Config::Erase().
373381 Config::SetBase (MakeISOPathConfigInfo (i), " " );
374382 }
375383
376- Config::SetBase (Config::MAIN_ISO_PATH_COUNT, MathUtil::SaturatingCast <int >(new_size ));
384+ Config::SetBase (Config::MAIN_ISO_PATH_COUNT, static_cast <int >(current_path_idx ));
377385}
378386
379387// Main.GBA
0 commit comments