ESP Scalpel - A command line tool for performing close-to-the-metal operations on ESP files. C source code is included.
Permissions and credits
Author's instructions
ESP Scalpel and the portions of its source code written by me (see below for a clear description of the zlib file compression/decompression source files not written by me) is provided freely for use by others along with my sincere thanks for all of the time and effort that others have put into mods, documentation, tutorials, and tools that I have enjoyed so much.
ESP Scalpel uses code from zlib 1.2.8 by Mark Adler and Jean-loup Gailly and available from http://zlib.net/ to handle ESP file compression. Source files from zlib128.zip used, without alteration and included in the scalpel_source directory purely for convenience by those wishing to recompile scalpel.exe are: crc32.h deflate.h gzguts.h inffast.h inffixed.h inflate.h inftrees.h trees.h zconf.h zlib.h zutil.h adler32.c crc32.c deflate.c infback.c inffast.c inflate.c inftrees.c trees.c zutil.c See the license in zlib.h and http://zlib.net/ for further information.
ESP Scalpel comes without warranty or guarantee of any kind. Under no circumstances will the author be liable for any problems that may arise from its use. It is a sharp instrument, so if you are using the -w switch to write, keep your stuff backed up and know what you've told it to do before you hit Enter.
File credits
zlib 1.2.8 data compression code by Jean-loup Gailly and Mark Adler
Donation Points system
This mod is not opted-in to receive Donation Points
ESP Scalpel is a fast and powerful command line tool for performing surgery on ESP file elements. While primarily intended for modders familiar with ESP file internal structures, it is perfectly suitable for use as an exploration and learning tool for those who aren't afraid of hexadecimal output. A batch file is included that uses it to extract an NPC from skyrim.esm, rename it, assign a new ID, modify its AI packages and inventory, and drop it into the Bannered Mare as a new NPC. A manual and walkthrough of the NPC extraction process is included.
ESP Scalpel works by loading ESP files into memory as a linked list of groups. Command line switches are used to select a specific group for expansion into subchains of records and subrecords. Records and subrecords that have been expanded can then be operated on using generic primitives such as extract and write to file, delete, insert, replace using previously extracted records, overwrite with string or binary literals, and so on. Changed block sizes are recalculated, compressed sections are recompressed, and files can be created or overwritten. C source code is included.