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

Author Topic: Streets of Rage 2 Title Screen Hacking Questions  (Read 2168 times)

eskayelle

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Streets of Rage 2 Title Screen Hacking Questions
« on: August 08, 2019, 10:48:56 pm »
tl;dr version: I'm trying to change the title screen for SoR2 and have some ideas on how I might do it (currently about 2-3 responses down from here).  I have the offset for the palette, the plane table mapping, and the title screen but I need some guidance regarding how to put all that information together.



Hi. I'm currently experimenting with hacking title screens for Genesis, specifically Streets of Rage 2, so I'm looking for someone with Genesis assembly experience to provide a little guidance. I don't have much Genesis hacking experience, as I've spent the last few summers working with the SNES, but I have some idea of where I need to go.

1-6) [DELETED THE ORIGINAL TEXT, SINCE IT'S WORDY AND DID NOT WORK.]

[22 August 2019 EDIT: Here's where I am so far...

I had run a tracelog from the point at which the demo fades out to the point at which the title screen displays. I did some searches on $00:A900 (dumping RAM at the title screen and dropping that RAM into an image editing tool yields that address) and found this code:
Code: [Select]
00:5C08  41 F9  LEA     ($00039018),A0           A0=FFFFFC1A A1=001EC160 A2=00166A70 A3=FFFFEC80 A4=00C00004 A5=FFFFEE00 A6=FFFFEC80 A7=FFFFFFFC D0=000000B8 D1=51B2FFFF D2=00000617 D3=87D10C3C D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc

This appears to be the offset for the screen. I replaced 00 03 90 18 with 00 2D A4 90. $2DA490 is where I've dropped in my title screen.

Specs for the plane table are here:
Code: [Select]
00:5C2C  4D F9  LEA     ($00038B94),A6
00:5C32  2A 3C  MOVE.L  #$61060003,D5
00:5C38  7E 21  MOVEQ   #$21,D7
00:5C3A  7C 10  MOVEQ   #$10,D6
00:5C3C  4E B9  JSR     ($000017D0)

My changes:
$5C2E: Changed from 00 03 8B 94 to 00 2D A0 F0. $2DA0F0 is where my sprite table starts (first tile being #$2000, based on checking bits and converting binary to hex; last tile is #$21BF). I also modified $5C39 and $5C3B to read as #$20 and #$0E instead of #$21 and #$10, since my tileset is slightly smaller. I'm using a graphic that's 32x14 tiles, versus the original's 33x16.

I did not alter code at $5C32, the respective Y,X starting point. Figured I'd wait till I can see the title graphic on screen.

Code: [Select]
00:5C16  21 FC  MOVE.L  #$40000000,($FC56)   
00:5C1E  21 FC  MOVE.L  #$941693C0,($FC5A)

RadioShadow suggested to change the 40 00 00 00 to 40 08 00 00 to write the title graphics to VRAM at $0200. I don't have guidance yet on $5C1E... could be part of the problem.

Looking at VDP RAM, the tiles never make their way in before the game crashes.

The crash appears to occur at $30D0:

Code: [Select]

00:5C08  41 F9  LEA     ($002DA490),A0           A0=00C00000 A1=00005A42 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFFC D0=00000000 D1=4C0CFFFF D2=00000C00 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:5C0E  43 F8  LEA     ($A900),A1               A0=002DA490 A1=00005A42 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFFC D0=00000000 D1=4C0CFFFF D2=00000C00 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:5C12  61 00  BSR     #$D4AC [00:30C0]         A0=002DA490 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFFC D0=00000000 D1=4C0CFFFF D2=00000C00 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:30C0  48 E7  MOVEM.L {d0-a7}[e0 20],-(SP)     A0=002DA490 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFF8 D0=00000000 D1=4C0CFFFF D2=00000C00 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:30C4  22 08  MOVE.L  A0,D1                    A0=002DA490 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=4C0CFFFF D2=00000C00 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:30C6  74 00  MOVEQ   #$00,D2                  A0=002DA490 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA490 D2=00000C00 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnzvc
00:30C8  14 18  MOVE.B  (A0)+,D2                 A0=002DA490 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA490 D2=00000000 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnZvc
00:30CA  10 18  MOVE.B  (A0)+,D0                 A0=002DA491 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA490 D2=00000000 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnZvc
00:30CC  E1 48  LSL.W   #8,D0                    A0=002DA492 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA490 D2=00000000 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnZvc
00:30CE  84 40  OR.W    D0,D2                    A0=002DA492 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA490 D2=00000000 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnZvc
00:30D0  D4 81  ADD.L   D1,D2                    A0=002DA492 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA490 D2=00000000 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnZvc

I think that $30xx code is decompression for the background, as NOPing it (4E 71 from $30C0 through $3160) killed the backgrounds in attract mode, particularly the Stage 1 playthrough and the Mr. X intro. But a title screen with no image ran. Meanwhile, NOPing the BSR to it at $5C12 through $5C15 was displaying garbage tiles as a title screen.  Maybe it's the actual push to VRAM and I just need help with some code to bypass it just for the title screen and instead move my new title screen tiles through, using my new map?]


Any additional guidance you can provide would be a huge help!
« Last Edit: August 22, 2019, 07:56:49 am by eskayelle »

RadioShadow

  • Sr. Member
  • ****
  • Posts: 335
  • Holding the Mega Drive controller
    • View Profile
Re: Streets of Rage 2 Title Screen Hacking Questions
« Reply #1 on: August 09, 2019, 11:09:20 am »
Let's break this down in what you should be investigating.

Now the Mega Drive uses the Control Port to write or read to the CRAM (Colors), VRAM (Video), or VSRAM (Scrolling Video). More details here: https://segaretro.org/Sega_Mega_Drive/VDP_general_usage#Control_port

The layout is a bit crazy, but if you can figure out what address the palettes or graphics are being transferred, you could search for address value in a trace.

For example, to write to CRAM address $0: #$C0000000

While the palettes are most likely not compressed, the graphics probably are. There are loads of graphic hacks of SOR2, so I suspect its using a common compression like Nemesis (https://segaretro.org/Nemesis_compression). Nemesis does have a tool that can detect and separate them, so you could give that a shot.

Now the next thing to figure out is are the tiles being stored in the Plane or as Sprites?

If it's on a Plane, then you have to use Plane Tables to transfer 8x8 tiles to the required location. More details on here: http://md.railgun.works/index.php/VDP#Nametables

If it's using Sprites, then you have to use Sprite Attribute Tables to determine the size, tiles to use, flip, pattern etc. More details here: http://md.railgun.works/index.php/VDP#Sprites

If you can figure the where the address are, you could search the data in the rom, or find it in a trace.

When I get some time, I'll have a look myself. Hope this helps.

August 10, 2019, 07:12:14 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Using the USA version, the title is stored in the Plane B area. The rom stores them as mapping values.

English Title (US version) = 38B94 to 38FD4 (440 Hex Bytes)

I also found this in the trace:

00:5C2C  4D F9  LEA     ($00038B94),A6
00:5C32  2A 3C  MOVE.L  #$61060003,D5
00:5C38  7E 21  MOVEQ   #$21,D7   
00:5C3A  7C 10  MOVEQ   #$10,D6
00:5C3C  4E B9  JSR     ($000017D0)


5C2C = Offset to Plane Table Title, so you can store the data at end of the ROM and expand.
5C39 = Length of Title (hex)
5C3B = Height of Title (hex)
5C34 = Y Position of Title (hex)
5C35 = X Position of Title (hex)

Now we just need to figure out where the palettes and graphics are. The graphics are not Nemesis compressed, so I need to do some digging. It feels great when you make progress.
« Last Edit: August 10, 2019, 07:12:14 am by RadioShadow »

eskayelle

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Streets of Rage 2 Title Screen Hacking Questions
« Reply #2 on: August 10, 2019, 11:22:29 am »
Thanks for the guidance!

So I ran a tracelog from the point at which the demo fades out to the point at which the title screen displays.  I did some searches on $00:A900 (dumping RAM at the title screen and dropping that RAM into an image editing tool yields that address) and found this code:

Code: [Select]
00:5C08  41 F9  LEA     ($00039018),A0           A0=FFFFFC1A A1=001EC160 A2=00166A70 A3=FFFFEC80 A4=00C00004 A5=FFFFEE00 A6=FFFFEC80 A7=FFFFFFFC D0=000000B8 D1=51B2FFFF D2=00000617 D3=87D10C3C D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc

This appears to be the offset for the screen!

I opened the ROM in Pancake 2, decompressed from that offset and - lo and behold - I was able to drop the resulting .bin into SonMapEd and see the title screen.

Next issue is that the title screen code must be mapping the same tiles more than once, particularly for the "E"s and maybe part of the "S" in "Streets".  Likely elsewhere too, but I didn't look into it that far.

The above being the case, if I were to drop my title screen into expanded ROM, I'm not sure yet how to:
1) repoint the ROM to it (perhaps via that LEA I wrote above?);
2) create code that will assign the tiles in the proper order; and
3) jump back to the proper code, ignoring the decompression routine

Code: [Select]
;the $A900 is the address of the tiles when dumping title screen RAM and viewing in TileMolestor
00:5C0E  43 F8  LEA     ($A900),A1               A0=00039018 A1=001EC160 A2=00166A70 A3=FFFFEC80 A4=00C00004 A5=FFFFEE00 A6=FFFFEC80 A7=FFFFFFFC D0=000000B8 D1=51B2FFFF D2=00000617 D3=87D10C3C D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:5C12  61 00  BSR     #$D4AC [00:30C0]         A0=00039018 A1=FFFFA900 A2=00166A70 A3=FFFFEC80 A4=00C00004 A5=FFFFEE00 A6=FFFFEC80 A7=FFFFFFFC D0=000000B8 D1=51B2FFFF D2=00000617 D3=87D10C3C D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:30C0  48 E7  MOVEM.L {d0-a7}[e0 20],-(SP)     A0=00039018 A1=FFFFA900 A2=00166A70 A3=FFFFEC80 A4=00C00004 A5=FFFFEE00 A6=FFFFEC80 A7=FFFFFFF8 D0=000000B8 D1=51B2FFFF D2=00000617 D3=87D10C3C D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:30C4  22 08  MOVE.L  A0,D1                    A0=00039018 A1=FFFFA900 A2=00166A70 A3=FFFFEC80 A4=00C00004 A5=FFFFEE00 A6=FFFFEC80 A7=FFFFFFE8 D0=000000B8 D1=51B2FFFF D2=00000617 D3=87D10C3C D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:30C6  74 00  MOVEQ   #$00,D2                  A0=00039018 A1=FFFFA900 A2=00166A70 A3=FFFFEC80 A4=00C00004 A5=FFFFEE00 A6=FFFFEC80 A7=FFFFFFE8 D0=000000B8 D1=00039018 D2=00000617 D3=87D10C3C D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnzvc

Any tips on next steps?

August 10, 2019, 11:43:00 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Just saw your post from today.  Here's a quick hash total on the rom to verify we're using the same one:



I do see the code you noted in my tracelog as well:

Code: [Select]
00:5C2C  4D F9  LEA     ($00038B94),A6           A0=0003A4A2 A1=FFFFD680 A2=00166A70 A3=FFFFEC80 A4=00C00004 A5=FFFFEE00 A6=FFFFEC80 A7=FFFFFFFC D0=000000B8 D1=51B2FFFF D2=00000617 D3=87D10C3C D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNZvc
00:5C32  2A 3C  MOVE.L  #$61060003,D5            A0=0003A4A2 A1=FFFFD680 A2=00166A70 A3=FFFFEC80 A4=00C00004 A5=FFFFEE00 A6=00038B94 A7=FFFFFFFC D0=000000B8 D1=51B2FFFF D2=00000617 D3=87D10C3C D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNZvc
00:5C38  7E 21  MOVEQ   #$21,D7                  A0=0003A4A2 A1=FFFFD680 A2=00166A70 A3=FFFFEC80 A4=00C00004 A5=FFFFEE00 A6=00038B94 A7=FFFFFFFC D0=000000B8 D1=51B2FFFF D2=00000617 D3=87D10C3C D4=940D8134 D5=61060003 D6=00000000 D7=0000FFFF xnzvc
00:5C3A  7C 10  MOVEQ   #$10,D6                  A0=0003A4A2 A1=FFFFD680 A2=00166A70 A3=FFFFEC80 A4=00C00004 A5=FFFFEE00 A6=00038B94 A7=FFFFFFFC D0=000000B8 D1=51B2FFFF D2=00000617 D3=87D10C3C D4=940D8134 D5=61060003 D6=00000000 D7=00000021 xnzvc
00:5C3C  4E B9  JSR     ($000017D0)              A0=0003A4A2 A1=FFFFD680 A2=00166A70 A3=FFFFEC80 A4=00C00004 A5=FFFFEE00 A6=00038B94 A7=FFFFFFFC D0=000000B8 D1=51B2FFFF D2=00000617 D3=87D10C3C D4=940D8134 D5=61060003 D6=00000010 D7=00000021 xnzvc

Based on my other findings, to your point on locating tiles and palette, I believe the offset for the tiles are at $39018 and the palette is at $5D74.

Let me know where you suggest going with this round of info.  And thanks for helping me get this far!!!   :beer:

August 12, 2019, 09:00:54 am - (Auto Merged - Double Posts are not allowed before 7 days.)
I took the weekend to work on a few sprite fixes, plus ponder the contents of this thread and the links within it.  As everything starts to click, I wonder if next steps are as follows (bolding my specific questions for ease of read):

1) Drop the title screen into expanded rom using an image editor like TileMolestor.  Is the format 4bpp?
2) Change the hex at $5C08 so it points to the start of the title screen in expanded rom instead of $39018.
3) Overwrite the palette bytes at $5D74 using the palette associated with my title screen.  Photoshop and a Palette Converter from here on RHDN will likely get me there.  I may also need to adjust my palette a bit to get rid of that shimmer that happens now at the title screen, but I'll cross that bridge once I can see the title screen in game.
4) Copy the plane table mapping to expanded rom and adjust it based on my title screen.

Here, I'm looking to understand better how those commands in this thread are managing the original table. 
a) Are they starting the screen at the upper left (X,Y coordinate 128,128)?
b) Are they then placing the tiles in VRAM one-by-one (in an 8x8 tile format), horizontally from left to right, then moving to the next vertical line? 
c) The #$21 and #$10 tile length and height are currently throwing me a bit, so I'm not sure if anything here needs to change when using the new map in expanded rom.  Similarly, I'm not sure if changes need to be made to Y,X position at $5C34 and $5C35?
d) As of right now, my title screen graphic size will be 256x112 pixels.  Will that be within the specs for the 68000?  Do I need to do any cutting of the length?  Reset it to 256x224 or 320x240?
e) The plane table seems to read as two byte values for each title, them then being positioned one-by-one, starting with tile 20 00.  When the 256th tile is reached, the next tile is value 21 00.  The same tile can be used several times, which seems to occur frequently with tile 20 00 (I assume this is a pure black background style tile).  Is my interpretation accurate? 
f) The end of the table is $38FD4, not $39017?  If so, what is the rest of this data between $38FD4 and $39017?  Is it relevant?
g) Inside the plane table map, some tiles appear to start with 38.  What does that mean?


Couple quick snaps of what I'm looking at in the hex:




5) Once the plane table map is finalized, change the hex at $5C2C so it points to the start of the tile mapping in expanded rom instead of $38B94.

Any adjustments I need to make to my gameplan?  (Like finding and NOPing the decompression routine?)
« Last Edit: August 12, 2019, 05:38:22 pm by eskayelle »

RadioShadow

  • Sr. Member
  • ****
  • Posts: 335
  • Holding the Mega Drive controller
    • View Profile
Re: Streets of Rage 2 Title Screen Hacking Questions
« Reply #3 on: August 13, 2019, 07:40:48 am »
The Plane Table data at 38B94 just contains each tile data to place on the Plane (2 hex bytes).

The code has been setup so the tiles automatically display on the next row based on the length that is set, and stops based on the height that was set.

It is currently set to 33 x 16 tiles.
So (33 x 16) * 2 = 1056 (Hex: 420)

So add 420 to 38B94 = 38FB4

So the Plane Table Data is between. 38B94 to 38FB4

------------------------------------------

When displaying the tile from the VRAM to Plane, it uses a specfic format. Let's take a look at 215F.

Convert this to binary: 215F = 0010000101011111

Each bit represents a task:

0 01 0 0 00101011111
P PL V H T

P  = Priority
PL = Palette Set
V  = Vertical Flip
H  = Horizontal Filp
T  = Tile ID

So in this case, it uses palette set 1 and uses tile ID 15F from the VRAM.

So you can basically set the properties for each  tile. So to set the following:

P  = High
PL = 2
V  = No
H  = Yes
T  = 243

This is how it is set in binary:
         
1 10 0 1 01001000011
P PL V H T

Convert to hex: 1100101001000011 = CA43

------------------------------------------

Hope that helps.

eskayelle

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Streets of Rage 2 Title Screen Hacking Questions
« Reply #4 on: August 13, 2019, 08:54:29 pm »
Thanks!

So I made a table in Excel using my 256x112 pixel intro (32x14 tiles) and noted that -- using the binary bits for priority, palette set, etc. -- I end up at tiles of values #$20 00 through #$21 C0, which seems like I'm on the right track when I compare to some of the original table.  I set up my plane table in expanded rom and then used TileMolestor (4bpp linear) to paste my title screen in as well.  I then made the following edits to the rom:

1) Changed $5C2E from 00 03 8B 94 to 00 2D A0 F0, the location of my new plane table.

2) Changed $5C39 to from 21 to 20 (32 tiles horizontally).

3) Changed $5C3B from 10 to 0E (14 tiles vertically).

4) Kept $5C34 and 35 as #$6106.  Not sure if I need to play with the coordinates yet, as the screen doesn't show.

5) Changed $5C0A from 00 03 90 18 to 00 2D A4 80, the starting point for where I dropped in the title screen tiles.

6) I overwrote the palette at $5D74 with a palette I obtained for my new title screen using Photoshop and a Palette Converter on this site.

I didn't change the X,Y starting coordinates (see item #4 above).  I'm also not positive of where the decompression routine is, so I didn't NOP that yet.  After fixing the checksum, the game boots and seems to freeze at the title screen.  Is the problem that the game's still attempting to decompress the new title screen?  Any other reason the title screen wouldn't display?  (Is there a better way I should be dropping in the title screen?) 

Doing a trace, the game seems like it breaks around $30D0:
Code: [Select]
00:5C04  67 00  BEQ     #$0040 [00:5C46]         A0=FFFFFC1A A1=00005A42 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFFC D0=00000000 D1=0000FFFF D2=00000C10 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:5C08  41 F9  LEA     ($002DA480),A0           A0=FFFFFC1A A1=00005A42 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFFC D0=00000000 D1=0000FFFF D2=00000C10 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:5C0E  43 F8  LEA     ($A900),A1               A0=002DA480 A1=00005A42 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFFC D0=00000000 D1=0000FFFF D2=00000C10 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:5C12  61 00  BSR     #$D4AC [00:30C0]         A0=002DA480 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFFC D0=00000000 D1=0000FFFF D2=00000C10 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:30C0  48 E7  MOVEM.L {d0-a7}[e0 20],-(SP)     A0=002DA480 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFF8 D0=00000000 D1=0000FFFF D2=00000C10 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:30C4  22 08  MOVE.L  A0,D1                    A0=002DA480 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=0000FFFF D2=00000C10 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:30C6  74 00  MOVEQ   #$00,D2                  A0=002DA480 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA480 D2=00000C10 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnzvc
00:30C8  14 18  MOVE.B  (A0)+,D2                 A0=002DA480 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA480 D2=00000000 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnZvc
00:30CA  10 18  MOVE.B  (A0)+,D0                 A0=002DA481 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA480 D2=00000000 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnZvc
00:30CC  E1 48  LSL.W   #8,D0                    A0=002DA482 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA480 D2=00000000 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnZvc
00:30CE  84 40  OR.W    D0,D2                    A0=002DA482 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA480 D2=00000000 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnZvc
00:30D0  D4 81  ADD.L   D1,D2                    A0=002DA482 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA480 D2=00000000 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnZvc

Do I need to re-route $5C12?  If so, any suggestions as to where?  Seems like the next routine is from $30C0 through $3160, with an RTS at $3160.  Should I leave $5C12 and NOP (4E 71) all the bytes from $30C0 till I get to $3160?



Hmmm... NOPing that code got the title screen running, but my tiles are completely black and the remaining Streets of Rage 2 ones can be seen just below them; plus the backgrounds are killed during the Mr. X scene in attract mode and the Scene 1 demo.  Wondering what step I may have missed?



OK... so this must be a general/overall decompression routine that I need.  So what if I take a step back and just NOP $5C12 through $5C15?  I get backgrounds back, and my title screen is this:



(This is actually after the demo/attract mode runs.  The first time the title screen shows, it's even more garbled.)

Some of these do look like my titles, but I'm not positive of what I've done wrong.  Doing a few more NOPs between $5C16 and $5C2C, I'm finding that the tiles don't appear to be placed in VRAM.  Is there a command that needs to be added?  More or different commands to NOP?
« Last Edit: August 14, 2019, 07:27:09 am by eskayelle »

RadioShadow

  • Sr. Member
  • ****
  • Posts: 335
  • Holding the Mega Drive controller
    • View Profile
Re: Streets of Rage 2 Title Screen Hacking Questions
« Reply #5 on: August 14, 2019, 04:13:56 pm »
I think you have set the wrong values if the colors are not correct. Try only editing the values I mentioned.

Also, I think the graphics are uncompressed (EDIT: Only some are uncompressed):


Now these two line of codes are interesting:


00:5C16  21 FC  MOVE.L  #$40000000,($FC56)     
00:5C1E  21 FC  MOVE.L  #$941693C0,($FC5A)


The #$40000000 basically tells the Control Port to Write to VRAM at address 0000. Change it to #$40080000 to write the title graphics to VRAM at 0200. :)

The the second line is something to with the where the tiles are stored. Just trying to figure out the format.
« Last Edit: August 14, 2019, 04:38:10 pm by RadioShadow »

eskayelle

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Streets of Rage 2 Title Screen Hacking Questions
« Reply #6 on: August 14, 2019, 05:07:35 pm »
Hey, RadioShadow.

Hmmmmm.... if I only make the following changes, the game gets to the title screen but never generates tiles.  Instead it stays black, never loads text, and eventually turns green.  Nothing after.

$5C16: Changed from 21 FC 40 00 00 00 to 21 FC 40 08 00 00.

$5C2E: Changed from 00 03 8B 94 to 00 2D A0 F0.  $2DA0F0 is where my sprite table starts (first tile being #$2000).

$5C0A: Changed from 00 03 90 18 to 00 2D A4 90.  $2DA490 is where I'm trying to sit my first title screen tile (copying it in thru TileMolester, still presuming 4bpp linear for now).

Looking at VDP RAM, the tiles never make their way in before the game crashes.

The crash appears to occur at $30D0 again:

Code: [Select]
00:5C08  41 F9  LEA     ($002DA490),A0           A0=00C00000 A1=00005A42 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFFC D0=00000000 D1=4C0CFFFF D2=00000C00 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:5C0E  43 F8  LEA     ($A900),A1               A0=002DA490 A1=00005A42 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFFC D0=00000000 D1=4C0CFFFF D2=00000C00 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:5C12  61 00  BSR     #$D4AC [00:30C0]         A0=002DA490 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFFC D0=00000000 D1=4C0CFFFF D2=00000C00 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:30C0  48 E7  MOVEM.L {d0-a7}[e0 20],-(SP)     A0=002DA490 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFF8 D0=00000000 D1=4C0CFFFF D2=00000C00 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:30C4  22 08  MOVE.L  A0,D1                    A0=002DA490 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=4C0CFFFF D2=00000C00 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xNzvc
00:30C6  74 00  MOVEQ   #$00,D2                  A0=002DA490 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA490 D2=00000C00 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnzvc
00:30C8  14 18  MOVE.B  (A0)+,D2                 A0=002DA490 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA490 D2=00000000 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnZvc
00:30CA  10 18  MOVE.B  (A0)+,D0                 A0=002DA491 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA490 D2=00000000 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnZvc
00:30CC  E1 48  LSL.W   #8,D0                    A0=002DA492 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA490 D2=00000000 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnZvc
00:30CE  84 40  OR.W    D0,D2                    A0=002DA492 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA490 D2=00000000 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnZvc
00:30D0  D4 81  ADD.L   D1,D2                    A0=002DA492 A1=FFFFA900 A2=000233B2 A3=FFFFEC80 A4=00C00004 A5=FFFFF500 A6=FFFFEC86 A7=FFFFFFE8 D0=00000000 D1=002DA490 D2=00000000 D3=00000003 D4=940D8134 D5=50000083 D6=00000000 D7=0000FFFF xnZvc

(After all this, just to see, I also modified $5C39 and $5C3B to read as #$20 and #$0E instead of #$21 and #$10, since my tileset is slightly smaller.  As expected, the outcome's the same as above.) 
« Last Edit: August 14, 2019, 07:33:27 pm by eskayelle »

eskayelle

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Streets of Rage 2 Title Screen Hacking Questions
« Reply #7 on: August 25, 2019, 11:49:55 am »
Making some fairly good progress with the title screen.

Any advice on what I might want to NOP to kill the animation / palette shifting on the title screen? I haven't been able to figure out where it's happening in my tracelog just yet.

August 25, 2019, 06:10:40 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Let's call this solved for now!  Looking up VRAM via Gens and then palettes via HivePal, I found the palette that tends to be "rotated" at $5BB0.  I messed with that and gave it a blinking animation that's pretty neat.

Moving on to some other elements of the ROM before I release.  Big thanks again for the help!
« Last Edit: August 25, 2019, 06:10:40 pm by eskayelle »