The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > ROM Hacking > Tools, Tutorials & Resources
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.
New threads in this forum are to be approved by a moderator before they are displayed.

Reply
 
Thread Tools
  #1    
Old December 4th, 2012 (01:20 AM). Edited December 4th, 2012 by Darthatron.
Darthatron's Avatar
Darthatron
巨大なトロール。
Community Supporter
 
Join Date: Jan 2006
Location: Melbourne, Australia
Age: 23
Gender: Male
Nature: Modest
A Beginners Guide To Hexadecimal

An Introduction To Hexadecimal
Let's begin by saying hexadecimal is a number system, not a computer language as it's referred to by some people on this forum. Hexadecimal, or hex, is a base-16 number system mainly used by humans to understand, in a logical way, how computers use and store data.

The number system you're most likely used to, decimal, is a base-10 system, meaning that we have 10 unique symbols (0-9) to represent each individual value. From this you can probably guess that this simply means that a base-16 number system, like hexadecimal, has 16 unique symbols (0-9, A, B, C, D, E and F) to represent each individual value. You can even convert between hexadecimal and decimal with some mathematics, but you don't need to understand the conversion process for hacking Pokémon ROMs.


Counting In Hexadecimal
As previously stated, hexadecimal is effectively an extension of the decimal number system we're used to, increasing the number of symbols from 10 to 16, so counting in hexadecimal is really quite simple. Let's count to 16 in hexadecimal and decimal together, just to see the difference.

Decimal:
1234567891011121314151617181920

Hexadecimal:
123456789ABCDEF1011121314


As you can see, counting in hexadecimal is very similar to counting in decimal, except when you get to 9, you go to A instead of 10, and then once you get to F you go to 10.

Don't worry if this is a tad confusing for you as it will be explained a little more further in to the tutorial.

Telling The Difference
"But, Darthatron, how can I tell if I'm meant to use hex or decimal?" you may be asking. And the answer should be pretty clear...

If the number is prefixed with 0x or &H then you are definitely dealing with hexadecimal. However, there is also some other, less clear, ways of showing hexadecimal notation, such as: Leading zeros (010, for example, is probably 10 in hexadecimal, which is 16 in decimal); or a suffixed h (63h, for example, would be 63 in hex, which is 99 in decimal.)

In the real world, however, you're more likely to see it expressed as Number16. For example: 1016 would be 16 in decimal.


Converting Hex To Decimal And Back Again (The Easy Way)
It's really easy! And rarely actually ever required in the Pokémon ROM Hacking scene.

First of all, open up Windows Calculator. This can be done easily by pressing the Windows Key () + R, typing "calc" into the box and pressing "OK". Looks like this.

Once you're in the Calculator go to the View menu and select "Programmer". In this mode, you can toggle between hex and decimal. Looks like this.

Selecting the "Dec" option and entering a decimal number and then selecting the "Hex" option will show you the hexadecimal value of the value you entered. The same applies for the reverse.


Editing A ROM In A Hex-Editor
Coming soon...


Comments/criticism appreciated.
__________________
あなた は しきしゃ です
わたし は ばか です
Reply With Quote
  #2    
Old December 4th, 2012 (04:17 PM).
itari's Avatar
itari
普通の魔法使い
Community Supporter
 
Join Date: Mar 2010
Location: 魔法の森
Age: 17
Gender: Male
Nature: Relaxed
Very nice. Well written, and you do a good job of explaining these foundational concepts.
__________________
Pokémon Something Version

SubscriptAdvanced SongType Effectiveness EditorTilemap CreatorPython IPS Patcher
Reply With Quote
  #3    
Old December 5th, 2012 (06:33 PM).
____^____'s Avatar
____^____
Unhatched Egg
 
Join Date: Dec 2012
Gender: Male
This is seriously helpfull. I was just wondering...is this what's used to change offsets such as script offsets? Sorry if i sound noobish but everything I know about hacking was self taught so I thought I'd try this forum.
Reply With Quote
  #4    
Old December 5th, 2012 (07:26 PM).
Darthatron's Avatar
Darthatron
巨大なトロール。
Community Supporter
 
Join Date: Jan 2006
Location: Melbourne, Australia
Age: 23
Gender: Male
Nature: Modest
Quote:
Originally Posted by agentgeo View Post
Very nice. Well written, and you do a good job of explaining these foundational concepts.
Thank you very much.
Quote:
Originally Posted by ____^____ View Post
This is seriously helpfull. I was just wondering...is this what's used to change offsets such as script offsets? Sorry if i sound noobish but everything I know about hacking was self taught so I thought I'd try this forum.
Yes, offsets in the ROM are all stored in hex within the ROM, along with everything else in the game. When working with offsets and pointers, it can be a little confusing at first, but I will go in to more detail in the next part of the guide.

With scripts, it's mostly handled by the compiler so it's pretty easy.
__________________
あなた は しきしゃ です
わたし は ばか です
Reply With Quote
  #5    
Old December 6th, 2012 (07:35 AM).
Iacobus's Avatar
Iacobus
sǝɯɐɾ
 
Join Date: Dec 2003
Location: Belgium
Age: 23
Gender: Male
First of all, why is this necessary?
I'm pretty sure there already is a thread like this somewhere. It is of course possible they are deleted or that their layout isn't as 'nice' as this one, but none the less.. I think you can find more useful and detailed documentation on the internet with a simple search.

Secondly, if you want to teach someone something, make sure you know what you want to teach.
Quote:
Originally Posted by Darthatron View Post
Yes, offsets in the ROM are all stored in hex within the ROM, along with everything else in the game.
It's weird you're saying this, as in your 'tutorial' you correctly state that hexadecimal is just a number system, with a radix of 16.
Nothing is stored in hex, it's your editor that represents the data as such, because it's easier for humans to read, interpret and understand than a bunch of 0 and 1's.

Also, don't focus on a specific Windows OS, or any OS for that matter. I'm referring to that calc related paragraph.
Just get rid of it and learn them how to manually convert hexadecimal numbers to decimal, octal and/or binary.

It would be nice too, if people didn't post tutorials containing "Coming soon..." sections.
__________________
Reply With Quote
  #6    
Old December 6th, 2012 (01:27 PM). Edited December 6th, 2012 by miksy91.
miksy91's Avatar
miksy91
A GB/C Rom Hacker since 2010
 
Join Date: Oct 2008
Location: A small country in the North
Gender: Male
Nature: Relaxed
Quote:
Originally Posted by Iacobus View Post
First of all, why is this necessary?
I'm pretty sure there already is a thread like this somewhere. It is of course possible they are deleted or that their layout isn't as 'nice' as this one, but none the less.. I think you can find more useful and detailed documentation on the internet with a simple search.

Secondly, if you want to teach someone something, make sure you know what you want to teach.
It's weird you're saying this, as in your 'tutorial' you correctly state that hexadecimal is just a number system, with a radix of 16.
Nothing is stored in hex, it's your editor that represents the data as such, because it's easier for humans to read, interpret and understand than a bunch of 0 and 1's.

Also, don't focus on a specific Windows OS, or any OS for that matter. I'm referring to that calc related paragraph.
Just get rid of it and learn them how to manually convert hexadecimal numbers to decimal, octal and/or binary.

It would be nice too, if people didn't post tutorials containing "Coming soon..." sections.
Surely there are tutorials similar to this one (I can point out one straight out of head, a stickied thread in Zophar's Domain) and this may not turn out the best one of them. However, this "hacking" community is full of newbies playing around with tools who may not even realize to search for hex editing tutorials themselves. These beginners would more likely check out the tutorials section which we've got here (which really isn't the best possible it could be...) and see this tutorial that way. We got rid of the "Scrapbox" in the past, something similar could be done with the tutorials section by still keeping the "not so important" tutorials around to be found.

Quote:
Originally Posted by Darthatron View Post
Yes, offsets in the ROM are all stored in hex within the ROM, along with everything else in the game. When working with offsets and pointers, it can be a little confusing at first, but I will go in to more detail in the next part of the guide.

With scripts, it's mostly handled by the compiler so it's pretty easy.
You're right about Darthatron talking "nonsense" here because "offsets being stored in hex within the ROM" means nothing but he clearly understands this as well. Would you assume a beginner who barely knows anything about programming or what bytes really are understand somebody explaining stuff in "language of programming" such as explaining everything based on binary instead? This would be a similar situation as running down people who think they know something about coding after studying programming languages in high school/university for a year or two.

Personally, I couldn't have explained what Darthatron did here better myself. Of course if you are talking to a more experienced person, you can try to convince him/her to understand what's really going on inside the CPU, why hex editors are much betters tools to use for hacking than binary editors, and such but no, not in a situation like this. And I have a strong feeling I said something here in a wrong way as well...

All of your points here are valid but my personal opinion is that proper explanations wouldn't be helpful for the majority of people around here. I learned the basics wrong myself and little by little, started to develop my knowledge about different kind of subjects related to coding, and haven't had any problems related to not learning everything correctly from the beginning (and the thing is that I don't think I would have gotten this far if there weren't "bad" but newbie-friendly explanations of different hacking related issues out there).
But what Darthatron could do with this thread is to expand it time after another and once enough is written, write in the end of the tutorial explaining how stuff really works out.
__________________
My Rom Hack



Hacks I support





Learn how to hack GB/C games:

Check my GameBoy/Color hacking videos in Youtube
-The video set uses Pokemon Silver (U) rom for demonstrations
Reply With Quote
  #7    
Old December 6th, 2012 (10:47 PM).
Darthatron's Avatar
Darthatron
巨大なトロール。
Community Supporter
 
Join Date: Jan 2006
Location: Melbourne, Australia
Age: 23
Gender: Male
Nature: Modest
Quote:
Originally Posted by Iacobus View Post
First of all, why is this necessary?
I'm pretty sure there already is a thread like this somewhere. It is of course possible they are deleted or that their layout isn't as 'nice' as this one, but none the less.. I think you can find more useful and detailed documentation on the internet with a simple search.
Because some people don't even know what to look for.
Quote:
Originally Posted by Iacobus View Post
Secondly, if you want to teach someone something, make sure you know what you want to teach.
It's weird you're saying this, as in your 'tutorial' you correctly state that hexadecimal is just a number system, with a radix of 16.
Nothing is stored in hex, it's your editor that represents the data as such, because it's easier for humans to read, interpret and understand than a bunch of 0 and 1's.
I merely said it was "stored in hex" because the offsets and pointers referred to in every tutorial and piece of documentation, and the offsets and pointers handled by the games hacked by the users of this website are byte-based. It's a beginners guide, so why would I complicate things by explaining something they don't need to know?

I also resent you saying I don't understand what I am explaining.
Quote:
Originally Posted by Iacobus View Post
Also, don't focus on a specific Windows OS, or any OS for that matter. I'm referring to that calc related paragraph.
Just get rid of it and learn them how to manually convert hexadecimal numbers to decimal, octal and/or binary.
The rest of the guide will also be windows based, since I don't have a Mac or run Linux.

Also, it's a guide called "A Beginners Guide To Hexadecimal".

And once again, the guide is targeted at beginners, so why would I complicate things with (somewhat) complex mathematics when a majority of the users on this forum are young? I plan on adding the less-easy way of converting some time soon, anyway.
Quote:
Originally Posted by Iacobus View Post
It would be nice too, if people didn't post tutorials containing "Coming soon..." sections.
Thanks for the feedback.
__________________
あなた は しきしゃ です
わたし は ばか です
Reply With Quote
  #8    
Old December 7th, 2012 (03:30 AM).
Iacobus's Avatar
Iacobus
sǝɯɐɾ
 
Join Date: Dec 2003
Location: Belgium
Age: 23
Gender: Male
@miksy91 and Darthatron (Warning: I might go slightly off topic here)
It's all about how you look at it. While it is true that there are lots and lots of newbies here whom don't know much about editing a ROM as they just click around in tools, we can't keep posting these 'beginners' guides/tutorials.

In my opinion a good tutorial should be written for everyone. Novice hackers start reading at the beginning where the basics are explained, while more experienced hackers can skip the basic stuff.
That way everyone can learn from it. Of course, once you are familiar with the topic, you would only use the tutorial as a reference for when you are uncertain about something.

Another reason for me disliking all these beginner tutorials is that they are just so.. TOO simple.
"Everything should be made as simple as possible, but not simpler." (Yes, pretty lame I use this quote, I know. Forgive me.)
While you don't want to overcomplicate things (a bunch of people writing tutorials here are good at that too), you too don't want to make it to easy. Give people a challenge! Let them discover something new. Learn them something they wouldn't think of learning on their own.

All of the above was in general, sharing how I think about it. Certainly not for writing off your guide.
I think you, Darthatron, should reconsider writing about manual conversion. You don't have to use scary numbers.

Trust me, there are a bunch of tutorials who are a lot worse. I just would like to see more detailed tutorials over here than the handful I can count. There are too many I-clicked-this-button-and-it-did-this-let's-write-a-tutorial-about-it-tutorial over here.

PS: If you want I can provide you with screenshots for Mac OS X, Windows XP and Ubuntu calculators.
__________________
Reply With Quote
  #9    
Old December 12th, 2012 (04:09 PM).
Scrambledgraphics's Avatar
Scrambledgraphics
 
Join Date: Dec 2012
Location: Kanto
Gender: Female
Nature: Adamant
Really interesting. Any help with hacking is appriciated! It's because I am a newbie to hacking and etc.
__________________
Hacks I support:

Reply With Quote
  #10    
Old December 14th, 2012 (04:09 AM).
Rain Dancer's Avatar
Rain Dancer
Wanderer
 
Join Date: Dec 2012
Location: Norway
Age: 23
Gender: Female
Nature: Calm
Same here.. Very helpful, this.

Especially in my case, where no tools exist for my desired tweak.
Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 06:26 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.