bugfix(namekeys): Remove hardcoded NameKeyIDs from dummy strings for modded files#2349
bugfix(namekeys): Remove hardcoded NameKeyIDs from dummy strings for modded files#2349Caball009 wants to merge 2 commits intoTheSuperHackers:mainfrom
Conversation
|
| Filename | Overview |
|---|---|
| GeneralsMD/Code/GameEngine/Include/Common/NameKeyGenerator.h | Added public methods syncNameKeyID() and verifyNameKeyID() to replace the private addReservedKey() function, improving the API design |
| GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp | Added verification calls at strategic initialization points and synchronized name key IDs after TheAudio initialization |
| GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp | Replaced hardcoded file path logic with generic dummy strings, simplified name-to-key functions by removing conditional key reservation |
Last reviewed commit: b8b15db
| @@ -508,6 +508,10 @@ void GameEngine::init() | |||
| #endif///////////////////////////////////////////////////////////////////////////////////////////// | |||
|
|
|||
|
|
|||
| #if RETAIL_COMPATIBLE_CRC | |||
| if (xferCRC.getCRC() == 0xA1E7F8E6) TheNameKeyGenerator->verifyNameKeyID(1); | |||
| return false; | ||
| nameToKey("TSH_dummy_string_1"); | ||
| nameToKey("TSH_dummy_string_2"); | ||
| nameToKey("TSH_dummy_string_3"); |
There was a problem hiding this comment.
I suggest to preserve the original strings for context
There was a problem hiding this comment.
Yeah, I can use the strings that were added in #1516.
Those strings depend either on registry language and / or use sound track names that can be changed by mods, though.
There was a problem hiding this comment.
It is mainly about preserving the context for what these strings are for the next person to look at it.
| #endif | ||
|
|
||
| return key; | ||
| return nameToLowercaseKeyImpl(name); |
There was a problem hiding this comment.
This means you can merge nameToLowercaseKeyImpl into nameToLowercaseKey entirely as it was originally.
Four times.
| @@ -524,6 +528,10 @@ void GameEngine::init() | |||
| if (!TheAudio->isMusicAlreadyLoaded()) | |||
| setQuitting(TRUE); | |||
|
|
|||
| #if RTS_ZEROHOUR && RETAIL_COMPATIBLE_CRC | |||
| TheNameKeyGenerator->syncNameKeyID(); | |||
There was a problem hiding this comment.
Instead of adding the syncNameKeyID function, how about just calling nameToKey 3 times here?
There was a problem hiding this comment.
I wanted a better place for a TSH comment that's not in the middle of an enormous function that's not really related.
Perhaps it's best to keep the issue open because it touches on a larger issue that this PR does not fix.
#1516 adds three strings with hardcoded name key IDs. This PR fixes the following issue:
I've added a second commit with debug assertions for the correct name key ID with unmodded files to help us detect undesirable additions or removals of name keys.
TODO: