User Tools

Site Tools


general:guides:hxd_guide

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
general:guides:hxd_guide [2024/10/18 21:58] – created felixwrightgeneral:guides:hxd_guide [2024/10/18 22:28] (current) – [Downloading HxD] felixwright
Line 1: Line 1:
-HxD Hex Guide+====== HxD Hex Editing Guide ======
  
 By FelixWright and Nodever2 By FelixWright and Nodever2
Line 9: Line 9:
 Let's get started. Let's get started.
  
-What is HxD?+===== What is HxD? =====
  
 HxD is a hex editor, disk editor, and memory editor developed for Windows. HxD can open files larger than 4 GiB and open and edit the raw contents of disk drives, as well as display and edit the memory used by running processes. Among other features, it can calculate various checksums, compare files, or shred files. The most recent version was created in 2009 by Maël Hörz. HxD is a hex editor, disk editor, and memory editor developed for Windows. HxD can open files larger than 4 GiB and open and edit the raw contents of disk drives, as well as display and edit the memory used by running processes. Among other features, it can calculate various checksums, compare files, or shred files. The most recent version was created in 2009 by Maël Hörz.
  
-Downloading HxD+===== Downloading HxD =====
  
-HxD 2.0 RC can be downloaded from mh-nexus.+HxD 2.0 RC can be [[https://mh-nexus.de/en/downloads.php?product=HxD20|downloaded from mh-nexus.]]
  
 What is Hexadecimal? What is Hexadecimal?
Line 29: Line 29:
 More examples: More examples:
  
-DECIMAL  =  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 +    DECIMAL  =  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 
- +    HEX      =  0 1 2 3 4 5 6 7 8 9  A  B  C  D  E  F  10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
-    HEX  =  0 1 2 3 4 5 6 7 8 9 A  B  C  D  E  F  10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F+
  
 There are many online resources for converting hex to decimal, but in this tutorial I will explain how to convert hex to decimal and decimal to hex using windows calculator. Before we begin, run calc.exe and press Alt + 3. This will put the calculator in programming mode. There are many online resources for converting hex to decimal, but in this tutorial I will explain how to convert hex to decimal and decimal to hex using windows calculator. Before we begin, run calc.exe and press Alt + 3. This will put the calculator in programming mode.
-Converting Hex to decimal+ 
 +===== Converting Hex to decimal =====
  
 Select the “Hex” Bubble. Select the “Hex” Bubble.
Line 41: Line 41:
  
 Ctrl + C to copy converted value to clipboard. Ctrl + C to copy converted value to clipboard.
-Converting decimal to Hex+ 
 +===== Converting decimal to Hex =====
  
 Select the “Dec” Bubble. Select the “Dec” Bubble.
Line 48: Line 49:
  
 Ctrl + C to copy converted value to clipboard. Ctrl + C to copy converted value to clipboard.
-Using HxD+ 
 +===== Using HxD =====
  
 Keyboard Shortcuts Keyboard Shortcuts
  
 Before we get into hex editing you should learn keyboard shortcuts. For ROMHacking, here's what you will need to know: Before we get into hex editing you should learn keyboard shortcuts. For ROMHacking, here's what you will need to know:
-Key Combination  Description +Key Combination Description ^ 
-F3  Find Again +|F3 Find Again | 
-F6  Next Difference (File Compare) +|F6 Next Difference (File Compare) | 
-Delete  Clear Selection (Note: This shortens filesize!) +|Delete Clear Selection (Note: This shortens filesize!) | 
-CTRL + A  Select All +|CTRL + A Select All | 
-CTRL + E  Select Block… +|CTRL + E Select Block… | 
-CTRL + G  Go To… +|CTRL + G Go To… | 
-CTRL + K  File Compare… +|CTRL + K File Compare… | 
-CTRL + N  New file (Empty) +|CTRL + N New file (Empty) | 
-CTRL + C  Copy Selection +|CTRL + C Copy Selection | 
-CTRL + X  Cut Selection +|CTRL + X Cut Selection | 
-CTRL + V  Paste Insert (Note: This increases filesize!) +|CTRL + V Paste Insert (Note: This increases filesize!) | 
-CTRL + B  Paste Write (Overwrite) +|CTRL + B Paste Write (Overwrite) | 
-CTRL + Z  Undo +|CTRL + Z Undo | 
-CTRL + Y  Redo +|CTRL + Y Redo | 
-CTRL + O  Open a file… +|CTRL + O Open a file… | 
-CTRL + R  Find & Replace… +|CTRL + R Find & Replace… | 
-CTRL + S  Save a file +|CTRL + S Save a file | 
-Shift + F3  Find Again (Reverse) +|Shift + F3 Find Again (Reverse) | 
-Shift + F6  Previous Difference (File Compare) +|Shift + F6 Previous Difference (File Compare) | 
-Ctrl + F4/Ctrl + W  Close file +|Ctrl + F4/Ctrl + W Close file | 
-Ctrl+Number (0-9)  Goto bookmark +|Ctrl+Number (0-9) Goto bookmark | 
-Ctrl+Shift+Number (0-9)  Add bookmark +|Ctrl+Shift+Number (0-9) Add bookmark | 
-Left and Right Arrow keys  Move to next/previous byte +|Left and Right Arrow keys Move to next/previous byte | 
-Up and Down Arrow keys  Move to next/previous row +|Up and Down Arrow keys Move to next/previous row | 
-Shift + Up/Shift + Down  Select next/previous row +|Shift + Up/Shift + Down Select next/previous row | 
-Shift + Left/Shift + Right  Select next/previous byte+|Shift + Left/Shift + Right Select next/previous byte |
  
 WARNING: Changes in filesize could destroy your ROM if you're not careful! WARNING: Changes in filesize could destroy your ROM if you're not careful!
-Going to an offset+ 
 +===== Going to an offset =====
  
 Going forward, Let's say you want to disable the low energy alarm in Zero Mission. 0x52888 = 1D 2F to 14 E0 Going forward, Let's say you want to disable the low energy alarm in Zero Mission. 0x52888 = 1D 2F to 14 E0
Line 90: Line 93:
 As you can see, by default HxD assumes you want to put in a hex address, and the address above is hex so that is fine. If you run into a decimal or octal address though, you can select the dec or oct bubbles and then paste in the address. As you can see, by default HxD assumes you want to put in a hex address, and the address above is hex so that is fine. If you run into a decimal or octal address though, you can select the dec or oct bubbles and then paste in the address.
  
-Editing Hex Values+===== Editing Hex Values =====
  
 So we're at address 0x52888. The text cursor should be blinking to the left of 1D. Select 1D, and type 14. Your cursor should now be blinking to the left of 2F. Select 2F, and replace it with E0. Save your changes with Ctrl + S. You have just performed a hex tweak! Open your ROM in an emulator, and reduce samus' energy below 30. There should no longer be a low energy alarm. So we're at address 0x52888. The text cursor should be blinking to the left of 1D. Select 1D, and type 14. Your cursor should now be blinking to the left of 2F. Select 2F, and replace it with E0. Save your changes with Ctrl + S. You have just performed a hex tweak! Open your ROM in an emulator, and reduce samus' energy below 30. There should no longer be a low energy alarm.
  
-PC vs SNES addresses+===== PC vs SNES addresses =====
  
 SNES roms are divided into banks, which are $8000 bytes long (32,768 bytes in decimal). Super Metroid is of the rom type LoROM, so it can address banks from bank $80-$FF. Because HxD uses PC addresses, and the majority of documentation for SNES games is written with SNES addresses, it's important to know the distinction between the two. PC addresses start at $000000, while SNES addresses start at $80:8000. Every SNES bank starts at $XX:8000, where XX is the bank number. The game reads addresses in this LoROM format. In a LoROM address, the bank is number separated by a colon. SNES roms are divided into banks, which are $8000 bytes long (32,768 bytes in decimal). Super Metroid is of the rom type LoROM, so it can address banks from bank $80-$FF. Because HxD uses PC addresses, and the majority of documentation for SNES games is written with SNES addresses, it's important to know the distinction between the two. PC addresses start at $000000, while SNES addresses start at $80:8000. Every SNES bank starts at $XX:8000, where XX is the bank number. The game reads addresses in this LoROM format. In a LoROM address, the bank is number separated by a colon.
  
 Examples: Examples:
-PC address  SNES address + 
-$4000  $80:C000 +PC address SNES address ^ 
-$9500  $81:0500 +$4000  $80:C000 | 
-$791F8  $8F:91F8 +$9500  $81:0500 | 
-$7FFFF  $8F:FFFF+$791F8 $8F:91F8 | 
 +$7FFFF $8F:FFFF 
  
 Looking at the LoROM addresses, we can see these addresses are referring to locations in banks 80, 81, 8F, and 8F (again), respectively. Looking at the LoROM addresses, we can see these addresses are referring to locations in banks 80, 81, 8F, and 8F (again), respectively.
Line 114: Line 119:
 From the SMMM: From the SMMM:
  
 +<code>
 Bank $##        LoROM address          PC address        Bank description Bank $##        LoROM address          PC address        Bank description
 --------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------
Line 253: Line 259:
 Bank $FE      $FE:0000-$FE:7FFF      $3F0000-3F7FFF      Free space Bank $FE      $FE:0000-$FE:7FFF      $3F0000-3F7FFF      Free space
 Bank $FF      $FF:8000-$FF:FFFF      $3F8000-3FFFFF      Free space Bank $FF      $FF:8000-$FF:FFFF      $3F8000-3FFFFF      Free space
- +</code>
general/guides/hxd_guide.1729288686.txt.gz · Last modified: by felixwright