Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GameDB / Memcards - Replace yaml-cpp with rapidyaml #5099

Merged
merged 11 commits into from
Dec 25, 2021

Conversation

xTVaser
Copy link
Member

@xTVaser xTVaser commented Dec 4, 2021

Description of Changes

  • Replaces our YAML library with rapidyaml, a significantly faster and more actively maintained library without by-design memory leaks (to my knowledge)
    • it is MIT licensed, and it's dependencies are: MIT / Boost / Apache / BSD-2 Clause
    • it does have a slightly more tricky to use API and you must be a lot more strict (yaml-cpp let you get away with a lot of unsafe behaviour after going through this migration...) but it has significant documentation and examples.
  • folder memory cards was the only other user of YAML, so I also had to migrate that

Rationale behind Changes

  • rapidyaml is a better library, I wanted to do this from the start a year ago, but getting it working with our visual studio configuration at the time was the main blocker.
    • from 300-400ms to 30-40ms loading the GameDB

Suggested Testing Steps

  • Thoroughly test folder memory cards and that i didn't break anything
  • GameDB testing:
    • are speedhacks/gamefixes/memcard filters/patches loaded as expected?
    • if you have invalid yaml does the app catastrophically fail or gracefully continue (in Release mode! debug mode will hit assertions)

common/StringUtil.cpp Outdated Show resolved Hide resolved
common/StringUtil.cpp Outdated Show resolved Hide resolved
common/StringUtil.cpp Outdated Show resolved Hide resolved
pcsx2/GS/Renderers/HW/GSRendererHW.cpp Outdated Show resolved Hide resolved
pcsx2/GameDatabase.cpp Outdated Show resolved Hide resolved
pcsx2/GameDatabase.cpp Outdated Show resolved Hide resolved
pcsx2/GameDatabase.cpp Outdated Show resolved Hide resolved
pcsx2/pcsx2.vcxproj Outdated Show resolved Hide resolved
pcsx2/pcsx2.vcxproj.filters Outdated Show resolved Hide resolved
pcsx2/pcsx2.vcxproj.filters Outdated Show resolved Hide resolved
common/StringUtil.h Outdated Show resolved Hide resolved
return Strncasecmp(str1.data(), str2.data(), str1.length()) == 0;
}

std::vector<std::string> convertMultiLineStringToVector(const std::string& multiLineString)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this called split in pretty much every other language's stdlib?

Comment on lines 64 to 74
std::string name = "";
std::string region = "";
Compatibility compat = Compatibility::Unknown;
RoundMode eeRoundMode = RoundMode::Undefined;
RoundMode vuRoundMode = RoundMode::Undefined;
ClampMode eeClampMode = ClampMode::Undefined;
ClampMode vuClampMode = ClampMode::Undefined;
std::vector<GamefixId> gameFixes;
std::vector<GamefixId> gameFixes = {};
std::vector<std::pair<SpeedhackId, int>> speedHacks;
std::vector<std::string> memcardFilters;
std::unordered_map<std::string, Patch> patches;
std::vector<std::string> memcardFilters = {};
std::unordered_map<std::string, Patch> patches = {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already the result of calling the default constructor. IMO it looks nicer to not have these.

@refractionpcsx2 refractionpcsx2 merged commit 70145eb into PCSX2:master Dec 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants