Difference between revisions of "HackerTools"

From UFOpaedia
Jump to navigation Jump to search
(Added an EDIT lookup reference)
(A few additions, plus the note on screencaps)
Line 2: Line 2:
  
 
* /Start /Run then enter 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.
+
* 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"
 
* 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 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.
Line 9: Line 9:
  
 
Editing:
 
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.
+
* 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) whereas EDIT does not (starts with column 1). Then again, it's not always clear whether someone is saying positions in terms of offsets. If the values aren't jiving with what somebody's saying, try looking one column to the right (or left!).
+
* 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!
 
* <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!!
 
* 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!!
Line 34: Line 34:
  
  
If you're on a budget, EDIT is a fine little tool. I use it more often than Hex Workshop even though I have both.
+
If you're on a budget, EDIT is a fine little tool. I, for one, once used Hex Workshop, but now exclusively use EDIT.
  
  
<b>Return to [[Under_The_Hood|Under The Hood]]</b>
+
'''NOTE:''' To make screen captures, see [[Info#Screenshots|this]].
 +
 
 +
 
 +
----
 +
 
 +
Return to [[Game_Files]]

Revision as of 04:13, 3 November 2007

Windows comes with the simple but effective EDIT hex editor. To use it:

  • /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 offsets (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!).
  • WARNING: When you first start to edit, hit the Insert key once 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(tm) 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
    • 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 here or the same thing in a .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.
  • Another WARNING: If you have a file open in EDIT, it may be LOCKED by the system. This means that other programs (like XCOM) can't write to it. XCOM won't necessarily complain!... but then you might end up with major weirdness. Or maybe not. Anyway, be sure to Close a file before XCOM might try to write to it.


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.



Return to Game_Files