|
Post by thebeardedone on Jun 23, 2024 0:39:02 GMT -5
Part 1: Is there available documentation that explains which hashes to use and where? I'm clear on which to use for things like strings, instance numbers and filenames but still a bit unclear of exactly when the high bit needs to be set and why. Also, I've seen 24 and 56 bit hashes mentioned a few times but never a mention of where or when they might be used.
Part 2: While working on my own hash generator I had a problem getting my code to match the results from other tools, until I noticed that it was because I was using mixed case strings for testing. It then became obvious that hash generators, such as the ones in S4S and Modding Toolbox, each convert the text to lower case prior to calculating the hash. No problem, that's a trivial change. But...
Changing the case of the text deviates from the FNV standard. Why is this done when creating hashes for The Sims (and perhaps other games)? Is it something dictated be EA or is it perhaps because the developers of those tools seem to reside in the Windows world, where case sensitivity is only very rarely a thing to be concerned with?
I'd be grateful for any light anyone can shed on either part.
|
|
|
Post by andrew on Jun 23, 2024 3:38:45 GMT -5
Hi, There is no complete documentation that I know of. EA has some limited info in their official modding documentation. The high bit was encouraged by EA in their documentation when generating instance and group ids. I think the purpose was so they could identify mod resources. I don't think the high bit is actually required anywhere, but it is an option in S4S since EA asked that we use it when possible for instance ids. 24-bit hashes are used by the group number of Sim Data. The FNV24 of the "i" attribute of a tuning xml is the group for the sim data. 32-bit hashes are of course used in any 32-bit hash field (bone refs, slot refs, string hashes, etc.). There are a few special cases where a 64 bit instance still needs to use a 32-bit hash though. 56-bit hashes - I can't think of any and don't remember why I added that to S4S. I may have added that option just in case. 64-bit hashes are usually what you want for an instance id. There are special cases where a 32-bit instance is required. The cases of this that I have seen are for object and CAS items that are referenced in the tuning, but there are probably more cases that I am unaware of. The Sims 4 FNV implementation is lower case, so it makes sense for Sims 4 modding tools to follow that instead of the FNV standard. FNV hashes in the game are often used to reference names (often mixed-case) and if the lower case version is not used, the reference won't be resolved.
|
|
|
Post by thebeardedone on Jun 23, 2024 5:20:35 GMT -5
Thanks Andrew, that clears up a few things. I have the official modding documentation but, as you will well know, it leaves a lot to be desired. I've even found issues with the *.bt templates. Just today I edited the simdata one because I noticed a field was completely missing (the group number at the end of the header).
I've added a checkbox to my gui hash tool to toggle case sensitivity, with it being off by default. Not being sure where the high bit setting is used I added it to all hash sizes. I'll remove it again from those < 64 bits.
I must admit that I've been rather enjoying creating my tool set, especially as I'm on Linux and am trying to avoid using WINE for everything.
|
|