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

Off-by-one in SDHC detection #6194

Merged
merged 1 commit into from Nov 14, 2017

Conversation

5 participants
@TBoshoven
Contributor

TBoshoven commented Nov 14, 2017

Also update name and description of SDHC constant.

This should fix this issue in which 2GiB SD cards are interpreted as SDHC.

Off-by-one in SDHC detection
Also update name and description of SDHC constant.

@delroth delroth merged commit 496c337 into dolphin-emu:master Nov 14, 2017

10 checks passed

default Very basic checks passed, handed off to Buildbot.
Details
lint Build succeeded on builder lint
Details
pr-android Build succeeded on builder pr-android
Details
pr-deb-dbg-x64 Build succeeded on builder pr-deb-dbg-x64
Details
pr-deb-x64 Build succeeded on builder pr-deb-x64
Details
pr-freebsd-x64 Build succeeded on builder pr-freebsd-x64
Details
pr-osx-x64 Build succeeded on builder pr-osx-x64
Details
pr-ubu-x64 Build succeeded on builder pr-ubu-x64
Details
pr-win-dbg-x64 Build succeeded on builder pr-win-dbg-x64
Details
pr-win-x64 Build succeeded on builder pr-win-x64
Details
@FishamanP

This comment has been minimized.

Show comment
Hide comment
@FishamanP

FishamanP Nov 17, 2017

There are most definitely 4GB SDSC cards, verified as being compatible with Wii games that don't support SDHC such as Super Smash Bros Brawl. SDSC_MAX_SIZE should probably be doubled.

FishamanP commented on 1fc7cf3 Nov 17, 2017

There are most definitely 4GB SDSC cards, verified as being compatible with Wii games that don't support SDHC such as Super Smash Bros Brawl. SDSC_MAX_SIZE should probably be doubled.

This comment has been minimized.

Show comment
Hide comment
@TBoshoven

TBoshoven Nov 21, 2017

Contributor

Those are quite rare and I'm not sure how capacity calculation is done for those.
In principle, the SD protocol version 1 (used by SDSC) cannot describe capacities of over 2 GiB.
The capacity calculation for the v1 CSD, also described on Wikipedia, with the maximum values for all fields, gives us the following:

>>> (4095+1)*(2**(7+2+10))
2147483648

This is exactly 2 GiB.
Note that this is the capacity calculation which is implemented in code in the .cpp. I doubt the current implementation is going to work with 4 GiB cards off the bat.

If you find out how capacity is computed for those guys, let me know or submit a PR.

Contributor

TBoshoven replied Nov 21, 2017

Those are quite rare and I'm not sure how capacity calculation is done for those.
In principle, the SD protocol version 1 (used by SDSC) cannot describe capacities of over 2 GiB.
The capacity calculation for the v1 CSD, also described on Wikipedia, with the maximum values for all fields, gives us the following:

>>> (4095+1)*(2**(7+2+10))
2147483648

This is exactly 2 GiB.
Note that this is the capacity calculation which is implemented in code in the .cpp. I doubt the current implementation is going to work with 4 GiB cards off the bat.

If you find out how capacity is computed for those guys, let me know or submit a PR.

This comment has been minimized.

Show comment
Hide comment
@TBoshoven

TBoshoven Nov 21, 2017

Contributor

Actually, I think I'm wrong here. Looks like I already use 11 for READ_BL_LEN (as opposed to the 9 or 10 described above) so 4 GiB should be possible with this. I'm currently not in a position to test this, but I'd say update the value and try it out :) .

Contributor

TBoshoven replied Nov 21, 2017

Actually, I think I'm wrong here. Looks like I already use 11 for READ_BL_LEN (as opposed to the 9 or 10 described above) so 4 GiB should be possible with this. I'm currently not in a position to test this, but I'd say update the value and try it out :) .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment