Would anyone be willing to teach me hex in detail?

Discuss Halo 2 modding, progress on figuring things out, mapfiles...you know the drill. Cheating discussion not allowed.
Post Reply
Juniorman030790





Posts: 745
Joined: Mon Feb 14, 2005 1:09 pm
Contact:

Would anyone be willing to teach me hex in detail?

Post by Juniorman030790 »

I am interested in making new discoveries but my knowledge of hex is below basic. If someone wouldn't mind maybe talking with me on msn or yahoo and showing me how it works I would be more than glad to learn.
I like to consider myself an intelligent person so you don't really have to worry about me being a dumb person as I will understand you when you say things like the word offset.
Image
User avatar
xXxCocoFangxXx





Posts: 3756
Joined: Thu Sep 08, 2005 9:57 am
Contact:

Post by xXxCocoFangxXx »

There are tuts out there. Just search.
Image
XxSilencedDeathxX





Posts: 486
Joined: Wed Apr 27, 2005 2:14 pm
Location: ;_;
Contact:

Post by XxSilencedDeathxX »

Ok, I'll show you some basics.

A Byte: A byte is simply two letters. Example: 3334 is two bytes. \

A Block: A block is simply a selection of bytes. Example: 3334 5544 9494 (this block is, in my case, 6 bytes)

A Dword: A Dword is two sets of two bytes, or four bytes. Example: 1122 3344

An Endian-Swap: An Endian Swap is pretty much reversing the bytes in a dword. Example: Original Dword: 1122 3344 Endiand Dword: 4433 2211 (you reverse them in sets of two, since two is a byte)

Following Reflexives: First off, you should know that Reflexives are the blue lines of text when you open a tag in Insolence. Now these reflexives carry chunks, and those are the spawned stuff on the map (sometimes). Now this is how a reflexive is set up "[chunk count][0000][reflexive pointer]." To follow a reflexive in hex workshop, Reflexive dword, little endian it, subtract secondary magic, and go to that offset in the .map, and there is the chunks for a reflexive. So, that pretty much means take the reflexive pointer, endian swap it, than take that number and subtract the secondary map magic from it. The number you get from that is the offset where the chunks are. That's pretty much it.
Juniorman030790





Posts: 745
Joined: Mon Feb 14, 2005 1:09 pm
Contact:

Post by Juniorman030790 »

Thanks, I knew that stuff at first but at the bottom, that helped me a lot.
Image
Doom




Articulatist 500

Posts: 1063
Joined: Mon May 09, 2005 7:31 am
Location: DHA , SA Team: Liquid Metal Knowledge: Excellent Your Mom?: Yes
Contact:

Post by Doom »

To tell you the truth, I knew diddly squat about hex until I read over these about 3 or 4 times. Now I can actually do some stuff. These will hopefully get you started.


[quote]Hex Editing...



Part1

Part2

Part3

Part4

Part5

Part6

Part7

Part8

Part9
Hex

Terms

Reflexives

Dependencies

Offsets

Floats

Meta Data

Tags

Map Files




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



Part 1 - Hex


Hex is short for Hexadecimal, a number system having 16 as its base. Here is a chart on the values of hex converted to decimal...



Hex Decimal


1

2

3

4

5

6

7

8

9

A

B

C

D

E

F


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15




and if you were to convert our number system (base 10) 10 = 16


See... 16 base number system. Our Halo maps can be viewed in Hex, and so can basically any other file. If we continued, 11 would equal 17, etc. Once you get into higher numbers, it's pretty hard to convert in your head, that's why hex workshop and windows calculator have base converters. In windows calculator, you just type in a decimal number, then click on hex and it will convert. Do the opposite to find decimal numbers with a given hex value. Here is a not so complicated formula for you. BEAD in Hex would equal...



B = 11

E = 14

A = 10

D = 13


16^3 = 4096

16^2 = 256

16^1 = 16

16^0 = 1
11*4096 = 45056

14*256 = 3584

10*16 = 160

13*1 = 13

BEAD = 48813


When modifying meta in our .map files, if we wanted to make something a large value, we would just insert F's. We will get more into detail about this later. Hexadecimal is more sufficient than binary when giving low level constants. When used in C, the prefix 0x is used, e.g. 0x69B142.



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


PART 2 - Terms

These terms are used when dealing with hex and/or when modifying the map files of Halo.


Offset: A value which represents a location. For example, 0x06 is 6 bytes into the file.

Byte: When you open up your map file, a byte will be 2 values (numbers/letters). You will hear the term byte/s a lot when dealing with hex and modifying Halo.

Reverse Endian: Taking the values and swapping them by pairs in reverse order, e.g. 49F6 07A2 would be A207 F649 reverse endianed.

Floats: Floats are 4 bytes that contain a decimal value. This decimal value can even be negative. When in the model meta, you will see some reflexives that translate to floats. These floats are x, y, and z coordinates. These floats (coordinates) show where something will be in the game. If it was a weapon, there will be a reflexive pointing to floats (coordinates) that say where a projectile is to be spawned. The coordinates are floats because they say where the projectile will be positioned from the center of the gun, 0, 0, 0. If you wanted the projectile in the middle, the coordinates would be (In hex floats) 0000 0000 0000 0000 0000 0000. Note: When you try to do this in the weapon model meta, you will have to skip 4 bytes after following the reflexive to get to the xyz coordinate floats.


Reflexives: A term you might hear often in the world of halo modding. These are pointers if you will. You can reverse endian their values and subtract the magic of the level to find the offset that these babies point to. In the model meta, a lot of the reflexives point to Floats. We will fully cover reflexives later in this document.


Dependencies: These babies are vert useful. Thank CLuis for creating a program to do swap these for you. The reason why he did it is because sometimes you want a gun to have this effect, but you want a vehicle that has the same effect to have a different effect. You don't want to just swap offsets do you? Because then both of those would change. When using the dependencies, you are just changing the things that are dependent of other things. I'll make a hierarchy view for you...


Scenery
Model antr Coll Model
shader effects
bitmaps bitmaps


This is just a view of what could possibly be. All scenery isn't like this. When changing dependencies, you could just change what the upper object uses. Scenery you could change models, models you could change shaders, etc. We will go into complete depth later on.


Object/Item: I would very much like to describe this because most people have no idea what it is when they are modding. When it is an object/item, it means it is in the map file.


Tag: 4 letter description for something like a vehicle. Vehicle would be vehi, and in the map it would be ihev in hex.


Inject: To add something, in Xbox you would have to overwrite something in the map.


Meta Data: The attributes of an item, e.g. the speed of the warthog (in hex)


Raw Data: Bitmaps, sounds, models.



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


PART 3 - Reflexives


Reflexives: A term you might hear often in the world of halo modding. These are pointers if you will. You can reverse endian their values and subtract the magic of the level to find the offset that these babies point to. In the model meta, a lot of the reflexives point to Floats.

As I said, reflexives are pointers.

Question: How do you find out where they point?
Answer: You reverse-endian the reflexive, and then subtract the magic of the level. That will give you an offset to go to. This is also called following or translating the reflexive.


Question: How do you know if it is a reflexive or not?
Answer: On Xbox, reflexives normally end in 80. In pc, they normally end in 40. Most every time you see a 4 byte value that ends in 80, it will be a reflexive. Likewise for pc, if they find a 4 byte value that ends in 40, then most likely it is a reflexive.


Question: What does the stuff in HMT mean when I save meta and it says something like this in the xml file:


<Reflexive>
<Location>0x144</Location>
<Translation>0x3F0</Translation>
<ChunkCount>4</ChunkCount>
</Reflexive>

Note: You can open up the xml files in Notepad.


Answer: Say this is a plasma rifle (it is not). This would mean that in the meta of the plasma rifle, at the offset (location) 0x144, there is a reflexive. This reflexive translates (is followed to) the offset (location) 0x3F0 in the same meta. This is only the translation for the meta you are in, if you wanted a translation to an offset in the map file, you would have to reverse-endian the reflexive, and subtract the magic of the map. You could also use a program called "Reflexive Tool" in the programs section of this site. The last thing I would like to say about this xml is to clarify what "<ChunkCount>" is. When it says "<ChunkCount>4</ChunkCount>" That means that the value there is 4 bytes long. In the case of it being a reflexive, it seems natural that the ChunkCount is 4 (the reflexive is 4 bytes long).



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


PART 4 - Dependencies


Dependencies: These babies are very useful. Thank CLuis for creating a program to do swap these for you. The reason why he did it is because sometimes you want a gun to have this effect, but you want a vehicle that has the same effect to have a different effect. You don't want to just swap offsets do you? Because then both of those would change. When using the dependencies, you are just changing the things that are dependent of other things. I'll make a hierarchy view for you.


Scenery
Model antr Coll Model
shader effects
bitmaps bitmaps


This is just a view of what could possibly be. All scenery isn't like this. When changing dependencies, you could just change what the upper object uses. Scenery you could change models, models you could change shaders, etc.


Dependencies are a very fun thing to work with. When dealing with modding and these halo map files, mostly ever good mod has some dependency changes. Hell, all of the mods I've made have changed at least 1 dependency. When you inject any new thing, you are most likely going to have to fix its dependencies. These are the easiest things to change because there is a program that does it for you. It is called HHT and is also found in the programs section of this site. Dependencies are also the nicest things to change because instead of swapping offsets of the meta which would say change the pistol bullet into a rocket. But what if another weapon used the pistol bullet (projectile - proj)? Then that weapon would shoot rockets too. Well, when you change dependencies, you are just changing what something points to, so now if you changed the pistols projectile dependency to a rocket, only the pistol would shoot a rocket now, and the other gun using the pistol bullet would still use the pistol bullet. I suggest opening a map file in HHT and messing around a little bit, this is sure to help you understand and release some cool mods.


Lastly, I would like to explain dependencies in the xml that HMT saves. This is an example of what HMT could save in the xml of a warthog.


<Dependency>
<Location>0x34</Location>
<Tagclass>edom
Image
Sig over three lines of text. <--- lik wtf? mods make my sig 4 lines of text, then they letz tis slide as GTAF says, and den dey delete it? likwtf?
Juniorman030790





Posts: 745
Joined: Mon Feb 14, 2005 1:09 pm
Contact:

Post by Juniorman030790 »

Ok, those have helped a lot, but could someone quickly tell me how to do a dependency swap through hex please?

I know this is an old topic but i made it. haha! :o
Image
ModzMaster





Posts: 101
Joined: Sun May 28, 2006 9:40 pm

Post by ModzMaster »

HOLY ****
THANK YOU,
i know you found that somewhere else but still THANK YOU
i never wouldve found it.
Quest
Could what you have said above be used for edditing the collision?
Juniorman030790





Posts: 745
Joined: Mon Feb 14, 2005 1:09 pm
Contact:

Post by Juniorman030790 »

umm... yeah, everything about a halo2 map can be found out with a hex editor if you were good enough with it.

I would still like to know how to change a dependency through hex.
Image
DeviousDave





Posts: 185
Joined: Mon Dec 05, 2005 9:08 pm

Post by DeviousDave »

A dependancy is an intraflexive (meaning a reflexive that points outside of a tag), I think, so idk, I'm just learning hex too but thats what I've gotten from it.
mrhyperpenguin




Revivalist Miner Wordewatician 250

Posts: 357
Joined: Sun Mar 07, 2004 4:34 pm

Post by mrhyperpenguin »

dependencies are two part, the tag class and the identifer (each of them 4 bytes). if you want to swap dependencies manually then you just swap the identifer.

edit to be a little clearer

say you have a bitmap dependency and the identifer of the tag is 0x12345678
in the map you would see 6D74 6962 7856 3412. the first four bytes is the tag class, bitm in hex endian swaped and the next four is the identifier endian swaped. if you want to change the dependency, leave the tag class alone and swap the identifer. for example, if you wanted to change the current identifer with another one, say 0x45678912, then you would replace 7856 3412 with 1289 6745
Image
DeviousDave





Posts: 185
Joined: Mon Dec 05, 2005 9:08 pm

Post by DeviousDave »

Yay, that makes sense =)
Juniorman030790





Posts: 745
Joined: Mon Feb 14, 2005 1:09 pm
Contact:

Post by Juniorman030790 »

I'll be sure to try that. Thanks. :D
Image
Post Reply