Huge Hardware Incompatiblity issue w/ Special Stage Art

Discussion in 'Discussion and Q&A Archive' started by Pacca, Mar 17, 2015.

Thread Status:
Not open for further replies.
  1. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    So in my Sonic 1 hack, I have the original stages with custom layouts. I haven't touched anything to do with the stages beyond the level layout (I haven't even touched the art and mappings). Despite this, the game crashes on Regen without displaying a helpful error message. It runs fine on Fusion, implying that this is a hardware only issue. I've completely overwritten both "Obj09" and the "SpecialStage" code sections with their original code, straight from a clean disassembly. I've been struggling with this for months now, and it seems that the only way to prevent the game from crashing is to prevent Obj09 from displaying it's special stage graphics on screen (I learned that through backtracking; removing the last vital line from "SS_FixCamera" before the rts fixes the crashing, but makes the stage load off screen).

    I'm so desperate, that I'm releasing a heavily limited version of my hack to speed things along; use the original S1 level select code on the title screen and select special stage option; I've bombed the "level" routine, so the rest of the hack is locked off.

    Download

    P.S. I'm genuinely sorry if it seems like I'm begging, but this is a huge, game breaking issue, and it seems to be beyond my normal abilities to fix. I hope this becomes a learning experience for me and anyone else who stumbles on this topic.

    EDIT: Another problem I forgot about: It loads the graphics of the previous level alongside the normal special stage art, glitching up some of the graphics as a result. I have no explanation for this; the special stage routine loads it's own PLCs on start, and making the game run the special stages PLCs every frame didn't make a difference. I have not even touched the PLCs for the special stage.
     
    Last edited by a moderator: Mar 17, 2015
  2. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    The crash is occurring in the "SS_ShowLayout" subroutine:

    Code:
    		adda.w	(a1,d1.w),a1
    a1 contained an odd address, it collected the odd address from here:
    Code:
    		lea	($FF4000).l,a5		; FF4000
    		lsl.w	#3,d0			; 0008
    		lea	(a5,d0.w),a5		; FF4008
    		movea.l	(a5)+,a1		; 03BC6D
    		move.w	(a5)+,d1		; 0000
    		add.w	d1,d1			; 0000
    		adda.w	(a1,d1.w),a1		; Crash, odd address...
    In RAM 4000, this is where the layout is decompressed to:
    Code:
    SS_LoadData:
    		lsl.w	#2,d0
    		lea	SS_StartLoc(pc,d0.w),a1
    		move.w	(a1)+,($FFFFD008).w
    		move.w	(a1)+,($FFFFD00C).w
    		movea.l	SS_LayoutIndex(pc,d0.w),a0
    		lea	($FF4000).l,a1
    		move.w	#0,d0
    		jsr	(EniDec).l
    Inside the layout, there are a series of pointers that are loaded into the layout section of RAM:
    Code:
    		lea	($FF4008).l,a1
    		lea	(SS_MapIndex).l,a0
    		moveq	#$4D,d1
    
    loc_1B714:
    		move.l	(a0)+,(a1)+
    		move.w	#0,(a1)+
    		move.b	-4(a0),-1(a1)
    		move.w	(a0)+,(a1)+
    		dbf	d1,loc_1B714
    These reference up against:
    Code:
    SS_MapIndex:
    	include "_incSpecial stage mappings and VRAM pointers.asm"
    Code:
    ; ---------------------------------------------------------------------------
    ; Special stage	mappings and VRAM pointers
    ; ---------------------------------------------------------------------------
    	dc.l Map_SSWalls	; address of mappings
    	dc.w $142		; VRAM setting
    	dc.l Map_SSWalls
    	dc.w $142
    	etc
    	etc
    So where in ROM is Map_SSWalls? And is it on an even address?
    Code:
    Nem_Goggle:	incbin	artnemxxxgoggl.bin	; unused goggles
    		even			; <- Is this here?
    ; ---------------------------------------------------------------------------
    ; Sprite mappings - walls of the special stage
    ; ---------------------------------------------------------------------------
    Map_SSWalls:
    	include "_mapsSSwalls.asm"
    Are these mappings OK too?
     
    Last edited by a moderator: Mar 17, 2015
  3. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    I've already put an even under the wall mappings, with no effect. I looked through the mappings pointer list you showed me, too, and added evens to every mapping mentioned in the list; nothing changed. However, adding evens below the goggle mappings as well as some others I shoved in worked! It still suffers that huge graphical bug I mentioned, but I'm just relieved it worked out! I better see if there are any other mappings I should even out...
     
Thread Status:
Not open for further replies.