TGC Codebase Backup



Ripping Painkiller Sfx Wave by Peace

2nd Apr 2005 14:10
Summary

Get all sfx samples of the game Painkiller



Description

Painkiller is one of my favorite games, but even I like the cool atmospheric samples in it. This little source by me ripps all 2190! samples in wav format for your own to listen them seperatly. The ripping process may take a bit of time, but it's a fine worth. If you want, you can download the added rar packed archive with a ready to use executable.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    Remstart  ---------------------------------------
                     PSH v1.00

         Painkiller SFX Hack © 2005 by FACS

                 19.03.2005 - 23:36
------------------------------------------ Remend

TYPE FHX
   File     AS STRING
   Output   AS STRING
   Search   AS STRING
   Finish   AS STRING
   Size     AS INTEGER
   FilePos  AS INTEGER
   Pos      AS INTEGER
ENDTYPE

xFHX AS FHX

`* Please change path to installdir of Painkiller
`* ----------------------------------------------
xFHX.File="C:Program FilesDreamCatcherPainkillerDataSounds.Pak"

`* Path to install all ripped soundfiles ;D
`* ----------------------------------------
xFHX.Output="DataSoundsPainkiller"

`* The matching codes, easy to change for other ripps
`* --------------------------------------------------
xFHX.Search="RIFF"
xFHX.Finish="RIFF"

cls rgb(235,236,237)
ink rgb(0,95,0),rgb(235,236,237)
set text font "Arial"
set text size 16
sync

set text opaque

center text 310, 0,"......................................................."
center text 310,16,"Painkiller SFX Hack v1.00"
center text 310,32,"© 2005 by FACS"
center text 310,48,"Hunting may take a bit of time"
center text 310,64,"Press [enter] to abort hunting"
center text 310,80,"......................................................................................................"

suspend for key

ink rgb(0,0,0),rgb(235,236,237)

_HuntWAV()

FUNCTION _HuntWAV

   `* --------------------------------------------------------
   `* Hunt for soundfiles in Painkiller packed archive
   `* I don't know if it's illegal, but takes a lot of fun...!
   `* --------------------------------------------------------

   if file exist(xFHX.File)

      xFHX.Search="RIFF"
      xFHX.Pos=0
      xFHX.FilePos=0
      xFHX.Size=file size(xFHX.File)

      center text 310,112,"Match file..."+xFHX.File
      center text 310,128,"Get internal informations..."+"Size: "+str$(xFHX.Size)+" BYTES - ("+str$(xFHX.Size/1024+1)+" KB)"
      center text 310,160,"Hunting for WAVE's..."

      r0=asc("R")
      i0=asc("I")
      f0=asc("F")

      `* Open the "Painkiller Sounds.pak datas"
      open to read 1,xFHX.File

      while xFHX.Pos<xFHX.Size-4

         `* Skip eventually private header
         read byte 1,r1 : inc xFHX.Pos
         if r1=r0

            read byte 1,i1 : inc xFHX.Pos
            if i1=i0

               read byte 1,f1 : inc xFHX.Pos
               if f1=f0

                  read byte 1,f1 : inc xFHX.Pos
                  if f1=f0

                     `* Hit the sfx-entry ;D
                     inc xNumb
                     read long 1,xl : inc xFHX.Pos,4
                     center text 310,192,"  "+str$(xNumb)+". Wave found at:"+str$(xFHX.Pos-8)+" - Size:"+str$(xl)+" - Left:"+str$(xFHX.Size-xFHX.Pos)+" - Done:"+left$(str$((100.0/xFHX.Size)*xFHX.Pos),5)+"%  "

                     `* Format outputname for wave ####.wav
                     a$=str$(xNumb)
                     a$=left$("0000",4-len(a$))+a$
                     a$=xFHX.Output+a$+".Wav"

                     if file exist(a$)=0
                        `* Write the wave-header "RIFF"
                        open to write 2,a$
                        write byte 2,r0
                        write byte 2,i0
                        write byte 2,f0
                        write byte 2,f0
                        write long 2,xl
                        `* Installs the raw sfx-sound
                        for a=1 to xl
                           read byte 1,b
                           write byte 2,b
                        next a
                        close file 2
                     else
                        for a=1 to xl
                           read byte 1,b
                        next a
                     endif

                     inc xFHX.Pos,xl
                     wait 5
                     if returnkey() then exit : `* End hunting if [returnkey]

                  endif

               endif

            endif

         endif

      endwhile

      center text 310,192,"  All soundfiles stored in "+get dir$()+""+xFHX.Output+"  "

      close file 1

   else

      center text 310,150,"[ Can't find: "+xFHX.File+" ]"

   endif

   `* That's all!
   center text 310,250,"[ End of hunt! (press key) ]"
   wait key

ENDFUNCTION