Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #required libs:
- sudo aptitude install libghc-opengl-dev libghc-sdl-dev make hexedit gawk doom-wad-shareware prboom -y
- #get doom source code
- #http://sourceforge.net/projects/prboom/files/prboom%20stable/2.5.0/
- wget "http://colocrossing.dl.sourceforge.net/project/prboom-plus/prboom-plus/2.5.1.3/prboom-plus-2.5.1.3.tar.gz"
- tar -xvf prboom-plus-2.5.1.3.tar.gz
- cd prboom-plus-2.5.1.3
- ./configure
- make
- #move original compile
- mv src/prboom-plus src/doom1
- #Change Player's default health and compile again
- vim +62 src/p_inter.c
- make
- #move new compile
- mv src/prboom-plus src/doom2
- #compare the two files
- cmp -l src/doom1 src/doom2 | gawk '{printf "%08X %02X %02X\n", $1-1, strtonum(0$2), strtonum(0$3)}'
- <sample output>
- 0000024D F3 D2
- 0000024E 69 D2
- 0000024F EE 3E
- 00000250 BD 0A
- 00000251 7B 1D
- 00000252 F8 D9
- 00000253 C3 76
- 00000254 3F ED
- 00000255 84 23
- 00000256 18 0B
- 00000257 57 1B
- 00000258 FD 6D
- 00000259 53 A6
- 0000025A B0 3D
- 0000025B C7 4F
- 0000025C EE 7F
- 0000025D CC 3B
- 0000025E 63 D7
- 0000025F E1 39
- 00000260 68 5F
- 00121849 64 E8
- 0012184A 00 03
- </sample output>
- #ignore all but last two line of output
- #open original binary in hexedit
- hexedit src/doom1
- #press F4 and jump to 00121849 from above.
- #This position will very based on compiling.
- #so reference the command above.
- #make changes 64 to E8 and 00 to 03
- #F2 to save and control-c to exit
- #other examples
- #max Ammo levels start a address 121800
- #hex numbers
- #Hex to int
- perl -e "print unpack('v', pack('H*', '6400'));" #this will output 100 which is what health originally was
- perl -e "print unpack('v',pack('H*', 'e803'));" #This will output 1000 which is what we changed health to
- perl -e "print unpack('v',pack('H*', 'e802'));" #This is 744 because the second two digits move by intervals of 256
- perl -e "print unpack('v',pack('H*', 'e80f'));" #4072 don't forget we are going from 0 to f
- perl -e "print unpack('v',pack('H*', '6300'));" #99 the first two digits get us the intervals from 0 to 255
- perl -e "print unpack('v',pack('H*', 'ff00'));" #This is because 16*16=256 but we start at 0
- perl -e "print unpack('v',pack('H*', 'E703'));" #This is 999 explained more below
- #The 'E' part.
- # 7 is 7. This column go to F which will be 15 - again because we start with 0
- # 14*16=224 You multiply each value in this column by 16. F would be 16 but we start at 0 so F=15 and E=14
- # 3*256=768 Everything in this column is multiplied by 256
- # 0 is 0 but you would multiply everything in this column by 4096 because 256*16=4096
- # So add it all together 14*16+7+3*256=999
- #changing strings from the command line
- #626F6E75732E is hex for 'bonus'
- #6974656D2E20 is hex for 'item. ' - There is a space at the end to keep the strings the same length
- #hexdump converts the file to editable text
- #sed finds and replaces the strings in hexcode
- #xxd converts the editable text back into a binary file
- hexdump -ve '1/1 "%.2X"' ./src/doom2|sed "s/626F6E75732E/6974656D2E20/g"|xxd -r -p > src/doom3
- chmod +x src/doom3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement