Modifying Oddtable.dat

Started by TOG, August 16, 2006, 10:06:44 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

TOG

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.

ccexplore

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

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?

EricLang

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?


ccexplore

Quote from: TOG 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.

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

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

TOG

Thanks, I'll use that.

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

ccexplore

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

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*)