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 o2em118src.zip.
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
  • LICENSE.TXT
  • O2EM.TXT
    • o2em118src/SRC:
  • AUDIO.C
  • AUDIO.H
  • CONFIG.H
  • CPU.C
  • CPU.H
  • CRC32.C
  • CRC32.H
  • CSET.C
  • CSET.H
  • DEBUG.C
  • DEBUG.H
  • DIS48.C
  • KEYBOARD.C
  • KEYBOARD.H
  • MAIN.C
  • Makefile
  • Makefile.djgpp
  • Makefile.freebsd
  • Makefile.linux
  • Makefile.mingw
  • Makefile.win
  • O2EM116_private.h
  • O2EM116_private.rc
  • O2em118.dev
  • O2em118.layout
  • O2EM.ICO
  • o2em.png
  • O2EM.RC
  • O2EM.RES
  • SCORE.C
  • SCORE.H
  • SYSTEM.C
  • TABLE.C
  • TABLE.H
  • TIMEFUNC.C
  • TIMEFUNC.H
  • TYPES.H
  • VDC.C
  • VDC.H
  • VMACHINE.C
  • VMACHINE.H
  • VOICE.C
  • VOICE.H
  • VPP.C
  • VPP_CSET.C
  • VPP_CSET.H
  • 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/rename.sh
#!/bin/bash
for file in *
do
        trfile=$(echo $file|tr '[A-Z]' '[a-z]')
        if [ "$file" != "$trfile" ]
        then
                command="mv $file $trfile"
                $command
        fi
done
run the rename.sh 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
Replace
LIBALLEG = /usr/lib/liballeg.so.4.2 -lalleg_unsharable

by
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 ...


  



5 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!

    RépondreSupprimer
  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?

    RépondreSupprimer
  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

    RépondreSupprimer
  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"
    default="o2em"

    RépondreSupprimer
  5. Thanks for providing this informative information you may also refer.
    http://www.s4techno.com/blog/2016/07/12/fix-grub-issue-of-dual-boot-between-linux-and-windows/

    RépondreSupprimer