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

Author Topic: [Technical] Need Help Finding Palette Data, Lolo3  (Read 295 times)

Vanya

  • Hero Member
  • *****
  • Posts: 1672
    • View Profile
[Technical] Need Help Finding Palette Data, Lolo3
« on: June 06, 2020, 04:42:59 pm »
Hi all. I've been working on a side project the last week or so and have run into a bit of roadblock.
I figured this would be very simple to figure out since I've done it before on other games.

My goal is to change this:



Into this:



The issue I'm having accomplishing this is that the bridges, floor, and green boxes all share the same palette.

Changing the palette itself is no problem.
Normally, the first 3 background palettes have color 3 set to the same color so you can see the floor underneath certain blocks and inside the doorway.
I changed the green block to not use color 3 at all.
But the next step is to change the 2 types of floor blocks to use either palette 0 or palette 3 so that it doesn't use the new "wood" color I want for the bridges.

So I fired up MESEN's debugging tools and got to work.

The PPU viewer says the attribute data is at $23c9 in PPU RAM.
I set the break point there to see when it gets written to.

This is where I ran into my first issue.
MESEN says: "Breakpoint: PPU Write ($23C9:$00)"

However the line that is stopped at says:
Code: [Select]
D4AE | STA PpuData_2007 = $D7

I was expecting to see an instruction directly writing to $23C9.

Then I decided to try waiting for it to say it was writing the value that ends up in that byte in PPU memory.

Then I noticed the line above it was writing the expected value to a different address right before the break.

Code: [Select]
D4AC | LDA ($13),Y @ $0104 = $95

Then I naturally set a break point for $0104 to see when it's being read from.
But that doesn't help because it's constantly being read from and written to.

Next I added a condition to the breakpoint so that it breaks when the accumulator is holding the value of $95.

The last time that $95 is loaded into the accumulator before writing to $0104, the value was read from $016B.

Great, another address in CPU RAM.

This time it lead me to an instance of code that had loaded $94 into the accumulator and performed an ORA to raise it to $95 before writing it to the relevant address.

So I guess I have to switch over to finding a write with this new value.

This is just leading to a long series of instances of AND and ORA that is ultimately coming up with the value of $95.

Code: [Select]
DD9F | STA $16                 
DDA1 | LDX $15                 
DDA3 | LDY #$00                 
DDA5 | LDA ($0F),Y             
DDA7 | AND $DDC3,X             
DDAA | ORA $16                 
DDAC | STA ($0F),Y             

At this point I'm not sure exactly what is happening and I'm no closer to figuring out how to universally set the floor blocks to use a different palette.

Am I even heading in the right direction here?

Cyneprepou4uk

  • Sr. Member
  • ****
  • Posts: 400
  • I am the baldest romhacker
    • View Profile
Re: [Technical] Need Help Finding Palette Data, Lolo3
« Reply #1 on: June 06, 2020, 05:28:53 pm »
I think you are the only one who can see these pictures.

Cpu writes to ppu via 2007 register. An actual ppu address is (maybe) displayed somewhere in debugger.

Instead of read breakpoint at 0104 set a write breakpoint at 0104 with condition 95
iromhacker.ru - NES ROM hacking tutorials for beginners. Please use Google Translate browser extension

Vanya

  • Hero Member
  • *****
  • Posts: 1672
    • View Profile
Re: [Technical] Need Help Finding Palette Data, Lolo3
« Reply #2 on: June 07, 2020, 06:14:56 am »
I'll check on the pics as soon as I get a chance.

As for the breakpoint, I did use condition 95 on it. That's what lead me to that bit of code that seems to be plucking several other values and making comparisions.

Seems like it's almost building the final value somehow rather than simply reading it from the ROM.

Another thing I tried initially was making a small change to a stage in the lolo3 editor and then comparing it to an unchanged rom in a hex editor, but no matter how small a change I made the amount of data that was different was way too much to learn anything useful from.

Cyneprepou4uk

  • Sr. Member
  • ****
  • Posts: 400
  • I am the baldest romhacker
    • View Profile
Re: [Technical] Need Help Finding Palette Data, Lolo3
« Reply #3 on: June 07, 2020, 07:25:37 am »
Well if you are sure that DD9F is where 95 is coming from, then you obviously should study this routine
iromhacker.ru - NES ROM hacking tutorials for beginners. Please use Google Translate browser extension

Vanya

  • Hero Member
  • *****
  • Posts: 1672
    • View Profile
Re: [Technical] Need Help Finding Palette Data, Lolo3
« Reply #4 on: June 07, 2020, 06:47:54 pm »
Yeah. At the very least it's a lead.
I'll post again if I make any progress. Thanks.