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

Author Topic: Dynamic palette change  (Read 1797 times)

Dirtbag

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Dynamic palette change
« on: January 28, 2014, 04:29:21 pm »
I've changed the font in Super Mario Kart.  On the track select screen (Time Trial, Vs. race, and battle mode) the colours don't work so well with the font.  I've tried to track down where these are stored, I've got so far but need help.

There are 4 different colour palettes used for the text: White, Blue, Red and Orange.  One of these is taken from the track theme palette (selected at the time) the others I couldn't alter in this way.  Using vSNES I've discovered that the colours palette is that of the track theme, but some of the values are changed.  You can see from these colour palettes that some of the colours have been changed (bottom 3 rows + 8th from bottom, first 4 colours).  The left is from the selection screen, the right is from the track palette unaltered: 



This is where I need help, can anyone help me track down where the values of these colours are stored?  Other than getting the colour values out of vSNES and searching in the ROM for them I'm at a loss of how to progress.

A lot of offset data can be found here, this has recently been updated by Stifu including a little more information I've found around this area.  I've been focusing on pack3-ttrial.htm
« Last Edit: January 29, 2014, 02:56:56 am by Dirtbag »

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: Dynamic palette change
« Reply #1 on: January 28, 2014, 10:48:33 pm »
Wait, which game are you talking about?

Dirtbag

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Re: Dynamic palette change
« Reply #2 on: January 29, 2014, 02:55:14 am »
Oppps that would help, it's Super Mario  Kart I'm working on.

February 03, 2014, 02:41:24 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
I've made a little bit of progress using BSNES' Debugger, but I still have not frond where the values are stored in ROM  :banghead:.

Looking at the palette viewer in VRAM I got the exact value of the light blue (7ff0) and orange (027f) colours that are added at indexes 225+226 & 241+242.  They are unique values in the palette so I set 2 breakpoints values of 7ff0 & 027f with WRITE S-PPU VRAM , both break points are hit once each in sequential order.  I assume this means that the value is must be written to the two indexes at the same time.

The disassembler output when the 7ff0 break point was hit:

 81c387 asl a
 81c388 sta $4303
 81c38b and #$3f
 81c38d sta $2117
 81c390 stz $2116
 81c393 lda #$7f
 81c395 sta $4304
 81c398 ldy #$0800
 81c39b sty $4305
 81c39e lda #$01
 81c3a0 sta $420b
 81c3a3 txa
 81c3a4 inc <-- Break point (or step after)
 81c3a5 sta $1d0c
 81c3a8 rep #$20
 81c3aa rtl
 81c3ab phb
 81c3ac phk
 81c3ad plb
 81c3ae rep #$20
 81c3b0 cpx #$0010
 81c3b3 bne $c3af
 81c3b5 ldx #$c3e0
 81c3b8 jsl $8194f4
 81c3bc bra $c3b7

The only difference is this branch after the break point for the second break point.

 81c3bc bra $c3b8

So I can only think that the values being read/ calculated happens before the disassembled code.  Can anyone suggest where I should look or try next?

« Last Edit: February 03, 2014, 02:41:24 pm by Dirtbag »