View unanswered posts | View active topics It is currently Wed Sep 08, 2010 7:47 pm

Forum rules


You should only expect us to help if your hack/mod request can be done by using some king of universal modding tool.



Post new topic Reply to topic  [ 31 posts ]  Go to page Previous  1, 2, 3  Next
MHPB PKR files 
Author Message

Joined: Tue Aug 04, 2009 12:50 am
Posts: 486
Location: FL - USA
Post Re: MHPB PKR files
Could you upload the MHPB .pkr file I'll have a look and see what i can do when i have a chance.

_________________
Image


Sun Jul 25, 2010 6:37 pm
Profile

Joined: Sat May 01, 2010 5:57 pm
Posts: 34
Post Re: MHPB PKR files
Here is the Mat Hoffman Data.prk:

http://www.megaupload.com/?d=WUBEJVSU


Sat Aug 21, 2010 6:42 pm
Profile

Joined: Sat May 01, 2010 5:57 pm
Posts: 34
Post Re: MHPB PKR files
PKR files are packed extremely well, but I looked into the PS1 Version of Mat Hoffman's "BMXCD.WAD" and found a couple interesting things. There is no working wad extractor for this game, one existed long ago but there is no download for it anywhere at this moment. I found with a hex editor on this wad.

Levels:
the Treatment Plant.Burnside.Downtown.the School.the Warehouse.Competition Level 3.CFB Competition 2.Bluetorch Competition 1.La Habra.the Movie Set.the Park in New York City.the Construction Yard.the London Underground.chal_1.bmp.load_b01.bmp.Factory.Lights Smashed.Hoffman Bike.Bkfact_T.facility

Warehouse and Burnside from THPS1 are in the game (you can unlock them via cheats or completing career or scoring high combos) but "School and The Movie Set" look like some random stuff.


Sun Aug 22, 2010 4:17 am
Profile

Joined: Tue Aug 04, 2009 12:50 am
Posts: 486
Location: FL - USA
Post Re: MHPB PKR files
Here's what I found out about the .pkr file structure when i briefly looked into it...

Mat Hoffman .pkr files-
------------------------------------------------------------------------------------------
4 byte = PKR3
4 byte = offset to the Directory Listing Header
Then starts file data

Directory Listing Header:
------------------------------------------------------------------------------------------
12 bytes total
4 bytes - unknown 04000000
4 bytes - total number of directories
4 bytes - total number of files

Directory Listing Structure:
------------------------------------------------------------------------------------------
40 bytes total each directory list entry.
32 bytes - string: directory name
4 bytes - count of the total files
4 bytes - number of files in the directory

File Listing Structure:
------------------------------------------------------------------------------------------
52 bytes total each file list entry
32 bytes - string: file name
4 bytes - unknown key of some sort | maybe a crc of the file data
4 bytes - unknown value either FFFFFFFF (.wav, .bik, .log files) or 02000000 (same as THPS2)
4 bytes - offset to the file data
4 bytes - uncompressed file size
4 bytes - compressed file size

_________________
Image


Last edited by WhoElseButMe on Mon Aug 23, 2010 6:18 am, edited 1 time in total.



Sun Aug 22, 2010 4:38 am
Profile

Joined: Sat May 01, 2010 5:57 pm
Posts: 34
Post Re: MHPB PKR files
Thanks for the information, is the anything further that you think you'll do?


Sun Aug 22, 2010 7:39 am
Profile

Joined: Tue Aug 04, 2009 12:50 am
Posts: 486
Location: FL - USA
Post Re: MHPB PKR files
Well, modifying the file seems pretty straight forward since the directory/file list is at the bottom of the .pkr file and doesn't use offsets to point to the file list, it uses 1 offset to point to the directory header and then uses math to find the files list entry which contains the offset to the actual file data.
Example:
Default directory header location (decimal) = 239592516 + 12 (to first directory) = 239592528 <- directory list offset
has 33 default directories, 33 x 40 = 1320
239592528 + 1320 = 239593848 <- file list offset
Obviously we would get the number of directories/files and perform our math on these retrieved variables instead of using defaults.

In my other post I noted that at each directories list data it keeps a count of the total files
If we know where the file list starts by doing basic math against known variables, finding the files for a directory would be just as simple.
Example:
directory list entry 1's index = 0
Say we want to get the files for directory 4, 40 x 3 = 120 | directory list offset + 120 = the start of directory 4's data.
Directory Name: data\audio\constrct\
file count - hex: 27000000 | decimal: 39
files in current directory - hex: 07000000 | decimal: 7
39 x 52 (file list data bytes) = 2028
239593848 (file list offset) + 2028 = 239595876 <- offset to the first file for directory 4
then you loop through retrieving the file list data you need, such as actual offsets to the file data.

Now I have a point here. Say you want to add a new directory and a new file to that directory you would simply add the new directory to the bottom of the directory list, adding 1 to the count, add your file data to the bottom of the file list, where its file data offset will equal the directory list header location. Lastly you change the offset pointer to the directory list header the number of bytes your added file equals.
Say you just wanted to add a file to a current directory you would perform the basic math outlined above to find the current location in the file list adding your new entry, then you would add 1 to the number of files in the current directory and 1to the file count of each directory starting with the current directory working your way to the end of the max number of directories. Same rules would apply for adding the file itself and changing the directory list header offset.

Simple enough? Anyone with any questions, comments, concerns feel free to post.

_________________
Image


Sun Aug 22, 2010 8:54 am
Profile

Joined: Sat May 01, 2010 5:57 pm
Posts: 34
Post Re: MHPB PKR files
Maybe I'm too noobish to understand it really, but I am appriciative of your work. :)


Tue Aug 24, 2010 5:07 am
Profile

Joined: Tue Aug 04, 2009 12:50 am
Posts: 486
Location: FL - USA
Post Re: MHPB PKR files
Its really quite simple maybe I didn't explain it very well, sleep deprivation tends to do that.
Anyways I had some spare time and started working on a tool to handle these PKR files
Here's a piece of the code that retrieves basic variables as the file is loaded that can be called on later
Maybe this will clear up how to retrieve data offsets within the PKR file.
written using M$ Fundamental Class
Code:
{
   CString m_strFileName;
   CFileDialog openDlg (TRUE, _T("pkr"), _T("*.pkr"),
   OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, _T("PKR Data Files (*.pkr)|*.pkr|"));
   openDlg.m_ofn.lpstrTitle = _T("PKR Data Files");
   if (openDlg.DoModal() == IDOK) {
      if (openDlg.GetFileName()) {
         m_strFileName = openDlg.GetFileName();
         SetDlgItemText(IDC_PKR_EDIT, m_strFileName);
      }
   }
   CFile file;
   int *pkrData = new int[4];         // first 4 bytes of the file, indicates pkr file type
   int *listOffset = new int[4];      // offset to the directory/file list header data
   int *headDataUnknown = new int[4];   // first 4 bytes of the header data, should be 04000000 for PKR3
   int *headDataNumDirs = new int[4];   // number of directories
   int *headDataNumFiles = new int[4];   // number of files

   if (file.Open(m_strFileName, CFile::modeReadWrite | CFile::typeBinary)) {
      file.Seek(0, NULL);
      file.Read(pkrData, 4);
      CString pkrType;
      pkrType.Format(_T("%X"), pkrData[0]);
      if (pkrType == _T("33524B50")) {
         SetDlgItemText(IDC_LOAD_STATIC, _T("PKR3: Mat Hoffman's Pro BMX"));
         // retrieve list header offset
         file.Read(listOffset, 4);
         ListHeaderOffset = listOffset[0];   // stores list header offset
         // read list header data & retrieve variable data to store
         file.Seek((LONGLONG)ListHeaderOffset, NULL);
         file.Read(headDataUnknown, 4);
         file.Read(headDataNumDirs, 4);
         NumDirs = headDataNumDirs[0];   // stores total number of directories
         file.Read(headDataNumFiles, 4);
         NumFiles = headDataNumFiles[0];   // stores total number of files
         DirListOffset = file.GetPosition();   // stores directory list offset
         int bytesTFL = (NumDirs * 40);
         FileListOffset = (DirListOffset + bytesTFL);   // stores file list offset
         
         OnFillDirList();
         
         m_strNotice.Format(_T(" File Data| ListHeaderOffset: %08X | DirectoryListOffset: %08X | #Directories: %i | FileListOffset: %08X | #Files: %i "), ListHeaderOffset, DirListOffset, NumDirs, FileListOffset, NumFiles);
         SetDlgItemText(IDC_STATIC_NOTICE, m_strNotice);
         CString dirGroup;
         dirGroup.Format(_T("Directory List - %i"), NumDirs);
         SetDlgItemText(IDC_DIR_GROUP, dirGroup);
      } else if (pkrType == _T("32524B50")) {
         SetDlgItemText(IDC_LOAD_STATIC, _T("PKR2: Tony Hawk's Pro Skater 2"));
      } else {
         SetDlgItemText(IDC_LOAD_STATIC, _T("PKR file unsupported"));
      }
   } else {
      SetDlgItemText(IDC_STATIC_NOTICE, _T(" Unable to open file for reading"));
      SetDlgItemText(IDC_LOAD_STATIC, _T("Load PKR File"));
   }
}

_________________
Image


Tue Aug 24, 2010 8:24 am
Profile

Joined: Sat May 01, 2010 5:57 pm
Posts: 34
Post Re: MHPB PKR files
Seems great! I understand everything to a basic level. I'm just surprised someone would actually put in the time to make a tool for such obscure games, particularly Mat Hoffman. It is also really nice that you included THPS2 support. :clap:

When you do get it to work, it will be nice to look around and see how this game functions. I'm assuming there will be a lot of THPS1/2 leftovers. On various cheat websites there is a cheat code for School for THPS1, but when it is entered on the pause screen, nothing is unlocked. I'm sure there will be some interesting stuff in here.

I'm assuming you have the game at this point? There is network play for two players!


Tue Aug 24, 2010 6:58 pm
Profile
User avatar

Joined: Wed Jul 08, 2009 10:07 am
Posts: 437
Location: Germany
Post Re: MHPB PKR files
I don't want to make a new thread about it so i'll ask here :
Would it be possible to convert the MHPB files to THPS2 ?
It's based on the same engine so it could be possible right?

_________________
Image


Tue Aug 24, 2010 9:24 pm
Profile ICQ

Joined: Tue Aug 04, 2009 12:50 am
Posts: 486
Location: FL - USA
Post Re: MHPB PKR files
@quazz
I do have the game but I've only installed it and not actually run it yet.
Also the little bit of work I put into this didn't take that long, I've been busy all day today so I haven't had time to work on it but as of right now the application does these tasks (only MHPB right now)...
When the user selects the pkr file to load it retrieves specific offsets that are used to perform look ups later.
It then walks the directory list in the pkr file and adds each entry to the apps directory list.
If the user selects a directory it then calculates where that directories files are within the file list and walks the file list in the pkr file and adds each entry (the number of files for the selected directory) to the apps file list.
Also, if the user selects a file it adds some retrieved variables to the GUI but doesn't actually display any file data yet.

Active wrote:
I don't want to make a new thread about it so i'll ask here :
Would it be possible to convert the MHPB files to THPS2 ?
It's based on the same engine so it could be possible right?

Those older games use standardized files like .txt .wav .bmp so it wouldn't be impossible but it might be a challenge.
The difference in the PKR files between THPS2 and MHPB are the format of the file and possibly the compression routine, however, if the file was completely decompressed the files themselves would be fine. Can't say the pkr itself would work though.

_________________
Image


Wed Aug 25, 2010 12:23 am
Profile

Joined: Tue Aug 04, 2009 12:50 am
Posts: 486
Location: FL - USA
Post Re: MHPB PKR files
Here's a preview image of the app, I meant to post this earlier but I got wrapped up in some things.

Image

_________________
Image


Wed Aug 25, 2010 6:25 am
Profile

Joined: Sat May 01, 2010 5:57 pm
Posts: 34
Post Re: MHPB PKR files
Looks great! AND I WAS RIGHT ABOUT THE "MOVIESET" LEVEL! I can't believe it!

Great work man, can't wait until it is released. (y)


Wed Aug 25, 2010 7:56 am
Profile

Joined: Tue Aug 04, 2009 12:50 am
Posts: 486
Location: FL - USA
Post Re: MHPB PKR files
I haven't had very much time to work on this tool I've been really busy lately, however, I thought I'd update that adding directories and adding file entries is working flawlessly. Next I need to implement an import feature to insure files can be added successfully. Until I can workout offset correcting, importing over an existing file larger than its existing size, will not be possible. But renaming the current file and adding a new file that files original name should work fine. I still need to work out the de/compression routine as well as file preview. Not a whole lot of progress, I know, but maybe in a few days I can find the time to put in some work on this tool.

_________________
Image


Fri Aug 27, 2010 2:54 am
Profile

Joined: Sat Mar 20, 2010 6:24 pm
Posts: 28
Post Re: MHPB PKR files
sorry that i didnt uploaded the PKR files
is there an repkr syntax to import files to an pkr?


Sun Aug 29, 2010 2:59 pm
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 31 posts ]  Go to page Previous  1, 2, 3  Next


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.