{"action":"created","issue":{"url":"https://api.github.com/repos/RetroPie/RetroPie-Setup/issues/903","labels_url":"https://api.github.com/repos/RetroPie/RetroPie-Setup/issues/903/labels{/name}","comments_url":"https://api.github.com/repos/RetroPie/RetroPie-Setup/issues/903/comments","events_url":"https://api.github.com/repos/RetroPie/RetroPie-Setup/issues/903/events","html_url":"https://github.com/RetroPie/RetroPie-Setup/issues/903","id":93530203,"number":903,"title":"Add ZEsarUX, ZX Spectrum emulator with game controller support","user":{"login":"dudleydes","id":8166945,"avatar_url":"https://avatars.githubusercontent.com/u/8166945?v=3","gravatar_id":"","url":"https://api.github.com/users/dudleydes","html_url":"https://github.com/dudleydes","followers_url":"https://api.github.com/users/dudleydes/followers","following_url":"https://api.github.com/users/dudleydes/following{/other_user}","gists_url":"https://api.github.com/users/dudleydes/gists{/gist_id}","starred_url":"https://api.github.com/users/dudleydes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dudleydes/subscriptions","organizations_url":"https://api.github.com/users/dudleydes/orgs","repos_url":"https://api.github.com/users/dudleydes/repos","events_url":"https://api.github.com/users/dudleydes/events{/privacy}","received_events_url":"https://api.github.com/users/dudleydes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-07-07T13:27:23Z","updated_at":"2015-07-12T18:23:22Z","closed_at":null,"body":"Would it be possible to add [ZEsarUX](http://sourceforge.net/projects/zesarux/) by Cesar Hernandez to Retropie? Cesar is an active developer having released three versions in 2015. He also responds enthusiastically to feedback as [he added SDL support at my request] (https://www.raspberrypi.org/forums/viewtopic.php?p=726041#p726041) so that it would be possible to launch Speccy games from EmulationStation.\r\n\r\nZEsarUX has out-of-the-box game controller support for most games with further configuration possible with command line parameters. With the [difficulties with installing lr-fuse](http://blog.petrockblock.com/forums/topic/libretro-fuse-wont-install/), ZEsarUX would be a great addition to Retropie. Also, there is support for audio over HDMI.\r\n\r\nThis is how I installed and configured ZEsarUX on my RPi 1 Model B using the RetroPie V3.0 Beta 2 image.\r\n\r\n#### Dependencies\r\n\r\nFrom the [INSTALL file](http://sourceforge.net/p/zesarux/code/ci/master/tree/INSTALL) from the source code, the dependencies are\r\n\r\n* libssl\r\n* libpthreads\r\n* alsa\r\n* sdllib (I think this should be libsdl)\r\n\r\nI didn't need to install any of these.\r\n\r\n#### Get Sources\r\n\r\nRun the following:\r\n```\r\nwget http://downloads.sourceforge.net/project/zesarux/ZEsarUX-3.0/ZEsarUX_src-3.0.tar.gz\r\ntar -xvf ZEsarUX_src-3.0.tar.gz\r\nrm ZEsarUX_src-3.0.tar.gz\r\n```\r\n\r\n#### Build Binary\r\n\r\nThe best joystick to emulate is the Kempston. This can be coded into the binary with the following commands:\r\n```\r\npushd ZEsarUX-3.0\r\nsed -i 's/JOYSTICK_CURSOR_WITH_SHIFT/JOYSTICK_KEMPSTON/g' joystick.c\r\n```\r\n\r\nNow we can build the binary, then install it and the necessary files to the /opt/retropie/emulators/zesarux folder with the following commands:\r\n\r\n```\r\nexport CFLAGS=-O3\r\nexport LDFLAGS=-O3\r\n./configure --enable-raspberry --prefix /opt/retropie/emulators/zesarux\r\nmake clean\r\nmake\r\nsudo make install\r\npopd\r\n```\r\n\r\n#### Configure ZEsarUX\r\n\r\nZEsarUX reads a config file, **~/.zesaruxrc** located in the home directory, upon loading. The config file allows for the same options to be passed in the command line. The file's contents should be as below:\r\n\r\n```\r\n;ZEsarUX sample configuration file\r\n;\r\n;Lines beginning with ; or # are ignored\r\n\r\n\r\n;Run zesarux with --help or --experthelp to see all the options\r\n--disableborder\r\n--vo sdl\r\n--ao alsa\r\n--hidemousepointer\r\n--disablefooter\r\n\r\n;Remap Fire Event. Uncomment and amend if you wish to change the default button 3.\r\n;--joystickevent 3 Fire\r\n```\r\nI have added the last line because it allows for the user to remap the fire event. On the PS3 controller, button 3 is Start so, with the --joystickevent flag, it is possible to remap to button 14 (X) for every game.\r\n\r\n#### Configure RetroPie\r\n\r\nIt is possible to configure game controllers by adding command line parameters outlining the mappings. The best way to launch these games is by using bash scripts. I have used a configuration similar to that for DOSBox.\r\n\r\nIn **/etc/emulationstation/es_systems.cfg**, the extensions .sh and .SH need to be added to the \\<extension> tag for the zxspectrum entry.\r\n\r\nIn **/opt/retropie/configs/zxspectrum/emulators.cfg**, add the following:\r\n```\r\nzesarux=\"/home/pi/RetroPie/roms/zxspectrum/+Start\\ ZEsarUX.sh %ROM%\"\r\ndefault=\"zesarux\"\r\n```\r\n\r\n#### Launch ZEsarUX from EmulationStation\r\n\r\nA rom +Start ZEsarUX.sh needs to be created in the zxspectrum rom folder. Its contents should be as follows:\r\n```\r\n#!/bin/bash\r\nparams=\"$1\"\r\nif [[ \"$params\" =~ \\.sh$ ]]; then\r\n    bash \"$params\"\r\nelse\r\n    /opt/retropie/supplementary/runcommand/runcommand.sh 0 \"/opt/retropie/emulators/zesarux/bin/zesarux $params\" \"zesarux\"\r\nfi\r\n```\r\nThis script will make sure that both tapes and scripts can be launched from Emulationstation. By launching +Start ZEsarUX itself, the emulator will start and it is possible to load tapes using the in-game UI. \r\n\r\nI'll write up some tutorials on how to use ZEsarUX and how to configure it for game controllers.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/RetroPie/RetroPie-Setup/issues/comments/120752444","html_url":"https://github.com/RetroPie/RetroPie-Setup/issues/903#issuecomment-120752444","issue_url":"https://api.github.com/repos/RetroPie/RetroPie-Setup/issues/903","id":120752444,"user":{"login":"dudleydes","id":8166945,"avatar_url":"https://avatars.githubusercontent.com/u/8166945?v=3","gravatar_id":"","url":"https://api.github.com/users/dudleydes","html_url":"https://github.com/dudleydes","followers_url":"https://api.github.com/users/dudleydes/followers","following_url":"https://api.github.com/users/dudleydes/following{/other_user}","gists_url":"https://api.github.com/users/dudleydes/gists{/gist_id}","starred_url":"https://api.github.com/users/dudleydes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dudleydes/subscriptions","organizations_url":"https://api.github.com/users/dudleydes/orgs","repos_url":"https://api.github.com/users/dudleydes/repos","events_url":"https://api.github.com/users/dudleydes/events{/privacy}","received_events_url":"https://api.github.com/users/dudleydes/received_events","type":"User","site_admin":false},"created_at":"2015-07-12T18:23:22Z","updated_at":"2015-07-12T18:23:22Z","body":"I have developed a scriptmodule, below, for ZEsarUX. I have tested it on a RPi1 using a fresh v3.0 Beta 2 image using a TZX tape and a shell script to launch games. Both worked as expected.\r\n\r\nHere is the script:\r\n\r\n```\r\n#!/usr/bin/env bash\r\n\r\n# This file is part of RetroPie.\r\n# \r\n# (c) Copyright 2012-2015  Florian Müller (contact@petrockblock.com)\r\n# \r\n# See the LICENSE.md file at the top-level directory of this distribution and \r\n# at https://raw.githubusercontent.com/petrockblog/RetroPie-Setup/master/LICENSE.md.\r\n#\r\n\r\nrp_module_id=\"zesarux\"\r\nrp_module_desc=\"ZX Spectrum emulator ZEsarUX\"\r\nrp_module_menus=\"4+\"\r\n\r\nfunction depends_dosbox() {\r\n    getDepends libssl-dev libpthread-stubs0-dev  libsdl1.2-dev\r\n}\r\n\r\nfunction sources_zesarux() {\r\n    wget -q http://downloads.sourceforge.net/project/zesarux/ZEsarUX-3.0/ZEsarUX_src-3.0.tar.gz\r\n    tar -xvf ZEsarUX_src-3.0.tar.gz\r\n    rm ZEsarUX_src-3.0.tar.gz\r\n}\r\n\r\nfunction build_zesarux() {\r\n    pushd ZEsarUX-3.0\r\n    export CFLAGS=-O3\r\n    export LDFLAGS=-O3\r\n    ./configure --enable-raspberry --prefix \"$md_inst\"\r\n    make clean\r\n    make\r\n    md_ret_require=\"$md_build/ZEsarUX-3.0\"\r\n}\r\n\r\nfunction install_zesarux() {\r\n    pushd ZEsarUX-3.0\r\n    sudo make install\r\n}\r\n\r\n\r\nfunction configure_zesarux() {\r\n    mkRomDir \"zxspectrum\"\r\n\r\n    rm -f \"$romdir/zxspectrum/Start ZEsarUX.sh\"\r\n    cat > \"$romdir/zxspectrum/+Start ZEsarUX.sh\" << _EOF_\r\n#!/bin/bash\r\nparams=\"\\$1\"\r\nif [[ \"\\$params\" =~ \\.sh$ ]]; then\r\n    bash \"\\$params\"\r\nelse\r\n    $rootdir/supplementary/runcommand/runcommand.sh 0 \"$md_inst/bin/zesarux \\$params\" \"$md_id\"\r\nfi\r\n_EOF_\r\n    chmod +x \"$romdir/zxspectrum/+Start ZEsarUX.sh\"\r\n    chown $user:$user \"$romdir/zxspectrum/+Start ZEsarUX.sh\"\r\n\r\n    # move any old configs to the new location\r\n    if [[ -d \"$home/.zesaruxrc\" && ! -h \"$home/.zesaruxrc\" ]]; then\r\n        mv \"$home/.zesaruxrc/\"* \"$configdir/zxspectrum/\"\r\n        rmdir \"$home/.zesaruxrc\"\r\n    fi\r\n    ln -snf \"$configdir/zxspectrum/.zesaruxrc\" \"$home/.zesaruxrc\"\r\n\r\n    cat > \"$configdir/zxspectrum/.zesaruxrc\" << _EOF_\r\n;ZEsarUX sample configuration file\r\n;\r\n;Lines beginning with ; or # are ignored\r\n\r\n\r\n;Run zesarux with --help or --experthelp to see all the options\r\n--disableborder\r\n--disablefooter\r\n--vo sdl\r\n--ao alsa\r\n--hidemousepointer\r\n\r\n--joystickemulated Kempston\r\n\r\n;Remap Fire Event. Uncomment and amend if you wish to change the default button 3.\r\n;--joystickevent 3 Fire\r\n_EOF_\r\n\r\n    chown -R $user:$user \"$configdir/zxspectrum\"\r\n\r\n    chown $user:$user \"$configdir/all/emulators.cfg\"\r\n\r\n    addSystem 1 \"$md_id\" \"zxspectrum\" \"$romdir/zxspectrum/+Start\\ ZEsarUX.sh %ROM%\" \"\" \".sh\"\r\n}\r\n```\r\n\r\nCuriously, es_systems.cfg already had shell scripts (.sh, .SH) included in permitted ROMs for zxspectrum.\r\n\r\nPlease let me know if there is any further testing or info you would like."}}