Notices
For all updates, view the main page.

 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.

#1
December 4th, 2012 (1:20 AM). Edited December 4th, 2012 by Darthatron.
 Darthatron 巨大なトロール。 Silver Tier Join Date: Jan 2006 Location: Melbourne, Australia Age: 25 Gender: Male Nature: Modest Posts: 1,152

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.

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

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

__________________
あなた は しきしゃ です
わたし は ばか です

#2
December 4th, 2012 (4:17 PM).
 Lost Heart ModeratorCS Join Date: Mar 2010 Age: 19 Gender: Male Nature: Quirky Posts: 3,511
Very nice. Well written, and you do a good job of explaining these foundational concepts.
__________________
mod github pair
#3
December 5th, 2012 (6:33 PM).
 ____^____ Join Date: Dec 2012 Gender: Male Posts: 4
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.
#4
December 5th, 2012 (7:26 PM).
 Darthatron 巨大なトロール。 Silver Tier Join Date: Jan 2006 Location: Melbourne, Australia Age: 25 Gender: Male Nature: Modest Posts: 1,152
Quote:
 Originally Posted by agentgeo Very nice. Well written, and you do a good job of explaining these foundational concepts.
Thank you very much.
Quote:
 Originally Posted by ____^____ 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.
__________________
あなた は しきしゃ です
わたし は ばか です
#5
December 6th, 2012 (7:35 AM).
 Iacobus sǝɯɐɾ Join Date: Dec 2003 Location: Belgium Age: 25 Gender: Male Posts: 62
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 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.
__________________
#6
December 6th, 2012 (1:27 PM). Edited December 6th, 2012 by miksy91.
 miksy91 Dark Energy is back in action! ;) Join Date: Oct 2008 Location: A small country in the North Gender: Male Nature: Relaxed Posts: 1,435
Quote:
 Originally Posted by Iacobus 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 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

CP of encountered pokemon in GO

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
#7
December 6th, 2012 (10:47 PM).
 Darthatron 巨大なトロール。 Silver Tier Join Date: Jan 2006 Location: Melbourne, Australia Age: 25 Gender: Male Nature: Modest Posts: 1,152
Quote:
 Originally Posted by Iacobus 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 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 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 It would be nice too, if people didn't post tutorials containing "Coming soon..." sections.
Thanks for the feedback.
__________________
あなた は しきしゃ です
わたし は ばか です
#8
December 7th, 2012 (3:30 AM).
 Iacobus sǝɯɐɾ Join Date: Dec 2003 Location: Belgium Age: 25 Gender: Male Posts: 62
@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.
__________________
#9
December 12th, 2012 (4:09 PM).
 Scrambledgraphics Join Date: Dec 2012 Location: Kanto Gender: Female Nature: Adamant Posts: 6
Really interesting. Any help with hacking is appriciated! It's because I am a newbie to hacking and etc.
__________________
Hacks I support:

#10
December 14th, 2012 (4:09 AM).
 Rain Dancer Wanderer Join Date: Dec 2012 Location: Norway Age: 25 Gender: Female Nature: Calm Posts: 52