ROM Hack Sonic Classic Collection Dumps and Opcode Fixes

DeadSkullzJr

Developer
OP
Developer
Joined
Sep 28, 2017
Messages
1,250
Trophies
0
XP
1,978
Country
United States
Hello everyone, today I decided to bring you something a bit interesting and or different. I wasn't too sure where to really post this, however considering the title of this topic involves a game released for the Nintendo DS, I figured this was the best section to post the content.

For a couple or so months now I have been messing around with Sonic Classic Collection for the Nintendo DS. To fill in those unaware of what this game is, Sonic Classic Collection was a game that contained four titles from the SEGA Genesis based series of the Sonic the Hedgehog (six counting the two lock-on titles), all of which were emulated to run on the Nintendo DS.

The games are as follows (in order):
- Sonic the Hedgehog
- Sonic the Hedgehog 2
- Sonic the Hedgehog 3
- Sonic & Knuckles
- Knuckles the Echidna in Sonic the Hedgehog 2 (Knuckles in Sonic the Hedgehog 2)
- Sonic the Hedgehog 3 & Knuckles (Knuckles in Sonic the Hedgehog 3)

Now that you are aware, let's move forward. Sonic Classic Collection is actually just a coated version of jEnesisDS (homebrew emulator) running a bunch of SEGA Genesis ROMs. Unfortunately not much of anything ever happened for Sonic Classic Collection in the ROM hacking scene and what not. However one thing that did happen back on 2010, the user KazoWAR uploaded a video YouTube of the games ripped right from Sonic Classic Collection as seen here:

The games were sent to Sonic Retro to look into for documentation purposes, however that was as far as it ever went, and sadly that's how it was left for all these years, that was until recently. As I stated earlier I have been messing with Sonic Classic Collection for quite a while, and I am happy to say that I have successfully dumped the games out of Sonic Classic Collection. During the process, I got halfway through until I hit a stump and needed some help, I did however end up figuring out what I was stumped on, but I would like to give thanks to KazoWAR for supplying the solution to the issue I initially contacted them about regardless of me figuring it out myself eventually.

Here is my video of the dumps I did:

I created patches out of these dumps, you'll need the original versions of the games in order for these dumps to work.


Original Games Needed:

Sonic the Hedgehog (World) (Rev 1):
Code:
File: Sonic the Hedgehog (World) (Rev 1).md
File: Sonic the Hedgehog (Japan, Korea).md
CRC-32: afe05eee
MD4: 19d722f330bad4e4cc0b337289501ba3
MD5: 09dadb5071eb35050067a32462e39c5f
SHA-1: 69e102855d4389c3fd1a8f3dc7d193f8eee5fe5b

Sonic the Hedgehog 2 (World) (Rev 1):
Code:
File: Sonic the Hedgehog 2 (World) (Rev 1).md
File: Sonic the Hedgehog 2 (World) (Rev A).md
CRC-32: 7b905383
MD4: 465e3a6be0997c1d74d8e1e5da78d35b
MD5: 9feeb724052c39982d432a7851c98d3e
SHA-1: 8bca5dcef1af3e00098666fd892dc1c2a76333f9

Sonic the Hedgehog 3 (USA):
Code:
File: Sonic the Hedgehog 3 (USA).md
CRC-32: 9bc192ce
MD4: eb8ca69af69cc77b2674bcefa4f1cef8
MD5: d724ea4dd417fe330c9dcfd955c596b2
SHA-1: 75e9c4705259d84112b3e697a6c00a0813d47d71

Sonic & Knuckles (World):
Code:
File: Sonic & Knuckles (World).md
CRC-32: 0658f691
MD4: c593d37a67748636cae21fa127a6575f
MD5: 4ea493ea4e9f6c9ebfccbdb15110367e
SHA-1: 88d6499d874dcb5721ff58d76fe1b9af811192e3


If you attempted to load the Sonic Classic Collection dumps right after patching the original versions of the games, you will notice that none of them will work on any emulator except jEnesisDS. The reason for this is because jEnesisDS incorrectly emulates $Axxx and $Fxxx as if they were $6xxx instructions. The $Axxx opcodes were used to implement system calls on the Motorola 68000 based computers, while the $Fxxx opcodes were used for floating-point co-processors. Considering the nature of these instructions, it's evident that these aren't usable on the SEGA Genesis because the console doesn't run an operating system nor has any floating-point co-processors. The $6xxx opcode is a conditional branch commonly used throughout many SEGA Genesis titles. The developers of Sonic Classic Collection changed all the $6xxx opcodes to the $Axxx and $Fxxx opcodes for each game, rendering ROM images that only work on jEnesisDS but nothing else. I went ahead and fixed these issues and created patches for said fixes, allowing you to run all of these games on any emulator you wish:


Apply to Patched Games:

Sonic the Hedgehog (World) (Rev 1) (Sonic Classic Collection):
Code:
File: Sonic the Hedgehog (World) (Rev 1) (Sonic Classic Collection).md
CRC-32: 27e22795
MD4: b87e2c71f1858a6af7b5e1aabf2ce161
MD5: dfe1e6246f1ab76bf7a1bf7cc39a8e9a
SHA-1: 802fe9a31a5973a46efbff3c29bfb634dc3f2f61

Sonic the Hedgehog 2 (World) (Rev 1) (Sonic Classic Collection):
Code:
File: Sonic the Hedgehog 2 (World) (Rev 1) (Sonic Classic Collection).md
CRC-32: 582e0bf7
MD4: e610e4d1d9f92e2acc4e604950eefbc3
MD5: 30506b6577a8022a065abeeff6accfa4
SHA-1: fdc2caf8e450481b090fdcae025a90d817c13144

Sonic the Hedgehog 3 (USA) (Sonic Classic Collection):
Code:
File: Sonic the Hedgehog 3 (USA) (Sonic Classic Collection).md
CRC-32: fc0429dd
MD4: 4b4d85e70bb717f04601a328ad076db1
MD5: 3af1c74639a2586e103caf3a1dcb1f36
SHA-1: 7ceb83de0871962fa3cd8fdc0ba8b5dec9a32ca9

Sonic & Knuckles (World) (Sonic Classic Collection):

Code:
File: Sonic & Knuckles (World) (Sonic Classic Collection).md
CRC-32: c7249cdf
MD4: bca9f90b398b8456509c8569d18ccbaa
MD5: 655b8fcdc0ee2112a347854dd339bfce
SHA-1: c432cd2f4725374483b021cd8a8769a077a98bb2


BONUS:
Due to how dynamic the data for the lock-on versions of the games are in Sonic Classic Collection, I had to assemble the titles together respectively and manually, however the structure is authentic to the real deal dumps of the lock-on titles (meaning nothing was trimmed, these result in full dumps when patched). Here are patches for the lock-on titles respectively (patches located in the "Lock-On Patches" folder). As a bonus, I combined Sonic the Hedgehog and Sonic & Knuckles together so you can play the full version of Blue Sphere.

Apply to:

Sonic & Knuckles (World) (Sonic Classic Collection) (Opcode Fix):
Code:
File: Sonic & Knuckles (World) (Sonic Classic Collection) (Opcode Fix).md
CRC-32: e87df1bd
MD4: e6fcd9b89a115637d80012cc64c834c1
MD5: aa75aec6809e369f86b95237b5f5640b
SHA-1: 853705ad1a8ac51d61b27621d611177b6f5278b7


Download:
https://mega.nz/file/gYpRkSgS#3Ag75OJytZSQeoGP-aM4j8H2ompWYnQnnpZov5mNY4o
 
Last edited by DeadSkullzJr,

DeadSkullzJr

Developer
OP
Developer
Joined
Sep 28, 2017
Messages
1,250
Trophies
0
XP
1,978
Country
United States
Do you have a more expanded version of the opcode problems? I feel tricked coming here expecting to learn about some interesting quirk and go not a lot.
Fixes are appreciated though.
The reason for this is because jEnesisDS incorrectly emulates $Axxx and $Fxxx as if they were $6xxx instructions. The $Axxx opcodes were used to implement system calls on the Motorola 68000 based computers, while the $Fxxx opcodes were used for floating-point co-processors. Considering the nature of these instructions, it's evident that these aren't usable on the SEGA Genesis because the console doesn't run an operating system nor has any floating-point co-processors. The $6xxx opcode is a conditional branch commonly used throughout many SEGA Genesis titles. The developers of Sonic Classic Collection changed all the $6xxx opcodes to the $Axxx and $Fxxx opcodes for each game, rendering ROM images that only work on jEnesisDS but nothing else.
 
  • Like
Reactions: maorninja

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
33,882
Trophies
2
Website
trastindustries.com
XP
22,622
Country
United Kingdom
The reason for this is because jEnesisDS incorrectly emulates $Axxx and $Fxxx as if they were $6xxx instructions. The $Axxx opcodes were used to implement system calls on the Motorola 68000 based computers, while the $Fxxx opcodes were used for floating-point co-processors. Considering the nature of these instructions, it's evident that these aren't usable on the SEGA Genesis because the console doesn't run an operating system nor has any floating-point co-processors. The $6xxx opcode is a conditional branch commonly used throughout many SEGA Genesis titles. The developers of Sonic Classic Collection changed all the $6xxx opcodes to the $Axxx and $Fxxx opcodes for each game, rendering ROM images that only work on jEnesisDS but nothing else.

Curious. I wonder then if it was some weird optimisation or the last vestiges of Sega's we don't like emulation so we use odd formats policy.
 

DeadSkullzJr

Developer
OP
Developer
Joined
Sep 28, 2017
Messages
1,250
Trophies
0
XP
1,978
Country
United States
Curious. I wonder then if it was some weird optimisation or the last vestiges of Sega's we don't like emulation so we use odd formats policy.
It was more so an attempt to stop people from ripping the games so easily to use them elsewhere, at the end of the day we all know what Sonic Classic Collection is. It's just a heavily modified version of jEnesisDS running ROMs, I don't think they wanted people running around with copies of the games present in Sonic Classic Collection lol. I know what you are thinking though, "but these games were already available to download?", the thing is back then people did whatever they could to rip/dump games from ports like this, Sonic Classic Collection just ended up being one of the more complicated ports compared to some of the rest out there because of the structure and form the game took all by itself.

I looked into the code for all the games already, these opcode changes didn't make a lick of difference in performance, if anything it just served as a gimmick to throw people off and to knock compatibility with emulators that actually run the opcodes properly off guard. I already tested this by running both the modified and opcode fixed versions respectively on jEnesisDS, no differences at all. The only noticeable differences between these games and the original versions is nothing but slight graphical changes, all of which was done to fit on the Nintendo DS display, other slight changes were made to "phase" out multiplayer based options, I can easily fix that though (I already have, just haven't decided on whether I plan to release the fixes or not).
 

LeviathaninWaves

New Member
Newbie
Joined
Jul 15, 2020
Messages
4
Trophies
0
Age
32
XP
29
Country
United States
How does one go about dumping these? There doesn't seem to be much information on that, other than them being stored (sometimes dynamically) in RAM and also in a Game.pak file which there seems to be no tool to decompress/decrypt.

I can fix the resolution issue if I can get these dumped.
 
Last edited by LeviathaninWaves,

DeadSkullzJr

Developer
OP
Developer
Joined
Sep 28, 2017
Messages
1,250
Trophies
0
XP
1,978
Country
United States
How does one go about dumping these? There doesn't seem to be much information on that, other than them being stored (sometimes dynamically) in RAM and also in a Game.pak file which there seems to be no tool to decompress/decrypt.

I can fix the resolution issue if I can get these dumped.
Resolution isn't being handled the way you think it is. jEnesisDS uses trickery to handle the resolution differently compared to real hardware or the average SEGA Genesis/Mega Drive emulator. The ROMs themselves do NOT contain any relative resolution changes, the only changes present are aspects of the UI for things like some of the title screen text. I already looked into this personally on real hardware and on emulation, I can definitely confirm the resolution is just fine, it's just the UI data that has been altered. The reason the display looks crushed down as much as it does is because jEnesisDS is set to do this at all times. Here are some screenshots showing the UI differences and some screenshots showing the restored options for the respective titles. I personally did the restoration myself so what you see is exactly what you would have seen if the developers left these options in the games respectively. The game play as a whole is the exact same.

Screenshots for UI Comparisons:

Sonic the Hedgehog:
Left image is the original, right image is the variant from Sonic Classic Collection.

NOTE:
The background is NOT different, it just seems that way because of the frame I captured the screenshot from, this includes Sonic's finger. The graphical tile next to "SEGA 1991" is actually not a bug, the developers just chose the wrong tile to use, I fixed this as well for both the dumps and Sonic Classic Collection itself.
Sonic-The-Hedgehog-Original.png
Sonic-The-Hedgehog-Sonic-Classic-Collection.png

Sonic-The-Hedgehog-In-game-Original.png
Sonic-The-Hedgehog-In-game-Sonic-Classic-Collection.png

Sonic the Hedgehog 2:
Left image is the original, right image is the variant from Sonic Classic Collection.

NOTE:
The background is NOT different, it just seems that way because of the frame I captured the screenshot from.
Sonic-The-Hedgehog-2-Original.png
Sonic-The-Hedgehog-2-Sonic-Classic-Collection.png

Sonic-The-Hedgehog-2-In-game-Original.png
Sonic-The-Hedgehog-2-In-game-Sonic-Classic-Collection.png

Sonic the Hedgehog 3:
Left image is the original, right image is the variant from Sonic Classic Collection.

NOTE:
The background is NOT different, it just seems that way because of the frame I captured the screenshot from.
Sonic-The-Hedgehog-3-Original.png
Sonic-The-Hedgehog-3-Sonic-Classic-Collection.png

Sonic-The-Hedgehog-3-In-game-Original.png
Sonic-The-Hedgehog-3-In-game-Sonic-Classic-Collection.png


Screenshots With Restored Options:

Sonic the Hedgehog 2:
Left image is the original options, right image is the fixed options.
Sonic-Classic-Collection-Sonic-the-Hedgehog-2-Original-Options-SEGA-Genesis-Emulator.png
Sonic-Classic-Collection-Sonic-the-Hedgehog-2-Fixed-Options-SEGA-Genesis-Emulator.png
Left image is the original options, right image is the fixed options.
Sonic-Classic-Collection-Sonic-the-Hedgehog-2-Original-Options.png
Sonic-Classic-Collection-Sonic-the-Hedgehog-2-Fixed-Options.png

Sonic the Hedgehog 3:
Sonic-Classic-Collection-Sonic-the-Hedgehog-3-Original-Options-SEGA-Genesis-Emulator.png
Sonic-Classic-Collection-Sonic-the-Hedgehog-3-Fixed-Options-SEGA-Genesis-Emulator.png
Sonic-Classic-Collection-Sonic-the-Hedgehog-3-Original-Options.png
Sonic-Classic-Collection-Sonic-the-Hedgehog-3-Fixed-Options.png

Sonic the Hedgehog 3 & Knuckles:
Sonic-Classic-Collection-Sonic-the-Hedgehog-3-Knuckles-Fixed-Options-SEGA-Genesis-Emulator.png
Sonic-Classic-Collection-Sonic-the-Hedgehog-3-Knuckles-Fixed-Options.png
 
Last edited by DeadSkullzJr,

LeviathaninWaves

New Member
Newbie
Joined
Jul 15, 2020
Messages
4
Trophies
0
Age
32
XP
29
Country
United States
Ok I must've misunderstood what I read about the line skipping then.

I guess the more pressing issue is how to dump the roms in order to obtain legal backups. Given the SEGA and MJ lawsuits, Sonic 3 and Sonic Knuckles are slowly becoming more scarce (Steam is an exception... for now, but who knows when they pull the plug on that).

I understand that RE'ing dynamically allocated memory and wading through tons of disassembly is time consuming. But I figured since you and one other figured it out, why reinvent the wheel here? Was there a tool custom made for dumping these games, were the steps required to dump them documented?
 

DeadSkullzJr

Developer
OP
Developer
Joined
Sep 28, 2017
Messages
1,250
Trophies
0
XP
1,978
Country
United States
Ok I must've misunderstood what I read about the line skipping then.

I guess the more pressing issue is how to dump the roms in order to obtain legal backups. Given the SEGA and MJ lawsuits, Sonic 3 and Sonic Knuckles are slowly becoming more scarce (Steam is an exception... for now, but who knows when they pull the plug on that).

I understand that RE'ing dynamically allocated memory and wading through tons of disassembly is time consuming. But I figured since you and one other figured it out, why reinvent the wheel here? Was there a tool custom made for dumping these games, were the steps required to dump them documented?
No custom tool was involved and there is no documentation on how to do it. I want to address this now before others start getting desperate on the matter. These ROM images are NOT the best variants of the games to dump and utilize for personal use. The developers of Sonic Classic Collection didn't modify the ROM images properly, not to mention they made opcode changes and what not which rendered aspects of the game sort of broken as is, rendering all of the images invalid versions of the games in the state of integrity, manual fixes are required, and while true I provided patches for both the as-is dumps and opcode fixed variants of the game, they still should NOT be used as personalized versions under any normal circumstances (verifying these dumps is harder because the games are handled dynamically, because of such nature they won't always be 1:1 when dumped). The current and best solutions would be the Steam versions of the games, they are not modified at all and are legal to have if you purchased them. It's far cheaper than Sonic Classic Collection as it is and is much easier to grab given it's stored directly on your drive (a tutorial online will tell you how to convert those titles into proper ROM images, far easier than something like this).

As for those who bring up the legal cases regarding Sonic the Hedgehog 3 and Sonic & Knuckles (Sonic the Hedgehog 3 & Knuckles as a whole), it's not going anywhere from Steam, the reason being is because SEGA added those games to Steam BEFORE those cases sprang up, that is the reason why the plug isn't and won't be pulled from Steam regarding that matter. You are safe to purchase those on Steam at any time, and honestly anyone who runs Steam should grab the whole SEGA Genesis/Mega Drive collection when they can, it's a really nice collection of games.

The purpose of this topic was meant for educational purposes, as I stated already, nobody should seriously consider using these for personal use given the invalid integrity of the ROM images as it is, and the potential issues that may lurk from within the code itself. The process to obtain these and to make them work properly took a little more work than one would expect, and honestly there is no automated solution to just make it work out of the box, especially given the dynamic nature of it all, that's one of the reasons I provided the patches to spare people the trouble of having to deal with the mess. You would just need the original proper dumps of the games to apply the patches (not from Sonic Classic Collection, the ones on Steam WILL work, hence why I provided valid hash data on what the patches work for).

If you don't know what the patches are, it's basically the dumped Sonic Classic Collection ROM images in as-is state AND a set carrying the opcode fixes, that way you can run them on emulators outside jEnesisDS. Both sets are in the form of patches that YOU have to apply to the original and proper versions of the games respectively, hence why I repeatedly mentioned the Steam variants as those are the original unmodified versions of the games.
 
Last edited by DeadSkullzJr,

SpaceGod

New Member
Newbie
Joined
Aug 3, 2021
Messages
1
Trophies
0
Age
32
XP
2
Country
United States
hey I'm in a rabbit hole trying to add custom songs of actual mp3s in sonic 3 and knuckles but due to the limitations of the genesis it's not possible. I was wondering if I could do it to the NDS "Classics" rom since obviously the DS can process audio better, but you said that the NDS version is basically a coated version of a genesis emulator so would this be possible with this rom or not???

--------------------- MERGED ---------------------------

i apologize if this is a double post. I replied before i signed up so idk if it posted or not. the long and short is ive been trying to add custom music to sonic 3 & knuckles but the genesis can't run a nice sounding mp3 convert. i was wondering if i could do it to the nds rom though since the nds is more capable. You mentioned that this rom was just a coated version of a genesis emulator though so is it still essentially a genesis rom thus presenting me with the same roadblock? Thanks!
 

DeadSkullzJr

Developer
OP
Developer
Joined
Sep 28, 2017
Messages
1,250
Trophies
0
XP
1,978
Country
United States
hey I'm in a rabbit hole trying to add custom songs of actual mp3s in sonic 3 and knuckles but due to the limitations of the genesis it's not possible. I was wondering if I could do it to the NDS "Classics" rom since obviously the DS can process audio better, but you said that the NDS version is basically a coated version of a genesis emulator so would this be possible with this rom or not???

--------------------- MERGED ---------------------------

i apologize if this is a double post. I replied before i signed up so idk if it posted or not. the long and short is ive been trying to add custom music to sonic 3 & knuckles but the genesis can't run a nice sounding mp3 convert. i was wondering if i could do it to the nds rom though since the nds is more capable. You mentioned that this rom was just a coated version of a genesis emulator though so is it still essentially a genesis rom thus presenting me with the same roadblock? Thanks!
It's emulated stuff, so the results will be the same.
 
General chit-chat
Help Users
  • DarkCoffe64 @ DarkCoffe64:
    noooo, I'm just... borrowing it for a watch and nothing more :V lol
    Gift
  • DarkCoffe64 @ DarkCoffe64:
    and eh, I can prolly afford it... but I'm not interested in buying it :P
    Gift
  • DarkCoffe64 @ DarkCoffe64:
    rather use the cash for something I actually care or want, lol
    Gift
  • Xzi @ Xzi:
    I can, but I can't spend $15 on a 10 box set of something you like lmao
    Gift
  • kenenthk @ kenenthk:
    You can you just aren't kind enough to
    Gift
  • Xzi @ Xzi:
    pretty much everything ive got in my account right now is reserved for christmas presents and my Q1 Steam Deck :ha:
    Gift
  • kenenthk @ kenenthk:
    I'm stuck on q2
    Gift
  • DarkCoffe64 @ DarkCoffe64:
    I'm waiting for Chocobo GP myself, lol
    +1
    Gift
  • kenenthk @ kenenthk:
    Least by q2 I'll know all the good stuff from it from videos
    Gift
  • Xzi @ Xzi:
    yeah but that'll all be out by december or january
    Gift
  • kenenthk @ kenenthk:
    Or something better than steamdeck may get announced
    Gift
  • Xzi @ Xzi:
    lol nah
    Gift
  • Xzi @ Xzi:
    nobody else is gonna take that kind of loss on each unit
    Gift
  • kenenthk @ kenenthk:
    Never know with the shit China diarrheas out
    Gift
  • Xzi @ Xzi:
    well sure theres some decent emulation portables that can do everything up to PS1
    Gift
  • kenenthk @ kenenthk:
    I will be disappointed if come next July valve announces some oled steamdeck with little improvements
    Gift
  • Xzi @ Xzi:
    but aya neo is a chinese portable gaming pc and its still like double the price
    Gift
  • Xzi @ Xzi:
    for slightly weaker hardware, at that
    Gift
  • kenenthk @ kenenthk:
    It would be probable for Aya neo to release something around the same price to compete
    Gift
  • Xzi @ Xzi:
    theyre a fairly new startup, they cant afford to take that kind of loss
    Gift
  • Xzi @ Xzi:
    and they announced the pro after steam deck's announcement
    Gift
  • Xzi @ Xzi:
    which is even more expensive
    Gift
  • kenenthk @ kenenthk:
    Valve just has fuck it money and can get away with it no telling what specs portability can bring by next summer
    Gift
  • kenenthk @ kenenthk:
    Or the next couple years
    Gift
  • Xzi @ Xzi:
    thats exactly it, id guess theyre literally losing like $200 per steam deck sold
    Gift
    Xzi @ Xzi: thats exactly it, id guess theyre literally losing like $200 per steam deck sold