OsmOse – a Sega Master System/Game Gear emulator, now ported

19 posts
by palerider » Thu Nov 22, 2012 7:37 pm
Hey guys,

The past couple of days I've been working on this port of OsmOse, an object-oriented Sega Master System and Game Gear emulator by Vedder Bruno. It is based on version 0.8.1, the last version by the author to use SDL, but I did a bunch of backports, fixes and changes to make it compile and run well on the Pi with as many features as possible. On my 700 MHz Pi, it runs really well and consumes about 30%-60% CPU.

This is made for the framebuffer, so no promises regarding whether or not it will work in X. If you want full screen without slow software scaling, you will likely need to put suitable modes (320x240, for instance) in /etc/fb.modes. There are some scaling filters built in but they are slow.

Get it now!

What I did to it in this first version:

  • Fixed missing standard C library includes
  • Removed PrecisionTimer (which contained x86 assembly) and backported some of the main emulation loop from 0.9.0b instead
  • Added support for configurable joystick buttons through the -joy1, -joy2 and -joystart buttons. You must still explicitely turn on joystick support with -joy, too.
  • Backported SN76489 fixes from 0.8.2
  • Backported TextWriter speed optimizations from 0.8.5b
  • Also, the command line fix for arbitrary placement of filename from 0.8.5b
  • Disabled FPS counter since it is not compatible with the newer frame rendering code
  • Disabled version display on boot for more seamless integration with emulator front-ends
  • Changed sound output rate from 22050 Hz to 44100 by rendering two sound frames every frame instead of one. Running the emulator at 22050 Hz causes sound desync. Probably a problem in the ALSA driver.
  • Doubled sound buffer size for potential better performance
  • Added Raspberry Pi-specific optimizations to Makefile

The archive above includes sources and a binary. The binary should be good to go, just run it. To compile the source, just type make (you'll need libsdl-dev).

Here's how I run it in order to turn on joystick support and define some buttons:

Code: Select all
./osmose -joy -joy1 2 -joy2 4 -joystart 11 filename.gg

You can run osmose without any arguments to see all the available switches.

Have fun!
Posts: 8
Joined: Fri Nov 16, 2012 1:05 pm
by petrockblog » Fri Dec 21, 2012 2:08 pm
How comes that anybody replied to this so far? I just tried your port and it works very well!

I will include it into the RetroPie Setup script.

Very nice work!
fun stuff for technics enthusiasts: www.petrockblock.com
Posts: 269
Joined: Wed Jul 04, 2012 6:12 am
Location: Germany
by jlongstreet » Fri Dec 21, 2012 4:49 pm
Wow, cool! Out of curiosity, what makes OsmOse faster than, say GenPlusGX or DGen? Is there some dynamic recompiling going on, or a better rendering pipeline, or just faster m68k/z80 cores?

I'll have to check it out. It might also be a candidate for porting to libretro for use in RetroArch.
Posts: 31
Joined: Wed Sep 05, 2012 2:59 am
by Raspiberry » Tue Dec 25, 2012 1:44 am
Downloaded Sonic the Hedgehog to try this, but a few issues:
Had no defined keys, but then saw the "./osmose -joy -joy1 2 -joy2 4 joystart 11" (that is an eleven, right?) text, and started it like that. But, I can't start it without sudo (just fails to open the .sms Sonic the Hedgehog file. When I do do "sudo ./osmose -joy -joy1 2 -joy2 4 joystart 11," the Pi displays no video on the screen and I have to hard reset the device (yank cord).
So, I can't run it without sudo and no video when I define those keys.
I'm using a newly created user account (named jason) with vchiq permissions and sudo permissions, if that matters. Haven't tried with Pi user yet, because the download is not working for me at the moment.
If only my school used the Raspberry Pi...
User avatar
Posts: 20
Joined: Sun Dec 16, 2012 9:56 pm
by mercraus » Mon Dec 31, 2012 3:03 pm
I've installed osmose via the Retro-Pie script and video works fine, but I only get a high-pitched whine/rapid beeping for audio. Any suggestions? Thanks in advance for the help.
Posts: 3
Joined: Sat Dec 29, 2012 12:04 pm
by ironKERRtain » Mon Feb 04, 2013 9:11 pm
In the es_setup file that the RetroPie script created, it does show the -joy in the line that launches Osmose, but not things like -joy1 2 -joy1 4. What do these mean? What I am ultimately trying to do is manually map my joypad buttons for the emulator. As of now it does work with whatever defaults are there, but I can't exit any roms without the use of a keyboard. I would like to add the ability to exit a rom using a joypad button. Any suggestions on how I could do this?
Posts: 7
Joined: Tue Jan 29, 2013 6:38 am
by Trey » Tue Feb 05, 2013 3:12 am
Hey, thanks for your work! As ironKERRtain noted, it would be nice to be able to map a joystick button to exit the emulator though for operation without a keyboard :D
Posts: 4
Joined: Sun Sep 16, 2012 2:40 pm
Location: Austin, TX
by badman12345 » Sat Feb 16, 2013 3:48 am
Posts: 33
Joined: Thu Feb 14, 2013 3:00 am
by badman12345 » Sat Mar 02, 2013 7:01 am
Hey guys, I just made a patch that will allow you to map a joystick button for quitting. You'll need to recompile (I won't include a binary because I use some strange libraries that won't match your system), but it's straight forward, same as it ever was, just type make!
Code: Select all

I will provide two links here, one to the entire source (patching not required), and one to the patch alone (just in case you'd rather just patch palerider's original download in the OP of this thread). Either way, you will need to recompile to make it work.

Patch file only

Pre-patched source
(This includes the patchfile in the directory as well, just in case you want to manually look over it and see the changes. It has already been applied though).

To add a button for quitting from joystick, simply launch with the -joyquit x (where x is a joystick button) switch. You still need to enable joy support with -joy 1. For instance, here is my command to launch it:
Code: Select all
osmose -joy 1 -joy1 1 -joy2 2 -joyquit 6 <romfile>

Then, while playing, simply press (and release) whatever button you mapped to quit! I made the event happen on the release of the button rather than the press of it, because that seems to be the general usage of quit keys (even by keyboard). If you'd like to change that behavior... simply check out OsmoseCore.cpp, and change

Posts: 33
Joined: Thu Feb 14, 2013 3:00 am
by wietze314 » Wed May 01, 2013 7:37 pm

I use your emulator, installed via RetroPie installation script.

I have issues with overwriting the default controls that it loads with.

I tried rewriting the config (/home/pi/RetroPie/configs/mastersystem/retroarch.cfg)
But the emulator does not seem to "listen" to this.

Code: Select all
input_player1_joypad_index = "0"
input_player1_l_x_plus_axis = "+4"
input_player1_l_y_plus_axis = "+5"
input_player1_l_x_minus_axis = "-4"
input_player1_l_y_minus_axis = "-5"
input_player1_a_btn = "2"
input_player1_b_btn = "1"

The problem I am having is that the movement is bound to my left analog stick. I want it on my dpad.
I use a logitech dual action controller.

Any pointers in the right direction?
Posts: 2
Joined: Wed May 01, 2013 7:32 pm
by JBaker1225 » Wed May 01, 2013 11:16 pm
I don't believe Osmose is under the RetroArch banner, so modifying retroarch.cfg isn't going to have any effect on it. I think you need to go into the Osmose directory and look for a cfg file there.
Posts: 48
Joined: Wed Apr 17, 2013 10:27 pm
by wietze314 » Thu May 02, 2013 5:34 pm
Ok I found:
Code: Select all

But I can only configure keyboard mapping.
No clue how I can point to which gamepad keys must be used, since there are only available keyboard key terms in the .ini file.
Posts: 2
Joined: Wed May 01, 2013 7:32 pm
by JBaker1225 » Thu May 02, 2013 5:39 pm
From the OP, it looks like if you go to the directory that the Osmose binary is in, you can run: ./osmose -joy -joy1 2 -joy2 4 -joystart 11 filename.gg

And that should let you assign controls to your joypad.
Posts: 48
Joined: Wed Apr 17, 2013 10:27 pm
by Aloshi » Thu May 02, 2013 8:41 pm
As far as I could tell, OsmOse only lets you map directly through the command line (you have to define the joystick buttons directly on the command line at launch). So you'd have to work out what goes where, then copy it into the ~/.emulationstation/es_systems.cfg "COMMAND=".
User avatar
Posts: 359
Joined: Sat Jun 23, 2012 6:42 pm
by soup » Tue Jun 25, 2013 9:30 am
Thanks palerider for this awesome port! It's been a blast playing through some of the old Master System games again.

I'm having an issue getting the pause button to work from an xbox360 controller, was hoping you guys may be able to help. I'm running it on the current Retropie image.

Thanks to badman12345 kindly providing the patch above I've managed to use his pre-patched source of Osmose in my Retropie installation and enable -joyquit so I can quit back to emulationstation from my controller. I've seen references around to a -joypause option for binding the pause button, but that option doesn't appear to be available in this build.

I'd like to get this working as some Master System games used the pause button to bring up gameplay menus (ie inventory, change weapons, etc) Alex Kidd in Miracle World is one example (and this is the game I'm dying to get working properly, most people my age in Australia grew up with this game as it came built in to the Master System II).

So to end this rambling tale, does anyone know of a patch or other method I can use to get pause button functionality from a joypad? Thanks for any help offered! :D
Posts: 1
Joined: Tue Jun 25, 2013 8:17 am
by tiago.almeida » Fri Jul 26, 2013 5:19 pm
I have great interest on this as well, but I'm using PS3 controller instead. I didn't find a way to customize Osmoze buttons neither find a way to fit my whole screen (heigh at least).

I'll work on this tonight and during weeking, if I find something I'll post it here.
User avatar
Posts: 9
Joined: Sat Aug 04, 2012 12:48 am
by tiago.almeida » Mon Jul 29, 2013 7:55 pm

I managed to get a decent emulation with Picodrive, PS3's DualShock 3 controller is working properly and I don't have the annoyance to use left analogic as directional (dpad is working!).

I didn't tested save and load states and it's not fullscreen either (changing scale value on retroarch.cfg does something although).

I will try to compile and test AdvMess tonight.

It's really a shame that we cannot customize controls using Osmose and it's not fullscreen!
User avatar
Posts: 9
Joined: Sat Aug 04, 2012 12:48 am
by KitchUK » Tue Aug 06, 2013 7:12 am
Hey tiago, what emulator did you settle with eventually?
Posts: 256
Joined: Fri Jul 19, 2013 5:40 pm
by tiago.almeida » Tue Aug 06, 2013 1:31 pm
I'm still using Picodrive,I have full screen and dualshock3 is working as expected, got its button mapping from retroarch.

I noticed some slowdowns but this is affecting almost all emulators I have...

I'm still working on it.
User avatar
Posts: 9
Joined: Sat Aug 04, 2012 12:48 am