diff --git a/OutRun2006Tweaks.ini b/OutRun2006Tweaks.ini index 0ed2b5d..ba5c983 100644 --- a/OutRun2006Tweaks.ini +++ b/OutRun2006Tweaks.ini @@ -344,15 +344,4 @@ HideOnlineSigninText = false 25_Shiny_World_prototype.ogg = Shiny World (Prototype) 26_Night_Flight_prototype.ogg = Night Flight (Prototype) 27_Life_was_a_Bore_Instrumental.ogg = Life was a Bore (Instrumental) -28_Night_Flight_Instrumental.ogg = Night Flight (Instrumental) -Last_Wave.ogg = Last Wave -SEGA441.ogg = SEGA Intro -Beach_wave.ogg = Beach Waves -title_pattern1.ogg = C2C Title 1 -title_01.ogg = C2C Opening Jingle -or2ed1.ogg = Ending 1 -or2ed2.ogg = Ending 2 -or2ed3a.ogg = Ending 3a -or2ed3b.ogg = Ending 3b -or2ed4.ogg = Ending 4 -or2ed5.ogg = Ending 5 +28_Night_Flight_Instrumental.ogg = Night Flight (Instrumental) \ No newline at end of file diff --git a/src/hooks_audio.cpp b/src/hooks_audio.cpp index dfffe72..0769e01 100644 --- a/src/hooks_audio.cpp +++ b/src/hooks_audio.cpp @@ -296,6 +296,8 @@ void CDSwitcher_ReadIni(const std::filesystem::path& iniPath) Settings::CDSwitcherEnable = false; } + std::vector> iniTracks; + std::ifstream file(iniPath); if (file && file.is_open()) { @@ -319,7 +321,7 @@ void CDSwitcher_ReadIni(const std::filesystem::path& iniPath) { std::string path = Util::trim(line.substr(0, delimiterPos)); std::string name = Util::trim(line.substr(delimiterPos + 1)); - Settings::CDTracks.emplace_back(path, name); + iniTracks.emplace_back(path, name); spdlog::info(" - CDTracks: Added track {} ({})", name, path); // Check both paths that the CDSwitcher code looks in @@ -336,12 +338,19 @@ void CDSwitcher_ReadIni(const std::filesystem::path& iniPath) file.close(); } + if (iniTracks.size() <= 0) + return; + if (Settings::CDSwitcherShuffleTracks) { std::random_device rd; std::mt19937 g(rd()); // Use std::shuffle to shuffle the vector - std::shuffle(Settings::CDTracks.begin(), Settings::CDTracks.end(), g); + std::shuffle(iniTracks.begin(), iniTracks.end(), g); } + + // replace old tracklist with the one from this INI + // (if user had specified tracks in user.ini they likely meant to replace the defaults) + Settings::CDTracks = iniTracks; }