Home Page

Sonic & Knuckles: lock-on imperfect emulation

Posted By: xinyingho

Sonic & Knuckles: lock-on imperfect emulation - 01/14/16 12:55 PM

Hi there,

I got 3 cartridges of Sonic & Knuckles (JP, US and EU versions). So I tested those on my European Mega Drive by stacking them and see what happens.

I found out that you can stack 2 or 3 S&K cartridges, but it won't change anything to the way the lock-on technology works: it simply ignores the additional S&K cartridges. You can put Sonic 3 on top of the stack, no matter the number of S&K cartridge there is, you'll still get Sonic 3 & Knuckles.

Then I tested the same operations on MAME. I couldn't get very far: as soon as you virtually stack 2 S&K cartridges, MAME simply crash outputting the exception stack.

I thought I should report this bug.
Posted By: LoganB

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/14/16 01:28 PM

Exception stack:
Code:
  000000000836F140: 00000000014F5B31 (winmain_dump_stack()+0x0041)
  000000000836F200: 00000000029756E9 (osd_break_into_debugger(char const*)+0x0029)
  000000000836F250: 00000000024C8FB2 (emu_fatalerror::emu_fatalerror(char const*, ...)+0x0052)
  000000000836F3B0: 000000000253C71D (machine_config::machine_config(game_driver const&, emu_options&)+0x039d)
  000000000836F520: 00000000024C94BA (emu_options::add_slot_options(bool)+0x00aa)
  000000000836F6A0: 00000000024C9D3A (emu_options::update_slot_options()+0x010a)
  000000000836F710: 00000000024CA21B (emu_options::parse_slot_devices(int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, char const*, char const*)+0x00bb)
  000000000836F770: 00000000024CA32A (emu_options::parse_command_line(int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)+0x004a)
  000000000836F950: 000000000248733F (cli_frontend::execute(int, char**)+0x05df)
  000000000836FDF0: 00000000014F500B (utf8_main(int, char**)+0x016b)
  000000000836FE50: 000000000297311E (wmain+0x007e)
  000000000836FF20: 000000000040140C (__tmainCRTStartup+0x025c)
  000000000836FF50: 000000000040153B (mainCRTStartup+0x001b)
  000000000836FF80: 00007FFB52588102 (BaseThreadInitThunk+0x0022)
  000000000836FFD0: 00007FFB54E4C2E4 (RtlUserThreadStart+0x0034)
Unknown slot option 'rom_sk' in slot 'mdslot:rom_sk:subslot'
Posted By: Haze

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/14/16 02:39 PM

it's a fatalerror, so it's already telling us what the problem is without the backtrace, basically the sk cart slot device isn't designed to take an sk cart ;-)
Posted By: Just Desserts

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/14/16 07:25 PM

Originally Posted By Haze
it's a fatalerror, so it's already telling us what the problem is without the backtrace, basically the sk cart slot device isn't designed to take an sk cart ;-)


That's just bad implementation, then. S&K could be used with just about any Mega Drive game: It would display a "this game is not designed for use with Sonic & Knuckles" screen, but if you punched in a button combo, it would take you to an infinite series of bonus rounds, the ordering being seeded by some sort of data from the locked-on cartridge.
Posted By: R. Belmont

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/14/16 07:30 PM

S&K will accept any Mega Drive game. It just won't accept another instance of itself, which in real life has no effect and may cause magic smoke to come out of your power brick if you do it too often.
Posted By: xinyingho

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/14/16 07:51 PM

Actually, S&K won't always show the special "No Way" screen for every games. I've tested with Sonic 3D Flickies Island on the top, and I just got the regular S&K intro. I think that S&K activates the "No Way" screen for any games released before it bu not necessarily for every game released after.
Posted By: Sharkpuncher

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/14/16 07:52 PM

I'm assuming that must be an EU or JP thing, in the US we just got a screen saying "NO WAY! NO WAY! NO WAY!" which, while fitting with the XTREME AWESOME era of the 90s, was more alarming than anything and "hit some buttons to get a random bonus stage" never came up until some friend or game magazine told you about it.

I think there were a few games that didn't work with S&K, I don't remember if they didn't boot or if S&K booted with random issues or something. I feel like it was some of the later games with more ROM space....

EDIT: Ahh ok... "Any connection with games that, when added to Sonic & Knuckles, become greater than 4MB (such as Super Street Fighter II) will prompt Sonic & Knuckles to start up as usual, without Blue Sphere activating. This is because when locked-on to a ROM larger than 2MB, Sonic & Knuckles maps the last 2MB of the locked-on ROM rather than the first 2MB, so when Sonic & Knuckles tries to read the locked-on header, it actually reads from the second half of the ROM, finds no header, and loads Sonic & Knuckles normally. An exception to this is Sonic Classics, which happens (or was designed?) to put Sonic the Hedgehog at the 2MB mark. This is a quirk in the Sonic & Knuckles cartridge's mapper, which is not reproduced in emulators."
Posted By: xinyingho

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/14/16 07:56 PM

@Sharkpuncher: I think that the "this game is not designed for use with Sonic & Knuckles" screen actually refers to the "No Way" screen.

Edit: really interesting finding. What is the source of your edit text?

Edit2 : found the source (http://info.sonicretro.org/Blue_Sphere). It seems like somebody actually succeeded to go through all the Blue Sphere levels of S&K+S1!
"[...] with a total of 134,217,728 levels in all. However, after level 128,016,000 some of the previous levels begin to reappear. After completing all 134,217,728 stages it restarts from the beginning" !!
Posted By: Sharkpuncher

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/14/16 10:06 PM

That's some dedication, wow. I can't imagine going through that many levels, that sphere game was pretty annoying to me.

And yeah, I just googled it quickly, I know that it's just anecdotal information from a random fan wiki but at least it seems like they've explored/hacked a lot of the hardware in various ways and that makes more sense than it being some arbitrary "works/doesn't work" based on ???? per game.

(That being said maybe they also found some way to go through all the levels without having to play each one, for that matter.)
Posted By: xinyingho

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/14/16 10:20 PM

Sonicretro is actually a very well known site, filled with people dedicated to hack into every Sonic games they find to make derivative games or salvage any interesting data. We can definitely trust what their wiki says.
Posted By: Haze

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/14/16 10:23 PM

it's just maths and a seed based random level generator, getting the seed from the cartridge header.

nobody has played all the levels, there's not enough time in a lifetime to actually play / look at all the levels, they just know that's how many there are because that's what the code does ;-)
Posted By: F1ReB4LL

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/14/16 11:38 PM

Some levels just loop over and over if you use a pass to play them, like, #130278914 with a password 0259 3817 9591. So I don't think you can really play through all of them without brooting the passwords.
Posted By: LoganB

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/15/16 05:44 AM

Quote:

<MainMemory|Away> afaik the S&K cart's mapper always forwards addresses from $200000 onward to the locked on cart, so multiple S&Ks would just keep forwarding the request until it reaches the end of the chain
Posted By: LoganB

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/15/16 05:44 AM

Quote:
<MainMemory|Away> afaik the S&K cart's mapper always forwards addresses from $200000 onward to the locked on cart, so multiple S&Ks would just keep forwarding the request until it reaches the end of the chain
Posted By: xinyingho

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/15/16 07:59 AM

Originally Posted By Haze
[...] nobody has played all the levels, there's not enough time in a lifetime to actually play / look at all the levels, they just know that's how many there are because that's what the code does ;-)

That makes sense. It's infinitely faster to understand what the code does than going through the 130 000 000 levels.

Quote:
<MainMemory|Away> afaik the S&K cart's mapper always forwards addresses from $200000 onward to the locked on cart, so multiple S&Ks would just keep forwarding the request until it reaches the end of the chain

I'm quite impressed by the design of this lock-on feature. During those old times, people really took the time to test and fix the most exotic use cases.
Posted By: Sharkpuncher

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/15/16 09:01 AM

Originally Posted By Haze
it's just maths and a seed based random level generator, getting the seed from the cartridge header.

nobody has played all the levels, there's not enough time in a lifetime to actually play / look at all the levels, they just know that's how many there are because that's what the code does ;-)


That makes more sense. I didn't really stop to think of the amount of time a number like that would take, my first thought was something like the rack advance from pacman (to get quickly to the kill screen on it) but that's a few orders of magnitude less. Eh...
Posted By: remax

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/18/16 02:48 PM

130 000 000 levels and 30 seconds per level equals 120 years...

Yeah, unlikely someone played trhough all of them :-D
Posted By: Lord Nightmare

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/18/16 07:49 PM

massively turbo-mode-ing the genesis/megadrive and making a bot which watches memory to figure out sonic's position on the grid and where the blue spheres are and auto-solves levels...

I'll bet every blue sphere level can be solved in way, WAY less than 120 years.

LN
Posted By: remax

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/20/16 11:19 AM

even at 1 sec per level you need 4 years... That would be an incredible dedication laugh
Posted By: qmc2

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/20/16 11:47 AM

You could do that massively parallel as a community project, then it may get down to a few days or weeks. Someone still needs to write the solver though smile.

EDIT: Well, that probably only works when you can "jump" to arbitrary levels which doesn't seem to be possible without the corresponding keys/passwords wink.
Posted By: Heihachi_73

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/20/16 05:04 PM

Exactly, people did the same thing with FreeCell years ago, first with the original Microsoft 32000 (the original Win32s version through Win9x), then with the million and beyond with the later versions starting with XP/Vista/7 etc. (note that these have to be selected manually, as the RNG only goes through the initial 32000, with the exception of FCPro which isn't by Microsoft but uses the same card-dealing algorithm). It wasn't only #11982 that was found to be impossible.

Not that this has anything to do with Sonic & Knuckles or the Blue Sphere minigame...
Posted By: Haze

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/20/16 06:23 PM

so.. we run a distributed application over a couple of (hundred) thousand computers, each using an emulator, save state and TAS tools / solver to play a specific level (obviously running unthrottled, real time would be too slow) while recording a video of each..

then upload all the videos in 720p 60fps to YouTube knowing that nobody will ever even be able to watch them all?
Posted By: xinyingho

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/20/16 07:15 PM

If anybody really did this and post everything on YouTube, he/she would certainly be considered a spam bot and be banned for life...
Posted By: xinyingho

Re: Sonic & Knuckles: lock-on imperfect emulation - 01/24/16 09:23 AM

by the way, do I need to log a bug at http://mametesters.org/ ?
Posted By: xinyingho

Re: Sonic & Knuckles: lock-on imperfect emulation - 02/09/16 06:30 PM

By the way, I found out that a Mega Drive 32X can accept regular Mega Drive cartridges along 32X cartridges. This way, you don't need to remove a 32X from a MD to play your regular MD game library. Thus shouldn't the 32x emulated machine in MAME accept both the 32x and megadriv software lists? Right now, it only accepts the 32x software list although I can feed it with MD ROM files without issues.
Posted By: Sharkpuncher

Re: Sonic & Knuckles: lock-on imperfect emulation - 02/09/16 08:22 PM

Putting the cart before the horse, one software list at a time.
Posted By: R. Belmont

Re: Sonic & Knuckles: lock-on imperfect emulation - 02/09/16 08:25 PM

"Let us redefine progress to mean that just because we can do a thing, it does not necessarily mean we must do that thing." - Captain James T. Kirk
Posted By: xinyingho

Re: Sonic & Knuckles: lock-on imperfect emulation - 02/09/16 09:18 PM

I understand that it's not a priority and there are surely tons of other more useful stuff to do before taking care of this kind of small challenge.

But I just wanted to notify that the 32X has been obviously designed to take in MD and 32X cartridges alike:
- the 32X cartridge form factor is the same worldwide,
- US and EU 32X cartridge slots take after the 32X cartridge form factor but can also take Genesis/EU MD cartridges as they are smaller,
- JP cartridge slots have a mixed form factor that can accommodate both 32X and JP MD cartridges.

It's just fun to understand how much thought Sega developers poured into this ill-fated extension laugh
Posted By: R. Belmont

Re: Sonic & Knuckles: lock-on imperfect emulation - 02/09/16 09:27 PM

Sure, and if you want to submit a pull request that adds the megadrive softlist for 32x we'd accept it, but it's the sort of thing where it's painfully trivial to pull e.g. Haze away from emulating an entire new game (as he's doing right now) to add smile
Posted By: xinyingho

Re: Sonic & Knuckles: lock-on imperfect emulation - 02/10/16 02:26 PM

I've tried a naive attempt at adding

MCFG_SOFTWARE_LIST_ADD("md_cart_list","megadriv")

into the configuration definition block for genesis_32x. It failed miserably... I'll need to look into the whole driver and software list architecture further.

The entire new game Haze is currently into, is it called SegaSonic Bros smile ?
Posted By: Stiletto

Re: Sonic & Knuckles: lock-on imperfect emulation - 02/10/16 04:15 PM

Originally Posted By xinyingho
The entire new game Haze is currently into, is it called SegaSonic Bros smile ?


I thought Arbee was referring to '96 Flag Rally:
http://mamedev.emulab.it/haze/2016/02/09/96-flag-rally/
Posted By: R. Belmont

Re: Sonic & Knuckles: lock-on imperfect emulation - 02/10/16 04:37 PM

SegaSonic Bros cannot be released, ShouTime has stated he will get no more rare games from anyone if he releases it.
Posted By: Dullaron

Re: Sonic & Knuckles: lock-on imperfect emulation - 02/10/16 07:20 PM

Do what? Sound like they will bump him off the list if he release the dump.

It will get dump and release in the future. He probably won't do it. Probably cost way too much.
Posted By: R. Belmont

Re: Sonic & Knuckles: lock-on imperfect emulation - 02/10/16 07:24 PM

I've warned before: this subject is not for public discussion. I have attempted to explain the situation as plainly as possible; if you still don't understand, you never will.
Posted By: Dullaron

Re: Sonic & Knuckles: lock-on imperfect emulation - 02/10/16 07:33 PM

Ok. I stop here.
Posted By: mfm005

Re: Sonic & Knuckles: lock-on imperfect emulation - 02/13/16 02:54 PM

While on subject, i have noticed that s&k + sonic3 doesn't save sram (and it's not available in the software list). Am I doing something wrong?
Posted By: xinyingho

Re: Sonic & Knuckles: lock-on imperfect emulation - 02/13/16 05:44 PM

I have the same issue here, it seems like SRAM isn't implemented yet for Sonic 3 at least.

If you want to get S&K + S3 through software lists, you must use this command line (here for the Japanese version):
mame64.exe megadrij -cartridge1 sk -cartridge2 sonic3j

If you don't want to use command lines, you can use my front-end Negatron (link in my signature) to do it in 3 steps:
- select Mega Drive as the machine by right clicking on its entry to display the machine configuration pane,
- select S&K as the game by clicking on the "List" button first, this will show a 2nd cartridge parameter in the machine configuration pane.
- Click on the 2nd "List" button and double-click on Sonic 3 to launch MAME.
© 2020 Forums