Author Topic: Modifying Oddtable.dat  (Read 7389 times)

0 Members and 1 Guest are viewing this topic.

TOG

  • Guest
Modifying Oddtable.dat
« on: August 16, 2006, 10:06:44 PM »
I have been changing the levels for the original Lemmings, and I think I just found out why they suggest to use CustLemm instead. That is that I have arrived at Fun 8, which is a duplicated level, and even though I change the information in oddtable.dat by using a hex-editor to what all the "non-used duplicate"s have there. It looks something like this ".c.c.c.c.c.c.c.c.c.c.c.c  This is a non-used duplicate  ". The periods are actually 00 in hexadecimal. But changing the place for level 8 Fun in the oddtable only changes the level to this in the game: There are 99 Lemmings, you have to save 99 Lemmings, it's at 99 speed, you have 99 of Climbers, Floaters, Exploders, Blockers, and 20 Builders, Bashers, and Miners, and 32 Diggers... and once the 81st lemming comes on the screen Lemmings messes up, but actually I expected that to happen.

Is the actual information as to whether it's a duplicate level held in Main.dat? I guess it would be, though I don't know.

Offline ccexplore

  • Posts: 5311
    • View Profile
Re: Modifying Oddtable.dat
« Reply #1 on: August 17, 2006, 01:14:52 AM »
oddtable.dat only contains the data to use for duplicated levels.̆ The decision on how a level maps to which level within what levelXXX.dat file, and whether to use the oddtable.dat data, are not in oddtable.dat.̆ They are instead in the executable itself.

A while ago when people were talking about "Lemmings Remake", I did some work to create a hacked version of the EXE.̆ If I recall I ended up allowing it to support like 160 levels total or something, with a simple mapping scheme that

1) ignores oddtable.dat
2) maps level X (counting from 0 to 159) to the Mth level in file levelNNN.dat, where NNN = X / 10 and M = X mod 10.̆ In other words, level000.dat contains level 0-9, level001.dat contains level 10-19, and so forth.

==============

In any event, I suggest you use CustLemm anyway, since most people's levelsets are designed for CustLemm, and people will likely use CustLemm to play your levels unless you said otherwise.

TOG

  • Guest
Re: Modifying Oddtable.dat
« Reply #2 on: August 17, 2006, 03:58:10 AM »
Yeah, I could use CustLemm, but I don't like the fact that there is no music.

How did you go about hacking the exe? As I understand it, it's pure machine code inside the executable. I have a free resource hacker, but that only can change certain things around on newer executables (definitely not ones that run in DOS). I suppose I could modify the levels for Oh no! More Lemmings, but that only has four songs I believe, whereas Lemmings has 15 plus the other ones for the four special levels with extended graphics.

Do you know who made CustLemm?

Offline EricLang

  • Posts: 464
    • View Profile
Re: Modifying Oddtable.dat
« Reply #3 on: August 17, 2006, 05:55:24 AM »
When changing something in oddtable.dat you only change the levelproperties like releaserate, lemmingscount etc. of an original. and a copy is made.
You mentioned Fun 8:  It is stored in Level000.dat at #6.
The original is Tricky 22. So if you want to use the Dos version, you should use the oddtable.dat as it is. Or maybe the hack of ccexplore is still around?


Offline ccexplore

  • Posts: 5311
    • View Profile
Re: Modifying Oddtable.dat
« Reply #4 on: August 17, 2006, 12:31:48 PM »
Yeah, I could use CustLemm, but I don't like the fact that there is no music.

Use Nocdlem instead.  It's CustLemm but with the original music restored.

http://it.travisbsd.org/lemmings/files/customized_lemmings_nocdlem.zip

TOG

  • Guest
Re: Modifying Oddtable.dat
« Reply #5 on: August 17, 2006, 03:16:34 PM »
Thanks, I'll use that.

Although I'm still kind of curious as to how you hacked the exe.

Offline ccexplore

  • Posts: 5311
    • View Profile
Re: Modifying Oddtable.dat
« Reply #6 on: August 18, 2006, 07:24:44 AM »
Actually, I don't really remember exactly how I discovered stuff like this, but I do know assembly language and have references to some low-level information regarding DOS programming, and although the Lemmings executable is compressed, the compression (pklite) can easily be reversed via tools found on the Internet.

So probably what happened was something like this.̆ In the uncompressed EXE I searched for the string "level000.dat".̆ I then looked for machine instructions that references the "000" part of the string in memory. I then see what other memory location it references in order to figure out what to replace "000" with.̆ This leads to figuring out which memory location holds the current level.̆ And then I probably did another search to check other sections of machine code that does calculations with that memory location (ie. current level number), and also intersect it with sections of machine code that references the "oddtable.dat" string in the EXE.̆ Together I guess this narrows the scope down to one section of code that involves both the level number and oddtable.dat.̆ Understanding that section finally allows me to figure out how the program translates the level number into which file to open, which level to load, and whether to use oddtable.dat data.̆ The code shows that it references a table inside the EXE to perform the translation.

In hacking the EXE for the remake version Lemmings, I think I changed the actual code (machine instructions) so that it no longer uses the table, instead using the formula mentioned above.

TOG

  • Guest
Re: Modifying Oddtable.dat
« Reply #7 on: August 18, 2006, 05:55:23 PM »
Interesting. Perhaps just a little over my head though. I'll still use the nocdlemm program to play (or test) the levels, but on the side I'll attempt to understand how to go about that. I know some programming languages. Basic programming like DarkBasic, Flash, Delphi, PHP, and Basic; not much more than that.

Thanks for the information, though I don't know whether I'll ever figure it out : ).

Note: I tried looking at the code with only a disassembler, and even with a guide to assembly code (I think it was the right kind), a few things confused me like what ax, sp, and such things were... (they weren't in the guide) and I couldn't see where the files were being loading. And the only assembler I had assembles com.s only. (*sigh*)