I'm pretty sure this has been posted on one of my boards in the past, but I will post it again. It is the way to convert libptr files to cache files manually, and is the process behind the program PTR2Cache. It originally appeared on Vark's website in 2002 but was known for years before that by some lib builders. The picture I posted above goes along with the process below. This is the process used to make the custom Cache.M file on my site which can be used to extract the HUDs, shapes, and some other files IIRC. Anything in the chart above can be extracted using this method as well:
Quote:
Issue #6
In this issue:
Extracting Non-Standard Files with the ATFG/FA Toolkits
(for Advanced Toolkit Users)
LibPtr File Types
Extracting Non-Standard Files
The Key to true Power Toolkit Using is the ability to alter files that not everyone is supposed to have access to. I get dozens of requests via email asking how I added my callsign to the Nato Library. Well, the short answer is... I edited the Dialog Resource. But which menu in the toolkit lets you edit Dialog Resources? None of them. You have to do it yourself, of course, letting the toolkit do the extraction for you. This tip requires a Hex Editor, and one of the Win95 Toolkits (it might work with the others, but no guarantees).
red_button.gif (627 bytes)So, you may ask, how do you fool the toolkit into extracting the files you want? Every file resource in the game is located and identified in the game's libraries. Every file in the libraries is identified and pointed to in a toolkit LIBPTR.XXX file. Go the the ..\TOOLKIT\CACHE\ subdirectory. You'll see two types of files: CACHE files and LIBPTR files.
The CACHE files are lists of the resources that the toolkit can extract and save in your project. The LIBPTR files are lists of all the resources in the game. Unfortunately, the two files aren't in the same format, so you have to manually translate from one to the other.
The Graphic to the right is a screen shot of a hex editor with a LIBPTR file open. The CACHE files can be opened and edited in a text editor (such as Window's Notepad). This file is the LIBPTR.PT file, which means all the resources listed within are *.PT resources. If you want to look at *.DLG resources, then open the LIBPTR.DLG file.
If you look closely at the graphic (I apologize for the size), you'll see that each record is 24 bytes long. The first 12 bytes are the name of the resource, the last 12 bytes indicate where the resource can be found. In the first record, the name is A1.PT, and the location data is (in hex): 0004 2374 6701 3220 DE7A 6701. This data is in the format: (LocationID) (StartPosition - 2 words) (Lib#) (EndPosition - 2 words).
In the CACHE files, the location data is stored in the following format: (Lib#) (StartPosition)+(EndPosition)+(LocationID)
A couple of these numbers have to be translated as well, other than just moving the positions around. The Lib# is stored in the LIBPTR file in this example as this: 3220. In the CACHE file it's stored as simply: 2. To determine which is which, look at the second digit. For example, 3320 would be Lib# 3. 3120 would be 1. Simple, no? The location ID is simply translated from Hex(4 digits) to Decimal(2 digits). 0004 is 04. 0014 is 20.
red_button.gif (627 bytes)So to complete our example, the location data for the A1.PT file looks like this in the LIBPTR file: 0004 2374 6701 3220 DE7A 6701. In the finished CACHE file, it looks like this: 2 23746701DE7A670104. Notice the space between the Lib# and the rest of the number.
Now all of this begs the question, OK, I've translated the location data for this great resource I want... Which CACHE file do I put it in? You have to be careful with this. If you use a CACHE file for a resource type that has an internal toolkit editor, you may crash the toolkit. So to be on the safe side, I always place my Newly decoded resources into the CACHE.M file. The new resource appears in the Mission menu, and when you select it, the toolkit doesn't attempt to decode or display it. It merely loads it into memory. Then you click the OK button, and the resource is saved to your project. You're free to edit it in any appropriate program.