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

Add generation of rcheevos hash as an option in DolphinTool #13035

Merged
merged 1 commit into from
Sep 15, 2024

Conversation

retroNUC
Copy link
Contributor

Allows the user to generate a RetroAchievements Game Identification hash via the command line for GameCube games in all file formats supported by Dolphin. RA does a quick hash of selected files within a disc image, rather than a very slow full MD5 hash.

> .\dolphintool.exe verify -i "game.rvz" -a rchash
9be90fd0a49908be157f8c001794699e

This is useful for external game launchers like LaunchBox, who need to identify which files are supported by RA so that information can be queried and displayed on their frontend.

This usually done by RAHasher, an external tool provided by the RA developers with the reference implementation on how to hash game files for each platform they support. However, while it supports reading of common disc formats like ISO and CHD, it doesn't have support for emulator-specific formats such as RVZ and some others used by Dolphin - RetroAchievements/RALibretro#415

Without having to translate over a bunch of Dolphin's DiscIO code into RAHasher so it can understand all of Dolphin's formats, or create an open-source library for handling them, this seems like the easiest way to solve the problem that RVZ games can't be identified.

Next steps after this would be to embed the hashing properly within VolumeVerifier and show this information on the Game Properties page as well, but that's a little more involved as Dolphin's current link with the rcheevos library only seems to support a file path, not working with an existing volume.

};
rc_hash_init_custom_filereader(&volume_reader);
rc_hash_generate_from_file(hash, RC_CONSOLE_GAMECUBE, file_path.c_str());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the function signature to std::string AchievementManager::CalculateHash(const std::string& file_path) so that callers don't need to care about the array size.

@Tilka
Copy link
Member

Tilka commented Aug 31, 2024

The diff is small enough that you can squash the commits without waiting for incremental reviews.

Fixed coding standards issue

CalculateHash return string instead of using char array param
Copy link
Member

@Tilka Tilka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tested?

@retroNUC
Copy link
Contributor Author

retroNUC commented Sep 15, 2024

Yeah. Shouldn't touch main Dolphin, but booted some games to test RA functionality with no issues.

Existing behaviour of verify function in DolphinTool all seems correct:

PS C:\Source\dolphin\Binary\x64> .\dolphintool.exe verify -i "game.iso"
CRC32: 9a75e03a
MD5 not computed
SHA1: 3f742bf1db42bd3b24ec50bc66320f762b043752
Problems Found: No

PS C:\Source\dolphin\Binary\x64> .\dolphintool.exe verify -i "game.iso" -a rchash
9be90fd0a49908be157f8c001794699e

PS C:\Source\dolphin\Binary\x64> .\dolphintool.exe verify -i "game.rvz" -a rchash
9be90fd0a49908be157f8c001794699e

PS C:\Source\dolphin\Binary\x64> .\dolphintool.exe verify -i "game.iso" -a md5
109274d9078b5aecf3bfa9af1d10688c

PS C:\Source\dolphin\Binary\x64> .\dolphintool.exe verify -i "license.txt" -a rchash
Error: Unable to open input file

@Tilka Tilka merged commit af92168 into dolphin-emu:master Sep 15, 2024
11 checks passed
SternXD pushed a commit to SternXD/dolphin-uwp that referenced this pull request Feb 7, 2025
Add generation of rcheevos hash as an option in DolphinTool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants