ROM Hack Sonic Classic Collection Dumps and Opcode Fixes

DeadSkullzJr

Developer
OP
Developer
Joined
Sep 28, 2017
Messages
1,554
Trophies
1
XP
3,877
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
    MD5: 09DADB5071EB35050067A32462E39C5F
  SHA-1: 69E102855D4389C3FD1A8F3DC7D193F8EEE5FE5B
SHA-256: 1B7F6635BD713F37F3C2F44F302B872C2E3C5F56E63637918DAD4637146900FD

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
    MD5: 9FEEB724052C39982D432A7851C98D3E
  SHA-1: 8BCA5DCEF1AF3E00098666FD892DC1C2A76333F9
SHA-256: 193BC4064CE0DAF27EA9E908ED246D87EC576CC294833BADEBB590B6AD8E8F6B

Sonic the Hedgehog 3 (USA):
Code:
   File: Sonic the Hedgehog 3 (USA).md
 CRC-32: 9BC192CE
    MD5: D724EA4DD417FE330C9DCFD955C596B2
  SHA-1: 75E9C4705259D84112B3E697A6C00A0813D47D71
SHA-256: D6404843C5BA32486F4C8C744ACB7E1932069376960D886B1DE37969787D3F9C

Sonic & Knuckles (World):
Code:
   File: Sonic & Knuckles (World).md
 CRC-32: 0658F691
    MD5: 4EA493EA4E9F6C9EBFCCBDB15110367E
  SHA-1: 88D6499D874DCB5721FF58D76FE1B9AF811192E3
SHA-256: 6E12E6B33C26EBFCD0BE433251D21CF6284EAFE9F71B027BDA3767AE59AFFEC1


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
    MD5: DFE1E6246F1AB76BF7A1BF7CC39A8E9A
  SHA-1: 802FE9A31A5973A46EFBFF3C29BFB634DC3F2F61
SHA-256: DDA5114A707897B87753D3B50A3681738B1317ED4F3378B094466408BFBE8AD0

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
    MD5: 30506B6577A8022A065ABEEFF6ACCFA4
  SHA-1: FDC2CAF8E450481B090FDCAE025A90D817C13144
SHA-256: CFA21BFA47D3A20D92E978299C9E570214BF2578705FB0E951B4DE3723BDA49A

Sonic the Hedgehog 3 (USA) (Sonic Classic Collection):
Code:
   File: Sonic the Hedgehog 3 (USA) (Sonic Classic Collection).md
 CRC-32: FC0429DD
    MD5: 3AF1C74639A2586E103CAF3A1DCB1F36
  SHA-1: 7CEB83DE0871962FA3CD8FDC0BA8B5DEC9A32CA9
SHA-256: 471F125FFB940C029100AE8EA0CD80066142E51823DBE7137CEAC4647D6F5ED7

Sonic & Knuckles (World) (Sonic Classic Collection):
Code:
   File: Sonic & Knuckles (World) (Sonic Classic Collection).md
 CRC-32: C7249CDF
    MD5: 655B8FCDC0EE2112A347854DD339BFCE
  SHA-1: C432CD2F4725374483B021CD8A8769A077A98BB2
SHA-256: 1AB6BFEF9D54CE2771B95E1D09198BC3DEC1119752FF57EB345D54B750E81887


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
     MD5: AA75AEC6809E369F86B95237B5F5640B
   SHA-1: 853705AD1A8AC51D61B27621D611177B6F5278B7
 SHA-256: 1BC8A5C48108EFB47230AD3998A5E5998E79656FE27F01239BD7C7F0F86A59A0

Download:
https://mega.nz/file/kZYAATjK#DKmwU29j7tGnVL0ZSFQlMvcrIzp3crTdPGadGECc-RA
 
Last edited by DeadSkullzJr,

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
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.
 
  • Like
Reactions: E1ite007

DeadSkullzJr

Developer
OP
Developer
Joined
Sep 28, 2017
Messages
1,554
Trophies
1
XP
3,877
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: NightScript

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
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,554
Trophies
1
XP
3,877
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

Member
Newcomer
Joined
Jul 15, 2020
Messages
10
Trophies
0
Age
35
XP
90
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,554
Trophies
1
XP
3,877
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

Member
Newcomer
Joined
Jul 15, 2020
Messages
10
Trophies
0
Age
35
XP
90
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,554
Trophies
1
XP
3,877
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
35
XP
32
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,554
Trophies
1
XP
3,877
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.
 

DolphinCube

Well-Known Member
Member
Joined
Oct 4, 2017
Messages
129
Trophies
0
XP
603
Country
United States
so how exactly do you extract the lock-on roms from the NDS file? I just cant figure out how to patch sonic 3 and knuckles when they are combined. Really sorry for the trouble!
 

NightScript

Well-Known Member
Member
Joined
Feb 7, 2016
Messages
951
Trophies
1
Age
20
XP
2,232
Country
United States
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.
This aged like milk, RIP
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: damn wifi