Commit 1dc15650 authored by Derrick Sobodash's avatar Derrick Sobodash

Initial commit.

parent 766cd820
Copyright (c) 2012, Derrick Sobodash
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
qdatools
--------
My original Akuji the Demon translation was produced in January or February
of 2003. These tools were written LONG after the fact in September of that
year.
The purpose is simple, one file extracts all the graphics from the QDA
resource Akuji uses, the other makes a new QDA format file using the contents
of whatever directory you give it.
This could be handy if you want to customize the graphics in the game, or if
you decide you want to waste your time producing a third (yes, third)
translation of the game because mine and the other don't suck enough.
qdatools
========
Tools to disassemble and rebuild the QDA resource files used by BUSTER, an indie game developer
\ No newline at end of file
#!/usr/bin/php
<?php
echo ("\nqdabuild 1.0 (c) 2003 Derrick Sobodash\n");
set_time_limit(6000000);
if ($argc < 2) { DisplayOptions(); die; }
else { $path = $argv[1]; }
// Simple routine to read in a directory listing and split it to an array
$mydir="";
$orgfile = "$path";
if ($handle = opendir($orgfile)) {
while (false !== ($file = readdir($handle))) {
$mydir .= $orgfile . "/$file\n";
}
closedir($handle);
}
$filelist = split("\n", $mydir);
print "Staring new header... ";
$header = str_pad((pack("V*", 0) . "QDA0" . pack("V*", (count($filelist) - 3))) , 0x100, chr(0), STR_PAD_RIGHT);
print "done!\n";
$binary = "";
for ($i=2; $i < (count($filelist)-1); $i++) {
print "Adding " . $filelist[$i] . "... ";
$fd = fopen($filelist[$i], "rb");
$file = fread($fd, filesize($filelist[$i]));
fclose($fd);
$header .= pack("V*", (0x100 + (268 * (count($filelist) - 3)) + strlen($binary))) .
pack("V*", strlen($file)) . pack("V*", strlen($file)) .
str_pad($filelist[$i], 256, chr(0), STR_PAD_RIGHT);
$binary .= $file;
print "done!\n";
}
print "Writing new resource file... ";
$fo = fopen("$path-a.qda", "w");
fputs($fo, $header . $binary);
fclose($fo);
print "done!\n";
echo ("All done!...\n\n");
function DisplayOptions() {
echo ("Builds a QDA resource for Akuji the Demon\n usage: qdabuild [input path]\n\n");
}
?>
#!/usr/bin/php
<?php
echo ("\nqdadump 1.0 - (c) 2003 Derrick Sobodash\n");
set_time_limit(6000000);
if ($argc < 2) { DisplayOptions(); die; }
else { $file = $argv[1]; }
$fd = fopen($file, "rb");
fseek($fd, 0x4, SEEK_SET);
$id = fread($fd, 4);
if($id != "QDA0") die(print "Not a valid QDA file!");
print "Reading header... ";
fseek($fd, 0x8, SEEK_SET);
$count = hexdec(bin2hex(strrev(fread ($fd, 1))));
fseek($fd, 0x100, SEEK_SET);
for($i=0; $i<$count; $i++) {
$off[$i] = hexdec(bin2hex(strrev(fread ($fd, 4))));
$size[$i] = hexdec(bin2hex(strrev(fread ($fd, 4))));
$unk[$i] = hexdec(bin2hex(strrev(fread ($fd, 4))));
$name[$i] = rtrim(fread($fd, 256));
}
print "done!\n";
$newdir = substr($file, 0, strlen($file)-4);
mkdir($newdir);
for($i=0; $i<$count; $i++) {
print "Writing " . $name[$i] . "... ";
fseek($fd, $off[$i], SEEK_SET);
$file = fread($fd, $size[$i]);
$fo = fopen("./$newdir/" . $name[$i], "wb");
fputs($fo, $file);
print "done!\n";
}
echo ("All done!...\n\n");
function DisplayOptions() {
echo ("Rips a QDA resource from Akuji the Demon\n usage: qdadump [input file]\n\n");
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment