Amnesia: Memories [root.pfs] [Windows]

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Delacroix
Posts: 65
Joined: Mon Dec 08, 2014 1:16 pm

Amnesia: Memories [root.pfs] [Windows]

Post by Delacroix »

While I'm having my hands full with these Ys files from the other day, here's another cookie:

root.pfs
root.pfs.000 (possibly an index file)
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Amnesia: Memories [root.pfs] [Windows]

Post by aluigi »

http://aluigi.org/bms/amnesia_memories.bms

Both the files are archives so remember to use the script on both.
Delacroix
Posts: 65
Joined: Mon Dec 08, 2014 1:16 pm

Re: Amnesia: Memories [root.pfs] [Windows]

Post by Delacroix »

OK, I determined what root.pfs.000 actually is. It's a patch file.

This means that everything put there will take priority over root.pfs and therefore...

It is very possible to translate the game. However...

The specifics of quickBMS (files need to be either same size or smaller in order to be replaced) essentially prohibits from making a patch archive. Unless I am mistaken?

Is there a way to create a new pfs.000 archive from scratch using QuickBMS or do we need a program written to deal with this?

Translation of the game involves both text and image editing.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Amnesia: Memories [root.pfs] [Windows]

Post by aluigi »

Some fields are unknown so I can't make a rebuilder.
Anyway I don't like to make rebuilders in any case, I tried for Amnesia simply because the format is simple (for extraction) but without those missing fields it's useless.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Amnesia: Memories [root.pfs] [Windows]

Post by aluigi »

Anyway, in case you want to try but I'm sure it will not work:

Code: Select all

set KEY binary "\x28\x4B\xA5\xF9\x78\xF0\x3A\x99\x98\xA3\xCD\xC9\x92\xCF\x8C\xB8\x0D\x76\x3A\xE5"

log MEMORY_FILE 0 0
log MEMORY_FILE2 0 0

append

putdstring "pf8" 3 MEMORY_FILE
put 0 long MEMORY_FILE
put 0 long MEMORY_FILE
savepos BASE_OFF MEMORY_FILE
math BASE_OFF + 4
for i = 0
    scandir "." NAME SIZE
    if NAME == ""
        break
    endif
    string NAME <<= 2   # remove .\
    if NAME != "root.pfs.000"
        putarray 0 i NAME
        putarray 1 i SIZE
        strlen NAMESZ NAME
        xmath BASE_OFF "BASE_OFF + 4 + NAMESZ + 4 + 4 + 4"
        math i + 1
    endif
next
math FILES = i
for i = 0 < FILES
    getarray NAME 0 i
    getarray SIZE 1 i
    print "INPUT FILE: %NAME% %SIZE|x%"
    open "." NAME

    strlen NAMESZ NAME
    put NAMESZ long MEMORY_FILE
    putdstring NAME NAMESZ MEMORY_FILE
    put 0 long MEMORY_FILE
    savepos OFFSET MEMORY_FILE2
    math OFFSET + BASE_OFF
    put OFFSET long MEMORY_FILE
    put SIZE long MEMORY_FILE

    encryption xor KEY 0 20
    log MEMORY_FILE2 0 SIZE
    encryption "" ""
next i

put 0 long MEMORY_FILE

goto 3 MEMORY_FILE
get INFO_SIZE asize MEMORY_FILE
math INFO_SIZE - 7
put INFO_SIZE long MEMORY_FILE
put FILES long MEMORY_FILE

get SIZE asize MEMORY_FILE2
log MEMORY_FILE 0 SIZE MEMORY_FILE2

append

get SIZE asize MEMORY_FILE
log "root.pfs.000" 0 SIZE MEMORY_FILE

Usage:
quickbms script.bms "" folders_with_the_files

The file root.pfs.000 will be created in the same folder of the input files.
Delacroix
Posts: 65
Joined: Mon Dec 08, 2014 1:16 pm

Re: Amnesia: Memories [root.pfs] [Windows]

Post by Delacroix »

...

I shit you not, Luigi, you are awesome. I'll try it out impromptu and hit you back with the result!

EDIT: Result is that game runs in the background, its process taking up maybe 6 MB of memory and nothing is going on. I assume that this would still need some work.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Amnesia: Memories [root.pfs] [Windows]

Post by aluigi »

The only missing thing is the data between the information of the files and the data of the file, so just the part that is not clear yet.
Oh well, at least I tried :)
Delacroix
Posts: 65
Joined: Mon Dec 08, 2014 1:16 pm

Re: Amnesia: Memories [root.pfs] [Windows]

Post by Delacroix »

Yes, you did, and maybe either you or someone else will figure out the last part. I'm keeping my fingers crossed. :-)
Veshurik
Posts: 1
Joined: Sun Oct 29, 2017 2:34 pm

Re: Amnesia: Memories [root.pfs] [Windows]

Post by Veshurik »

Hello, guys! Found that topic on the Net.

I just interesting how I can extract the .pfs files.
I tried to use asmodean tool, but it doesn't help - nothing to extract.

I just want to extract files from demo version of Abnormal Lovers.

Thank you for the advice!
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Amnesia: Memories [root.pfs] [Windows]

Post by aluigi »

The problem of this pfs format is that without the algorithm that generates the key (since I guess they are generated in such way) then everytime it's necessary to "guess" the key in some way, something on which I'm no longer interested.

Anyway have you tried the following script?
http://aluigi.org/bms/norn9.bms

It implements a way to guess the key most of times, maybe you are lucky :)