Battlezone 1

Community Forum
Home Page Home Page Home Page
  Register
Login 

Delete all board cookies


Contact Us | All times are UTC



Welcome
Welcome to Battlezone 1 Forum!

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. Registration is fast, simple, and absolutely free, so please, join our community today!


Home Page Home Page  [ 8 posts ] 
 
Previous topic | Next topic 
Author Message
Offline 
 Post subject: SDF Editor Corrupts Files
PostPosted: February 3rd, 2009, 9:55 am 
User avatar
senior member

Joined: June 1st, 2008, 9:16 pm
Posts: 3680
SDF Editor is a program to edit BattleZone SDF files. These are building models, like the Hangar.

I was experimenting with abhang.sdf. I wanted to remove the part of the hangar that is flat and on the ground, because colliding with it while driving through the hangar was annoying. So, I selected it and pressed delete. I then saved the modified hangar to another location. I then placed it in my addon and ran the 1st mission. UE! I figured this part must somehow be critical, and rather than delete it, I would simply move it underground. I did so and tested it in BZ 1st mission. UE again! So as a control test, I re-opened stock abhang.sdf, made NO CHANGES, and re-saved the file from the editor and tested it in BZ 1st mission. UE! I had made no changes at all and the file was bad. Just to be sure, I copied stock model to addon. The game ran just fine.

In conclusion, when the SDF editor saves a file, it corrupts it. SDF Editor can still read the file, but BZ cannot.

So this tool is worthless. :(


Top
 Profile  
 
 
Offline 
 Post subject: Re: SDF Editor Corrupts Files
PostPosted: June 23rd, 2011, 4:14 pm 

Joined: April 11th, 2010, 1:22 pm
Posts: 87
I found a way to edit SDF files withouth any error,actually,the UE was because of a header (?) typo
Image

Changing "SDFCP" to "SDFCN" we'll have a working .sdf file (make sure to open the .sdf file with a hex editor)

Image

Here's a little attachment with the .sdfs,so anyone can try


Attachments:
SDF Stuff.zip [2.61 KiB]
Downloaded 6 times
Top
 Profile  
 
Offline 
 Post subject: Re: SDF Editor Corrupts Files
PostPosted: June 23rd, 2011, 4:31 pm 
User avatar
senior member

Joined: June 1st, 2008, 9:16 pm
Posts: 3680
Nice! Maybe I can reverse engineer the SDF editor and make it work correctly so you don't have to manually fix your files. I'll give it a try. :)

EDIT: Nevermind, too much trouble... I might try something else.


Top
 Profile  
 
Offline 
 Post subject: Re: SDF Editor Corrupts Files
PostPosted: June 24th, 2011, 12:28 pm 
User avatar
senior member

Joined: June 1st, 2008, 9:16 pm
Posts: 3680
I wrote a quick application to fix the incorrect header caused by the SDF editor.
http://64digits.com/users/Big%20J/SDFRepair.7z
It's the same as doing it yourself in a hex editor, but automated. :)


Top
 Profile  
 
Offline 
 Post subject: Re: SDF Editor Corrupts Files
PostPosted: June 24th, 2011, 1:44 pm 

Joined: April 11th, 2010, 1:22 pm
Posts: 87
Looks like drag & drop has some kind of error,when you do,it says is not a valid SDF file,while when you do starting the exe,nothing wrong


Top
 Profile  
 
Offline 
 Post subject: Re: SDF Editor Corrupts Files
PostPosted: June 24th, 2011, 2:57 pm 
User avatar
senior member

Joined: June 1st, 2008, 9:16 pm
Posts: 3680
It works, for me, I don't know your problem. Anything interesting in SDF_Fix.log?


Top
 Profile  
 
Offline 
 Post subject: Re: SDF Editor Corrupts Files
PostPosted: June 24th, 2011, 3:05 pm 

Joined: April 11th, 2010, 1:22 pm
Posts: 87
Nothing interesting,just this
"Failure. File 'absupp.SDF' does not appear to be a Battlezone SDF model file."


Top
 Profile  
 
Offline 
 Post subject: Re: SDF Editor Corrupts Files
PostPosted: June 24th, 2011, 3:20 pm 
User avatar
senior member

Joined: June 1st, 2008, 9:16 pm
Posts: 3680
Ah, I know the problem... I forgot to make the file extension check case insensitive. Rename it to "absupp.sdf" and it should work. :)

This is part of the code. the only check that says the file is invalid would be the extension not being ".sdf".
Spoiler:
Code:
var f, file, extension, name;
extension = ".sdf";
file = argument0;
if (file == "")
{
    exit;
}
if (filename_ext(file) == "") //if no extension
{
    file += extension; //append it
}
name = filename_name(file);
if (!file_exists(file)) //if file does not exist
{
    echo("Failure. File '" + name + "' does not exist.");
    exit;
}
if (filename_ext(file) != extension) //if different extension
{
    echo("Failure. File '" + name + "' does not appear to be a Battlezone SDF model file.");
    exit;
}
f = file_bin_open(file,2); //open the file for reading and writing
if (error_occurred)
{
    echo("Failure. " + name + " cannot be modified because it is set to read-only or is in use by another program.");
}
echo("Attempting to fix '" + file + "'...");
if (binaryGet(f,$18) != $4E) //check the problematic header
{
    echo("Writing 0x4E at 0x18"); //console output
    binarySet(f,$18,$4E);
    file_bin_close(f);
    echo("Success. ('" + name + "' has been fixed.)");
}
else
{
    echo("Nothing to do. ('" + name + "' did not appear to need fixing.)");
}

Download it again if you want. It should be fixed now.


Top
 Profile  
 
Display posts from previous:  Sort by  
Home Page Home Page  [ 8 posts ] 

Contact Us | All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


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
Jump to:  

cron
Donate Now
Donate Now


Powered by Skin-Lab © Alpha Trion
suspicion-preferred