-
Notifications
You must be signed in to change notification settings - Fork 49
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
hash collision in the mapping.json #588
Comments
I'm ok with a change like this. But the authors of all tools which use this data (which should hopefully be pretty much any save editor) will need to be made aware of this change (ideally by way of issues on github linking this issue). |
You could also put it all into one file, so you have {
"libMBIN_version": "4.52.0.2",
"Mapping_account": [...],
"Mapping_save": [...],
"Mapping": [...]
} I realise this is not exactly beautiful though. |
What I did in the meantime as a workaround (but may be the way to go to achieve this in a less impactful way) is splitting Only issue with the current file is that generic keys like Could be solved with two separate var save_mapping = new HashSet<Tuple<string, string>>();
UpdateHashes(typeof(libMBIN.NMS.GameComponents.GcPlayerStateData), save_mapping);
// ...
// Also add the GcUserSettingsData class
var account_mapping = new HashSet<Tuple<string, string>>();
account_mapping.Add(new Tuple<string, string>(HashName("UserSettingsData"), "UserSettingsData"));
UpdateHashes(typeof(libMBIN.NMS.GameComponents.GcUserSettingsData), account_mapping);
main_data["libMBIN_version"] = libMBIN.Version.AssemblyVersion.ToString();
main_data["Mapping"] = save_mapping.ToList().Concat(account_mapping.ToList()); |
I'm happy for you to open a PR with a suggested fix so that people may see the result in the generated artefacts of the PR, then people can give better comments on the format of the file. |
Just wanted to wait for feedback on the suggestion :) Created a PR with the code example above, keeping it in one list. |
Hmm, personally i probably would have had accountdata_mapping.json for accountdata.hg, and save_mapping.json for save*.hg. Although pc gog and steam seem to use a similar format for both accountdata.hg and save*.hg i'm not sure i would assume this would be true, or continue to be true, for other platforms e.g. game pass seems to store info in radically different set of files. |
@cengelha if you are happy with the solution would you like to close this ticket? |
Describe the bug
It was noticed that there is a hash collision in the mapping.json (see zencq/NomNom#165 for more).
In this case one is used for account data and one for actual saves. But as everything is put together in the same list, it is not possible to use the correct mapping without adding extra handling.
Expected behavior
Splitting the mapping for account data and saves into its own lists within the mapping.json would solve this very easily.
Result could look like this:
The text was updated successfully, but these errors were encountered: