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

DiscIO: Store partition key directly in ReuseID #9854

Merged
merged 1 commit into from Jul 6, 2021

Conversation

JosJuice
Copy link
Member

@JosJuice JosJuice commented Jun 29, 2021

The main reason I'm making this change is to avoid the ICE mentioned in e5b9e1b#r51445090, but there is also the advantage that this lets us reuse blocks in the case where different partition entries use the same key (which probably isn't actually all that common).

JosJuice referenced this pull request Jun 29, 2021
This is useful for the way Dolphin scrubs Wii discs.
The encrypted data is what gets zeroed out, but this
zeroed out data then gets decrypted before being stored,
and the resulting data does not compress well.
However, each block of decrypted scrubbed data is
identical given the same encryption key, and there's
nothing stopping us from making multiple group entries
point to the same offset in the file, so we only have
to store one copy of this data per partition.

For reference, wit zeroes out the decrypted data,
but Dolphin's WIA writer can't do this because it currently
doesn't know which parts of the disc are scrubbed.

This is also useful for things such as storing Datel discs
full of 0x55 blocks (repesenting unreadable blocks)
without compression enabled.
@JosJuice
Copy link
Member Author

Actually, it seems like this doesn't fix the ICE...

@Erisa
Copy link

Erisa commented Jun 29, 2021

Actually, it seems like this doesn't fix the ICE...

Same here, was about to comment. Same ICE happens with this code.

@JosJuice
Copy link
Member Author

Well, I'll leave this PR open in case someone thinks this PR is worth merging for its secondary benefit. But hmm, should we add shuffle2's workaround in a separate PR or should we just wait for the next version of MSVC...

@Erisa
Copy link

Erisa commented Jun 29, 2021

I personally think it would be worth attempting some kind of fix, so anyone else trying to build for Windows ARM64 doesn't have any unpleasant surprises like I did, until the next version of MSVC (Which I have no idea when that would even be).
Even if the number of people building for that platform is incredibly low, it currently doesn't build for an issue that's relatively hard to diagnose and that's a problem for the time being.

@JosJuice
Copy link
Member Author

Submitted as PR #9855.

This lets us reuse blocks in the case where different partition
entries use the same key (which probably isn't very common).
@leoetlino leoetlino merged commit 39e14b6 into dolphin-emu:master Jul 6, 2021
11 checks passed
@JosJuice JosJuice deleted the wia-ice branch July 6, 2021 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants