Page 1 of 3

How to use HexEdit (Informative, not inquisitive)

Posted: Fri Apr 21, 2006 12:30 pm
by Deox
It has come to my attention that a few people here do not know how to use HexEdit, so I have taken this opportunity to write a small, yet informative tutorial, since it does not seem to have been done before.

So here it is.

--------------

Okay, first things first. The best Hex Editor I have found is called HexEdit, and you can find it here. If you have some other Hex Editor, I advise you get rid of it and use HexEdit instead, since this tutorial does not cover other Hex Editors.

The tools in HexEdit are pretty basic. When you open a map file, you should see three distinct columns, with very many characters and numbers. On the far left side is a list of addresses. Addresses are always eight characters long. These addresses are in hex (I advise you read this, so you have a solid understanding of how hex works), and relate to the position in the file where the line starts.

If you read that page, you'd know that address 00000010 is the line which starts at byte 16 (Since A, B, C, D, E, and F come before 10 in the hexidecimal numeric system). 00000020 starts at byte 32...etc.

These addresses are very useful in hex, since they are much shorter than they would be if you expressed them in decimal (This only applies to large numbers; for example, 3,184,935 in decimal is only 309,927 in hex -- but I dont want to confuse you, so I wont go into that).

By pressing command+J, you can "jump" to any part of the file, instantly. Just select the "Entry type" (decimal or hex -- since we're using hex editors, I'd keep the "hex" button selected), type in the address, click "GO," and you're off!

---

The next column holds all of the Hex Code. In this column, Hex Bytes are in pairs, and coordinate with ASCII codes (Again, I advise you to read this, since it will minimize the amount of questions you might want to ask).

You will also notice something strange about this column. Unlike the Hex Address column, each row of this column is split into four equal parts, each having 4 hex bytes (8 characters in total), which are split by spaces. There are 4 dividing lines in this column, each having 4 hex bytes, since hex, as you may have guessed if you read the article I posted above, is a numeric system based on 16 (And what's four times four?).

Also, most things in the map file (Object tags and whatnot) are divisible by four, which makes it fairly easy to edit with a Hex Editor.

And finally, the third and last column, is ASCII. Since this column is filled with characters your keyboard may not be able to generate, I'd advise you to stick with editing the hex part. This column is more of a reference to what you're editing, and can be useful from time to time.

The very top of the screen has an info bar. You should see "Len: $xxxxxxxx | Type/Creator: xxxx/xxxx | Sel: $xxxxxxxx:xxxxxxxx / $xxxxxxxx."

Len is file length, in hex by default (but you can change it to decimal by going to Options, and then selecting Use Decimal Addresses).

Type/Creator is pretty self explanatory.

Sel is a bit confusing at first. The first eight numbers after "Sel:" (the one on the left side of the colon; $xxxxxxxx:xxxxxxxx) show your current position in the map file, and the second row of 8 numbers will only differ from the first numbers if you have part of the file selected. In this case, these numbers show where your selection ends. For example, if you have the first four ASCII characters selected, Sel: will look something like this: Sel: $00000000:00000004 . The number after the frontslash shows how many bytes you have selected within the file. Get it?

And again, all of these numbers will appear in decimal if you go to Options and select Use Decimal Addresses.

So there it is. My small, yet hopefully helpful tutorial on how to use HexEdit. I hope this is enough to help some people get started. I'm not going into tags or metas or anything right now, since I believe this should be enough, and there are many topics in this forum and others which do go into that.

Have fun, and I hope someone's learned something from this.

;)

~Deox

Posted: Fri Apr 21, 2006 1:25 pm
by Monoman
Nice one. Now how will I spend my time when I don't see anymore "I CAN'T FIGURE OUT HEX EDITING !!!@!" posts. :lol:

Re: How to use HexEdit (Informative, not inquisitive)

Posted: Sat Apr 22, 2006 4:59 am
by Jonathan
Deox wrote:Okay, first things first. The best Hex Editor I have found is called HexEdit, and you can find it here. If you have some other Hex Editor, I advise you get rid of it and use HexEdit instead, since this tutorial does not cover other Hex Editors.
I have to note that hex editors are very similar in the basics. The address/hex/ASCII view is universal. I have yet to find a hex editor that can't jump to a specific address. It's the more advanced things where they differ. Say, HexEditor doesn't allow in-place replacing or adding/removing things (I think this is a common feature though), but it can do conversions to many different formats and back, which may be more convenient for you.
Deox wrote:On the far left side is a list of addresses. Addresses are always eight characters long.
Addresses aren't always 32 bits (although many do fit), and in my opinion a hex editor that limits itself to 32 bit addresses is broken. Files (and addresses) can be 4 GiB and larger, and currently 64 bit addresses are often used by the OS. And that's what hex editors should be using.
Deox wrote:These addresses are very useful in hex, since they are much shorter than they would be if you expressed them in decimal (This only applies to large numbers; for example, 3,184,935 in decimal is only 309,927 in hex -- but I dont want to confuse you, so I wont go into that).
I think it's more important that the hex system is more suited to representing computer types. A hex digit has 16 combinations, and log2(16)=4. Since 4 is an integer, bit stuffing is very straightforward. Also, today most computers use 8 bit bytes (octets). And because 8/4=2, 2 hex digits can represent an octet exactly as 00-FF. It would need 8/log2(10) (NOT an integer) decimal digits, leaving 256-999 unusable.
Deox wrote:By pressing command+J, you can "jump" to any part of the file, instantly. Just select the "Entry type" (decimal or hex -- since we're using hex editors, I'd keep the "hex" button selected), type in the address, click "GO," and you're off!
There's no reason not to use decimal if you have to. Hex is most common for the reasons I gave above, and why it's called a hex editor, but in the end it's just an editor that offers raw access to a file.
Deox wrote:You will also notice something strange about this column. Unlike the Hex Address column, each row of this column is split into four equal parts, each having 4 hex bytes (8 characters in total), which are split by spaces. There are 4 dividing lines in this column, each having 4 hex bytes, since hex, as you may have guessed if you read the article I posted above, is a numeric system based on 16 (And what's four times four?).
They're grouped because humans are better at locating things in uniform groups. A nice effect is that aligned 32-bit things will always fit between dividers, and data of different size can also fit in a nice way. The length of the line is 16 to align it with hex addresses, and of course also data. All nibbles but the lowest will tell you the line (noticed that the low nibble in the address column is always zero?), and the low nibble tells where something is located on the line.
Deox wrote:And finally, the third and last column, is ASCII. Since this column is filled with characters your keyboard may not be able to generate, I'd advise you to stick with editing the hex part. This column is more of a reference to what you're editing, and can be useful from time to time.
As its name implies, you can edit data in ASCII there. If you're editing things that are to be interpreted as numbers, it won't be very usable, but it can make editing anything ASCII-like more convenient.

Re: How to use HexEdit (Informative, not inquisitive)

Posted: Sat Apr 22, 2006 10:05 am
by Deox
Jonathan wrote:...stuff...
Thank you for taking the time to correct areas where I may have been incorrect. I tried to do the best I could, but you are obviously a more experienced modder (and now I see it's not just modding...do you have some experience in either programming or computer science?) and know more about how things work than I do - I respect you for this.

So yeah.

~Deox

Posted: Sat Apr 22, 2006 12:11 pm
by sheepofdumb
Thanks a lot Deox and Jonathan this will make a good impact on this fourm with new poeple who want to know what they are doing decent modders.

Posted: Fri May 05, 2006 6:00 pm
by foxrun
well, if you want another version of basic hex editing try this. This knowledge is crutial to modding.

http://www.campaigncreations.org/development/hex.shtml

Posted: Sun May 07, 2006 1:54 pm
by MaxwellK
how do you use the file comparison optilons? I click on it, and nothing happens.

ive worked...

Posted: Mon May 29, 2006 12:57 pm
by Trinity.
ive worked so hard on Hex and every time i change a code and turn on Halo Trial it either kicks me off or doesn't load the map. i am really getting mad and want to MOD. can you guys PLEASE HELP ME.

Posted: Thu Jun 01, 2006 4:08 am
by {SF} Flood
Ok deox please dont hate me for this. Here a hint: find and replace. ihev. Have Fun. :D

with

Posted: Thu Jun 01, 2006 6:50 am
by Trinity.
with what?

Posted: Thu Jun 01, 2006 9:13 am
by «Beast»
I was just thinking, why would Deox hate you for that? How in the hell does that help anyone?

Posted: Thu Jun 01, 2006 2:26 pm
by >Shadow<
Well, it is a clue on how to change the <Not saying what it changes>.

Posted: Thu Jun 01, 2006 4:28 pm
by {SF} Flood
oh its with hexedit.

Darn I started a new page. :roll:

so where do u get the codes?

Posted: Sun Jun 04, 2006 2:46 am
by Some1 new
so where do u get the codes? lets say i wanna delete a car what numbers and letters do i delete?
where is the ascii code sheet for halo demo modding?

Posted: Sun Jun 04, 2006 8:48 am
by >Shadow<
Everything is in the Mod Dev Boards. Noones gonnna spill those secrets. :)