Author Topic: Here's how to remove the black background when removing the BG Layer in FCEUX  (Read 1129 times)

0 Members and 1 Guest are viewing this topic.

Offline ReyVGM

  • Jr. Member
  • **
  • Posts: 65
  • Game Endings Master
Some people might already know this, but after years of struggling ripping sprites or doing maps, I finally found a way to have the black background color changed to something else when removing the background layer in FCEUX.

Just open the fceux.cfg file with Notepad++, go to "gNoBGFillColor" and change the number to something else. I haven't found the number for pink yet, but I settled with "35", which gives me a purplish color that I don't think is used by any game.

Offline mechaskrom

  • Newbie
  • *
  • Posts: 37
The number is a palette index. Here's an image of the NES palette with the numbers/indices:
http://www.mediafire.com/view/6xbrskg256wtco6/nes_palette_numbers.png/file
I believe only 0-63 are valid. Higher values probably just wraps around. Value 255 is special for don't override background color(?).

It's too bad that you can't specify a custom color instead of using one from the palette. Would've made it easier to pick a unique background color for games. Better than nothing though.
Current project: -
Last finished project: Mission: Impossible (NES)

Offline mechaskrom

  • Newbie
  • *
  • Posts: 37
Thinking about it some more. I believe that many of the black colors like 30, 31, 46 and 47 are rarely used by games, so making a custom palette with your wanted background color in one of these indices should work pretty well together with "gNoBGFillColor". Just an idea.
Current project: -
Last finished project: Mission: Impossible (NES)

Offline ReyVGM

  • Jr. Member
  • **
  • Posts: 65
  • Game Endings Master
The number is a palette index. Here's an image of the NES palette with the numbers/indices:
http://www.mediafire.com/view/6xbrskg256wtco6/nes_palette_numbers.png/file
I believe only 0-63 are valid. Higher values probably just wraps around. Value 255 is special for don't override background color(?).

It's too bad that you can't specify a custom color instead of using one from the palette. Would've made it easier to pick a unique background color for games. Better than nothing though.

Thanks. One of the devs told me you can make your own custom .pal file with the colors want. I don't know how to do that though.

See his info here:
https://github.com/TASVideos/fceux/issues/320

Offline mechaskrom

  • Newbie
  • *
  • Posts: 37
A .pal file is just 192 bytes with 3 bytes per color entry (64*3=192). There's also files that include the emphasis colors (3 bits = 8 combinations) and are therefore 1536 bytes (8*64*3=1536). The 3 bytes represents the common RGB color.
https://wiki.nesdev.com/w/index.php/.pal

So if you want to edit for example entry 30 then you change the 3 bytes that start at 90 bytes (30*3=90) into the .pal file (0x5A in hex). There are online hex editors if you want to try it. Use the goto function in the upper right to navigate to the starting byte.
https://hexed.it/

Or use a palette editor. The old Nesten emulator has one built-in that's pretty nice (Vid -> Palette Console...).
https://tnse.zophar.net/Files/NESten06BetaF.zip
https://www.romhacking.net/utilities/1572/

Make sure to use a good NES palette as a source. There are many floating around that looks awful IMO. This one is pretty good:
https://tcrf.net/images/f/f4/NES_NTSC_Palette.zip

Then after you changed entry 30 to e.g. magenta (255,0,255 = 0xFF,0x00,0xFF) just set the "gNoBGFillColor" to 30 and load the custom palette in FCEUX (Config -> Palette...) .
Current project: -
Last finished project: Mission: Impossible (NES)