{"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":26,"created_at":"2015-07-07T13:27:23Z","updated_at":"2015-07-29T11:23:00Z","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/125922895","html_url":"https://github.com/RetroPie/RetroPie-Setup/issues/903#issuecomment-125922895","issue_url":"https://api.github.com/repos/RetroPie/RetroPie-Setup/issues/903","id":125922895,"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-29T11:22:59Z","updated_at":"2015-07-29T11:22:59Z","body":"It has come to my attention that version 3.0 of ZEsarUX supports custom config files for every game. Launching games by script is no longer necessary so I have decided to simplify the +Start ZEsarUX script. Also, I noticed that games with spaces in their names were not loading with the current script.\r\n\r\nI have written a new version of the configure section of the existing scriptmodule to resolve these issues.\r\n\r\n```\r\nfunction configure_zesarux() {\r\n    mkRomDir \"zxspectrum\"\r\n\r\n    cat > \"$romdir/zxspectrum/+Start ZEsarUX.sh\" << _EOF_\r\n#!/bin/bash \r\nparams=\"\\$1\" \r\npushd \"/opt/retropie/emulators/zesarux/bin\" \r\nif [[ \"\\$params\" =~ \\.sh$ ]]; then \r\n    ./zesarux \r\nelse \r\n    ./zesarux \"\\$params\" \r\nfi\r\npopd\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    ln -sf \"$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--smartloadpath /home/pi/RetroPie/roms/zxspectrum\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 $user:$user \"$configdir/zxspectrum/.zesaruxrc\"\r\n\r\n    addSystem 1 \"$md_id\" \"zxspectrum\" \"$romdir/zxspectrum/+Start\\ ZEsarUX.sh %ROM%\" \"\" \".sh\"\r\n}\r\n```\r\nSelecting the +Start ZEsarUX script in ES will allow the launch of ZEsarUX which will be useful to users who wish to load tapes or snapshots from the emulator itself as well as experimenting with various settings. To facilitate this, I have included a --smartloadpath parameter in the config file, .zesarux, to set the default path for loading tapes to the zxspectrum rom folder.\r\n\r\nI have tested the script and everything is working as it should. Could the scriptmodule be updated? Thanks."}}