Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Doomkid

Modifying doom2.exe using dehacked.exe? Trying to play mods on DOS machine

Recommended Posts

I've recently acquired a machine running ms-dos which runs Doom2 wonderfully. I'd like to play some old mods which rely on dehacked but have run into some strange errors when I attempt to edit any .deh files using dehacked.exe.

 

image.png.3da5030ed2a4ade62a9c02fc4ac14afb.png

 

That's dehacked.exe running in DosBox. As you can see, the values for everything have been completely garbled - Initial health is set to negative nine billion, the new cheat code for God Mode is apparently <_@ and so on. When I dump this garbled data to a modified DOOM2.EXE, it is unlikely to run, though I have gotten it to run with some hilarious results since it basically created a corrupted doom2.exe.

 

That was entertaining, but it's not what I'm here for. Why are the .deh files becoming a garbled mess when I try to open them Okay, so I've just tried to open dehacked.exe without specifying any .deh file and it's still showing garbled data. What the heck gives? I've set up my dehacked.ini properly and am using a clean, non-edited 1.9 executable as a base, by the way.

 

Any help on this is greatly appreciated.

Share this post


Link to post

I assure you that Dehacked works just fine in DOSBox so all I can assume is that one or more of your files are either corrupted, or not the latest version, or there is still something wrong in your INI.

 

Next time you open Dehacked, press in order: Z [enter], W [enter], R to Zap changes, Write changes, and Run doomhack.exe.

 

OWkGPST.mp4

Share this post


Link to post

Thank you both for the replies. I’m using the shareware 1.9 exe from idgames (renamed to doom2.exe) and dehacked 3.1 also from idgames. My doom2.wad seems to have the right SHA1 so I assume that isn’t the problem either, and as I load various .deh files into dehacked it doesn’t report any unknown lines or anything. I’m doing everything to set these up in dosbox so I can just easily move the prepared files onto the dos machine, so I think that means it’s all being fucked around with in it’s native 8 bit environment (though my PC itself is 64 bits). I’ll do as Ling said and if I still get garbled results I’ll re-download fresh versions of everything and try again (because why not). Cheers!

Share this post


Link to post

Before ports that could load deh files, Dehacked worked by editing the exe file. It used offsets into the code to know where to edit things, so you had to have the exact version of the code that dehacked expected, or the offsets would be pointing to the wrong places. The executables for shareware Doom, registered Doom, Ultimate Doom, and Doom 2 would be different enough to make it not work if you have the wrong one selected, even if they all had the same version number.

Share this post


Link to post

Excellent, this is exactly what I needed to know. There’s a tutorial from eons ago on Enjay’s page and when I read it I got the impression that all the EXEs were the same. Renaming the 1.9 shareware to doom2.exe did result in it successfully playing vanilla doom2 but obviously there are some further differences under the hood. Thanks!

Share this post


Link to post

Getting the negative 9 billion and so forth is a very excellent clue that DeHacked believes that your Doom executable is a different version than it actually is.

 

When Id builds a new Doom exe, the compiler puts that data in a different spot in the complied exe. The DeHacked developer had to figure out where the data is in each Doom executable. So, Dehacked.exe has some logic in it that says:

If this exe is Doom v1.2,

  the monster table starts at position 152535

Else if this is Doom v1.666,

  the monster table starts at position 183757

Else ... (etc)

 

So, it is crucial that DeHacked knows which version of the executable it is hacking. Seeing those garbage values is the smoking gun - it's virtual proof that DeHacked is misidentifying your executable.

 

It's nice to have a real DOS machine. I've still got my old 486-50, MS-DOS v6.22 box with local bus video, and a 640x480, 30 FPS video capture card! The capture card is a monster - it's as long as the motherboard! That box has a SCSI 1 Gb hard drive which is also a monster. It's a double tall drive, and it sounds like a jet engine when it starts spinning! It's sitting on a shelf in my closet - I should pull it out, dust it off, and see if it still runs.

 

I wrote a menu program for that box, that launched at startup. It let you choose which programs to run. If you chose Doom, it would re-write the AUTOEXEC.BAT file just for Doom, and it would reboot the machine. The altered AUTOEXEC.BAT would run minimal TSRs, and then run Doom. It would also put AUTOEXEC.BAT back to normal. If you then exited from Doom, or Doom crashed, it would reboot the machine again, with the restored AUTOEXEC.BAT, and launch the menu again.

 

It was really pretty slick, if I say so myself. It would do all the dirty work for you, then clean it up before running Doom (or whatever), so if there was a crash, a reboot would always put you back to normal.

 

I really do miss the simplicity of DOS. Have fun!

Share this post


Link to post
5 hours ago, Doomkid said:

Excellent, this is exactly what I needed to know. There’s a tutorial from eons ago on Enjay’s page and when I read it I got the impression that all the EXEs were the same. Renaming the 1.9 shareware to doom2.exe did result in it successfully playing vanilla doom2 but obviously there are some further differences under the hood. Thanks!

The beauty of .deh files is that DeHacked provides a layer of compatibility, so, to the .deh author, the executables appear to be the same! In other words, no matter what executable you have, DeHacked will try to apply the effects in the .deh file. The idea is that you distribute your .deh file, and DeHacked applies the .deh changes to whatever executable your mod players are using. This works really well, just as long as DeHacked can identify which .exe is being used.But if it identifies the Doom exe incorrectly, DeHacked's changes will not be applied to actor tables, or frames. Instead, there's a good chance that it will alter executable code itself, resulting in crashes.

Share this post


Link to post

You're most welcome, Doomkid - glad to help! I was really hoping that it didn't read like chicken scratch :) It's really a bizarre concept: tools that are routinely used to hack a spread of similar game executables... it's almost doing the unthinkable, and getting away with it.

 

I've been toying around with building a more powerful, updated version for a long time, but I'm nowhere near completion. And, with the availability of ports, and the lack of availability of DOS environments, demand is pretty low, you know? Still, it's fun checking out the old executables, so the next logical step is to hack on them.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×