Fixing Corrupted Modules

Introduction

One of the very irritating downsides to the Aurora Toolkit is that it has a nasty habit of corrupting modules:

Uh oh.

Virtually none of us have the discipline to keep backups of the last 10 saves of the module in case the latest one becomes corrupted, which means that we can lose hours of work. (Some unfortunates have probably lost hundreds of hours of work thanks to these corruption bugs.)

There was a “sticky” thread on the BioWare boards about how to recover these corrupted modules, which involved messing around with the temporary directories that the Toolset creates, but that was a bit too hacky for my liking. So here’s another method to recover them.

Recovering Corrupted Modules with NWNViewer and NWNPacker

You’ll need Zoligato’s NWNViewer, an invaluable program for NWN hackers. The NWNViewer application actually has the NWNPacker program inside it, so there’s no separate download for NWNPacker.

Here’s the procedure:

  • Use the “File menu -> MOD HAK ERF Open” command to open your corrupted module
  • Right-click on any name inside the “File List” pane (the left-hand-side of the NWNViewer application) and pick “Extract ALL” from the context menu
  • Extract all files to a Directory Of Your Choice
  • Start NWNPacker by going to the “File menu -> NWN Packer”

Here’s the fun bit: the “File” menu is completely irrelevant to the NWNPacker application. Everything in NWNPacker is controlled by the icons in the NWNPacker window. So …

  • Click on the “New Document” icon (the piece of paper with the folded corner) inside the NWNPacker window, and select the “New MOD” menu entry. (You can’t go to “File menu -> New -> New MOD” to create a new MOD file, because there is no “File menu -> New” menu entry!) The directory browser inside the NWNPacker window should now allow you to navigate directories and add files to the left pane.
  • Add all the files which you previously extracted to your new module, by dragging them from the file selection window in the bottom-right to the list of files in the module in the bottom-left.
  • Use the disk icon in the NWNPacker window to save your new module.

At this point, your module should be openable (is that a word?) in the toolset.

  • Open your new module up in the toolset, and delete any invalid resources in it. If you’re lucky, the Toolset won’t give you those fun “invalid pointer” error messages as you’re doing this. Save this new module as your final module, and you should be able to continue work from there.

Optionally:

  • If you’re paranoid (like moi), you may want to then open up your final module and repeat the process with NWNViewer/NWNPacker, to make 100% sure that the module file is packed properly.

I’d add screenshots to this to make it more understandable, but hey, I’m lazy. If you care enough about recovering your corrupted module to email me about it but can’t understand this procedure, email me so I can put up some screenshots for you.

Possible Explanations for Corruption

If you try to open up your corrupted module in NWNPacker (instead of NWNViewer), it will complain about insufficient memory. My intuitive guess is that one of the length fields for the resources inside the module is wrong, which would also explain the invalid pointer operations performed by the toolkit.

NWNViewer appears to be more robust than NWNPacker and the toolkit, and seems to deal with such corruption better.

Have the appropriate amount of fun.

blog comments powered by Disqus