ROMHacking Thread

A forum for creative people.
User avatar
Garrett Gilchrist
Site Admin
Posts: 7861
Joined: Tue Feb 12, 2013 1:23 am

ROMHacking Thread

Post: # 11035Post Garrett Gilchrist »

NES Romhacking
Tools used:

Photoshop (or other art program, such as Aesprite, Tiled, Clip Studio Paint)

Mesen (NES emulator, HDPacks, Nametable dumping, sprite/layout/graphics viewing, etc)

FCEUX (NES emulator, hex editor for real-time reprogramming with text table support)

Shiru's NES Screen Tool (Background/sprite graphics layout design)

YY-CHR (graphics replacement)

Hex editor (any will do)

Notepad

Oriton table creator (text table creation)

Lunar IPS (create/run IPS patches, used to distribute ROMhacks as "changed bytes only" for copyright reasons)

CADEditor for level editing

--------------------------------


The graphics (CHR) bank in an NES game is a 128x128 image that looks like this:

Image

Every square there is a new 8x8 sprite.


Here's one of the sprite sheets from Karate Kid, followed by a background graphics sheet at bottom, which includes the title screen and the cheering crowd.

Image
https://imgur.com/a/5DHirs6

I pulled this using the Mesen emulator to look at the CHR banks in the PPU Viewer, modifying palettes to make it more visible.

Here are alternate graphics from the existing RomHack Cobra Kai, and tweaked versions by Silent_J.
https://i.ibb.co/vmBJHkR/Cobra-Kai-Karate-Kid-NES.png

To make different graphics work in the actual game, you'd need to go through these 8x8 pixel tiles in Photoshop (maybe using the checkerboard image I posted as an overlay at low opacity), and compare them to a sprite sheet of the characters, and a modified version of that same artwork (which would be on another matching layer).

For my Monster Party hack, I put together matching sprite sheets from the normal game and from a redesign. I then went through block by block, looked for each sprite block, found it, and pasted the modified sprite over it as a replacement layer.

This replaced art can then run in Mesen as an HDpack and can be pasted into the actual ROM using YY-CHR or a similar program.

To alter text in a game, I use the FCEUX emulator and open up the hex editor. I probably need to create a lookup table, or LUT. For Monster Party I used Oriton Table Creator. I looked at where the text font is stored in the CHR graphics, and noted the number of each sprite (using the PPU/CHR viewer in Mesen or FCEUX). So I create a lookup table which translates each letter in the font to the location of that letter in the graphics.

The number of tiles you use for your title screen should match those used for the original, since it will have to fit in the same space in the CHR bank. You may also have to duplicate the layout of the original, as its blank tiles may have to stay blank. Shiru's Screen Tool may come in handy, as may I-CHR.

https://shiru.untergrund.net/software.shtml


____________


Notes on current hack progress:

When copy/pasting new graphics into YY-CHR, the colors will always be assigned wrong, but since it's a four-color system this only takes seconds to fix.

At this point, a lot of the graphics tiles have been replaced (using YY-CHR), and often they're not in the same place as the originals because we're planning to do a something a little different with the characters. The wrong tiles are displayed, in the wrong colors. This has to be corrected by looking at the hexadecimal code in FCEUX using the code/data logger. The code is just a bunch of numbers, which mean something different in different contexts, but I should be able to find where these specific tiles are and change the numbers.

Tiles are all 8x8. Sprite tiles can choose from 1 of 4 four-color palettes. Background tiles can be recolored in 16x16 blocks made up of four tiles.

_____________





So looking in CadEditor gives a good example of how most NES games handle level layouts.

[Image]

Sometimes, especially on a title screen, you would define everything on a tile by tile basis, probably also using control codes to jump around the screen and save code space. You would then have an attribute table, setting colors in 2x2 blocks.

But in this case, and on the title screen and shop and ending, we're dealing with 2x2 blocks throughout.

From the selection of graphics tiles at right, we've defined a number of 2x2 blocks of tiles, with one of four color palettes selected, and probably collision detection set as well.

The entire level layout is then done from those sets of 2x2 blocks rather than on a 1x1 tile basis.

(Note that background color can be changed on a 2x2 block basis while sprite color can be changed on every single tile. A tile is 8x8, a block is 16x16.)

Without CadEditor I was editing four separate tables for each screen. The graphics bank, the block definitions, the block palettes and types, and the level layout.

I would do this from trying to find numbers in the hex code which seemed to match what I'm trying to do. It's not visual but I can refresh the ROM to see if I'm right.
A set of graphics tiles on the NES is four colors (and can use four palettes for background and four for sprites). Each tile is numbered from 00 to FF, as seen below.

[Image]

That's 128x128 pixels, made up of 8x8 tiles. That's smaller than the NES's resolution of 256x240, so get ready to be clever and reuse tiles.

Related: Did you know the clouds in Super Mario Bros are also the bushes?

Since every tile is numbered, it is usually possible to find in the hex code where the tiles are being defined and used, and type in a different number for that in order to use different tiles and change appearance.

There may be two different tables for sprites -- such as a table which defines which tiles are used and their palette number, and whether they're being flipped or not -- and then a table for their position onscreen.

You can only display a limited number of sprites on a single line. The sprites will start to become invisible when too many enemies are onscreen, for example. (Modern emulators can turn this on and off but lots of onscreen sprites also slows down the game.)

Backgrounds have no such restrictions.

Generally the player character and any enemies would be sprites.

Emulators also have a debugger which attempts to reconstruct the original assembly code instructions based on what numbers appear in the hex code.

I don't usually use these, and they're not entirely accurate, but better hackers are using these all the time. You might attempt to disassemble the code in a similar fashion. Some of the more popular games have gotten disassemblies which attempt to make the code much more understandable. I used this on my Super Mario Bros 2 hack. This isn't usually available with the games I'm hacking and the SMB2 hack was still difficult, as the disassembly didn't quite explain everything. It explained most things though.

In order to help you find what parts of the hex code are being used at any time, FCEUX (emulator) has a Code/Data logger. A code disassembler will also require this. You can run it for short periods of time while playing the game, and the code that's being used will light up (or can be saved to file on its own). This is usually enough to help you find the code you need to change.

Generally, two CHR graphics banks are used at any one time - one for backgrounds and one for sprites. Early NES games only used two graphics banks period (known as Mapper Zero games). Later games used more advanced Mapper chips to switch between different graphics banks, sometimes in the middle of gameplay, and sometimes combining pieces of several different CHR graphics banks into one inside the NES's graphics PPU.

Donald Land is a very normal NES game for this period. It uses one background sheet and one sprite sheet at a time, and switches them between levels, or when loading a different set of enemies.

We can view and change these graphics sheets in YY-CHR or similar programs.
User avatar
Garrett Gilchrist
Site Admin
Posts: 7861
Joined: Tue Feb 12, 2013 1:23 am

Re: ROMHacking Thread

Post: # 11036Post Garrett Gilchrist »

http://www.romhacking.net/hacks/5423/

Elvira's Monster Party

Elvira, Mistress of the Dark, the horror hostess played by Cassandra Peterson, stars in this hack of Bandai’s Monster Party for the NES / Famicom.

With a flaming sword to deflect attacks (like a baseball bat), and the ability to transform into a bat-winged (and bat-throwing) monster, Elvira is ready for action! Batter up. Fight through eight stages in a parody world filled with familiar movie monsters.

The player character has been replaced with Elvira, Mistress of the Dark, who also appears in the intro and outro cutscenes with new text. Boss text has not been altered.

This is based on the restoration and translation of Parody World Monster Party, released by Stardust Crusaders. http://www.romhacking.net/translations/3115/

Concept and Elvira graphics were created by Sil3nt_J.

Various graphics, text and Romhacking by Garrett Gilchrist (tygerbug).

This is a patch for Monster_Party_(J)_(Prototype).zip (256 KB)


UPDATE:

https://www.youtube.com/watch?v=WP_csuNh7u8
https://youtu.be/_K30pHcD4aw
User avatar
Garrett Gilchrist
Site Admin
Posts: 7861
Joined: Tue Feb 12, 2013 1:23 am

Re: ROMHacking Thread

Post: # 11037Post Garrett Gilchrist »

Della Duck playable in NES Ducktales!

http://www.romhacking.net/hacks/6776/
https://www.youtube.com/watch?v=7skuSh-87qk

Della Ducktales! Graphics mod to make Della Duck playable in NES DuckTales (1989) and Ducktales 2, via graphics replacement (as an HD pack) in the Mesen emulator. This is Donald Duck's sister, as seen in the reboot TV series.

https://www.mediafire.com/file/8jrs44m66xnx1ds/

It wasn't that hard to redraw the graphics, but I'd drawn Della in slightly different positions than Scrooge, mainly her head positions, which got me in trouble later. The NES programming reuses graphics tiles constantly, and any inconsistency was immediately obvious, requiring some tweaking. I would recommend that anyone redrawing NES graphics keep their characters either identically positioned to the original sprite or changed consistently on every frame ... just in case!
User avatar
Garrett Gilchrist
Site Admin
Posts: 7861
Joined: Tue Feb 12, 2013 1:23 am

Re: ROMHacking Thread

Post: # 11049Post Garrett Gilchrist »

You can modify nametables in NES Screen Tool.

Export your nametable for any scene from the Mesen emulator's Memory Tools.

Image

Here I am looking at Nametable RAM, including what looks like the palettes at bottom. Save the nametable RAM as a file.

Open this up in a hex editor. It's twice as big as it should be. Delete the second half of the file from 400 onward. Rename to .NAM.

Import CHR graphics into shiru's NES Screen Tool, by importing the NES file and selecting a CHR bank.

Open your NAM file.

https://shiru.untergrund.net/software.shtml

Recreate your palettes manually I guess.

At this point you can alter your background sprites and palettes, and save the results to be copy/pasted back into the ROM later. You can also create onscreen sprite displays as a metasprite bank.

You can use NES Screen Tool like a drawing tool here, placing tiles and palettes. Check or uncheck "Apply Tiles" and "Apply Palettes."

The .bin data you save when you're done can be manually reinserted into your NES ROM in the appropriate places.

Image

In Mesen (or in your old DMP file), copy a few bytes/numbers from the unaltered nametable and search for THAT in the NES file.

Find this data inside the original ROM in a hex editor.

(Either in a Hex editor or in FCEUX's Hex editor. Open up Debug/Hex editor/ROM file, you will be able to see your changes in real time. I suppose Mesen can do this too.)

You have found the Nametable for this scene inside the ROM.

You may be able to simply copy/paste your new/altered Nametable info directly into the ROM (from the .BIN file you exported from NES Screen Tool, or from an .MSB if you were working with sprites).

However, the code in the actual ROM may be different and more complex than that - there may be extra commands which jump around the screen, like maybe a three-byte command on every line break, or commands which seek to a specific point onscreen.

So you may need to make changes to your code to account for that.. Compare your new code to the old hex code.

Try this in FCEUX's hex editor, while working with the CHR ROM. See if you're breaking the code by pasting in the new code.

(It depends on the ROM!

They often have some extra code which you have to work around, in the actual Nametables.

Maybe an extra three bytes before every line of sprites, and an extra three bytes in the middle of the color palette at the end.

It's not too hard though! Just something to look out for, and add to your new code!)
User avatar
Garrett Gilchrist
Site Admin
Posts: 7861
Joined: Tue Feb 12, 2013 1:23 am

Re: ROMHacking Thread

Post: # 11064Post Garrett Gilchrist »

One annoying thing about hacking the first Super Mario Bros is that Mario's sprites are mirrored when in an idle stance. Here's an old AP hack which replaces him with SMB3 Mario- a good starting point for hackers.

http://www.romhacking.net/hacks/168/
User avatar
Garrett Gilchrist
Site Admin
Posts: 7861
Joined: Tue Feb 12, 2013 1:23 am

Re: ROMHacking Thread

Post: # 11257Post Garrett Gilchrist »

Sample of conditional backgrounds in Mesen HDpacks. Here's a condition where if one background tile is displayed onscreen at a certain point, a new full background image kicks in instead of a background color. (Background tiles which are not transparent will still display over this background.)

<options>disableSpriteLimit,disableContours

<condition>titlescreen,tileAtPosition,193,25,124,0F15110F
[titlescreen]<background>title1.png,1,0,0,N,0,0

The four numbers after tileAtPosition are:

Tile's onscreen position (tile position multiplied by 8, plus one, horiz and vert)
Then Mesen's output for that tile in "HDPack format" when you copy/paste. The 124 means it's background tile 24 in the CHR, followed by the palette.
User avatar
Garrett Gilchrist
Site Admin
Posts: 7861
Joined: Tue Feb 12, 2013 1:23 am

Re: ROMHacking Thread

Post: # 11392Post Garrett Gilchrist »

Image

http://orangecow.org/shared/Elvirasmons ... ESBox2.jpg
http://orangecow.org/shared/Elvirasmons ... belBig.jpg

Here's some cover art for Elvira's Monster Party, a hack I released last year.
https://www.romhacking.net/hacks/5423/
https://www.youtube.com/watch?v=WP_csuNh7u8

An Etsy seller was using this image on a physical cart, so I took inspiration from that.

Romhacking by Garrett Gilchrist (tygerbug). Additional hacking and help from Proveaux.

Concept and Elvira graphics were created by Sil3nt_J. Based on the Stardust Crusaders restoration and translation.


Image

On The Simpsons, Lee Carvallo's Putting Challenge is not selling well and Bart is unfortunate to receive it instead of Bonestorm (a Mortal Kombat stand-in). The game has digitized voice and probably Mortal Kombat-type graphics, but also clunky number-pad controls like the Intellivision. Maybe a Jaguar or 3DO type game.

An early script for The Simpsons "Marge Be Not Proud" (1995) shows that Lee Carvallo is a parody of Lee Trevino, Dallas-born golf star. He is playable as "Super Mex" in Lee Trevino's Fighting Golf for NES, arcades, C64 and Tiger Handheld.

This was a precursor in some ways to SNK's classic Neo Turf Masters.

So I've started a hack of this game as Lee Carvallo's Putting Challenge, with a new title screen, Simpsons font, and text changes for character names.

https://www.deviantart.com/tygerbug/art ... -909601257


Image
Image

Here's concepts for Zapper NES hacks of Gumshoe as Inspector Gadget, and of Duck Hunt featuring Scrooge McDuck.

I haven't finished these, but here are the rough designs. There would also be new title screens.


Image
Image

Image
Image
Image

Tests for a "Thief and the Cobbler" hack of Super Mario Bros 2, which I did many years ago. Never finished it.

Image

https://archive.org/details/super-mario ... tended-vhs

Super Mario Bros: The Morton Jankel Cut (VHS Extended Rough Cut)

Previously-unseen extended rough cut of the controversial 1993 cyberpunk fantasy, Super Mario Bros.

This took many months of work and was intended to be an official Blu-Ray extra. That got held up- indefinitely, as it turned out- so I leaked it to Archive instead.

There aren't a lot of hacks based off this movie, oddly.


Image

https://www.youtube.com/watch?v=7skuSh-87qk

Della Ducktales. Quick graphics mod to make Della Duck playable in NES DuckTales (1989) and Ducktales 2, via graphics replacement (as an HD pack) in the Mesen emulator.

https://www.mediafire.com/file/8jrs44m6 ... s.zip/file

I thought about redoing this as a ROM ... and did this test.

https://drive.google.com/file/d/1lhDlcO ... sp=sharing

It's not very good. Obviously the NES palette is much more limited than what I was able to do with no color limitations. Also Della's face is in a different position than Scrooge's "face mask," and it shows in the palette switching. Ideally I would want the "face masks" for Della to be displayed up two pixels and inward one pixel, from where they are now. I couldn't figure that code out.

Proveaux did send me some info though:
'This is for facing left. The rest should be similarly formatted and near this.'

1589B EYES VERTICAL
1589C EYES HORIZONTAL
1589D ROW 1 TILE 1 VERTICAL
1589E ROW 1 TILE 1 HORIZONTAL
1589F ROW 1 TILE 2 VERTICAL
158A0 ROW 1 TILE 2 HORIZONTAL
158A1 ROW 2 TILE 1 VERTICAL
158A2 ROW 2 TILE 1 HORIZONTAL
158A3 ROW 2 TILE 2 VERTICAL
158A4 ROW 2 TILE 2 HORIZONTAL
158A5 ROW 3 TILE 1 VERTICAL
158A6 ROW 3 TILE 1 HORIZONTAL
158A7 ROW 3 TILE 2 VERTICAL
158A8 ROW 3 TILE 2 HORIZONTAL
158A9 ROW 3 TILE 3 VERTICAL
158AA ROW 3 TILE 3 HORIZONTAL
158AB ROW 4 TILE 1 VERTICAL
158AC ROW 4 TILE 1 HORIZONTAL
158AD ROW 4 TILE 2 VERTICAL
158AE ROW 4 TILE 2 HORIZONTAL
158AF ROW 4 TILE 3 VERTICAL
158B0 ROW 4 TILE 3 HORIZONTAL


(Garrett's notes:)
(F7 F6 at 1589B/C)
(F7 02 at 0158B3/4)
158CB/C [F6 F5]
158DF [F6 03]
1590B/C [F7 01]
15923/4 [00 F2]
15939/A [00 06]
1593E/F is the weird crouch, cant figure it out
15A5B/C pogo left F8 F5
15A6F pogo right F8 03
15997 pogo2 left FCF5
159AB pogo2 right FC 03
158F3 jump left F7 F7
159D5 about to swing right F7 01
159Bf abt swing left F7 F7
159EB swinging left
15A05 swing right
159F0 swing left
User avatar
Garrett Gilchrist
Site Admin
Posts: 7861
Joined: Tue Feb 12, 2013 1:23 am

Re: ROMHacking Thread

Post: # 11546Post Garrett Gilchrist »

Here's some images of how the player sprites are laid out in 2D Mario games.

https://drive.google.com/drive/folders/ ... sp=sharing

SMB 1-3, World and X2 (fangame)

If you can lay your sprite work out identically ... organize it the same way .... you've basically got a ROMhack.

Generally I would draw over a sprite sheet from the game, like from the Spriters Resource website, then organize it to match the ROM afterward ... the sprite sheet underneath would allow accurate matches to each tile when figuring this out.
User avatar
Garrett Gilchrist
Site Admin
Posts: 7861
Joined: Tue Feb 12, 2013 1:23 am

Re: ROMHacking Thread

Post: # 11547Post Garrett Gilchrist »

Welcome to Lee Carvallo's Putting Challenge. Join golf legend Carvallo, and his rivals Gracie Driver, Big Raining and Miracle Monroe, for the ultimate golfing challenge on your Nintendo Entertainment System!

Lee Carvallo personally gives you advice on each course. Select your golf club, and guide your swing. Play for the title across thirty-six unique courses in the United States and Japan!

Fans of The Simpsons may remember the fully-voiced CD-ROM version released Christmas 1995, which Bart was disappointed to get instead of the violent fighting game Bonestorm.

This was a parody of "Lee Trevino's Fighting Golf" by SNK, for NES, arcades, C64 and Tiger Handheld. This was a precursor to SNK's popular Neo Turf Masters, and stars top golfer Lee Trevino as "Super Mex." The 1988 NES game offers more complexity, challenge and control than the original Golf on NES.

Hacking it into its Simpsons counterpart seemed obvious. That was also easier said than done, since the game's graphics are coded strangely.

There's a new title screen and font, and new names for the characters. Rani Baker (@destroyed4com4t) did the hacking while Garrett Gilchrist (@TygerbugGarrett) designed graphics and packaging art.

Would you like to play again?

https://www.youtube.com/watch?v=Y1V69hB ... e=youtu.be
Post Reply