Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function GetNULLPaddedString($string)
- {
- $newString = NULL;
- $i = 0;
- while ($i < strlen($string))
- {
- if(!ord($string{$i}))
- break;
- $newString = $newString.$string{$i};
- $i++;
- }
- return $newString;
- }
- if(!$fh = fopen('peds.col', 'r'))
- exit;
- fseek($fh, 100);
- $counter = 0;
- $version = NULL;
- do
- {
- $character = fread($fh, 1);
- if($character == "\x23")
- break;
- $version = $version.chr(ord($character)-23);
- fseek($fh, 99, SEEK_CUR);
- ++$counter;
- }
- while ($counter < 26);
- echo 'Version: '.$version."</br></br></br>";
- fseek($fh, 0);
- $position = 0;
- while($FourCC = fread($fh, 4))
- {
- echo 'Position: 0x'.dechex($position)."</br>";
- $SizeToAnEndOfThisCollision = unpack('Vx', fread($fh, 4));
- $SizeToAnEndOfThisCollision = $SizeToAnEndOfThisCollision['x'];
- $CollisionName = GetNULLPaddedString(fread($fh, 24));
- echo 'Name: '.$CollisionName."</br>SizeToAnEndOfThisCollision: 0x".dechex($SizeToAnEndOfThisCollision)."</br></br>";
- $position += $SizeToAnEndOfThisCollision + 8;
- fseek($fh, $SizeToAnEndOfThisCollision - 24, SEEK_CUR);
- }
- fclose($fh);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement