WeiDUorg / weidu

WeiDU is a program used to develop, distribute and install modifications for games based on the Infinity Engine.
http://www.weidu.org
GNU General Public License v2.0
90 stars 20 forks source link

[Feature Request] Improve AUTO_TRA with EE_SUFFIX extended files #227

Closed Roberciiik closed 11 months ago

Roberciiik commented 1 year ago

Problem description

EE games changed in-game text style formatting that is not compatible with classic BG style. (For example: they changed " " to Unicode „ ”).

Proposed solution

Add an optional parameter (for example: EE_SUFFIX) to AUTO_TRA command that would allow supplying additional files pattern that should overwrite (only available stringrefs) currently processing file.

AUTO_TRA ~MyMod/Tra/%s/D~
    EE_SUFFIX ~-ee~

So if we have file1.d and corresponding file1.tra and file1-ee.tra, then file1.tra would be loaded on classic engine, or file1.tra and then file1-ee.tra would be loaded on EE game (in UTF-8 format already, because of characters that are only defined in Unicode and not in ANSI/Localized Codepages).

A real-life example is here: https://github.com/Pocket-Plane-Group/Assassinations/pull/3/files where I had to append EE-specific files manually in ALWAYS clause before AUTO_TRA takes place. Note that this is a very simple example because there is only one D file, but in bigger mods it would be impossible to load and maintain multiple files.

Additional solutions

Additionally, there could be an optional extension that would include also the whole new folder of EE-specific files to be loaded:

AUTO_TRA ~MyMod/Tra/%s/D~
    EE_FOLDER ~ee~
FredrikLindgren commented 11 months ago

Implemented in 4e59dd0587886d01434fe4ffc3ec523036985c68 as AUTO_TRA path [ subdir ]. If path/subdir/file.tra exists, it is loaded instead of path/file.tra on EE-type games.

Roberciiik commented 11 months ago

@FredrikLindgren Thank you for your support!

Is there any development build, so I could try this during installation? Also, I would like to request a minor adjustment to this feature: it would be better when the subdir files overrides only existing strings in that files. I mean that AUTO_TRA should load path files first and then override them with content of subdir files. So you don't need to copy the whole content of the original file.

Example subdir file: https://github.com/Pocket-Plane-Group/Assassinations/pull/3/files#diff-026412fc93d97e4c80e25f8d34d7de0e05f80988f1b9b325c68d80f655edfc4e

EDIT: I can open a new issue if you prefer this as a new feature request.

FredrikLindgren commented 11 months ago

@Roberciiik Done in a37b24e7414c53a5dffacf512016793ed8c48af9. There isn't a development build.

Roberciiik commented 11 months ago

Great! Looking forward of a new release.

Roberciiik commented 10 months ago

@FredrikLindgren Hello again! So first of all, thank you for the support. I was able to test this change from a compiled weidu version. I think I found an issue in relation to this feature.

The code works fine, i.e. AUTO_TRA ~Assassinations/%s~ ~Assassinations/%s/EE~ is interpreted correctly by the new version of WeiDU. However, it seems that replacing of the corresponding file is not taking the place. Installation passed successfully and in NearInfinity I checked if the EE-specific stringrefs from EE/Assassinations.tra file were updated. And it's not. Also in the log there is no mentioned loading this file. Only:

[Assassinations/Polish/Assassinations.TRA] has 1421 translation strings
[Assassinations/Dialogue/Assassinations.d] loaded, 95878 bytes

Could please take a look if I did something wrong or there is a bug that prevents from loading the second file for EE.

I pushed my tp2 code to the branch https://github.com/Roberciiik/Assassinations/tree/ee-weidu here: https://github.com/Roberciiik/Assassinations/commit/0d0c8fe0d030d368c5eafc70d8c4e66c5ac22212, so you can test it during installation on BG2:EE.

PS. oBG2 seems to be not affected, thus it is working correctly.

FredrikLindgren commented 10 months ago

Your AUTO_TRA should be AUTO_TRA ~Assassinations/%s~ ~EE~

However, NB 1bb61fce. I have also clarified this in the documentation.

Roberciiik commented 9 months ago

Hello, I tested the newest fixes and it seems that it is working correctly. Thanks again! Finger crossed for the future release soon. :)

Roberciiik commented 1 month ago

Hello @FredrikLindgren I saw you are active last days. Any chance to have a release with this feature any time soon? Let us know. Thanks.