• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Tool: PokeEdit - Gen 2 ROM Editor

masterxy

Pokémon Breeder
23
Posts
10
Years
Yay, first post!

Well to just quickly introduce myself: I'm really obsessed with Pokemon as well as Computers and I got into ROM hacking a while ago.
However I really love the charm of Gen 2 and since there is a lack of hacking/editing tools for gen 2 as well as not very much general ROM information (at least it seems so to me) I decided to start a general editor for second gen ROMs.
I'm still figuring out the ROM structure and stuff like where the game gets it's pointers from to allow adding new data in the future.
Atm the editor is capable of editing existing moves and searching for free data blocks in the ROM but with time going on I will add more things like editing Pokemon, Trainers etc.

I'm putting this thread up to see if there's any appreciation for gen 2 tools as well as getting some detailed info about Gen 2 roms (For instance where the game stores pointers to pointer tables etc, atm I just used a HEX editor to find the pointer tables manually)

I'd be more then happy if you try it out and tell me what features you'd whish or if there's any errors. Created in Visual Studio C# so it will need Net Framework 4.5 to run.
 

masterxy

Pokémon Breeder
23
Posts
10
Years
So I've been getting personal response to this thread and one reaction was to lower the required Net Framework target (which I should've done to begin with). Well I lowered it to 4.0, couldn't go any lower though.

Current Development Overview
I added some new things, but I will wait with the upload. Want to finish them and do some testing. I added the option to rename Attacks, will add Attack descriptions too (Those are accessed via pointer table so it should be easy repointing them)
One thin I'm trying to find out is where the data for increased crit chance of attacks is stored since it's not in the move data itself. I think I read something about a list with all the attacks that have increased crit chance but I've not found it yet.

The type editor is almost ready. Renaming Types (even the unused BIRD type and the types using the text from the NORMAL type) works and it repoints text automatically if needed. Didn't take too long to find those pointer tables as well as the corresponding pointers to those tables. Editing type effectiveness is done pretty much but it gets a littly tricky adding new effectiveness values other then "Normal damage" since there's not much free space in that particular bank. Since those data is stored pretty stupid (just a long byte list without special pointers) if you repoint it, you have to repoint ALL of it but the available free space left in the bank is actually smaller then the initial type effectiveness data. I fear there's nothing that you can do about that.

Repointing stuff has worked so far though I might just be lucky cause I'm not sure if I'm calculating pointers right since I've different approaches. Atm I'm doing: (Address % 0x4000) + 0x4000
I've seen some approaches where you subtract 0x4000, change nothing, add 0x4000 or even add 0x8000 dpending on the pointer value O.o
So correct me if I made some mistake that just seemed to work in all my testcases ^^

TL;DR
As stated above, I'll upload the next version when the attack & type editors are finished. I'll probably include the source code (since I've seen enough people ranting about developers not doing that xD) although it's really messy since I don't usually program in C# and I think many things could be done better (But hey! Free source code!).
 

miksy91

Dark Energy is back in action! ;)
1,480
Posts
15
Years
Nice to see you're creating stuff that's handy for hacking the gen II games. There are really not many of those out there.
You should upload this tool elsewhere as well though; for example Skeetendo Inc. and possibly PHO. There are others there who could find it useful.

One thin I'm trying to find out is where the data for increased crit chance of attacks is stored since it's not in the move data itself. I think I read something about a list with all the attacks that have increased crit chance but I've not found it yet.
I believe that is part of the asm routine of the move that has an enhanced crit. hit ratio (and has nothing to do with attack data itself).

Repointing stuff has worked so far though I might just be lucky cause I'm not sure if I'm calculating pointers right since I've different approaches. Atm I'm doing: (Address % 0x4000) + 0x4000
I've seen some approaches where you subtract 0x4000, change nothing, add 0x4000 or even add 0x8000 dpending on the pointer value O.o
So correct me if I made some mistake that just seemed to work in all my testcases ^^
Your method for calculating the pointer value works in every case when we are pointing to a variable rom bank (= pointing to rom, but not in rom bank 0). So yeah, you've got it correct.

Rom bank 0 (data area 0x0 - 0x3FFF) can be pointed to with pointers values between 00 00 and FF 3F, and all the other parts of the rom with pointer values between 00 40 and FF 7F. Apart from those, we can also point to stuff in ram by setting our pointer to something higher than 00 80.

But hey, keep up the good work and if you're looking for some more attention, you should create accounts in those forums as well and post your stuff there. Crystal hacking doesn't really need any tools because of diassembly, but we don't have that for Gold and Silver yet so hacking those is pretty tool-based.

P.S
Those others pointer calculating methods you mentioned there work so that they just take the last four digits of the address and then "convert" that to a value that is between 0x4000 and 0x7FFF with the right addition/subtraction by a multiple of 0x4000. If you try it out for yourself, you can see why it works too. Not that I would program an algorithm that uses such method myself, hahha. :)
 

masterxy

Pokémon Breeder
23
Posts
10
Years
Thanks for your reply :)

I believe that is part of the asm routine of the move that has an enhanced crit. hit ratio (and has nothing to do with attack data itself).

I don't think so, since those moves don't have a custom effect byte set, like I thought they would. So e.g. Slash's move data uses effect byte 0 which is "no effect" like Tackle has for instance. So that move would use the default asm routine I guess, still slash has increased hit ratio. That means the crit chance is either hardcoded in the attack routine (which would take up too much space I guess) or there's a list of moves that have incresed hit chance.

I'll probably register at other formums too when this tool has gotten to a stage where it will be more useful than now, for now I'll stick to this community :)

Crystal hacking doesn't really need any tools because of diassembly

What does that mean? You can disassemble Crystal but not Gold and Silver? How so? I just know little about assembly.
 

miksy91

Dark Energy is back in action! ;)
1,480
Posts
15
Years
I don't think so, since those moves don't have a custom effect byte set, like I thought they would. So e.g. Slash's move data uses effect byte 0 which is "no effect" like Tackle has for instance. So that move would use the default asm routine I guess, still slash has increased hit ratio. That means the crit chance is either hardcoded in the attack routine (which would take up too much space I guess) or there's a list of moves that have incresed hit chance.
I don't remember clearly enough since I have never really played with attacks that much either, and besides, been quite long since I have done GSC hacking as well.
But I'd say that the effect byte is just a value that tells what kind of effect the move has, but I believe that the move has its own asm routine as well. could be totally wrong about this if the animation is simply determined by the id value of the move as well, and so, what would be the point of this additional routine?

If no such routine exists, I don't really know what could cause the critical hit ratios to be different. Are you sure that they are actually? I remember that the ratios are different for some moves in gen I but don't remember them "differing" in gen II.

What does that mean? You can disassemble Crystal but not Gold and Silver? How so? I just know little about assembly.
We have a fully functioning disassembly for pokemon crystal (u) rom that others that Skeetendo Inc. have written, but no such diassembly exists for Gold or Silver.
https://github.com/kanzure/pokecrystal
 

masterxy

Pokémon Breeder
23
Posts
10
Years
But I'd say that the effect byte is just a value that tells what kind of effect the move has, but I believe that the move has its own asm routine as well. could be totally wrong about this if the animation is simply determined by the id value of the move as well, and so, what would be the point of this additional routine?

Well I'm pretty sure about what all the bytes in the move data itself do, what I'm guessing about the effect byte is, that it uses a default attack routine for moves with the effect byte 0 and that all the other effect bytes define custom attack routines but don't take my word on that. That's just what I think and would do as a programmer since having an effect byte AND a custom routine for every move would be a waste of space. But I think I saved a link to that post about the crit data somewhere on my other pc so when I get to my parents place again I'll probably find out ;)

A different thing I'm wondering is how big is the chance that a pointer to some data occures more then one time in a bank? I'm currently in a situation where I calculated a pointer from an offset and I found that pointer 2 times in the same bank both times with a leading 21 instruction. I noticed the difference when repointing the second one but didn't really notice one on the first. Guess that needs some more investigation.
 

miksy91

Dark Energy is back in action! ;)
1,480
Posts
15
Years
Well I'm pretty sure about what all the bytes in the move data itself do, what I'm guessing about the effect byte is, that it uses a default attack routine for moves with the effect byte 0 and that all the other effect bytes define custom attack routines but don't take my word on that. That's just what I think and would do as a programmer since having an effect byte AND a custom routine for every move would be a waste of space. But I think I saved a link to that post about the crit data somewhere on my other pc so when I get to my parents place again I'll probably find out ;)
Yeah, I guess you're right. The effect byte probably works as the index value of some pointer table of the asm routines actually..

A different thing I'm wondering is how big is the chance that a pointer to some data occures more then one time in a bank? I'm currently in a situation where I calculated a pointer from an offset and I found that pointer 2 times in the same bank both times with a leading 21 instruction. I noticed the difference when repointing the second one but didn't really notice one on the first. Guess that needs some more investigation.
If that same data structure has to be accessable from several different routines, it's totally possible. In this case, both of those "21 + [pointer]" cases indeed access that data.

"21 + 2-byte value" is "load HL with $address" asm instruction. Like it says, it simply loads a 16-bit value to register pair HL for usage. HL is the most used 16-bit register pair in GB/C CPU language because most opcodes that work with register pairs are related to using HL as part of the opcode.
http://nemesis.lonestar.org/computers/tandy/software/apps/m4/qd/opcodes.html

P.S
Trying to figure out how certain data structures work is waaay easier if you play around with bgb (which has a built-in debugger) or Gameboy ASM editor. Both of them should be downloadable in romhacking.net.
 
50
Posts
12
Years
  • Seen Mar 5, 2022
I know im off topic but i dont want to wait to get approve to make a new topic so here goes, Ive notice many tools do not edit the AI of the pokemon games difficulty mainly the trainer editors so, ill make one, but what language would i need to learn, and what compiler would i use? its for pokmeon g/c/s. thx. Hopefully if i can make one I will release it haere so you can edit the game even better.
 

masterxy

Pokémon Breeder
23
Posts
10
Years
I know im off topic but i dont want to wait to get approve to make a new topic so here goes, Ive notice many tools do not edit the AI of the pokemon games difficulty mainly the trainer editors so, ill make one, but what language would i need to learn, and what compiler would i use? its for pokmeon g/c/s. thx. Hopefully if i can make one I will release it haere so you can edit the game even better.

I think (I read that somewhere) that the difficulty of the AI is based off the prize money you get by winning.
I used C# but you can really use almost any programming language that can edit files.
 

masterxy

Pokémon Breeder
23
Posts
10
Years
Seems like a forum issue? I will try reuploading it when I get the time to look for the tool. Keep in mind it's not finished (and probably won't ever be at this point).
 
16
Posts
5
Years
Hey, I'm sorry if i am wasting your time but I noticed the link doesn't work anymore. Did you delete it? Because I'm trying to make a pokemon crystal rom hack...
 

masterxy

Pokémon Breeder
23
Posts
10
Years
Sorry, I stopped working on it since there's not really a need for the tool anymore and the only thing I got implemented so far was move editing.
 
510
Posts
11
Years
  • Seen today
Considering that Pok?mon Crystal has been completely disassembled (pokecrystal), editors and tools became virtually irrelevant. Except map editors, but there's Polished Map for that.
 
Back
Top