How to make a program to Extract / Repack files like BIOFAT ?

Started by TBartoli, December 09, 2013, 10:54:06 AM

Previous topic - Next topic


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  :)


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.)


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).


Thank you for your answers  :)

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.

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

But i don't really know the Assembling language.


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.


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.


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.


QuoteYou 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 ?


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.



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:

case BIO1_DIS_EMD:
szFileName = GetFileName("EMD", "Bio Hazard File (*.EMD)\0*.EMD\0\0");

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. :)

Quote from: Gemini on December 10, 2013, 05:17:41 AMCreate 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".


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 ?


Thank you so much. :thumbsup: