|
ForumsSega Master System / Mark III / Game GearSG-1000 / SC-3000 / SF-7000 / OMV |
Home - Forums - Games - Scans - Maps - Cheats - Credits Music - Videos - Development - Hacks - Translations - Homebrew |
Author | Message |
---|---|
|
Detecting features
Posted: Fri Nov 05, 2021 4:29 pm
|
What's the best way to detect what model console I'm running on? Specifically let's say I want to use 2X sprite mode on consoles that support it (Master System 2, Master Gear Converter) but have a fallback for the Master System 1 and Power Base Converter. If I can find a use for them I might also want to do the same with SG-1000 modes.
Are there registers/behavior that can be reliably detected? |
|
|
Posted: Fri Nov 05, 2021 5:19 pm |
I dont know how to answer this specifically with code, mainly because Ive never tested for type differences in the VDP...
The best lead you can take is to look at VRAM addresses or registers that retain values with one VDP variant but dont with others. Once that is found, you can use a routine that writes a constant then reads it back from those addresses. If your compare matches, then you'll know what VDP you have. This link mentions the primary differences between SMS1 and SMS2 VDPs and may be your lead on detecting which is which. https://www.smspower.org/Development/SMS1SMS2VDPs And this link of documentation created by Charles MacDonald offers some information near the bottom of the page about the Game Gear and MegaDrive VDP http://www.techno-junk.org/txt/msvdp.txt Unfortunately just by skimming the last link, it doesnt look like its very straight forward on how to detect a GG VDP... But I'm sure there is plenty there to find a way. |
|
|
Posted: Fri Nov 05, 2021 5:43 pm |
You can do some sprite drawing in black on black to detect VDP capabilities by checking for collisions or overflow flags. I did this to detect Mode 4 capability recently: https://www.smspower.org/forums/18562-DetectingVDPMode4Availability
To detect the ability to draw 8 doubled sprites, set them up to draw the first six non overlapping and then the last two so that they will overlap only if doubled properly. Then the collision flag tells you the result. |
|
|
Posted: Mon Nov 08, 2021 7:22 pm |
By performing a (small) set of tests SMSTestSuite can recognize Mark III / SMS / SMS II / GG / Megadrive. See here how to do it. Detecting the VDP is a key part, of course. | |
|
Posted: Mon Nov 08, 2021 10:07 pm |
I suspect it makes more sense to switch logic based on functionality rather than the detected system, for better support on emulators. Many (including Meka) emulate some hybrid systems at times. | |
|
Posted: Tue Nov 09, 2021 4:19 pm |
I agree, I meant to say that it's not that hard to gather enough information to be able to tell what system the code is running on.
If the point is to detect sprite zoom capability, the way to go is surely to test collisions once the zoom bit has been set. Note that the first revision VDP has the infamous bug here and the collision bit is even more bugged that what initially expected. Here's the C code to detect the zoom capabilities (absent, partial, complete). |
|