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.

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.

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.

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.

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.

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*

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.