dimanche 3 avril 2016

64bits linux and odyssey 2 emulation

Here is my latest story related to odyssey 2 emulation.

Recently, I've offered myself a brand new computer. I've installed a recent linux distro with 64 bits compilation mode. Everything was fine until i tried to restore o2em and my launcher jo2emLauncher. For those who don't know, here is a link to a blog entry about the launcher blog entry about jo2emLauncher.


No odyssey 2 emulator anymore ?


The most perspicacious among have already noticed the big lie in the previous section. Not everything was easy and straightforward. The problem with o2em was rather the 20th problem I met, but it si the one this blog entry is about.
  • Impossible to use the binary file I had saved. It was a 32 bits exe and the system is 64 bits. There are some compatibility layers, but I did not try this way.
  • O2em is developed using liballegro 4.2 and ubuntu 15.10 (Willy Werewolf) brings allegro 4.4.
Rather than trying to make o2em work by installing a compatibility layer and some old library release, I tried to find an more modern emulator. I found O2em2. The main page of this project is there o2em2.

 

Recompile it


Recompiling o2em2 and making it working has not been a simple job.
  • I first downloaded the latest release o2em2-1.51.tar.gz
  • I uncompressed: tar -xvzf o2em2-1.51.tar.gz
  • cd o2em2-1.51/
  • ./configure --with-game-api=allegro
  • make
    • vmachine.c:25:19: fatal error: debug.h: No such file or directory
       
  • I edited main.c and vmachine.c to replace
    •  #include "debug.h" by
    • //#include "debug.h"
  •  make
  • This time I got a launchable program. To try it, I just had to create a "bios" and a "roms" directories.
 

Program options

The following issue I met was about options. Lots of o2em command line options were not accepted anymore. Among them:
  • -help (not so important)
  • -fullscreen (Annoying because to really have fun you have to play 2 player games. You have to be a few feet away from the screen)
  • -s1
  • -s2 (really annoying because many games require a joystick or a joypad.)
To fix this, I modified the source code of the function parse_option. The modifications of the source code are simple but there are many. I don't place them in the blog entry but you can download the patch.


Having the joysticks working

After the parse_option update, all the options are accepted by the program, but some are still not working. i did not test each of them, but I can tell you that joysticks were still not working.
To fix it, I uncommented a source code line in vmachine.c. source file. The uncommented line is poll_joystick();.

Once this statement is brought back, the program is working fine for me. Nonetheless you may find some other issues and differences with o2em.

Source patches

To ease getting the same result I got, I publish 2 patch files. You can download them:
  main.patch

 vmachine.patch

To apply patches, you just have to download them into the o2em2 source directory and enter the following command:

  • patch -p0 < vmachine.patch
  • patch -p0 < main.patch
Then compile:
  • ./configure --with-game-api=allegro
  • make

  What about jo2emLauncher ?

For now I just created a symbolic link o2em -> o2em2. It is enough to make the launcher work with o2em2.
In a next coming release of he launcher, the name of the emulator binary will be customizable. I've added this item to the TODO list.