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

Backups have "dead" lumps

Recommended Posts

I set XWE to do the minimum possible restoration, I use only one backup and have disabled undo. Generally, I don't need to undo or restore anything, but I accidentally saved a file with the same name when I was trying to create a subset with only part of the resources, so now I have the offshoot file and a backup of the original.

I renamed the backup, which is the size of the old file, but it still displays only the lumps I didn't delete (either in any wad editing tool or in the game). The data of the deleted lumps is still in there in some form (I even see a text format lump in a text editing program), but it isn't recognized. Is there any way to restore those lumps?

Share this post

Link to post

Well, thanks for that, because you reminded me to update to the latest.

It was an older beta from November 23rd, but I just tried it with the newer one (July 11th), and it did the same thing on a test wad. It's easy to reproduce; just grap a wad with a bunch of lumps, delete some, rename the BAK file to WAD, and open it. It lists the undeleted lumps only, but has the size of the original file.

Share this post

Link to post

I'm sorry you ran into this problem. It may sound weird, but this behavior is by design.

Here's what happens: You open a WAD and delete some lumps. There is no BAK file at this point! It's a final change written straight to the WAD. Give it a try and check it - no BAK file. (Note: there is an undo file however, in the temp folder, so at this point, your delete is easily undoable.)

When you close XWE, there's an option which is turned on by default called "Perform Clean Up on exit". The Clean Up function rewrites whole WAD file to reclaim wasted space. Wasted space is produced for a lot of operations, this is normal for most WAD editing programs (it's not feasible to keep rewriting the whole WAD all the time - especially for very large files). Before clean up occurs, a BAK is created. But that BAK - as you pointed out - already has your files deleted (again, as you pointed out - deleted from the lump list, but not from the actual file). Then the new cleaned up file is written.

Technically it's possible to recreate those lumps, but it's manual work, hacking around with HEX editors. If I recall correctly, DeepSea had some tools for this, you could look into that if getting the lost data is vital.

Share this post

Link to post

I added a new option which is turned on by default: "Automatically create a backup file when a WAD file is opened". It basically performs a "clean-up" when you open a WAD (which leaves the original file as a backup).

Pro: with this option enabled, I'm confident that there will be no data loss of any kind using XWE.

Cons: 1) it will create more files, which take up disk space (those can be deleted). 2) If you open very large files, this may take a while (so you can consider turning this off).

Share this post

Link to post

It's annoying how it messes even with the IWADs (most people open these a lot). Setting the Read only attribute will get rid of the problem for individual files you don't want modified, but it's still not very convenient because it'll modify (at least the date stamp) any wad opened.

XWE adds an option to the right click menu that says "Edit with XWE". Perhaps this could be changed to two options, one that says View with XWE and another that says Edit with XWE? View making no backup but allowing you to browse the wad or save lumps and resources to disk. Maybe you could add suboptions so that it doesn't clutter the right click menu:

XWE --> View with XWE
        Edit with XWE
        Edit with XWE (no backup)
Not sure which should be the default for double clicking, maybe that could be set in the INI file. Also, if there were an internal "toggle editing/viewing mode" in the XWE menus one could change once the program is running, and it would make any necessary backup once the editing mode is enabled.

But backing up would be much simpler if the program temporarily cached all the changes to disk and applied them to the wad only when exiting, creating the backup right before making all the changes, or when the user selects "save wad".

Share this post

Link to post

I see your point. This change is probably a necessary one, I think if I can nail it, XWE will be a much more solid app.

I think what it should do is, when a WAD is opened, copy it to a temp file (e.g. add ".XWE" to the filename), and work on that. If Save is selected, the original is renamed to a backup name and the temp file is renamed to the original name. I'll have to think about it a bit more, and I'll try to add this soon.

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