edit text ppu

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

TheBoxGamePL
Posts: 106
Joined: Thu Aug 10, 2023 3:08 am

edit text ppu

Post by TheBoxGamePL »

Hello, I have a question. Can someone tell me how to edit text in PPU in the game Dynowarz Destruction of Spondylus? I made a table with the missing letters in YY-CHR because there were missing letters like Z J and so on, but now the problem is different. When I want to change the word GRK PUNCH and others to another word, the PROGRAM shows that there is no such word in PPU, even though when I loaded the table it shows that I am in PPU.

Can someone help me with this or give me some program that will detect unavailable words such as GRK PUNCH AND OTHERS even though I created a table from the title screen and in the game?
Attachments
Screenshot_2025-05-08-09-40-32-228_com.eltechs.ed.jpg
Screenshot_2025-05-08-09-40-27-299_com.eltechs.ed.jpg
Screenshot_2025-05-08-09-40-43-008_com.eltechs.ed.jpg
Screenshot_2025-05-08-09-38-28-590_com.eltechs.ed.jpg
Screenshot_2025-05-08-09-37-38-652_com.eltechs.ed.jpg
Screenshot_2025-05-08-09-35-47-772_com.eltechs.ed.jpg
Screenshot_2025-05-08-09-35-15-041_com.eltechs.ed.jpg
IMG_20250508_093318.jpg
User avatar
Ben Boldt
Posts: 1379
Joined: Tue Mar 22, 2016 8:27 pm
Location: Minnesota, USA

Re: edit text ppu

Post by Ben Boldt »

I am not sure this is the best way to approach this but here is what I have done for something like this before. You never know how the code works that writes the text to the nametable, so you have to find the code and see how it works. I used FCEUx but I am guessing you can do something similar and probably better in Mesen.

I opened the Name Table Viewer and I hovered the mouse over each character. The nametable address that you are hovering over is shown at the bottom of the window. (Due to mirroring, there may be 2 or more of these addresses.) I then used the debugger to set a breakpoint on writes to that PPU memory address. Then reset the game. You can find the spot that writes the character to the nametable this way, and it will show you the specific part of the code that wrote it. You can then look at the code to figure out how it works and where it gets its data from, etc, so you can modify it.

Note that there are probably a lot of different places that write to the nametable, including init functions that might write 00s to the full memory, etc. You may need to look at multiple writes to that same location until you find the one where the correct character appears on the screen. i.e. clicking Run again, waiting for another breakpoint to happen, etc.
User avatar
Ben Boldt
Posts: 1379
Joined: Tue Mar 22, 2016 8:27 pm
Location: Minnesota, USA

Re: edit text ppu

Post by Ben Boldt »

Digging into this a little bit, I found this in the english version:

nt.png
rom.png
You can see, there are some interleaved bytes in the ROM. Then I edited it:
edithex.png
tbg.png
TheBoxGamePL
Posts: 106
Joined: Thu Aug 10, 2023 3:08 am

Re: edit text ppu

Post by TheBoxGamePL »

thank you buddy can you search for these addresses in the HXd program because I need to change them
Attachments
Screenshot_2025-05-09-10-01-14-430_com.explusalpha.NesEmu.jpg
Screenshot_2025-05-09-10-03-38-370_com.explusalpha.NesEmu.jpg
TheBoxGamePL
Posts: 106
Joined: Thu Aug 10, 2023 3:08 am

Re: edit text ppu

Post by TheBoxGamePL »

Thanks
Attachments
Screenshot_2025-05-09-10-03-38-370_com.explusalpha.NesEmu.jpg
Screenshot_2025-05-09-10-01-14-430_com.explusalpha.NesEmu.jpg
Screenshot_2025-05-09-10-00-03-603_com.explusalpha.NesEmu.jpg
Screenshot_2025-05-09-09-59-55-908_com.explusalpha.NesEmu.jpg
Screenshot_2025-05-09-09-59-34-672_com.explusalpha.NesEmu.jpg
User avatar
Ben Boldt
Posts: 1379
Joined: Tue Mar 22, 2016 8:27 pm
Location: Minnesota, USA

Re: edit text ppu

Post by Ben Boldt »

I can help teach you how to find it yourself. I have some instructions above with FCEUx. Please tell me where you get stuck and I can help.
User avatar
segaloco
Posts: 568
Joined: Fri Aug 25, 2023 11:56 am
Contact:

Re: edit text ppu

Post by segaloco »

The charset encoding is just the positions of the characters in the background CHR section, so you can handle this sort of thing as a general case of encoding conversion. The canonical way on UNIX systems is the iconv(1) utility which takes two files, each mapping a character set to a series of symbolic names. You produce one for the source and one for the destination, essentially you're saying "convert every 0x0A to 0x41", "convert every 0x0B to 0x42" etc.

As for the symbolic name, this is just something like <U0041> for "UTF-8 code-point 0x41" or <KEYA> for "the A key". This is used to join the source and destination encodings between the two files. Fair warning, POSIX iconv(1) is picky in that if you use either a user-supplied source or destination charmap, you have to provide both, you can't say go from a custom Nintendo encoding to the system's UTF-8, you have to spin a destination UTF-8 mapping yourself. From the standard:
The iconv utility can be used portably only when the user provides two charmap files as option-arguments. This is because a single charmap provided by the user cannot reliably be joined with the names in a system-provided character set description.
In other words, the standard defines the format of charmap files and that selection of system charmaps by symbolic name should work, but makes no guarantees of the symbolic names for individual characters used. However <UXXXX> is a widely-used convention when UTF-8 is involved.

The -c and -s options help with leveraging only partial charmap files but it is generally suggested to have a mapping for every possible character. Non-printable source bytes can be simply converted to unrelated random characters in the host charmap. I'd generally suggest non-printing and/or non-textual characters, that'll help with scenarios like text recognition.

So basically:

Code: Select all

iconv -f ./srcmap -t ./destmap rom.nes | strings
May yield some interesting results if srcmap maps CHR codepoints to symbolic names that then are mapped to the system charmap.

What's helpful is the charmap formats are the same, so you can even use iconv(1) to first translate a string from the ROM to UTF-8, edit that string in a host text editor, then use iconv(1) with the charmaps swapped to insert the text back in with, for instance, dd(1). The whole thing could even be setup as a pipeline akin to (options omitted):

Code: Select all

dd | iconv | sed 's///g' | iconv | dd
meaning snip the piece out, convert to UTF-8, make some systematic edit, convert back to the game's encoding, then insert the snip back in. Make the dd(1), iconv(1), and sed(1) parameters variables and you've got a nice little spot text editor for NES ROMs as long as you draft charmap files reflecting the realities of the background CHR.

Granted you can always consider seeing if your integrated tool of choice such as a text editor, debugger, IDE, what have you, has a memory viewer in which you can set the encoding. However, I find iconv(1) helpful because it acts as a filter so can be hooked up down in just about anything I need. As always, found on any UNIX near you, check into compatibility layers if you're on WinNT.

Edit: For posterity, I wanted to add that this editing mechanism only works if the original and edited strings are the same length, start changing the lengths of strings in ROMS arbitrarily without keeping bound and you break pointers all over the place.
Last edited by segaloco on Sun May 11, 2025 10:35 am, edited 1 time in total.
TheBoxGamePL
Posts: 106
Joined: Thu Aug 10, 2023 3:08 am

Re: edit text ppu

Post by TheBoxGamePL »

I got it all sorted out but now I have another problem because I'm talking about the game Summer Carnival 92 Recca, I want to change the inscription complete to finished and game over to the end of the game but it's not there anywhere because the table is a bit weird

could you find me an address where the words complete and game over are located
Attachments
Screenshot_2025-05-10-08-44-24-131_com.explusalpha.NesEmu.jpg
Screenshot_2025-05-10-08-45-01-820_com.explusalpha.NesEmu.jpg
Screenshot_2025-05-10-08-48-25-688_com.eltechs.ed.jpg
Screenshot_2025-05-10-08-47-48-080_com.eltechs.ed.jpg
Screenshot_2025-05-10-08-47-45-066_com.eltechs.ed.jpg
tepples
Posts: 22898
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: edit text ppu

Post by tepples »

Open Sprite Viewer. If you see the "GAME OVER" letters there, you won't be able to make "END OF GAME" (what is this? Zoop?) because the text is written with sprites, and only 8 sprites can be displayed on the same scanline.

First, you'll want to set the mapping on the second pattern table (the one with sprite tiles) to 8x16 so that the tiles line up. This will show most of the alphabet in tiles $00-$3F.

Methods that game engines use to draw sprites differ more than how they draw text to the nametable. You'll probably need to do a lot more reverse engineering of the program code, working backward from the output (sprites on screen) to the input (metasprite tables in ROM). First you'll need to figure out where in RAM the game stores its 256-byte "shadow OAM" (display list where the CPU builds sprite positions). Put a write breakpoint on $4014; any value written is the high byte of the starting address of shadow OAM. For example, many games write $02, which causes the CPU to copy 512 bytes from $0200-$02FF to object attribute memory (OAM) on the PPU. Then by correlating PPU Viewer, Sprite Viewer, and Hex Editor, you can find where in RAM it writes the sprites. By putting a write breakpoint on addresses in shadow OAM, you can find what code is writing to shadow OAM and what table it's reading in ROM.
TheBoxGamePL
Posts: 106
Joined: Thu Aug 10, 2023 3:08 am

Re: edit text ppu

Post by TheBoxGamePL »

Can you explain it to me in more detail, how to handle it, for example like in dynowarz in the pictures, because I don't get it
TheBoxGamePL
Posts: 106
Joined: Thu Aug 10, 2023 3:08 am

Re: edit text ppu

Post by TheBoxGamePL »

this thing has a mirror image, we'll play around in Djinn Tile Mapper and I found it but I can't find the game over text
Attachments
Screenshot_2025-05-11-09-21-54-141_com.eltechs.ed.jpg
Screenshot_2025-05-11-09-21-37-318_com.eltechs.ed.jpg
TheBoxGamePL
Posts: 106
Joined: Thu Aug 10, 2023 3:08 am

Re: edit text ppu

Post by TheBoxGamePL »

Look
Attachments
Screenshot_2025-05-11-09-21-37-318_com.eltechs.ed.jpg
Screenshot_2025-05-11-09-21-54-141_com.eltechs.ed.jpg
Screenshot_2025-05-11-09-48-37-629_com.eltechs.ed.jpg
Bavi_H
Posts: 227
Joined: Sun Mar 03, 2013 1:52 am
Location: Texas, USA
Contact:

Re: edit text ppu

Post by Bavi_H »

tepples wrote: Sat May 10, 2025 6:58 am Open Sprite Viewer. If you see the "GAME OVER" letters there, you won't be able to make "END OF GAME" [...] because the text is written with sprites, and only 8 sprites can be displayed on the same scanline.
Note: TheBoxGamePL appears to be using a version of FCEUX which doesn't have a sprite viewer. (It looks like the Qt/SDL version of FCEUX has a Sprite Viewer, but the Windows version of FCEUX does not.)

As an alternative, you can do the following:
  1. Once you are on a screen with the text you are interested in, pause the emulator.
  2. Go to the Config menu, the Display sub-menu, then uncheck the item "Graphics: BG" leaving only "Graphics: OBJ" checked. When the emulator draws another frame, these display settings will hide the background tiles leaving only the sprite tiles showing.
  3. Press the shortcut key for Frame Advance to draw one frame. (I believe the Frame Advance key is "\" by default, but you can go to the Config menu and the command "Map Hotkeys" to check.)
TheBoxGamePL
Posts: 106
Joined: Thu Aug 10, 2023 3:08 am

Re: edit text ppu

Post by TheBoxGamePL »

I did as you wrote but it didn't show the hidden tiles, damn
Attachments
Screenshot_2025-05-11-12-24-01-217_com.eltechs.ed.jpg
TheBoxGamePL
Posts: 106
Joined: Thu Aug 10, 2023 3:08 am

Re: edit text ppu

Post by TheBoxGamePL »

<link to commercial rom download removed by mods>

Could you please help me sort this out because it doesn't show me the tiles?
Post Reply