News: 11 March 2016 - Forum Rules

Author Topic: How to make a program to Extract / Repack files like BIOFAT ?  (Read 7859 times)

TBartoli

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
How to make a program to Extract / Repack files like BIOFAT ?
« on: December 09, 2013, 10:54:06 am »
Hi there  :)

i am a game modifier and i need to Extract / Repack some files to make modifications, but the problem is that i need to make an Extractor / Repacker program to make it.

A program like BIOFAT, made by MarkGrass for Resident Evil.


So, i already made the program with Multimedia Fusion 2, but now i need to make scripts for Extract / Repack and add these scripts to the program.

Is anyone can help me by anychance  :angel: ?

Thanks  :)

Zoinkity

  • Hero Member
  • *****
  • Posts: 565
    • View Profile
Re: How to make a program to Extract / Repack files like BIOFAT ?
« Reply #1 on: December 09, 2013, 04:10:55 pm »
Before anyone can help you they're going to need to know what game and platform you're working with. 

It's a bit of an oversimplification, but you can pretty much assume every single game is different from every other, and yes, there's a decent chance they'll have changed internal storage slightly between platforms.  So, extraction scripts are pretty much on a game-by-game basis.
(Just assuming you're aiming for something similar to BIOFAT but for a different game.)

Gemini

  • Hero Member
  • *****
  • Posts: 2026
  • 時を越えよう、そして彼女の元に戻ろう
    • View Profile
    • Apple of Eden
Re: How to make a program to Extract / Repack files like BIOFAT ?
« Reply #2 on: December 09, 2013, 05:56:49 pm »
If you're aiming for something visually similar to BioFAT, try straight WinAPI since that's what Mark uses with Visual C++ 2010 Express. At worst you'll have only to feed a bunch of menu IDs to the Windows message loop, with your unpacking code doing everything in background (i.e. objects to handle things in a simplified manner you can later apply to other programming styles).
I am the lord, you all know my name, now. I got it all: cash, money, and fame.

TBartoli

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: How to make a program to Extract / Repack files like BIOFAT ?
« Reply #3 on: December 10, 2013, 04:50:47 am »
Thank you for your answers  :)

Zoinkity
I want learn to create a program like BIOFAT for Resident Evil 1 PC, it's for practice, for exemple :
Extract / Repack EMD (Model) files at least.

Gemini
I made the exactly same program that BIOFAT with Multimedia Fusion 2, but i don't know if Multimedia Fusion 2 allow to add script to it (menu).

I have Visual C++ 2010 Express, but where i can download WinAPI ?

Here is the tools i have:

Cheat Engine
Hexwork Shop
IDA Pro

But i don't really know the Assembling language.
« Last Edit: December 10, 2013, 04:58:21 am by TBartoli »

Gemini

  • Hero Member
  • *****
  • Posts: 2026
  • 時を越えよう、そして彼女の元に戻ろう
    • View Profile
    • Apple of Eden
Re: How to make a program to Extract / Repack files like BIOFAT ?
« Reply #4 on: December 10, 2013, 05:17:41 am »
You don't really download the WinAPI, it's part of the libraries embedded with the development environment itself (not to mention it's just Windows itself being directly referred by the code). Create a Win32 project and you have exactly what you need to develop a BioFAT clone.
I am the lord, you all know my name, now. I got it all: cash, money, and fame.

TBartoli

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: How to make a program to Extract / Repack files like BIOFAT ?
« Reply #5 on: December 10, 2013, 05:43:03 am »
Gemini
Thank you for these informations  :)

It's Mark Grass itself who told you what he used for create BIOFAT (WinAPI / Visual C++ 2010 Express.) ?

And what is the next ? What is the process to make the Extract / Repack script ? for exemple EMD file from Resident Evil 1.
« Last Edit: December 10, 2013, 07:18:22 am by TBartoli »

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: How to make a program to Extract / Repack files like BIOFAT ?
« Reply #6 on: December 10, 2013, 06:50:12 am »
The first step is always to reverse engineer the file formats so that you can read the data. You better get used to working with octet streams quickly, because file formats are rarely text based.

TBartoli

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: How to make a program to Extract / Repack files like BIOFAT ?
« Reply #7 on: December 10, 2013, 07:28:59 am »
henke37
Quote
You better get used to working with octet streams quickly, because file formats are rarely text based.

I work often with Cheat Engine and Hex Workshop,
So the numbers, octets, bits, I know ;).

So, what software i must use to analyse EMD format to start reverse engineer ? :)
And when the file is opened, what i need to look ?

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: How to make a program to Extract / Repack files like BIOFAT ?
« Reply #8 on: December 10, 2013, 08:32:38 am »
There is no required software. It all depends on how you want to go about it. Most people start with a hex editor.

As for "what i need to look ?", there is no answer. The file contents can be any data in any structure encoded in any format. You must figure it out yourself. In the worst case you will need to reverse engineer the parser that the game itself uses.

TBartoli

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: How to make a program to Extract / Repack files like BIOFAT ?
« Reply #9 on: December 10, 2013, 09:46:43 am »
Okay,

thanks for all these informations  ;).

I will try.

MeganGrass

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
    • GitHub
Re: How to make a program to Extract / Repack files like BIOFAT ?
« Reply #10 on: December 10, 2013, 03:26:35 pm »
Well, first I would suggest downloading a stable version of biofat, for reference (download).

I'm not familiar with Multimedia Fusion 2 and use WinAPI, as Gemini suggested. WinAPI is simple to utilize, compact/doesn't produce bloated executables, very-well documented at Microsoft websites and compatible with all versions of Windows.

That said, a few pointers and examples:

As henke37 suggested, you'll need to know how the file is handled. Because you stated that you don't know r3000 dis/assembly, I'd suggest looking at the file in hex.

For the EMD archive file, the index (a list of file pointers) is located at the EOF (end of file), like so:

00000000 00000000 000032AC 00003584 00009ABC

The dummy entries (zeroes) represent just that - dummy data - meaning that slot is empty/blank. Judging the list above, it is shown there are 5 files located in an EMD archive, where each value is an absolute pointer to each data.

Obviously, there isn't a 'filesize list', so you'll have to manually calculate the sizes for each file, yourself. Hopefully, I shouldn't have to explain how to accomplish that. ;P

Once you have created your function to handle the EMD filetype, the next step is getting your menu to work, which I will only touch upon. For reference, you'll have to look into something called 'resource' - a simple tool such as 'Resource Hacker' should help.

This is my simple setup for menu IDs, running in the Windows loop (WndProc() function), under the WM_COMMAND message:

Code: [Select]
case BIO1_DIS_EMD:
szFileName = GetFileName("EMD", "Bio Hazard File (*.EMD)\0*.EMD\0\0");
Bio1->DisArchive(szFileName);
break;

BIO1_DIS_EMD is the menu ID, located in resource and 'activate' only when the user selects the appropriate option from the menu.

The GetFileName() function is a simple frontend, of sorts, for Microsoft's GetOpenFileName() function that uses a dialog window to select any given name of a file.

Bio1 is a class for the "Bio Hazard / Resident Evil" game, where DisArchive() is the actual function that handles the file (extracts all contents from an EMD archive).



Beyond that, there's not much else that I can help you with, as I haven't the time to teach programming skills. I hope that helps. :)

Create a Win32 project and you have exactly what you need to develop a BioFAT clone.

Ironic, because the classes I've created are part of something of a whole, which I call "BioClone".

TBartoli

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: How to make a program to Extract / Repack files like BIOFAT ?
« Reply #11 on: December 11, 2013, 06:20:51 am »
Wow, Mark Grass itself who answer me, i can't have better :angel:

Well, i read your words a first time, and...
I don't understand anything x), but it's normal the first time, i will copy your text in a text editor as "Golden Instructions"  ;).

I have a question for you, how many time you need to make EMD Extractor / Repacker ?

Anyway,

Thank you so much. :thumbsup:

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: How to make a program to Extract / Repack files like BIOFAT ?
« Reply #12 on: December 11, 2013, 10:23:08 am »
You just need to write the code one time.