[HELP] Script needed for unpacking/packing .spf files
Posted: Tue Dec 16, 2014 12:21 am
Hi, so I'm currently trying to make sense out of an archive file for a game called Navy Field 2. What I wanted to do was replace the game's voices with my own voices, but I realized that they were all stored in an archive file. I have very little experience with low level programming and hex editing, and I've been spending the entire day trying to make sense out of it and just feel overwhelmed because I'm not getting any leads. If anyone can lend a hand that would be great!!
Here is a background for this game archive format:
The files are .spf extention. They are used for a variety of things to store data, but mainly for storing music and sounds. For example, BGM.spf stores all the bgm the game uses.
Background about the game:
This is a ship game where you choose 1 of 4 nations and play their ships. I play as Japan so I'm dealing with Japanese voices.
My goal is to mod a file called IJN.SPF, which contains all the voices (in .wav) for Japan.
What I know so far:
I've figured out that there are 154 .wav files in total from using an unpacker tool. These files correspond to these voices in-game:
1. 1-38 Male voices used for all ships (38 total)
2. 39-76 Female voices used for ships ships (38 total)
3. 77-113 Additional male voices for aircraft carriers (37 total)
4. 114-150 Additional female voices for aircraft carriers (34 total)
5. 151-154 4 .wavs that I have no idea what they do, they are distorted voices (4 total)
I used dragon unpacker to find the wav files, and all the offsets and filesizes are given too and i used that as a starting point.
There is a directory, followed by the start of the actual data (.wav files) with no break.
PLEASE IGNORE THE PART IN QUOTES it is pretty much wrong after WRS showed it was encrypted
IJN.spf is what i want to mod
KM.spf and option.spf are other spfs to compare to
Offsets can be gotten by running the unknown filetype script in dragon unpacker.
Also extra note:
When I replace a .wav with my own .wav, all the sounds before it are fine but the ones after break. However when I trimmed that custom .wav to be exactly the same size as what I was replacing it worked. (which makes sense if the offset got messed up by inserting my own file while not updating the header)
If anyone can make a script for me please let me know. I can upload the original files if needed. Also if you need more clarifications/pictures i can post them.
Thanks!
Here is a background for this game archive format:
The files are .spf extention. They are used for a variety of things to store data, but mainly for storing music and sounds. For example, BGM.spf stores all the bgm the game uses.
Background about the game:
This is a ship game where you choose 1 of 4 nations and play their ships. I play as Japan so I'm dealing with Japanese voices.
My goal is to mod a file called IJN.SPF, which contains all the voices (in .wav) for Japan.
What I know so far:
I've figured out that there are 154 .wav files in total from using an unpacker tool. These files correspond to these voices in-game:
1. 1-38 Male voices used for all ships (38 total)
2. 39-76 Female voices used for ships ships (38 total)
3. 77-113 Additional male voices for aircraft carriers (37 total)
4. 114-150 Additional female voices for aircraft carriers (34 total)
5. 151-154 4 .wavs that I have no idea what they do, they are distorted voices (4 total)
I used dragon unpacker to find the wav files, and all the offsets and filesizes are given too and i used that as a starting point.
There is a directory, followed by the start of the actual data (.wav files) with no break.
PLEASE IGNORE THE PART IN QUOTES it is pretty much wrong after WRS showed it was encrypted
Sample files to work with: https://www.mediafire.com/folder/iqd4v36k12er1/nf2Now the hard part, most of the directory is still unknown to me. However, I have figured out a lot already.
The first 3 rows are the header.
Row 1: the same for every .spf file (5C 57 21 5B)
Row 2: bytes 1 and 2 are the same for all voice archives but different for other .spf archives.
Row 3: Always different (I want to say this is the filesize but so far it hasn't matched anything)
Entries start at row 4, and have 8 rows.
Row 1: no idea, but the same for every entry (34 9E 71 A8)
Row 2: the first 2 bytes seem to be random, byte 3 is always either 1A, 19, or 18. byte 4 is always 94
Row 3: This row always changes, but there is some order. The first 2 bytes seem to be always different, Byte 3 usually stays on a certain left hex going down the list of entries. (ie. B2, B0, B7, B5, BB, then later A6, A4, A9, AF) Byte 4 starts at F2 but eventually becomes F3 near the end. I think this row is the offset but the numbers have been meaningless so far.
Row 4: always the same (F2 AF 87 C5)
Row 5: always the same (72 DD 2E E9)
Row 6: the row that changes depending on which voice category it is (see above)
Row 7: the first 2 bytes are always the same. the 3rd starts at 83, then 82, 81, 80, and resets when it hits a new voice category. byte 4 is always Cx where x is some number.
Row 8: always the same (DC D8 E6 B3)
Example:
0000002C 34 9E 71 A8
00000030 E8 E6 19 94
00000034 B9 29 B2 F2
00000038 F2 AF 87 C5
0000003C 72 DD 2E E9
00000040 76 CD 2B A5
00000044 5E 42 83 C0
00000048 DC D8 E6 B3
The entries correspond with the voice categories I just mentioned as well. By comparing Japan's voices archive with another nation's, I learned that there were certain bytes (or maybe rows?) that distinguished which category they were in. From start of directory:
1-36 contain a row called 76 CD 2B A5
37-76 contain a row called 76 CD 2A A5
77-113 contain 7A CE 28 A1
114-150 contain 7A CE 2E A5
the last 4 contain 7A C6 2B A1
I used this row to determine which category of voices that entry was in.
The problem is, I have yet to find any entry that matches with any hint at an offset or filesize. I've looked at this for hours trying to but still nothing. I think I have narrowed it down to rows that have something to do with filesize, but I can't make sense out of these values.
The following are the first 4940 bytes I have been analyzing, used with diffchecker. On the left is IJN.SPF (japanese voices) and on the right is KM.SPF (german voices)
Organized by 4-byte rows: https://www.diffchecker.com/pueqei72
Organized by 16-byte rows: https://www.diffchecker.com/ydfu1if0
The first 77 entries (this helped with figuring out the 2B/2A flag):ttps://www.diffchecker.com/4epjfgls
Just checking to see if there were any differences within the first 38 entries: https://www.diffchecker.com/w5hx0x76
As you can tell, there are only 2 rows that consistently change. I'm pretty sure these are where the offset values are stored, but the values make no sense, nor do I know how to interpret it. I've tried little endian and big endian, and I've tried adding and subtracting with various other rows and still have nothing.
IJN.spf is what i want to mod
KM.spf and option.spf are other spfs to compare to
Offsets can be gotten by running the unknown filetype script in dragon unpacker.
Also extra note:
When I replace a .wav with my own .wav, all the sounds before it are fine but the ones after break. However when I trimmed that custom .wav to be exactly the same size as what I was replacing it worked. (which makes sense if the offset got messed up by inserting my own file while not updating the header)
If anyone can make a script for me please let me know. I can upload the original files if needed. Also if you need more clarifications/pictures i can post them.
Thanks!
