The bunny palette issue [*solved*]

View previous topic View next topic Go down

The bunny palette issue [*solved*]

Post by Puzzledude on Wed 1 Feb 2017 - 9:46

Solved the bunny palette problem.

When you construct a custom main sprite (ie Link), you will surely encounter a massive palette bug, when you draw the dark world equivalent (ie bunny) of the sprite, like seen here:



after pressing X for map, and returning:



And this is why:
at
1.) DD308, = green tunic pals for main sprite, 2 bytes for one colour, 1E bytes in hex

2.) at DD329, = same, but for blue tunic Link
3.) at DD344, = same, but for red tunic Link

new thing (not accebile in HM, but only in hex):
4.) at DD362, = same, but for bunny


main problem:
first apperance of bunny everytime you go to dark world with No Moonpearl= load 4.), but after pressing the map, the game load 1.) again.

This basically is a bug in the original ALTTP, since the game should be always loading 1.) and not 4.), or always 4.), but this is not the case with hacks.

You solve this by copy pasting the section DD308 (with data length 1E) into the scetion 4.), so to DD362 (with data length 1E). Then the game will always load 1.), the way it should be.

Doing so, you can also load pals for any custom main sprite, uppon you have changed all main pals. So you copy paste *after* the main pals change. Then you draw the bunny with the same colours as the green tunic variant of Link (this is logical though, as you can never be bunny if blue or red tunic; so you always draw for green tunic by default in YYchr).

This hex fix will ensure, that you can draw a brand new dark world variant of the main sprite if there is no Moonpearl (with correct pals loaded in all cases).


Last edited by Puzzledude on Thu 25 May 2017 - 8:54; edited 1 time in total
avatar
Puzzledude
Elite ROM Hacker
Elite ROM Hacker

Since : 2012-06-20

Back to top Go down

Re: The bunny palette issue [*solved*]

Post by ShadowOne333 on Sat 11 Feb 2017 - 12:47

Thank you so much for this info, puzzledude.
This will come in handy for sure.

To make it clear, the fix you provide (overwritting 1E bytes from DD308 into DD362) makes it so that the default palette loaded up for the bunny is always palette #1 right?

What change would be needed to fix the issue of the game loading palette 1 instead of 4 when going back from the Map screen for vanilla ALttP? So that the game the same palette it had before opening the Map. (i.e. Bunny palette retained no matter what if No moon pearl is aquired yet)

ShadowOne333
Rank: Rope
Rank: Rope

Since : 2016-04-06

Back to top Go down

Re: The bunny palette issue [*solved*]

Post by Puzzledude on Sat 11 Feb 2017 - 13:38

To make it clear, the fix you provide (overwritting 1E bytes from DD308 into DD362) makes it so that the default palette loaded up for the bunny is always palette #1 right?
Yes. This fix will load pal-1 (ie green tunic) when Link has tunic-1 (green clothes) and when you are a bunny. This is suitable for hacks, or gfx altered main sprite, since you always draw on pal-1 in YYchr. So now you only need to be careful when drawing clothes (colours) which will change when you get tunic-2 and 3.

However this fix is not recomended for original ALttP, since the actual correct bunny palette is palette-4. Or in other words, the original game has a paradox. It either loads bunny falsly (when both pals are 1) or would load Link falsly if both pals would be set to 4.



What change would be needed to fix the issue of the game loading palette 1 instead of 4 when going back from the Map screen for vanilla ALttP? So that the game the same palette it had before opening the Map. (i.e. Bunny palette retained no matter what if No moon pearl is aquired yet).
This will definitely require ASM, since Nintendo probably never noticed this. You see when returning from map and have Moonpearl you do return to pal-1 or any other current pal. There is no logic why game swaps the pal from 4 to 1 once you are a bunny (it should just keep the current pal).

This basically was never done, since when you are dealing with hacks, you always draw on pal-1. You actually don't even have access to pal-4 with HM, so obviously you don't draw on it.

Only the original game needs pal-4 for bunny. Basically you would need to trace the code when the game swaps pals and tell the game to not do this instead and keep the current pal-4 for the bunny even if pressing map.




Aside the ASM fix, you could also redraw the bunny in YYchr (ir GFX edit). So you would draw a bunny using the pal-1 colours, but you would be limited to the colours which are used for Link only, so you could never draw it the way it was meant.

It was long wondered why Link has pink hair. Finally they all said it has something to do with shared pals with bunny, who is pink. We now know this is not true, since they have separate pals.
avatar
Puzzledude
Elite ROM Hacker
Elite ROM Hacker

Since : 2012-06-20

Back to top Go down

Re: The bunny palette issue [*solved*]

Post by ShadowOne333 on Sat 11 Feb 2017 - 20:28

Puzzledude wrote:

However this fix is not recomended for original ALttP, since the actual correct bunny palette is palette-4. Or in other words, the original game has a paradox. It either loads bunny falsly (when both pals are 1) or would load Link falsly if both pals would be set to 4.

I did try to do it the other way around (Pal 4 into 1) and ended up with a bit too Pinky Link for my taste.Did so just to screw around with it a little bit.
It's rather odd though, since this issues doesn't seem to happen with neither palette 2 nor 3 (Blue and Red tunics), it only seems to switch the Pal 4 with Pal 1 for the bunny and no other pal.

Puzzledude wrote:

This will definitely require ASM, since Nintendo probably never noticed this. You see when returning from map and have Moonpearl you do return to pal-1 or any other current pal. There is no logic why game swaps the pal from 4 to 1 once you are a bunny (it should just keep the current pal).

This basically was never done, since when you are dealing with hacks, you always draw on pal-1. You actually don't even have access to pal-4 with HM, so obviously you don't draw on it.

I think I saw a palette similar to that of Link by using SnesPalEd quite some months ago, but didn't really pay attention to it.
So it means that basically the bunny has it's own palette, instead of the legendary assumption that Link's hair was pink because of the shared palette with the bunny.
Good to know it wasn't that way, as we now have 4 different palettes for 4 different sprites available.

Puzzledude wrote:
Aside the ASM fix, you could also redraw the bunny in YYchr (ir GFX edit). So you would draw a bunny using the pal-1 colours, but you would be limited to the colours which are used for Link only, so you could never draw it the way it was meant.

That's the problem I currently have.
I changed Link's default colour palette quite drastically, so redrawing the Bunny's GFX would only take those colours.
It'd surely be interesting to see the routine which causes the palette change. I'll see if I can find it with Snes9x Debugger.

EDIT:
Nope, I suck real bad xD
I always end up having issues with setting breakpoints and finding exactly what portion of it is the one I need.
:/

ShadowOne333
Rank: Rope
Rank: Rope

Since : 2016-04-06

Back to top Go down

Re: The bunny palette issue [*solved*]

Post by Trovsky on Mon 22 May 2017 - 15:43

http://www.romhacking.net/forum/index.php?topic=24197.msg336610#new

Trovsky
Rank: Blacksmith
Rank: Blacksmith

Since : 2014-04-10

Back to top Go down

Re: The bunny palette issue [*solved*]

Post by Puzzledude on Thu 25 May 2017 - 8:42

Bunny palette issue (completely) solved:

ASM by rainponcho:

Hex decode:

expand rom to 2MB, then


at 756C8:
AF 5B F3 7E --> 22 00 FF 3F
jumps to 1FFF00

at DEDFB:
AF 5B F3 7E --> 22 00 FF 3F
jumps to 1FFF00

at DEE10:
AF 54 F3 7E --> 22 14 FF 3F
jumps to 1FFF14

at 1FFF00: new code
AF E0 02 00 05 56 29 FF 00 F0 04 A9 03 03 6B AF 5B F3 7E 6B AF E0 02 00 05 56 29 FF 00 F0 04 A9 00 00 6B AF 54 F3 7E 6B


Basically what this ASM does is this:
if you have the green tunic and go to dark world and are a bunny either because of no Moonpearl or getting hit by the yellow beam which will temp-transform you into bunny, then pal-4 will be loaded: ie at DD362, so you can control all these colours. But after pressing the map, going to next room or overworld area, it will not swap to pal-1, it will remain in pal-4.

The same will also happen if you have the blue or the red tunic/armor.

This basically means rainponcho has made it so, that we can now choose the 4th palette for the bunny or his variants. This now basically is the 4th tunic or the bunny tunic.

Special Note:
if you are using the IPS proveded by the author, take into consideretion that there are some byte missing after the address 1FFF27, where the code ends. You need to add D8 bytes or 216 bytes in dec all with the value 00, to bring the rom from false size 1FFF27 to 1FFFFF (which means 2MB, since the first byte of the rom is at 00).
avatar
Puzzledude
Elite ROM Hacker
Elite ROM Hacker

Since : 2012-06-20

Back to top Go down

Re: The bunny palette issue [*solved*]

Post by ShadowOne333 on Fri 26 May 2017 - 11:14

Here's the code in ASM form provided by RomHacking user "rainponcho" for the Bunny palette bugfix, just in case anyone needs it or if they intend to use it with xkas.
Spoiler:

Code:
arch snes.cpu; lorom


//$0E/D6C8 AF 5B F3 7E LDA $7EF35B[$7E:F35B]   A:0304 X:00FE Y:00FE P:envmXdizC
//$0E/D6CC 29 FF 00    AND #$00FF              A:0502 X:00FE Y:00FE P:envmXdizC
//$0E/D6CF 80 17       BRA $17    [$D6E8]      A:0002 X:00FE Y:00FE P:envmXdizC

org $ed6c8

jsl bunny_palette


//$1B/EDFB AF 5B F3 7E LDA $7EF35B[$7E:F35B]   A:0233 X:00C0 Y:00FF P:envmXdizc
//$1B/EDFF 29 FF 00    AND #$00FF              A:0502 X:00C0 Y:00FF P:envmXdizc

org $1bedfb

jsl bunny_palette


//$1B/EE1D AF 54 F3 7E LDA $7EF354[$7E:F354]   A:0000 X:0200 Y:FFFF P:envmxdiZc
//$1B/EE21 29 FF 00    AND #$00FF              A:0102 X:0200 Y:FFFF P:envmxdizc

org $1bee1d

jsl bunny_palette2


org $3fff00


bunny_palette:

// check bunny
lda $2e0
ora $56
and.w #$00ff
beq bunny_palette_tunic

lda #$0303
rtl


bunny_palette_tunic:
lda $7ef35b
rtl


bunny_palette2:

// check bunny
lda $2e0
ora $56
and.w #$00ff
beq bunny_palette2_tunic

lda #$0000
rtl


bunny_palette2_tunic:
lda $7ef354
rtl

Also, thanks for the explanation, puzzledude!
Now thanks to this we are now able to use the 4 palettes for the main character freely.

ShadowOne333
Rank: Rope
Rank: Rope

Since : 2016-04-06

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum