samedi 16 février 2013

install o2em on linux and recompile it

 version francaise 

In my previous message "installer et configurer o2em", I explained how to install this emulator on windows.
In this message I'm going to provide instructions for linux.

The main videopac emulator is o2em. The web site proposes binaries of the latest release of o2em only for Windows. This is why we are going to start from the sources and recompile them.

This mesage is based on experiments made withubuntu Precise Pangolin 32 bits. You may need to tweak here described manipulations to your own linux distribution.

1 Dependancies

the main dependancy of o2em is liballegro.
You can use synaptic Package manager to install it. You should get a result similar to the figure below:

2 Rebuild videopac emulator from sources

In this chapter we are going to rebuild o2em from sources. Those who do not whish to recompile it themselves can jump to chapter 3.

2.1 Download o2em sources

Click on the following link to download a zip file of o2em sources
Unzip the downloaded file. I use to unzip it into my home directory.

You should get the following directory structure:
  • o2em118src/
    • o2em118src/Docs/
  • changelog.txt
  • O2EM.TXT
    • o2em118src/SRC:
  • CPU.C
  • CPU.H
  • CRC32.C
  • CRC32.H
  • CSET.C
  • CSET.H
  • DIS48.C
  • MAIN.C
  • Makefile
  • Makefile.djgpp
  • Makefile.freebsd
  • Makefile.linux
  • Makefile.mingw
  • O2EM116_private.h
  • O2EM116_private.rc
  • O2em118.layout
  • O2EM.ICO
  • o2em.png
  • O2EM.RC
  • O2EM.RES
  • VDC.C
  • VDC.H
  • VPP.C
  • VPP.H

2.2 Change the case of the file names

The files in SRC directory  nearly all have their name in uppercase. this is causing a problem during compilation. So we have to correct the case:
Enter the following script and save it into o2em118src/SRC/
for file in *
        trfile=$(echo $file|tr '[A-Z]' '[a-z]')
        if [ "$file" != "$trfile" ]
                command="mv $file $trfile"
run the script .

 2.3 Edit score.c

To solve errors like :
score.c:110:68: error: ‘errno’ undeclared (first use in this function)

Edit score.c file , add #include <errno.h> before the first #include statement.
 *   Score loading/saving by manopac

#include <errno.h>
#include <dirent.h>

2.4 Modify makefile

To solve the following error
 /usr/bin/ld: cannot find -lalleg_unsharable
collect2: ld returned 1 exit status

Edit  makefile.linux file
LIBALLEG = /usr/lib/ -lalleg_unsharable

LIBALLEG = `allegro-config --libs`
Beware of antiquotes (AltGr 7)

2.5 Compile

make -f makefile.linux
As output, you must get  two executable files in SRC directory:
  • dis48
  • o2em

2.6  Install

Copy o2em into the directory of your choice. My pesonal choice is /usr/local/games/o2em. In this directory create two subdirectories roms and bios.

drwxrwxr-x 2 ventrill ventrill   4096 Feb 16 17:57 bios
-rwxrwxr-x 1 ventrill ventrill  11768 Feb 16 17:57 dis48

drwx------ 2 ventrill ventrill   4096 Feb 16 18:18 Docs

-rwxrwxr-x 1 ventrill ventrill 133448 Feb 16 17:57 o2em

drwxrwxr-x 2 ventrill ventrill   4096 Feb 16 17:57 roms
In bios directory, you must copy a bios file. In roms directory you must copy rom files. Pour avoir plus de détails, consultez le post "installer-et-configurer-o2em" .

3 o2em from binary in tarball

For those who do not want to go through the steps of recompiling described in chapter2, here is an alternate solution. I recorded the result of chapter 2 and zipped it into this archive : emulvideopac001-linux-x86.tgz.
Download it, expand it and here you are.

4 Use o2em

For now, there is no launcher availabel. I show a shell command. change to the directory wehre you have decompressed the archive. There enter the following commands :
cd o2em
./o2em vp01.bin

To learn more about available options, read the file Docs/O2EM.TXT. I am also planning to describe the use of available options in future posts ...


7 commentaires:

  1. Thank you so much for publishing your fixes! After applying your changes to the code, I compiled O2EM successfully. Note: This is to be run in X Windows. It took me a few tries to realize this!

    This is working on my Raspberry Pi.

    Merci beaucoup!

  2. I would like to run o2em directly from retropie and tried the following command:
    o2em="xinit /opt/retropie/emulators/o2em/o2em %ROM%"
    somehow the emulator gets started but fails because of
    dir 'roms/' not found !

    any help how i could set the roms directory right?
    what should I put in the o2em_def.cfg the o2em will find it's roms directory?

  3. I have never used retropie, but i can give it a try
    - 1 - i usually just use a directory called roms placed in the same direectory as o2em binary. This is the default if i remember well.
    - 2 - you may try to set the full rom directory in a -romdir option like this : xinit /opt/retropie/emulators/o2em/o2em -romdir /my/o2em/rom/dir %ROM%.

    Let me know the results please

  4. this command worked for me:
    o2em="xinit /opt/retropie/emulators/o2em/o2em -fullscreen -wsize=2 -s1=3 s2=3 -biosdir=/home/pi/RetroPie/BIOS/ -romdir=/home/pi/RetroPie/roms/videopac/ %BASENAME%.bin"

  5. When I start o2em the following error occures:

    Starting emulation ...
    Initializing sound system...
    Sound system initialized ok
    Sound driver [ALSA] detected
    Using Allegro Allegro 4.4.3, Unix

    dir 'bios/' without BIOS !

    Any idea?

  6. The o2rom.bin is in the directory bios !

  7. Now it works.
    I use this tutorial: