Skip to content

Commit

Permalink
Update settings.h
Browse files Browse the repository at this point in the history
  • Loading branch information
NarrikSynthfox committed May 5, 2024
1 parent 149be10 commit 07f7974
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Encore/include/game/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ class Settings {
}
if (settings.HasMember("songDirectories") && settings["songDirectories"].IsArray()){
for (auto& songPath : settings["songDirectories"].GetArray()) {
songPaths.push_back(songPath.GetString());
if(songPath.GetString()!=defaultSongPaths[0])
songPaths.push_back(songPath.GetString());
}
} else {
songDirectoryError = true;
Expand Down Expand Up @@ -711,8 +712,9 @@ class Settings {
settings.EraseMember("songDirectories");
rapidjson::Document::AllocatorType& allocator = settings.GetAllocator();
rapidjson::Value arraySongDir(rapidjson::kArrayType);
for (std::filesystem::path &path: defaultSongPaths)
arraySongDir.PushBack(rapidjson::Value().SetString((const char*)(path.c_str()), allocator), allocator);
for (auto& songPath : defaultSongPaths) {
songPaths.push_back(songPath);
}
settings.AddMember("songDirectories", arraySongDir, allocator);
}
if (MissHighwayError) {
Expand Down Expand Up @@ -856,10 +858,10 @@ class Settings {
missHighwayColorMember->value.SetBool(missHighwayDefault);
rapidjson::Value::MemberIterator mirrorMember = settings.FindMember("mirror");
mirrorMember->value.SetBool(mirrorMode);
// rapidjson::Value::MemberIterator songDirMember = settings.FindMember("songDirectories");
// songDirMember->value.Clear();
// for (std::filesystem::path& path : songPaths)
// songDirMember->value.PushBack(rapidjson::Value().SetString(path.string(), allocator), allocator);
rapidjson::Value::MemberIterator songDirMember = settings.FindMember("songDirectories");
songDirMember->value.Clear();
for (std::filesystem::path& path : songPaths)
songDirMember->value.PushBack(rapidjson::Value().SetString(path.string(), allocator), allocator);
rapidjson::Value::MemberIterator keybinds4KMember = settings["keybinds"].FindMember("4k");
keybinds4KMember->value.Clear();
for (int& key : keybinds4K)
Expand Down

0 comments on commit 07f7974

Please sign in to comment.