Author Topic: Error reading dialog.tlk - negative seek offset  (Read 28838 times)

Offline Phobossus

  • Planewalker
  • *****
  • Posts: 34
Error reading dialog.tlk - negative seek offset
« on: May 18, 2008, 10:44:15 AM »
Hi, I've been looking everywhere and could not find any suggestions how to solve this trouble.

When I launch Near Infinity, it works well - I load dialog.tlk file with no problems. But when it comes to edit the strings, it says "Error reading dialog.tlk. Negative seek offset". I've totally no ideas what shall I do, I've tried to reinstall BG 2 several times, nothing changed. Patches doesn't help either.

However, I've got another dialog.tlk, the one that got updated after I downloaded some english mod/patch (I do not remember where and what was that; I'm from Poland, I've got a polish Baldur's Gate 2), it suddenly started to read properly and I could edit and make new strings as I only wanted. But it would be too much luck if that was a solution - after I saved a string, I lost all polish characters and whatever I did, I couldn't get them back (So right now I'm using that dialog.tlk which allows me to see the strings, but I do not touch them cause the event from above happens every time I do so.

I'd be thankful if anyone told me
a) What is the "Error reading dialog tlk. Negative seek offset" message and how to get rid of that

Or

b) How to restore polish characters after saving that second dialog.tlk

I remind you that it's not BG 1 and I can't get them back using kpzbg1. I would rather something like "kpztbg2" if only it existed :P

Hope to see some answers soon

Best Regards,
Phobossus


Offline Phobossus

  • Planewalker
  • *****
  • Posts: 34
Re: Error reading dialog.tlk - negative seek offset
« Reply #1 on: June 14, 2008, 01:26:53 PM »
Hey, is there no one who knows how to help me ?

Offline Taimon

  • Planewalker
  • *****
  • Posts: 328
Re: Error reading dialog.tlk - negative seek offset
« Reply #2 on: June 15, 2008, 08:15:35 AM »
The first dialog.tlk is from a fresh bg2 installation?

Can you upload it somewhere?
Posting the contents of the debug console after the error might also be interesting. (I think it was under Tools or somewhere, and it should contain the java error backtrace.)

Offline Phobossus

  • Planewalker
  • *****
  • Posts: 34
Re: Error reading dialog.tlk - negative seek offset
« Reply #3 on: June 15, 2008, 04:00:55 PM »
Yes, it is from a fresh installation.

One week ago I bought BG gold edition (bg1 + bg2 + tob) and it behaves the same like in old BG 2 so it's not my game's version fault.

Here are the contents:

java.io.IOException: Negative seek offset
   at java.io.RandomAccessFile.seek(Native Method)
   at n.readString(SourceFile:606)
   at bU.run(SourceFile:370)
   at java.lang.Thread.run(Unknown Source)

And here is the dialog.tlk file
http://www.speedyshare.com/639162597.html

Hope it is enough to say what causes the trouble


Offline Taimon

  • Planewalker
  • *****
  • Posts: 328
Re: Error reading dialog.tlk - negative seek offset
« Reply #4 on: June 16, 2008, 11:50:02 AM »
Your dialog.tlk contains invalid entries. The higher order word of some offsets is off by 0x60FF.
(So it's supposed to be 0x0000 but is 0x60FF or it should be 0x0200 but is 0x62FF instead.)
A lot of entries are affected, so this seems to be intentional. Maybe this is a secret tlk flag or something, I don't know.
Try to get another polish dialog.tlk and compare them.

Offline Phobossus

  • Planewalker
  • *****
  • Posts: 34
Re: Error reading dialog.tlk - negative seek offset
« Reply #5 on: June 16, 2008, 12:46:58 PM »
Well I've installed some mods and patches and this message does not appear any more time. The only trouble now is that if I edit dialog.tlk and save, I lose polish letters. Any ideas?

Offline Taimon

  • Planewalker
  • *****
  • Posts: 328
Re: Error reading dialog.tlk - negative seek offset
« Reply #6 on: June 16, 2008, 01:35:41 PM »
Can you give me an example of how a string looks before and after saving?
(You use version 1.32, right?)

Maybe it's easier to reproduce when you upload that modded dialog.tlk somewhere for me.

Offline Phobossus

  • Planewalker
  • *****
  • Posts: 34
Re: Error reading dialog.tlk - negative seek offset
« Reply #7 on: June 16, 2008, 02:23:51 PM »
Yep I'm using 1.32 and I tried earlier versions with no difference.

I don't think u'll understand that but the point is to show u the string.

Before:
http://img399.imageshack.us/img399/9233/beforeon1.png


After:
http://img71.imageshack.us/img71/433/aftermh5.png

When I launch game, the polish letters are gone, the same when I'm viewing dialogs or creature names in Near Infinity, however: When I open the edit strings window, the letters are on it's place. Isn't it a bit silly?

The dialog.tlk after installing mods:

http://www.speedyshare.com/865732993.html

Offline Taimon

  • Planewalker
  • *****
  • Posts: 328
Re: Error reading dialog.tlk - negative seek offset
« Reply #8 on: June 17, 2008, 04:53:32 AM »
Eh, this dialog.tlk has all non-ascii chars replaced with question marks, so I doubt you will see any polish letters with the string editor.
What mods did you install?

It will be easier to fix your broken dialog.tlk. I already started this, but gave up due to the big amount of offsets that needed to be corrected. You can do it yourself, if you are familiar with hex editing. (Or I might just finish what I started when I find some time.)

Offline Phobossus

  • Planewalker
  • *****
  • Posts: 34
Re: Error reading dialog.tlk - negative seek offset
« Reply #9 on: June 17, 2008, 10:14:14 AM »
Bah I know nothing about hex editing :s

If u doubt, then see

http://img337.imageshack.us/img337/4368/lettersdisappeardd6.png

The mods I installed are:

- BG2 ToB Baldurdash-WeiDU FixPack v1.64
- Enhanced BG2 v1.0
- Tortured Souls
- Tower of Deceipton v2
- Larsha Mod v0.2
- BG2 Fixpack v4
- Divine Remix v5

Anyway, if u know what to do and got time for it, I'd be really thankful. The time does not count :)

Offline Phobossus

  • Planewalker
  • *****
  • Posts: 34
Re: Error reading dialog.tlk - negative seek offset
« Reply #10 on: June 17, 2008, 10:39:17 AM »
Hey but if there is no more troubles with offset message, there is no need of fixing that dialog.tlk .. Now I need to be able to edit strings and save them without losing polish letters

Offline Taimon

  • Planewalker
  • *****
  • Posts: 328
Re: Error reading dialog.tlk - negative seek offset
« Reply #11 on: June 17, 2008, 10:50:51 AM »
Are you sure you posted the correct dialog.tlk above? (The one which should contain the polish letters that vanish when saving.)
Try downloading it yourself and replace the current one. (Back up before overwriting.)
I think it's one after you saved and so there are no polish letters inside.

Offline Phobossus

  • Planewalker
  • *****
  • Posts: 34
Re: Error reading dialog.tlk - negative seek offset
« Reply #12 on: June 17, 2008, 11:14:55 AM »
Oh .. my mistake.

Here is the correct one.

http://www.speedyshare.com/672492947.html

Offline Taimon

  • Planewalker
  • *****
  • Posts: 328
Re: Error reading dialog.tlk - negative seek offset
« Reply #13 on: June 17, 2008, 02:57:50 PM »
Looks like NI uses a hardcoded charset when writing the tlk strings.  (iso-8859-1, while polish is iso-8859-2 or cp1250)
Are you familiar with compiling java programs?

dev, if you are reading this, what about changing that iso-8859-1 to java.nio.charset.Charset.defaultCharset()?
I don't think the iso charset is okay (even for "western" BG installs), because the BG fonts use the windows codepage.

/Edit: On second thought, defaultCharset will lead to problems. Providing an option could be a better alternative.


« Last Edit: June 17, 2008, 03:26:19 PM by Taimon »

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: Error reading dialog.tlk - negative seek offset
« Reply #14 on: June 17, 2008, 03:31:42 PM »
I don't know. I'd be very leery of using defaultCharset() -- I don't want it to spit out Unicode or MacRoman or anything that would get returned under Linux.

It could probably go to Windows Latin 1, but I don't think that's good for TLK 3.0.

Offline Taimon

  • Planewalker
  • *****
  • Posts: 328
Re: Error reading dialog.tlk - negative seek offset
« Reply #15 on: June 17, 2008, 03:48:05 PM »
This is exactly what I realized later. Forget about defaultCharset().

I'll try to add an tlk encoding option, then.

Offline Phobossus

  • Planewalker
  • *****
  • Posts: 34
Re: Error reading dialog.tlk - negative seek offset
« Reply #16 on: June 17, 2008, 03:56:37 PM »
Thank you for all the time u spend on this.


Offline Taimon

  • Planewalker
  • *****
  • Posts: 328
Re: Error reading dialog.tlk - negative seek offset
« Reply #17 on: June 18, 2008, 12:15:30 AM »
If you can compile java stuff on your own, download the NI beta from sourceforge and edit infinity/util/Filewriter.java. Change the "ISO-8859-1" in line 50 to "windows-1250", and build the jar file.

Otherwise, you'll have to wait for me, making that tlk charset option.

/Edit: Okay, try downloading my current private build. (based on devSins changes to 1.33b19)
Go to options and change TLK charset to "windows-1250" or "iso-8859-2". (back up your stuff before editing anything)
There might be some other changes and I currently can't remember if this requires java v1.6 or not. Source is included.
I won't give any support on this.
« Last Edit: June 18, 2008, 06:13:18 AM by Taimon »

Offline Phobossus

  • Planewalker
  • *****
  • Posts: 34
Re: Error reading dialog.tlk - negative seek offset
« Reply #18 on: June 18, 2008, 12:46:39 PM »
It works. Thank you very much, I thought I'd never have it fixed  :)

Offline Phobossus

  • Planewalker
  • *****
  • Posts: 34
Re: Error reading dialog.tlk - negative seek offset
« Reply #19 on: June 19, 2008, 08:58:04 AM »
By the way, do u know any good dialogue and script making tutorials?

Offline Taimon

  • Planewalker
  • *****
  • Posts: 328
Re: Error reading dialog.tlk - negative seek offset
« Reply #20 on: June 19, 2008, 09:33:16 AM »
Look around in the forums, most of them have a tutorials section.

Offline Phobossus

  • Planewalker
  • *****
  • Posts: 34
Re: Error reading dialog.tlk - negative seek offset
« Reply #21 on: June 22, 2008, 04:50:18 PM »
I found that when I make new string it does not appear in game, I mean there is a blank pool instead.

Offline Taimon

  • Planewalker
  • *****
  • Posts: 328
Re: Error reading dialog.tlk - negative seek offset
« Reply #22 on: June 22, 2008, 05:21:17 PM »
Don't know what you mean. You'll have to provide some more info about what you did and what you expected.

Offline Phobossus

  • Planewalker
  • *****
  • Posts: 34
Re: Error reading dialog.tlk - negative seek offset
« Reply #23 on: June 23, 2008, 03:28:46 AM »
I just wanted to use my string in game, but the text doesn't show.
I expected to see them, huh? ^^

http://img299.imageshack.us/img299/8268/slytheio9.png

This not happen only to dialogues, the same is with creature names, item descirptions etc.



Offline Taimon

  • Planewalker
  • *****
  • Posts: 328
Re: Error reading dialog.tlk - negative seek offset
« Reply #24 on: June 23, 2008, 06:29:22 AM »
How did you add that string? (Try to be more detailed.)
Or is every other string gone as well?

And generally, I suggest you use WeiDU for dialogue modding.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: