themrdemonized / STALKER-Anomaly-modded-exes

STALKER Anomaly exe edits with patches by community
125 stars 26 forks source link

DXML not loading `eng` and `rus` localization files #62

Closed augustsaintfreytag closed 9 months ago

augustsaintfreytag commented 9 months ago

According to the DXML documentation, quote, "DXML won't process translation strings other than from eng/rus folders", that reads like it indeed does load and process localization XML files like text/eng/ui_st_inventory.xml. However, logging all files loaded by DXML during launch (and an F2 debug game), these files do not run through DXML or the on_xml_read callback is never called for these. Patching text that appears in the details/stats panel for items would require it, though, like ui_ammo_types.

Is this a bug? Is the documentation wrong about it and DXML does not process localization files (all the *st* files) at all?

Interestingly enough, the documentation says the module won't process character files and those are the ones specifically handled in the Additional Functions section, though the callback does get invoked for gameplay\character_desc_marsh.xml and others.

themrdemonized commented 9 months ago

it does work for localization files, otherwise you wouldn't see Modified exes line in the title screen, it is modified by modxml_test.script Only character_desc_general.xml wont be processed, cause its too big for Lua. Other character_desc files might be processed if they are standalone files not included in character_desc_general.xml

augustsaintfreytag commented 9 months ago

Hm, that is true. But checking the sample code of the test script, I can't see where I could've gone wrong.

Assuming I write a script like the following:

function on_xml_read()
    RegisterScriptCallback("on_xml_read", function(xml_scope_name, xml_obj)
        printf("DXML callback called for file '%s'.", xml_scope_name)
    end)
end

Shouldn't that log the name of all localized string files, too? In this case, my file was named modxml_ui_text_auto_patcher.script, by what I got from the documentation, all that's required is that the LUA script name leads withs modxml.

Some XML files run through this and their names get logged but notably not a single ui_st file. If I use this script, load a debug game, open my inventory, I see strings defined in ui_st_inventory.xml but the file name is never logged. Interestingly enough, _game_version.xml is also not logged and DXML does not appear in the bottom row if it's supposed to. Another mod I'm building that only patches UI files through DXML works flawlessly.

Screenshot 2024-01-06 181749
themrdemonized commented 9 months ago

изображение works fine for me, also i dont support modpacks and i can't guarantee that they use everything correctly, i suggest testing on vanilla install first

augustsaintfreytag commented 9 months ago

I see, thanks for testing it out. This was apparently a misunderstanding of what comes bundled with GAMMA, seems to be an older or reduced version of the modified executables, it did include DXML, which led me to believe it would be an up to date version, but it was some variant that did not load all XML files I expected. The solution here was just to use the most recent release, install that on top of the modpack and everything is working smoothly from there. I've learned a lot from this.

I greatly appreciate your work, none of the mods I'm working on would be possible without what you've done, so thank you for your contributions to the community and thanks for bearing with me on this one.