Here's a utility to undo the damage that XWE does to your IWADs. It will restore the IWAD tag to any wad file it is given as input, so long as that file is marked as a PWAD.

Usage:
> unxwe [input file name]

A backup will be created, just in case you need broken stupid files laying around.

WIN32 Source and binary, released under GPL v2.0:
http://eternity.mancubus.net/unxwe.zip

Share this post


Link to post
Quasar said:

It will restore the IWAD tag to any wad file it is given as input, so long as that file is marked as a PWAD.

So, it is just changing the first byte of a file from 'P' to 'I'? It's a bit underwhelming.

I expected something that would, for example, repair broken TEXTUREx/PNAMES lumps and lump directories where XWE made garbage characters part of the strings.

Share this post


Link to post
Gez said:

So, it is just changing the first byte of a file from 'P' to 'I'? It's a bit underwhelming.

I expected something that would, for example, repair broken TEXTUREx/PNAMES lumps and lump directories where XWE made garbage characters part of the strings.

If you can give an explicit description of what happens to the file when this occurs, maybe I can implement that too. This was a quick one-off hack, not meant to impress. Just to do what it says on the box.

Share this post


Link to post
Quasar said:

If you can give an explicit description of what happens to the file when this occurs, maybe I can implement that too. This was a quick one-off hack, not meant to impress. Just to do what it says on the box.


The gist is that name strings in Doom's data files are NULL-terminated 8-chars array; but that Delphi (in which XWE is coded) doesn't do NULL-termination like C. (Instead, the first character in a Pascal string is the string length, so it can be between 0 and 255. A NULL character is actually interpreted like a space.)

So suppose you have a texture or lump or whatever named LAVA. Its representation will be LAVA\0\0\0\0. But only LAVA\0 matters. It's very possible that when writing with some old lump editor thing, garbage characters are left in memory and not overwritten. So it can end up being LAVA\0`@Û which is written in the file. Open and save in XWE, it becomes LAVA `@Û (with a space instead of a NULL).

The idea would be to scan through the WAD directory and, if they are present, the patch names in PNAMES and the texture names in TEXTURE1 and TEXTURE2, look for spaces in names, and replace them (and everything that follows) with NULL.

Share this post


Link to post

Sounds simple enough. I'll implement it in the next version. That's not gonna be released tonight though as I have other things to do ;)

Share this post


Link to post

While I don't like what XWE does to IWADs, it's probably best to just overwrite your IWADs with the originals than to try to repair it, that way you can be sure that the file is untouched and has the same MD5.

Share this post


Link to post

Or just make your iwads "read-only". :) That's what I did.

Share this post


Link to post

I've always used a hex editor if I want to change the P to an I (or vice versa). DeePsea allows you to change the P or I when you import files into a WAD as well (you can import nothing and just have it change the header if you want). Some ports don't care whether a WAD has a P or an I in the header.

All that being said, I'm sure someone will find a use for the program. If I had an otherwise unaltered IWAD, however, I'd just copy the original over the damaged one.

Share this post


Link to post
Sodaholic said:

While I don't like what XWE does to IWADs, it's probably best to just overwrite your IWADs with the originals than to try to repair it, that way you can be sure that the file is untouched and has the same MD5.

Pity the foo who didn't have a backup, right?

Share this post


Link to post

I suppose this is the part where someone goes "then why not just warez it"? :P

That totally doesn't count as me saying it, BTW. This'd be a preferable alternative, for sure. I'm curious to know if the standard level of XWE-ization is such that PWAD->IWAD and texture directory fixed would be enough to get it byte-for-byte back to the original... probably not, given how XWE stores junk lumps everywhere as it edits stuff, but maaaybe for really minor cases? *shrugs*

Share this post


Link to post
Xaser said:

I suppose this is the part where someone goes "then why not just warez it"? :P

There is no DRM on Doom. Assuming you installed it from a legitimate installer (be it the original set of floppies, or the later CD-ROM, or Steam), you can reinstall it an unlimited amount of times. And XWE isn't going to overwrite your read-only floppies/CDs/Steam servers.

I suppose if you got the game through warez, then warezing it again counts as reinstalling it from the same source... But hey, it's five bucks on Steam. For $25 bucks, you can get Ultimate Doom, Doom II, Final Doom, Heretic, Hexen, and Deathkings (aka all the non-free IWADs except Strife).

And once you have downloaded them, you can even uninstall Steam and forget about it, and play all these games with source ports. So even if you dislike Steam, it's still a good idea.

Share this post


Link to post

Yeah. I wish ID would sell Doom/Doom II/Final Doom as a digital download for like $5 or $10, but the Steam method is the best deal so far.

Share this post


Link to post

I think I'm going to lose my mind if I see any more XWE chatter.

Share this post


Link to post

I remember there already was a "WAD gender changer" utility laying around...maybe on toastytech?

Share this post


Link to post
This topic is now closed to further replies.