|
lue Micro-Goomba Level: 8 Posts: 3/11 EXP: 2012 For next: 175 Since: 01-01-14 Since last post: 8.0 years Last activity: 6.1 years |
|
| For a while now I've been trying to decode the .avf video files present in some older Nancy Drew PC games, so that I may write a decoder and watch them without having to run the game and doing some symlinking to speed things up a bit. From the one scrap of info I've found on the format, it's a highly proprietary video format playable only in the game. I've so far only looked through games 1 (Secrets Can Kill, not the remastered version), 10 (Secret of Shadow Ranch), and 11 (Curse of Blackmoor Manor), and most of what I know on the file itself comes from the first game.
The files are used exclusively for video in the first game (and presumably the next four games as well, if the DreamCatcher connection gave rise to the format), and are almost entirely replaced by BINK files in games 10 and 11, with the AVFs used for various static-image puzzles and "fidgeting" animations by then. They appear to be a video-only format, as all the sounds associated with the game are in separate audio files. Here's what I've discovered on the file format so far (presented values come from the first game's Intro.avf, the largest avf in the game): Each one starts with a text string identifying the file and the developer who presumably generated them (always Wayne Sikes). It appears to be null-terminated, since a null character follows the text, and the resulting odd number of characters would explain why other numbers in the header start on odd offsets. 00000000 41 56 46 20 57 61 79 6e 65 53 69 6b 65 73 00 |AVF WayneSikes.|
Next up are a couple of numbers whose significance I don't know. Note that in a couple of avf files I've looked at from 10 and 11, the 01 is instead 00. These numbers are consistent between all files in the game. 0000000f 01 02 00 00 00 00 |......|
Next up are three two-byte values: 00000015 52 01 78 01 cd 00 |R.x...|
The first value indicates the number of entries in the index, which will be presented shortly. Next up is the width and height of the video. Remember that this is Windows thus Intel processors thus little-endian .
Next up in the header are some more unknown values, but these appear as-is in all of the first game's AVF files as well as those of 10 and 11. 0000001b 10 42 00 00 00 02 |.B....|
Immediately after that comes the index, which consists of a series of 19-byte entries pointing to where each frame's data is. Here's one such entry taken from the middle of the index: 00001062 db 00 dd 9c c6 00 5b 9c 00 00 30 5a 02 00 00 ff |......[...0Z....|
Each entry begins with an entry number, zero-indexed. Afterwards is the start offset for the frame's data. Following it is the size of the data. After those numbers comes two constants. The file-local constant is constant throughout all entries in a file's index, but changes between files. The game-local constant is the same throughout all files in the game. I've noticed that in games 10 and 11, the 0xff values are instead 0x00. I'm not as sure that the leading 00 00 is constant across files, though I've yet to see it be anything else. ...And that's all I know the meaning of. As for the frame data itself? All I know is:
Let me show a relatively simple image, which may make figuring out the compression used a bit easier. This image is insertcd.avf, a one frame 536x292 video which produces this within the game (hopefully it's obvious that the cursor's not part of the image):
And here's the first 64 bytes of the frame's data: 00000034 7b 01 06 f1 f9 06 06 08 08 f7 01 19 0e 18 0f 0f |{...............|
Since it's logical for this data to start in the very top-left, we merely have to figure out how this corresponds to a bunch of black pixels, right? Ha ha no of course not:
The components of each background pixel is either 00 or 08, leading to a variety of colors more visible when the contrast and brightness are increased. You'll notice that the silhouette is colored similarly, and now you'll notice the background has a slight red tint to it . (It should be noted at this point that I'm running these games through Wine, so that potentially is what's causing the weird background coloring, though I doubt it.)
The entirety of that frame's entry can be seen at this location for those of you wanting to play with it. Anyways, that's where I'm currently stuck. I've not had much luck poking around in the main executable, hoping to find a decompression routine, though that may be my inexperience with Windows things . I fear my general inexperience with doing this kind of stuff (reverse-engineering a video codec, specifically) is now getting in my way. So, I thought that is was time I shared what I knew and asked all of you for any help or hints you may be able to give me. I've still got quite a number of games to look through, perhaps one of them spills some secrets by accident.
(I'm half-hoping someone will take all of five seconds to say "Oh, that's simply DEFLATE-compressed data XORd with the string 'AVF '" or something .)____________________ U+110000 END OF POST |




.
. (It should be noted at this point that I'm running these games through Wine, so that potentially is what's causing the weird background coloring, though I doubt it.)
.)
The old top-left paradigm probably started from textmode console output, where lines of text were read left-to-right, top-to-bottom. But geometrically, positive Y is typically "up". You'll see this even in things like GPU textures like those used in OpenGL and DirectX: the first row of texels in the data is (nearly?) always the bottom one.




Yes. Yes, all bits off is a lighter version of all bits on, neither of which involves a grayscale color. Yes, having green's MSb be the only one on is nearly identical to having green's second-most significant bit be the only one off. Yes, there is an unusual lack of distinctly green coloration in this collection of images. And yes, there's a weird affinity towards purple and pink colors.
Actually I find it a bit flattering that after 20 years you're studying my work. I've published many other games since then but I still have a fondness in my heart for the old Nancy Drew games. We had a blast making them. We almost went broke a few times since back then women didn't generally buy computer games but after the first few titles they really caught on. I left Her Interactive years ago and miss some of the awesome folks I worked with in creating those games. (I did the first 13 titles, then moved on to greener pastures....). Since the AVF format is proprietary to Her Interactive, I won't give the details openly. I did see a private messaging system in this site so just private me and I might pass along a few tidbits of code for you if you're still interested. Also, i'm at wayneloe@gmail.com
!
