Jump to content

Recommended Posts

Greetings,

I'm trying to access the dialog.tlk file and its content to manipulate it. The following sources/tools are used for the experiments:

Approaches that partially work:

Spoiler
COPY_EXISTING ~<absolute path to gamefolder>/lang/en_US/dialog.tlk~ ~override~ 
READ_ASCII 0x1c5426 AssociatedSoundName
PATCH_PRINT ~%AssociatedSoundName%~

Coppying the dialog.tlk into the mod folder.

COPY_EXISTING ~%MOD_FOLDER%/dialog.tlk~ ~override~ 
READ_ASCII 0x1c5426 AssociatedSoundName
PATCH_PRINT ~%AssociatedSoundName%~

 

The problem here is that first

I would prefer to access dialog.tlk this way

COPY_EXISTING ~../lang/en_US/dialog.tlk~ ~override~ 

and manipulate it without having it copied to the override folder as I assume the system doesn't know what to do with this file (I could be wrong here). The problem here is that accessing the parent directory with "../" was unsuccessful. How can this be achieved in WeiDU?

Second, I'm interested in accessing the entire block that contains all the information found in https://gibberlings3.github.io/iesdp/file_formats/ie_formats/tlk_v1.htm so that a full deletion of that block is possible . Unfortunately I don't know how to access such a block as I don't know the offset and offset size (not found in iesdp and Near Infinity, see screenshot). How can this be achieved in WeiDU? I assume that deleting such a block in WeiDU is done with "NULL" or "-1"?

I welcome any idea, information or experience that might help solve this problem. Please ask questions if necessary as I do not know if this explanation is sufficient.

Thank you for reading this thread.

 

 

 

NI_dialogTLK.png

Link to comment

I would strongly advice against manipulating the dialog.tlk in WeiDU directly. WeiDU uses a cached version of it internally to handle (direct or indirect) string manipulations. Updating the string table manually will certainly cause syncing issues with WeiDU's own internal copy and may cause the mod installation to fail (best case) or silently corrupt the file (worst case).

WeiDU provides several commands to access or manipulate the string table. Some WeiDU commands you might want to look up are:

  • (ACTION_)GET_STRREF
  • (ACTION_)GET_STRREF_S
  • RESOLVE_STR_REF
  • NEXT_STRREF
  • STRING_SET
  • STRING_SET_EVALUATE
  • STRING_SET_RANGE
  • ALTER_TLK
  • ALTER_TLK_LIST
  • ALTER_TLK_RANGE

Btw, you should *never* remove any strings in the middle of the dialog.tlk. It will not only make all strings after the removed elements going out of sync, but may also crash the game since it uses many hardcoded string references internally.

Link to comment

I was hoping that the system would know the highest strref
number and uses this to understand when to stop searching.

Additionally, I assumed that strref not found would be ignored and hoped that the other strref values would not change, so any strrefs found would be used correctly by the system.

Unfortunately I understand you that this is not the case. Since you are working intensively on Near Infinity, I will take your words seriously.

Thanks for the enlightenment @argent77.

Link to comment

The system doesn't just "know" anything; that's all handled by fields within the tlk file. The header has a field for how many strings there are, math tells you where the tlk entry for string #N is, and the location for the actual string is the sum of a field in the header and a field in that string's entry.

So, if you delete one of those tlk entries - what you showed in that NI screenshot, plus two fields NI hid from you - and shorten the file in the process, you would literally break every bit of text in the game. First, deleting those 26 bytes would throw off where the strings start in the file, displacing the start of every string by 26 bytes. For example, BGEE's string number 1 (in English) would go from "Do you know anyone by the name of Koveras?" to "name of Koveras?Thank you for helping us.G". And the last string (#71403 in BGEE/SoD v2.6 before mods, "Remember Dorn, the blackguard? He looked strangely familiar...") would crash the game with an out-of-bounds error when the game tried to read it. But wait, it's even worse than that. By deleting a tlk entry, you effectively reindex all the later string numbers, so it's actually string #71402 (normally "Epic, epic, epic!") that throws the out of bounds error. #71403 tries to interpret ASCII text as its binary-format entry, gets utter gibberish, and that could go wrong in just about any way. All strings before your deleted entry start at the wrong spots, while strings after the deleted entry both start at the wrong spots and read the wrong lengths, and strings with the very highest numbers crash the game.

In other words, don't do it. Stick to the reasonably safe operations WeiDU gives you for adding or altering strings.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...