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
GCMemcard: Change behavior of TitlePresent() to more closely resemble how saves are actually identified. #8903
GCMemcard: Change behavior of TitlePresent() to more closely resemble how saves are actually identified. #8903
Conversation
07041d6
to
8b31361
Compare
|
Commit should probably have the extended description added to it, so that info is stored in the repository |
8b31361
to
c486270
Compare
|
Good point, done. |
| if (lhs.m_makercode != rhs.m_makercode) | ||
| return false; | ||
|
|
||
| for (size_t i = 0; i < lhs.m_filename.size(); ++i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this perhaps be i < std::min(lhs.m_filename.size(), rhs.m_filename.size())? Or do we make sure that the lhs filename is shorter than (or of equal length to) the rhs filename?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scratch that, I just noticed this is an array and not an actual string.
| if (lhs.m_makercode != rhs.m_makercode) | ||
| return false; | ||
|
|
||
| for (size_t i = 0; i < lhs.m_filename.size(); ++i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scratch that, I just noticed this is an array and not an actual string.
… how saves are actually identified. This modifies GCMemcard::TitlePresent() to match my findings of how the GC BIOS and various games behave when you alter the fields in the directory entry. It looks like for a save to be recognized by a game, the following have to be true: - Game code and maker code must exactly match what the game expects. - Filename is only checked up to the first null byte. All bytes afterwards can be whatever. The BIOS itself does a full compare of the filename when checking for whether it should allow copying a file from one card to another, but behaves oddly in some cases when there's non-null bytes after the first null. See the big comment in `HasSameIdentity()` for details.
c486270
to
556e93f
Compare
|
Clarified the description a bit, code was not changed. |
This modifies
GCMemcard::TitlePresent()to match my findings of how the GC BIOS and various games behave when you muck with the fields in the directory entry.It looks like for a save to be recognized by a game, the following have to be true:
The BIOS itself does a full compare of the filename when checking for whether it should allow copying a file from one card to another, but behaves oddly in some cases when there's non-null bytes after the first null. See the big comment in
HasSameIdentity()for details.The new
GCMemcardUtils.cppfile may seem a bit excessive for now, but I have some plans for some improvements to the memory card manager that would fit well in there, andGCMemcard.cppis pretty crowded already.I'm also not sure if "Identity" is a good word to describe what we're comparing here; any other suggestions?