Sign in to follow this  
Legion303

Corrupt FL file? No problem! (ONLY FOR DAMAGED HEADERS)

41 posts in this topic

READ THIS FIRST:

If you came here from a google search on corrupt FL files and couldn't be bothered to read the entire thread, at least read this part: I WILL NOT FIX YOUR FILE FOR YOU. STOP ASKING. YOU MORON.

Now back to our regularly scheduled post.

EDIT: Steve Laboy has come up with a more elegant and (more importantly) easier way to fix corrupted files here: http://www.ocremix.org/forums/showpost.php?p=245629&postcount=32

If that doesn't work for you and you don't mind getting your hands dirty, continue:

After working on a remix for about 30 hours, I tried to load a VST effect which crashed FL Studio right after a save. I hit save again (FL was still running, it just stopped making sound) to be sure everything would be OK, and closed the program. When I restarted and tried to load my song I got this:

"An error occured while reading the FLP file. It may be corrupted, or some plugin caused an error while opening."

Long story short, it was a corrupt file (verified by trying to open the FLP on another computer). A google search found nothing other than forum messages like "you're fucked. Start over."

But it turns out every FLP file has this in the first 32 bytes of its header:


46 4C 68 64 06 00 00 00 00 00 04 00 60 00 46 4C
64 74 B1 77 00 00 C7 06 35 2E 30 2E 31 00 C8 10

The text side looks like this:

FLhd........`.FL
dt±w..Ç.5.0.1.È.

The first line is exactly the same in every FLP I looked at. The second line is similar, but the last half contains the FL Studio version number (5.01 in my case, as seen on the second text line above). Additionally, the first two bytes of the second line (64 74; bytes 17 and 18 of the header) are exactly the same in all files, but the third and fourth (B1 77 above) are not consistent even in files saved from the same version of FL. My corrupt file had nulls in the 19th and 20th bytes of its header, so I overwrote them with data from another FLP header.

Edit: it turns out those two bytes are a pointer to an address 22 bytes from the end of the file, consistent among all files I looked at. I believe this is due to the really sloppy way FL handles files...instead of putting a pointer to various sections (i.e., "go to this address for instrument data; this one for pattern info; etc.), FL just crams information in and the program has to scan for headers to find various sections. With such small files it works, I guess, it's just weird. So what happened in my case was that the pointer to the "end" of the file was really pointing to the very first byte, before the start of data. I imagine that confused FL. :)

Edit 2: to get the correct pointer address (see Edit 1), look at the end of the file. There should be several repetitions of "1\" with other characters (if not, the end of your file is hosed and this probably won't work). Look at the last byte of your file. That's byte #1 for our purposes. Let's say the end of your file looks like this:


0000a150h: 00 00 81 1F 00 31 5C 44 00 00 00 00 00 00 82 1F ; ..?..1\D......‚.
0000a160h: 00 31 5C 44 00 00 85 04 01 00 00 ; .1\D..…....

Starting with the last byte and counting backwards, find byte #22 from the end of the file. In the example, that's the "31" in the first line. This is where you need to point. Now look at the address of that line: 0000a150h (the "h" stands for Hexadecimal). The byte "31" occurs in the fifth position of that line (counting bytes from the left, like so):


0 1 2 3 4 5
00 00 81 1F 00 31

Note that there are 16 bytes per line, and this is in hex, so if the byte you're interested in happens to be the last one on a line, its "number" is F.

OK. "31" is byte 5 on that line. Add that to the line's address to get 0000a155. The last four characters (representing two bytes) are the address we want: A1 55. I don't remember my assembly programming enough to recall why, but these need to be reversed for pointer purposes (EDIT 3: it's because Little-endian systems (e.g. microcomputers) store the least-significant byte of addresses first in memory). So now we have the byte string "55 A1". Go back to the top of the file. The second line (which is always address 00000010h) Must begin with "64 74" on the left (corresponding to "dt" on the text side). The next two bytes are the address pointer you just got. Overwrite whatever two bytes come after "64 74" to get "64 74 55 A1" as the first four bytes of the second line in the file. Congratulations. If it still doesn't work, you're fucked. Start over. :)

BEFORE:

46 4C 68 64 06 00 00 00 00 00 04 00 60 00 46 4C ; FLhd........`.FL
64 74 00 00 00 00 C7 06 35 2E 30 2E 31 00 C8 10 ; dt....Ç.5.0.1.È.


AFTER:

46 4C 68 64 06 00 00 00 00 00 04 00 60 00 46 4C ; FLhd........`.FL
64 74 B1 77 00 00 C7 06 35 2E 30 2E 31 00 C8 10 ; dt±w..Ç.5.0.1.È.

This brought back all of my instruments with intact settings, and all of the patterns I had written. Unfortunately, the Playlist pattern data (how you build different patterns together--don't know the right terminology) was lost, but all the parts are there and all my pattern labels were still on the playlist. In any event I'm happy it will only take me a few hours to rebuild the playlist data instead of having to start from scratch.

So if you have a corrupt FLP that has data in it (i.e., you don't have a 0-byte file), this will at least let you open the damn thing. I don't know if it will work on FL 6.

I'll keep comparing FLPs and post anything else I learn about the format, but at this point I'm just happy I got my shit working again. So I'll probably get lazy.

EDIT: Amazing file structure analysis here: http://www.ocremix.org/forums/showpost.php?p=258055&postcount=34. You people are way too brilliant for me. Bah!

-steve

Share this post


Link to post
Share on other sites

Wow - this is pretty major work you're doing! A lot of people will want to know about this - we have to make sure the word gets out! Thanks for taking the time to sleuth around and not just letting the corruption slide.

Share this post


Link to post
Share on other sites
Back up regularly

QFE, sometimes I save flp's in two locations, not just the project folder, just in case, it has helped me once I believe. Backing up is what needs to be done.

But nice work on the indepth correcting, I'm sure it'll help me out in the future. Though I still use FLS4, I'm sure it'll come in handy.

Share this post


Link to post
Share on other sites

I save about every 10 minutes while I work. Also, whenever I do anything major, I save, then I save a new version. My new CT sewer mix has about 14 backups because of this method.

Share this post


Link to post
Share on other sites

I dont just save in multiple places. If your HD totally crashes often (as does mine), either upload your project files to a secure server, or just use a CD to back up your files at the end of every week. Trust me, it's saved my work a countless amount of times.

Share this post


Link to post
Share on other sites

So far I've gotten about 4 personal requests to fix other peoples' songs (some of these requests look like people who found this post through google and didn't try the work themselves). Please don't do that. I'm happy to do it for the people I've already said "sure, I'll look at it" to, but note that everything I can possibly do to fix a file has been outlined in the first post of this thread, and anything I can do, you can do yourself using the same methods I did.

I will add to this post if I discover anything else about the file format, but when a file's too corrupted to recover you've just got to rely on backups.

-steve

Share this post


Link to post
Share on other sites

Hey people. I had exactly the same problem, theres a few people mensioning backing up files, but really, who backs up files in two places in the process of writing and producing, back up is usually a process after you have finished a session. I save after every edit i do, but i still lost my work.

Anyway, ive had a read of the first post and i dont really understand how to fix the problem, i can only program in vb. is there any chance i could share email with someone who knows so they can do it for me? I've been working on my final piece for quite a while now, and to put it bluntly, im fucked!

Please help save my arse!

Share this post


Link to post
Share on other sites
but really, who backs up files in two places in the process of writing and producing, back up is usually a process after you have finished a session.

People who don't want to lose their work.

Share this post


Link to post
Share on other sites
Anyway, ive had a read of the first post and i dont really understand how to fix the problem
you need an hex editor. the ms-dos EDIT is fine.

Start -> Run -> Cmd.exe

then something like "C:\Windows\Your Mom>" appears.

type "EDIT" and press enter

File -> Open

browse to find your file, and open it. make sure you check the "Binary" checkbox (I don't know its actual name since I'm running the italian version).

do what is explained in the first post.

File -> Save

File -> Exit

Have a nice day

Share this post


Link to post
Share on other sites
but really, who backs up files in two places in the process of writing and producing, back up is usually a process after you have finished a session.

People who don't want to lose their work.

That sounds about right... Every time I close my sequencer I make sure to copy whatever I was working on to a seperate hard drive. Also, I recently I've been saving different versions of the same song backed up just incase I make a major change and then the next day I decide "What the hell was I thinking when I did this yesterday?" (It's happened a few times...)

Share this post


Link to post
Share on other sites

Yeh, good points people, maybe im depending on my laptop to be as good as it is too much. Think i shall be purchasing some cdrw's.

On the note of usin the hex editor to editor the fl file. Mine seems to be in a different format, i made sure the binary box was checked and reopend it, but it was completly different. Anyone know what the problem could be.

For good forums on nearly all styles of electronica, check out www.itstooloud.com and get involved.

Share this post


Link to post
Share on other sites
I dont just save in multiple places. If your HD totally crashes often (as does mine), either upload your project files to a secure server, or just use a CD to back up your files at the end of every week. Trust me, it's saved my work a countless amount of times.

i generally save every couple of minutes, and i save a new version after every major edit. and if you ever DO get a weird ass error, save your project to a NEW FILE so you don't corrupt your current work by accident. even if the new file turns out to be corrupt, you still have the old one to work off of.

also as far as backup goes, that would be quite cumbersome as i go through probably 2-3 DVD's worth in a week's time. needless to say uploading that on dialup would be ridiculous.

Share this post


Link to post
Share on other sites

I found this site from google, searching for "corrupt flp file" in the desperate hope that there may have been some way of rescuing a song I had spent hours and hours on.

The same old story, a plugin crashed as I was saving the file. I tried to look at the code and find the markers and what not, but this was just beyond me.

However, I was running Norton System Works 2006, including Norton Go Back. With File & Version rescue you can restore files from a number of different times on drives you have protected.

Now unfortunately I don't save my flp files to C drive, which is the only drive I have enabled protection on. Luckily though I was able to find a number of versions of C:\Program Files\FLStudio 5\Trash bin\Backup.flp file which included a save of my song 8 minutes before it crashed.

Thank God for Go Back.

Just thought I'd post this to in the hope that it might save someone else's hard work. Of course by the time they search for this, it's probably too late. From now on I'll be using FL Studio 6 and the "Save New Version" function regularly.

Share this post


Link to post
Share on other sites

Not at all. I think the software is prohibitively expensive, and so much of a memory hog that it is probably impractical to run it on your DAW.

I'm just happy I got my file back.

If there is an easier way to access previous copies of the Backup.flp file, I'd love to hear what they are.

Share this post


Link to post
Share on other sites

Wait, what? FL is one of the cheapest and lowest CPU/RAM using programs there is.

Share this post


Link to post
Share on other sites

Hey everybody I got the same problem, FL got stuk and now I got a damaged file of a song I worked weeks on. I tried the solution but I'm to n00b to understand it. Could somebody help me?

I upload the file @ http://two.fsphost.com/zortox/help/LDMFmix.flp if somebody could fix it, that would be great! cause I spend alot of time @ this song and now its all gone :(

(yes I know I should have made back-ups :))

so please help me :)

thanx in forward.

Share this post


Link to post
Share on other sites
Hey everybody I got the same problem

If the fix didn't work for you, send your song to ImageLine support and see if they can help.

-steve

Share this post


Link to post
Share on other sites
If the fix didn't work for you, send your song to ImageLine support and see if they can help.

-steve

I can't find a email adres on the FLstudio site, anybody knows a email adres where I can contact ImageLine support ?

READ THIS FIRST:

If you came here from a google search on corrupt FL files and couldn't be bothered to read the entire thread, at least read this part: I WILL NOT FIX YOUR FILE FOR YOU. STOP ASKING. YOU MORON.

Now back to our regularly scheduled post.

I've read the whole topic OVER and OVER but I don't udnerstand it I can't work with Hexeditors so please help me

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this