User Tools

Site Tools


general:guides:hxd_guide

This is an old revision of the document!


HxD Hex Guide

By FelixWright, A.K.A. Cosmic

Hello, and welcome to our current graphics guide for HxD and hex editing in general.

The main goal of this guide is to teach newbies how to edit ROMs with hexadecimal.

Let's get started.

2. What is Hexadecimal?

To understand hexadecimal, you need to understand decimal. Decimal (also called base-ten, and occasionally called denary) is the standard system for denoting integer and non-integer numbers. Decimal is called base10 because it uses ten values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Because it is the de-facto standard number system, it does not have any denotation.

Example: 100 in Decimal is 100.

Hexadecimal is a positional numeral system with a radix, or base, of 16. This means it uses sixteen symbols, in this case 0–9 to represent values zero to nine, and A–F to represent values ten to fifteen. In the romhacking scene, hex values are denoted with $ or 0x.

Example: 100 in Hexadecimal is $64.

2. What is HxD?

HxD is a hex editor, disk editor, and memory editor developed by Maël Hörz for Windows. It 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.

3. Downloading HxD

HxD 2.0 RC can be downloaded from mh-nexus.

4. Shortcuts

Before we get into hex editing you should learn keyboard shortcuts. For ROMHacking, here's what you will need to know:

Key Combination Description
F3 Find Again
Shift + F3 Find Again (Reverse)
Ctrl + F4/Ctrl + W Close file
F6 Next Difference (File Compare)
Shift + F6 Previous Difference (File Compare)
Delete Clear Selection (Note: This shortens filesize!)
Left and Right Arrow keys Move to next/previous byte
Shift + Left/Shift + Right Select next/previous byte
Up and Down Arrow keys Move to next/previous row
Shift + Up/Shift + Down Select next/previous row
CTRL + A Select All
CTRL + E Select Block…
CTRL + G Go To…
CTRL + K File Compare…
CTRL + N New file (Empty)
CTRL + C Copy Selection
CTRL + X Cut Selection
CTRL + V Paste Insert (Note: This increases filesize!)
CTRL + B Paste Write (Overwrite)
CTRL + Z Undo
CTRL + Y Redo
CTRL + O Open a file…
CTRL + R Find & Replace…
CTRL + S Save a file

5. Conversions

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

Select the “Hex” Bubble.

Paste in your hex value (Ctrl + V) or type it in. Select the “Dec” Bubble.

Ctrl + C to copy converted value to clipboard.

Converting decimal to Hex

Select the “Dec” Bubble.

Paste in your dec value (Ctrl + V) or type it in. Select the “Hex” Bubble.

Ctrl + C to copy converted value to clipboard.

6. 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

Open Zero Mission in HxD, and use Goto… (Ctrl + G)

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.

7. 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.

general/guides/hxd_guide.1527175714.txt.gz · Last modified: 2018/05/24 15:28 by felixwright