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

Common/LinearDiskCache: Handle truncated shadercache files. #9340

Merged
merged 2 commits into from Dec 20, 2020

Conversation

AdmiralCurtiss
Copy link
Contributor

Without this you run into two issues:

  • Since it breaks out after reading the value_size but before reading the actual value, the file position is not aligned on a boundary between values, so it would have no chance to find any newly written values the next time the cachefile is opened.
  • ...But it probably doesn't come to that because of a quirk in files opened in r+ mode. Thankfully Visual Studio's debug mode catches this, I would have never found this otherwise.

I also took the opportunity to replace the manual new/delete with an unique_ptr.

Copy link
Contributor

@iwubcode iwubcode left a comment

Choose a reason for hiding this comment

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

Untested but this LGTM. I've been bitten by this issue multiple times now but wasn't sure what the issue was. I just would delete my shader cache which was a pain.

@lioncash lioncash merged commit c08fab6 into dolphin-emu:master Dec 20, 2020
10 checks passed
@AdmiralCurtiss AdmiralCurtiss deleted the truncated-shadercache branch December 20, 2020 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants