Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
960 B

  1. #! perl
  2. # make a simple fixed pak file for testing code. This utility is only for testing the code
  3. # before writing the "real" utility. The files that are packed are fake
  4. $ndatfileindex=0;
  5. $ndatoffset=0;
  6. $nullbyte = pack("C",0);
  7. foreach $ext ("txt","vtf")
  8. {
  9. $dirout.=$ext.$nullbyte;
  10. foreach $dir("dir1","dir2")
  11. {
  12. $dirout.=$dir.$nullbyte;
  13. foreach $file("test1","test2")
  14. {
  15. $fdata=$file x 5;
  16. $dirout.=$file.$nullbyte;
  17. $dirout.=pack("V",crc32($fdata));
  18. $dirout.=pack("v",0); #meta data size
  19. $dirout.=pack("C",$ndatfileindex);
  20. $dirout.=pack("V",$ndatoffset);
  21. $dirout.=pack("V",length($dataout));
  22. $dataout.=$fdata;
  23. $dirout.=pack("C",-1);
  24. }
  25. $dirout.=$nullbyte; # mark no more files
  26. }
  27. $dirout.=$nullbyte;
  28. }
  29. $dirout.=$nullbyte;
  30. open(DIROUT,">test.dir") || die;
  31. binmode DIROUT;
  32. print DIROUT $dirout;
  33. close DIROUT;
  34. open(DATAOUT,">test_000.dat") || die;
  35. binmode DATAOUT;
  36. print DATAOUT $dataout;
  37. close DATAOUT;