- Silent Hill 2 sound files research by Nisto at 2:02 AM EDT on April 12, 2014
- I know some people have been looking to extract (convert?) the audio in the SOUND.MGF file (MiLO, peronmls ;) of Silent Hill 2, and I would have posted this on XeNTaX in the/an appropriate thread if I had an account there, but.. I don't, so I hope you'll find your way to this thread (or I guess I'll just link, lol).
Anyway, I've been doing some research on the game these past few days. Thanks to PCSX2, MHS (Memory Hacking Software) and a hex editor, I'm starting to get fairly confident that SOUND.MGF may just be sound effects and some... other data, which at the most controls how/where the sequenced music plays. So it looks like there's really nothing of much interest in it (unless you do want the sound effects).
The top chunk consists of S-FORCE (.sfc) files, which is a 3D sound format. I noticed that when I nulled the "forest.sfc" file (0x49F800 in SOUND.MGF), the growls that usually appear when you pass through the forest are no longer there. Everything else seems intact.
The bottom chunk (0xFC6000) contains .sdb files. These, as kind of previously mentioned, seem to just control where/how music plays, but I have no idea how they really work. I guess they could be sound banks of some kind...
So even if someone did extract the data of SOUND.MGF, you'd still have to figure out a way to play/convert the stuff... And I don't think anyone knows anything about it. In fact, this is the first time I've heard of S-FORCE. I only found two games that apparently utilize it: Silent Hill 2 and Kingdom Hearts II. I also found a press release regarding S-FORCE for whoever cares.
If someone thinks differently (or even knows) about the SOUND.MGF file though, by all means prove me wrong. I'm not saying I have to be right, but it is an educated guess.
Also, the reason I'm calling chunks "files" is because the game actually does have a virtual file system kinda thing. You can see all the paths in the main executable (SLUS_202.28). Here's a structure and an example...
ulong address of sub-file attributes (pointer to main file or larger chunk of it, offset, size) (->table 2)
ulong address of sub-file path (->table 3)
Each entry has one of three initial values before it's loaded into memory. So, depending on that value...
ulong 0x03 00 00 00 -- physical file
ulong address of filepath (->table 3)
ulong offset (sector) of physical main file
ulong size (bytes)
ulong 0x23 00 00 00 -- virtual file
ulong same as for physical files
ulong same as for physical files
ulong same as for physical files
ulong 0x50 00 00 00 -- virtual sub-file/chunk
ulong address of entry of main file or a larger chunk of it (->table 2)
ulong offset (bytes) in the file/chunk
ulong size (bytes) of sub-file/chunk
Table 3 contains null-delimited filepaths only.
It probably seems a bit confusing, so here's a demonstration - let's find out in what file forest.sfc is stored, as well as its offset/size:
Prerequisites: Silent Hill 2 (the disc itself or an image file), PCSX2 and MHS.
First off, I feel I need to make it clear that when the game's main executable is loaded into memory, a lot of values are changed, stuff is loaded above it, etc. So the addresses in the static executable doesn't really make much sense unless the game is loaded. Also, you need to know that the address in memory at which the actual game data begins, is going to be 0x20 00 00 00 and not 0x0. This is because MHS reads physical memory, and not exclusive PS2 memory. So you need to account for that, where needed, by adding 0x20000000 to addresses that are stored in memory by the game and subtracting from addresses that aren't stored in memory by the game. Lastly, keep in mind that all values are big endian, so you'll also likely need to reverse the byte order when using functions such as goto (Ctrl+G).
Start by fully loading Silent Hill 2 in PCSX2. Then open the process for PCSX2 in MHS. Now make a string search for forest.sfc (make sure "aligned" and "match whole word only" are NOT checked). Open the first address in the results with the built-in hex editor. Note the address of the start offset of the path (if you're unable to see the whole path, use goto (Ctrl+G) and enter an appropriate negative decimal number to backtrack from current position, as you won't be able to simply scroll up unfortunately.) Go back to the main MHS window and make a pointer search (exact value; make sure "find only static pointers" is NOT checked).
If you get multiple results, open the first dynamic (non-green) address in the hex editor. You should be somewhere in table 1 now. The 4 bytes to the left of the found value should be the pointer for the file's entry in table 2 (where all the good stuff's at). Use goto to get to the address.
Now you should be somewhere in table 2. For this particular case - forest.sfc - we can see that it's a sub-file/chunk entry (0x50 00 00 00). Note the offset and size values of this entry for now, as those are the attributes for forest.sfc. Next, let's go to the address being pointed to. This is another sub-file/chunk entry, which simply defines a larger chunk at the top of a file. Again, note the offset/size values. Let's again proceed to the address being pointed to. We finally end up at an entry for a physical file. Let's see where the pointer value takes us. That should have landed you at the filepath of SOUND.MGF!
So, going by the info in table 2 and 3:
- forest.sfc has offset 0x49F800 and is 0x08F63A bytes in size
- the offset is relative to a chunk defined from 0x0 to 0xFB6000 (i.e. the offset is still 0x49F800, duuh)
- in file "SOUND.MGF"
In short: 0x49F800 to 0x52EE39 in SOUND.MGF is forest.sfc
Here is the full filepath table in a human readable format: https://dl.dropboxusercontent.com/u/48454461/misc/fparr.txt
Now, if only someone could be awesome enough to figure out how to make PSF2s with those module files, I'd be forever grateful.
edited 2:05 AM EDT April 12, 2014
- by peronmls at 4:24 AM EDT on April 12, 2014
- Yea i was already able to extract all the sounds from SH2/3. Just PSF2s i wanted to make. Also if you just let psound scan the MGF it will find and play the samples. The files in the game really aren't that complicated.
- by Nisto at 10:49 AM EDT on April 12, 2014
- Wait what.. why are you asking on XeNTaX only like a couple of months ago for an extraction script then? I have tried PSound, and I also don't find any tools that will extract it in VGMToolbox. They can both extract the SOUND.DAT file, but that's different..
edited 11:09 AM EDT April 12, 2014
- by peronmls at 10:54 AM EDT on April 12, 2014
- because I wanted something that extracted more than just audio files.
- by tranxient at 2:01 PM EDT on April 12, 2014
- Still, an informative and useful post for a noob such as myself. Thanks, Nisto.
- by MiLŲ at 4:16 PM EDT on April 13, 2014
- That's pretty good Nisto, even if nothing else comes from it, I found a pretty useful thing in your research - file names for PSS cutscenes. So I guess not every game has a table of contents inside their executable file (in this case SLUS_202.28), I remember looking through some other games' executable and not finding anything useful.
psscut.exe will extract all individual PSS files from MOVIE.MGF, and they go in the same order as the file system says:
The problem is there are 21 PSS files inside MOVIE.MGF, while filesystem gives names only to 20. Weird.
The files are extracted (via psscut) with names 000.pss~020.pss.
The last file 020.pss is the last name on the list = water.pss
018.pss is toilet.pss, so the missing name is for 019.pss.
I'm tempted to just call it "memory.pss" and be done with it. The cutscene shows a black & white recording of Mary by James, so I think the name would be appropriate.
Btw this thing is the same for Japanese version as well (SLPM_650.51), I checked - only 20 names and 21 files.
edited 4:18 PM EDT April 13, 2014
- by Nisto at 5:19 PM EDT on April 13, 2014
- One of the names could be for two files... maybe. Or I guess it's possible there's something unused in it (I actually still haven't played through the game, so I don't know). I'll have a look at it.
EDIT: Well, it does seem like it is something unused. But someone's gonna have to verify that, because as I mentioned, I haven't played through it yet (but even then, it looks like there's a lot of different scenes that you may or may not see depending on... stuff, so...).
edited 12:38 AM EDT April 14, 2014
- by MiLŲ at 1:17 AM EDT on April 14, 2014
- I can guarantee there are no unused PSS files. Each one of those 21 videos is played at certain point in the story.
Also it seems unlikely that one name could be given to two cutscenes at once. For example there's korosu_a.pss and korosu_b.pss - so they do separate two cutscenes into A & B parts even if those cutscenes of similar context.
I loaded Iso in PCSX2, created a save state, and looked at it in Hex editor, it's the same thing - the last file names are toilet.pss & water.pss, even though there's clearly a PSS file between them in MOVIE.MGF. Strange indeed. Even the save state doesn't have a name for it.
I guess the only way the game would know what file to play when it needed to play that nameless video file is by its position. Unless there's some ultimate true table of contents hidden somewhere that we haven't seen yet.
And just to reiterate I'm fairly certain that all other names are appropriate for other files from top to bottom. If translating japanese names (e.g. hakaba=graveyard, rouya=jail, korosu=to kill) it all makes sense according to what is shown in those cutscenes.
edited 1:33 AM EDT April 14, 2014
edited 1:35 AM EDT April 14, 2014
- by Nisto at 9:23 AM EDT on April 14, 2014
- Yeah, this is certainly quite weird then! I guess we'd have to look at memory when the scene is actually loaded to really know what's going on. And if it turns out the game doesn't somehow modify the table values even, then... I guess it's possible there are still some type of entries that I didn't learn about yet.
Does anyone know if there's a place with PS2 save states for SH2 (or in-game saves)? What part in the game would we be looking for (like.. area name)?
edited 9:28 AM EDT April 14, 2014
- by MiLŲ at 1:54 PM EDT on April 14, 2014
- I figured it out! Turns out you were right Nisto, 1 file is unused. Explanation involves heavy spoilers though so if you haven't played the game and don't know how the story goes, be warned major spoilers below:
The unnamed file 019.pss between toilet.pss and water.pss is actually a first part of murder.pss. It's exactly the same frame-for-frame first 36 seconds of a flashback James is having in which it is revealed that he kills Mary.
I must've didn't realize it before but there's no instance in the game where he can have that flashback without remembering the whole thing - killing his wife. Which is exactly what 019.pss is - it doesn't show him killing her. So for what ever reason it was included in the game but was left unused. Makes you wonder if there was suppose to be a path where James doesn't even become aware of his crime.
Also I checked with PC version of the game, it doesn't even have that short version of the video, only the whole thing: murder.bik.
PC version uses bik codec for their videos and needless to say it is heavily compressed, much more than PS2 version that is. PC videos are not hidden in any container and are just in a "movie" folder and add up to ~600mb while PS2's MOVIE.MGF is 1.58 GB. PS2 has the best quality of SH2 cutscenes to date which is why I was after them with proper names, but somehow didn't think of matching the names to PC version.
On that note Silent Hill HD Collection would be a prefect opportunity to release a true-HD renderings of those cutscenes but they turned out to be a simple upscale job of bik videos from PC. A very lame and lazy way of doing things. Just like everything about HD Collection was. They probably didn't even bother to ask for original hi-def files stored on someone's harddrive at Konami, or Takayoshi Sato - the main guy behind CGI is Silent Hill 1 & 2.
edited 3:10 PM EDT April 14, 2014
HCS Forum Index
Go to Page 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Search this thread
Show all threads
Reply to this thread:
Halley's Comet Software
Generated in 0.004s;