• 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?".
  • Forum moderator applications are now open! Click here for details.
  • 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.

ROM Hacking Discussions

Status
Not open for further replies.

Sawakita

Not Invented Here
181
Posts
13
Years
  • Age 34
  • Seen Nov 17, 2019
New topic for discussion:

If you were able to make a new ROM Hacking tool, what would you have it do and why would you decide to make it?
Waiting for your answers on this.
If I could, I would write a disassembler, with tracing functions, smart enough to be able to distinguish between code and data. It would save a lot of time...
 

IIMarckus

J946@5488AA97464
402
Posts
16
Years
  • Seen Feb 21, 2024
If I could, I would write a disassembler, with tracing functions, smart enough to be able to distinguish between code and data. It would save a lot of time...
I think an easier way to do this would be to take an existing open‐source emulator (Gambatte would be a good choice) and modify it to disassemble the current instruction. Play through the game a few times, save the log, and then write some text processing scripts to sort and remove duplicate entries.
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
I think an easier way to do this would be to take an existing open‐source emulator (Gambatte would be a good choice) and modify it to disassemble the current instruction. Play through the game a few times, save the log, and then write some text processing scripts to sort and remove duplicate entries.

That would definitely not be easier.
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
Well there really aren't that many commands in the ARM7/thumb codeset, so simply writing it from scratch isn't super difficult anyway. And through past experience, reading through some code (that does something similar to what you want) to find a tiny part and then editing it, is a lot more difficult than just doing something yourself. And as you said, it wouldn't even end up disassembling all the code anyway.
 

Sawakita

Not Invented Here
181
Posts
13
Years
  • Age 34
  • Seen Nov 17, 2019
Well there really aren't that many commands in the ARM7/thumb codeset, so simply writing it from scratch isn't super difficult anyway. And through past experience, reading through some code (that does something similar to what you want) to find a tiny part and then editing it, is a lot more difficult than just doing something yourself. And as you said, it wouldn't even end up disassembling all the code anyway.
Actually I was referring to SHARP z80 (even though that's not a big difference, for the topic itself).
And through past experience, reading through some code (that does something similar to what you want) to find a tiny part and then editing it, is a lot more difficult than just doing something yourself. And as you said, it wouldn't even end up disassembling all the code anyway.
I have to disagree: if the code is well written, it's pretty easy to find where is the part one's interested in (I gave a look at Gambatte's source, and finding the part I need to edit was pretty fast). Adding a tracing/logging funtion shouldn't take too much time.

Anyway what I really meant was not a program that simply dumps the code in "mnemonics" (BGB and a Pokeanalysis ".c/.h" module do it as well). I was thinking of a program that can actually label every address the code refers to (routines' beginnings, jumps' offsets, and so on), and can format data as "Define Byte", "Define Word" (or in structured macros, but that would be too much, probably), if you get what I mean.

Because, the problem with disassembling code "by hand" is not the difficulty of finding where the stuff is located or figuring out how it works (by the way, I find it the most entertaining part); the problem is instead arranging it in the format that the assembler needs in order to assemble it correctly.
 

IIMarckus

J946@5488AA97464
402
Posts
16
Years
  • Seen Feb 21, 2024
Actually I was referring to SHARP z80 (even though that's not a big difference, for the topic itself).

I have to disagree: if the code is well written, it's pretty easy to find where is the part one's interested in (I gave a look at Gambatte's source, and finding the part I need to edit was pretty fast). Adding a tracing/logging funtion shouldn't take too much time.

Anyway what I really meant was not a program that simply dumps the code in "mnemonics" (BGB and a Pokeanalysis ".c/.h" module do it as well). I was thinking of a program that can actually label every address the code refers to (routines' beginnings, jumps' offsets, and so on), and can format data as "Define Byte", "Define Word" (or in structured macros, but that would be too much, probably), if you get what I mean.

Because, the problem with disassembling code "by hand" is not the difficulty of finding where the stuff is located or figuring out how it works (by the way, I find it the most entertaining part); the problem is instead arranging it in the format that the assembler needs in order to assemble it correctly.
Of course, it would be impossible to get things perfect. But here are some ideas:
  • Nothing has to be disassembled in order; precede each line with its address so you can sort it later. (Better idea: precede it with address × 2. Then you can precede labels with address × 2 − 1.
  • Keep around a boolean true/false for each value in memory, so you don't get in an infinite loop.
  • Here's an example of properly labeling things: when you encounter loads to a and hl, put them in a queue before printing them out. If they're followed by a call to $35CD, replace the constants with the appropriate labels and BANK() macros, then flush the queue.
 

Sawakita

Not Invented Here
181
Posts
13
Years
  • Age 34
  • Seen Nov 17, 2019
Of course, it would be impossible to get things perfect. But here are some ideas:
  • Nothing has to be disassembled in order; precede each line with its address so you can sort it later. (Better idea: precede it with address × 2. Then you can precede labels with address × 2 − 1.
  • Keep around a boolean true/false for each value in memory, so you don't get in an infinite loop.
  • Here's an example of properly labeling things: when you encounter loads to a and hl, put them in a queue before printing them out. If they're followed by a call to $35CD, replace the constants with the appropriate labels and BANK() macros, then flush the queue.
These are some enlightening advices, thank you. I'll try to follow them when I'll get around starting that project.
I'm not sure I understood right the thing about putting [address x 2], though. Could you clarify it a bit?
 

IIMarckus

J946@5488AA97464
402
Posts
16
Years
  • Seen Feb 21, 2024
These are some enlightening advices, thank you. I'll try to follow them when I'll get around starting that project.
I'm not sure I understood right the thing about putting [address x 2], though. Could you clarify it a bit?
It is just there for sorting purposes.

Say you have a line of code like this:
Code:
ld a,1
nop
ld hl,$1234
jr z,−5
If you're partially or fully emulating the processor, you probably won't be diassembling from beginning to end, but rather following jumps, so you need some way to sort the text file later. One way is to prefix each instruction with its address, then sort the file after you're done disassembling (e.g., by running it through the Unix program "sort -u").
Code:
10000 ld a,1
10001 nop
10002 ld hl,$1234
10003 jr z,−5
But if you do that, you won't see that the load to hl needs a label beforehand. So you could double the number you prefix with, and subtract 1 to force labels to appear in the right location.
Code:
20000 ld a,1
20002 nop
20004 ld hl,$1234
20006 jr z,addr00_2712
20003 addr00_2712:
Now this can be sorted and things will appear in the right places.
 

Sawakita

Not Invented Here
181
Posts
13
Years
  • Age 34
  • Seen Nov 17, 2019
A-ha! That's all clear now, thanks again. This might be a good opportunity to get more confident with C (so I can also learn how to fix the flaws RGBDS has; and you know what I'm talking about!).
 

ThaReaper01

I'm on my way...
18
Posts
13
Years
  • Age 29
  • Seen Oct 25, 2014
I believe that there is a thread over in Research & Development regarding doing exactly that. In fact, I think a patch was released that implements that feature in Fire Red.

Cheers for that. I looked there, but didn't find any downloads. Just a discussion thread.

I'm sure there was a physical/special split for GBA games in the Research and Development threads. Search there, but it does have... Issues.

I looked but couldn't find anything.
 
Last edited:

Banjora Marxvile

hOI!!!!!! i'm tEMMIE!!
3,496
Posts
15
Years
  • Age 30
  • Seen yesterday
I looked but couldn't find anything.

Right, I have a free few minutes...

Oh well would you look at this! The first thing in Research and Development, and it has a patch apparently! Seriously, it is the top thing in the R&D section, so your search wasn't very thorough.

http://www.pokecommunity.com/showthread.php?t=234550

Read the entire thread, the first patch isn't necessarily what you may want, but a user called Windslash made a patch of what you want. Still in development though.
 

Truality

Left for good
1,006
Posts
12
Years
  • Age 32
  • Seen May 17, 2013
So, in continuation to the topic I started, here's my own response:

If you were able to make a new ROM Hacking tool, what would you have it do and why would you decide to make it?
If I could, I would create a new tile/titlescreen editing & inserting program. More easy, handy to use and with various bookmarks from the ROMs. All the old ones are either not working or are outdated in some way (afaik)..
 

Gamer2020

Accept no Imitations!
1,062
Posts
15
Years
New topic for discussion:

If you were able to make a new ROM Hacking tool, what would you have it do and why would you decide to make it?
Waiting for your answers on this.
If I could I would write a program that downloaded all the programs I needed to ROM hack and organized them in a simple GUI.
 

Truality

Left for good
1,006
Posts
12
Years
  • Age 32
  • Seen May 17, 2013
New topic for you then:

What do you people find good to be a small project? Looking at the sideshow showcase for a while, I gained the opinion that most projects there are too expected. Still, I also think that people do not take these projects as seriously as they should. Not only the viewers, but the creators, too.

Morevoer, is it correct to assume that a pipedown happened in ROM Hacking-generically speaking-since last winter? (that's when I became less and less active)

Do you think it'll last or would you have a prediction about a change? (for example, something new on the DS hacking environmet)
 

lord_hardware

Lord Hardware
17
Posts
16
Years
  • Age 33
  • Seen Nov 6, 2016
I hadn't seen it, but what exactly would the debug rom open up? (besides easier way of tracking down inbuilt flags and integers?)
 

masterquestmq

Enthusiastic Rom Hacker
194
Posts
13
Years
  • Seen Nov 19, 2023
I've been searching the forums for sometime and still haven't found an answer.

Has any1 managed to edit the number of PCs and Flying position in FR?
 

cbd98

A bouquet of oopsie dasies
333
Posts
13
Years
  • Seen Jan 18, 2021
I got a great idea while playing Ruby today, but I'd love other people's opinions. Basically, you get your own gym after the Elite 4, and you can go to it whenever you want. I would be set up kind of with the Battle Tower system of 7 battles and then some reward, like BP. You could also customize the style of your gym and place in special items. So, whaddya think?
 
Status
Not open for further replies.
Back
Top