Editing custom file formats
-
Hello! I have a problem, and nobody seems to know the remedy... There are a lot of programmes capable of editing (doing various things) custom file formats, for example game editors. For instance, there is a fifaFS console application which gives the oppurtunity of editing .big graphic archives of FIFA 2005 from EA Sports. You can pack, unpack files, rebuild etc. So how did the creator manage to write such software? I mean, there is nothing in Delphi capable of editing .big files (it's written in Deplhi, but I am a C# programmer so I want to know how to do it in C#)... So how?! I heard that you need to know the structure of the file... Ok, so for example I have the file specification of BMP file format. But how do I do stuff with it? Please explain! And please give some piece of code... I really need your help! Please don't tell me that .big is a commercial file format owned by EA, so there's no chance of editing it. I know at least 20 programmes capable of editing .big file. Thanks! Regards, Lars
-
Hello! I have a problem, and nobody seems to know the remedy... There are a lot of programmes capable of editing (doing various things) custom file formats, for example game editors. For instance, there is a fifaFS console application which gives the oppurtunity of editing .big graphic archives of FIFA 2005 from EA Sports. You can pack, unpack files, rebuild etc. So how did the creator manage to write such software? I mean, there is nothing in Delphi capable of editing .big files (it's written in Deplhi, but I am a C# programmer so I want to know how to do it in C#)... So how?! I heard that you need to know the structure of the file... Ok, so for example I have the file specification of BMP file format. But how do I do stuff with it? Please explain! And please give some piece of code... I really need your help! Please don't tell me that .big is a commercial file format owned by EA, so there's no chance of editing it. I know at least 20 programmes capable of editing .big file. Thanks! Regards, Lars
I dont htink there is anything magical with this file format. I think its just something where several files are packed into a single file. At the beginning of those files one can clearly the the contents. You could just dig through one sample file and try to findout yourself how exactly it works. You could also contact someone from one of those 20 programs and ask him if he has any infos conecrning the exact format. So it doesnt have to do anything with the programming language uyou use, but with the knwoledge you have of the format. If you know it a simple stream is enough to unpack the contents.
-
I dont htink there is anything magical with this file format. I think its just something where several files are packed into a single file. At the beginning of those files one can clearly the the contents. You could just dig through one sample file and try to findout yourself how exactly it works. You could also contact someone from one of those 20 programs and ask him if he has any infos conecrning the exact format. So it doesnt have to do anything with the programming language uyou use, but with the knwoledge you have of the format. If you know it a simple stream is enough to unpack the contents.
Yeah, well, thanks, but I am kind of a begginer... So could anyone please give an example code for the available BMP file format, just to demonstrate the technique? Please! The BMP specification is here: http://www.dcs.ed.ac.uk/home/mxr/gfx/2d/BMP.txt Or just type 'File formats' in Google, then check out the first site. Choose whichever file you like, and please help me! Thanks!
-
Yeah, well, thanks, but I am kind of a begginer... So could anyone please give an example code for the available BMP file format, just to demonstrate the technique? Please! The BMP specification is here: http://www.dcs.ed.ac.uk/home/mxr/gfx/2d/BMP.txt Or just type 'File formats' in Google, then check out the first site. Choose whichever file you like, and please help me! Thanks!
It won't help much if someone shows you how to read file format A (for example, BMP) if you want to modify file format B. When you get down to it, each file is just a bunch of bytes you can read or write (check
BinaryReader
orBinaryWriter
in the FCL, for example). But unless you get the specification _what_ the bytes at a certain offset mean, you're out of luck. You might be able to scan for certain byte patterns, but usually when you try to modify a file without knowing the exact structure you'll end up with a corrupt file. Once you have the structure you can write classes that read or write the correct files, but not any sooner. mav -
It won't help much if someone shows you how to read file format A (for example, BMP) if you want to modify file format B. When you get down to it, each file is just a bunch of bytes you can read or write (check
BinaryReader
orBinaryWriter
in the FCL, for example). But unless you get the specification _what_ the bytes at a certain offset mean, you're out of luck. You might be able to scan for certain byte patterns, but usually when you try to modify a file without knowing the exact structure you'll end up with a corrupt file. Once you have the structure you can write classes that read or write the correct files, but not any sooner. mavOk, thanks! But you didn't get it: I don't want to edit those .big files, I just stated them as an example. I just want to understand how does one edit some file format. And I wanted some simple code about working with those bytes...
-
Ok, thanks! But you didn't get it: I don't want to edit those .big files, I just stated them as an example. I just want to understand how does one edit some file format. And I wanted some simple code about working with those bytes...
Editing the file format meaning understanding exactly what each byte in the format means. There is no one method for editing every file format. You read the file stream in, parse it up based on the rules for the file format, edit it based on the rules of the file format, and then write it back out. Are you asking how to read a file? How to parse up the data? or what? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome