MOB File Format Breakdown Thread

Discussion in 'General Modification' started by Agetian, Mar 20, 2005.

Remove all ads!
  1. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    Hey dulcaoin,
    Way to go! Good news about the float format!
    So, the main problem that remains for now is that all those offsets are relative to the chest thing we analyzed (the Tutorial Chest 1, that is). There got to be some kind of a byte count or an offset into different blocks of a mob file (i.e. the property block, the item block, etc.). On the other hand, it may well be dependent on the mob file subtype (chest/npc/weapon/etc.).

    Btw, it's interesting they actually have a container item inventory reference in the mob file. I wonder what it's for, since all the items are referenced directly in a chest (and the chest itself is back-referenced in the weapon/ammo/armor/etc. mob files, too). Maybe it was used by the Worlded?
    I deleted the item inventory reference entry in my rebuilt chest mob and it still worked fine...

    Good targets for further analysis (in our chest mob) would be:

    1) Great targets for offsets/byte count/stuff like that:
    the "80 0E" thing at the offset 0x0046
    the "01 18" thing at the offset 0x0073
    the "6E 16" thing at the offset 0x007C

    2) Unknown stuff that crashes the game if changed:
    offsets 0x0038 (value 0B), 0x003A (value 07), 0x003C (value 20), 0x003E (value C2).

    I'll try to join up in 4-5 days, for now I can't do anything but remain kinda passive due to life troubles... :-((

    Thanks in advance!

    UPDATE: Uh, had a couple minutes to check a small, but important thing: fired up the protos editor and checked for some more similarities to info there and in the mob file. Found nothing so far, even though there's no direct way to check for such things as OCOF_LOCKED and the like (I guess they are defined in temple.dll and not in the *.mes files)...

    - Agetian
     
    Last edited: Apr 8, 2005
  2. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0
    I'm 98% sure that OCOF_LOCKED is 1, so the container_flags value would be 01. We have plenty of those in the file.

    In the "old days" (Arcanum), you only had Inventory Source for storing things in containers, so that was "how it was done". That's why I went looking for it here.

    One of the values near the end, one of the all-0's, could be the notify-npc, potentially; another Arcanum feature that I'm not sure has made it to TOEE or not.

    -- d
     
  3. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    Hey dulcaoin,

    I'm not sure there's really that many of 'em left after I refined the file ;-)
    You can use the refined one (from a download I provided in my posts above) to determine the possible valuable offsets. Of course, I'm not saying that everything I've emptied out is absolutely useless, but at least it's not useful for our chest's functionality so it can be ignored for the time being.

    P.S. I wonder if there's any reference in the Internet about the Arcanum mob files? It might be useful if one exists (I know that Arcanum had a world editor distributed with it, but I'm not sure how far its community went with it...). I tried searching for it (google/search.com/etc.) but to no avail...

    IMPORTANT PUZZLE THING: My friend, while further IDA'ing the mob loader routine in temple.dll, has found a logical switch construction with 17 elements that is called when the game loads something that it calls "fields". He's so far unable to investigate further what it all does, because the file blocks are loaded into different places in memory and it's very hard to trace the process. Anyway, does the number "17" ring a bell? (Well, it may be 16 as well, 17th branch being the default one). Could it be the total number of MOB types (chest,item,weapon,npc,...)? Or the MOB subtypes? Any ideas are welcome.
    By the way, judging from the string references in temple.dll, it might just as well be the number of MOB types:
    10292670: 'obj_t_bag',0
    1029267C: 'obj_t_trap',0
    10292688: 'obj_t_npc',0
    10292694: 'obj_t_pc',0
    102926A0: 'obj_t_generic',0
    102926B0: 'obj_t_written',0
    102926C0: 'obj_t_key',0
    102926CC: 'obj_t_scroll',0
    102926DC: 'obj_t_food',0
    102926E8: 'obj_t_money',0
    102926F4: 'obj_t_armor',0
    10292700: 'obj_t_ammo',0
    1029270C: 'obj_t_weapon',0
    1029271C: 'obj_t_projectile',0
    10292730: 'obj_t_scenery',0
    10292740: 'obj_t_container',0
    10292750: 'obj_t_portal',0
    Exactly 17 types... So, this might turn out to be prominent in the future. Probably there is one subroutine in temple.dll for each of the mob file types, so they in fact may be seventeen different subformats instead of one and the same format for each mob file type.

    UPDATE: The subroutines I'm talking about seem to be somehow connected with the obj_f_* stuff someone mentioned in this thread before. For those who don't know/remember, the obj_f_* fields are defined in temple.dll and they are names for certain fields in mob files (e.g. rotation, height, and so on). This means that if me or my friend had found a way to detect the reference to one of those string constants while the mob files load we would be able to plug once again into our "Mr. Laboratory Animal" Tutorial Chest A and determine the order of the loaded fields and match their contents, after which it would be easier to do the same for any other MOB file. Any volunteers to help us with that, by the way? Maybe someone here knows a good way to detect such references?

    THREAD STATUS UPDATE: Stickied this thread due to its high relevance for toee modding.

    - Agetian
     
    Last edited: Apr 8, 2005
  4. Firestrand

    Firestrand Member

    Joined:
    Mar 11, 2004
    Messages:
    79
    Likes Received:
    0
    See if you can get a hold of a copy of softice and a windows 2000 computer. (Not sure if softice is XP compatible) Then using softice set up a watch for the data type you are looking for, or I think you can even mark a subroutine in the machine code, and it will break into there at that point. You may also be able to use other debugging tools like Visual Studio to watch the memory and files, but I am not as familiar with the capabilities of those. I know you can do it with softice, unfortunately I can't find my copy anymore, I sort of lost track when I went XP and SUSE on all my boxes.

    You know we will all be reverse engineering pros by the time this is figured out.
    [EDIT]
    OK, I found a free debugger that should work with ToEE in window mode. I can't test right now as I am at work. The debugger is called OllyDbg, and a quick tutorial on using it to reverse engineer something can be found here.

    In case someone doesn't know, window mode is achieved by adding "-window" after your ToEE shortcut. So if you open the properties for your ToEE shortcut, then edit Target to be:
    Code:
    "C:\Program Files\Atari\Temple of Elemental Evil\TOEE.EXE" -window
    -Firestrand
     
    Last edited: Apr 8, 2005
  5. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    Hi,
    I think my friend told me something about softice (I think he has it, even though I didn't ask specifically) and something about it not working on XP, so I'm not sure if it'll work.

    If I have some spare time within next few days I'll test out OllyDbg and see if it's worth it. Thanks!

    - Agetian
     
  6. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    Critical question

    I have a critical question to all of you. Does anyone know of moebius2778's e-mail address? I really need to contact him somehow about working with the MOB functions in temple.dll (I know that he worked with temple.dll a lot in the past), but he seems to be long gone from here (his last activity was in November 2004) and the e-mail function is disabled by the administrator on this site.

    If anyone can give me a hint how I can contact this guy, I'd be very glad!!
    Maybe he could help me a li'l bit with the DLL thing...?

    Thanks in advance.
    - Agetian
     
  7. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0
    A google search reveals that the NWN Modules forum contained a link to a moebius2778@hotmail.com

    I can't see there being two people, so I'd try that if I were you. :)

    -- dulcaoin
     
  8. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    Thanks, pal! Gotta check this out for sure today!!
    - Agetian
     
  9. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    Hmmm... didn't work (the e-mail doesn't exist). Gotta find some other way.
    Thanks anyway!
    - Agetian
     
  10. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    MOB File Format Update

    After a certain analysis I came to a conclusion that offset 0x0034 definitely defines the MOB type. It can contain one of the following values:

    00 - Portal
    01 - Container
    02 - Scenery
    03 - Projectile
    04 - Weapon
    05 - Ammo
    06 - Armor
    07 - Money
    08 - Food
    09 - Scroll
    0A - Key
    0B - Written
    0C - Generic
    0D - PC
    0E - NPC
    0F - Trap
    10 - Bag

    - Agetian
     
  11. Shiningted

    Shiningted I want my goat back Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,654
    Likes Received:
    352
    Its been a while since I read this whole thing, but I am pretty sure what I am about to say addds a little something.

    Comments have been made about only being able to mob in shopkeepers. I have been fiddling with Jinnerth the tailor and Armario the cabinet maker, and realised the large number of mob files in their map folders are the inventories of their shops.

    Moreover, these inventories are 'stored' in a chest, protos 1001. This is mob'ed in but of course invisible (or something, 'not drawn' or something perhaps). This invisibility is in the mob itself it would seem, as it is not in the protos and it appears happily if spawned.

    Curiously, this chest is trapped. So if you go into Armario or Jinnerth's houses and hit 'search', you find a trap :)

    O, but if you spawn it from the console or heartbeat or something and open it, it doesn't have the inventory in it. (But then y would u other than for testing ;))

    Hope this is of some help to someone.
     
  12. darmagon

    darmagon stumbler in the dark

    Joined:
    Mar 22, 2005
    Messages:
    295
    Likes Received:
    0
    Okay, now I am resurrecting an old thread.

    @Agetian can you give me a simple explanation of the mob file format such that I can easily extract an inventory from it. Remember that I am a programmer with nearly 20 years in, so I will understand most jargon (and if I don't I will ask.)

    If it is not that simple please let me know.

    THX
    Darmagon
     
  13. Shiningted

    Shiningted I want my goat back Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,654
    Likes Received:
    352
    Funny this should be resurrected, I came on to ask the same thing.

    Agetian, could we simply have a breakdown of the .mobs as they are known, including particularly unknown areas so if necessary we can concentrate there when looking for new stuff.
     
  14. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    NOTE: This thread is outdated. It has been unstickied, but will remain intact because it still contains valuable information. Please use this thread in order to ask questions about the MOB file format. A new thread will be created where I will post the MOB specs with time. That thread will be closed and you will not be able to post there directly, so please use this thread for MOB questions instead.
    Thanks.

    - Agetian
     
Our Host!