fMSX 3.5 for Windows, Unix, S60, UIQ and DOS

by fms on 10-02-2008, 13:39
Topic: Emulation
Languages:

The next version of the MSX/MSX2/MSX2+ emulator, fMSX, has just been released! Starting with this release, fMSX-Unix support is reintroduced. The new fMSX-Unix is available in the source code form from the web site. Here is the full list of changes, additions and fixes in fMSX 3.5:

  • After a long pause, the fMSX-Unix port was finally updated. fMSX-Unix source code is once again available as part of the core source code distribution. It has been debugged using Ubuntu (Linux). In case of any incompatibilities with other Unix flavors, contact the developer.
  • Added run-time compatibility with 8bpp, 16bpp, 24bpp (32bit pixels) and 32bpp screen depths to fMSX-Unix. Important note: at this moment, the built-in config menu, debugger, and NetPlay dialog will only work at X11 screen depth that matches the original compile-time setting (i.e. DBPPxx) in Makefile. Make sure you always compile fMSX-Unix for your default screen depth.
  • Disabled secondary slots for primary slot #0 in MSX1 mode. DiskROM boots in MSX1 mode again.
  • Now syncing all sound channels after loading state, sound does not get "stuck" any more.
  • Renamed command line option -zoom/-nozoom into -soft/-nosoft.
  • Moved a few key definitions, so that "!@#$%^..." characters can now be used as indices into Keys[]. This is done for compatibility with GDK key events.
  • Renamed KeyMap[] to KeyState[] to avoid name clash with the MacOSX system API.
  • ALT swaps joysticks 1/2 on all platforms where applicable.
  • CONTROL/SHIFT keys now act as FIRE-A/FIRE-B joystick buttons on all platforms.
  • Improved fMSX-Symbian sound code, although sound problems still persist on some UIQ3 phones.
  • Split fMSX-Symbian/S60 configuration menu into four tabs, making "Video" and "Audio" settings separate.
  • Added "Audio Latency", "Skip Frames", and "Sync Updates" settings to fMSX-Symbian.
  • Added to fMSX-Symbian ability to use Nokia E61/E62 [FUNC] key in the built-in menu.
  • Fixed an fMSX-Symbian bug where pieces of virtual keyboard remained on screen after closing it.
  • Pressing [8] key on fMSX-Symbian now invokes virtual keyboard, if enabled, for the phones which do not have the [EDIT] key.

Relevant link: all platforms + source code
Relevant link: FREE version for smartphone users
Relevant link: help and discussion forum

Comments (21)

By Manuel

Ascended (19810)

Manuel's picture

10-02-2008, 13:54

Well, the Unix stuff is good news I guess. It's at least very easy to compile it now:

- unzip the code
- cd fMSX/Unix
- edit Makefile and change color depth to what you need (I used 32)
- make

After this, run the resulting binary from the fMSX/ROMs dir.

By ro

Scribe (5129)

ro's picture

10-02-2008, 14:11

Cool!

I recently purchased a Nokia N95 (s60, symbian) and was looking for stuff like this Smile

By snout

Ascended (15187)

snout's picture

10-02-2008, 14:14

Ro: you should at least check this one as well.

By cax

Prophet (3741)

cax's picture

11-02-2008, 08:39

Ta da... Unix version. And according to fMSX sources, Marat now got himself a MAEMO-based Nokia Internet Tablet.

By cax

Prophet (3741)

cax's picture

11-02-2008, 12:44

Just tried to run it in Cygwin/X. Unlike the previous Unix version, this one don't want to start and fails.
I am too lazy now to check why this happens, but if anybody of you want to investigate this - here are the changes you will need to perform to make it compile on Cygwin:

LibUnix.c:

#ifdef __CYGWIN__
#include <X11/keysym.h>
#endif

NetUnix.c:

#ifdef __CYGWIN__
#include <arpa/inet.h>
#endif

SndUnix.c:

#ifdef __CYGWIN__
#include <sys/soundcard.h>
#endif

Unix.c:

#ifdef __CYGWIN__
#include <X11/keysym.h>
#endif

Rules.Unix:

LIBS += -L/usr/X11R6/lib -lX11 -lXext

In Console.c put attention that Cygwin does not implement d_type and such, so you will need to workaround this somehow.

By cax

Prophet (3741)

cax's picture

12-02-2008, 12:15

In fact, I was wrong when I told that fMSX 3.0 compiled OK on Cygwin without patching - after checking I see I had to patch SndUnix.c on it too, but the most important thing is that Cygwin lacks MITSHM support, and it should be disabled in compilation options.

So, in addition to the operations above you have to:

- disable MITSHM by removing "-DMITSHM" from Rules.Unix

- fix fMSX 3.5 bug in LibUnix.c by adding #ifdef around the following line:

#ifdef MITSHM
OutImg.SHMInfo.shmaddr = 0;
#endif

After that fMSX 3.5 will compile successfully, and I even saw MSX logo after running it with the line

./fmsx -home ../ROMs

but after that emulator hangs.

I also tried to compile fMSX 3.5 on a remote United Linux machine.
Had to disable MITSHM, add keysym.h includes and specify -L for X11 library too, but it worked.

By fms

Champion (366)

fms's picture

12-02-2008, 13:46

Thanks, I will put the OutImg fix and #include the keysym.h. Still not sure what to do about the soundcard stuff though: it seems to sit at different locations even in different Linux flavors.

By fms

Champion (366)

fms's picture

12-02-2008, 23:15

Do not do -home ../ROMs, as that directory contains several incompatible ROMs. Copy only the ROMs you need to a separate directory and use it as -home instead.

By cax

Prophet (3741)

cax's picture

14-02-2008, 00:48

Using selected ROMs doesn't help - in Cygwin fMSX 3.5 hangs. For msx2 - after MSX logo, for msx1 it even doesn't open X window. I even commented out and disabled net, debugger, console, serial, printer, tried different X server, attempted -sound 0 and other options - the result is the same. It really looks strange - like some memory corruption, that manifests itself in CYGWIN.

By cax

Prophet (3741)

cax's picture

14-02-2008, 01:31

I tested it on Solaris. Here we go:

- in addition to

-DSUN_AUDIO
removal of -DLSB_FIRST
-lsocket -lnsl

it required also BSD compatibility flag: -DBSD_COMP (otherwise it says FIONBIO is not defined)

- Solaris also doesn't support d_type from Console.c

Of course, keysyms.h and MITSHM required patching too.

Would be nice (if you are not planning to create ./configure) to document these changes in rules file or in makefile at least .

And now the most interesting fact:
on Solaris fMSX hangs without opening window at all, like on Cygwin. But this time you won't see window even in msx2 mode.

fms, would you like to fix this new Unix version ? I believe it doesn't run on both Cygwin and SunOS for the same reason.

By fms

Champion (366)

fms's picture

14-02-2008, 07:47

>Using selected ROMs doesn't help - in Cygwin fMSX 3.5 hangs.
>It really looks strange - like some memory corruption, that
>manifests itself in CYGWIN.
I do not think it is a memory corruption (there ain't too many places in the code where it may happen). It may be something related to timer signals in Cygwin being handled differently though.

> I tested it on Solaris. Here we go:
>- in addition to
>-DSUN_AUDIO
>removal of -DLSB_FIRST
>-lsocket -lnsl
>it required also BSD compatibility flag: -DBSD_COMP (otherwise it says FIONBIO is not defined)
>Of course, keysyms.h and MITSHM required patching too.
>- Solaris also doesn't support d_type from Console.c
Well, these are to be expected. Looks like I will have to simulate d_type, too Sad

>Would be nice (if you are not planning to create ./configure) to document
>these changes in rules file or in makefile at least .
Some I will fix right away, others I will comment about in the makefile.

>on Solaris fMSX hangs without opening window at all, like on Cygwin.
>But this time you won't see window even in msx2 mode.
>fms, would you like to fix this new Unix version ? I believe it
> doesn't run on both Cygwin and SunOS for the same reason.
I no longer have neither Cygwin/X11 nor Solaris, so it will not be possible for me to debug on these platforms. Fortunately, due to the freedom of open source, you can probably investigate the problems further and tell me what the cause is Smile Once you do that, I will fix the code as required.

By cax

Prophet (3741)

cax's picture

17-02-2008, 20:12

After debug session with fms I see that I was right about memory corruption (was fixed and Cygwin/X port works now) but I was totally wrong about SunOS - it still doesn't open X window until I comment out WaitSyncTimer().
Also I think the palette on SunOS is broken - MSX logo starts with green background, etc.

By fms

Champion (366)

fms's picture

17-02-2008, 23:13

The WaitSyncTimer() thing can be avoided from command line, by using '-nosync' option. As to the colors being wrong, Solaris X11 may be using a pixel format different from the one assumed by fMSX. Check out with xwininfo and tell me what it says: I am mostly interested in pixel formated related stuff (color bitmasks etc).

By fms

Champion (366)

fms's picture

18-02-2008, 09:04

Could you please make the following experiment:

-- Uncomment WaitSyncTimer() and SetSyncTimer()
-- Replace ITIMER_REAL with ITIMER_VIRTUAL
-- Replace SIGALRM with SIGVTALRM everywhere in the code

See if this fixes the hangup on Solaris.

By cax

Prophet (3741)

cax's picture

18-02-2008, 12:41

1) xwininfo told me the following:

Depth: 16
Visual Class: TrueColor
Colormap: 0x20 (installed)

I've found nothing else in it's report that can tell you about colors.

2) suggested replacements for SIGALRM and ITIMER_REAL didn't help. I still need "-nosync" to see fmsx X window.

3) please in your next release address also sound thread issue I wrote you about

By fms

Champion (366)

fms's picture

18-02-2008, 16:17

If by sound thread issue you mean the SUN_AUDIO thing, I have included this setting into Solaris-specific makefile. I have not received from you any emai about other sound thread issues, so let me know if it is something different.

The SIGALRM and color issues will need some debugging though.

By cax

Prophet (3741)

cax's picture

24-02-2008, 07:56

By sound issue I mean InitAudio() in SndUnix.c having the following flow:

SndRate = 0;
...
pthread_create(&Thr,0,ThrHandler,0)
...
return(SndRate=Rate);

Just after pthread_create() ThrHandler starts. Because SndRate is still zero, it exits loop
for(RPtr=WPtr=0;SndRate&&SndData&&(SoundFD>=0);)
and then exits ThrHandler itself, so I hear no sound in Cygwin.
Setting SndRate right before pthread_create effectively solves the problem.

I checked - wrong colors on Solaris were the same in fMSX 3.0, so this is not a new issue as I thought before.

By fms

Champion (366)

fms's picture

24-02-2008, 20:19

Heheh, I have just fixed the pthread/SndRate bug when working on the fMSX-Maemo port this morning Smile

By Gilneas2

Master (235)

Gilneas2's picture

03-03-2008, 07:22

I can't get sound to work on my Linux system.
Everything else is fine, especially after setting the depth to 32.

Maybe/Hopefully related is that Konami's Mahjong 2 always freezes up at Speech moments (i.e. when someone is about to Pon/Riichi etc)

By cax

Prophet (3741)

cax's picture

03-03-2008, 11:35

Gilneas2, read my previous comment - there is a bug you can easily fix, and you'll hear sound (or just wait until Marat releases the fix)

By Gilneas2

Master (235)

Gilneas2's picture

04-03-2008, 01:47

Thanks, I see it is related now.
I get music after adding "SndRate=44100;" however I still get crashes in Mahjong 2 at Speech, and in Rune Master 2 in the intro.