Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2013-04-30 16:12:13

jacky
Member
Registered: 2013-01-06
Post 3/10

How to add a new type to RBY hack?

I want to add new type to my own hack. So how can I do that? or edit an old type? Thanks in adv

Offline

#2 2013-04-30 16:27:14

80C
Banned
Registered: 2013-03-16
Post 334/1,257

Re: How to add a new type to RBY hack?

Of course you can.

Check this:
http://hax.iimarck.us/topic/3315/

Remember that there's a search function in this forum, you may use that.


I left this forum.

Offline

#3 2013-05-01 08:03:43

jacky
Member
Registered: 2013-01-06
Post 4/10

Re: How to add a new type to RBY hack?

Thanks 80C.
But that tut only shows me how to edit strength/weakness. I want to add a completely new type, not edit an old type.

Last edited by jacky (2013-05-01 08:04:09)

Offline

#4 2013-05-01 08:25:01

Miksy91
Member
Registered: 2010-10-16
Post 1,638/2,317

Re: How to add a new type to RBY hack?

jacky wrote:

Thanks 80C.
But that tut only shows me how to edit strength/weakness. I want to add a completely new type, not edit an old type.

1. You repoint that weakness/strength table and add more content to it (for your new type)
2. Look where type names "Normal, Fire, Water, ..." are stored and how the coding for loading those work.
    --> And do "stuff" there.

At the moment, I can't pick up anything else you'd need for adding new types into the game.
Just modify those two pieces of code so that the game reads more types than originally, add names for them, and edit their properties (case 1.).


And if you're looking for editing Gold/Silver, the case is even much easier than this.
You can see (through that link) that "0A-12 = Blank", so there is plenty of room for adding new types without having to re-code anything (in case 2.).
You'll still have to add their properties to strength/weakness table first though.

Last edited by Miksy91 (2013-05-01 08:27:58)

Offline

#5 2013-05-01 09:08:00

jacky
Member
Registered: 2013-01-06
Post 5/10

Re: How to add a new type to RBY hack?

Miksy91 wrote:
jacky wrote:

Thanks 80C.
But that tut only shows me how to edit strength/weakness. I want to add a completely new type, not edit an old type.

1. You repoint that weakness/strength table and add more content to it (for your new type)
2. Look where type names "Normal, Fire, Water, ..." are stored and how the coding for loading those work.
    --> And do "stuff" there.

At the moment, I can't pick up anything else you'd need for adding new types into the game.
Just modify those two pieces of code so that the game reads more types than originally, add names for them, and edit their properties (case 1.).


And if you're looking for editing Gold/Silver, the case is even much easier than this.
You can see (through that link) that "0A-12 = Blank", so there is plenty of room for adding new types without having to re-code anything (in case 2.).
You'll still have to add their properties to strength/weakness table first though.

Thank a lot bro

Last edited by jacky (2013-05-01 09:09:30)

Offline

#6 2013-05-01 14:41:54

80C
Banned
Registered: 2013-03-16
Post 349/1,257

Re: How to add a new type to RBY hack?

Miksy91 wrote:

And if you're looking for editing Gold/Silver, the case is even much easier than this.
You can see (through that link) that "0A-12 = Blank", so there is plenty of room for adding new types without having to re-code anything (in case 2.).
You'll still have to add their properties to strength/weakness table first though.

Even RBY is easy like GSC, because it has even more blank spaces (and you may add the steel & dark types of Gold, just like KBM did, or, as Miksy said, add new types in the blank spaces).

There's a thing or two I wish know too, could you solve that doubts abou it, please?

the first is how I could repoint the type names and, in fact, know where's located the byte\s that indicates the table location (that I already know);

the second one is the same but for the weakness table.
I added successfully some new types' weaknesses in my hack (because there will be new types), but I'm gonna add another types (the total of the new types used in game will be 10, for now there are steel, dark, bird should have some weaknesses defined & moves assigned, [no spoiler]type that has actually no name and another one).


I left this forum.

Offline

#7 2013-05-01 15:29:58

Miksy91
Member
Registered: 2010-10-16
Post 1,641/2,317

Re: How to add a new type to RBY hack?

80C wrote:

There's a thing or two I wish know too, could you solve that doubts abou it, please?

the first is how I could repoint the type names and, in fact, know where's located the byte\s that indicates the table location (that I already know);

So you know the location of the table storing type names? In that case, you'll most likely find the pointer to the table somewhere close (in that same rom bank at least, but not necessarily). It works so that there is not just some magical pointer which can load the names of the types but instead, the whole coding behind it in which that pointer is actually only used as an address to tell the CPU, where to look for the names, that's all.

You'll never know, if you run into many matches by searching for specific bytes pointing to a certain table: "Which set of two bytes is used as pointing to the table?", and "Which is some other data?". But these kind of problems can be solved by studying the actual code close to that "possible pointer" and see if it has anything to do with the "type names" table or not.

Sometimes, you can work out things by simply trying "Would it work if I change this and that?", which I used to do in the past. But when you're restricted to something like: little space in the current rom bank, can't expand a table just by repointing it because it needs more "slots", studying the code with assembly and doing the required changes is really the only option.


Specifically, it's all about knowing assembly (which really isn't that hard!).

I personally couldn't follow machine instructions with a hex editor (or at least make anything out of it). That is why we've got assemblers, and editors which can somehow visualize binary (or "hexadecimal") code in a way we can understand.



ld a, (D151)
add a, 05
ld (D151), a
ret

This code specifically increases the value in ram address D151 by 5.
Which one looks most readable? That or...

FA 51 D1 C6 05 EA 51 D1 C9

...how it's written in rom.

Or possibly...

1111 1010  0101 0001....

Last edited by Miksy91 (2013-05-01 15:50:17)

Offline

#8 2013-05-01 17:39:34

80C
Banned
Registered: 2013-03-16
Post 353/1,257

Re: How to add a new type to RBY hack?

yeah, disassembler is really helpful for things such as scripts, internal game loading of screens, etc. or add\edit custom\normal routines... I ask usually the bytes that indicates the pointer (or sometimes only the bank) because I thought everything has something in the rom that indicates where is that part of code.

I'm interested in this... maybe to change the walking path of Oak that leads u 2 the lab or maybe for other routines, but... there isn't very much free space for the names close-by, and I saw hacks with new types\names such as pokemon aqua or brown, I thought they may have repointed, and at that time disassembly wasn't so developed... thats why I've asked this.


I left this forum.

Offline

#9 2013-05-01 17:40:51

80C
Banned
Registered: 2013-03-16
Post 354/1,257

Re: How to add a new type to RBY hack?

add-on
Oh, almost forgot, sometimes I use also bgb debugger.


I left this forum.

Offline

#10 2013-05-01 20:22:16

Miksy91
Member
Registered: 2010-10-16
Post 1,643/2,317

Re: How to add a new type to RBY hack?

Koolboyman could have moved the whole "type name loading" routine to another rom bank, I have for example done the same with trainer data with my own hack since there is not that much free space to work with it in G/S/C.

You'll trace back in code (with bgb) until you end up in a part where you can tell that the "previous instructions" weren't executed but instead, there was a JP code somewhere to the routine you were following. If that jump code came from some other rom bank, you can easily move the whole (sub)routine elsewhere. If not, trace back in code, move something else away or get more free space to work with by some other means.

Of course, JP can only set the Program Counter to another 16-bit value and in other words, you can't change rom banks with jump instruction only. I may be saying something wrong here, but you can change rom banks in R/B/Y by writing data to $2000, which tells Memory Bank Controller, which rom bank should be accessable as variable rom bank at the moment.

This is handled in pokemon G/S with predefined routine at rom address $10 (with instruction "rst $10"), but I don't think any other predefined asm routine exists in the start of the rom (which you could access with "rst" instructions) in R/B/Y. You could either try tracking that kind of routine down (should be rather simple), or write your own (which really won't be necessary and will just waste space, yet I'll do this sometimes for practising stuff).


Pokemon Silver (U):

Rom Bank Switch (rom bank loaded in register a)

00:0010  ld (FF9F), a
00:0012  ld (2000), a
00:0015  ret

Call routine from another rom bank (a: bank, hl: address) --> 00:2E27
// accessable with rst $8

Last edited by Miksy91 (2013-05-01 20:33:04)

Offline

Board footer

Powered by FluxBB