Counter Strike : Global Offensive Source Code
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.

43 lines
914 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.=$dir.$nullbyte;
  17. $dirout.=pack("V",0); # fake crc
  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("V",-1);
  24. }
  25. }
  26. $dirout.=$nullbyte;
  27. }
  28. $dirout.=$nullbyte;
  29. open(DIROUT,">test.dir") || die;
  30. binmode DIROUT;
  31. print DIROUT $dirout;
  32. close DIROUT;
  33. open(DATAOUT,">test_000.dat") || die;
  34. binmode DATAOUT;
  35. print DATAOUT $dataout;
  36. close DATAOUT;