(PS3) Max Payne 3 RPF File ?

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Scofield_TR
Posts: 99
Joined: Wed Dec 03, 2014 12:44 pm

(PS3) Max Payne 3 RPF File ?

Post by Scofield_TR »

I can not open this file.

Please can you help.

File: https://mega.co.nz/#!HdMRRT4Q!eKQNYAxVMeLujgrxroMAXSLu9D5oNmNU8FeAeu48MdM

Thank you in advance.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: (PS3) Max Payne 3 RPF File ?

Post by aluigi »

I think that the tool is OpenIV: http://openiv.com/
Scofield_TR
Posts: 99
Joined: Wed Dec 03, 2014 12:44 pm

Re: (PS3) Max Payne 3 RPF File ?

Post by Scofield_TR »

aluigi wrote:I think that the tool is OpenIV: http://openiv.com/


I can't open with this program. :(

Please help in this regard.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: (PS3) Max Payne 3 RPF File ?

Post by aluigi »

Best and simplest solution: contact the author of OpenIV.
michalss
Posts: 320
Joined: Sun Aug 10, 2014 12:49 pm

Re: (PS3) Max Payne 3 RPF File ?

Post by michalss »

Scofield_TR
Posts: 99
Joined: Wed Dec 03, 2014 12:44 pm

Re: (PS3) Max Payne 3 RPF File ?

Post by Scofield_TR »

aluigi wrote:Best and simplest solution: contact the author of OpenIV.


They do not help in this regard. :(
Scofield_TR
Posts: 99
Joined: Wed Dec 03, 2014 12:44 pm

Re: (PS3) Max Payne 3 RPF File ?

Post by Scofield_TR »

michalss wrote:try this : http://tmacdev.com/category/rpftool/


I tried. :(

But it does not.

Dude, please help.

Please examine.

http://rpftool.googlecode.com/svn/trunk/RPFTool/

[Keys]
RDR=B762DFB6E2B2C6DEAF722A32D2FB6F0C98A3217462C9C4EDADAA2ED0DDF92F10
MP3=95FC19EE3200C604A070FE8E6858DB768811A302110905A48D39EDAE4332545A
MC=AF7CD2E9FAAA45FD9728AC247DD0CE5ED6E4A182FFE241DB8FF0703B629C4785
barti
Posts: 34
Joined: Sun Nov 09, 2014 2:40 pm

Re: (PS3) Max Payne 3 RPF File ?

Post by barti »

OpenIV only supports the PC version, while RPFTool only supports Xbox 360 and PC.
There's no tool for PS3 RPF files, unfortunately.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: (PS3) Max Payne 3 RPF File ?

Post by aluigi »

Do you know why the PS3 files are not supported?
Keys, endianess, different format?
Just curious but I guess the reason is probably related to the keys.
Scofield_TR
Posts: 99
Joined: Wed Dec 03, 2014 12:44 pm

Re: (PS3) Max Payne 3 RPF File ?

Post by Scofield_TR »

aluigi wrote:Do you know why the PS3 files are not supported?
Keys, endianess, different format?
Just curious but I guess the reason is probably related to the keys.

Hi aluigi,

I do not understand much of this topic. :(

Please help me in this regard.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: (PS3) Max Payne 3 RPF File ?

Post by aluigi »

My questions were directed to barti or any other with more information about the tools and the format.
barti
Posts: 34
Joined: Sun Nov 09, 2014 2:40 pm

Re: (PS3) Max Payne 3 RPF File ?

Post by barti »

aluigi wrote:Do you know why the PS3 files are not supported?
Keys, endianess, different format?
Just curious but I guess the reason is probably related to the keys.


The creators of OpenIV have stated why they don't want to support consoles, something related to difficulty of modding and problems with retrieving the encryption key:
http://openiv.com/?p=667#more-667

While the creator of RPFTool didn't really specify a reason for it (except that he doesn't have time to work on the program now):
http://tmacdev.com/faq/

All I can help with this is that both PS3 and PC versions use RPF4. I don't have access to files from the Xbox version. File structure looks very similar, so I assume that keys are related to the problem.
Another possible reason why people don't bother with the PS3 versions is because Sony tends to use proprietary formats, compression and encryption as part of the EDGE SDK, so files from the 360 version are just easier to extract.
barti
Posts: 34
Joined: Sun Nov 09, 2014 2:40 pm

Re: (PS3) Max Payne 3 RPF File ?

Post by barti »

Accidental double post, please delete this.
Last edited by barti on Mon Jan 19, 2015 5:10 pm, edited 1 time in total.
michalss
Posts: 320
Joined: Sun Aug 10, 2014 12:49 pm

Re: (PS3) Max Payne 3 RPF File ?

Post by michalss »

Well interesting part with OpeniV is that they actually support console version of GTA V :) I like it but it is kind of strange..
michalss
Posts: 320
Joined: Sun Aug 10, 2014 12:49 pm

Re: (PS3) Max Payne 3 RPF File ?

Post by michalss »

aluigi wrote:My questions were directed to barti or any other with more information about the tools and the format.



I dont know anything about format to be hones, but there is planty of tools with sources in c# to work with... :) however im very bad with encrypted formats :( so i cannot really help in this matter
Scofield_TR
Posts: 99
Joined: Wed Dec 03, 2014 12:44 pm

Re: (PS3) Max Payne 3 RPF File ?

Post by Scofield_TR »

Anything in this regard cannot be. Do you ? :(
montcer9012
Posts: 3
Joined: Thu Sep 13, 2018 1:07 am

Re: (PS3) Max Payne 3 RPF File ?

Post by montcer9012 »

Hello nice people from ZenHax.

Come here to request help with Max Payne 3 for the PS3.
So, I were searching for a tool to open some .RPF files from the game, but can't find one that does this for the PS3 version.
No, OpenIV does not supports the console version. And yes, I have requested help in their forums.

The far I got was this thread in Xentax were a friendly dude was helping a person. I did contacted him, but my knowdledge with Hex editors and basic coding is null :(
He has a tool repository in GitHUB which I am trying to build, but as I wrote this, MS Visual Studio download has not finish. If someone knows a faster way to build his tool, please share it!

Also, I am not sure if his tool will allow to inject custom files within the game PS3 RPF files, which is my first intention. Hopes for the best :D

So, my action log looks like this:
1. Find a tool that will open/modify/inject custom files into Max Payne 3 .RPF files for the PS3. [IN PROGRESS]
2. Decrypt "common.sdat". [DONE] I did use TrueAncestor Edat Rebuilder v1.65. I have my PS3 IDPS, my act.dat and the game .rap file so it was a piece of cake.
3. Obtain the RPF file key in order to decrypt it. According to this post, as per my understanding, what I need to do is:
A. Decrypt the game original EBOOT.BIN file in order to obtain the .ELF. [DONE] I did use TrueAncestor_SELF_Resigner_v1.98. Plus, I have my PS3 IDPS, my act.dat and the game .rap file. Piece of cake.
B. Once we have the .ELF file, use IDA Hex Rays to locate the key at 0x014C6CA4. [WHAT?] I do totally need help on this step. I did open the .ELF file with that program, but it starts asking me details in order to open the file, like which kind of file it is, PowerPC, 64, 32 or 16 bits, and then to mark the entry point (?). Don't know how to get that key :(

OPTIONAL:
If I manage to build twisted RPFTool, then I need:
1. To get the RPF decrypt key for the PS3.
2. Place it inside Keys.ini in the RPFTOOL folder.
3. Hope for the best that this toold will allow me to modify the .rpf files and not just see their content.

So, that's it.
I could really appreciate on this!
montcer9012
Posts: 3
Joined: Thu Sep 13, 2018 1:07 am

Re: (PS3) Max Payne 3 RPF File ?

Post by montcer9012 »

Hello.

I still struggling to build the RPF tool by twisted. It seems that I have to use the very same version of Visual Studio were the code was written on.

Regarding the key to work with the RPF4 files from Max Payne in the PS3, I have already:
1. Decrypted common.dat, which is common.rpf now, and starts like this:

Code: Select all

52 50 46 34 00 50 06 00 4F 2A 00 00 00 00 00 00 FE FF FF FF 00 00 00 00

The four first bytes, seems to mean RPF4, according to the HEX editor.

2. Decrypted EBOOT.BIN, so now I have EBOOT.ELF. According to twisted in this post in Xentax, the key is located at 0x014C6CA4, but that address should be from another file, as that one in EBOOT.ELF takes me to here:
Image

So, I was thinking to write a script for QuickBMS, but if I manage to compile the RPF tool then I won't need to. Regardless, I am not sure if that tool will allow me to modify the RPF files :(

Can someone please tell me where to look for the key?
montcer9012
Posts: 3
Joined: Thu Sep 13, 2018 1:07 am

Re: (PS3) Max Payne 3 RPF File ?

Post by montcer9012 »

So, I managed to build the tool and find the key (with help, obviously) and now I am a happy modder of Max Payne for the PS3.

However, I now find that the game levels are written with script files, wrapped inside some .SCO files (which are inside a .rpf file as well).
There is a discord channel where some user posted the already decompiled scripts, however, no one there provided a tool to open/mod the .SCO files in case you want to mod those.

I find this tool named SCO Tool Box, that works with GTA IV and its expansion for the PC version. From the SCO Tool Box source code, the keys are located here:

Code: Select all

                RegistryKey key;
                if ((key = Registry.LocalMachine.OpenSubKey(Key32)) != null ||
                    (key = Registry.LocalMachine.OpenSubKey(Key64)) != null)
                {
                    dir = key.GetValue(ValueName).ToString();
                    exe = "GTAIV.exe";
                }

                if ((key = Registry.LocalMachine.OpenSubKey(Key32E)) != null ||
                    (key = Registry.LocalMachine.OpenSubKey(Key64E)) != null)
                {
                    dir = key.GetValue(ValueName).ToString();
                    exe = "EFLC.exe";
                }
            }

            return FindKey(dir, exe);

            } catch { return null; }
        }

        private static byte[] FindKey(string gtaPath, string gtaExe)
        {
            gtaExe = Path.Combine(gtaPath, gtaExe);

            try {
                uint[] searchOffsets = {
                                       //EFIGS EXEs
                                       0xA94204 /* 1.0 */,
                                       0xB607C4 /* 1.0.1 */,
                                       0xB56BC4 /* 1.0.2 */,
                                       0xB75C9C /* 1.0.3 */,
                                       0xB7AEF4 /* 1.0.4 */,
                                        0xBE1370 /* 1.0.4r2 */,
                                        0xBE6540 /* 1.0.6 */,
                                       0xBE7540 /* 1.0.7 */,
                                       //Russian EXEs
                                       0xB5B65C /* 1.0.0.1 */,
                                       0xB569F4 /* 1.0.1.1 */,
                                       0xB76CB4 /* 1.0.2.1 */,
                                       0xB7AEFC /* 1.0.3.1 */,
                                       //Japan EXEs
                                        0xB8813C /* 1.0.1.2 */,
                                        0xB8C38C /* 1.0.2.2 */,
                                     0xBE6510 /* 1.0.5.2 */,
                                     //EFLC
                                       0xBEF028 /* 1.1.2 */,
                                       0xC705E0 /* 1.1.1 */,
                                       0xC6DEEC /* 1.1.0 */,
                                   };
                const string validHash = "DEA375EF1E6EF2223A1221C2C575C47BF17EFA5E";
                byte[] key = null;

                var fs = new FileStream(gtaExe, FileMode.Open, FileAccess.Read);

                foreach (var u in searchOffsets)
                {
                    if (u <= fs.Length - 32)
                    {
                        var tempKey = new byte[32];
                        fs.Seek(u, SeekOrigin.Begin);
                        fs.Read(tempKey, 0, 32);

                        var hash = BitConverter.ToString(SHA1.Create().ComputeHash(tempKey)).Replace("-", "");
                        if (hash == validHash)
                        {
                            key = tempKey;
                            break;
                        }
                    }
                }


So, I am working Max Payne 3 for the PS3, again how can I locate the key for the .SCO files!? Thanks in advance.