Romhacking => ROM Hacking Discussion => Topic started by: Razieldemon on September 25, 2018, 05:23:57 pm

Title: Tool suggestions literature GBA pallete swap
Post by: Razieldemon on September 25, 2018, 05:23:57 pm
Ive seen a number of successful projects aimed at color adjustments for GBA ports like the Mario games.

Id like to dump a couple years (lol) into doing that for the Mega Man Zero series to give the characters and environments more pop.

There are a few tools out there, one I ran across called CCYH but all the sprites were indescernable. Any recommends?
Title: Re: Tool suggestions literature GBA pallete swap
Post by: ShadowOne333 on September 25, 2018, 05:32:06 pm
Are you doing sprite work or only modifying the palettes?
For changing palettes I recommend APE (Advance Palette Editor).
Though, from experience, I believe APE doesn't handle LZ77 compressed palettes as well as I'd like.

I am not sure how the palettes for the Zero games are stored in the ROM, but give APE a try.
Also, for getting the color palettes I recommend you use mGBA and its palette viewer, that will help out a lot when searching for the palettes in APE and knowing which ones to change.
Title: Re: Tool suggestions literature GBA pallete swap
Post by: Razieldemon on September 25, 2018, 08:45:31 pm
Thank you I will check those out :) primarily the pallete swap is what I will try first but sprite editing isn't out of the question. Im not a fan of the posture of the Mega Man Zero sprite but that might take a little more time
Title: Re: Tool suggestions literature GBA pallete swap
Post by: FAST6191 on September 25, 2018, 09:08:12 pm
There are two main types of palette swap for the GBA

1) Old SNES games that got ported for first gen GBAs.

2) Everything else, including GBA player custom stuff.

The GBA for many devs was something of a mini SNES. This extended as far as having the same palette format for several of the modes. However for reasons known only to Nintendo the first revision of the GBA had no lit screen and needed to be placed under blinding light to view it well. This meant many games, and at this point many ports, pumped the brightness of their palettes up a bit to help in this. Not great for emulator users, or the eventual later models with frontlit, backlit and straight TV out, indeed not great for people with reasonable lighting setups.
Simple solution then was fish the palette from the SNES ROM and then put it in the GBA ROM.

Everything else then. For some it will be similar -- find palette in game, extract into editor of your choice, put back into game (often with the button right next to the extraction one). It should also be noted you don't have to just edit palettes and can instead edit sprites to effect colour chances.

Palette finding.
The basic method I usually start with is savestate analysis. As the palette is a custom affair then it necessarily has to be in memory, uncompressed and everything. Tile editors know this (I like tileed 2002 and can pull from it which can be enough for many sprite editing purposes.
Graphics can be compressed but as most palettes are only a few bytes they are rarely compressed. To that end you can search through the game for the palette dumped from memory/savestates and often find it in the game.
Troubles here. Dynamic palettes and palette animations. Summon Night 2 provides nice examples of both but for animations a simpler example can be found in Mr Driller 2 (the rainbow block, set a palette viewer in VBA to auto update and find a rainbow block in a level and it will all make sense). For these I tend to try fragments.
Back to Summon Night 2 then it has options in the menu to adjust colours (read brightness) for GBA, GBA SP/GB Micro and TV (GB player), animations can be seen in the save swords. Said dynamic adjustment has consequences for the method above. You can try a relative search if you want but eh, sometimes said adjustments will be a simple pointer switch (think how a game can have 5 languages onboard) and there will be three sets of each palette for each mode and it might be a combo of the two.
Finally you of course have tracing. If you can find the palette in RAM (like where the thing you want to edit is on screen) then you do something like (but probably with no$gba debug these days now it is free).

If it is a compressed palette then you can try searching for fragments and hoping you get lucky (most compression does not encrypt files, though it can look like it at times), you will struggle to edit compressed files directly (you don't know if that sequence you just edited is used later in the compression) so decompress first to save headaches. There are a few types of compression on the GBA but most will be LZ, bit unpacking which is what gets called 1bbp mode in some tile editors but is technically compression (you tend to see this more in fonts for obvious reasons), and filtering where changes are noted rather than full numbers which makes compression easier. LZ has some telltale fingerprints so there are LZ searching tools... I am not going to say don't use such things but certainly don't rely upon them.

I have some pictures of some of this in,14708.0.html .
Title: Re: Tool suggestions literature GBA pallete swap
Post by: Razieldemon on September 25, 2018, 10:21:11 pm
Wow I am going through your guide right now and I can't even begin to thank you.

At first I was wanting to homebrew this game from beginning to end onto a Super Nintendo. After spending a few weeks looking through various documents I realized that sort of plan might take a decade. When I realized my biggest problem with Mega Man Zero was the garrish colours for the very reasons you listed above and after seeing various mario hacks, it became clear that the simpler solution made far more sense.

Considering the blood splatter was also simply recoloured yellow, this is also something I intend on remedying. I wish I could say I fully understood everything you meant above, but I also knew taking on this project will be something more of an obsession than a hobby

edit: what you mentioned about the sprite editing palette is important as well. One of the areas I expected to have some massive problems with is turning an over bright game into a darkly lit deep contrasty one. So I appreciate pointing that out early to me.
Title: Re: Tool suggestions literature GBA pallete swap
Post by: FAST6191 on September 26, 2018, 07:24:03 am
The sprite editing part (also good for sprite sheet making for that matter) was less about changing contrast. I can see a path to something being done with sprite editing there, and indeed blood recolouring might be achieved if you overwrite all the relevant parts of a sprite with a red that might exist in the same colour palette -- tiles are basically paint by numbers pictures and if you change all the numbers to be that of another colour it works just as well as changing the palette*.
*give or take fun and games that can happen with palette swap enemies but we will skip that one for now.

The sprite editing stuff is more for when you are happy with the broad strokes of a sprite but want some small aspect changed. An example might be games brought out of Japan tend to censor cigarettes for characters. While you could go find the Japanese game and rip a sprite you could also draw one back in if you fancy your skills as an artist. Or if a character has say a bandanna and you want it a few pixels longer. Or if the character opens their mouth in an animation and you don't care for it so you paint it shut in that part. Basically tweaking elements which already exist within the broad scheme of the art.

It can get much more annoying than this -- sprite drawing is a hard game at the best of times and the complexity/creative workarounds of older computers does not help matters; and while the GBA has abilities the older home consoles could only dream of it is hardly a modern PC where you could software define 50000 sprites all doing their own thing and not have it break a sweat.

For changing a game's contrast then you will want to be looking at palettes. Often it will be a unilateral change (every colour now 15 steps brighter sort of thing) and you might be able to undo that mathematically, however it will be less about sprites for that. That said most tile editors will be able to have a nice slider to do that.

As far as making a SNES game from scratch it is not for the feint of heart, if nothing else the SNES lacks anything in the way of high level languages you will want to use where the GBA on up has the likes of to get at least some C going on.
Title: Re: Tool suggestions literature GBA pallete swap
Post by: Asaki on September 28, 2018, 07:51:05 pm
Surprisingly, the ports for the DS use the same palettes, as far as I could tell.

If you're playing the game on an emulator, or a Game Boy Player, there are options to improve the colors for most games without having to hack them.

Or you could play it on a Game Boy Micro.