CnCNet / xna-cncnet-client

XNA / MonoGame based client for playing classic Command & Conquer games both online and offline with a CnCNet game spawner.
Other
223 stars 86 forks source link

Translation system config reading fix #476

Closed MahBoiDeveloper closed 4 months ago

MahBoiDeveloper commented 1 year ago

During the porting of the Twisted Insurrection russifier to the new client version, I was surprised that the key reading algorithm for copying the game files was hardcoded to the key number after GameFile. Thanks to Kerbiter, I was able to quickly find the place where those keys were read and processed. Now to make this feature work, you don't need to a specific number in keys. You can use any set of letters in the keys, as long as the keys starts with GameFile.

Example [Translations] section keys in ClientDefinitions.ini with old reading algorithm:

[Translations]
; Localized in-game fonts
GameFile0=MIX/ecache98.mix,MIX/ecache98.mix

; In-game menu text
GameFile1=Resources/language_800x600.dll,Resources/language_800x600.dll
GameFile2=Resources/language_1024x720.dll,Resources/language_1024x720.dll

; In-game mission text and units naming
GameFile3=INI/LangFS.ini,INI/LangFS.ini
GameFile4=INI/Tutorial.ini,INI/Tutorial.ini

; Missions with localized briefings
GameFile5=Missions/g0.map,Maps/Missions/g0.map
GameFile6=Missions/g1.map,Maps/Missions/g1.map
GameFile7=Missions/g10.map,Maps/Missions/g10.map
GameFile8=Missions/g11.map,Maps/Missions/g11.map
GameFile9=Missions/g12.map,Maps/Missions/g12.map
GameFile10=Missions/g13.map,Maps/Missions/g13.map

Example [Translations] section keys in ClientDefinitions.ini with new reading algorithm:

; Localized in-game fonts
GameFileFonts=MIX/ecache98.mix,MIX/ecache98.mix

; In-game menu text
GameFile01=Resources/language_800x600.dll,Resources/language_800x600.dll
GameFile0000002=Resources/language_1024x720.dll,Resources/language_1024x720.dll

; In-game mission text and units naming
GameFileUnitNames=INI/LangFS.ini,INI/LangFS.ini
GameFileMissionText=INI/Tutorial.ini,INI/Tutorial.ini

; Missions with localized briefings
GameFileMissionG00=Missions/g0.map,Maps/Missions/g0.map
GameFileMissionG01=Missions/g1.map,Maps/Missions/g1.map
GameFileMissionG10=Missions/g10.map,Maps/Missions/g10.map
GameFileMissionG11=Missions/g11.map,Maps/Missions/g11.map
GameFileMissionG12=Missions/g12.map,Maps/Missions/g12.map
GameFileMissionG13=Missions/g13.map,Maps/Missions/g13.map
github-actions[bot] commented 1 year ago

Nightly build for this pull request:

MahBoiDeveloper commented 4 months ago

PR has been updated to the newest develop changes and tested. My custom TI client works fine. Documentation has been updated too.