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

Qt/GCMemcardCreateNewDialog: Use zero values for formatting instead of accessing g_SRAM. #9021

Merged

Conversation

AdmiralCurtiss
Copy link
Contributor

GUI code should not be directly accessing emulated hardware like this.

As for the CardFlashId value itself... frankly, I don't believe the value itself actually matters in the slightest. I've checked various dumped memory cards of mine and it looks like a completely random set of 12 bytes to me for them, while all my Dolphin-generated cards use either 12 zeros like what I'm using in this PR (which happens when you create a card before launching a game, as g_SRAM is zero-filled before first boot), or the ASCII DOLPHINSLOTA as seen here. Gamecube software does not seem to care what it is -- it probably just matters that the serial in the header is correctly synced with the flash ID, which we ensure here when mounting a card and here when formatting a card.

As a sidenote... am I right in assuming that this flash ID on real hardware is a separate piece of information provided by a memory card, disconnected from formatted header data? Cause we emulate it by just assuming the header block is always correct. Which is probably fine, but just wondering.

@AdmiralCurtiss
Copy link
Contributor Author

Oh, alternatively, we could also just generate a random flash ID instead. Would that be preferable?

@leoetlino
Copy link
Member

All those values are already zero on master when you create a card prior to launching a game, so I think this change is fine.

@leoetlino leoetlino merged commit 299adf5 into dolphin-emu:master Oct 20, 2020
10 checks passed
@AdmiralCurtiss AdmiralCurtiss deleted the gui-memcard-format-sram branch October 20, 2020 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants