![]() |
![]() |
||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||
|
Tutorial: Building a Custom ERF Data Extractor Intended Audience: NOTICE: This tutorial is to give software developers an example of how to use the Encapsulated Resource File (ERF) Format. The source code provided is unsupported; compile and run at your own risk. Please refer to the For Developers FAQ and the NWN End User License Agreement (EULA) for more information. Description1. Purpose I need a command-line program that can extract resources by type id / name from an erf and save them to another directory. I can use this to help automate the merging of data files from different modules into the same module. 2. Command Line The command line should look like this:
3. Program Architecture In an ideal world, I would create a class that handles all ERF behaviours and put it in a library that I would then link into my executable. However, it's Saturday afternoon and I want to get this done as quickly as possible and all I really want at this moment is to get that data out of the ERF. So, I'll forego all the standard practices and just stick all that code required to accomplish what I want in my main function. Note: This is not the recommended approach! 4. Class Definitions None. C Source CodeTo view or download the C Source Code you need to be logged into your BioWare Community Account. If you don't have an account you can sign up for a free BioWare Community Account. Extra Credit1. Clean Up The Code Okay, while functional, this really isn't the best approach. Restructure the program by creating an interface to the set of typical ERF behaviours that we expect most programs to require: OpenFile, CloseFile, SaveFile, AddResource, GetResource, RemoveResource. Put this interface in a separate library to which the program will link. The program should then be modified to create an instance of this class and use it to navigate the ERF file. 2. Make the Program More Robust The command line system that the program currently supports is very fragile. If you don't get the parameters exactly right, the program will fail (and it won't report anything). Extend the program to make it handle extracting all the resources from the erf, all the resources of a particular type and all the resources of a particular name. 3. Write the ERF Data Integrator Write a program that takes data files in a directory and adds them to the specified ERF, creating the file if it doesn't already exist. The program should take an ERF file name and a directory as parameters. Watch out of files that don't correspond to known resource types and resources that already exist in the ERF. Together these two programs then allow you to transfer data between ERFs (modules) without having to use the toolset.
|
||||||||||||||||||||||||||||||||||||||
|
|
||
|
Multiplayer Games at Neverwinter Connections
|
||
|
Download Modules
|
||
|
5,048,300 utilisateurs sur le site de BioWare:
|
||