Sonic and Sega Retro Message Board: Sonic 3 & Knuckles undocumented glitch - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 4 Pages +
  • 1
  • 2
  • 3
  • 4
    Locked
    Locked Forum

Sonic 3 & Knuckles undocumented glitch

#16 User is offline Tiddles 

Posted 31 July 2014 - 01:31 AM

  • Diamond Dust
  • Posts: 471
  • Joined: 25-December 09
  • Gender:Male
  • Location:Leicester, England
  • Project:Get in an accident and wake up in 1973
  • Wiki edits:31
You only need to do FFAF; it's treated as a word, and 0001 is the normal value for S&K being attached.

It doesn't have anything to do with the Sonic 3 levels being involved or not - vanishingly close to all of the code is running from S&K even in those levels, just some data (graphics, chunk layout) etc. comes from Sonic 3. The easiest place I found to do this was Mushroom Hill, which will still just as happily reset you into S&K. The glitch even works in genuine S&K alone if you enable debug using PAR codes or other methods, minus the final reset into S&K being an interesting event. All it is is RAM corruption of the RAM addresses you mention, and it's entirely an S&K bug (though the same mistaken code probably exists in S3, it will never be called in S3&K). Crashes that don't corrupt RAM will not cause this.

And though it is likely an overflow, there is something peculiar about this situation, because it is guarded against in most object spawning scenarios. Skipping the Icecap 1 boss and keeping the snowflakes active will leak object RAM until the game becomes unplayable, but this corruption and crash won't happen; nor will simply spawning too many monitors to begin with. So they did think program for the object limit... just something here seems to sneak around it.

#17 User is offline Uberham 

Posted 31 July 2014 - 08:30 PM

  • King Of Oblivion
  • Posts: 1147
  • Joined: 23-February 08
  • Gender:Male
  • Location:Sheffield England
Could it be that coupled with the art change into super/hyper sonic? like the change forces the loading of new art, so it overflows from there?

#18 User is offline Tiddles 

Posted 01 August 2014 - 04:18 AM

  • Diamond Dust
  • Posts: 471
  • Joined: 25-December 09
  • Gender:Male
  • Location:Leicester, England
  • Project:Get in an accident and wake up in 1973
  • Wiki edits:31
The relevant Sonic art is directly transferred from ROM every frame anyway, and the offset doesn't actually change for Super so they can share similar poses. The Super/Hyper stars do get loaded into their own object slot but their art is also dynamic (IIRC). So I'd be surprised if it's directly related to that, personally.

#19 User is offline muteKi 

Posted 01 August 2014 - 10:40 PM

  • Fuck it
  • Posts: 7515
  • Joined: 03-March 05
  • Gender:Male
  • Wiki edits:91
I was going to ask if it was because it had to spawn the broken-monitor object on destruction -- but then we'd expect this out of running through a series of badniks since they spawn an animal and a point total.

EDIT: oh right those despawn as soon as they go offscreen unlike the broken monitor

EDIT2: also seems to be REALLY hard if not impossible to trigger with other monitors besides the S one, so I bet the checking is related to a race condition with loading the super state
This post has been edited by muteKi: 01 August 2014 - 11:07 PM

#20 User is offline kazblox 

Posted 01 November 2016 - 10:11 PM

  • Posts: 120
  • Joined: 20-August 14
  • Gender:Male
  • Project:Sonic 3?
This is a large bump, but for future reference, I'll state it clear: It's Hyper Sonic's stars that cause the game to corrupt it's memory.

Flamewing pointed out that Hyper Sonic's stars use Moduled Kosinski art... When looking into this glitch, he pointed out that the code for decompressing KosM art in Sonic 3 and Sonic and Knuckles does not check for overflows in it's buffer. You can probably guess what would happen if you queued too many art files.

Always check for overflows!


#21 User is offline nineko 

Posted 01 November 2016 - 10:20 PM

  • I am the Holy Cat
  • Posts: 5566
  • Joined: 17-August 06
  • Gender:Male
  • Location:italy
  • Project:I... don't even know anymore :U
  • Wiki edits:5,251
Interesting, so that's why it doesn't crash if you place and break tons of S monitors with Knuckles instead.
This post has been edited by nineko: 01 November 2016 - 10:20 PM

#22 User is offline flamewing 

Posted 02 November 2016 - 07:41 AM

  • Emerald Hunter
  • Posts: 1113
  • Joined: 11-October 10
  • Gender:Male
  • Location:🇫🇷 France
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12
FYI, I confirmed my theory: if you find this piece of code:
Queue_Kos_Module:
		lea	(Kos_module_queue).w,a2
		tst.l	(a2)	; is the first slot free?
		beq.s	Process_Kos_Module_Queue_Init	; if it is, branch
		addq.w	#6,a2	; otherwise, check next slot

$$findFreeSlot:
		tst.l	(a2)
		beq.s	$$freeSlotFound
		addq.w	#6,a2
		bra.s	$$findFreeSlot
; ---------------------------------------------------------------------------

$$freeSlotFound:
		move.l	a1,(a2)+	; store source address
		move.w	d2,(a2)+	; store destination VRAM address
		rts
; End of function Queue_Kos_Module

and replace it with this:
Queue_Kos_Module:
		lea	(Kos_module_queue).w,a2
		tst.l	(a2)	; is the first slot free?
		beq.s	Process_Kos_Module_Queue_Init	; if it is, branch
		moveq	#$1E/6-2,d3	; -2 since we already checked one slot; I *think* $1E is the queue size?
		addq.w	#6,a2	; otherwise, check next slot

$$findFreeSlot:
		tst.l	(a2)
		beq.s	$$freeSlotFound
		addq.w	#6,a2
		dbra	d3,$$findFreeSlot
		rts
; ---------------------------------------------------------------------------

$$freeSlotFound:
		move.l	a1,(a2)+	; store source address
		move.w	d2,(a2)+	; store destination VRAM address
		rts
; End of function Queue_Kos_Module

then you can break as many monitors as you wish and nothing will happen.

Funny thing: future versions of SCH use KosM and don't have the above bounds check, but even if I were to add a S3&K-like S monitor, it still would not crash because the Hyper Stars only get queued for decoding if they are not loaded already.

#23 User is offline Travelsonic 

Posted 11 December 2016 - 01:05 PM

  • Posts: 705
  • Joined: 01-March 05

View PostChibisteven, on 30 July 2014 - 09:45 PM, said:

Debug mode glitches aren't technically glitches as you never encounter them during normal game play.


By the strict definition of a glitch, though, how relevant is that distinction? In all the time I've been lurking around here, and other sites, I've seen this argument presented, but never understood it in full.... I mean, I could see deliberately causing the aforementioned problem as one thing, but doing one thing, and another problem popping up down the pike due to it seems different, to me at least.
This post has been edited by Travelsonic: 11 December 2016 - 01:13 PM

#24 User is offline DigitalDuck 

Posted 11 December 2016 - 05:21 PM

  • Arriving four years late.
  • Posts: 4608
  • Joined: 23-June 08
  • Gender:Male
  • Location:Lincs, UK
  • Project:TurBoa, S1RL

View PostTravelsonic, on 11 December 2016 - 01:05 PM, said:

By the strict definition of a glitch, though, how relevant is that distinction? In all the time I've been lurking around here, and other sites, I've seen this argument presented, but never understood it in full.... I mean, I could see deliberately causing the aforementioned problem as one thing, but doing one thing, and another problem popping up down the pike due to it seems different, to me at least.


Technically, they're all glitches. Debug mode glitches aren't bugs, however.

#25 User is offline Blue Blood 

Posted 11 December 2016 - 07:14 PM

  • Posts: 4366
  • Joined: 15-January 05
  • Gender:Male
  • Wiki edits:6
The thing about debug is you're intentionally putting the game into an unstable mode designed specifically for testing. Things aren't going to behave as they should. When glitches happen in regular gameplay though, you'll have found a bug in the system. It's something that shouldn't be there and has, for whatever reason, slipped through the net.
This post has been edited by Blue Blood: 11 December 2016 - 07:14 PM

#26 User is offline The Growler 

Posted 12 December 2016 - 11:42 AM

  • Posts: 1064
  • Joined: 05-January 07
  • Gender:Male
  • Location:Sheffield, UK

View PostDigitalDuck, on 11 December 2016 - 05:21 PM, said:

View PostTravelsonic, on 11 December 2016 - 01:05 PM, said:

By the strict definition of a glitch, though, how relevant is that distinction? In all the time I've been lurking around here, and other sites, I've seen this argument presented, but never understood it in full.... I mean, I could see deliberately causing the aforementioned problem as one thing, but doing one thing, and another problem popping up down the pike due to it seems different, to me at least.


Technically, they're all glitches. Debug mode glitches aren't bugs, however.

That begs the question as to why it's called "DE-BUG" Mode in the first place.

#27 User is offline Dark Sonic 

Posted 12 December 2016 - 11:52 AM

  • Posts: 10929
  • Joined: 21-April 06
  • Gender:Male
  • Project:Working on my art!
  • Wiki edits:10

View PostThe Growler, on 12 December 2016 - 11:42 AM, said:

View PostDigitalDuck, on 11 December 2016 - 05:21 PM, said:

View PostTravelsonic, on 11 December 2016 - 01:05 PM, said:

By the strict definition of a glitch, though, how relevant is that distinction? In all the time I've been lurking around here, and other sites, I've seen this argument presented, but never understood it in full.... I mean, I could see deliberately causing the aforementioned problem as one thing, but doing one thing, and another problem popping up down the pike due to it seems different, to me at least.


Technically, they're all glitches. Debug mode glitches aren't bugs, however.

That begs the question as to why it's called "DE-BUG" Mode in the first place.

Well, Debug mode can help them find bugs yes, like "Oh we need to test this badnik but I don't want to go all the way over there, so I'll just plant one." But I don't think "The game had a seizure because you planted 50 Super Sonic boxes" counts as a bug really.

It depends on what it's used for.

#28 User is offline TheInvisibleSun 

Posted 12 December 2016 - 12:24 PM

  • OVER THE TOP TECHNO-BLAST
  • Posts: 1336
  • Joined: 09-December 09
  • Gender:Male
  • Location:Buffalo, NY, USA
  • Project:Sonic 1 Color Contrast

View PostDigitalDuck, on 11 December 2016 - 05:21 PM, said:

View PostTravelsonic, on 11 December 2016 - 01:05 PM, said:

By the strict definition of a glitch, though, how relevant is that distinction? In all the time I've been lurking around here, and other sites, I've seen this argument presented, but never understood it in full.... I mean, I could see deliberately causing the aforementioned problem as one thing, but doing one thing, and another problem popping up down the pike due to it seems different, to me at least.


Technically, they're all glitches. Debug mode glitches aren't bugs, however.


they're features

#29 User is offline DigitalDuck 

Posted 12 December 2016 - 06:47 PM

  • Arriving four years late.
  • Posts: 4608
  • Joined: 23-June 08
  • Gender:Male
  • Location:Lincs, UK
  • Project:TurBoa, S1RL

View PostDark Sonic, on 12 December 2016 - 11:52 AM, said:

Well, Debug mode can help them find bugs yes, like "Oh we need to test this badnik but I don't want to go all the way over there, so I'll just plant one." But I don't think "The game had a seizure because you planted 50 Super Sonic boxes" counts as a bug really.


Exactly. Most games have some form of debug mode while in development (and in the case of the classic Sonic games, they're left in for release). Typically they involve a level select, some method of moving about the level a lot more quickly, object manipulation, etc.

#30 User is offline Neo 

Posted 13 December 2016 - 03:50 PM

  • Clackerjack
  • Posts: 1288
  • Joined: 10-December 04
  • Gender:Male
  • Location:Portugal
  • Project:Sonic 3 Unlocked
  • Wiki edits:1

View PostThe Growler, on 12 December 2016 - 11:42 AM, said:

That begs the question as to why it's called "DE-BUG" Mode in the first place.

"Debug mode" is a fan moniker, Sonic Jam calls it "edit mode".

  • 4 Pages +
  • 1
  • 2
  • 3
  • 4
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users