Main Menu
Main Page
Forums
New pages
Recent changes
Random page
Help

Glitches
Arbitrary code execution
Pokémon cloning
Pomeg glitch and Glitzer Popping
Tweaking and voiding
Glitches by generation
Glitch categories

References/Resources
Databases
Disassembly projects
The Big HEX List
Pokémon cheat codes
Pokémon glitch terminology
Useful tools
More

Affiliates
Legendary Star Blob 2 (Hakuda) (日本語/Japanese)
Pokémon Speedruns wiki (English)
PRAMA Initiative (Français/French)
MissingNo. Glitch City (Italiano/Italian)
Become an affiliate!

Technical
Site source code

Search Wiki

 

Search Forums

 

Author Topic: Editing the ROM, how would I make a custom textbox?  (Read 452 times)

0 Members and 1 Guest are viewing this topic.

0ErrorYT

  • GCLF Member
  • *
  • Offline Offline
  • Gender: Male
  • Dri REDGREENMOM MOM, are you ready?
    • View Profile
Editing the ROM, how would I make a custom textbox?
« on: April 26, 2018, 08:47:51 pm »
I'm trying to make something where when RST 38 is executed, the game jumps to a custom message saying something like "Pokemon has encountered a critical error. The game will be shut down to protect your save file." Then a safe game crash. Mostly to help me with ASM and coding in general, but I don't even know where to start, so I need help. I'm hoping to try and patch glitches in The game just for shits and giggles and experience with ASM. Any help is appreciated!

Also, do the contents of 0038 ram address matter?
Well ????? is a pokemon that can only be accesed by hacking the game
genrally with gameshark but the game shark code for it works in this way:
it tells the  game to make a certain pokemon appear what that pokemon is depends on the two pokemon digits in the code fore example bulabsuar code could be 4R (it isnt really) but if you put in a number for a pokemon that doesnt exist... the game wotn know what to make appear there for cusing its name sprite antacks etc to be nothing to do with real pokemon! :) :) :) hope u understood tis lol!!!

ISSOtm

  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Staff
  • *****
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: Editing the ROM, how would I make a custom textbox?
« Reply #1 on: April 26, 2018, 11:10:47 pm »
You should use pokered instead. Change all the RST vectors to NOPs, except 0038, which you should repoint to the blank space after the interrupt vectors (0061~0068, not sure) and put the func there.

There is no RAM address 0038. 0038 is in ROM.
"THOU SHALL NOT PASS !!"  RIVAL's effect, Gandalf.

Proudly glitching Pokémon Red and Yellow on a Black & White GB, Pocket GB, GB Color, GBA SP and new 3DS.

My Twitter (beware, I'm French)
My YouTube (same warning)

Here is an online tool to build 8F setups : GBz80 to Items !

They see me layzin', they ha-tin'...
Heavy contributor of the global augmentation of entropy (my room's is too damn high !)

0ErrorYT

  • GCLF Member
  • *
  • Offline Offline
  • Gender: Male
  • Dri REDGREENMOM MOM, are you ready?
    • View Profile
Re: Editing the ROM, how would I make a custom textbox?
« Reply #2 on: April 27, 2018, 08:40:25 pm »
I got the RST vectors changed, I got the text written, I just don't know the function. It wouldnt be a jp right?
Well ????? is a pokemon that can only be accesed by hacking the game
genrally with gameshark but the game shark code for it works in this way:
it tells the  game to make a certain pokemon appear what that pokemon is depends on the two pokemon digits in the code fore example bulabsuar code could be 4R (it isnt really) but if you put in a number for a pokemon that doesnt exist... the game wotn know what to make appear there for cusing its name sprite antacks etc to be nothing to do with real pokemon! :) :) :) hope u understood tis lol!!!

ISSOtm

  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Staff
  • *****
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: Editing the ROM, how would I make a custom textbox?
« Reply #3 on: April 28, 2018, 06:51:03 am »
What function?
"THOU SHALL NOT PASS !!"  RIVAL's effect, Gandalf.

Proudly glitching Pokémon Red and Yellow on a Black & White GB, Pocket GB, GB Color, GBA SP and new 3DS.

My Twitter (beware, I'm French)
My YouTube (same warning)

Here is an online tool to build 8F setups : GBz80 to Items !

They see me layzin', they ha-tin'...
Heavy contributor of the global augmentation of entropy (my room's is too damn high !)

0ErrorYT

  • GCLF Member
  • *
  • Offline Offline
  • Gender: Male
  • Dri REDGREENMOM MOM, are you ready?
    • View Profile
Re: Editing the ROM, how would I make a custom textbox?
« Reply #4 on: April 28, 2018, 10:53:26 am »
Never mind, I just changed a textbox instead, how do I jump to it? I can't use jp because the textbox is at 094B08
Well ????? is a pokemon that can only be accesed by hacking the game
genrally with gameshark but the game shark code for it works in this way:
it tells the  game to make a certain pokemon appear what that pokemon is depends on the two pokemon digits in the code fore example bulabsuar code could be 4R (it isnt really) but if you put in a number for a pokemon that doesnt exist... the game wotn know what to make appear there for cusing its name sprite antacks etc to be nothing to do with real pokemon! :) :) :) hope u understood tis lol!!!

ISSOtm

  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Staff
  • *****
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: Editing the ROM, how would I make a custom textbox?
« Reply #5 on: April 28, 2018, 03:12:20 pm »
What text box did you change? And what do you mean? You can't jump to a textbox.
"THOU SHALL NOT PASS !!"  RIVAL's effect, Gandalf.

Proudly glitching Pokémon Red and Yellow on a Black & White GB, Pocket GB, GB Color, GBA SP and new 3DS.

My Twitter (beware, I'm French)
My YouTube (same warning)

Here is an online tool to build 8F setups : GBz80 to Items !

They see me layzin', they ha-tin'...
Heavy contributor of the global augmentation of entropy (my room's is too damn high !)

0ErrorYT

  • GCLF Member
  • *
  • Offline Offline
  • Gender: Male
  • Dri REDGREENMOM MOM, are you ready?
    • View Profile
Re: Editing the ROM, how would I make a custom textbox?
« Reply #6 on: April 28, 2018, 03:50:02 pm »
I believe it was the one talking to mom before getting a Pokemon. How do I get to it then?
Well ????? is a pokemon that can only be accesed by hacking the game
genrally with gameshark but the game shark code for it works in this way:
it tells the  game to make a certain pokemon appear what that pokemon is depends on the two pokemon digits in the code fore example bulabsuar code could be 4R (it isnt really) but if you put in a number for a pokemon that doesnt exist... the game wotn know what to make appear there for cusing its name sprite antacks etc to be nothing to do with real pokemon! :) :) :) hope u understood tis lol!!!

Evie the Mother Hen ☽ ❤

  • Head Administrator
  • *****
  • Offline Offline
  • Gender: Female
  • I love My Melody. I want to be a mum. 🦋 ✿
    • View Profile
Re: Editing the ROM, how would I make a custom textbox?
« Reply #7 on: April 28, 2018, 05:09:26 pm »
Text is stored using a text code byte at the beginning of the text. While I don't know all of them examples are 00 (normal text), 08 (execute code) and the preset text boxes described here.

You can terminate your code with a 57 byte, and other control characters are documented on The Big HEX List

Without the disassembly (which I haven't used before to compile a ROM), then to locate the Mom text, try opening a hex editor (I normally use the freeware software HxD) and searching for "8C 8E 8C 9C 7F 52" (because that's the start of "MOM: RED" where 8C-7F are the characters up to ":" and 52 is the player's name.

As expected, you can find the text after the 00 text code; specifically the start of it is at 94B6D. Hence you can write anything you want here as long as it fits. Change 8C to 80 and it would say "AOM: RED (...) and so on.

If you want longer text and don't mind using a tool, you may be able to do it easiest with PokeText, although I'm unsure if it has any bugs or drawbacks or anything.

If you don't mind not editing the ROM to do it, then at D36C/D36D in RAM you will find the location pointer of the map's pointer table. Sounds complex but basically let's say you make this at 80DA (beginning of stored Pokémon). This would mean the first text pointer is at DA80, so at DA80 a value of say 00DB would be the beginning of the first text box's text code and contents. Then by writing your text there (at DB00) you can give Mom the custom text you want. For example, 00 80 81 82 57 (57 is the generic terminator here) would make her say "ABC[END]"



Say however anyway you wanted to make longer text for her permanently in the ROM. When you enter D36C is set to 6B 41. This means pointer 416B, but we still don't know the offset only the pointer which falls in the region of banked ROM (4000-7FFF). However, you can set a breakpoint on BGB emulator to 416B on read (go to the debugger by right clicking, then choose access breakpoints, then type in 416B and add it with "on read" checked, then talk to Mom).

After you've done that, go to 416B and you can find it's in bank 12. So our pointer is really 12:416B. Another way to find the bank (in hexadecimal) is to consult this list.

So what you'd need to do in short is to find a way of making the game load something other than 416B in bank 12 (although I'm unsure of further details however you can probably find how to do it browsing the disassembly).

Bank 12's offset for HxD is 0x12*0x4000=48000 and ends at 4BFFF. 4A390 is in bank 12 and appears to be the start of free data (all 00), so you could edit that. By converting it to a three byte pointer either by hand or by using a calculator, you get 12:6390.

So you would change the 416B write to a 9063 write, then at 9063 have a custom text pointer and at the pointer have your desired text (so for instance at 4A390 you could place 9065 and at 4A392 the text beginning with 00 and ending with 57 etc.

ISSOtm may be able to help if you want to generate a custom ROM from the disassembly instead.

Hope this helps and let me know if you have any questions. :)
« Last Edit: April 28, 2018, 05:11:10 pm by Torchickens »

✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿
Here have some free flowers on every post :)
✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿



(Images © Sanrio, Nintendo, Pokémon, HAL Laboratory)

✿ Hi, I'm Evie. Transgender woman but spiritually doesn't believe 'male'/'female' needs to be defined; lives more stereotypically like a woman. Call me whichever pronouns you like. :)

Feel free to contact me here about anything regarding the site.

Forgiveness. I feel that the more people pray to our greatest source/God/mathematical equality for world peace, the more and more it manifests into reality (until our next spiritual death).

Thank you Nyapon for this lovely artwork. :3