Difference between revisions of "HackerTools"

From UFOpaedia
Jump to navigation Jump to search
m (Removed duplicated MS-Edit instructions)
Line 1: Line 1:
Windows comes with the simple but effective EDIT hex editor. To use it:
+
Windows 95 and beyond offer a simple but effective text editor that can be used to hex edit binary files: [[MS-Edit]].
 
 
* /Start /Run then enter EDIT
 
* Point to the game file of interest. This DOS tool has some old conventions such as: clicking on the two periods (..) at the top of the Directory list moves you up one directory level. Use Help (F1) for more info. Once you've highlighted the file of interest,
 
* Checkmark "Open Binary"
 
* If you know the record length for your file of interest, enter it on "Line Width". For example, SOLDIER.DAT has record lengths of 68. This causes file entries to "line up" and makes patterns obvious.
 
* If you're new to hacking, checkmark "Open Read-Only". This prevents you from making changes.
 
 
 
 
 
Editing:
 
* The "Col" and "Value" info along the bottom bar show you the current byte column you're in, and its value. Use this when comparing your file against e.g. the [[SOLDIER.DAT]] and [[UNITREF.DAT]] wiki entries.
 
* Many folks talk about byte positions using <i>offsets</i> (starts at 0, and is indicated by [square brackets]) whereas EDIT does not (starts with column 1). If the values don't seem to be jiving, try looking one column to the right (or left!).
 
* <b>WARNING:</b> When you first start to edit, hit the Insert key <b>once</b> to get the big block cursor. This puts you in Overwrite mode instead of Insert mode (the small underline cursor). Be VERY CAREFUL about hitting the Insert key again. Insert mode is a Very Bad Thing<i>(tm)</i> for binary files. Inserting a byte moves every subsequent byte over by one, thus nuking position-based files (i.e., most XCOM files). If your game has gone south and you're SOL though, you might give it a shot... you never know what might happen!
 
* Likewise, be VERY CAREFUL about hitting keys like Delete, Backspace, or Enter. All these (and more!) mess with positionality. If you ever see that records aren't lining up, Close without saving!!
 
* To enter numeric values into a byte:
 
** Hold down an Alt key (either one)
 
** Using the NUMERIC KEYPAD (the numbers on right side of keyboard, not the ones along the top of keyboard), type in the number you want to enter. It doesn't matter if Numlock is on or off.
 
** Let go of the Alt key. In the case where your computer doesn't have a numeric keypad such as a laptop, you must press the function (Fn) key along with ALT in order to enter these values.
 
** The number will now be entered. However, for values less than 28, you have to go through special gyrations (these were "control characters" for DOS). First, hit Control-P (^P). Then:
 
*** For 0, hit ^2 (don't ask why)
 
*** For 1-26, hit ^A to ^Z. For example, ^A is 1, ^M is 13, ^Z is 26.
 
*** For 27, hit ^[
 
* A handy lookup table for numbers versus characters can be found as a .GIF [[Media:DOS_Chars_In_MsEdit.gif|here]] or the same thing in a .PDF [[Media:DOS_Chars_In_MsEdit.pdf|here]]
 
* If you see that your number makes a "regular" character (e.g. 65=A), you can also simply type in that character. However, the space character (number 32) looks just like a null character (number 0); don't use a space to mean zero!
 
* Make a copy of the file if you're unsure of what you're doing. EDIT prompts you about making a .BAK backup file when you save edits, which is a nice convenience.
 
 
 
 
 
Also:
 
* Some savegame files store 'rubbish' in a field that's not being used. For example, not all soldier and alien names are 25 characters long (26 including the null byte, value 00, that shows where it ends). You'll usually find rubbish stored in the columns past the name end. It can be the remains of old (longer) names, or might even be e.g. random Windows crap that was in that position in RAM when the file was last in memory. Garbage characters may also show up in e.g. fields that an alien doesn't use (but soldiers do). Don't worry about them... if there's no reason for the game to use them, they're meaningless.
 
* If you have a file open in EDIT, it is not locked by the system. You can keep the file open indefinitely even when the game is running and nothing strange will happen. Just make sure to save your changes so that they show up. In the case if the executable, it is always best to save and restart.
 
  
 +
----
  
 
Another hex editor that some folks use is Hex Workshop by [http://www.bpsoft.com www.BPSoft.com]. Hex Workshop has the nice feature that you can make a 'structure library' with the meaning (field name) of each byte, turning the file into a little database. You will see some of these definitions (.HSLs) in the game file wikis. Hex Workshop is free for 30 days and then costs $50 if you want to keep using it. While it has a number of nice features, it does have some drawbacks. Examples: 1) Its display field can't be more than 64 characters wide (unlike EDIT), so you can't do a "one row equals one record" display for e.g. SOLDIER.DAT (reclength 68) or UNITREF.DAT (reclength 124). Related to this, 2) although it's a "modern" Windows app, you can't e.g. go to some tiny font and see a lot more in your data display window (even though you probably have 1600x1200 screen rez as a L33T gamer).
 
Another hex editor that some folks use is Hex Workshop by [http://www.bpsoft.com www.BPSoft.com]. Hex Workshop has the nice feature that you can make a 'structure library' with the meaning (field name) of each byte, turning the file into a little database. You will see some of these definitions (.HSLs) in the game file wikis. Hex Workshop is free for 30 days and then costs $50 if you want to keep using it. While it has a number of nice features, it does have some drawbacks. Examples: 1) Its display field can't be more than 64 characters wide (unlike EDIT), so you can't do a "one row equals one record" display for e.g. SOLDIER.DAT (reclength 68) or UNITREF.DAT (reclength 124). Related to this, 2) although it's a "modern" Windows app, you can't e.g. go to some tiny font and see a lot more in your data display window (even though you probably have 1600x1200 screen rez as a L33T gamer).

Revision as of 07:57, 24 August 2009

Windows 95 and beyond offer a simple but effective text editor that can be used to hex edit binary files: MS-Edit.


Another hex editor that some folks use is Hex Workshop by www.BPSoft.com. Hex Workshop has the nice feature that you can make a 'structure library' with the meaning (field name) of each byte, turning the file into a little database. You will see some of these definitions (.HSLs) in the game file wikis. Hex Workshop is free for 30 days and then costs $50 if you want to keep using it. While it has a number of nice features, it does have some drawbacks. Examples: 1) Its display field can't be more than 64 characters wide (unlike EDIT), so you can't do a "one row equals one record" display for e.g. SOLDIER.DAT (reclength 68) or UNITREF.DAT (reclength 124). Related to this, 2) although it's a "modern" Windows app, you can't e.g. go to some tiny font and see a lot more in your data display window (even though you probably have 1600x1200 screen rez as a L33T gamer).


If you're on a budget, EDIT is a fine little tool. I, for one, once used Hex Workshop, but now exclusively use EDIT.


NOTE: To make screen captures, see this.



Another VERY useful hex editing program is the Universal Game Editor (UGE). It is a hex editor which displays numbers in digits instead of hex codes. It uses templates that can store variables found in the game files, so that they can be easily edited (including variables with 1, 2, or 4 bytes, or text entries).

It can be found from a variety of locations using a search engine. The program is only about 400kb and is free to use (shareware with full capabilities, but has a reminder screen).


Return to Game_Files