News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Mario 3 palettes  (Read 3283 times)

Hypnotic_rabbit

  • Jr. Member
  • **
  • Posts: 35
    • View Profile
Mario 3 palettes
« on: September 08, 2015, 10:28:50 pm »
Im creating a mario 3 tile editor and I have some questions about the palettes, where are they exactly and are they all together or scattered a bit? I know how to find them edit them and figure out what sprites they go with but id rather ask then go do the work myself lol. Can anyone give me specific starting and stopping address or char numbers they start and stop on? What I need to do is  load them all into an array as iv done with the tiles. I have the editor loading, editing and saving all the tiles perfectly using generic colors but now id like to try and incorporate the palettes when displaying the tiles and allow for editing the palette colors. From my testing all the tiles seems to be in the same spot on all versions of the rom and im wondering if the same would be true for the palettes as well?

Disch

  • Hero Member
  • *****
  • Posts: 2746
  • NES Junkie
    • View Profile
Re: Mario 3 palettes
« Reply #1 on: September 08, 2015, 10:42:40 pm »
Palettes are almost always stored verbatim in the ROM.  They are one of the easiest things to find.

Mario 3 probably has them separated into groups -- like one group for enemies, one for backgrounds, one for the mini-game screens, etc.

Take a look at the runtime palettes in FCEUX.  Each palette is 4 colors.  Look at the numbers of the last 3 (like "30 10 00" or something if there's a grayscale palette), then open the ROM in a hex editor and Ctrl+F for that sequence.  Odds are there will only be a small handful of hits, and it should be pretty easy to spot which are the palette tables.

Hypnotic_rabbit

  • Jr. Member
  • **
  • Posts: 35
    • View Profile
Re: Mario 3 palettes
« Reply #2 on: September 08, 2015, 11:02:44 pm »
You were very helpful with helping me understand 2bpp, disch but im afraid you didnt tell me much i didnt know already about the palettes. I understand the groups and 4 bytes per palette and how to find them but what i was really trying to find out is if they are stored one after another in the rom with no other data in between. I dont expect anyone to go find out for me so I guess ill have to check it out myself, just thought id get lucky and someone would know for sure already. One thing i dont get is the grayscale palette you mentioned, care to explain plz?

Disch

  • Hero Member
  • *****
  • Posts: 2746
  • NES Junkie
    • View Profile
Re: Mario 3 palettes
« Reply #3 on: September 08, 2015, 11:22:57 pm »
I understand the groups and 4 bytes per palette and how to find them but what i was really trying to find out is if they are stored one after another in the rom with no other data in between.

To expand a bit... a game will usually have any number of palette groups.  For example, SMB3 might have one group that is dedicated for background palettes for different levels in the game.

Each group will store its entries sequentially.  So if SMB3 has 1 palette for each level, you will probably see a big table of palettes, with the first 4 entries being the palette for 1-1, the next 4 being for 1-2, etc.

Other groups (like enemies) will be stored in a separate area in the ROM, but likely in the same fashion.


Note that my level example was over simplistic to give the idea.  Likely there is a layer of indirection.  For example... each level might only have a single byte to indicate a "palette ID" for it to use.  Then the palettes which correspond to each ID will be in the big table.  This saves space because it allows multiple levels to use the same palette information by giving them the same 1 byte ID, rather than the same 4+ byte palette.


Palette tables are usually pretty easy to spot, as they often have the same value (usually 0F) every 4 bytes, and no bytes are higher than 3F.  Here's an example from Final Fantasy:

http://i.imgur.com/oKzSXiC.png

It's pretty easy to see the pattern of a palette table starting at offset 0x2010 here.

In FF1's case, each row of bytes here is the palette for 1 map in the game.  So the first row is for the first town, the next row is for the next town, etc.  Enemy palettes, character palettes, etc are all stored in very different areas.

Knowing that the map palettes for the first town in FF1 are "1A 28 18", I would have found this very easily with a Ctrl+F.  And then I would see that the rest of the bytes in this area all have this pattern, so I would quickly identify it as a palette table.

Quote
One thing i dont get is the grayscale palette you mentioned, care to explain plz?

Forget about it.  It was a poor example to illustrate how a palette looks.  The above visual should be easier to understand.



EDIT:

Datacrystal has some of the palettes outlined already.  Dunno if you've seen it:

http://datacrystal.romhacking.net/wiki/Super_Mario_Bros._3:ROM_map

Hypnotic_rabbit

  • Jr. Member
  • **
  • Posts: 35
    • View Profile
Re: Mario 3 palettes
« Reply #4 on: September 08, 2015, 11:48:44 pm »
Ahh i see, the palette ids would explain changing one sprites colors changing another sprites colors because they are sharing. That sounds like a challenge finding a single byte in the rom and where it is pointing to eh? I think you answered my biggest question tho, all the palettes are not stored all in one space most likely, nothing a little bit of hunt and find cant solve tho i guess, thanks. I totally forgot about that datacrystal link you posted, I remember seeing it when i first got into this and saved it somewhere because i knew id eventually get to the palettes after I got done with learning how to load edit and save the tiles. Seems like I seen another site that gave some offsets but Ill have to look again. Now im wondering about the tiles now tho, looking at them with tile editor pro they start and go all the way to the end in one big sheet with nothing in between. Iv tested the first bunch of beginning tiles and the ending bunch of tiles after loading them into the editor and it seems they are all together, Would it wrong to assume they are not? I know how tile editor pro works when it loads them but would there be any reason they appear to be all in order in the prog? Surely its not skipping data in between the tiles right?

Disch

  • Hero Member
  • *****
  • Posts: 2746
  • NES Junkie
    • View Profile
Re: Mario 3 palettes
« Reply #5 on: September 08, 2015, 11:58:41 pm »
Now im wondering about the tiles now tho, looking at them with tile editor pro they start and go all the way to the end in one big sheet with nothing in between.

SMB3 uses CHR-ROM only.  This means that on the physical cartridge, the CHR (pattern tables) were all on a separate ROM chip from the rest of the game.  So yes, all the graphics for the game are going to be in that big block.

That's different from PRG-ROM, which has, well, everything else.

This is just how CHR-ROM games work.

Quote
Iv tested the first bunch of beginning tiles and the ending bunch of tiles after loading them into the editor and it seems they are all together, Would it wrong to assume they are not?

Well, there's different "pages".  You can think of each 4 rows of tiles to be one page, and the game can switch which page it wants to use as it goes.  Again this comes down to having an ID to represent each page... so ID 0 would be the first 4 rows of tiles, ID 1 would be the next 4, and so on.

Different parts of the game might recycle graphics by having the same page ID.  Likely coming down to 1 or more bytes for each level, indicating which page(s) to use.

Hypnotic_rabbit

  • Jr. Member
  • **
  • Posts: 35
    • View Profile
Re: Mario 3 palettes
« Reply #6 on: September 09, 2015, 12:17:57 am »
You rock man. I couldn't have done it without you, not as fast anyway lol. Id prolly still be trying to figure out bitplanes still. The reason I started this is because I was going to make a mario 3 hack and there are already level editors for mario 3 and even a world editor but i couldn't find a tile editor for it other then your basic tile editor. It would be nice to have a tile editor just for mario 3 just so they are all organized and easy to edit them along with the palettes. My end goal is to have all three in one program, a "make your own mario 3" if you will. I haven't gotten to the world editing or the level editing yet but since im already here, is there anything you can tell me about doing that?

Disch

  • Hero Member
  • *****
  • Posts: 2746
  • NES Junkie
    • View Profile
Re: Mario 3 palettes
« Reply #7 on: September 09, 2015, 12:46:59 am »
You rock man. I couldn't have done it without you, not as fast anyway lol.

Cool man.  I'm happy to help.  If only I could find a way to actually make money off of NES ROM hacking.  Hah!

Quote
I haven't gotten to the world editing or the level editing yet but since im already here, is there anything you can tell me about doing that?

Nah, not really.  Other than it's almost certainly compressed.

Though with level editors available, the format has been figured out already, so you shouldn't have to figure it out yourself.  Dig around and look for documentation which lays it out for you.

Hypnotic_rabbit

  • Jr. Member
  • **
  • Posts: 35
    • View Profile
Re: Mario 3 palettes
« Reply #8 on: September 09, 2015, 01:07:00 am »
Id pay ya for the help but im broke as a joke haha, hell i might even put a donate button on my finished prog lol. When it comes to computer stuff like programming, hex, ram, rom, blah blah its nothing new to me. Been there done that, iv been doing it so long I even use to make booters for yahoo chat rooms long long ago, but rom hacking is new too me. Iv read and read what little i can find on it but i cant ask a document question like can with you. Any good sites you know of other then this one?

Disch

  • Hero Member
  • *****
  • Posts: 2746
  • NES Junkie
    • View Profile
Re: Mario 3 palettes
« Reply #9 on: September 09, 2015, 01:22:42 am »
You might get responses on the nesdev forums -- but I don't think many people there do much actual ROM hacking (it's more homebrew / emu development) so they won't know any game-specific info, but you can ask questions about NES architecture and how the system itself works and you'll get a bunch of detailed replies.

But as far as romhacking sources go -- this is pretty much the only one I know of or go to.  I never really bothered looking around for others.

Dr. Floppy

  • Restricted Access
  • Hero Member
  • *
  • Posts: 972
  • Make America GREAT Again!
    • View Profile
    • BaddestHacks.net
Re: Mario 3 palettes
« Reply #10 on: September 09, 2015, 01:44:59 am »
Beware that SMB3 assigns most background/sprite palette layouts to multiple levels/areas. Thus, changing one entry can affect multiple places throughout the game. (And the game's large enough that exploring every single nook & cranny after each alteration isn't realistic.)

If only I could find a way to actually make money off of NES ROM hacking.  Hah!

Do you have any experience with higher-level programming languages?

Disch

  • Hero Member
  • *****
  • Posts: 2746
  • NES Junkie
    • View Profile
Re: Mario 3 palettes
« Reply #11 on: September 09, 2015, 01:45:57 am »
Do you have any experience with higher-level programming languages?

Yes, but they're not as fun as NES ROM hacking.

Hypnotic_rabbit

  • Jr. Member
  • **
  • Posts: 35
    • View Profile
Re: Mario 3 palettes
« Reply #12 on: September 09, 2015, 12:28:26 pm »
Beware that SMB3 assigns most background/sprite palette layouts to multiple levels/areas.

Im aware and i plan on letting the user know this. Using bookmarks in my hex editor does make it possible to know when multiple sprites are using the same palette

Xkeeper

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: Mario 3 palettes
« Reply #13 on: September 15, 2015, 02:51:14 pm »
A few days late but you might enjoy looking at the SMB3 disassembly, or at least NoDice, a pretty full-featured editor for the game. (The actual disassembly is here, though)

I run a wiki.

Dr. Floppy

  • Restricted Access
  • Hero Member
  • *
  • Posts: 972
  • Make America GREAT Again!
    • View Profile
    • BaddestHacks.net
Re: Mario 3 palettes
« Reply #14 on: September 18, 2015, 11:24:45 pm »
Yes, but they're not as fun as NES ROM hacking.

Much sadness. I have a standing offer to pay good money to anyone who makes a FCEUxD-quality Debug/Emulator for SNES.

PKstarship

  • Jr. Member
  • **
  • Posts: 44
    • View Profile
Re: Mario 3 palettes
« Reply #15 on: September 18, 2015, 11:38:56 pm »
I was just about to make a thread asking where SMB3 palettes are, but just found out this was here, I even learned what CHR-ROM is! Lucky me, I guess :)