The Sims 2 PSP - filenames?

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
renderedknave
Posts: 7
Joined: Sat Dec 24, 2016 2:04 am

The Sims 2 PSP - filenames?

Post by renderedknave »

This game already has a script for extracting the files from the pathcache.bin, but the files exported by it lack the actual filenames (as with the directory structure, they both use incremental numbering for filenames).

The filenames aren't, actually, obfuscated - all files have a complete path directory relative to the .bin file (with the file serving as root) and a filename, somewhere in them. Scripts have their names after a "lua!" identifier, at the file's footer, and resource files (not sure what is in them, but from my basic inspection, there are models, skeletal data for animation, textures, animation data, effects parameters, etc.) have a lot of different names, because they have a lot of different data in them that refers to different files (not all of them with a .res extension, some of them are .tif, for example).

I'd add support for these filenames myself, if I knew how. The attached screenshots show filename locations in some script files and in resource files, highlighted in orange.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: The Sims 2 PSP - filenames?

Post by aluigi »

As written inside the script, all the strings and filenames are obfuscated and so the script can't extract them.
What you see there are just chunks of files and not parts of the TOC (the table with information about the files to extract).
renderedknave
Posts: 7
Joined: Sat Dec 24, 2016 2:04 am

Re: The Sims 2 PSP - filenames?

Post by renderedknave »

Oh, I didn't know about that. I checked in pathcache.bin and the filenames aren't even there, unlike everything else, so I'm guessing that this is related to the missing TOC?

Anyways, I've found some more info on the files used in the game.
There are multiple cutscenes which use the psp's .pmf (MPEG or H.264 video, ATRAC3 audio) file format, music files which also use the AT3 format (though these all have the standard .res header which allows the engine to identify what kind of file it is - removing this and a portion of the end of the file allows it to be played in Audacity, for example) and various sound files (different from music, these are just sound bites/ sound effects and do not use AT3, even though they seem to use the WAVE format and share header data with music files. Have yet to figure out how to play), along with .tif textures (do not use II or MM identifiers, so can't be read. They're all relatively big for a small image, so I suspect they're not just textures) and many, many LUA scripts.

The scripts control everything from character behavior, to text displayed in-game (and regional differences), to Perks/Aspirations behaviour in-game. Character behavior files have two versions - a big file in the /0/ folder with all of the files in /1/ and subfolders, and the files in /1/ themselves. Changing them does not seem to do anything, but this is not because of my methods, given that re-enabling a buggy scrapped feature in the "chat" minigame causes the game to crash upon minigame start in an emulator and on original hardware.

There are also files with .DAT extensions which seem to be drivers or codecs for reading the ATRAC3 music files, PMF files, font libraries and just codecs in general (video and audio, but no exact format). Maybe these could help read the unknown format sound files have.

Also, the "data" files that had many different "filenames" in them are most likely read order files/ folder content index files, because all folders with LUA files in them have at least one of these, and they contain the filenames found in the footers.
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: The Sims 2 PSP - filenames?

Post by AnonBaiter »

So I found this on the game`s executable(PSP version):

Code: Select all

0123456789abcdefghijklmnopqrstuvwxyz
This was all I could find though, although it might be a potential clue as to why are the filenames so obfuscated like that.
renderedknave
Posts: 7
Joined: Sat Dec 24, 2016 2:04 am

Re: The Sims 2 PSP - filenames?

Post by renderedknave »

Were you reading the encrypted executable (found on the game's UMD) or the decrypted version (i.e. exported using PPSSPP)? There's a huge difference between them, and the decrypted version has a lot of very interesting things, such as many references to a debug tool called Emory.
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: The Sims 2 PSP - filenames?

Post by AnonBaiter »

renderedknave wrote:Were you reading the encrypted executable (found on the game's UMD) or the decrypted version (i.e. exported using PPSSPP)?
I originally read it on BOOT.BIN through the game`s UMD, which is identical to the decrypted executable you get from PPSSPP by messing around with your emulator settings.
renderedknave wrote:There's a huge difference between them, and the decrypted version has a lot of very interesting things, such as many references to a debug tool called Emory.
Emory?
renderedknave
Posts: 7
Joined: Sat Dec 24, 2016 2:04 am

Re: The Sims 2 PSP - filenames?

Post by renderedknave »

I just checked, and yeah, the executables are identical. I must have confused this game's .bin with another's.

There are many places in the executable's text that reference "emory" and a bunch of debug-related functions, so I can only imagine that this was their tool or internal codename for the game. There is a part in the .bin which mentions a lot of characters' names (actually refers to the .res files for each character) and there is an Emory there, but this has nothing to do with anything.

Offsets where "emory" appear in are 20FDD0, 210004, 21009C, 21059C, 21069C, 2107E4, 210ABC, 210B44, 211018, 2114D4, 2115F4 with a couple more references until 212295, where it's "emilyemory" and actually a character definition file.