Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Snepulator! My SMS/GG/SG-1000 emulator

Reply to topic
Author Message
  • Joined: 11 Mar 2018
  • Posts: 55
  • Location: New Zealand
Reply with quote
Snepulator! My SMS/GG/SG-1000 emulator
Post Posted: Fri Feb 17, 2023 10:23 am
Hi all,

For a very long time, I'd wanted to make my own emulator. I made a start back in 2017, and have been poking at it in my spare time over the past six years. The 'Snep' in Snepulator is short for snow leopard :3

While I've had my work-in-progress code (Linux version) up on GitHub since the start, I think now it's finally ready to call "released".

I've tried to include a few features that some other emulators tend to leave out:
- Anaglyph 3d glasses support, (red-cyan, red-green, magenta-green), along with an option to decrease the colour saturation to improve the 3d effect.
- Light phaser support, click / touch to shoot
- Paddle support, translating left/right keys into movement on the paddle, or a touch-slider on the Android port
- Making use of the backdrop colour, using a dimmed version of it to fill the space around the active area in the window (the active area sticks to an integer multiple of the Master System's native resolutions)

Along with a few of the usual features, like bios support, scanlines, save states. The main missing feature is that I haven't yet gotten around to adding support for the FM add-on.

I've not yet ported it to Windows, but the code can be found on my Github and built for Linux:
- https://github.com/JoppyFurr/Snepulator

I've also had a go at making a port of this this into my first Android app to see if I can turn my hobby into beer money. For this I split it into two versions; one being a paid version with Master System and Game Gear support; the other being a free SG-1000 only version to make it easier to check compatibility with your device:
- https://play.google.com/store/apps/details?id=net.snepulator.sg
- https://play.google.com/store/apps/details?id=net.snepulator.ms

I do hope in the future, once I find some more free time, to add FM support and to port to more platforms (Windows, WebAssembly, and possibly the 3DS to have a play with its autostereoscopic display)

Any feedback is welcome :3
california_bmx.png (85.1 KB)
california_bmx.png

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14682
  • Location: London
Reply with quote
Post Posted: Fri Feb 17, 2023 12:03 pm
You mentioned integer sizing, but I guess you ought to think about pixel aspect ratios, especially for Game Gear. That adds complexity of course, especially to preserve crisp pixels while also needing to interpolate to the screen resolution. On a sufficiently high resolution screen this thankfully becomes much less of an issue.

How did you handle the light phaser emulation? Meka has some reverse engineered factors to ensure that the various games pick exactly the point clocked, as their hcounter set to point centre logic is quite variable.

I’d recommend making use of whatever CI platform you like to have multi platform builds as much as is reasonable, especially for us dumb Windows users :)
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8644
  • Location: Paris, France
Reply with quote
Post Posted: Fri Feb 17, 2023 2:03 pm
(Nice to see more emulators using Dear ImGui. It seems particularly fit to that purpose, e.g. building low-level tools for a VM. There's a memory editor you can grab here and use with 3 lines of code: https://github.com/ocornut/imgui_club

I ought to use it for MEKA and then we can drop Allegro, but at this rate MEKA will be the last emulator with a GUI not using Dear ImGui haha.)
  View user's profile Send private message Visit poster's website
  • Joined: 11 Mar 2018
  • Posts: 55
  • Location: New Zealand
Reply with quote
Post Posted: Fri Feb 17, 2023 10:48 pm
Maxim wrote

How did you handle the light phaser emulation? Meka has some reverse engineered factors to ensure that the various games pick exactly the point clocked, as their hcounter set to point centre logic is quite variable.


For the phaser, I try to simulate roughly how it would appear on a real Master System / CRT. From where the user's cursor is, I define a circle of radius 10px. This circle represents the area of the CRT that is visible to the phaser. Based on the line number that is being drawn, I set the h_counter latch to the position of the left-edge of the circle. This should correspond to the rising-edge seen by the phaser.

Through trying out a few different games, it appeared that this solution resulted in the aim being slightly off to the left. My assumption here is that on a real system, the 'seen' h-counter values may be offset due to propagation delays as the signal makes its way through the CRT and into the phaser's sensor; with games accounting for this. To handle this offset, I add +24 to the h-counter latch value, which seems to give a decent result on the games I have tested.
  View user's profile Send private message Visit poster's website
  • Joined: 30 Dec 2008
  • Posts: 24
  • Location: Naples,Italy
Reply with quote
Post Posted: Sat Feb 18, 2023 9:53 am
JoppyFurr wrote
To handle this offset, I add +24 to the h-counter latch value, which seems to give a decent result on the games I have tested.


Hoping of a windows port so i must try this emulator, i think that the best option is to permit to edit this value in the gui so i can adjust as per game setting.

Good work however.
  View user's profile Send private message
  • Joined: 12 Jul 1999
  • Posts: 891
Reply with quote
Post Posted: Tue Feb 21, 2023 8:11 am
I'm always in the mood to try out emulators for Android, since I love the dedicated emulation handheld devices out there.

...the Retroid Pocket 3+ just displays a black screen when running any ROM. It sounds fine though!
  View user's profile Send private message
  • Joined: 11 Mar 2018
  • Posts: 55
  • Location: New Zealand
Reply with quote
Post Posted: Wed Feb 22, 2023 12:04 pm
unfnknblvbl wrote
I'm always in the mood to try out emulators for Android, since I love the dedicated emulation handheld devices out there.

...the Retroid Pocket 3+ just displays a black screen when running any ROM. It sounds fine though!


Hi unfnknblvbl,

I'm not too familiar with the Retroid, but I can take a look in the weekend to see if there's anything special that needs to be done to support its graphics hardware. I think what I've got is all pretty standard OpenGL ES3.

Just to check:
* Did the Snepulator logo show in the middle of the screen before opening the menu to load a rom?
* Did it make any difference to select a different shader option (eg, Nearest)?

Cheers,
Joppy
  View user's profile Send private message Visit poster's website
  • Joined: 12 Jul 1999
  • Posts: 891
Reply with quote
Post Posted: Fri Feb 24, 2023 11:59 pm
Heya!

No logos or splash. The only things I can see are the overlays (which I've disabled because the device has physical controls) and the text "this text should not be visible"
Changing the shader made no difference.

Does the app output a log I can send you?
  View user's profile Send private message
  • Joined: 11 Mar 2018
  • Posts: 55
  • Location: New Zealand
Reply with quote
Post Posted: Sun Feb 26, 2023 6:33 am
unfnknblvbl wrote
Heya!

No logos or splash. The only things I can see are the overlays (which I've disabled because the device has physical controls) and the text "this text should not be visible"
Changing the shader made no difference.

Does the app output a log I can send you?


Cheers for the info. The behaviour you describe suggests that the problem is with the GLSL shader. I was able to reproduce the behaviour on a simulator. It looks like some graphics drivers are a bit more picky than others, and will only compile if the GLSL version number is on the very first line (I previously had the first line empty, with the version number on the following line).

I've made a new build and will let you know once it's been rolled out to Google Play. Hopefully this gets Snepulator running on your device

Edit: The update has now been rolled out, let me know if this fixes Snepulator on your device
  View user's profile Send private message Visit poster's website
  • Joined: 12 Jul 1999
  • Posts: 891
Reply with quote
Post Posted: Fri Mar 03, 2023 12:47 pm
I thought it might be something like that - the Sonic Mania decompilation project had a similar issue with GLES. I think they ended up switching to Vulkan to solve the issues.

Anyway, whatever you did, it worked! Most excellent! I'm always excited for new Android-based emulators!
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!