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: Rework the implementation of TGC reading #8644

Merged
merged 3 commits into from Sep 6, 2020

Conversation

JosJuice
Copy link
Member

@JosJuice JosJuice commented Feb 23, 2020

Fixes https://bugs.dolphin-emu.org/issues/10654.

To quote the documenation file included with the program tgctogcm:

TGC's are miniaturized .gcm images with a 32kB header.
The embedded gcm contains some bogus data, namely:
-FST Location (0x424 in gcm)
-DOL Location (0x420 in gcm)
-FST File offsets (all files are offset/spoofed by a certain amount)

Dolphin has been handling the values at 0x420 and 0x424 by simply overwriting them with a working value (just like tgctogcm does), but it has used a different approach for the file offsets in the FST. Instead of changing the offsets that are stored in the FST, Dolphin changed where the files actually are placed on the virtual disc. My hope was that this would make the loading times more accurate to how they are when running a TGC file as part of a larger disc. However, there are TGC files where we would need to move files backwards on the disc in order to do this (this is what issue 10654 is about), so the approach we have been using is flawed.

This change makes Dolphin overwrite offsets in the FST instead, like tgctogcm does. Other than making Dolphin handle the affected TGC files correctly, this change also makes it so that unnecessary padding data isn't written if you use Dolphin to convert a TGC file to an ISO file. This feature is not actually implemented in Dolphin as of now, but I'm planning to add it in the near future as part of a larger feature.

JosJuice added a commit to JosJuice/dolphin that referenced this pull request Apr 28, 2020
This should not be exposed to users before the merge of PR dolphin-emu#8644.
(PR dolphin-emu#8738 was unintentionally merged before PR dolphin-emu#8644.)
dreamsyntax pushed a commit to dreamsyntax/dolphin that referenced this pull request May 11, 2020
This should not be exposed to users before the merge of PR dolphin-emu#8644.
(PR dolphin-emu#8738 was unintentionally merged before PR dolphin-emu#8644.)
Fixes https://bugs.dolphin-emu.org/issues/10654.

To quote the documenation file included with the program tgctogcm:

"TGC's are miniaturized .gcm images with a 32kB header.
The embedded gcm contains some bogus data, namely:
-FST Location (0x424 in gcm)
-DOL Location (0x420 in gcm)
-FST File offsets (all files are offset/spoofed by a certain amount)"

Dolphin has been handling the values at 0x420 and 0x424 by simply
overwriting them with a working value (just like tgctogcm does),
but it has used a different approach for the file offsets in the FST.
Instead of changing the offsets that are stored in the FST, Dolphin
changed where the files actually are placed on the virtual disc.
My hope was that this would make the loading times more accurate to
how they are when running a TGC file as part of a larger disc.
However, there are TGC files where we would need to move files
backwards on the disc in order to do this (this is what issue
10654 is about), so the approach we have been using is flawed.

This change makes Dolphin overwrite offsets in the FST instead, like
tgctogcm does. Other than making Dolphin handle the affected TGC files
correctly, this change also makes it so that unnecessary padding data
isn't written if you use Dolphin to convert a TGC file to an ISO file.
This feature is not actually implemented in Dolphin as of now, but I'm
planning to add it in the near future as part of a larger feature.
@JMC47
Copy link
Contributor

JMC47 commented Sep 6, 2020

Has this been tested by anyone? If not, what testing does it need?

@PPLToast
Copy link
Contributor

PPLToast commented Sep 6, 2020

I can confirm this fixes playing a demo tgc that crashed unless converted to gcm. Same for extracting files that otherwise got corrupted.

@JosJuice
Copy link
Member Author

JosJuice commented Sep 6, 2020

I did a similar amount of testing to PPLToast when I created the PR. I'm not aware of anything additional that needs to be tested, unless you have something in particular.

@JMC47 JMC47 merged commit c8c4ec2 into dolphin-emu:master Sep 6, 2020
@JosJuice JosJuice deleted the rework-tgc branch September 6, 2020 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants