Jump to content

  •  

Photo

Sonic 1 Labyrinth Zone palette bug


  • This topic is locked This topic is locked
17 replies to this topic

#1 Psycho RFG

Psycho RFG

    4 Chaos Emeralds

  • Member
  • 210 posts
  • Gender:Male

Posted 24 April 2012 - 12:55 PM

Hi!
Here am I, with another rare bug. I tested a lot because I noticed it in my hack and it happens in origianl Sonic 1 game too (in REV00 and REV01). The bug appears in Labyrinth Zone, when you are out of water, sometimes, for a frame (not noticeable too much if you don't see the game frame by frame), the entire screen show the underwater palette...

Here is an screenshot to show what I mean:

Posted Image


As you can see, here, at the middle of the screen is the water surface, but the entire screen is with underwater palette. As I said, this only happens for a frame, and then back to normal, but it's repeated more times.
Anyone noticed this? is there any possible fix? what is causing that?
  • 0

#2 vladikcomper

vladikcomper

    5 Chaos Emeralds

  • Pro User
  • 325 posts
  • Gender:Male
  • Location:Russia

Posted 24 April 2012 - 02:51 PM

The only way this can happen is when you disable interrupts and game lags at the same time (i.e. if level main loop isn't finished processing when VBlanking period starts and a new frame is about to render).

Infact, VBlank interrupt is meant to happen always during normal gameplay. Even if the game lags -- it will interrupt the code being processed at that moment, then VBlank routine runs, then the processor sets back to the point, where the program was interrupted. So, VBlank routine runs every time when a new frame is going to render. Every frame it updates music and palette, also storing horizontal interrupt to swap the palette to a water one. That's why even if the game terribly lags -- the music doesn't and the water is rendered properly all the way.

This is how I see the bug: VBlank interrupt somehow didn't happen and CRAM/palette remained unchanged. The matter is, to render the water, the game should first load 'dry' palette (at VBlank), then swap it to 'water' one at the certain point of frame (by Horizontal Interrupt). As VBlank didn't work, 'dry' palette wasn't loaded and the 'water' one remained from the previous frame. Therefore, VDP starts to render new frame with 'water' palette.

I don't know how this even can happen, because interrupts are always enabled in the original game and there is nothing that can break palette loading. What emulator do you use? This palette swaping this is quite complicated to emulate, so what if this an emulator inaccuracy? I have never seen this in Kega or Regen, nor in hacks, nor in original game.
  • 0

#3 SpirituInsanum

SpirituInsanum

    6 Chaos Emeralds

  • Pro User
  • 642 posts
  • Gender:Male

Posted 24 April 2012 - 03:26 PM

I've never seen it, and couldn't reproduce it, but it happens in s3, in angel island, when you come from above and the water should become visible shortly after. It might be related.

I don't know why either though.
  • 0

#4 Psycho RFG

Psycho RFG

    4 Chaos Emeralds

  • Member
  • 210 posts
  • Gender:Male

Posted 24 April 2012 - 05:50 PM

Thanks for the replys. I was using Kega Fusion 3.64... I tried in Regen and coudn't see the bug so, maybe it's emulator related, or maybe not... I have to try it in real hardware.
  • 0

#5 Irixion

Irixion

    6 Chaos Emeralds

  • Pro User
  • 579 posts
  • Gender:Male
  • Location:Ontario, Canada

Posted 24 April 2012 - 11:12 PM

It does happen on real hardware, and it's for the reason mentioned above. Just lag.
  • 0

#6 SpirituInsanum

SpirituInsanum

    6 Chaos Emeralds

  • Pro User
  • 642 posts
  • Gender:Male

Posted 25 April 2012 - 12:06 AM

Would it solve anything to re-enable the interruptions at the end of the palette transfer?

They're disabled at the beginning of PalToCRAM/HBlank (depending on the disassembly), but not enabled again after that (or in a way I couldn't notice).

I can't really test it since I don't know where/how to make it happen. Add move #$2300,sr before the rte if you want to try (I'm really not sure it will work though).
  • 0

#7 Psycho RFG

Psycho RFG

    4 Chaos Emeralds

  • Member
  • 210 posts
  • Gender:Male

Posted 25 April 2012 - 01:48 PM

Thanks for the report Irixion, I couldn't see the bug in real hardware (it's too difficult even with debug and slow motion mode)... but it's very noticeable in Fusion, especially if the water level is on the screen and if a badnik is near to sonic too (just press PAUSE button from your keyboard, and then press INSERT button on your keyboard to see frame by frame and you will see).

I tried what you said SpirituInsanum, but I see no difference. Te bug is still there.

Edited by Psycho RFG, 25 April 2012 - 01:48 PM.

  • 0

#8 SpirituInsanum

SpirituInsanum

    6 Chaos Emeralds

  • Pro User
  • 642 posts
  • Gender:Male

Posted 25 April 2012 - 04:21 PM

You added it before both rte's?
  • 0

#9 Irixion

Irixion

    6 Chaos Emeralds

  • Pro User
  • 579 posts
  • Gender:Male
  • Location:Ontario, Canada

Posted 25 April 2012 - 05:34 PM

Yeah, no, I remember it happening on real hardware. It happens in S2, and S3K. I've seen it happen in the infamous rising mega muck spot in CPZ, with all the bubbles coming out of Sonic and Tails' mouths lagging it up
  • 0

#10 Psycho RFG

Psycho RFG

    4 Chaos Emeralds

  • Member
  • 210 posts
  • Gender:Male

Posted 25 April 2012 - 05:48 PM

You added it before both rte's?

Yeah, I tried in both rte, I tried too only in the first one and only in the second one... but the problem is still there...

It's to rare, sometimes it happens too much and some other not too much... I'm starting to think it's emulator problem :S

New note: If the water level is not on the screen, the bug only affect to Sonic palette (and badniks that uses that palette of course), not on the entire stage.

Edited by Psycho RFG, 25 April 2012 - 06:02 PM.

  • 0

#11 SpirituInsanum

SpirituInsanum

    6 Chaos Emeralds

  • Pro User
  • 642 posts
  • Gender:Male

Posted 25 April 2012 - 09:37 PM

Really, it would help if you could detail how, where and when it's happening, because it looks like you keep seeing it, and after many tries I still couldn't find it. :/
  • 0

#12 Psycho RFG

Psycho RFG

    4 Chaos Emeralds

  • Member
  • 210 posts
  • Gender:Male

Posted 25 April 2012 - 10:20 PM

I'm really thinking is emulator problem. Is not always in the same place or same condition to say... but sometimes it happens too much (even each 2 frames constantly) and others I can't see nothing strange... So I think it happens when my computer is doing too much work at the same time :S
Here is a video (sorry for the bad quality but it's the only program I couldn't use that catch the bug)...


http://youtu.be/-61INtP3WlU


  • 0

#13 SpirituInsanum

SpirituInsanum

    6 Chaos Emeralds

  • Pro User
  • 642 posts
  • Gender:Male

Posted 25 April 2012 - 10:30 PM

o_O

That's totally extreme, we would definitely have noticed that long ago. Is it with the unmodified s1 (rev01)?

What are the settings of the emulator?
  • 0

#14 Psycho RFG

Psycho RFG

    4 Chaos Emeralds

  • Member
  • 210 posts
  • Gender:Male

Posted 25 April 2012 - 10:35 PM

Yes, the time I recorded the video I noticed it was too much extreme :S The other times was one frame each 20, 14, 24 or so frames... after record the video I tried again and... nothing.... only saw it one frame in about 40 seconds... So that's what I thinking is something with the emulator...
Yes, it's an unmodified rom. Original REV01.
It's Fusion 3.64, the video was recorded in original resolution (320x224), Normal Mode, Fixed Aspect (Fit) and nothing rare... What kind of settings do you need?

Edited by Psycho RFG, 25 April 2012 - 10:38 PM.

  • 0

#15 SpirituInsanum

SpirituInsanum

    6 Chaos Emeralds

  • Pro User
  • 642 posts
  • Gender:Male

Posted 25 April 2012 - 11:00 PM

I don't know, anything that could slow it down. For example, under "options", is everything disabled? I don't think sound can make a huge difference, but try with only 22 or 44kHz enabled.

I looks like it's the 68k's emulation that's being slown down.
  • 0

#16 Psycho RFG

Psycho RFG

    4 Chaos Emeralds

  • Member
  • 210 posts
  • Gender:Male

Posted 25 April 2012 - 11:15 PM

Sound was disabled when I recorded the video. If finally is emulator problem and not game bug, then it really don't mind too much.
  • 0

#17 MarkeyJester

MarkeyJester

    We're all mad here

  • Pro User
  • 1813 posts
  • Gender:Male

Posted 26 April 2012 - 01:28 PM

It's the emulator, clear and simple, you can tell because you "paused" the emulation, and there was a delay before the colour took effect, even though everything is suppose to be hulted.
  • 0

#18 Psycho RFG

Psycho RFG

    4 Chaos Emeralds

  • Member
  • 210 posts
  • Gender:Male

Posted 26 April 2012 - 01:40 PM

That was me pressing "advance frame"... when I paused the emulation the palette was ok, but I was pressing the key to advacne frame (I didn't thought the bug would appear so soon)... but at this moment I think is the emulator too. Anybody can notice this and I couldn't saw it in real hardware (maybe only for a few moment when the drowing numbers are on the screen and you jump out of the water) but nothing important. So I think finally it's a false alarm bug...
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users