vendredi 1 mai 2020

docker container for videopac / odyssey2 emulation


As some of you already probably know, the support for the 32 bits software is tending to disappear.
Some old emulators only support 32bits linux systems and some other are difficult to recompile. To help people try and use the o2em2 emulator, i've built a docker image.

Docker is currently widely used to broadcast software and enabel people to use it without having to mess to much with their system.


Prerequisites


You need to have docker installed and running. You need a running linux station with graphical environment set up. The docker container should also work with a windows station, but I have not yet tried to.

The docker service must be started.

Running it

Runing a docker image is as simple as issuing a command :
docker -it <imagename>
The docker image for o2em2 is called o2em2. It is available here : docker hub o2em2.

To run the emulator software and actually use it you need to overcome two problems:
  • access to the graphic interface
  • access to the sound devices
gaining access to the sound device may be considered optionnal, but really it seems necessary to me to have the sounds to enjoy playing those games.

Access to the sound device

obtaining the sound requires to pass an additionnal option
    --device /dev/snd \

Access to the graphic interface


Several options ca be used for that
Option 1 : open network access
If you are willing to open network access to your X11 server then you simply have to pass a DISPLAY env variable
    -e DISPLAY=$(hostname -I | cut -d ' ' -f 1):0  \

Option 2 : provide the container access to the X11 unix domain socket
This can be acheived by passing additionnal options to docker command:
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -v $XAUTHORITY:/root/.Xauthority \
Display must simply be :0
    -e DISPLAY=:0  \

This option also requires access to some shared memory IPC, thus the following option must be added:
    --ipc=host \

Minimal command with option 1 is :
docker run -it \
    --device /dev/snd \
    -e DISPLAY=$(hostname -I | cut -d ' ' -f 1):0  \
    o2em2

Minimal command with option 2 is :
docker run -it \
    --device /dev/snd \
  --ipc=host \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  -v $XAUTHORITY:/root/.Xauthority \
    -e DISPLAY=$(hostname -I | cut -d ' ' -f 1):0  \
    o2em2


option 1 seems simpler, but do not forget it requires some system configuration as in most linux distros, the X11 server is not listening on an IP port. Option 1 also requires you to open some access with an xhost command.
option 2 should work out of the box.

container tweaking

control launched rom:
By default the container launches always the same game. You can control the launched game by adding the following at the end of the docker command :
    ./o2em2 vp_14.bin
 

tweak bios:
It is possible to provide your own bios directory to o2em2.
     --volume=<fullToBiosDirInHost>:/app/bios  \

tweak rom dir :
It is possible to provide the rom  directory used by o2em2.
     --volume=<fullToRomsDirInHost>:/app/roms  \

tweak sound:
The alsa sound configuration can be set from host system
    --volume=<fullPathtoYourAsound.conf>:/etc/asound.conf \


The following capture show a full command in option 2


Conclusion

I hope this container is going to help some people play the retro games of the early 80's.
In a next coming post i'm going to explain how to control IP address in option 1 and how to troubleshoot sound.