-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Patching Version 0.11 Mar.20,1995 by : Lee Dong-Liang -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- English DOC English DOC English DOC English DOC English DOC English DOC English -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- I. Introduction: We can easily use TextEditor to change the data of the ASCII data file, But the BINARY data file is hard to change. To change BINARY data file, we must use DiskEdit or FileEdit with BINARY mode option. This kind of software is hard to use for most of the computer user. So I create this program to change BINARY data file easily. This software contains the following files : Patch.EXE 28,260 03-20-95 12:10a --> Main Program PatchC.DOC 15,500 03-20-95 12:10a --> Chinese Document PatchE.DOC 18,600 03-20-95 12:10a --> English Document test.pat 997 03-20-95 12:10a --> Demo data file If you can read Chinese, check PatchC.DOC instead of PatchE.DOC , for my english is not so good. II. Usage: Patch [options] PATCHdatafile options: /c Check patch data file only /t Test patch file only /p Patch file /n[[:]no] Set max block number of patch data (Default=20) PATCHdatafile See Part IV for the format of the Patch Data File III. Examples: Patch /c test.pat (Show the patch data in "test.pat". ) Patch /t test.pat (Test patch data in "test.pat", ) (for searching specified PATTERN data only,) (till end of file. ) Patch /p test.pat (Patch data in "test.pat", ) (for searching specified PATTERN data, ) (if found, change to specified CHANGE data,) (till end of file. ) Patch /p /n:2 test.pat (Set the maximum block number of patch data) (to 2 , Patch data in "test.pat", ) (for searching specified PATTERN data, ) (if found, change to specified CHANGE data,) (till end of file. ) IV. The Format of the Patch Data File (*) The KEYWORD of Patch Data Block : ( Ignore Case ) FILE = ˘wĄ÷ specify File Name to patch, can use '*' and '?' <>NOTE! Path Name is not allowed in this version. And execute "patch /p patchdatafile" in the directory of the specified file. <>NOTE! If you use OFFSET and CHANGE to create new file, the specify FILE can not use '*' and '?'. If there is XX in CHANGE, it will be set as 00. DOC = ---> Document for this Patch Data Block <>NOTE! the maximum length of DOC is 80. <>If you don't want to document, you can skip the definition of DOC = . OFFSET = ---> Define the offset of patch data. The value must larger or equal to ZERO. The offset value of the begining of a file is ZERO. <> If the specify file length is to small, PATCH will fill ZERO to proper file length for patching data. So, the file size may change. <>NOTE! You can only select OFFSET or SEARCH in a Patch Data Block. <>NOTE! If you use OFFSET and CHANGE to create new file, the specify FILE can not use '*' and '?'. If there is XX in CHANGE, it will be set as 00. SEARCH = ---> Define data for search. (1) Define Non-ASCII character : Please use 2 character in hexadecimal (0,1,...,E,F) to present one character data, for example : 1.To present data char 'A' use 41 . 2.To present data char '^' use 5E . 3.To present data char '+' use 2B . Except using ?? , you can use any non-hexadecimal character to present Any Character Data, i.e., this character will not be used for data comparision. But can not use SPACE to present Any Character Data. (2) Define ASCII character or string: Please using double quotation marks to mark you data, for example : 1.To present data char 'A' use "A" . 2.To present data string 'Lee' use "Lee" . <> Can not define Any Character Data in quotes. <>NOTE! The defined data can not over 120 columns, include space between characters. <>NOTE! If 120 columns is not enough, please use a new row. In the new row, you can directly define data, and don't have to use SEARCH= in the begin of the line. <>NOTE! The max character number of SEARCH is 512. <>The character number of SEARCH and CHANGE may not be the same, but batter be the same. CHANGE = ---> Define data for chnage. (1) Define Non-ASCII character : Please use 2 character in hexadecimal (0,1,...,E,F) to present one character data, for example : 1.To present data char 'A' use 41 . 2.To present data char '^' use 5E . 3.To present data char '+' use 2B . Use XX to present this character data is no need to change. Except using XX , you can use any non-hexadecimal character to present that character data is no need to change. But can not use SPACE to present no-need- to-change character. (2) Define ASCII character or string: Please using double quotation marks to mark you data, for example : 1.To present data char 'A' use "A" . 2.To present data string 'Lee' use "Lee" . <> Can not define No-Need-To-Change data in quotes. So. If there are data in quotes that no need to change, you can use the same data in SEARCH=. <>NOTE! The defined data can not over 120 columns, include space between characters. <>NOTE! If 120 columns is not enough, please use a new row. In the new row, you can directly define data, and don't have to use CHANGE= in the begin of the line. <>NOTE! The max character number of CHANGE is 512. <>The character number of CHANGE and SEARCH may not be the same, but batter be the same. (*) The data between the (N)-th KEYWORD and the (N+1)-th KEYWORD will be set to the (N)-th KEYWORD. When defining multi-line data , you don't have to add the KEYWORD in the begin of the line. (*) The sequence of using KEYWORD to define Patch Data Block: (1) First using FILE to specify file that need to patch. FILE = patch_filename After this definition, all defined data is for this specify file, until meet another FILE= definition. One patch data file can define patch data for more than one file. (2) Then, defining the Patch Data Block(PDB). There are two kinds of the Patch Data Block. (i) using SEARCH with CHANGE DOC = the doc of this PDB (not necessary) SEARCH = search data (can be multi-line) CHANGE = patch data (can be multi-line) (ii) using OFFSET with CHANGE DOC = the doc of this PDB (not necessary) OFFSET = file offset of the patch data CHANGE = patch data (can be multi-line) After FILE= , you may use number of ( SEARCH with CHANGE ) or ( OFFSET with CHANGE) , or use both of them. <>NOTE! If the sequence has some error, may cause patch error. <>NOTE! If the sequence is not valid, the program will exit. (*) The Remark Mark ; ---> the data after this remark mark ';" will not be used by PATCH.exe . <> If ';' appears in the double quotation marks, that ';' will not be taken as a remark mark. (*) The End Mark of All Patch Data Blocks [patch end] ---> the END mark of all Patch Data Blocks The patch file data that below this mark will not be used by PATCH.exe . <>[patch end] is not necessary for a patch data file. But in this case, you need to use Remark Mark ; for every documentation. V. Examples of Patch Data File ++++ Example 1 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ; ; Example of Patch Data File TEST1.pat ; ; while using : Please put PATCH.exe in current directory or PATH directory, ; and put TEST1.pat to current directory. ; (that include specified FILE in Patch Data Block of TEST1.pat) ; ; And then execute : PATCH /p TEST1.pat ; ; If Memory is not enough, may use PATCH /p /n:2 TEST1.pat ; ; <><><> The following data are not real. ;; specify File Name to patch FILE = play.exe ;; Document for this Patch Data Block DOC = patching XXXXXXXX Game -- IMMORTAL Version ;; Define data for search -- Not real data only for DEMO ! Search = 00 01 02 03 ?? ?? ?? ?? 08 09 0A 0B 0C 0D 0E 0F 12 13 14 ?? ?? ?? ?? ?? ?? 1B 1C ; (continued) ;; Define data for chnage -- Not real data only for DEMO ! Change = xx xx xx xx xx xx xx xx xx xx AA BB CC DD EE xx xx xx xx 11 22 33 44 55 66 77 88 ; (continued) doc = patching XXXXXXXX Game -- for No Bullet Limit search = ?? ?? ?? ?? 99 88 77 66 55 44 change = 33 66 99 00 xx xx xx xx xx xx ;; The End Mark of All Patch Data Blocks [patch end] Other remarks do not need ";" , below the line of [patch end]. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++ Example 2 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ; ; Example of Patch Data File TEST2.pat ; ; while using : Please put PATCH.exe in current directory or PATH directory, ; and put TEST2.pat to current directory. ; (that include specified FILE in Patch Data Block of TEST2.pat) ; ; And then execute : PATCH /p TEST2.pat ; ; <><><> The following data are not real. File = game.sav ; Specify patch file name Doc = Set Money to Maximum value Offset = 228 ; file offset of patch data Change = FF FF FF 7F ; Hex(7FFFFFFF)=Dec(2147483647) Doc = Set Personal Characters to 100 Search = "D.L.Lee" ?? ?? 50 38 44 32 18 27 ; the characters of D.L.Lee Change = "D.L.Lee" xx xx 64 64 64 64 64 64 ; Hex(64)=Dec(100) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++ Example 3 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ; ; Example of Patch Data File REBOOT.pat ; ; while using : Please put PATCH.exe in current directory or PATH directory, ; and put REBOOT.pat to current directory. ; ; And then execute : PATCH /p REBOOT.pat ; ; <><><> The following data are real. It will create REBOOT.com for reboot. File = reboot.com ; Specify file name Doc = Creating REBOOT.COM ; Creating a new file Offset = 0 ; Create it from the begin of the file Change = BB 34 12 ; mov bx,1234 B8 40 00 ; mov ax,0040 8E D8 ; mov ds,ax 89 1E 72 00 ; mov [0072],bx EA 00 00 FF FF ; jmp FFFF:0000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ VI. Version Ver 0.11 : Mar.20,1995 (Patch.exe) o Add Options /c to check patch data file. o Add patch ASCII data feature by using "string" to define. o Add [format]OFFSET to specify file offset for patch data. o The data after remark mark ';" will not be used by PATCH.exe . ( If ';' appears in the double quotation marks, that ';' will not be taken as a remark mark.) o Change [format]PATTERN to [format]SEARCH . o [format]PATTERN still can be used. (for ver 0.10) o The max number of defined characters in [format]SEARCH and [format]CHANGE can be 512 bytes. o [format]SEARCH can use non-hexadecimal(0-F) to present any character, except SPACE. o [format]CHANGE can use non-hexadecimal(0-F) to present no- need-to-change character, except SPACE. * [begin] [end] are cancelled. Using KEYWORDs to separate data. The KEYWORDs of the Patch Data File are: FILE, DOC, OFFSET, PATTERN, SEARCH, CHANGE . * For [begin] [end] are cancelled, so PATCH.exe set the data between the (N)-th KEYWORD and the (N+1)-th KEYWORD to the (N)-th KEYWORD. When defining multi-line data , you don't have to add the KEYWORD in the begin of the line. * [patch end] is still reserved. ** For the Patch Data File in the format of Version 0.10 : <>If the data of PATTERN and CHANGE has only one line in a [begin]-[end] block, then the data file can be used directly without any modification. <>If the data of PATTERN and CHANGE has more than one line in a [begin]-[end] block, the PATTERN are defined in continuous lines , and the CHANGE are also defined in continuous lines , then the data file can be used directly without any modification. <*>If the data of PATTERN and CHANGE has more than one line in a [begin]-[end] block, and the PATTERN and CHANGE are defined in mixed lines, then the data file must separate the mixed PATTERN and CHANGE, make all PATTERN lines be together , and make all CHANGE lines be together. And then, the data file can be used for Version 0.11 . Ver 0.10 : Feb.05,1995 (Patch.exe) o Satisfy the basic requirement. o The date of the patched file will not be change. o If the patched file is READ-ONLY file, PATCH.exe will also patch the file directly, and set the file attribute back after patch that file. o [format]FILE can use '*' and '?' to specify filename. o [format]PATTERN can use ?? to present any character, maximum define 64 character data. o [format]CHANGE can use XX to present no change, maximum define 64 character data. <> Each Patch Data Block can only define one patch data, if there are another parts of the data file need to patch, please write another Patch Data Block. <> One Patch Data File can define many Patch Data Blocks, but if the number of the Patch Data Blocks(PDB) is over 20, please use the option /n:[number_of_PDB] to make sure all data are patched . In the future : o Can specify the file offset where PATCH.exe start to search. o Can specify the time of search/change. o The features suggest by users. VII. You may copy this program freely, but please make them all together. If you feel this program is useful, and you will to sponsor the next version of the program, you can sand your donation to Lee Dong-Liang 63,37 Alley,Ren-I Road, KeeLong,Taiwan,R.O.C. CODE : 201 You may use this address to contact me or Email to DDL.bbs@bbs.mgt.ncu.edu.tw ( Before Jun,1995 ) VIII. Thanks all the suggestions provided by ANDY-SNOWFOX.