Hash Cache Usage in Server
This describes how the Reloaded3 server uses the hash cache for packages and game folders.
The Reloaded3 server utilizes a hash cache system to efficiently store and retrieve hash information for both packages and games.
Package Hash Cache
For packages, the hash cache items are stored using a combination of the package name and version:
{PackageID}+{PackageVersion}.hashcache
Where:
- {PackageID} is the unique identifier of the package.
- {PackageVersion} is the semantic version of the package.
Example
For a package with ID reloaded3.utility.examplemod.s56
with version 1.2.3
,
the hash cache file would be:
reloaded3.utility.examplemod.s56+1.2.3.hashcache
Usage
When the server needs to access or update the hash cache for a specific package:
- Construct the file name using the package name and version.
- Try to open the file in the designated hash cache database.
- If the open operation succeeds, read the hash cache file.
- If the file doesn't exist, create a new hash cache file for the package.
Game Hash Cache
Hash cache for games is tricky, because a user can have multiple versions of the same game installed.
For example, a Steam
release of a game, and a GOG
release of a game.
In addition, a user may have multiple computers, where the local files for a game may differ.
Therefore, the file name for the hash cache for games is stored within the Machine Specific Info structure of each installed game entry.
Usage
- Check the hash cache database for the game as it's loaded.
- Compare timestamps and short hashes of files.
- If any file is different, suggest to the user that the game folder has been modified.
- This can be done via a Diagnostic.
For game files, only the short hash and timestamp parts of the hash cache are used. Full hashes
would take too long to verify; so we simply omit them and write them as 0
.