Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // xtyp_objs_v1.php
- ini_set('memory_limit', '900M');
- ini_set('display_errors', '1');
- $files = explode("\n", `dir /b /s *.xtyp`);
- $section_const = "\x11\x11\x33\x33";
- $objs_code = "\x82\xD6\xFC\x83";
- print "f0, f1, f2, f3, ";
- print "bound_min_x, bound_min_y, bound_min_z, ";
- print "bound_max_x, bound_max_y, bound_max_z, ";
- print "sphere_x, sphere_y, sphere_z, ";
- print "sphere_radius, draw_dist, model, texture, ";
- print "f4, f5, f6, f7, ";
- print "f8, f9, f10, f11\r\n";
- foreach ($files as $file)
- {
- if (!is_file($file)) continue;
- $data = file_get_contents($file);
- if ($data !== false)
- {
- // parse section list
- $loffset = fix_offset(substr($data, 0x40, 4));
- while (substr($data, $loffset + 0xc, 4) == $section_const)
- {
- $code = substr($data, $loffset + 0x0, 4);
- $ssize = parse_int(substr($data, $loffset + 0x4, 4));
- $soffset = fix_offset(substr($data, $loffset + 0x8, 4));
- // parse objs section
- if ($code == $objs_code)
- {
- $size_parsed = 0;
- while ($size_parsed + 0x70 <= $ssize)
- {
- $f0 = strtoupper( bin2hex(substr($data, $soffset + 0x0, 4)) );
- $f1 = strtoupper( bin2hex(substr($data, $soffset + 0x4, 4)) );
- $f2 = strtoupper( bin2hex(substr($data, $soffset + 0x8, 4)) );
- $f3 = strtoupper( bin2hex(substr($data, $soffset + 0xc, 4)) );
- printf("%s, %s, %s, %s, ", $f0, $f1, $f2, $f3);
- $x = parse_float(substr($data, $soffset + 0x10, 4));
- $y = parse_float(substr($data, $soffset + 0x14, 4));
- $z = parse_float(substr($data, $soffset + 0x18, 4));
- printf("%.4f, %.4f, %.4f, ", $x, $y, $z);
- $x = parse_float(substr($data, $soffset + 0x20, 4));
- $y = parse_float(substr($data, $soffset + 0x24, 4));
- $z = parse_float(substr($data, $soffset + 0x28, 4));
- printf("%.4f, %.4f, %.4f, ", $x, $y, $z);
- $x = parse_float(substr($data, $soffset + 0x30, 4));
- $y = parse_float(substr($data, $soffset + 0x34, 4));
- $z = parse_float(substr($data, $soffset + 0x38, 4));
- printf("%.4f, %.4f, %.4f, ", $x, $y, $z);
- $r = parse_float(substr($data, $soffset + 0x40, 4));
- $dd = parse_float(substr($data, $soffset + 0x44, 4));
- $mh = "0x" . strtoupper( bin2hex(substr($data, $soffset + 0x48, 4)) );
- $th = "0x" . strtoupper( bin2hex(substr($data, $soffset + 0x4c, 4)) );
- printf("%.4f, %.4f, %s, %s, ", $r, $dd, $mh, $th);
- $f0 = strtoupper( bin2hex(substr($data, $soffset + 0x50, 4)) );
- $f1 = strtoupper( bin2hex(substr($data, $soffset + 0x54, 4)) );
- $f2 = strtoupper( bin2hex(substr($data, $soffset + 0x58, 4)) );
- $f3 = strtoupper( bin2hex(substr($data, $soffset + 0x5c, 4)) );
- printf("%s, %s, %s, %s, ", $f0, $f1, $f2, $f3);
- $f0 = strtoupper( bin2hex(substr($data, $soffset + 0x60, 4)) );
- $f1 = strtoupper( bin2hex(substr($data, $soffset + 0x64, 4)) );
- $f2 = strtoupper( bin2hex(substr($data, $soffset + 0x68, 4)) );
- $f3 = strtoupper( bin2hex(substr($data, $soffset + 0x6c, 4)) );
- printf("%s, %s, %s, %s\r\n", $f0, $f1, $f2, $f3);
- $soffset += 0x70;
- $size_parsed += 0x70;
- }
- }
- $loffset += 0x10;
- }
- }
- }
- // takes 0x50XXXXXX offset and fixes it to file offset
- function fix_offset($data)
- {
- $data[0] = "\x00";
- return 0x10 + array_pop(unpack("N", $data));
- }
- function parse_int($data)
- {
- return array_pop(unpack("N", $data));
- }
- function parse_float($data)
- {
- return array_pop(unpack("f", strrev($data)));
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment