Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The existing case-correction algorithm performs an
access
-check on every path component -- this results in a lot of redundant syscalls, since the majority of the path is provided by the engine and should thus be already correct.This new version instead scans the path backwards, looking for the first incorrect component from the end of the path, correcting it, and then working forward from there (in a similar manner to the old version).
On my setup, this significantly improves loading performance, especially when reloading the game data after regaining focus. Without this patch, the game would often spend several seconds reloading assets; with the patch applied, the game becomes responsive within less than 1 second.
I've verified that the main campaign works with these changes applied.
If there are any code-style issues or similar, I'd be happy to correct them.
The diff might look a bit odd due to how git has decided to match things -- the
std::string caseCorrect(const std::string &path)
overload has not been modified; only thevoid caseCorrect(char* path)
function was replaced (alongside a fewstatic
functions).