The Black Wyrm Lair Forums
The Black Wyrm's Lair Terms of Use Help Search Members Calendar

Welcome Guest ( Log In | Register )

> DEITM049.ITM Error
BeachBum
post Oct 7 2008, 02:23 AM
Post #1





Forum Member
Posts: 4
Joined: 4-September 08




I am in the middle of installing Big World and specifcally the Lost Crossroads Spell Pack for Baldur's Gate 2 = SpellPackB5 and am encountering an error.

When trying to install the Core Files and Graphics it fails with the following error. "DEITM049.ITM: read out of bounds".

Can anyone help resolve this.

Thanks.

Go to the top of the page
 
Quote Post
 
Start new topic
Replies
Baronius
post Oct 10 2008, 04:49 PM
Post #2


Master of energies
Group Icon

Council Member
Posts: 3324
Joined: 9-July 04
From: Magyarország




If you want to suppress such installation errors in WeiDU, use "ELSE x" in the proper context, as TheBigg has said.

For example, here is a "patching" function call with two arguments that reads a 32-bit integer from file position 1234h to the variable "some_header_field":

READ_LONG 0x1234 "some_header_field"

If offset 0x1234 is out of range (e.g. the file size is smaller or equal to 0x1238 bytes), the operation will fail, causing an installation error. On the other hand, the following form works differently:

READ_LONG 0x1234 "some_header_field" ELSE 666
PATCH_IF ("%some_header_field%" != 666) ...

In this case, the value of some_header field will be 666, if the offset is beyond the end of stream. There will be no installation error. You can detect that there was an error by checking the returned value (obviously, to indicate the error you should use a value that can't occur in normal circumstances).

You said you learnt some Java earlier. You can think of the difference between the two solutions above as an Exception and a null check. That is, a run-time exception interrupts the normal flow of the program, while a null check can be used to detect a problem "silently" when you surely know that the returned value is a valid reference in normal circumstances (and you don't want to use exception handling, e.g. because the failure is expected to happen relatively often).

So you should add "ELSE 0" statements (with additional code if needed, I don't know your concrete code) to every function call where you expect failed reads and want to suppress (or specially process) the error. As I've emphasized, suppressing errors in mods is not always desired; if you specifically want to set a field/entry of a particular file and the file is corrupt, the installation won't fail, and the missing field (corrupt file) might break one or more features of the mod (which have the field or entry as their dependency). On the other hand, suppressing errors for features which absence can be tolerated is another question (it's a question of taste/style and/or of the mod's goals) .

Of course, there are other ways as well in WeiDU to detect that a file is corrupt (e.g. SOURCE_SIZE -- or something like that -- returns the buffer/file size, so you can check whether it has the required minimal size).

QUOTE(Galactygon)
[..] how is the game able to run smoothly [..]

It ignores the problem if an invalid value is returned (exactly what you do with "ELSE 0" smile.gif). (I would've guessed that the game crashes when a referenced feature block doesn't exist, but if this inconsistent deitm049.itm works for people, then my guess was wrong and the game just ignores such problems). I didn't test how exactly the game handles item files that are invalid in this way, but it's a general fact that the file structure specifications are stricter than the implementation that deals with these files. This allows the game to be more fault-tolerant when it's possible (for example, a missing dialogue file doesn't cause any crash, but an area without a tileset cannot be tolerated smile.gif).

As far as I've noticed, DLTCEP tries to read most file formats in a robust way too. How can it be accomplished? I haven't checked the implementations in DLTCEP and NI, but I guess that e.g. DLTCEP often simply considers the file as a sequence of contiguous sections (e.g. header, extended headers, feature blocks, equipping feature blocks). Where possible, it reads all sections (when it finishes the reading of a Section A, it immediately starts to read Section B that follows Section A, regardless what the file header says about the position of Section B ). Of course, this is a bit simplified, but you get the idea. This allows DLTCEP to read files with inconsistent or sometimes even corrupt structure, and when you save it again, it provides valid values for the header fields that were incorrect in the originally loaded file -- which results in a consistent, valid output file. This is how "broken files" can be fixed.

However, this robust approach has its own drawbacks. First of all, since these editors (such as DLTCEP) aren't built for data recovery from corrupt IE mod/game files, the algorithms aren't too complicated, there aren't too advanced heuristics. Notice that data recovery and file editing have different goals; data recovery has its own uncertainty (the returned data might be corrupt) and it usually requires human interaction, while file editing should always guarantee a consistent structure, and when this isn't possible, it should indicate an error. It's typical example of the question whether we want to correct the error or to indicate it. The latter one is usually easier and -- more importantly -- safe, because correction may fail and return corrupt data without indicating that it's corrupt (but discussing this would exceed the scope of the present topic). This drawback is present in DLTCEP as well: when it reads dialog.tlk (probably with the aforementioned procedure of continous reading that ignores certain offsets) and there is an inconsistency, it offers you to make an attempt to correct the problem. If you click 'Yes', it applies its "corrections" and saves the file. Depending on the type of the faulty field in dialog.tlk, this can corrupt dialog.tlk! For example, the unofficial Russian dialog.tlk works perfectly in the game, but it contains a very tricky offset assignment (I wonder who had that idea and what he/she wanted to accomplish with it) which DLTCEP detects as a consistency error and offers to make an attempt to fix it. Its fix will corrupt the file (the game will not crash, but many dialog.tlk strings will become totally senseless, corrupt), because the assumptions made by its heuristics prove to be wrong. Needless to say that DLTCEP doesn't detect that it partially corrupted the file (this is a common drawback of correcting errors, as I've said), because structurally, the file will be consistent, but semantically, it will contain several corrupt, unreadable texts.

Considering BeachBum could open and save deitm049 in Near Infinity, this software probably uses the same or a similar algorithm to read items as DLTCEP (i.e. trying to be fault-tolerant when possible), but when you save the file, it does not correct the invalid fields. It probably writes back the same values as it read out (this has an advantage as well: it won't accidently corrupt an inconsistent file that possibly works in the game itself).

I hope I managed to answer your question Galc, and hopefully the readers of this topic also got an insight to the question of when "ELSE 0" should be used and when it shouldn't (and why).


--------------------
Mental harmony dispels the darkness.
Go to the top of the page
 
Quote Post

Posts in this topic
BeachBum   DEITM049.ITM Error   Oct 7 2008, 02:23 AM
Galactygon   You are not the first to report an out of bounds e...   Oct 7 2008, 02:27 PM
The Bigg   DEITM049.ITM is a broken file from FR_ROV (has 6 e...   Oct 7 2008, 02:40 PM
Baronius   Why isn't the file fixed in such cases when th...   Oct 7 2008, 03:09 PM
The Bigg   Why isn't the file fixed in such cases when th...   Oct 7 2008, 03:15 PM
Azazello   DEITM049.ITM is a broken file from FR_ROV (has 6 e...   Oct 21 2008, 12:38 AM
Baronius   RE: DEITM049.ITM Error   Oct 7 2008, 04:05 PM
The Bigg   ToD vs. UB is a wrong example. UB applies a typica...   Oct 7 2008, 05:04 PM
Baronius   I don't understand this from a grammar POV. ...   Oct 7 2008, 05:34 PM
The Bigg   I meant that you make a pinned topic about the pat...   Oct 7 2008, 06:47 PM
BeachBum   Here is the file before I did as you suggested. I...   Oct 7 2008, 05:40 PM
BeachBum   Opened the file in Near Infinity and then saved it...   Oct 7 2008, 05:52 PM
Baronius   BeachBum: as far as I can see, the file you attach...   Oct 7 2008, 06:58 PM
BeachBum   Baronius - Thanks for the help. This got me by ...   Oct 8 2008, 05:24 AM
Baronius   Since no one has replied yet: I suppose that if i...   Oct 8 2008, 04:43 PM
Galactygon   Unfortunately, I cannot return to SpellPack until ...   Oct 9 2008, 04:08 PM
Baronius   I think BeachBum was merely wondering whether or n...   Oct 9 2008, 05:05 PM
Galactygon   The file I attached has consistent structure for 1...   Oct 10 2008, 10:50 AM
Baronius   Just to make sure I understand your question: are ...   Oct 10 2008, 12:32 PM
Galactygon   Yes, or more like how is the game able to run smoo...   Oct 10 2008, 01:36 PM
Baronius   RE: DEITM049.ITM Error   Oct 10 2008, 04:49 PM
The Bigg   It ignores the problem if an invalid value is retu...   Oct 10 2008, 05:07 PM
Baronius   Possible. One more reason why I generally don...   Oct 10 2008, 05:42 PM
Baronius   I actually meant that the third-party code (e.g. ...   Oct 21 2008, 02:16 AM
Galactygon   I actually meant that the third-party code (e.g. ...   Oct 21 2008, 06:21 AM
Baronius   Glad to hear that. I hope you will practise that i...   Oct 21 2008, 06:50 AM
Galactygon   Glad to hear that. I hope you will practise that i...   Oct 21 2008, 07:21 AM
Baronius   Where do such corrupt files occur? The algorithm y...   Oct 21 2008, 08:57 AM
Galactygon   Where do such corrupt files occur? The algorythm y...   Oct 21 2008, 10:32 AM
Baronius   I see, but I asked what mods (or perhaps the origi...   Oct 21 2008, 03:55 PM
Galactygon   Filled in by what? A WeiDU installer of a mod? If ...   Oct 21 2008, 07:02 PM
Baronius   So you don't want to reveal where do these ...   Oct 21 2008, 08:32 PM
Galactygon   So you don't want to reveal where do these ...   Oct 23 2008, 05:26 PM
Baronius   Perhaps I'm misinterpreting something, so let...   Oct 23 2008, 05:41 PM
Galactygon   Is this correct? If yes, my question was simple: y...   Oct 23 2008, 05:52 PM
Baronius   First, just a quick note: SOURCE_SIZE in WeiDU re...   Oct 23 2008, 07:06 PM
The Bigg   First, just a quick note: SOURCE_SIZE in WeiDU ret...   Oct 23 2008, 08:30 PM
Baronius   I also meant SOURCE_SIZE in that way (my wording ...   Oct 23 2008, 09:24 PM
Leomar   A nice treasure is hidden in this thread. :) So...   May 17 2009, 03:37 AM
Tervadh   So I'll let you know, that we have included th...   May 18 2009, 10:39 PM
Leomar   So I'll let you know, that we have included th...   May 20 2009, 04:04 AM
Galactygon   This issue has been fixed. -Galactygon   Feb 6 2010, 06:46 PM


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:



- Lo-Fi Version Time is now: 11th August 2025 - 08:32 PM