Repository: RetroPie/RetroPie-Setup Branch: master Commit: 1d651c50bd65 Files: 398 Total size: 1.4 MB Directory structure: gitextract_5rddm1no/ ├── .github/ │ ├── FUNDING.yml │ └── ISSUE_TEMPLATE/ │ ├── bug-report.yml │ └── config.yml ├── .gitignore ├── AUTHORS ├── CONTRIBUTING.md ├── COPYRIGHT.md ├── LICENSE.md ├── README.md ├── platforms.cfg ├── retropie_packages.sh ├── retropie_setup.sh └── scriptmodules/ ├── admin/ │ ├── apidocs.sh │ ├── builder.sh │ ├── crosscomp/ │ │ ├── asan_limits.diff │ │ └── bullseye.diff │ ├── crosscomp.sh │ ├── image/ │ │ ├── dists/ │ │ │ ├── rpios-bookworm-64.ini │ │ │ ├── rpios-bookworm.ini │ │ │ ├── rpios-bullseye.ini │ │ │ ├── rpios-buster.ini │ │ │ ├── rpios-jessie.ini │ │ │ └── rpios-stretch.ini │ │ └── template.json │ ├── image.sh │ ├── joy2key/ │ │ ├── joy2key.py │ │ ├── joy2key_sdl.py │ │ └── osk.py │ ├── joy2key.sh │ ├── setup.sh │ ├── stats/ │ │ ├── licences/ │ │ │ ├── app.css │ │ │ ├── app.js │ │ │ └── index.html │ │ └── pkgflags/ │ │ ├── app.css │ │ ├── app.js │ │ └── index.html │ ├── stats.sh │ ├── tools.sh │ └── wikidocs.sh ├── archivefuncs.sh ├── emulators/ │ ├── advmame/ │ │ ├── 01_rpi_framebuffer.diff │ │ ├── 02_fix_extern_globals_0_94.diff │ │ └── 02_fix_extern_globals_1_4.diff │ ├── advmame-0.94.sh │ ├── advmame-1.4.sh │ ├── advmame.sh │ ├── ags.sh │ ├── amiberry/ │ │ ├── 01_preserve_env.diff │ │ ├── 02_fix_uae_config_load.diff │ │ └── 03_fix_crash_saving.diff │ ├── amiberry.sh │ ├── atari800/ │ │ ├── 01_rpi_fixes.diff │ │ └── atari800.sh │ ├── atari800.sh │ ├── basilisk.sh │ ├── capricerpi.sh │ ├── coolcv.sh │ ├── daphne/ │ │ └── dapinput.ini │ ├── daphne.sh │ ├── dgen.sh │ ├── dolphin.sh │ ├── dosbox/ │ │ └── 01-fully-bindable-joystick.diff │ ├── dosbox-sdl2/ │ │ └── 001-sd2.0-check-remove.diff │ ├── dosbox-sdl2.sh │ ├── dosbox-staging/ │ │ └── 0.82.x-kmsdrm-fix.diff │ ├── dosbox-staging.sh │ ├── dosbox.sh │ ├── drastic.sh │ ├── fbzx.sh │ ├── frotz.sh │ ├── fs-uae/ │ │ └── fs-uae.sh │ ├── fs-uae.sh │ ├── fuse/ │ │ ├── 01_disable_cursor.diff │ │ ├── 02_sdl_fix.diff │ │ └── 03_gcc_10_fix.diff │ ├── fuse.sh │ ├── gngeopi.sh │ ├── gpsp.sh │ ├── hatari.sh │ ├── hypseus/ │ │ ├── hypinput.ini │ │ └── hypinput_gamepad.ini │ ├── hypseus.sh │ ├── jzintv/ │ │ ├── 01_rpi_hide_cursor_sdl2.patch │ │ ├── 01_rpi_pillar_boxing_black_background_sdl2.patch │ │ └── 02_Makefile_multiarch_pkg_config.patch │ ├── jzintv.sh │ ├── linapple.sh │ ├── mame/ │ │ └── lzma_armv7_crc.diff │ ├── mame.sh │ ├── mame4all.sh │ ├── minivmac.sh │ ├── mupen64plus/ │ │ ├── 0001-GLideN64-use-emplace.patch │ │ ├── mupen64plus.sh │ │ └── remove_fast_math.diff │ ├── mupen64plus.sh │ ├── np2pi.sh │ ├── openmsx/ │ │ └── retropie-init.tcl │ ├── openmsx.sh │ ├── oricutron.sh │ ├── osmose.sh │ ├── pcsx-rearmed.sh │ ├── pcsx2.sh │ ├── pifba.sh │ ├── pisnes.sh │ ├── ppsspp/ │ │ ├── gles2_fix.diff │ │ ├── sdl_ttf_fix_before_1.19.diff │ │ └── tinker.armv7.cmake │ ├── ppsspp-1.5.4.sh │ ├── ppsspp.sh │ ├── px68k/ │ │ └── 001-missing-typedef.diff │ ├── px68k.sh │ ├── quasi88/ │ │ └── 01_cmake.diff │ ├── quasi88.sh │ ├── redream.sh │ ├── reicast/ │ │ ├── 0001-enable-rpi4-sdl2-target.patch │ │ ├── 0002-enable-vsync.patch │ │ ├── 0003-fix-sdl2-sighandler-conflict.patch │ │ └── reicast.sh │ ├── reicast.sh │ ├── retroarch/ │ │ ├── mess2016_libretro.info │ │ └── mupen64plus_libretro.info │ ├── retroarch.sh │ ├── rpix86.sh │ ├── scummvm-sdl1.sh │ ├── scummvm.sh │ ├── sdltrs.sh │ ├── simcoupe.sh │ ├── snes9x.sh │ ├── stella.sh │ ├── stratagus.sh │ ├── supermodel3.sh │ ├── ti99sim/ │ │ └── missing_cstring.diff │ ├── ti99sim-sdl1/ │ │ └── missing_cstdio.diff │ ├── ti99sim-sdl1.sh │ ├── ti99sim.sh │ ├── uae4all/ │ │ └── 01_guichan.diff │ ├── uae4all.sh │ ├── uae4arm/ │ │ └── uae4arm.sh │ ├── uae4arm.sh │ ├── vice.sh │ ├── xm7/ │ │ └── 01_fix_build.diff │ ├── xm7.sh │ ├── xroar.sh │ ├── yabasanshiro.sh │ └── zesarux.sh ├── helpers.sh ├── inifuncs.sh ├── libretrocores/ │ ├── lr-81.sh │ ├── lr-atari800.sh │ ├── lr-beetle-lynx.sh │ ├── lr-beetle-ngp.sh │ ├── lr-beetle-pce-fast.sh │ ├── lr-beetle-pce.sh │ ├── lr-beetle-pcfx.sh │ ├── lr-beetle-psx.sh │ ├── lr-beetle-saturn.sh │ ├── lr-beetle-supergrafx.sh │ ├── lr-beetle-vb.sh │ ├── lr-beetle-wswan.sh │ ├── lr-bennugd.sh │ ├── lr-bluemsx.sh │ ├── lr-bsnes.sh │ ├── lr-caprice32.sh │ ├── lr-desmume.sh │ ├── lr-desmume2015.sh │ ├── lr-dinothawr.sh │ ├── lr-dirksimple.sh │ ├── lr-dolphin.sh │ ├── lr-dosbox-pure.sh │ ├── lr-dosbox.sh │ ├── lr-ep128emu.sh │ ├── lr-fbalpha2012.sh │ ├── lr-fbneo.sh │ ├── lr-fceumm.sh │ ├── lr-flycast/ │ │ └── 01_flags_fix.diff │ ├── lr-flycast-dev.sh │ ├── lr-flycast.sh │ ├── lr-fmsx.sh │ ├── lr-freechaf.sh │ ├── lr-freeintv.sh │ ├── lr-fuse.sh │ ├── lr-gambatte/ │ │ └── default.pal │ ├── lr-gambatte.sh │ ├── lr-geargrafx.sh │ ├── lr-gearsystem.sh │ ├── lr-genesis-plus-gx.sh │ ├── lr-gpsp.sh │ ├── lr-gw.sh │ ├── lr-handy.sh │ ├── lr-hatari/ │ │ └── 01_libcapsimage.diff │ ├── lr-hatari.sh │ ├── lr-kronos.sh │ ├── lr-mame.sh │ ├── lr-mame2000.sh │ ├── lr-mame2003-plus.sh │ ├── lr-mame2003.sh │ ├── lr-mame2010.sh │ ├── lr-mame2015/ │ │ └── 01-python3-irgen.diff │ ├── lr-mame2015.sh │ ├── lr-mame2016/ │ │ └── 01-python3-irgen.diff │ ├── lr-mame2016.sh │ ├── lr-mesen.sh │ ├── lr-mess.sh │ ├── lr-mess2016.sh │ ├── lr-mgba.sh │ ├── lr-mrboom.sh │ ├── lr-mupen64plus/ │ │ ├── 0001-eliminate-conflicting-typedefs.patch │ │ ├── 0002-rpi-gles3.patch │ │ └── 0003-fix-fsqrt-conflict.patch │ ├── lr-mupen64plus-next.sh │ ├── lr-mupen64plus.sh │ ├── lr-neocd.sh │ ├── lr-nestopia.sh │ ├── lr-np2kai.sh │ ├── lr-nxengine.sh │ ├── lr-o2em.sh │ ├── lr-opera.sh │ ├── lr-parallel-n64/ │ │ └── 01-fix-fsqrt-conflicts.diff │ ├── lr-parallel-n64.sh │ ├── lr-pcsx-rearmed.sh │ ├── lr-picodrive.sh │ ├── lr-pokemini.sh │ ├── lr-ppsspp/ │ │ ├── v13-libretro_fix.diff │ │ └── v16-clamp-include.diff │ ├── lr-ppsspp.sh │ ├── lr-prboom.sh │ ├── lr-prosystem.sh │ ├── lr-puae.sh │ ├── lr-puae2021.sh │ ├── lr-px68k.sh │ ├── lr-quasi88.sh │ ├── lr-quicknes.sh │ ├── lr-retro8.sh │ ├── lr-scummvm.sh │ ├── lr-smsplus-gx.sh │ ├── lr-snes9x.sh │ ├── lr-snes9x2002.sh │ ├── lr-snes9x2005.sh │ ├── lr-snes9x2010.sh │ ├── lr-stella.sh │ ├── lr-stella2014.sh │ ├── lr-superflappybirds.sh │ ├── lr-tgbdual.sh │ ├── lr-theodore.sh │ ├── lr-tic80.sh │ ├── lr-tyrquake.sh │ ├── lr-uae4arm.sh │ ├── lr-vba-next.sh │ ├── lr-vecx.sh │ ├── lr-vice.sh │ ├── lr-virtualjaguar.sh │ ├── lr-x1.sh │ ├── lr-xrick.sh │ └── lr-yabause.sh ├── packages.sh ├── ports/ │ ├── alephone.sh │ ├── cannonball.sh │ ├── cdogs-sdl.sh │ ├── cgenius.sh │ ├── darkplaces-quake/ │ │ ├── 01_rpi_fixes.diff │ │ └── 02_makefile_fixes.diff │ ├── darkplaces-quake.sh │ ├── dsda-doom.sh │ ├── dxx-rebirth.sh │ ├── eduke32/ │ │ ├── 0001-revert-r6918.patch │ │ ├── 0002-fix-skybox.patch │ │ ├── 0003-replace-gl_red.patch │ │ ├── 0004-recast-function.patch │ │ ├── 0005-e1m4-shrinker-bug.patch │ │ └── 0006-e4m4-water-bug.patch │ ├── eduke32.sh │ ├── gemrb.sh │ ├── giana.sh │ ├── gzdoom/ │ │ ├── armv8_gcc12_fix.diff │ │ └── lzma_armv7_crc.diff │ ├── gzdoom.sh │ ├── ionfury.sh │ ├── ioquake3.sh │ ├── jumpnbump/ │ │ └── jumpnbump.sh │ ├── jumpnbump.sh │ ├── kodi.sh │ ├── lincity-ng.sh │ ├── love-0.10.2.sh │ ├── love.sh │ ├── lzdoom/ │ │ ├── 01_remove_cmake_arm_options.diff │ │ ├── 02_lzma_sdk_dont_force_arm_crc32.diff │ │ └── 03_extra_includes.diff │ ├── lzdoom.sh │ ├── micropolis.sh │ ├── minecraft.sh │ ├── mysticmine.sh │ ├── openblok.sh │ ├── openbor.sh │ ├── openpht.sh │ ├── openttd.sh │ ├── opentyrian/ │ │ └── 01_fullscreen.diff │ ├── opentyrian.sh │ ├── quake3.sh │ ├── sdlpop.sh │ ├── smw.sh │ ├── solarus.sh │ ├── splitwolf.sh │ ├── srb2/ │ │ └── 001-cmake-libfind.diff │ ├── srb2.sh │ ├── steamlink.sh │ ├── supertux.sh │ ├── tyrquake.sh │ ├── uqm.sh │ ├── vvvvvv.sh │ ├── wolf4sdl.sh │ ├── xrick.sh │ ├── yquake2/ │ │ ├── hotkey_exit.diff │ │ ├── sdl2_joylabels.diff │ │ └── yq2.cfg │ └── yquake2.sh ├── supplementary/ │ ├── attractmode.sh │ ├── audiosettings.sh │ ├── autostart.sh │ ├── backends.sh │ ├── bashwelcometweak.sh │ ├── bluetooth/ │ │ ├── COPYING │ │ ├── bluez-simple-agent │ │ ├── bluez-test-device │ │ ├── bluezutils.py │ │ ├── connect.sh │ │ └── readme.txt │ ├── bluetooth.sh │ ├── configedit.sh │ ├── consolefont.sh │ ├── controlblock.sh │ ├── custombluez/ │ │ └── 01_raspbian_patches.diff │ ├── customhidsony/ │ │ └── 0001-hidsony-gasiafix.diff │ ├── customhidsony.sh │ ├── dbar4gun.sh │ ├── docsview.sh │ ├── emulationstation/ │ │ ├── configscripts/ │ │ │ ├── daphne.sh │ │ │ ├── emulationstation.sh │ │ │ ├── mupen64plus.sh │ │ │ ├── openmsx.sh │ │ │ ├── pifba.sh │ │ │ ├── pisnes.sh │ │ │ ├── reicast.sh │ │ │ ├── retroarch.sh │ │ │ └── sdl2.sh │ │ └── inputconfiguration.sh │ ├── emulationstation-dev.sh │ ├── emulationstation.sh │ ├── esthemes/ │ │ ├── patch-ruckage-famicom-mini.diff │ │ ├── patch-ruckage-nes-mini.diff │ │ └── patch-ruckage-snes-mini.diff │ ├── esthemes.sh │ ├── gamecondriver.sh │ ├── golang.sh │ ├── kmsxx.sh │ ├── launchingimages.sh │ ├── mehstation.sh │ ├── mesa-drm.sh │ ├── mkarcadejoystick.sh │ ├── mobilegamepad.sh │ ├── moonlight.sh │ ├── omxiv.sh │ ├── pegasus-fe-dev.sh │ ├── pegasus-fe.sh │ ├── powerblock.sh │ ├── ps3controller.sh │ ├── raspbiantools.sh │ ├── resetromdirs.sh │ ├── retronetplay.sh │ ├── retropiemenu.sh │ ├── runcommand/ │ │ └── runcommand.sh │ ├── runcommand.sh │ ├── samba.sh │ ├── scraper.sh │ ├── sdl1.sh │ ├── sdl12-compat.sh │ ├── sdl2.sh │ ├── sixaxis.sh │ ├── skyscraper.sh │ ├── snesdev/ │ │ └── 001-wiringpi-static.diff │ ├── snesdev.sh │ ├── splashscreen/ │ │ ├── 05-splash.sh │ │ ├── asplashscreen.sh │ │ └── rp-vlc │ ├── splashscreen.sh │ ├── steamcontroller.sh │ ├── usbromservice/ │ │ ├── 01_retropie_copyroms │ │ └── 10_retropie_mount │ ├── usbromservice.sh │ ├── virtualgamepad.sh │ ├── wifi.sh │ ├── xarcade2jstick.sh │ ├── xboxdrv.sh │ ├── xpad/ │ │ ├── 01_enable_leds_and_trigmapping.diff │ │ ├── 02_dkms_updates_folder.diff │ │ └── 03_xpad_add_version.diff │ ├── xpad.sh │ └── xpadneo.sh └── system.sh ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/FUNDING.yml ================================================ patreon: retropie custom: https://retropie.org.uk/donate/ ================================================ FILE: .github/ISSUE_TEMPLATE/bug-report.yml ================================================ name: Create Issue description: | Report a bug with RetroPie-Setup scripts body: - type: markdown id: info attributes: value: | #### Important Only RetroPie-Setup **bugs** should be reported here as an Issue. For general support questions, games troubleshooting and enhancement requests please use the [RetroPie Forums](https://retropie.org.uk/forum). validations: required: false - type: textarea id: description attributes: label: Description placeholder: describe the problem/bug in RetroPie's scripts validations: required: true ================================================ FILE: .github/ISSUE_TEMPLATE/config.yml ================================================ blank_issues_enabled: false contact_links: - name: RetroPie Forums url: https://retropie.org.uk/forum about: Community for discussion and support - name: Documentation url: https://retropie.org.uk/docs about: Official RetroPie Documentation ================================================ FILE: .gitignore ================================================ # OS generated files # ###################### .DS_Store .DS_Store? ._* .Spotlight-V100 .Trashes Icon? ehthumbs.db Thumbs.db # Generated files logs/ tmp/ # 3rd Party Repos ext/* ================================================ FILE: AUTHORS ================================================ Florian Müller - - Main code, maintainer Jools Wills - - Main code, maintainer ================================================ FILE: CONTRIBUTING.md ================================================ # How to contribute ## Support Requests vs Bug Reporting Please use the GitHub for bug reports only. For help / support in using RetroPie and the emulators it ships with, please use the [RetroPie forum](https://retropie.org.uk/forum/). ## Pull Requests Contributions to the project are welcome - please check out our [Shell Style Guide](https://retropie.org.uk/docs/Shell-Style-Guide/) before submitting changes. ================================================ FILE: COPYRIGHT.md ================================================ The RetroPie Project Copyright (C) 2012-2025 by the following: If you have contributed to this project then you deserve to be on this list. Contact us (see: AUTHORS) and we'll add you. * Florian Müller "petrockblog" * Jools Wills "joolswills" * Peter Mahlknecht * Aloshi * Martin Modahl * marqs * Juan Pablo Zapata, jpzapa * Xevin * James Le Cuirot * Ewan Meadows * Adam "adskiremote" * Hyperspin * Claudio Cesar Sanchez Tejeda, * cdu13a * Christian Bryn * Adam Smith * Adrian Moisey * Sergej Tatarincev * "HerbFargus" * Stefan "gizmo98" For most recent list see also https://github.com/RetroPie/RetroPie-Setup/graphs/contributors ================================================ FILE: LICENSE.md ================================================ # RetroPie Legal Information ## License ### GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. ### Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. ### TERMS AND CONDITIONS #### 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. #### 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. #### 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. #### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. #### 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. #### 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. #### 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. #### 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. #### 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. #### 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. #### 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. #### 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. #### 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. #### 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. #### 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. #### 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. #### 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. #### 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS --- ## Copyright (c) Copyright 2012-2015 RetroPie Project (See COPYRIGHT.md) ================================================ FILE: README.md ================================================ RetroPie-Setup ============== General Usage ------------- Shell script to setup the Raspberry Pi, Vero4K, ODroid-C1 or a PC running Ubuntu with many emulators and games, using EmulationStation as the graphical front end. Bootable pre-made images for the Raspberry Pi are available for those that want a ready-to-go system, downloadable from the releases section of GitHub or via our website at https://retropie.org.uk. This script is designed for use on Raspberry Pi OS (previously called Raspbian) on the Raspberry Pi, OSMC on the Vero4K or Ubuntu on the ODroid-C1 or a PC. To run the RetroPie Setup Script make sure that your APT repositories are up-to-date and that Git is installed: ```shell sudo apt-get update sudo apt-get dist-upgrade sudo apt-get install git ``` Then you can download the latest RetroPie setup script with: ```shell cd git clone --depth=1 https://github.com/RetroPie/RetroPie-Setup.git ``` The script is executed with: ```shell cd RetroPie-Setup sudo ./retropie_setup.sh ``` When you first run the script it may install some additional packages that are needed. Binaries and Sources -------------------- On the Raspberry Pi, RetroPie Setup offers the possibility to install from binaries or source. For other supported platforms only a source install is available. Installing from binary is recommended on a Raspberry Pi as building everything from source can take a long time. For more information, visit the site at https://retropie.org.uk or the repository at https://github.com/RetroPie/RetroPie-Setup. Docs ---- You can find useful information about several components and answers to frequently asked questions in the [RetroPie Docs](https://retropie.org.uk/docs/). If you think that there is something missing, you are invited to submit a pull request to the [RetroPie-Docs repository](https://github.com/RetroPie/RetroPie-Docs). Thanks ------ This script just simplifies the usage of the great works of many other people that enjoy the spirit of retrogaming. Many thanks go to them! ================================================ FILE: platforms.cfg ================================================ 3do_exts=".chd .cue .iso .zip" 3do_fullname="3DO Interactive Multiplayer" ags_exts=".exe" ags_fullname="Adventure Game Studio" amiga_exts=".adf .adz .chd .cue .dms .hdf .hdz .ipf .lha .m3u .sh .uae .zip" amiga_fullname="Commodore Amiga" amstradcpc_exts=".cdt .cpc .cpr .dsk .m3u .tap .zip" amstradcpc_fullname="Amstrad CPC" apple2_exts=".po .dsk .nib" apple2_fullname="Apple II" arcade_exts=".7z .cue .fba .iso .zip" arcade_fullname="Arcade" arcadia_exts=".bin .zip" arcadia_fullname="Arcadia 2001" atari2600_exts=".7z .a26 .bin .rom .zip .gz" atari2600_fullname="Atari 2600" atari5200_exts=".7z .a52 .bin .car .zip" atari5200_fullname="Atari 5200" atari7800_exts=".7z .a78 .bin .zip" atari7800_fullname="Atari 7800 ProSystem" atari800_exts=".7z .atr .atr.gz .atx .bas .bin .car .cas .com .dcm .rom .xex .xfd .xfd.gz .zip" atari800_fullname="Atari 800" atarijaguar_exts=".j64 .jag .zip" atarijaguar_fullname="Atari Jaguar" atarilynx_exts=".7z .lnx .zip" atarilynx_fullname="Atari Lynx" atarist_exts=".st .stx .img .m3u .rom .raw .ipf .ctr .zip" atarist_fullname="Atari ST" c64_exts=".cmd .crt .d64 .d71 .d80 .d81 .g64 .prg .m3u .t64 .tap .x64 .zip .vsf" c64_fullname="Commodore 64" channelf_exts=".bin .rom .zip .7z" channelf_fullname="Fairchild ChannelF" coco_exts=".bin .cas .wav .bas .asc .dmk .jvc .os9 .dsk .vdk .rom .ccc .sna" coco_fullname="TRS-80 Color Computer" coleco_exts=".bin .col .rom .zip" coleco_fullname="ColecoVision" coleco_theme="colecovision" coleco_platform="colecovision" crvision_exts=".rom .zip" crvision_fullname="CreatiVision" daphne_exts=".daphne .ogv" daphne_fullname="Daphne" dragon32_exts=".bin .cas .wav .bas .asc .dmk .jvc .os9 .dsk .vdk .rom .ccc .sna" dragon32_fullname="Dragon 32" dreamcast_exts=".cdi .chd .cue .gdi .sh .zip .m3u" dreamcast_fullname="Dreamcast" enterprise_exts=".img .dsk .tap .dtf .wav .bas .com .trn .128" enterprise_fullname="Enterprise 128" fba_exts=".7z .cue .fba .iso .zip" fba_fullname="Final Burn Alpha" fba_platform="arcade" fds_exts=".7z .nes .fds .zip" fds_fullname="Famicom Disk System" fm7_exts=".d77 .t77 .d88 .2d" fm7_fullname="Fujitsu FM-7 Series" gameandwatch_exts=".mgw" gameandwatch_fullname="Game and Watch" gamegear_exts=".7z .gg .bin .sms .zip" gamegear_fullname="Sega Gamegear" gba_exts=".7z .gba .zip" gba_fullname="Game Boy Advance" gb_exts=".7z .gb .zip" gb_fullname="Game Boy" gbc_exts=".7z .gbc .zip" gbc_fullname="Game Boy Color" gc_exts=".ciso .gcm .gcz .iso .rvz .m3u" gc_fullname="Nintendo Gamecube" intellivision_exts=".7z .bin .int .itv .rom .zip" intellivision_fullname="Intellivision" love_exts=".love" love_fullname="Love" macintosh_exts=".txt .dsk" macintosh_fullname="Apple Macintosh" mame_exts=".zip .7z" mame_fullname="Multiple Arcade Machine Emulator" mame_platform="arcade" mame_theme="mame" mame-advmame_exts=".zip" mame-advmame_fullname="Multiple Arcade Machine Emulator" mame-advmame_platform="arcade" mame-advmame_theme="mame" mame-libretro_exts=".zip" mame-libretro_fullname="Multiple Arcade Machine Emulator" mame-libretro_platform="arcade" mame-libretro_theme="mame" mame-mame4all_exts=".zip" mame-mame4all_fullname="Multiple Arcade Machine Emulator" mame-mame4all_platform="arcade" mame-mame4all_theme="mame" mastersystem_exts=".7z .sms .bin .zip" mastersystem_fullname="Sega Master System" megadrive_exts=".7z .smd .bin .gen .md .sg .zip" megadrive_fullname="Sega Mega Drive" megadrive_theme="megadrive" megadrive_platform="megadrive" msx_exts=".cas .rom .mx1 .mx2 .col .dsk .zip .m3u" msx_fullname="MSX" moto_exts=".fd .k7 .m5 .m7 .rom .sap" moto_fullname="Thomson MO/TO" n64_exts=".z64 .n64 .v64 .zip" n64_fullname="Nintendo 64" nds_exts=".nds .zip" nds_fullname="Nintendo DS" neogeo_exts=".7z .chd .cue .fba .iso .zip" neogeo_fullname="Neo Geo" nes_exts=".7z .nes .zip" nes_fullname="Nintendo Entertainment System" ngp_exts=".7z .ngp .zip" ngp_fullname="Neo Geo Pocket" ngpc_exts=".7z .ngc .zip" ngpc_fullname="Neo Geo Pocket Color" np2pi_exts=".d88 .d98 .88d .98d .fdi .xdf .hdm .dup .2hd .tfd .hdi .thd .nhd .hdd" np2pi_fullname="NEC PC-9801" oric_exts=".dsk .tap" oric_fullname="Oric 1" pc88_exts=".d88 .cmt .m3u .t88" pc88_fullname="NEC PC-8801" pc98_exts=".2hd .88d .98d .cmd .d88 .d98 .dup .fdi .fdd .hdd .hdi .hdm .nhd .thd .tfd .xdf .zip" pc98_fullname="NEC PC-9801" pc_exts=".bat .com .conf .cue .dosz .exe .ins .ima .img .iso .m3u .m3u8 .sh .vhd .zip" pc_fullname="PC" pcengine_exts=".7z .pce .ccd .chd .cue .zip" pcengine_fullname="PC Engine" pcengine_theme="pcengine" pcfx_exts=".pce .ccd .cue .iso .chd" pcfx_fullname="PC-FX" pico8_exts=".p8 .png .zip" pico8_fullname="PICO-8" pokemini_exts=".min .zip" pokemini_fullname="Pokemon Mini" ports_exts=".sh" ports_fullname="Ports" ports_platform="pc" ps2_exts=".iso .img .bin .mdf .z .z2 .bz2 .dump .cso .chd .ima .gz" ps2_fullname="PlayStation 2" psp_exts=".chd .iso .pbp .cso" psp_fullname="PlayStation Portable" psx_exts=".cue .cbn .chd .img .iso .m3u .mdf .pbp .toc .z .znx" psx_fullname="PlayStation" samcoupe_exts=".dsk .mgt .sbt .sad" samcoupe_fullname="SAM Coupe" saturn_exts=".chd .cue .m3u .mdf .zip" saturn_fullname="Sega Saturn" scummvm_exts=".sh .svm" scummvm_fullname="ScummVM" sega32x_exts=".7z .32x .smd .bin .md .zip" sega32x_fullname="Sega 32X" segacd_exts=".iso .cue .chd .m3u" segacd_fullname="Mega CD" sg-1000_exts=".7z .sg .bin .zip" sg-1000_fullname="Sega SG-1000" snes_exts=".7z .bin .bs .smc .sfc .fig .swc .mgd .zip" snes_fullname="Super Nintendo" solarus_exts=".solarus .zip" solarus_fullname="Solarus Engine" ti99_exts=".ctg" ti99_fullname="TI99" tic80_exts=".tic .zip" tic80_fullname="TIC-80" trs-80_exts=".dsk" trs-80_fullname="trs-80" vectrex_exts=".7z .vec .gam .bin .zip" vectrex_fullname="Vectrex" videopac_exts=".7z .bin .zip" videopac_fullname="Videopac" virtualboy_exts=".7z .vb .zip" virtualboy_fullname="Virtual Boy" wii_exts=".ciso .gcm .gcz .iso .rvz .wad .wbfs .m3u" wii_fullname="Nintendo Wii" wonderswan_exts=".7z .ws .zip" wonderswan_fullname="Wonderswan" wonderswancolor_exts=".7z .wsc .zip" wonderswancolor_fullname="Wonderswan Color" x1_exts=".dx1 .zip .2d .2hd .tfd .d88 .88d .hdm .xdf .dup .cmd" x1_fullname="Sharp X1" x68000_exts=".dim .hdf .hdm .2hd .d88 .m3u .xdf" x68000_fullname="X68000" zmachine_exts=".dat .zip .z1 .z2 .z3 .z4 .z5 .z6 .z7 .z8" zmachine_fullname="Z-machine" zx81_exts=".7z .p .tzx .t81 .zip" zx81_fullname="ZX81" zxspectrum_exts=".7z .sh .sna .szx .z80 .tap .tzx .gz .udi .mgt .img .trd .scl .dsk .zip .rzx" zxspectrum_fullname="ZX Spectrum" ================================================ FILE: retropie_packages.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # __version="4.8.11" [[ "$__debug" -eq 1 ]] && set -x # main retropie install location rootdir="/opt/retropie" # if no user is specified if [[ -z "$__user" ]]; then # get the calling user from sudo env __user="$SUDO_USER" # if not called from sudo get the current user [[ -z "$__user" ]] && __user="$(id -un)" fi # check if the user exists if [[ -z "$(getent passwd "$__user")" ]]; then echo "User $__user does not exist." exit 1 fi # if no group is specified get the users primary group if [[ -z "$__group" ]]; then __group="$(id -gn "$__user")" fi # check if the group exists if [[ -z "$(getent group "$__group")" ]]; then echo "Group $__group does not exist." exit 1 fi # backwards compatibility user="$__user" home="$(eval echo ~$__user)" datadir="$home/RetroPie" biosdir="$datadir/BIOS" romdir="$datadir/roms" emudir="$rootdir/emulators" configdir="$rootdir/configs" scriptdir="$(dirname "$0")" scriptdir="$(cd "$scriptdir" && pwd)" __logdir="$scriptdir/logs" __tmpdir="$scriptdir/tmp" __builddir="$__tmpdir/build" __swapdir="$__tmpdir" # check, if sudo is used if [[ "$(id -u)" -ne 0 ]]; then echo "Script must be run under sudo from the user you want to install for. Try 'sudo $0'" exit 1 fi __backtitle="retropie.org.uk - RetroPie Setup. Installation folder: $rootdir for user $__user" source "$scriptdir/scriptmodules/system.sh" source "$scriptdir/scriptmodules/helpers.sh" source "$scriptdir/scriptmodules/inifuncs.sh" source "$scriptdir/scriptmodules/packages.sh" setup_env rp_registerAllModules ensureFBMode 320 240 rp_ret=0 if [[ $# -gt 0 ]]; then setupDirectories rp_callModule "$@" rp_ret=$? else rp_printUsageinfo fi if [[ "${#__ERRMSGS[@]}" -gt 0 ]]; then # override return code if ERRMSGS is set - eg in the case of calling basic_install from setup # we won't get the return code, as we don't handle return codes when calling non packaging functions # as it would require all modules functions to handle errors differently, and make things more complicated [[ "$rp_ret" -eq 0 ]] && rp_ret=1 printMsgs "console" "Errors:\n${__ERRMSGS[@]}" fi if [[ "${#__INFMSGS[@]}" -gt 0 ]]; then printMsgs "console" "Info:\n${__INFMSGS[@]}" fi exit $rp_ret ================================================ FILE: retropie_setup.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # scriptdir="$(dirname "$0")" scriptdir="$(cd "$scriptdir" && pwd)" "$scriptdir/retropie_packages.sh" setup gui ================================================ FILE: scriptmodules/admin/apidocs.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="apidocs" rp_module_desc="Generate developer documentation" rp_module_section="" function depends_apidocs() { getDepends doxygen graphviz } function sources_apidocs() { gitPullOrClone "$md_build" https://github.com/Anvil/bash-doxygen.git } function build_apidocs() { local config="Doxyfile" rm -f "$config" doxygen -g "$config" >/dev/null iniConfig " = " '' "$config" iniSet "PROJECT_NAME" "RetroPie-Setup" iniSet "PROJECT_NUMBER" "$__version" iniSet "EXTENSION_MAPPING" "sh=C" iniSet "QUIET" "YES" iniSet "WARN_IF_DOC_ERROR" "NO" iniSet "INPUT" "$scriptdir" iniSet "EXCLUDE_PATTERNS" "*/tmp/*" iniSet "INPUT_FILTER" "\"sed -n -f $md_build/doxygen-bash.sed -- \"" iniSet "RECURSIVE" "YES" # unable to use iniSet for latest doxygen "multi line" FILE_PATTERNS default echo "FILE_PATTERNS = *.sh" >>"$config" doxygen "$config" } function install_apidocs() { rsync -a --delete "$md_build/html/" "$__tmpdir/apidocs/" chown -R "$__user":"$__group" "$__tmpdir/apidocs" } function upload_apidocs() { adminRsync "$__tmpdir/apidocs/" "api/" --delete } ================================================ FILE: scriptmodules/admin/builder.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="builder" rp_module_desc="Create binary archives for distribution" rp_module_section="" function depends_builder() { getDepends rsync } function module_builder() { local ids=($@) # set log directories local log_dir_ok="$__tmpdir/build_logs/$__os_binaries/ok/$__platform" local log_dir_fail="$__tmpdir/build_logs/$__os_binaries/fail/$__platform" # create the log directories mkdir -p "$log_dir_ok" "$log_dir_fail" local id for id in "${ids[@]}"; do printMsgs "console" "Checking module $id ..." # don't build binaries for modules with flag nobin # eg scraper which fails as go1.8 doesn't work under qemu if hasFlag "${__mod_info[$id/flags]}" "nobin"; then printMsgs "console" "Module has 'nobin' flag set, so not building." continue fi # skip modules that are not enabled for the target system if [[ "${__mod_info[$id/enabled]}" -ne 1 ]]; then printMsgs "console" "Module is disabled for this platform ($__platform)." continue fi # if the module has no install_ function skip to the next module if ! fnExists "install_${id}"; then printMsgs "console" "Module has no install_${id} function so cannot be pre-built." continue fi # if there is no newer version, skip to the next module. Returns 1 when update is not required, # but can also return 2, to mean "unknown" in which case we should do an update. Modules like sdl2 # will return 2 as they are handled differently, and don't use the package update mechanisms. rp_hasNewerModule "$id" "source" if [[ "$?" -eq 1 ]]; then printMsgs "console" "No update was found." continue else printMsgs "console" "Update found." fi # delete previous log if present rm -f "$log_dir_ok/$id.log" # build, install and create binary archive. # initial clean in case anything was in the build folder when calling local failed=0 local mode for mode in clean depends sources build install create_bin clean remove "depends remove"; do # don't try and create binary archives for modules with an install_bin such as sdl1/sdl2 if [[ "$mode" == "create_bin" ]] && fnExists "install_bin_${id}"; then continue fi # call the module function, logging the output. rp_callModule "$id" $mode 2>&1 | tee -a "$log_dir_ok/$id.log" # if the module function returns an error mark as failed and continue to next module if [[ ${PIPESTATUS[0]} -ne 0 ]]; then failed=1 break fi done if [[ "$failed" -eq 0 ]]; then # if the build is successful, remove any previous fail log rm -f "$log_dir_fail/$id.log" else # otherwise, the build failed or a module wasn't available so move the module output to a fail log mv "$log_dir_ok/$id.log" "$log_dir_fail/$id.log" fi done return 0 } function section_builder() { module_builder $(rp_getSectionIds $1) || return 1 } function upload_builder() { adminRsync "$__tmpdir/archives/" "files/binaries/" } function clean_archives_builder() { rm -rfv "$__tmpdir/archives" } function chroot_build_builder() { rp_callModule image depends mkdir -p "$md_build" # get current host ip for the distcc in the emulated chroot to connect to local ip="$(getIPAddress)" local dist local dists="$__builder_dists" [[ -z "$dists" ]] && return 1 local platform local platforms="$__builder_platforms" for dist in $dists; do [[ -z "$platforms" ]] && platforms="$(_get_info_image "$dist" "platforms")" [[ -z "$platforms" ]] && fatalError "Unable to get platforms information for $dist" local chroot_dir="$md_build/$dist" local chroot_rps_dir="$chroot_dir/home/pi/RetroPie-Setup" local dist_name="$(_get_info_image "$dist" "name")" [[ -z "$dist_name" ]] && fatalError "Unable to get name information for $dist" local archive_dir="tmp/archives/$dist_name" # set the host and chroot build_log locations local chroot_build_logs="$chroot_rps_dir/tmp/build_logs" local host_build_logs="$scriptdir/tmp/build_logs" local distcc_hosts="$__builder_distcc_hosts" local use_ccache="$__builder_use_ccache" local makeflags="$__builder_makeflags" [[ -z "$makeflags" ]] && makeflags="-j$(nproc)" [[ ! -d "$chroot_dir" ]] && rp_callModule image create_chroot "$dist" "$chroot_dir" if [[ ! -d "$chroot_rps_dir" ]]; then gpg --export-secret-keys "$__gpg_signing_key" >"$chroot_dir/retropie.key" rp_callModule image chroot "$chroot_dir" bash -c " sudo gpg --import /retropie.key sudo rm /retropie.key sudo apt-get update; sudo apt-get install -y git cd git clone https://github.com/RetroPie/RetroPie-Setup.git " # copy existing packages from host if building in a clean chroot to avoid rebuilding everything mkdir -p "$scriptdir/$archive_dir" "$chroot_rps_dir/$archive_dir" rsync -av "$scriptdir/$archive_dir/" "$chroot_rps_dir/$archive_dir/" # copy any previous build logs back to the chroot mkdir -p "$host_build_logs/$dist_name" "$chroot_build_logs/$dist_name" rsync -av --delete "$host_build_logs/$dist_name/" "$chroot_build_logs/$dist_name/" else rp_callModule image chroot "$chroot_dir" bash -c " cd ~/RetroPie-Setup git checkout master git pull if git remote | grep -q builder; then git branch -D builder-branch git remote remove builder fi " fi # if we have a __builder_repo and __builder_branch set, check out the branch and use that if [[ -n "$__builder_repo" && "$__builder_branch" ]]; then rp_callModule image chroot "$chroot_dir" bash -c " cd ~/RetroPie-Setup git remote add builder $__builder_repo git fetch -q builder git checkout builder/$__builder_branch -b builder-branch " fi for platform in $platforms; do rp_callModule image chroot "$chroot_dir" \ sudo \ __use_ccache="$use_ccache" \ __makeflags="$makeflags" \ DISTCC_HOSTS="$distcc_hosts" \ __platform="$platform" \ __has_binaries="$__chroot_has_binaries" \ /home/pi/RetroPie-Setup/retropie_packages.sh builder "$@" done rsync -av "$chroot_rps_dir/$archive_dir/" "$scriptdir/$archive_dir/" # sync the build_logs from the chroot to the host system - note: $dist_name should be the same as $__os_binaries rsync -av --delete "$chroot_build_logs/$dist_name/" "$host_build_logs/$dist_name/" done } ================================================ FILE: scriptmodules/admin/crosscomp/asan_limits.diff ================================================ # fixes gcc/libsanitizer/asan/asan_linux.cpp:217:21: error: ‘PATH_MAX’ was not declared in this scope --- a/gcc/libsanitizer/asan/asan_linux.cpp +++ b/gcc/libsanitizer/asan/asan_linux.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include ================================================ FILE: scriptmodules/admin/crosscomp/bullseye.diff ================================================ # see https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=49348beafe9ba150c9bd48595b3f372299bddbb0 diff --git a/math/Makefile b/math/Makefile index 84a8b94c74..0a5a40430e 100644 --- a/glibc/math/Makefile +++ b/glibc/math/Makefile @@ -644,6 +644,128 @@ # We won't compile the `long double' code at all. Tell the `double' code # to define aliases for the `FUNCl' names. math-CPPFLAGS += -DNO_LONG_DOUBLE +# GCC 10 diagnoses aliases with types conflicting with built-in +# functions. +CFLAGS-w_acos.c += -fno-builtin-acosl +CFLAGS-w_acosh.c += -fno-builtin-acoshl +CFLAGS-w_asin.c += -fno-builtin-asinl +CFLAGS-s_asinh.c += -fno-builtin-asinhl +CFLAGS-s_atan.c += -fno-builtin-atanl +CFLAGS-w_atan2.c += -fno-builtin-atan2l +CFLAGS-w_atanh.c += -fno-builtin-atanhl +CFLAGS-s_cabs.c += -fno-builtin-cabsl +CFLAGS-s_cacos.c += -fno-builtin-cacosl +CFLAGS-s_cacosh.c += -fno-builtin-cacoshl +CFLAGS-s_canonicalize.c += -fno-builtin-canonicalizel +CFLAGS-s_carg.c += -fno-builtin-cargl +CFLAGS-s_casin.c += -fno-builtin-casinl +CFLAGS-s_casinh.c += -fno-builtin-casinhl +CFLAGS-s_catan.c += -fno-builtin-catanl +CFLAGS-s_catanh.c += -fno-builtin-catanhl +CFLAGS-s_cbrt.c += -fno-builtin-cbrtl +CFLAGS-s_ccos.c += -fno-builtin-ccosl +CFLAGS-s_ccosh.c += -fno-builtin-ccoshl +CFLAGS-s_ceil.c += -fno-builtin-ceill +CFLAGS-s_cexp.c += -fno-builtin-cexpl +CFLAGS-s_cimag.c += -fno-builtin-cimagl +CFLAGS-s_clog.c += -fno-builtin-clogl +CFLAGS-s_clog10.c += -fno-builtin-clog10l +CFLAGS-s_conj.c += -fno-builtin-conjl +CFLAGS-s_copysign.c += -fno-builtin-copysignl +CFLAGS-s_cos.c += -fno-builtin-cosl +CFLAGS-w_cosh.c += -fno-builtin-coshl +CFLAGS-s_cpow.c += -fno-builtin-cpowl +CFLAGS-s_cproj.c += -fno-builtin-cprojl +CFLAGS-s_creal.c += -fno-builtin-creall +CFLAGS-s_csin.c += -fno-builtin-csinl +CFLAGS-s_csinh.c += -fno-builtin-csinhl +CFLAGS-s_csqrt.c += -fno-builtin-csqrtl +CFLAGS-s_ctan.c += -fno-builtin-ctanl +CFLAGS-s_ctanh.c += -fno-builtin-ctanhl +CFLAGS-s_dadd.c += -fno-builtin-daddl +CFLAGS-s_ddiv.c += -fno-builtin-ddivl +CFLAGS-s_dmul.c += -fno-builtin-dmull +CFLAGS-s_dsub.c += -fno-builtin-dsubl +CFLAGS-s_erf.c += -fno-builtin-erfl +CFLAGS-s_erfc.c += -fno-builtin-erfcl +CFLAGS-e_exp.c += -fno-builtin-expl +CFLAGS-w_exp10.c += -fno-builtin-exp10l +CFLAGS-e_exp2.c += -fno-builtin-exp2l +CFLAGS-s_expm1.c += -fno-builtin-expm1l +CFLAGS-s_fabs.c += -fno-builtin-fabsl +CFLAGS-s_fadd.c += -fno-builtin-faddl +CFLAGS-s_fdim.c += -fno-builtin-fdiml +CFLAGS-s_fdiv.c += -fno-builtin-fdivl +CFLAGS-s_finite.c += -fno-builtin-finitel +CFLAGS-s_floor.c += -fno-builtin-floorl +CFLAGS-s_fma.c += -fno-builtin-fmal +CFLAGS-s_fmax.c += -fno-builtin-fmaxl +CFLAGS-s_fmaxmag.c += -fno-builtin-fmaxmagl +CFLAGS-s_fmin.c += -fno-builtin-fminl +CFLAGS-s_fminmag.c += -fno-builtin-fminmagl +CFLAGS-w_fmod.c += -fno-builtin-fmodl +CFLAGS-s_fmul.c += -fno-builtin-fmull +CFLAGS-s_frexp.c += -fno-builtin-frexpl +CFLAGS-s_fromfp.c += -fno-builtin-fromfpl +CFLAGS-s_fromfpx.c += -fno-builtin-fromfpxl +CFLAGS-s_fsub.c += -fno-builtin-fsubl +CFLAGS-s_gamma.c += -fno-builtin-gammal +CFLAGS-s_getpayload.c += -fno-builtin-getpayloadl +CFLAGS-w_hypot.c += -fno-builtin-hypotl +CFLAGS-w_ilogb.c += -fno-builtin-ilogbl +CFLAGS-s_isinf.c += -fno-builtin-isinfl +CFLAGS-s_isnan.c += -fno-builtin-isnanl +CFLAGS-w_j0.c += -fno-builtin-j0l +CFLAGS-w_j1.c += -fno-builtin-j1l +CFLAGS-w_jn.c += -fno-builtin-jnl +CFLAGS-s_ldexp.c += -fno-builtin-ldexpl +CFLAGS-w_lgamma.c += -fno-builtin-lgammal +CFLAGS-w_lgamma_r.c += -fno-builtin-lgammal_r +CFLAGS-w_llogb.c += -fno-builtin-llogbl +CFLAGS-s_llrint.c += -fno-builtin-llrintl +CFLAGS-s_llround.c += -fno-builtin-llroundl +CFLAGS-e_log.c += -fno-builtin-logl +CFLAGS-w_log10.c += -fno-builtin-log10l +CFLAGS-w_log1p.c += -fno-builtin-log1pl +CFLAGS-e_log2.c += -fno-builtin-log2l +CFLAGS-s_logb.c += -fno-builtin-logbl +CFLAGS-s_lrint.c += -fno-builtin-lrintl +CFLAGS-s_lround.c += -fno-builtin-lroundl +CFLAGS-s_modf.c += -fno-builtin-modfl +CFLAGS-s_nan.c += -fno-builtin-nanl +CFLAGS-s_nearbyint.c += -fno-builtin-nearbyintl +CFLAGS-s_nextafter.c += -fno-builtin-nextafterl +CFLAGS-s_nextdown.c += -fno-builtin-nextdownl +CFLAGS-s_nexttoward.c += -fno-builtin-nexttoward -fno-builtin-nexttowardl +CFLAGS-s_nexttowardf.c += -fno-builtin-nexttowardf +CFLAGS-s_nextup.c += -fno-builtin-nextupl +CFLAGS-e_pow.c += -fno-builtin-powl +CFLAGS-w_remainder.c += -fno-builtin-remainderl -fno-builtin-dreml +CFLAGS-s_remquo.c += -fno-builtin-remquol +CFLAGS-s_rint.c += -fno-builtin-rintl +CFLAGS-s_round.c += -fno-builtin-roundl +CFLAGS-s_roundeven.c += -fno-builtin-roundevenl +CFLAGS-w_scalb.c += -fno-builtin-scalbl +CFLAGS-w_scalbln.c += -fno-builtin-scalblnl +CFLAGS-s_scalbn.c += -fno-builtin-scalbnl +CFLAGS-s_setpayload.c += -fno-builtin-setpayloadl +CFLAGS-s_setpayloadsig.c += -fno-builtin-setpayloadsigl +CFLAGS-s_significand.c += -fno-builtin-significandl +CFLAGS-s_sin.c += -fno-builtin-sinl +CFLAGS-s_sincos.c += -fno-builtin-sincosl +CFLAGS-w_sinh.c += -fno-builtin-sinhl +CFLAGS-w_sqrt.c += -fno-builtin-sqrtl +CFLAGS-s_tan.c += -fno-builtin-tanl +CFLAGS-s_tanh.c += -fno-builtin-tanhl +CFLAGS-w_tgamma.c += -fno-builtin-tgammal +CFLAGS-s_totalorder.c += -fno-builtin-totalorderl +CFLAGS-s_totalordermag.c += -fno-builtin-totalordermagl +CFLAGS-s_trunc.c += -fno-builtin-truncl +CFLAGS-s_ufromfp.c += -fno-builtin-ufromfpl +CFLAGS-s_ufromfpx.c += -fno-builtin-ufromfpxl +CFLAGS-s_y0.c += -fno-builtin-y0l +CFLAGS-s_y1.c += -fno-builtin-y1l +CFLAGS-s_yn.c += -fno-builtin-ynl endif # These files quiet sNaNs in a way that is optimized away without ================================================ FILE: scriptmodules/admin/crosscomp.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="crosscomp" rp_module_desc="Create am arm cross compiler env - based on examples from http://preshing.com/20141119/how-to-build-a-gcc-cross-compiler" rp_module_help="Can be used via distcc to build RetroPie binaries" rp_module_section="" rp_module_flags="!arm" function _default_dist_crosscomp() { echo "buster" } function depends_crosscomp() { getDepends distcc } function sources_crosscomp() { local dist="$1" [[ -z "$dist" ]] && return declare -A pkgs case "$dist" in stretch) pkgs=( [binutils]=2.28 [gcc]=6.4.0 [glibc]=2.24 [gmp]=6.1.2 [kernel]=4.9.80 [mpfr]=3.1.5 [mpc]=1.0.3 ) ;; buster) pkgs=( [binutils]=2.31.1 [gcc]=8.3.0 [glibc]=2.28 [gmp]=6.1.2 [kernel]=4.19.50 [mpfr]=4.0.2 [mpc]=1.1.0 ) ;; bullseye) pkgs=( [binutils]=2.35.2 [gcc]=10.2.0 [glibc]=2.31 [gmp]=6.2.1 [kernel]=5.15.61 [mpfr]=4.1.0 [mpc]=1.2.0 ) ;; bookworm) pkgs=( [binutils]=2.40 [gcc]=12.2.0 [glibc]=2.36 [gmp]=6.2.1 [kernel]=6.1 [mpfr]=4.2.0 [mpc]=1.3.1 ) ;; *) md_ret_errors+=("Unsupported distribution $dist") return 1 ;; esac downloadAndExtract "https://ftp.gnu.org/gnu/binutils/binutils-${pkgs[binutils]}.tar.gz" binutils --strip-components 1 downloadAndExtract "https://ftp.gnu.org/gnu/mpfr/mpfr-${pkgs[mpfr]}.tar.gz" mpfr --strip-components 1 downloadAndExtract "https://ftp.gnu.org/gnu/gmp/gmp-${pkgs[gmp]}.tar.bz2" gmp --strip-components 1 downloadAndExtract "https://ftp.gnu.org/gnu/mpc/mpc-${pkgs[mpc]}.tar.gz" mpc --strip-components 1 downloadAndExtract "https://ftp.gnu.org/gnu/glibc/glibc-${pkgs[glibc]}.tar.bz2" glibc --strip-components 1 downloadAndExtract "https://ftp.gnu.org/gnu/gcc/gcc-${pkgs[gcc]}/gcc-${pkgs[gcc]}.tar.gz" gcc --strip-components 1 downloadAndExtract "https://www.kernel.org/pub/linux/kernel/v${pkgs[kernel]:0:1}.x/linux-${pkgs[kernel]}.tar.gz" linux --strip-components 1 local pkg for pkg in gmp mpc mpfr; do ln -sf "../$pkg" "gcc/$pkg" done # apply glibc patch required when compiling with GCC 10+ # see https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=49348beafe9ba150c9bd48595b3f372299bddbb0 if [[ "$dist" == "bullseye" ]]; then applyPatch "$md_data/bullseye.diff" fi # fix incorrect limits.h include. if compareVersions "${pkgs[gcc]}" ge 10; then applyPatch "$md_data/asan_limits.diff" fi } function build_crosscomp() { local dist="$1" [[ -z "$dist" ]] && return # remove old build directories rm -rf "$md_build/build-"* local params=(--with-arch=armv6 --with-fpu=vfp --with-float=hard) local target=arm-linux-gnueabihf local dest="$md_inst/$dist" local old_path="$PATH" export PATH="$dest/bin:$old_path" export ASFLAGS="" export CFLAGS="-O2" export CXXFLAGS="-O2" # binutils printHeading "Building binutils" mkdir -p build-binutils cd build-binutils ../binutils/configure --prefix="$dest" --target="$target" "${params[@]}" make make install cd .. # kernel headers printHeading "Installing kernel headers" cd linux make ARCH=arm INSTALL_HDR_PATH="$dest/$target" headers_install cd .. # gcc printHeading "Building gcc" mkdir -p build-gcc cd build-gcc ../gcc/configure --prefix="$dest" --target="$target" --enable-languages=c,c++ --disable-multilib --disable-werror "${params[@]}" make all-gcc make install-gcc cd .. # glibc printHeading "Building glibc" mkdir -p build-glibc cd build-glibc ../glibc/configure --prefix="$dest/$target" --build="$MACHTYPE" --host="$target" --target="$target" --with-headers="$dest/$target/include" libc_cv_forced_unwind=yes make install-bootstrap-headers=yes install-headers make csu/subdir_lib install csu/crt1.o csu/crti.o csu/crtn.o "$dest/$target/lib" "$target-gcc" -nostdlib -nostartfiles -shared -x c /dev/null -o "$dest/$target/lib/libc.so" touch "$dest/$target/include/gnu/stubs.h" cd .. # compiler support library printHeading "Building libgcc" cd build-gcc make all-target-libgcc make install-target-libgcc cd .. # standard c library printHeading "Building glibc (2)" cd build-glibc make make install cd .. # standard c++ library printHeading "Building libcpp" cd build-gcc make all make install cd .. export PATH="$old_path" export ASFLAGS="$__asflags" export CFLAGS="$__cflags" export CXXFLAGS="$__cxxflags" } function setup_crosscomp() { local dist="$1" [[ -z "$dist" ]] && dist="$(_default_dist_crosscomp)" if rp_callModule crosscomp sources "$dist"; then rp_callModule crosscomp build "$dist" rp_callModule crosscomp clean fi } function setup_all_crosscomp() { local dist for dist in stretch buster bullseye; do setup_crosscomp "$dist" done } function configure_distcc_crosscomp() { local dist="$1" [[ -z "$dist" ]] && return 1 local port="$2" [[ -z "$port" ]] && return 1 local bin_dir="$md_inst/$dist/bin" # add additional symlinks for cc/gcc/c++/g++ local name for name in cc gcc; do ln -sfv "arm-linux-gnueabihf-gcc" "$bin_dir/$name" done for name in c++ g++; do ln -sfv "arm-linux-gnueabihf-g++" "$bin_dir/$name" done local initd_script="/etc/init.d/distcc-$dist" # duplicate distcc init.d script cp /etc/init.d/distcc "$initd_script" # add dist to NAME in new init.d sed -i "s/NAME=distccd/NAME=distccd-$dist/" "$initd_script" # add custom port to new init.d sed -i "s/--daemon\"/--daemon --port $port\"/" "$initd_script" # add the $dist cross compiler bin path to new init.d local replace="PATH=$bin_dir:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" # if the PATH line exists, replace it (older distcc init.d script) if grep -q "PATH=" "$initd_script"; then sed -i "s#^PATH=.*#$replace#" "$initd_script" # otherwise, insert it before the DAEMON= line (newer distcc init.d script) else sed -i "/^DAEMON=.*/i $replace" "$initd_script" fi # create log file local log="/var/log/distccd-$dist.log" touch "$log" chown distccd:nogroup "$log" # restart distcc systemctl daemon-reload service distcc restart } ================================================ FILE: scriptmodules/admin/image/dists/rpios-bookworm-64.ini ================================================ name="bookworm-64" version="12" url="https://downloads.raspberrypi.com/raspios_oldstable_lite_arm64/images/raspios_oldstable_lite_arm64-2025-11-24/2025-11-24-raspios-bookworm-arm64-lite.img.xz" format="xz" platforms="rpi3 rpi4 rpi5" file_rpi3="rpi3" title_rpi3="Raspberry Pi 3" file_rpi4="rpi4" title_rpi4="Raspberry Pi 4" file_rpi5="rpi5" title_rpi5="Raspberry Pi 5" ================================================ FILE: scriptmodules/admin/image/dists/rpios-bookworm.ini ================================================ name="bookworm" version="12" url="https://downloads.raspberrypi.com/raspios_oldstable_lite_armhf/images/raspios_oldstable_lite_armhf-2025-11-24/2025-11-24-raspios-bookworm-armhf-lite.img.xz" format="xz" platforms="rpi1 rpi2 rpi3 rpi4 rpi5" file_rpi1="rpi1_zero" title_rpi1="RPI 1/Zero" file_rpi2="rpi2" title_rpi2="RPI 2" file_rpi3="rpi3_zero2w" title_rpi3="RPI 3/Zero 2 W" file_rpi4="rpi4_400" title_rpi4="RPI 4/400" file_rpi5="rpi5" title_rpi5="RPI 5" ================================================ FILE: scriptmodules/admin/image/dists/rpios-bullseye.ini ================================================ name="bullseye" version="11" url="https://downloads.raspberrypi.org/raspios_oldstable_lite_armhf/images/raspios_oldstable_lite_armhf-2025-05-07/2025-05-06-raspios-bullseye-armhf-lite.img.xz" format="xz" platforms="rpi1 rpi2 rpi3 rpi4" file_rpi1="rpi1_zero" title_rpi1="RPI 1/Zero" file_rpi2="rpi2" title_rpi2="RPI 2" file_rpi3="rpi3_zero2w" title_rpi3="RPI 3/Zero 2 W" file_rpi4="rpi4_400" title_rpi4="RPI 4/400" ================================================ FILE: scriptmodules/admin/image/dists/rpios-buster.ini ================================================ name="buster" version="10" url="https://downloads.raspberrypi.org/raspios_oldstable_lite_armhf/images/raspios_oldstable_lite_armhf-2023-05-03/2023-05-03-raspios-buster-armhf-lite.img.xz" format="xz" platforms="rpi1 rpi2 rpi4" file_rpi1="rpi1_zero" title_rpi1="RPI 1/Zero" file_rpi2="rpi2_3_zero2w" title_rpi2="RPI 2/3/Zero 2 W" file_rpi4="rpi4_400" title_rpi4="RPI 4/400" ================================================ FILE: scriptmodules/admin/image/dists/rpios-jessie.ini ================================================ name="jessie" version="8" url="https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-07-05/2017-07-05-raspbian-jessie-lite.zip" format="zip" platforms="rpi1 rpi2" file_rpi1="rpi1_zero" title_rpi1="RPI 1/Zero" file_rpi2="rpi2_3" title_rpi2="RPI 2/3" ================================================ FILE: scriptmodules/admin/image/dists/rpios-stretch.ini ================================================ name="stretch" version="9" url="https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-04-09/2019-04-08-raspbian-stretch-lite.zip" format="zip" platforms="rpi1 rpi2" file_rpi1="rpi1_zero" title_rpi1="RPI 1/Zero" file_rpi2="rpi2_3" title_rpi2="RPI 2/3" ================================================ FILE: scriptmodules/admin/image/template.json ================================================ { "url": "https://github.com/RetroPie/RetroPie-Setup/releases/download/IMG_PATH", "extract_size": IMG_EXTRACT_SIZE, "extract_sha256": "IMG_SHA256", "image_download_size": IMG_DOWNLOAD_SIZE, "description": "Turn your Raspberry Pi into a retro-gaming machine.", "icon": "https://retropie.org.uk/retropie-logo-40x40.png", "name": "RetroPie IMG_VERSION (IMG_PLATFORM)", "release_date": "IMG_DATE", "website": "https://retropie.org.uk" } ================================================ FILE: scriptmodules/admin/image.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="image" rp_module_desc="Create/Manage RetroPie images" rp_module_section="" rp_module_flags="" function depends_image() { local depends=(kpartx unzip binfmt-support rsync parted squashfs-tools dosfstools e2fsprogs xz-utils) isPlatform "x86" && depends+=(qemu-user-binfmt) getDepends "${depends[@]}" # enable C flag in qemu-aarch64/qemu-arm binfmt_misc override to allow suid binaries in emulated chroot if isPlatform "x86"; then local platform for platform in arm aarch64; do local config="qemu-$platform.conf" local src_config="/usr/lib/binfmt.d/$config" local dest_config="/etc/binfmt.d/$config" if [[ ! -f "$dest_config" ]]; then printMsgs "console" "Adding C flag to $src_config (overriding in $dest_config)" sed "s/$/C/" "/usr/lib/binfmt.d/$config" >"/etc/binfmt.d/$config" fi done systemctl restart systemd-binfmt fi } function _get_info_image() { local dist="$1" local key="$2" # don't use $md_data so this function can be used directly from builder.sh local ini="${__mod_info[image/path]%/*}/image/dists/${dist}.ini" # if the file is found try and extract the value else echo an empty string if [[ -f "$ini" ]]; then iniConfig "=" "\"" "$ini" iniGet "$key" echo "$ini_value" else echo "" fi } function create_chroot_image() { local dist="$1" [[ -z "$dist" ]] && return 1 local chroot="$2" [[ -z "$chroot" ]] && chroot="$md_build/$dist" mkdir -p "$md_build" pushd "$md_build" mkdir -p "$chroot" local url=$(_get_info_image "$dist" "url") [[ -z "$url" ]] && fatalError "Unable to get url information for $dist" local format=$(_get_info_image "$dist" "format") [[ -z "$format" ]] && fatalError "Unable to get format information for $dist" local base="raspbian-${dist}-lite" local image="${dist}.img" local dest="${image}.${format}" if [[ ! -f "$image" ]]; then case "$format" in zip) download "$url" "$dest" unzip -o "$dest" mv "$(unzip -Z -1 "$dest")" "$image" rm "$dest" ;; xz) download "$url" "$dest" xz -d -v "$dest" ;; esac fi # abort if there is no extracted image present [[ ! -f "$image" ]] && return 1 # mount image local partitions=($(kpartx -s -a -v "$image" | awk '{ print "/dev/mapper/"$3 }')) local part_boot="${partitions[0]}" local part_root="${partitions[1]}" # get temporary directory local tmp="$(mktemp -d -p "$md_build")" # mount root partition mount "$part_root" "$tmp" # get the mount location of the boot partition from etc/fstab local boot_path="$(_get_boot_path_image "$tmp")" # create the boot partition mountpoint and mount mkdir -p "$tmp$boot_path" mount "$part_boot" "$tmp$boot_path" printMsgs "console" "Creating chroot from $image ..." rsync -aAHX --numeric-ids --delete "$tmp/" "$chroot/" # fix up raspberry pi repos for buster image building (see buster_fix_apt_raspbiantools in raspbiantools.sh scriptmodule) if [[ "$dist" == "rpios-buster" ]]; then sed -i "s/raspbian\.raspberrypi\.org/legacy.raspbian.org/" "$chroot/etc/apt/sources.list" fi umount -l "$tmp$boot_path" "$tmp" rm -rf "$tmp" dmsetup remove "${partitions[@]}" kpartx -d "$image" popd return 0 } function _get_boot_path_image() { local chroot="$1" # extract boot partition mount location from fstab awk '$3=="vfat" {print $2}' "$chroot/etc/fstab" } function install_rp_image() { local platform="$1" if [[ -z "$platform" ]]; then printMsgs "console" "Requires a platform (eg rpi3/rpi4)" return 1 fi local dist="$2" if [[ -z "$dist" ]]; then printMsgs "Requires a distribution name (eg rpios-buster/rpios-bullseye)" return 1 fi local chroot="$3" [[ -z "$chroot" ]] && chroot="$md_build/$dist" local dist_version="$(_get_info_image "$dist" "version")" [[ -z "$dist_version" ]] && fatalError "Unable to get version information for $dist" # hostname to retropie echo "retropie" >"$chroot/etc/hostname" sed -i "s/raspberrypi/retropie/" "$chroot/etc/hosts" local boot_path="$(_get_boot_path_image "$chroot")" # quieter boot / disable plymouth (as without the splash parameter it # causes all boot messages to be displayed and interferes with people # using tty3 to make the boot even quieter) if ! grep -q consoleblank "$chroot$boot_path/cmdline.txt"; then # extra quiet as the raspbian usr/lib/raspi-config/init_resize.sh does # sed -i 's/ quiet init=.*$//' /boot/cmdline.txt so this will remove the last quiet # and the init line but leave ours intact sed -i "s/quiet/quiet loglevel=3 consoleblank=0 plymouth.enable=0 quiet/" "$chroot/boot/cmdline.txt" fi iniConfig "=" "" "$chroot$boot_path/config.txt" # set default GPU mem (videocore only) if [[ "$dist_version" -lt 11 && "$platform" == rpi[123] ]]; then iniSet "gpu_mem_256" 128 iniSet "gpu_mem_512" 256 iniSet "gpu_mem_1024" 256 fi # set overscan_scale so ES scales to overscan settings. iniSet "overscan_scale" 1 # disable 64bit kernel on 32bit userland OSs (to disable rpi4 defaulting to 64bit kernel) # 64 bit distros end in -64 if [[ "$dist" != *-64 ]]; then iniSet "arm_64bit" 0 # otherwise if on 64bit switch to using the 4k page size kernel else iniSet "kernel" "kernel8.img" fi [[ -z "$__chroot_repo" ]] && __chroot_repo="https://github.com/RetroPie/RetroPie-Setup.git" [[ -z "$__chroot_branch" ]] && __chroot_branch="master" # fix up initramfs-tools installation in a chroot (can't find root partition, workaround is to use MODULES=most) local config="$chroot/etc/initramfs-tools/initramfs.conf" if [[ -f "$config" ]]; then sed -i "s/MODULES=dep/MODULES=most/" "$config" fi cat > "$chroot/home/pi/install.sh" <<_EOF_ #!/bin/bash cd if systemctl is-enabled userconfig &>/dev/null; then echo "pi:raspberry" | sudo chpasswd sudo systemctl disable userconfig sudo systemctl --quiet enable getty@tty1 fi sudo apt-get update sudo apt-get -y install git dialog xmlstarlet joystick git clone -b "$__chroot_branch" "$__chroot_repo" cd RetroPie-Setup modules=( 'raspbiantools apt_upgrade' 'setup basic_install' 'bluetooth depends' 'raspbiantools enable_modules' 'autostart enable' 'usbromservice' 'samba depends' 'samba install_shares' 'splashscreen default' 'splashscreen enable' 'bashwelcometweak' 'xpad' ) for module in "\${modules[@]}"; do sudo __platform=$platform __nodialog=1 __has_binaries=$__chroot_has_binaries ./retropie_packages.sh \$module done sudo rm -rf tmp sudo apt-get clean _EOF_ # chroot and run install script rp_callModule image chroot "$chroot" bash /home/pi/install.sh rm "$chroot/home/pi/install.sh" # restore initramfs-tools config to default if [[ -f "$config" ]]; then sed -i "s/MODULES=most/MODULES=dep/" "$config" fi # remove any ssh host keys that may have been generated during any ssh package upgrades rm -f "$chroot/etc/ssh/ssh_host"* } function _init_chroot_image() { local chroot="$1" [[ -z "$chroot" ]] && return 1 # unmount on ctrl+c trap "_trap_chroot_image '$chroot'" INT # mount special filesystems to chroot mkdir -p "$chroot"{/dev/pts,/proc,/sys} mount none -t devpts "$chroot/dev/pts" mount -t proc /proc "$chroot/proc" mount -t sysfs /sys "$chroot/sys" local nameserver="$__nameserver" [[ -z "$nameserver" ]] && nameserver="$(nmcli device show | grep IP4.DNS | awk '{print $NF; exit}')" # so we can resolve inside the chroot echo "nameserver $nameserver" >"$chroot/etc/resolv.conf" # move /etc/ld.so.preload out of the way to avoid warnings if [[ -f "$chroot/etc/ld.so.preload" ]]; then mv "$chroot/etc/ld.so.preload" "$chroot/etc/ld.so.preload.bak" fi } function _deinit_chroot_image() { local chroot="$1" [[ -z "$chroot" ]] && return 1 trap "" INT >"$chroot/etc/resolv.conf" # restore /etc/ld.so.preload if backup present if [[ -f "$chroot/etc/ld.so.preload.bak" ]]; then mv "$chroot/etc/ld.so.preload.bak" "$chroot/etc/ld.so.preload" fi umount -l "$chroot/proc" "$chroot/dev/pts" "$chroot/sys" trap INT } function _trap_chroot_image() { _deinit_chroot_image "$1" exit } function chroot_image() { local chroot="$1" [[ -z "$chroot" ]] && return 1 shift printMsgs "console" "Chrooting to $chroot ..." _init_chroot_image "$chroot" HOME="/home/pi" chroot --userspec 1000:1000 "$chroot" "$@" _deinit_chroot_image "$chroot" } function create_image() { local image="$1" [[ -z "$image" ]] && return 1 local chroot="$2" [[ -z "$chroot" ]] && chroot="$md_build/chroot" local boot_size_mib="$3" # if not specified default the boot size partition to 512MiB [[ -z "$boot_size_mib" ]] && boot_size_mib=512 # get size of files in MiB local chroot_size_mib=$(du -s -m "$chroot" 2>/dev/null | cut -f1) # make image size 256MiB larger than contents of chroot and boot partition local image_size_mib=$((boot_size_mib + chroot_size_mib + 256)) # create image printMsgs "console" "Creating image $image ..." dd if=/dev/zero of="$image" bs=1M count="$image_size_mib" # partition printMsgs "console" "partitioning $image ..." local boot_start_mib=8 local boot_end_mib=$((boot_start_mib + boot_size_mib)) parted -s "$image" -- \ mklabel msdos \ unit mib \ mkpart primary fat32 $boot_start_mib $boot_end_mib \ mkpart primary $boot_end_mib -1s # format printMsgs "console" "Formatting $image ..." # change to the image folder as kpartx has problems removing the # device mapper files when using a full path to the image local image_path="${image%/*}" local image_name="${image##*/}" pushd "$image_path" local partitions=($(kpartx -s -a -v "$image_name" | awk '{ print "/dev/mapper/"$3 }')) local part_boot="${partitions[0]}" local part_root="${partitions[1]}" mkfs.vfat -F 32 -n bootfs "$part_boot" # use the mke2fs config from the chroot so we create the filesystem with supported features # disable huge_file & 64bit as with the Raspberry Pi OS images MKE2FS_CONFIG="$chroot/etc/mke2fs.conf" mkfs.ext4 -O ^huge_file,^64bit -L retropie "$part_root" parted "$image_name" print # disable ctrl+c trap "" INT # mount printMsgs "console" "Mounting $image_name ..." # get temporary directory local tmp="$(mktemp -d -p "$md_build")" # mount root partition mount "$part_root" "$tmp" # get the mount location of the boot partition from etc/fstab local boot_path="$(_get_boot_path_image "$chroot")" # create the boot partition mountpoint and mount mkdir -p "$tmp$boot_path" mount "$part_boot" "$tmp$boot_path" # copy files printMsgs "console" "Rsyncing chroot to $image_name ..." rsync -aAHX --numeric-ids "$chroot/" "$tmp/" # we need to fix up the UUIDS for /boot/cmdline.txt and /etc/fstab local old_id="$(sed "s/.*PARTUUID=\([^-]*\).*/\1/" $tmp$boot_path/cmdline.txt)" local new_id="$(blkid -s PARTUUID -o value "$part_root" | cut -c -8)" sed -i "s/$old_id/$new_id/" "$tmp$boot_path/cmdline.txt" sed -i "s/$old_id/$new_id/g" "$tmp/etc/fstab" # unmount umount -l "$tmp$boot_path" "$tmp" rm -rf "$tmp" kpartx -d "$image_name" trap INT } # generate berryboot squashfs from filesystem function create_bb_image() { local image="$1" [[ -z "$image" ]] && return 1 local chroot="$2" [[ -z "$chroot" ]] && return 1 # replace fstab echo "proc /proc proc defaults 0 0" >"$chroot/etc/fstab" # remove any earlier image rm -f "$image" mksquashfs "$chroot" "$image" -comp lzo -e boot -e lib/modules } function all_image() { local dist="$1" local make_bb="$2" local platforms="$(_get_info_image "$dist" "platforms")" [[ -z "$platforms" ]] && fatalError "Unable to get platforms information for $dist" local platform printMsgs "heading" "Building $platforms images based on $dist ..." for platform in $platforms; do platform_image "$platform" "$dist" "$make_bb" done combine_json_image } function platform_image() { local platform="$1" local dist="$2" local make_bb="$3" [[ -z "$platform" ]] && return 1 local dest="$__tmpdir/images" mkdir -p "$dest" printMsgs "heading" "Building $platform image based on $dist ..." rp_callModule image create_chroot "$dist" rp_callModule image install_rp "$platform" "$dist" "$md_build/$dist" local dist_name="$(_get_info_image "$dist" "name")" [[ -z "$dist_name" ]] && fatalError "Unable to get name information for $dist" local dist_version="$(_get_info_image "$dist" "version")" [[ -z "$dist_version" ]] && fatalError "Unable to get version information for $dist" local file_add="$(_get_info_image "$dist" "file_${platform}")" [[ -z "$file_add" ]] && fatalError "Unable to get file_* information for $dist" local image_title="$(_get_info_image "$dist" "title_${platform}")" [[ -z "$image_title" ]] && fatalError "Unable to get image_title information for $dist" local image_base="retropie-${dist_name}-${__version}-${file_add}" local image_name="${image_base}.img" local image_file="$dest/$image_name" local boot_size_mib=512 # use a 256MiB boot partition for Raspberry Pi OS lower than 12 (Bullseye and below) if [[ "$dist_version" -lt 12 ]]; then boot_size_mib=256 fi rp_callModule image create "$image_file" "$md_build/$dist" $boot_size_mib [[ "$make_bb" -eq 1 ]] && rp_callModule image create_bb "$dest/${image_base}-berryboot.img256" printMsgs "console" "Compressing ${image_name} ..." xz -v --compress --stdout "$image_file" > "${image_file}.xz" printMsgs "console" "Generating JSON data for rpi-imager ..." local template template="$(<"$md_data/template.json")" template="${template/IMG_PATH/$__version\/${image_name}.xz}" template="${template/IMG_EXTRACT_SIZE/$(stat -c %s $image_file)}" template="${template/IMG_SHA256/$(sha256sum $image_file | cut -d" " -f1)}" template="${template/IMG_DOWNLOAD_SIZE/$(stat -c %s ${image_file}.xz)}" template="${template/IMG_VERSION/$__version}" template="${template/IMG_PLATFORM/$image_title}" template="${template/IMG_DATE/$(date '+%Y-%m-%d')}" echo "$template" >"${image_file}.json" rm -f "$image_file" } function combine_json_image() { local dest="$__tmpdir/images" { local template echo -en "{\n \"os_list\": [\n" local i=0 while read file; do [[ "$i" -gt 0 ]] && echo -en ",\n" template="$(<$file)" echo -n "$template" ((i++)) done < <(find "$dest" -name "*.img.json" | sort) echo -en "\n ]\n}\n" } >"$dest/os_list_imagingutility.json" } ================================================ FILE: scriptmodules/admin/joy2key/joy2key.py ================================================ #!/usr/bin/python3 # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # import os, sys, struct, time, fcntl, termios, signal import curses, errno, re from pyudev import Context # struct js_event { # __u32 time; /* event timestamp in milliseconds */ # __s16 value; /* value */ # __u8 type; /* event type */ # __u8 number; /* axis/button number */ # }; JS_MIN = -32768 JS_MAX = 32768 JS_REP = 0.20 JS_THRESH = 0.75 JS_EVENT_BUTTON = 0x01 JS_EVENT_AXIS = 0x02 JS_EVENT_INIT = 0x80 CONFIG_DIR = '/opt/retropie/configs/' RETROARCH_CFG = CONFIG_DIR + 'all/retroarch.cfg' def ini_get(key, cfg_file): pattern = r'[ |\t]*' + key + r'[ |\t]*=[ |\t]*' value_m = r'"*([^"\|\r]*)"*' value = '' with open(cfg_file, 'r') as ini_file: for line in ini_file: if re.match(pattern, line): value = re.sub(pattern + value_m + '.*\n', r'\1', line) break return value def get_btn_num(btn, cfg): num = ini_get('input_' + btn + '_btn', cfg) if num: return num num = ini_get('input_player1_' + btn + '_btn', cfg) if num: return num return '' def sysdev_get(key, sysdev_path): value = '' for line in open(sysdev_path + key, 'r'): value = line.rstrip('\n') break return value def get_button_codes(dev_path): js_cfg_dir = CONFIG_DIR + 'all/retroarch-joypads/' js_cfg = '' dev_name = '' dev_button_codes = list(default_button_codes) for device in Context().list_devices(DEVNAME=dev_path): sysdev_path = os.path.normpath('/sys' + device.get('DEVPATH')) + '/' if not os.path.isfile(sysdev_path + 'name'): sysdev_path = os.path.normpath(sysdev_path + '/../') + '/' # getting joystick name dev_name = sysdev_get('name', sysdev_path) # getting joystick vendor ID dev_vendor_id = int(sysdev_get('id/vendor', sysdev_path), 16) # getting joystick product ID dev_product_id = int(sysdev_get('id/product', sysdev_path), 16) if not dev_name: return dev_button_codes # getting retroarch config file for joystick for f in os.listdir(js_cfg_dir): if f.endswith('.cfg'): input_device = ini_get('input_device', js_cfg_dir + f) input_vendor_id = ini_get('input_vendor_id', js_cfg_dir + f) input_product_id = ini_get('input_product_id', js_cfg_dir + f) if (input_device == dev_name and (input_vendor_id == '' or int(input_vendor_id) == dev_vendor_id) and (input_product_id == '' or int(input_product_id) == dev_product_id)): js_cfg = js_cfg_dir + f break if not js_cfg: js_cfg = RETROARCH_CFG # getting configs for dpad, buttons A, B, X and Y btn_map = [ 'left', 'right', 'up', 'down', 'a', 'b', 'x', 'y' ] btn_num = {} biggest_num = 0 i = 0 for btn in list(btn_map): if i >= len(dev_button_codes): break try: btn_num[btn] = int(get_btn_num(btn, js_cfg)) except ValueError: btn_map.pop(i) dev_button_codes.pop(i) btn_num.pop(btn, None) continue if btn_num[btn] > biggest_num: biggest_num = btn_num[btn] i += 1 # building the button codes list btn_codes = [''] * (biggest_num + 1) i = 0 for btn in btn_map: if i >= len(dev_button_codes): break btn_codes[btn_num[btn]] = dev_button_codes[i] i += 1 try: # if button A is and menu_swap_ok_cancel_buttons is true, swap buttons A and B functions if (ini_get('menu_swap_ok_cancel_buttons', RETROARCH_CFG) == 'true' and 'a' in btn_num and 'b' in btn_num and btn_codes[btn_num['a']] == '\n'): btn_codes[btn_num['a']] = btn_codes[btn_num['b']] btn_codes[btn_num['b']] = '\n' except (IOError, ValueError): pass return btn_codes def signal_handler(signum, frame): signal.signal(signal.SIGINT, signal.SIG_IGN) signal.signal(signal.SIGTERM, signal.SIG_IGN) if (js_fds): close_fds(js_fds) if (tty_fd): os.close(tty_fd) sys.exit(0) def get_hex_chars(key_str): if (key_str.startswith("0x")): out = bytes.fromhex(key_str[2:]) else: out = curses.tigetstr(key_str) return out.decode('utf-8') def get_devices(): devs = [] if sys.argv[1] == '/dev/input/jsX': for dev in os.listdir('/dev/input'): if dev.startswith('js'): devs.append('/dev/input/' + dev) else: devs.append(sys.argv[1]) return devs def open_devices(): devs = get_devices() fds = [] for dev in devs: try: fds.append(os.open(dev, os.O_RDONLY | os.O_NONBLOCK )) js_button_codes[fds[-1]] = get_button_codes(dev) except (OSError, ValueError): pass return devs, fds def close_fds(fds): for fd in fds: os.close(fd) def read_event(fd): while True: try: event = os.read(fd, event_size) except OSError as e: if e.errno == errno.EWOULDBLOCK: return None return False else: return event def process_event(event): (js_time, js_value, js_type, js_number) = struct.unpack(event_format, event) # ignore init events if js_type & JS_EVENT_INIT: return False hex_chars = "" if js_type == JS_EVENT_BUTTON: if js_number < len(button_codes) and js_value == 1: hex_chars = button_codes[js_number] if js_type == JS_EVENT_AXIS and js_number <= 7: if js_number % 2 == 0: if js_value <= JS_MIN * JS_THRESH: hex_chars = axis_codes[0] if js_value >= JS_MAX * JS_THRESH: hex_chars = axis_codes[1] if js_number % 2 == 1: if js_value <= JS_MIN * JS_THRESH: hex_chars = axis_codes[2] if js_value >= JS_MAX * JS_THRESH: hex_chars = axis_codes[3] if hex_chars: for c in hex_chars: fcntl.ioctl(tty_fd, termios.TIOCSTI, c) return True return False js_fds = [] tty_fd = [] signal.signal(signal.SIGINT, signal_handler) signal.signal(signal.SIGTERM, signal_handler) # daemonize when signal handlers are registered if os.fork(): os._exit(0) js_button_codes = {} button_codes = [] default_button_codes = [] axis_codes = [] curses.setupterm() i = 0 for arg in sys.argv[2:]: chars = get_hex_chars(arg) if i < 4: axis_codes.append(chars) default_button_codes.append(chars) i += 1 event_format = 'IhBB' event_size = struct.calcsize(event_format) try: tty_fd = os.open('/dev/tty', os.O_WRONLY) except IOError: print('Unable to open /dev/tty', file = sys.stderr) sys.exit(1) rescan_time = time.time() while True: do_sleep = True if not js_fds: js_devs, js_fds = open_devices() if js_fds: i = 0 current = time.time() js_last = [None] * len(js_fds) for js in js_fds: js_last[i] = current i += 1 else: time.sleep(1) else: i = 0 for fd in js_fds: event = read_event(fd) if event: do_sleep = False if time.time() - js_last[i] > JS_REP: if fd in js_button_codes: button_codes = js_button_codes[fd] else: button_codes = default_button_codes if process_event(event): js_last[i] = time.time() elif event == False: close_fds(js_fds) js_fds = [] break i += 1 if time.time() - rescan_time > 2: rescan_time = time.time() if js_devs != get_devices(): close_fds(js_fds) js_fds = [] if do_sleep: time.sleep(0.01) ================================================ FILE: scriptmodules/admin/joy2key/joy2key_sdl.py ================================================ #!/usr/bin/env python3 """ This file is part of The RetroPie Project The RetroPie Project is the legal property of its developers, whose names are too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. See the LICENSE.md file at the top-level directory of this distribution and https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md. Command line joystick to keyboard translator, using SDL2 for event handling Example usage:

RetroPie package licences

This page shows an up-to-date list of all RetroPie packages and the licences they use.

This page is provided merely for informational purposes and should not be taken as a legal advice. Always check the licences of the individual softwares and the local laws if you have legal question.

Copyright © 2019 The RetroPie Project

================================================ FILE: scriptmodules/admin/stats/pkgflags/app.css ================================================ body { font-family: sans-serif; line-height: 1.25; } .center { display: flex; flex-flow: column; align-items: center; } h1, p { max-width: 600px; text-align: center; } #packages table { width: 100%; max-width: 1280px; border-collapse: collapse; } #packages td { padding: .25rem; } #packages tr td.id { font-family: monospace; min-width: 15%; } #packages td.flag.first { border-left: 1px solid rgba(0,0,0,30%); } #packages tr td.flag { color: rgba(0,0,0,50%); } #packages tr td.flag.pass { background-color: #dfd; } #packages tr td.flag.fail { background-color: #fbb; } #packages table .flag { text-align: center; } #packages thead { vertical-align: bottom; border-bottom: 1px solid rgba(0,0,0,30%); } #packages thead .flag { writing-mode: vertical-rl; width: 2rem; line-height: 2rem; } #packages tr:hover { background-color: #eee; } #packages tr:hover td.flag.pass { background-color: #cfc; } #packages tr:hover td.flag.fail { background-color: #f99; } #packages section { position: relative; margin: 2em 0; } #packages section h2 { position: absolute; top: 0; } #devices { display: flex; justify-content: center; width: 100%; max-width: 1000px; } #devices ul { list-style-type: none; padding: 0; width: 100%; display: flex; flex-flow: column; } #devices li { display: flex; margin: .25em 0; } #devices li span { width: 11em; } #devices li span:first-child { text-align: right; } #devices li progress { flex-grow: 1; margin: 0 .5em; height: auto; /* for webkit */ } #commit { font-size: 90%; margin-top: 0; } #commit code { font-size: 110%; } footer { font-size: 85%; width: 100%; max-width: 900px; text-align: center; margin-top: 2em; border-top: 1px solid #ccc; padding: 1.5em 0; } ================================================ FILE: scriptmodules/admin/stats/pkgflags/app.js ================================================ async function fetch_packages() { const resp = await fetch('../packages.csv'); const data = await resp.text(); return data .split('\n') .map(line => line.split(';')) .filter(fields => fields.length >= 5) .map(fields => ({ section: fields[0], id: fields[1], desc: fields[2], // fields[3] is the licence flags: fields[4].split(' '), })); } async function fetch_commit_info() { const resp = await fetch('../commit.csv'); const data = await resp.text(); const fields = data.split(';'); return { sha: fields[0] || '', when: fields[1] || '', branch: fields[2] || '', }; } function create_device_bars(packages) { const devices = [{ name: 'Raspberry Pi 0/1', flags: ['videocore', 'arm', 'armv6'], hover: 'VideoCore + ARMv6', }, { name: 'Raspberry Pi 2', flags: ['videocore', 'arm', 'armv7'], hover: 'VideoCore + ARMv7', },{ name: 'Raspberry Pi 3', flags: ['videocore', 'arm', 'armv8'], hover: 'VideoCore + ARMv8', }, { name: 'Raspberry Pi 4', flags: ['kms', 'arm', 'armv8'], hover: 'DRM/KMS + ARMv8', }, { name: 'Odroid C1/XU3/XU4', flags: ['mali', 'arm', 'armv7'], hover: 'Mali + ARMv7', }, { name: 'Odroid C2', flags: ['mali', 'aarch64'], hover: 'Mali + AArch64', }, { name: 'Desktop Linux', flags: ['x11', 'x86'], hover: 'X11 + x86', }, ]; const ui_holder = document.createElement('ul'); devices .map(device => { const label = document.createElement('span'); label.innerText = device.name; const bar = document.createElement('progress'); bar.max = packages.length; bar.value = packages .filter(pkg => device.flags.every(flag => !pkg.flags.includes('!' + flag))) .length; bar.title = `${device.hover}\n${bar.value} / ${bar.max}`; const percent = document.createElement('span'); percent.innerText = Math.round(100 * bar.value / bar.max) + '%'; const row = document.createElement('li'); row.appendChild(label); row.appendChild(bar); row.appendChild(percent); return row; }) .forEach(row => ui_holder.appendChild(row)); document.getElementById('devices').appendChild(ui_holder); } function create_commit_info(commit) { const date = commit.when.slice(0, 10); const time = commit.when.slice(11, 16); const text = `Last update: ${date} ${time}, ${commit.branch} branch at ${commit.sha}`; document.getElementById('commit').innerHTML = text; } function package_enabled_for(pkg, flag) { const video_flag_synonyms = { 'videocore' : [ 'arm', 'rpi', 'rpi1', 'rpi2', 'rpi3', 'dispmanx', 'gles' ], 'mali' : [ 'arm' , 'gles' ], 'kms' : [ 'arm' , 'rpi', 'rpi4', 'dispmanx', 'mesa' , 'gles3' ], 'x11' : [ 'x86' , '64bit', 'mesa' ] }; var equivs = (video_flag_synonyms[flag] ? [flag].concat(video_flag_synonyms[flag]) : [flag]); if ( pkg.flags.includes('!all') ) { return _flags_include(pkg.flags, equivs) && !_flags_exclude(pkg.flags, equivs); } else { return !_flags_exclude(pkg.flags, equivs); } } function _flags_include(pkg_flags, flags) { return flags.reduce( (acc, flag) => acc || pkg_flags.includes(flag), false); } function _flags_exclude(pkg_flags, flags) { return flags.reduce( (acc, flag) => acc || pkg_flags.includes('!' + flag), false); } function append_pkg_text_cell(parent, klass, text) { const cell = document.createElement('td'); cell.innerText = text; if (Array.isArray(klass)) klass.forEach(k => cell.classList.add(k)); else cell.classList.add(klass); parent.appendChild(cell); } function append_pkg_flag_cell(parent, klass, is_pass) { const cell = document.createElement('td'); cell.innerText = is_pass ? '\u2713' : '\u2717'; cell.classList.add('flag', klass, is_pass ? 'pass' : 'fail'); parent.appendChild(cell); } function create_section_thead() { const thead = document.createElement('thead'); append_pkg_text_cell(thead, 'id', 'Package'); append_pkg_text_cell(thead, 'desc', 'Description'); append_pkg_text_cell(thead, ['flag', 'video'], 'VideoCore'); append_pkg_text_cell(thead, ['flag', 'video'], 'Mali'); append_pkg_text_cell(thead, ['flag', 'video'], 'DRM/KMS'); append_pkg_text_cell(thead, ['flag', 'video'], 'X11'); append_pkg_text_cell(thead, ['flag', 'cpu'], 'ARMv6'); append_pkg_text_cell(thead, ['flag', 'cpu'], 'ARMv7'); append_pkg_text_cell(thead, ['flag', 'cpu'], 'ARMv8 (32 bit)'); append_pkg_text_cell(thead, ['flag', 'cpu'], 'AArch64'); append_pkg_text_cell(thead, ['flag', 'cpu'], 'x86'); thead.querySelector('.flag.video').classList.add('first'); thead.querySelector('.flag.cpu').classList.add('first'); return thead; } function create_section_row(pkg) { const row = document.createElement('tr'); row.title='Script flags: ' + pkg.flags.join(' '); append_pkg_text_cell(row, 'id', pkg.id); append_pkg_text_cell(row, 'desc', pkg.desc); append_pkg_flag_cell(row, 'video', package_enabled_for(pkg, 'videocore')); append_pkg_flag_cell(row, 'video', package_enabled_for(pkg, 'mali')); append_pkg_flag_cell(row, 'video', package_enabled_for(pkg, 'kms')); append_pkg_flag_cell(row, 'video', package_enabled_for(pkg, 'x11')); append_pkg_flag_cell(row, 'cpu', !pkg.flags.includes('!arm') && !pkg.flags.includes('!armv6')); append_pkg_flag_cell(row, 'cpu', !pkg.flags.includes('!arm') && !pkg.flags.includes('!armv7')); append_pkg_flag_cell(row, 'cpu', !pkg.flags.includes('!arm') && !pkg.flags.includes('!armv8')); append_pkg_flag_cell(row, 'cpu', !pkg.flags.includes('!aarch64')); append_pkg_flag_cell(row, 'cpu', !pkg.flags.includes('!x86')); row.querySelector('.flag.video').classList.add('first'); row.querySelector('.flag.cpu').classList.add('first'); return row; } function create_package_sections(packages) { const section_ids = [ 'core', 'main', 'opt', 'exp', 'driver', 'config', '', ]; const section_names = { opt: 'optional', exp: 'experimental', config: 'configuration', '': 'other', }; const sections = []; section_ids.forEach(id => sections[id] = []); packages.forEach(pkg => { const section = sections[pkg.section] || sections['']; section.push(pkg); }); const fragment = new DocumentFragment(); section_ids .filter(id => sections[id]) .forEach(id => { const ui_container = document.createElement('section'); const ui_title = document.createElement('h2'); ui_title.innerText = section_names[id] || id; ui_container.appendChild(ui_title); const ui_table = document.createElement('table'); ui_table.appendChild(create_section_thead()); sections[id] .sort((a, b) => a.id.localeCompare(b.id)) .map(pkg => create_section_row(pkg)) .forEach(row => ui_table.appendChild(row)); ui_container.appendChild(ui_table); fragment.appendChild(ui_container); }); document.getElementById('packages').appendChild(fragment); document.querySelector('table .flag.video').classList.add('first'); document.querySelector('table .flag.cpu').classList.add('first'); } window.onload = async () => { const packages = await fetch_packages(); const commit = await fetch_commit_info(); create_device_bars(packages); create_commit_info(commit); create_package_sections(packages); }; ================================================ FILE: scriptmodules/admin/stats/pkgflags/index.html ================================================ RetroPie package flags

RetroPie platform support

This page shows an up-to-date list of all RetroPie packages and the platforms (devices and flags) they support.

Copyright © 2019 The RetroPie Project
================================================ FILE: scriptmodules/admin/stats.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="stats" rp_module_desc="Generates statistics about packages" rp_module_section="" function _get_commit_data_stats() { local hash=$(git -C "$scriptdir" log -1 --format=%h) local date=$(git -C "$scriptdir" log -1 --format=%cd --date=iso-strict) local branch=$(git -C "$scriptdir" rev-parse --abbrev-ref HEAD) echo "$hash;$date;$branch;" } function _get_package_data_stats() { local data=() local id for id in ${__mod_id[@]}; do data+=("${__mod_info[$id/section]};$id;${__mod_info[$id/desc]};${__mod_info[$id/licence]};${__mod_info[$id/flags]};") done printf "%s\n" "${data[@]}" } function build_stats() { local dest="$__tmpdir/stats" mkUserDir "$dest" # ignore platform flags to get info for all packages __ignore_flags=1 rp_registerAllModules echo "$(_get_package_data_stats)" > "$dest/packages.csv" echo "$(_get_commit_data_stats)" > "$dest/commit.csv" cp -rv "$md_data/licences" "$dest/" cp -rv "$md_data/pkgflags" "$dest/" chown -R "$__user":"$__group" "$dest" } function upload_stats() { adminRsync "$__tmpdir/stats/" "stats/" --delete } ================================================ FILE: scriptmodules/admin/tools.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="tools" rp_module_desc="Various RetroPie development/administration tools" rp_module_section="" function check_repos_tools() { local ids if [[ -n "$1" ]]; then ids=("$@") else ids=("${__mod_id[@]}") fi local id local ret=0 for id in "${ids[@]}"; do eval "$(rp_moduleVars $id)" local out [[ -z "$md_repo_type" ]] && continue md_repo_branch="$(rp_resolveRepoParam "$md_repo_branch")" md_repo_commit="$(rp_resolveRepoParam "$md_repo_commit")" printMsgs "console" "Checking $id repository ($md_repo_url / $md_repo_branch) ..." case "$md_repo_type" in git|svn) out=$(rp_getRemoteRepoHash "$md_repo_type" "$md_repo_url" "$md_repo_branch" "$md_repo_commit") if [[ "$?" -ne 0 || -z "$out" ]]; then printMsgs "console" "$id repository failed - $md_repo_url $md_repo_branch" ret=1 fi ;; file) if ! rp_getFileDate "$md_repo_url" >/dev/null; then printMsgs "console" "$id file archive failed - $md_repo_url" ret=1 fi ;; :*) # handle checking via module function - function should return 1 if there was an error local function="${md_repo_type:1}" if fnExists "$function" ; then ! "$function" check && ret=1 fi ;; esac done return "$ret" } function check_licences_tools() { local ids if [[ -n "$1" ]]; then ids=("$@") else ids=("${__mod_id[@]}") fi local id local ret=0 local licence local url for id in "${ids[@]}"; do eval "$(rp_moduleVars $id)" licence=($md_licence) url="${licence[1]}" if [[ -n "$url" ]]; then printMsgs "console" "Checking $id ($md_licence) ..." if ! download "$url" - &>/dev/null; then printMsgs "console" "... $id licence URL failed ($url)" ret=1 fi fi done return "$ret" } ================================================ FILE: scriptmodules/admin/wikidocs.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="wikidocs" rp_module_desc="Generate mkdocs documentation from wiki" rp_module_section="" function depends_wikidocs() { getDepends python3 python3-pip libyaml-dev python3-setuptools python3-wheel python3-virtualenv } function sources_wikidocs() { gitPullOrClone "$md_build" https://github.com/RetroPie/RetroPie-Docs.git } function build_wikidocs() { python3 -m venv "$md_inst" source "$md_inst/bin/activate" pip3 install --upgrade mkdocs-material mdx_truly_sane_lists git+https://github.com/cmitu/mkdocs-altlink-plugin mkdocs build deactivate } function install_wikidocs() { rsync -a --delete "$md_build/site/" "$__tmpdir/wikidocs/" chown -R "$__user":"$__group" "$__tmpdir/wikidocs" } function upload_wikidocs() { adminRsync "$__tmpdir/wikidocs/" "docs/" --delete } ================================================ FILE: scriptmodules/archivefuncs.sh ================================================ #!/bin/bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # ## @file archivefuncs.sh ## @brief RetroPie archivefuncs library ## @copyright GPLv3 readonly arch_dir="/tmp/retropie-archive" ## @fn archiveExtract() ## @param src_file Full path to archive file to extract ## @param disk_exts Space separated list of supported disk extensions (e.g. ".d64 .t64") ## @brief Extracts an archive to a temporary directory ## @details After calling this the variable arch_dir will contain the directory that was used ## for extraction. Also the variable arch_files will contain an array of filenames that are ## considered as game disks according to parameter disk_exts. function archiveExtract() { local src_file="$1" local disk_exts="$2" # clean temp directory if needed archiveCleanup mkdir "$arch_dir" local ext="${src_file##*.}" case "${ext,,}" in zip) unzip "$src_file" -d "$arch_dir" ;; *) echo "Unsupported archive: $src_file" return 1 ;; esac # build a regex portion from the passed extensions local regex="${disk_exts// /\\|}" IFS=$'\n' read -d '' -r -a arch_files < <(find "$arch_dir" -iregex ".*.\(${regex}\)$" | sort) if [[ ${#arch_files[@]} -eq 0 ]]; then return 2 fi } ## @fn archiveCleanup() ## @brief Purges archive temp directory from previous calls to archiveExtract function archiveCleanup() { [[ -d "$arch_dir" ]] && rm -rf "$arch_dir" } ================================================ FILE: scriptmodules/emulators/advmame/01_rpi_framebuffer.diff ================================================ --- a/advance/linux/vfb.c +++ b/advance/linux/vfb.c @@ -268,7 +268,7 @@ var->height = 0; var->width = 0; var->accel_flags = FB_ACCEL_NONE; - var->pixclock = (unsigned)(1000000000000LL / pixelclock); + var->pixclock = pixelclock; var->left_margin = ht - hre; var->right_margin = hrs - hde; var->upper_margin = vt - vre; @@ -587,9 +587,8 @@ goto err_close; } - fb_state.flags = VIDEO_DRIVER_FLAGS_MODE_PALETTE8 | VIDEO_DRIVER_FLAGS_MODE_BGR15 | VIDEO_DRIVER_FLAGS_MODE_BGR16 | VIDEO_DRIVER_FLAGS_MODE_BGR24 | VIDEO_DRIVER_FLAGS_MODE_BGR32 - | VIDEO_DRIVER_FLAGS_PROGRAMMABLE_ALL - | VIDEO_DRIVER_FLAGS_OUTPUT_FULLSCREEN; + fb_state.flags = VIDEO_DRIVER_FLAGS_MODE_PALETTE8 | VIDEO_DRIVER_FLAGS_MODE_BGR16 | VIDEO_DRIVER_FLAGS_MODE_BGR24 | VIDEO_DRIVER_FLAGS_MODE_BGR32 + | VIDEO_DRIVER_FLAGS_OUTPUT_WINDOW; if (fb_detect() != 0) { goto err_close; @@ -1120,14 +1119,10 @@ { assert(fb_is_active()); - if (crtc_is_fake(crtc)) { - error_nolog_set("Not programmable modes are not supported.\n"); + if (!crtc_is_fake(crtc)) { return -1; } - if (video_mode_generate_check("fb", fb_flags(), 8, 2048, crtc, flags)!=0) - return -1; - mode->crtc = *crtc; mode->index = flags & MODE_FLAGS_INDEX_MASK; --- a/advance/osd/frame.c +++ b/advance/osd/frame.c @@ -1298,9 +1299,9 @@ best_vclock = context->state.game_fps; video_init_crtc_make_fake(context, "generate", best_size_x, best_size_y); + video_init_crtc_make_fake(context, "generate-double-y", best_size_x, best_size_2y); + video_init_crtc_make_fake(context, "generate-double-x", best_size_2x, best_size_y); video_init_crtc_make_fake(context, "generate-double", best_size_2x, best_size_2y); - video_init_crtc_make_fake(context, "generate-triple", best_size_3x, best_size_3y); - video_init_crtc_make_fake(context, "generate-quad", best_size_4x, best_size_4y); } else { unsigned long long factor_x; unsigned long long factor_y; --- a/advance/osd/frame.c +++ b/advance/osd/frame.c @@ -2425,6 +2425,7 @@ void advance_video_mode_preinit(struct advance_video_context* context, struct ma } log_std(("emu:video: suggested debugger size %dx%d\n", option->debug_width, option->debug_height)); +#if 0 /* set the vector game size */ if (mame_is_game_vector(option->game)) { unsigned mode_size_x; @@ -2484,6 +2485,7 @@ void advance_video_mode_preinit(struct advance_video_context* context, struct ma option->vector_width = 0; option->vector_height = 0; } +#endif } /** --- a/advance/osd/glue.c +++ b/advance/osd/glue.c @@ -2866,6 +2866,9 @@ adv_error mame_init(struct advance_context* context) conf_float_register_limit_default(context->cfg, "display_gamma", 0.5, 2.0, 1.0); conf_float_register_limit_default(context->cfg, "display_brightness", 0.1, 10.0, 1.0); + conf_int_register_default(context->cfg, "display_width", 640); + conf_int_register_default(context->cfg, "display_height", 480); + conf_bool_register_default(context->cfg, "misc_cheat", 0); conf_string_register_default(context->cfg, "misc_languagefile", "english.lng"); conf_string_register_default(context->cfg, "misc_cheatfile", "cheat.dat"); @@ -2915,6 +2918,8 @@ adv_error mame_config_load(adv_conf* cfg_context, struct mame_option* option) option->gamma = conf_float_get_default(cfg_context, "display_gamma"); option->brightness = conf_float_get_default(cfg_context, "display_brightness"); + option->vector_width = conf_int_get_default(cfg_context, "display_width"); + option->vector_height = conf_int_get_default(cfg_context, "display_height"); option->cheat_flag = conf_bool_get_default(cfg_context, "misc_cheat"); ================================================ FILE: scriptmodules/emulators/advmame/02_fix_extern_globals_0_94.diff ================================================ diff --git a/src/drivers/seibuspi.c b/src/drivers/seibuspi.c index 143dcc2..91187f8 100644 --- a/src/drivers/seibuspi.c +++ b/src/drivers/seibuspi.c @@ -602,7 +602,7 @@ WRITE32_HANDLER( video_dma_length_w ); WRITE32_HANDLER( video_dma_address_w ); WRITE32_HANDLER( sprite_dma_start_w ); -UINT32 *scroll_ram; +extern UINT32 *scroll_ram; extern int old_vidhw; extern int bg_size; data32_t *spimainram; ================================================ FILE: scriptmodules/emulators/advmame/02_fix_extern_globals_1_4.diff ================================================ From f8688cae05799a30cd5337e626a07fa9f004c0a3 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Fri, 23 Oct 2020 21:29:41 +0200 Subject: [PATCH] Fix build errors due new gcc 10 default for -fno-common --- src/drivers/cavepgm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/drivers/cavepgm.c b/src/drivers/cavepgm.c index 38d3dae8..df6e97ab 100644 --- a/src/drivers/cavepgm.c +++ b/src/drivers/cavepgm.c @@ -287,7 +287,7 @@ Notes: #include "timer.h" -UINT16 *pgm_mainram, *pgm_bg_videoram, *pgm_tx_videoram, *pgm_videoregs, *pgm_rowscrollram; +extern UINT16 *pgm_mainram, *pgm_bg_videoram, *pgm_tx_videoram, *pgm_videoregs, *pgm_rowscrollram; static UINT8 *z80_mainram; static UINT32 *arm7_shareram; static UINT32 arm7_latch; @@ -852,8 +852,8 @@ static void expand_32x32x5bpp(void) /* This function expands the sprite colour data (in the A Roms) from 3 pixels in each word to a byte per pixel making it easier to use */ -UINT8 *pgm_sprite_a_region; -size_t pgm_sprite_a_region_allocate; +extern UINT8 *pgm_sprite_a_region; +extern size_t pgm_sprite_a_region_allocate; static void expand_colourdata(void) { -- 2.32.0 ================================================ FILE: scriptmodules/emulators/advmame-0.94.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="advmame-0.94" rp_module_desc="AdvanceMAME v0.94.0" rp_module_help="ROM Extension: .zip\n\nCopy your AdvanceMAME roms to either $romdir/mame-advmame or\n$romdir/arcade" rp_module_licence="GPL2 https://raw.githubusercontent.com/amadvance/advancemame/master/COPYING" rp_module_repo="file $__archive_url/advancemame-0.94.0.tar.gz" rp_module_section="opt" rp_module_flags="!mali !kms" function depends_advmame-0.94() { local depends=(libsdl1.2-dev) getDepends "${depends[@]}" } function sources_advmame-0.94() { downloadAndExtract "$md_repo_url" "$md_build" --strip-components 1 _sources_patch_advmame-1.4 # Fix the global vars missing the 'external' qualifier, needed for gcc > 10 applyPatch "${md_path%/*}/advmame/02_fix_extern_globals_0_94.diff" } function build_advmame-0.94() { ./configure CFLAGS="$CFLAGS -fsigned-char -fno-stack-protector" LDFLAGS="-s -lm -Wl,--no-as-needed" --prefix="$md_inst" make clean make } function install_advmame-0.94() { make install } function configure_advmame-0.94() { # move any old configuration file if [[ -f "$md_conf_root/mame-advmame/advmame-0.94.0.rc" ]]; then mv "$md_conf_root/mame-advmame/advmame-0.94.0.rc" "$md_conf_root/mame-advmame/advmame-0.94.rc" fi # remove old emulators.cfg entries delEmulator advmame-0.94.0 mame-advmame delEmulator advmame-0.94.0 arcade configure_advmame } ================================================ FILE: scriptmodules/emulators/advmame-1.4.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="advmame-1.4" rp_module_desc="AdvanceMAME v1.4" rp_module_help="ROM Extension: .zip\n\nCopy your AdvanceMAME roms to either $romdir/mame-advmame or\n$romdir/arcade" rp_module_licence="GPL2 https://raw.githubusercontent.com/amadvance/advancemame/master/COPYING" rp_module_repo="file $__archive_url/advancemame-1.4.tar.gz" rp_module_section="opt" rp_module_flags="!mali !kms" function depends_advmame-1.4() { local depends=(libsdl1.2-dev) getDepends "${depends[@]}" } function _sources_patch_advmame-1.4() { # update internal names to separate out config files (due to incompatible options) sed -i "s/advmame\.rc/$md_id.rc/" advance/v/v.c advance/cfg/cfg.c if grep -q "ADVANCE_NAME" advance/osd/emu.h; then sed -i "s/ADVANCE_NAME \"advmame\"/ADVANCE_NAME \"$md_id\"/" advance/osd/emu.h else sed -i "s/ADV_NAME \"advmame\"/ADV_NAME \"$md_id\"/" advance/osd/emu.h fi if isPlatform "rpi"; then if grep -q "MAP_FIXED" advance/linux/vfb.c; then sed -i 's/MAP_SHARED | MAP_FIXED,/MAP_SHARED,/' advance/linux/vfb.c fi # patch advmame to use a fake generated mode with the exact dimensions for fb - avoids need for configuring monitor / clocks. # the pi framebuffer doesn't use any of the framebuffer timing configs - it hardware scales from chosen dimensions to actual size applyPatch "${md_path%/*}/advmame/01_rpi_framebuffer.diff" fi } function sources_advmame-1.4() { downloadAndExtract "$md_repo_url" "$md_build" --strip-components 1 _sources_patch_advmame-1.4 1.4 # Fix the global vars missing the 'external' qualifier, needed for gcc > 10 applyPatch "${md_path%/*}/advmame/02_fix_extern_globals_1_4.diff" } function build_advmame-1.4() { ./configure CFLAGS="$CFLAGS -fsigned-char -fno-stack-protector" LDFLAGS="-s -lm -Wl,--no-as-needed" --prefix="$md_inst" make clean make } function install_advmame-1.4() { make install } function configure_advmame-1.4() { configure_advmame } ================================================ FILE: scriptmodules/emulators/advmame.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="advmame" rp_module_desc="AdvanceMAME" rp_module_help="ROM Extension: .zip\n\nCopy your AdvanceMAME roms to either $romdir/mame-advmame or\n$romdir/arcade" rp_module_licence="GPL2 https://raw.githubusercontent.com/amadvance/advancemame/master/COPYING" rp_module_repo="git https://github.com/amadvance/advancemame v3.10" rp_module_section="opt" rp_module_flags="sdl2 sdl1-videocore" function _update_hook_advmame() { # if the non split advmame is installed, make directories for 0.94 / 1.4 so they will be updated # when doing update all packages if [[ -d "$md_inst/0.94.0" ]]; then mkdir -p "$rootdir/emulators/advmame-"{0.94,1.4} printMsgs "dialog" "The advmame package has now been split into the following packages.\n\nadvmame-0.94\nadvmame-1.4\nadvmame\n\nIf you have chosen just to update the RetroPie-Setup script, you will need to update all the advmame packages for them to work correctly.\n\nNote that advmame-0.94.0.rc will be renamed to advmame-0.94.rc and the config for the main advmame will be advmame.rc.\n\nThe advmame package will be the latest version of the software." fi } function depends_advmame() { local depends=(autoconf automake) if isPlatform "videocore"; then depends+=(libsdl1.2-dev libraspberrypi-dev) else depends+=(libsdl2-dev) fi getDepends "${depends[@]}" } function sources_advmame() { gitPullOrClone } function build_advmame() { local params=() if isPlatform "videocore"; then params+=(--enable-sdl --disable-sdl2 --enable-vc) else params+=(--enable-sdl2 --disable-sdl --disable-vc) fi ./autogen.sh ./configure CFLAGS="$CFLAGS -fno-stack-protector" --prefix="$md_inst" "${params[@]}" make clean make md_ret_require="$md_build/advmame" } function install_advmame() { make install } function configure_advmame() { mkRomDir "arcade" mkRomDir "arcade/advmame" mkRomDir "mame-advmame" moveConfigDir "$home/.advance" "$md_conf_root/mame-advmame" # move any old named configs (with 3.2 taking priority) local ver for ver in 3.1 3.2; do if [[ -f "$md_conf_root/mame-advmame/advmame-$ver.rc" ]]; then mv "$md_conf_root/mame-advmame/advmame-$ver.rc" "$md_conf_root/mame-advmame/advmame.rc" fi # remove any old emulator.cfg entries delEmulator advmame-$ver mame-advmame delEmulator advmame-$ver arcade done if [[ "$md_mode" == "install" ]]; then local mame_sub_dir for mame_sub_dir in artwork diff hi inp memcard nvram sample snap sta; do mkRomDir "mame-advmame/$mame_sub_dir" ln -sf "$romdir/mame-advmame/$mame_sub_dir" "$romdir/arcade/advmame" # fix for older broken symlink generation rm -f "$romdir/mame-advmame/$mame_sub_dir/$mame_sub_dir" done fi if [[ "$md_mode" == "install" && ! -f "$md_conf_root/mame-advmame/$md_id.rc" ]]; then su "$__user" -c "$md_inst/bin/advmame --default" iniConfig " " "" "$md_conf_root/mame-advmame/$md_id.rc" iniSet "misc_quiet" "yes" iniSet "dir_rom" "$romdir/mame-advmame:$romdir/arcade" iniSet "dir_artwork" "$romdir/mame-advmame/artwork" iniSet "dir_sample" "$romdir/mame-advmame/samples" iniSet "dir_diff" "$romdir/mame-advmame/diff" iniSet "dir_hi" "$romdir/mame-advmame/hi" iniSet "dir_image" "$romdir/mame-advmame" iniSet "dir_inp" "$romdir/mame-advmame/inp" iniSet "dir_memcard" "$romdir/mame-advmame/memcard" iniSet "dir_nvram" "$romdir/mame-advmame/nvram" iniSet "dir_snap" "$romdir/mame-advmame/snap" iniSet "dir_sta" "$romdir/mame-advmame/nvram" if isPlatform "videocore"; then iniSet "device_video" "fb" iniSet "device_video_cursor" "off" iniSet "device_keyboard" "raw" iniSet "device_sound" "alsa" iniSet "display_vsync" "no" iniSet "sound_normalize" "no" iniSet "display_resizeeffect" "none" iniSet "display_resize" "integer" iniSet "display_magnify" "1" elif isPlatform "kms" || isPlatform "mali"; then iniSet "device_video" "sdl" # need to force keyboard device as auto will choose event driver which doesn't work with sdl iniSet "device_keyboard" "sdl" # default for best performance iniSet "display_magnify" "1" # disable threading to get rid of the crash-on-exit when using SDL, preventing config save iniSet "misc_smp" "no" else iniSet "device_video_output" "overlay" iniSet "display_aspectx" 16 iniSet "display_aspecty" 9 fi if isPlatform "armv6"; then iniSet "sound_samplerate" "22050" iniSet "sound_latency" "0.2" else iniSet "sound_samplerate" "44100" fi fi addEmulator 1 "$md_id" "arcade" "$md_inst/bin/advmame %BASENAME%" addEmulator 1 "$md_id" "mame-advmame" "$md_inst/bin/advmame %BASENAME%" addSystem "arcade" addSystem "mame-advmame" } ================================================ FILE: scriptmodules/emulators/ags.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="ags" rp_module_desc="Adventure Game Studio - Adventure game engine" rp_module_help="ROM Extension: .exe\n\nCopy your Adventure Game Studio roms to $romdir/ags//" rp_module_licence="OTHER https://raw.githubusercontent.com/adventuregamestudio/ags/master/License.txt" rp_module_repo="git https://github.com/adventuregamestudio/ags.git release-3.6.0" rp_module_section="opt" rp_module_flags="!mali" function depends_ags() { getDepends libsdl2-dev cmake pkg-config libaldmb1-dev libfreetype6-dev libtheora-dev libvorbis-dev libogg-dev liballegro4-dev } function sources_ags() { gitPullOrClone } function build_ags() { cmake -DCMAKE_INSTALL_PREFIX="$md_inst" \ -DAGS_USE_LOCAL_ALL_LIBRARIES=ON \ -DAGS_USE_LOCAL_SDL2_SOUND=OFF \ -DCMAKE_BUILD_TYPE=Release make -C Engine clean make -C Engine md_ret_require="$md_build/ags" } function install_ags() { make -C Engine install # install Eawpatches GUS patch set (see: http://liballeg.org/digmid.html) download "http://www.eglebbk.dds.nl/program/download/digmid.dat" - | bzcat >"$md_inst/bin/patches.dat" } function configure_ags() { local launcher="$md_inst/launch_ags.sh" moveConfigDir "$home/.local/share/ags" "$md_conf_root/ags" mkRomDir "ags" if [[ "$md_mode" == "install" ]]; then _create_launcher_ags "$launcher" fi addEmulator 1 "$md_id" "ags" "bash '$launcher' %ROM%" "Adventure Game Studio" ".exe" addSystem "ags" } function _create_launcher_ags() { local launcher="$1" local binary="$md_inst/bin/ags" local params=( "--fullscreen" "--gfxdriver ogl" ) cat > "$launcher" << _EOF_ #! /usr/bin/env bash # ROM usually denotes ".../roms/ags/.exe" whereas the game files are # expected in "/" subfolder. .exe and / are # expected to be sibling in the $romdir/ags folder. ROM=\$1 fn="\${ROM##*/}" subfolder="\${fn%.*}" path="\${ROM%/*}" # only hint the emulator to the subfolder if it exists, because some games # can be run with a single AGS exe and do not require a game subfolder if [[ -d "\$path/\$subfolder/" ]] ; then ROM="\$path/\$subfolder/" fi echo "ROM parameter for AGS engine: \$ROM" >> /dev/shm/runcommand.log $binary "${params[*]}" "\$ROM" _EOF_ chown "$__user":"$__group" "$launcher" chmod u+x "$launcher" } ================================================ FILE: scriptmodules/emulators/amiberry/01_preserve_env.diff ================================================ diff --git a/Makefile b/Makefile index 9747718..dcdfb2f 100644 --- a/Makefile +++ b/Makefile @@ -43,10 +43,10 @@ SDL_CONFIG ?= sdl2-config export SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags) export SDL_LDFLAGS := $(shell $(SDL_CONFIG) --libs) -CPPFLAGS = -MD -MT $@ -MF $(@:%.o=%.d) $(SDL_CFLAGS) -Iexternal/libguisan/include -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Isrc/archivers -Iexternal/floppybridge/src -Iexternal/mt32emu/src -D_FILE_OFFSET_BITS=64 -CFLAGS=-pipe -Wno-shift-overflow -Wno-narrowing -fno-pie +CPPFLAGS += -MD -MT $@ -MF $(@:%.o=%.d) $(SDL_CFLAGS) -Iexternal/libguisan/include -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Isrc/archivers -Iexternal/floppybridge/src -Iexternal/mt32emu/src -D_FILE_OFFSET_BITS=64 +CFLAGS += -pipe -Wno-shift-overflow -Wno-narrowing -fno-pie -LDFLAGS = $(SDL_LDFLAGS) -lSDL2_image -lSDL2_ttf -lserialport -lportmidi -lguisan -Lexternal/libguisan/lib -lmt32emu -Lexternal/mt32emu +LDFLAGS += $(SDL_LDFLAGS) -lSDL2_image -lSDL2_ttf -lserialport -lportmidi -lguisan -Lexternal/libguisan/lib -lmt32emu -Lexternal/mt32emu LDFLAGS += -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lpthread -lz -lpng -lrt -lFLAC -lmpg123 -ldl -lmpeg2convert -lmpeg2 -lstdc++fs -no-pie ifdef USE_OPENGL ================================================ FILE: scriptmodules/emulators/amiberry/02_fix_uae_config_load.diff ================================================ diff --git a/src/osdep/amiberry_whdbooter.cpp b/src/osdep/amiberry_whdbooter.cpp index 8a03e732..939b26b8 100644 --- a/src/osdep/amiberry_whdbooter.cpp +++ b/src/osdep/amiberry_whdbooter.cpp @@ -1180,6 +1180,7 @@ void set_booter_drives(uae_prefs* prefs, const char* filepath) void whdload_auto_prefs(uae_prefs* prefs, const char* filepath) { + bool custom_config_loaded = false; write_log("WHDBooter Launched\n"); if (lstAvailableROMs.empty()) @@ -1207,18 +1208,7 @@ void whdload_auto_prefs(uae_prefs* prefs, const char* filepath) const std::string filename_no_extension = get_game_filename(filepath); whdload_prefs.filename = filename_no_extension; - // LOAD GAME SPECIFICS FOR EXISTING .UAE - USE SHA1 IF AVAILABLE - // CONFIG LOAD IF .UAE IS IN CONFIG PATH - build_uae_config_filename(whdload_prefs.filename); - - // If we have a config file, we use that first - if (std::filesystem::exists(uae_config)) - { - write_log("WHDBooter - %s found. Loading Config for WHDLoad options.\n", uae_config.c_str()); - target_cfgfile_load(prefs, uae_config.c_str(), CONFIG_TYPE_DEFAULT, 0); - } - - // setups for tmp folder. + // setup for tmp folder. std::filesystem::create_directories("/tmp/amiberry/s"); std::filesystem::create_directories("/tmp/amiberry/c"); std::filesystem::create_directories("/tmp/amiberry/devs"); @@ -1234,7 +1224,6 @@ void whdload_auto_prefs(uae_prefs* prefs, const char* filepath) // LOAD GAME SPECIFICS whd_path = whdbooter_path / "game-data"; game_hardware_options game_detail; - whd_config = whd_path / "whdload_db.xml"; if (std::filesystem::exists(whd_config)) @@ -1243,7 +1232,17 @@ void whdload_auto_prefs(uae_prefs* prefs, const char* filepath) } else { - write_log("WHDBooter - Could not load whdload_db.xml - does not exist?\n"); + write_log("WHDBooter - Could not load whdload_db.xml - does not exist?\n"); + } + + // LOAD CUSTOM CONFIG + build_uae_config_filename(whdload_prefs.filename); + // If we have a config file, we will load that on top of the XML settings + if (std::filesystem::exists(uae_config)) + { + write_log("WHDBooter - %s found. Loading Config for WHDLoad options.\n", uae_config.c_str()); + target_cfgfile_load(prefs, uae_config.c_str(), CONFIG_TYPE_DEFAULT, 0); + custom_config_loaded = true; } // If we have a slave, create a startup-sequence @@ -1308,7 +1307,7 @@ void whdload_auto_prefs(uae_prefs* prefs, const char* filepath) #endif // if we already loaded a .uae config, we don't need to do the below manual setup for hardware - if (std::filesystem::exists(uae_config)) + if (custom_config_loaded) { write_log("WHDBooter - %s found; ignoring WHD Quickstart setup.\n", uae_config.c_str()); return; ================================================ FILE: scriptmodules/emulators/amiberry/03_fix_crash_saving.diff ================================================ diff --git a/src/cfgfile.cpp b/src/cfgfile.cpp index f96ee0d9..24bd58cb 100644 --- a/src/cfgfile.cpp +++ b/src/cfgfile.cpp @@ -2243,7 +2243,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) #ifdef AMIBERRY std::string mode; std::string buffer; - didata* did = &di_joystick[jp->id]; + didata* did = &di_joystick[jp->id - JSEM_JOYS]; // custom options SAVING for (int m = 0; m < 2; ++m) ================================================ FILE: scriptmodules/emulators/amiberry.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="amiberry" rp_module_desc="Amiga emulator with JIT support (forked from uae4arm)" rp_module_help="ROM Extension: .adf .chd .ipf .lha .zip\n\nCopy your Amiga games to $romdir/amiga\n\nCopy the required BIOS files\nkick13.rom\nkick20.rom\nkick31.rom\nto $biosdir/amiga" rp_module_licence="GPL3 https://raw.githubusercontent.com/BlitterStudio/amiberry/master/LICENSE" rp_module_repo="git https://github.com/BlitterStudio/amiberry :_get_branch_amiberry" rp_module_section="opt" rp_module_flags="!all arm rpi3 rpi4 rpi5 x86" function _update_hook_amiberry() { local rom mkUserDir "$biosdir/amiga" for rom in kick13.rom kick20.rom kick31.rom; do # if we have a kickstart rom in $biosdir, move it to $biosdir/amiga and symlink the old location if [[ -f "$biosdir/$rom" && ! -h "$biosdir/$rom" ]]; then moveConfigFile "$biosdir/$rom" "$biosdir/amiga/$rom" fi done } function _get_branch_amiberry() { if isPlatform "dispmanx"; then echo "v5.7.1" elif isPlatform "x86"; then echo "preview-v6.3.3" else echo "v5.7.2" fi } function _get_platform_amiberry() { local platform="$__platform-sdl2" if isPlatform "aarch64" && isPlatform "rpi"; then platform="$__platform-64-sdl2" elif isPlatform "dispmanx"; then platform="$__platform" elif isPlatform "odroid-xu"; then platform="xu4" elif isPlatform "odroid-c1"; then platform="c1" elif isPlatform "tinker"; then platform="tinker" elif isPlatform "vero4k"; then platform="vero4k" elif isPlatform "x86"; then platform="x86-64" fi echo "$platform" } function depends_amiberry() { local depends=(cmake autoconf libpng-dev libmpeg2-4-dev zlib1g-dev libmpg123-dev libflac-dev libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libserialport-dev wget libportmidi-dev) isPlatform "dispmanx" && depends+=(libraspberrypi-dev) isPlatform "vero4k" && depends+=(vero3-userland-dev-osmc) getDepends "${depends[@]}" } function sources_amiberry() { gitPullOrClone if ! isPlatform "x86"; then applyPatch "$md_data/01_preserve_env.diff" fi # Dispmanx is locked on v5.7.1, apply some critical fixes on top of it if isPlatform "dispmanx"; then applyPatch "$md_data/02_fix_uae_config_load.diff" applyPatch "$md_data/03_fix_crash_saving.diff" fi # use our default optimisation level sed -i "/CFLAGS += -O3/d" "$md_build/Makefile" } function build_amiberry() { local platform=$(_get_platform_amiberry) make clean cd external/capsimg ./bootstrap ./configure make clean make cp capsimg.so "$md_build/plugins" cd "$md_build" make PLATFORM="$platform" CPUFLAGS="$__cpu_flags" md_ret_require="$md_build/amiberry" } function install_amiberry() { md_ret_files=( 'abr' 'amiberry' 'data' 'plugins' 'kickstarts' ) cp -R "$md_build/whdboot" "$md_inst/whdboot-dist" } function configure_amiberry() { addEmulator 1 "amiberry" "amiga" "$md_inst/amiberry.sh %ROM%" addEmulator 0 "amiberry-a500" "amiga" "$md_inst/amiberry.sh %ROM% --model A500" addEmulator 0 "amiberry-a500plus" "amiga" "$md_inst/amiberry.sh %ROM% --model A500P" addEmulator 0 "amiberry-a1200" "amiga" "$md_inst/amiberry.sh %ROM% --model A1200" addEmulator 0 "amiberry-a4000" "amiga" "$md_inst/amiberry.sh %ROM% --model A4000" addEmulator 0 "amiberry-cdtv" "amiga" "$md_inst/amiberry.sh %ROM% --model CDTV" addEmulator 0 "amiberry-cd32" "amiga" "$md_inst/amiberry.sh %ROM% --model CD32" addSystem "amiga" [[ "$md_mode" == "remove" ]] && return mkRomDir "amiga" mkUserDir "$md_conf_root/amiga" mkUserDir "$md_conf_root/amiga/amiberry" # move config / save folders to $md_conf_root/amiga/amiberry local dir for dir in conf nvram savestates screenshots; do moveConfigDir "$md_inst/$dir" "$md_conf_root/amiga/amiberry/$dir" done # set various media paths to the 'amiga' rom folder iniConfig "=" "" "$md_inst/conf/amiberry.conf" iniSet "rom_path" "$biosdir/amiga" iniSet "floppy_path" "$romdir/amiga" iniSet "harddrive_path" "$romdir/amiga" iniSet "cdrom_path" "$romdir/amiga" iniSet "lha_path" "$romdir/amiga" chown "$__user":"$__group" "$md_inst/conf/amiberry.conf" # check for cd32.nvr and move it to $md_conf_root/amiga/amiberry/nvram if [[ -f "$md_conf_root/amiga/amiberry/cd32.nvr" ]]; then mv "$md_conf_root/amiga/amiberry/cd32.nvr" "$md_conf_root/amiga/amiberry/nvram/" fi moveConfigDir "$md_inst/kickstarts" "$biosdir/amiga" chown -R "$__user":"$__group" "$biosdir/amiga" # symlink the retroarch config / autoconfigs for amiberry to use ln -sf "$configdir/all/retroarch/autoconfig" "$md_inst/controllers" ln -sf "$configdir/all/retroarch.cfg" "$md_inst/conf/retroarch.cfg" local config_dir="$md_conf_root/amiga/amiberry" # create whdboot config area moveConfigDir "$md_inst/whdboot" "$config_dir/whdboot" # copy game-data, save-data folders, boot-data.zip and WHDLoad cp -R "$md_inst/whdboot-dist/"{game-data,save-data,boot-data.zip,WHDLoad} "$config_dir/whdboot/" chown -R "$__user":"$__group" "$config_dir/whdboot" # copy shared uae4arm/amiberry launch script while setting is_amiberry=1 sed "s/is_amiberry=0/is_amiberry=1/" "$md_data/../uae4arm/uae4arm.sh" >"$md_inst/amiberry.sh" chmod a+x "$md_inst/amiberry.sh" local script="+Start Amiberry.sh" cat > "$romdir/amiga/$script" << _EOF_ #!/bin/bash "$md_inst/amiberry.sh" _EOF_ chmod a+x "$romdir/amiga/$script" chown "$__user":"$__group" "$romdir/amiga/$script" } ================================================ FILE: scriptmodules/emulators/atari800/01_rpi_fixes.diff ================================================ diff --git a/configure.ac b/configure.ac index adb899f..bc9d939 100644 --- a/configure.ac +++ b/configure.ac @@ -148,7 +148,7 @@ if [[ "$a8_target" = "ps2" ]]; then fi if [[ "$a8_target" = "rpi" ]]; then [[ -z "$RPI_SDK" ]] && RPI_SDK="/opt/vc" - CC="arm-linux-gnueabihf-gcc" + CC="gcc" CFLAGS="$CFLAGS -I${RPI_SDK}/include -I${RPI_SDK}/include/SDL -I${RPI_SDK}/include/interface/vmcs_host/linux -I${RPI_SDK}/include/interface/vcos/pthreads" LDFLAGS="$LDFLAGS -Wl,--unresolved-symbols=ignore-in-shared-libs -L${RPI_SDK}/lib" fi ================================================ FILE: scriptmodules/emulators/atari800/atari800.sh ================================================ #!/bin/bash emulator="./EMULATOR" rom="$1" shift params=("$@") pushd "${0%/*}" >/dev/null if [[ -z "$rom" ]]; then "$emulator" "${params[@]}" else source "../../lib/archivefuncs.sh" archiveExtract "$rom" ".a52 .atr .bas .bin .car .dcm .xex .xfd" # check successful extraction and if we have at least one file if [[ $? == 0 ]]; then rom="${arch_files[0]}" fi "$emulator" "$rom" "${params[@]}" archiveCleanup fi popd ================================================ FILE: scriptmodules/emulators/atari800.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="atari800" rp_module_desc="Atari 8-bit/800/5200 emulator" rp_module_help="ROM Extensions: .a52 .bas .bin .car .xex .atr .xfd .dcm .atr.gz .xfd.gz\n\nCopy your Atari800 games to $romdir/atari800\n\nCopy your Atari 5200 roms to $romdir/atari5200 You need to copy the Atari 800/5200 BIOS files (5200.ROM, ATARIBAS.ROM, ATARIOSB.ROM and ATARIXL.ROM) to the folder $biosdir and then on first launch configure it to scan that folder for roms (F1 -> Emulator Configuration -> System Rom Settings)" rp_module_licence="GPL2 https://raw.githubusercontent.com/atari800/atari800/master/COPYING" rp_module_repo="git https://github.com/atari800/atari800.git ATARI800_5_2_0" rp_module_section="opt" rp_module_flags="sdl1" function depends_atari800() { local depends=(libsdl1.2-dev autoconf automake zlib1g-dev libpng-dev) isPlatform "dispmanx" && depends+=(libraspberrypi-dev) getDepends "${depends[@]}" } function sources_atari800() { gitPullOrClone if isPlatform "rpi"; then applyPatch "$md_data/01_rpi_fixes.diff" fi } function build_atari800() { local params=() ./autogen.sh isPlatform "dispmanx" && params+=(--target=rpi) ./configure --prefix="$md_inst" ${params[@]} make clean make md_ret_require="$md_build/src/atari800" } function install_atari800() { cd src make install } function _add_emulators_atari800() { local params=() local backend="$(getBackend "$md_id")" case "$backend" in x11*) # use fullscreen on x11 params+=("-fullscreen") # enable hw acceleration by default if supported if isPlatform "gl" || isPlatform "gles"; then params+=("-video-accel") fi ;; default|x11*) # if backend is set to sdl1 default and we are on kms, we need to set fullscreen # and add width/height params to be filled out by runcommand or else it won't fill the screen isPlatform "kms" && params+=("-fullscreen" "-fs-width %XRES%" "-fs-height %YRES%") ;; esac local cmd="$md_inst/atari800.sh %ROM% ${params[*]}" addEmulator 1 "$md_id" "atari800" "$cmd" addEmulator 1 "$md_id-800" "atari800" "$cmd -atari" addEmulator 1 "$md_id-800xl" "atari800" "$cmd -xl" addEmulator 1 "$md_id-130xe" "atari800" "$cmd -xe" addEmulator 1 "$md_id-5200" "atari5200" "$cmd -5200" } function configure_atari800() { mkRomDir "atari800" mkRomDir "atari5200" if [[ "$md_mode" == "install" ]]; then mkUserDir "$md_conf_root/atari800" # move old config if exists to new location if [[ -f "$md_conf_root/atari800.cfg" ]]; then mv "$md_conf_root/atari800.cfg" "$md_conf_root/atari800/atari800.cfg" fi moveConfigFile "$home/.atari800.cfg" "$md_conf_root/atari800/atari800.cfg" # copy launch script (used for unpacking archives) sed "s#EMULATOR#/bin/$md_id#" "$scriptdir/scriptmodules/$md_type/atari800/atari800.sh" >"$md_inst/$md_id.sh" chmod a+x "$md_inst/$md_id.sh" fi local params=() # if we are on fkms, use the sdl1 dispmanx backend by default for good performance without using X11/opengl isPlatform kms && isPlatform "dispmanx" && _backend_set_atari800 "dispmanx" # when no dispmanx is available, but still on KMS, use 'sdl12-compat' and go through SDL2 isPlatform "kms" && ! isPlatform "dispmanx" _&& _backend_set_atari800 "sdl12-compat" # this is split out so we can call it via _backend_set_atari800 _add_emulators_atari800 addSystem "atari800" addSystem "atari5200" } function _backend_set_atari800() { local mode="$1" local force="$2" setBackend "$md_id" "$mode" "$force" setBackend "$md_id-800" "$mode" "$force" setBackend "$md_id-800xl" "$mode" "$force" setBackend "$md_id-130xe" "$mode" "$force" setBackend "$md_id-5200" "$mode" "$force" # call _add_emulators_atari800 again (unless called from configure_atari800) as the emulator.cfg # entries differ depending on backend [[ "${FUNCNAME[1]}" != "configure_atari800" ]] && _add_emulators_atari800 } ================================================ FILE: scriptmodules/emulators/basilisk.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="basilisk" rp_module_desc="Macintosh emulator" rp_module_help="ROM Extensions: .img .rom\n\nCopy your Macintosh roms mac.rom and disk.img to $romdir/macintosh" rp_module_licence="GPL2 https://raw.githubusercontent.com/cebix/macemu/master/BasiliskII/COPYING" rp_module_repo="git https://github.com/cebix/macemu.git master" rp_module_section="opt" rp_module_flags="sdl1 !mali" function depends_basilisk() { local depends=(libsdl1.2-dev autoconf automake oss-compat) isPlatform "x11" && depends+=(libgtk2.0-dev) getDepends "${depends[@]}" } function sources_basilisk() { gitPullOrClone } function build_basilisk() { cd BasiliskII/src/Unix local params=(--enable-sdl-video --enable-sdl-audio --disable-vosf --without-mon --without-esd) ! isPlatform "x86" && params+=(--disable-jit-compiler) ! isPlatform "x11" && params+=(--without-x --without-gtk) isPlatform "aarch64" && params+=(--build=arm) ./autogen.sh --prefix="$md_inst" "${params[@]}" make clean make md_ret_require="$md_build/BasiliskII/src/Unix/BasiliskII" } function install_basilisk() { cd "BasiliskII/src/Unix" make install } function configure_basilisk() { local params=() isPlatform "kms" && params+=("--screen win/%XRES%/%YRES%") mkRomDir "macintosh" touch "$romdir/macintosh/Start.txt" mkUserDir "$md_conf_root/macintosh" addEmulator 1 "$md_id" "macintosh" "$md_inst/bin/BasiliskII --rom $romdir/macintosh/mac.rom --disk $romdir/macintosh/disk.img --extfs $romdir/macintosh --config $md_conf_root/macintosh/basiliskii.cfg ${params[*]}" addSystem "macintosh" } ================================================ FILE: scriptmodules/emulators/capricerpi.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="capricerpi" rp_module_desc="Amstrad CPC emulator - port of Caprice32 for the RPI" rp_module_help="ROM Extensions: .cdt .cpc .dsk\n\nCopy your Amstrad CPC games to $romdir/amstradcpc" rp_module_licence="GPL2 https://raw.githubusercontent.com/KaosOverride/CapriceRPI/master/COPYING.txt" rp_module_repo="git https://github.com/KaosOverride/CapriceRPI.git master" rp_module_section="opt" rp_module_flags="sdl1" function depends_capricerpi() { getDepends libsdl1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev zlib1g-dev libpng-dev } function sources_capricerpi() { gitPullOrClone sed -i "s/-lpng12/-lpng/" src/makefile } function build_capricerpi() { cd src make clean make RELEASE=TRUE md_ret_require="$md_build/src/capriceRPI" } function install_capricerpi() { cp -Rv "$md_build/"{README*.txt,COPYING.txt} "$md_inst/" cp -Rv "$md_build/src/capriceRPI" "$md_inst/" } function configure_capricerpi() { mkRomDir "amstradcpc" addEmulator 0 "$md_id" "amstradcpc" "$md_inst/capriceRPI %ROM%" addSystem "amstradcpc" [[ $mode == "remove" ]] && return # use sdl12-compat backend on KMS ! isPlatform "dispmanx" && isPlatform "kms" && setBackend "$md_id" "sdl12-compat" } ================================================ FILE: scriptmodules/emulators/coolcv.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="coolcv" rp_module_desc="CoolCV Colecovision Emulator" rp_module_help="ROM Extensions: .bin .col .rom .zip\n\nCopy your Colecovision roms to $romdir/coleco" rp_module_licence="PROP" rp_module_repo="file $__archive_url/coolcv.tar.gz" rp_module_section="opt" rp_module_flags="!all videocore" function depends_coolcv() { getDepends libsdl2-dev } function install_bin_coolcv() { downloadAndExtract "$md_repo_url" "$md_inst" --strip-components 1 patchVendorGraphics "$md_inst/coolcv_pi" } function configure_coolcv() { mkRomDir "coleco" moveConfigFile "$home/coolcv_mapping.txt" "$md_conf_root/coleco/coolcv_mapping.txt" addEmulator 1 "$md_id" "coleco" "$md_inst/coolcv_pi %ROM%" addSystem "coleco" } ================================================ FILE: scriptmodules/emulators/daphne/dapinput.ini ================================================ # Daphne cutom keyboard and joystick mapping # # Each input is mapped to 2 keyboard keys and one joystick button. # A joystick's first analog stick is also automatically mapped. # # The first two numbers are SDL keyboard codes (or 0 for "none") # Find keyboard codes here: # http://www.daphne-emu.com/mediawiki/index.php/KeyList # # The third number is the joystick button code (or 0 for "none") # Since 0 is reserved for special meaning, joystick button 0 is identified # as 1 here. Button 1 is identified as 2, and so on. # # Find the button you want to map by running: # jstest /dev/input/js0 [KEYBOARD] KEY_UP = 273 114 5 KEY_DOWN = 274 102 7 KEY_LEFT = 276 100 8 KEY_RIGHT = 275 103 6 KEY_BUTTON1 = 306 97 14 KEY_BUTTON2 = 308 115 15 KEY_BUTTON3 = 32 113 16 KEY_START1 = 49 0 4 KEY_START2 = 50 0 0 KEY_COIN1 = 53 0 1 KEY_COIN2 = 54 0 0 KEY_SKILL1 = 304 119 0 KEY_SKILL2 = 122 105 0 KEY_SKILL3 = 120 107 0 KEY_SERVICE = 57 0 0 KEY_TEST = 283 0 0 KEY_RESET = 284 0 0 KEY_SCREENSHOT = 293 0 0 KEY_QUIT = 27 113 17 END ================================================ FILE: scriptmodules/emulators/daphne.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="daphne" rp_module_desc="Daphne - Laserdisc Emulator" rp_module_help="ROM Extension: .daphne\n\nCopy your Daphne roms to $romdir/daphne" rp_module_licence="GPL2 https://raw.githubusercontent.com/RetroPie/daphne-emu/master/COPYING" rp_module_repo="git https://github.com/RetroPie/daphne-emu.git retropie" rp_module_section="opt" rp_module_flags="sdl1 !x86 !mali" function depends_daphne() { getDepends libsdl1.2-dev libvorbis-dev libglew-dev zlib1g-dev } function sources_daphne() { gitPullOrClone } function build_daphne() { local params=() isPlatform "aarch64" && params=(--build=arm) cd src/vldp2 ./configure "${params[@]}" make -f Makefile.rp cd .. ln -sf Makefile.vars.rp Makefile.vars make STATIC_VLDP=1 md_ret_require="$md_build/daphne.bin" } function install_daphne() { md_ret_files=( 'sound' 'pics' 'daphne.bin' 'COPYING' ) } function configure_daphne() { mkRomDir "daphne" mkRomDir "daphne/roms" addEmulator 1 "$md_id" "daphne" "$md_inst/daphne.sh %ROM%" addSystem "daphne" [[ "$md_mode" == "remove" ]] && return mkUserDir "$md_conf_root/daphne" isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" if [[ ! -f "$md_conf_root/daphne/dapinput.ini" ]]; then cp -v "$md_data/dapinput.ini" "$md_conf_root/daphne/dapinput.ini" fi ln -snf "$romdir/daphne/roms" "$md_inst/roms" ln -sf "$md_conf_root/$md_id/dapinput.ini" "$md_inst/dapinput.ini" cat >"$md_inst/daphne.sh" <<_EOF_ #!/bin/bash dir="\$1" name="\${dir##*/}" name="\${name%.*}" if [[ -f "\$dir/\$name.commands" ]]; then params=\$(<"\$dir/\$name.commands") fi "$md_inst/daphne.bin" "\$name" vldp -nohwaccel -framefile "\$dir/\$name.txt" -homedir "$md_inst" -fullscreen \$params _EOF_ chmod +x "$md_inst/daphne.sh" chown -R "$__user":"$__group" "$md_inst" chown -R "$__user":"$__group" "$md_conf_root/daphne/dapinput.ini" } ================================================ FILE: scriptmodules/emulators/dgen.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="dgen" rp_module_desc="Megadrive/Genesis emulator DGEN" rp_module_help="ROM Extensions: .32x .iso .cue .smd .bin .gen .md .sg .zip\n\nCopy your Megadrive / Genesis roms to $romdir/megadrive\nSega 32X roms to $romdir/sega32x\nand SegaCD roms to $romdir/segacd\nThe Sega CD requires the BIOS files bios_CD_U.bin, bios_CD_E.bin, and bios_CD_J.bin copied to $biosdir" rp_module_licence="GPL2 https://sourceforge.net/p/dgen/dgen/ci/master/tree/COPYING" rp_module_repo="file $__archive_url/dgen-sdl-1.33.tar.gz" rp_module_section="opt" rp_module_flags="sdl1 !mali !kms" function depends_dgen() { getDepends libsdl1.2-dev libarchive-dev } function sources_dgen() { downloadAndExtract "$md_repo_url" "$md_build" --strip-components 1 } function build_dgen() { local params=() isPlatform "rpi" && params+=(--disable-opengl --disable-hqx) # dgen contains obsoleted arm assembler that gcc/as will not like for armv8 cpu targets if isPlatform "armv8"; then CFLAGS="-O2 -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard" ./configure --prefix="$md_inst" else ./configure --prefix="$md_inst" fi make clean make md_ret_require="$md_build/dgen" } function install_dgen() { make install cp "sample.dgenrc" "$md_inst/" md_ret_require="$md_inst/bin/dgen" } function configure_dgen() { local system for system in megadrive segacd sega32x; do mkRomDir "$system" addEmulator 0 "$md_id" "$system" "$md_inst/bin/dgen -r $md_conf_root/megadrive/dgenrc %ROM%" addSystem "$system" done [[ "$md_mode" == "remove" ]] && return mkUserDir "$md_conf_root/megadrive" # move config from previous location if [[ -f "$configdir/all/dgenrc" ]]; then mv -v "$configdir/all/dgenrc" "$md_conf_root/megadrive/dgenrc" fi if [[ ! -f "$md_conf_root/megadrive/dgenrc" ]]; then cp "sample.dgenrc" "$md_conf_root/megadrive/dgenrc" chown "$__user":"$__group" "$md_conf_root/megadrive/dgenrc" fi iniConfig " = " "" "$md_conf_root/megadrive/dgenrc" if isPlatform "rpi"; then iniSet "int_width" "320" iniSet "int_height" "240" iniSet "bool_doublebuffer" "no" iniSet "bool_screen_thread" "yes" iniSet "scaling_startup" "none" # we don't have opengl (or build dgen with it) iniSet "bool_opengl" "no" # lower sample rate iniSet "int_soundrate" "22050" iniSet "emu_z80_startup" "drz80" iniSet "emu_m68k_startup" "cyclone" fi iniSet "joy_pad1_a" "joystick0-button0" iniSet "joy_pad1_b" "joystick0-button1" iniSet "joy_pad1_c" "joystick0-button2" iniSet "joy_pad1_x" "joystick0-button3" iniSet "joy_pad1_y" "joystick0-button4" iniSet "joy_pad1_z" "joystick0-button5" iniSet "joy_pad1_mode" "joystick0-button6" iniSet "joy_pad1_start" "joystick0-button7" iniSet "joy_pad2_a" "joystick1-button0" iniSet "joy_pad2_b" "joystick1-button1" iniSet "joy_pad2_c" "joystick1-button2" iniSet "joy_pad2_x" "joystick1-button3" iniSet "joy_pad2_y" "joystick1-button4" iniSet "joy_pad2_z" "joystick1-button5" iniSet "joy_pad2_mode" "joystick1-button6" iniSet "joy_pad2_start" "joystick1-button7" isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" } ================================================ FILE: scriptmodules/emulators/dolphin.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="dolphin" rp_module_desc="Gamecube/Wii emulator Dolphin" rp_module_help="ROM Extensions: .gcm .iso .wbfs .ciso .gcz .rvz .wad .wbfs\n\nCopy your Gamecube roms to $romdir/gc and Wii roms to $romdir/wii" rp_module_licence="GPL2 https://raw.githubusercontent.com/dolphin-emu/dolphin/master/COPYING" rp_module_repo="git https://github.com/dolphin-emu/dolphin.git master :_get_commit_dolphin" rp_module_section="exp" rp_module_flags="!all 64bit !:\$__gcc_version:-lt:8" function _get_commit_dolphin() { local commit local has_qt6=$(apt-cache -qq madison qt6-base-private-dev | cut -d'|' -f1) # current HEAD of dolphin doesn't build without a C++20 capable compiler .. [[ "$__gcc_version" -lt 10 ]] && commit="f59f1a2a" # .. and without QT6 [[ -z "$has_qt6" ]] && commit="b9a7f577" # support gcc 8.4.0 for Ubuntu 18.04 [[ "$__gcc_version" -lt 9 ]] && commit="1c0ca09e" echo "$commit" } function depends_dolphin() { local depends=(cmake gettext pkg-config libao-dev libasound2-dev libavcodec-dev libavformat-dev libbluetooth-dev libenet-dev liblzo2-dev libminiupnpc-dev libopenal-dev libpulse-dev libreadline-dev libsfml-dev libsoil-dev libsoundtouch-dev libswscale-dev libusb-1.0-0-dev libxext-dev libxi-dev libxrandr-dev portaudio19-dev zlib1g-dev libudev-dev libevdev-dev libmbedtls-dev libcurl4-openssl-dev libegl1-mesa-dev liblzma-dev) # check if qt6 is available, otherwise use qt5 local has_qt6=$(apt-cache -qq madison qt6-base-private-dev | cut -d'|' -f1) if [[ -n "$has_qt6" ]]; then depends+=(qt6-base-private-dev) # Older Ubuntu versions provide libqt6svg6-dev instead of Debian's qt6-svg-dev if [[ -n "$__os_ubuntu_ver" ]] && compareVersions "$__os_ubuntu_ver" lt 23.04; then depends+=(libqt6svg6-dev) else depends+=(qt6-svg-dev) fi else depends+=(qtbase5-private-dev) fi # on KMS use x11 to start the emulator isPlatform "kms" && depends+=(xorg matchbox-window-manager) # if using the latest version, add SDL2 as dependency, since it's mandatory [[ "$(_get_commit_dolphin)" == "" ]] && depends+=(libsdl2-dev) getDepends "${depends[@]}" } function sources_dolphin() { gitPullOrClone } function build_dolphin() { mkdir build cd build # use the bundled 'speexdsp' libs, distro versions before 1.2.1 trigger a 'cmake' error cmake .. -DBUNDLE_SPEEX=ON -DENABLE_AUTOUPDATE=OFF -DENABLE_ANALYTICS=OFF -DUSE_DISCORD_PRESENCE=OFF -DCMAKE_INSTALL_PREFIX="$md_inst" make clean make md_ret_require="$md_build/build/Binaries/dolphin-emu" } function install_dolphin() { cd build make install } function configure_dolphin() { mkRomDir "gc" mkRomDir "wii" local launch_prefix isPlatform "kms" && launch_prefix="XINIT-WM:" addEmulator 0 "$md_id" "gc" "$launch_prefix$md_inst/bin/dolphin-emu-nogui -e %ROM%" addEmulator 1 "$md_id-gui" "gc" "$launch_prefix$md_inst/bin/dolphin-emu -b -e %ROM%" addEmulator 0 "$md_id" "wii" "$launch_prefix$md_inst/bin/dolphin-emu-nogui -e %ROM%" addEmulator 1 "$md_id-gui" "wii" "$launch_prefix$md_inst/bin/dolphin-emu -b -e %ROM%" addSystem "gc" addSystem "wii" [[ "$md_mode" == "remove" ]] && return # Move the other dolphin-emu options, memory card saves etc moveConfigDir "$home/.local/share/dolphin-emu" "$md_conf_root/gc/local" mkUserDir "$md_conf_root/gc/local" moveConfigDir "$home/.config/dolphin-emu" "$md_conf_root/gc/Config" mkUserDir "$md_conf_root/gc/Config" # preset a few options on a first installation if [[ ! -f "$md_conf_root/gc/Config/Dolphin.ini" ]]; then cat >"$md_conf_root/gc/Config/Dolphin.ini" <<_EOF_ [Display] FullscreenDisplayRes = Auto Fullscreen = True RenderToMain = True KeepWindowOnTop = True [Interface] ConfirmStop = False [General] ISOPath0 = "$home/RetroPie/roms/gc" ISOPath1 = "$home/RetroPie/roms/wii" ISOPaths = 2 [Core] AutoDiscChange = True _EOF_ fi # use the GLES(3) render path on platforms where it's available if [[ ! -f "$md_conf_root/gc/Config/GFX.ini" ]] && isPlatform "gles3"; then cat >"$md_conf_root/gc/Config/GFX.ini" <<_EOF2_ [Settings] PreferGLES = True _EOF2_ fi chown -R "$__user":"$__group" "$md_conf_root/gc/Config" } ================================================ FILE: scriptmodules/emulators/dosbox/01-fully-bindable-joystick.diff ================================================ --- a/src/gui/sdl_mapper.cpp 2019-03-10 04:19:35.938770333 +0000 +++ b/src/gui/sdl_mapper.cpp 2019-03-10 04:46:26.474081295 +0000 @@ -69,6 +69,8 @@ #define MAXACTIVE 16 #define MAXBUTTON 32 #define MAXBUTTON_CAP 16 +#define MAXAXIS 8 +#define MAXHAT 2 class CEvent; class CHandlerEvent; @@ -634,8 +636,8 @@ if (_dummy) return; // initialize binding lists and position data - pos_axis_lists=new CBindList[4]; - neg_axis_lists=new CBindList[4]; + pos_axis_lists=new CBindList[MAXAXIS]; + neg_axis_lists=new CBindList[MAXAXIS]; button_lists=new CBindList[MAXBUTTON]; hat_lists=new CBindList[4]; Bitu i; @@ -644,7 +646,7 @@ old_button_state[i]=0; } for(i=0;i<16;i++) old_hat_state[i]=0; - for (i=0; i<4; i++) { + for (i=0; i MAXAXIS) axes = MAXAXIS; + axes_cap=emulated_axes; + if (axes_cap>axes) axes_cap=axes; + hats=SDL_JoystickNumHats(sdl_joystick); + if (hats > MAXHAT) hats = MAXHAT; + hats_cap=emulated_hats; + if (hats_cap>hats) hats_cap=hats; + + buttons=SDL_JoystickNumButtons(sdl_joystick); button_wrap=buttons; button_cap=buttons; if (button_wrapping_enabled) { @@ -671,10 +681,7 @@ if (buttons>MAXBUTTON_CAP) button_cap = MAXBUTTON_CAP; } if (button_wrap > MAXBUTTON) button_wrap = MAXBUTTON; - axes_cap=emulated_axes; - if (axes_cap>axes) axes_cap=axes; - hats_cap=emulated_hats; - if (hats_cap>hats) hats_cap=hats; + LOG_MSG("Using joystick %s with %d axes, %d buttons and %d hat(s)",SDL_JoystickName(stick),axes,buttons,hats); } ~CStickBindGroup() { @@ -707,7 +714,7 @@ if (event->type==SDL_JOYAXISMOTION) { if (event->jaxis.which!=stick) return 0; #if defined (REDUCE_JOYSTICK_POLLING) - if (event->jaxis.axis>=emulated_axes) return 0; + if (event->jaxis.axis>=axes) return 0; #endif if (abs(event->jaxis.value)<25000) return 0; return CreateAxisBind(event->jaxis.axis,event->jaxis.value>0); @@ -799,7 +806,7 @@ } } - for (i=0; i1) { @@ -831,7 +838,7 @@ } } - for (i=0; i=0.57, otherwise install it locally for the build local meson_version="$(meson --version)" if compareVersions "$meson_version" lt 0.57; then downloadAndExtract "https://github.com/mesonbuild/meson/releases/download/0.61.5/meson-0.61.5.tar.gz" meson --strip-components 1 fi } function build_dosbox-staging() { local params=(-Dprefix="$md_inst" -Ddatadir="resources" -Dtry_static_libs="iir,mt32emu") # use the build local Meson installation if found local meson_cmd="meson" [[ -f "$md_build/meson/meson.py" ]] && meson_cmd="python3 $md_build/meson/meson.py" # disable speexdsp simd support on armv6 devices isPlatform "armv6" && params+=(-Dspeexdsp:simd=false) $meson_cmd setup "${params[@]}" build $meson_cmd compile -j${__jobs} -C build md_ret_require=( "$md_build/build/dosbox" ) } function install_dosbox-staging() { ninja -C build install } function configure_dosbox-staging() { configure_dosbox [[ "$md_mode" == "remove" ]] && return local config_dir="$md_conf_root/pc" chown -R "$__user":"$__group" "$config_dir" local staging_output="texturenb" if isPlatform "kms"; then staging_output="openglnb" fi local config_path=$(su "$__user" -c "\"$md_inst/bin/dosbox\" -printconf") if [[ -f "$config_path" ]]; then iniConfig " = " "" "$config_path" if isPlatform "rpi"; then iniSet "fullscreen" "true" iniSet "fullresolution" "original" iniSet "vsync" "true" iniSet "output" "$staging_output" iniSet "core" "dynamic" iniSet "blocksize" "2048" iniSet "prebuffer" "50" fi fi } ================================================ FILE: scriptmodules/emulators/dosbox.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="dosbox" rp_module_desc="DOS emulator" rp_module_help="ROM Extensions: .bat .com .exe .sh .conf\n\nCopy your DOS games to $romdir/pc" rp_module_licence="GPL2 https://sourceforge.net/p/dosbox/code-0/HEAD/tree/dosbox/trunk/COPYING" rp_module_repo="svn https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk - 4252" rp_module_section="opt" rp_module_flags="sdl1 !mali" function depends_dosbox() { local depends=(alsa-utils libasound2-dev libpng-dev automake autoconf zlib1g-dev "$@") [[ "$md_id" == "dosbox" ]] && depends+=(libsdl1.2-dev libsdl-net1.2-dev libsdl-sound1.2-dev) isPlatform "rpi" && depends+=(timidity freepats) getDepends "${depends[@]}" } function sources_dosbox() { local revision="$1" [[ -z "$revision" ]] && revision="4252" svn checkout "$md_repo_url" "$md_build" -r "$revision" applyPatch "$md_data/01-fully-bindable-joystick.diff" } function build_dosbox() { local params=() ! isPlatform "x11" && params+=(--disable-opengl) # add or override params from calling function params+=("$@") ./autogen.sh ./configure --prefix="$md_inst" "${params[@]}" if isPlatform "arm"; then # enable dynamic recompilation for armv4 sed -i 's|/\* #undef C_DYNREC \*/|#define C_DYNREC 1|' config.h if isPlatform "armv6"; then sed -i 's/C_TARGETCPU.*/C_TARGETCPU ARMV4LE/g' config.h else sed -i 's/C_TARGETCPU.*/C_TARGETCPU ARMV7LE/g' config.h sed -i 's|/\* #undef C_UNALIGNED_MEMORY \*/|#define C_UNALIGNED_MEMORY 1|' config.h fi fi make clean make md_ret_require="$md_build/src/dosbox" } function install_dosbox() { make install md_ret_require="$md_inst/bin/dosbox" } function configure_dosbox() { local def=0 local launcher_name="+Start DOSBox.sh" local needs_synth=0 local config_dir="$home/.$md_id" case "$md_id" in dosbox-sdl2) launcher_name="+Start DOSBox-SDL2.sh" ;; dosbox) def=1 # needs software synth for midi; limit to Pi for now isPlatform "rpi" && needs_synth=1 # set dispmanx by default on rpi with fkms isPlatform "dispmanx" && ! isPlatform "videocore" && setBackend "$md_id" "dispmanx" ;; dosbox-staging) launcher_name="+Start DOSBox-Staging.sh" config_dir="$home/.config/dosbox" ;; *) return 1 ;; esac mkRomDir "pc" moveConfigDir "$config_dir" "$md_conf_root/pc" addEmulator "$def" "$md_id" "pc" "bash $romdir/pc/${launcher_name// /\\ } %ROM%" addSystem "pc" rm -f "$romdir/pc/$launcher_name" [[ "$md_mode" == "remove" ]] && return cat > "$romdir/pc/$launcher_name" << _EOF_ #!/bin/bash [[ ! -n "\$(aconnect -o | grep -e TiMidity -e FluidSynth)" ]] && needs_synth="$needs_synth" function midi_synth() { [[ "\$needs_synth" != "1" ]] && return case "\$1" in "start") timidity -Os -iAD & i=0 until [[ -n "\$(aconnect -o | grep TiMidity)" || "\$i" -ge 10 ]]; do sleep 1 ((i++)) done ;; "stop") killall timidity ;; *) ;; esac } params=("\$@") if [[ -z "\${params[0]}" ]]; then params=(-c "@MOUNT C $romdir/pc -freesize 1024" -c "@C:") elif [[ "\${params[0]}" == *.sh ]]; then midi_synth start bash "\${params[@]}" midi_synth stop exit elif [[ "\${params[0]}" == *.conf ]]; then params=(-userconf -conf "\${params[@]}") else params+=(-exit) fi # fullscreen when running in X [[ -n "\$DISPLAY" ]] && params+=(-fullscreen) midi_synth start "$md_inst/bin/dosbox" "\${params[@]}" midi_synth stop _EOF_ chmod +x "$romdir/pc/$launcher_name" chown "$__user":"$__group" "$romdir/pc/$launcher_name" if [[ "$md_id" == "dosbox" || "$md_id" == "dosbox-sdl2" ]]; then local config_path=$(su "$__user" -c "\"$md_inst/bin/dosbox\" -printconf") if [[ -f "$config_path" ]]; then iniConfig " = " "" "$config_path" iniSet "usescancodes" "false" iniSet "core" "dynamic" iniSet "cycles" "max" iniSet "scaler" "none" if isPlatform "rpi" || [[ -n "$(aconnect -o | grep -e TiMidity -e FluidSynth)" ]]; then iniSet "mididevice" "alsa" iniSet "midiconfig" "128:0" fi fi fi } ================================================ FILE: scriptmodules/emulators/drastic.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="drastic" rp_module_desc="NDS emu - DraStic" rp_module_help="ROM Extensions: .nds .zip\n\nCopy your Nintendo DS roms to $romdir/nds" rp_module_licence="PROP" rp_module_section="exp" rp_module_flags="sdl2 !all arm !armv6 !mali" function depends_drastic() { local depends=(libasound2-dev libsdl2-dev zlib1g-dev) if isPlatform "kms" && ! isPlatform "x11"; then depends+=(matchbox-window-manager xorg xserver-xorg-input-all) fi getDepends ${depends[@]} } function __binary_url_drastic() { echo "$__archive_url/drastic-2.5.0.4.tar.gz" } function install_bin_drastic() { downloadAndExtract "$(__binary_url_drastic)" "$md_inst" --strip-components 1 } function configure_drastic() { mkRomDir "nds" addEmulator 1 "$md_id" "nds" "$md_inst/drastic.sh %ROM%" addSystem "nds" [[ "$md_mode" == "remove" ]] && return isPlatform "kms" && ! isPlatform "x11" && setBackend "$md_id" "x11" cat > "$md_inst/drastic.sh" << _EOF_ #!/bin/bash pushd "$md_conf_root/nds/drastic" $md_inst/drastic "\$1" popd _EOF_ chmod +x "$md_inst/drastic.sh" # wrong permissions on game_database.xml chmod 644 "$md_inst/game_database.xml" mkUserDir "$md_conf_root/nds/drastic" mkUserDir "$md_conf_root/nds/drastic/system" local file for file in game_database.xml system/drastic_bios_arm7.bin system/drastic_bios_arm9.bin usrcheat.dat drastic_logo_0.raw drastic_logo_1.raw; do ln -sfv "$md_inst/$file" "$md_conf_root/nds/drastic/$file" done } ================================================ FILE: scriptmodules/emulators/fbzx.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="fbzx" rp_module_desc="ZXSpectrum emulator FBZX" rp_module_help="ROM Extensions: .sna .szx .z80 .tap .tzx .gz .udi .mgt .img .trd .scl .dsk .zip\n\nCopy your ZX Spectrum to $romdir/zxspectrum" rp_module_licence="GPL3 https://raw.githubusercontent.com/rastersoft/fbzx/master/COPYING" rp_module_repo="git https://github.com/rastersoft/fbzx :_get_branch_fbzx" rp_module_section="opt" rp_module_flags="sdl1" function _get_branch_fbzx() { local branch # use older version for non x86 systems (faster) ! isPlatform "x86" && branch="2.11.1" echo "$branch" } function depends_fbzx() { getDepends libasound2-dev libsdl1.2-dev } function sources_fbzx() { gitPullOrClone ! isPlatform "x86" && sed -i 's|PREFIX2=$(PREFIX)/usr|PREFIX2=$(PREFIX)|' Makefile } function build_fbzx() { make clean make if ! isPlatform "x86"; then md_ret_require="$md_build/fbzx" else md_ret_require="$md_build/src/fbzx" fi } function install_fbzx() { if ! isPlatform "x86"; then mkdir "$md_inst/bin" fi make install PREFIX="$md_inst" } function configure_fbzx() { mkRomDir "zxspectrum" addEmulator 0 "$md_id" "zxspectrum" "pushd $md_inst/share; $md_inst/bin/fbzx -fs %ROM%; popd" addSystem "zxspectrum" ! isPlatform "dispmanx" && isPlatform "kms" && setBackend "$md_id" "sdl12-compat" } ================================================ FILE: scriptmodules/emulators/frotz.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="frotz" rp_module_desc="Z-Machine Interpreter for Infocom games" rp_module_help="ROM Extensions: .dat .zip .z1 .z2 .z3 .z4 .z5 .z6 .z7 .z8\n\nCopy your Infocom games to $romdir/zmachine" rp_module_licence="GPL2 https://raw.githubusercontent.com/DavidGriffith/frotz/master/COPYING" rp_module_section="opt" rp_module_flags="" function _update_hook_frotz() { # to show as installed in retropie-setup 4.x hasPackage frotz && mkdir -p "$md_inst" } function install_bin_frotz() { aptInstall frotz } function remove_frotz() { aptRemove frotz } function game_data_frotz() { local dest="$romdir/zmachine" if [[ ! -f "$dest/zork1.dat" ]]; then mkUserDir "$dest" local temp="$(mktemp -d)" local file for file in zork1 zork2 zork3; do downloadAndExtract "$__archive_url/$file.zip" "$temp" -L cp "$temp/data/$file.dat" "$dest" rm -rf "$temp" done rm -rf "$temp" chown -R "$__user":"$__group" "$romdir/zmachine" fi } function configure_frotz() { mkRomDir "zmachine" # CON: to stop runcommand from redirecting stdout to log addEmulator 1 "$md_id" "zmachine" "CON:pushd $romdir/zmachine; frotz %ROM%; popd" addSystem "zmachine" [[ "$md_mode" == "install" ]] && game_data_frotz } ================================================ FILE: scriptmodules/emulators/fs-uae/fs-uae.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rom="$1" rootdir="/opt/retropie" datadir="$HOME/RetroPie" romdir="$datadir/roms/amiga" savedir="$romdir" biosdir="$datadir/BIOS" kickfile="$biosdir/kick13.rom" source "$rootdir/lib/archivefuncs.sh" if [[ ! -f "$kickfile" ]]; then dialog --no-cancel --pause "You need to copy the Amiga kickstart file (kick13.rom) to the folder $biosdir to boot the Amiga emulator." 22 76 15 exit 1 fi archiveExtract "$rom" ".adf .adz .dms .ipf" # check successful extraction and if we have at least one file if [[ $? == 0 ]]; then rom="${arch_files[0]}" romdir="$arch_dir" floppy_images=() for i in "${!arch_files[@]}"; do floppy_images+=("--floppy_image_$i=${arch_files[$i]}") done fi fs-uae --floppy_drive_0="$rom" "${floppy_images[@]}" --kickstart_file="$kickfile" --floppies_dir="$romdir" --save_states_dir="$savedir" archiveCleanup ================================================ FILE: scriptmodules/emulators/fs-uae.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="fs-uae" rp_module_desc="Amiga emulator - FS-UAE integrates the most accurate Amiga emulation code available from WinUAE" rp_module_help="ROM Extension: .adf .adz .dms .ipf .zip\n\nCopy your Amiga games to $romdir/amiga\n\nCopy a required BIOS file (e.g. kick13.rom) to $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/FrodeSolheim/fs-uae/master/COPYING" rp_module_section="exp" rp_module_flags="!all !arm x11" function depends_fs-uae() { local apt_file="/etc/apt/sources.list.d/fsuae-stable.list" local key_file="/etc/apt/trusted.gpg.d/home_FrodeSolheim_stable.gpg" if [[ "$md_mode" == "remove" ]]; then rm -f "$apt_file" # remove old keys gpg --keyring /etc/apt/trusted.gpg --batch --yes --delete-keys "home:FrodeSolheim@build.opensuse.org" &>/dev/null$ rm -f "$key_file" return fi [[ "$md_mode" != "install*" ]] && return # handle installation for Debian or Ubuntu case "$__os_id" in Debian) case "$__os_debian_ver" in 11|12) name="Debian_${__os_debian_ver}" ;; *) md_ret_errors+=("Sorry, fs-uae isn't currently available for Debian $__os_debian_ver") return 1 ;; esac ;; Ubuntu) case "$__os_ubuntu_ver" in 20.04|22.04|24.04|24.10|25.04) name="xUbuntu_${__os_ubuntu_ver}" ;; *) md_ret_errors+=("Sorry, fs-uae isn't currently available for Ubuntu $__os_ubuntu_ver") return 1 ;; esac ;; *) md_ret_errors+=("Sorry, fs-uae isn't currently available for your system") return 1 ;; esac # configure the APT repo and key local repo="http://download.opensuse.org/repositories/home:/FrodeSolheim:/stable/$name" echo "deb $repo/ /" > "$apt_file" download "$repo/Release.key" - | gpg --dearmor | tee "$key_file" >/dev/null } function install_bin_fs-uae() { aptInstall fs-uae fs-uae-launcher fs-uae-arcade } function remove_fs-uae() { aptRemove fs-uae fs-uae-launcher fs-uae-arcade } function configure_fs-uae() { mkRomDir "amiga" addEmulator 1 "$md_id" "amiga" "CON:bash $md_inst/bin/fs-uae.sh %ROM%" addSystem "amiga" [[ "$md_mode" == "remove" ]] && return # copy configuring start script mkdir "$md_inst/bin" cp "$md_data/fs-uae.sh" "$md_inst/bin" chmod +x "$md_inst/bin/fs-uae.sh" mkUserDir "$md_conf_root/amiga" mkUserDir "$home/Documents/FS-UAE" mkUserDir "$home/Documents/FS-UAE/Configurations" moveConfigDir "$home/Documents/FS-UAE/Configurations" "$md_conf_root/amiga/fs-uae" # copy default config file local config="$(mktemp)" iniConfig " = " "" "$config" iniSet "fullscreen" "1" iniSet "keep_aspect" "1" iniSet "zoom" "full" iniSet "fsaa" "0" iniSet "scanlines" "0" iniSet "floppy_drive_speed" "100" copyDefaultConfig "$config" "$md_conf_root/amiga/fs-uae/Default.fs-uae" rm "$config" } ================================================ FILE: scriptmodules/emulators/fuse/01_disable_cursor.diff ================================================ --- a/ui/sdl/sdldisplay.c 2017-07-02 05:36:42.000000000 +0000 +++ b/ui/sdl/sdldisplay.c 2018-08-22 13:55:03.474702732 +0000 @@ -412,7 +412,7 @@ SDL_ShowCursor( SDL_DISABLE ); SDL_WarpMouse( 128, 128 ); } else { - SDL_ShowCursor( SDL_ENABLE ); + SDL_ShowCursor( SDL_DISABLE ); } fuse_emulation_unpause(); ================================================ FILE: scriptmodules/emulators/fuse/02_sdl_fix.diff ================================================ diff --git a/ui/sdl/sdldisplay.c b/ui/sdl/sdldisplay.c index e4d640b..fafe0ac 100644 --- a/ui/sdl/sdldisplay.c +++ b/ui/sdl/sdldisplay.c @@ -249,11 +249,13 @@ uidisplay_init( int width, int height ) return 0; } - for( i=0; modes[i]; ++i ); /* count modes */ - if( settings_current.sdl_fullscreen_mode ) { - if( sscanf( settings_current.sdl_fullscreen_mode, " %dx%d", &mw, &mh ) != 2 ) { - if( sscanf( settings_current.sdl_fullscreen_mode, " %d", &mn ) == 1 && mn <= i ) { - mw = modes[mn - 1]->w; mh = modes[mn - 1]->h; + if ( ! no_modes ) { + for( i=0; modes[i]; ++i ); /* count modes */ + if( settings_current.sdl_fullscreen_mode ) { + if( sscanf( settings_current.sdl_fullscreen_mode, " %dx%d", &mw, &mh ) != 2 ) { + if( sscanf( settings_current.sdl_fullscreen_mode, " %d", &mn ) == 1 && mn <= i ) { + mw = modes[mn - 1]->w; mh = modes[mn - 1]->h; + } } } } ================================================ FILE: scriptmodules/emulators/fuse/03_gcc_10_fix.diff ================================================ --- a/ui/widget/widget.c +++ b/ui/widget/widget.c @@ -91,7 +91,7 @@ static widget_recurse_t widget_return[10]; /* The stack to recurse on */ /* The settings used whilst playing with an options dialog box */ -settings_info widget_options_settings; +extern settings_info widget_options_settings; static int widget_read_font( const char *filename ) { ================================================ FILE: scriptmodules/emulators/fuse.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="fuse" rp_module_desc="ZX Spectrum emulator Fuse" rp_module_help="ROM Extensions: .sna .szx .z80 .tap .tzx .gz .udi .mgt .img .trd .scl .dsk .zip\n\nCopy your ZX Spectrum games to $romdir/zxspectrum" rp_module_licence="GPL2 https://sourceforge.net/p/fuse-emulator/fuse/ci/master/tree/COPYING" rp_module_repo="file $__archive_url/fuse-1.5.7.tar.gz" rp_module_section="opt" rp_module_flags="sdl1 !mali" function depends_fuse() { getDepends libsdl1.2-dev libpng-dev zlib1g-dev libbz2-dev libaudiofile-dev bison flex } function sources_fuse() { downloadAndExtract "$__archive_url/fuse-1.5.7.tar.gz" "$md_build" --strip-components 1 mkdir libspectrum downloadAndExtract "$__archive_url/libspectrum-1.4.4.tar.gz" "$md_build/libspectrum" --strip-components 1 if ! isPlatform "x11"; then applyPatch "$md_data/01_disable_cursor.diff" fi applyPatch "$md_data/02_sdl_fix.diff" applyPatch "$md_data/03_gcc_10_fix.diff" } function build_fuse() { pushd libspectrum ./configure --disable-shared make clean make popd ./configure --prefix="$md_inst" --without-libao --without-gpm --without-gtk --without-libxml2 --with-sdl LIBSPECTRUM_CFLAGS="-I$md_build/libspectrum" LIBSPECTRUM_LIBS="-L$md_build/libspectrum/.libs -lspectrum" make clean make md_ret_require="$md_build/fuse" } function install_fuse() { make install } function configure_fuse() { mkRomDir "zxspectrum" addEmulator 0 "$md_id-48k" "zxspectrum" "$md_inst/bin/fuse --machine 48 --full-screen %ROM%" addEmulator 0 "$md_id-128k" "zxspectrum" "$md_inst/bin/fuse --machine 128 --full-screen %ROM%" addSystem "zxspectrum" [[ "$md_mode" == "remove" ]] && return mkUserDir "$md_conf_root/zxspectrum" moveConfigFile "$home/.fuserc" "$md_conf_root/zxspectrum/.fuserc" # default to dispmanx backend isPlatform "dispmanx" && _backend_set_fuse "dispmanx" # without dispmanx, but with KMS, then use sdl12-compat ! isPlatform "dispmanx" && isPlatform "kms" && _backend_set_fuse "sdl12-compat" local script="$romdir/zxspectrum/+Start Fuse.sh" cat > "$script" << _EOF_ #!/bin/bash $md_inst/bin/fuse --machine 128 --full-screen _EOF_ chown "$__user":"$__group" "$script" chmod +x "$script" } function _backend_set_fuse() { local mode="$1" local force="$2" setBackend "$md_id" "$mode" "$force" setBackend "$md_id-48k" "$mode" "$force" setBackend "$md_id-128k" "$mode" "$force" } ================================================ FILE: scriptmodules/emulators/gngeopi.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="gngeopi" rp_module_desc="NeoGeo emulator GnGeoPi" rp_module_help="ROM Extension: .zip\n\nCopy your GnGeoPi roms to $romdir/neogeo\n\nCopy the required BIOS file neogeo.zip BIOS to $romdir/neogeo" rp_module_licence="NONCOM https://raw.githubusercontent.com/ymartel06/GnGeo-Pi/master/gngeo/COPYING" rp_module_repo="git https://github.com/ymartel06/GnGeo-Pi.git master" rp_module_section="opt" rp_module_flags="!all arm !mali !kms" function depends_gngeopi() { getDepends libsdl1.2-dev } function sources_gngeopi() { gitPullOrClone } function build_gngeopi() { cd gngeo chmod +x configure ./configure --disable-i386asm --prefix="$md_inst" make clean # not safe for building in parallel make -j1 md_ret_require="$md_build/gngeo/src/gngeo" } function install_gngeopi() { cd gngeo make install mkdir -p "$md_inst/neogeobios" } function configure_gngeopi() { mkRomDir "arcade" mkRomDir "neogeo" # move old config to new location moveConfigDir "$home/.gngeo" "$md_conf_root/neogeo" if [[ ! -f "$md_conf_root/neogeo/gngeorc" ]]; then # add default controls for keyboard p1/p2 cat > "$md_conf_root/neogeo/gngeorc" <<\_EOF_ p1control A=K122,B=K120,C=K97,D=K115,START=K49,COIN=K51,UP=K273,DOWN=K274,LEFT=K276,RIGHT=K275,MENU=K27 p2control A=K108,B=K59,C=K111,D=K112,START=K50,COIN=K52,UP=K264,DOWN=K261,LEFT=K260,RIGHT=K262,MENU=K27 _EOF_ chown -R "$__user":"$__group" "$md_conf_root/neogeo/gngeorc" fi addEmulator 0 "$md_id" "arcade" "$md_inst/bin/gngeo -i $romdir/neogeo -B $md_inst/neogeobios %ROM%" addEmulator 0 "$md_id" "neogeo" "$md_inst/bin/gngeo -i $romdir/neogeo -B $md_inst/neogeobios %ROM%" addSystem "arcade" addSystem "neogeo" } ================================================ FILE: scriptmodules/emulators/gpsp.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="gpsp" rp_module_desc="GameBoy Advance emulator" rp_module_help="ROM Extensions: .gba .zip\n\nCopy your Game Boy Advance roms to $romdir/gba\n\nCopy the required BIOS file gba_bios.bin to $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/gizmo98/gpsp/master/COPYING.DOC" rp_module_repo="git https://github.com/gizmo98/gpsp.git master" rp_module_section="opt" rp_module_flags="noinstclean !all videocore" function depends_gpsp() { getDepends libsdl1.2-dev libraspberrypi-dev gcc-6 } function sources_gpsp() { gitPullOrClone } function build_gpsp() { cd raspberrypi rpSwap on 512 make clean make CC="gcc-6" rpSwap off md_ret_require="$md_build/raspberrypi/gpsp" } function install_gpsp() { md_ret_files=( 'COPYING.DOC' 'game_config.txt' 'readme.txt' 'raspberrypi/gpsp' ) } function configure_gpsp() { mkRomDir "gba" chown -R "$__user":"$__group" "$md_inst" mkUserDir "$md_conf_root/gba" # symlink the rom so so it can be installed with the other bios files ln -sf "$biosdir/gba_bios.bin" "$md_inst/gba_bios.bin" # move old config moveConfigFile "gpsp.cfg" "$md_conf_root/gba/gpsp.cfg" addEmulator 0 "$md_id" "gba" "$md_inst/gpsp %ROM%" addSystem "gba" } ================================================ FILE: scriptmodules/emulators/hatari.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="hatari" rp_module_desc="Atari emulator Hatari" rp_module_help="ROM Extensions: .st .stx .img .rom .raw .ipf .ctr .zip\n\nCopy your Atari ST games to $romdir/atarist\n\nCopy Atari ST BIOS (tos.img) to $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/hatari/hatari/master/gpl.txt" rp_module_repo="git https://github.com/hatari/hatari v2.4.1" rp_module_section="opt" rp_module_flags="" function depends_hatari() { getDepends libsdl2-dev zlib1g-dev libpng-dev cmake libreadline-dev portaudio19-dev } function _sources_libcapsimage_hatari() { downloadAndExtract "$__archive_url/spsdeclib_5.1_source.zip" "$md_build" unzip -o capsimg_source_linux_macosx.zip chmod u+x capsimg_source_linux_macosx/CAPSImg/configure } function sources_hatari() { # shallow clone isn't supported via https:// on this repo gitPullOrClone _sources_libcapsimage_hatari } function _build_libcapsimage_hatari() { # build libcapsimage cd capsimg_source_linux_macosx/CAPSImg ./configure --prefix="$md_build" make clean make make install mkdir -p "$md_build/src/includes/caps" cp -R "../LibIPF/"*.h "$md_build/src/includes/caps/" cp "../Core/CommonTypes.h" "$md_build/src/includes/caps/" } function build_hatari() { _build_libcapsimage_hatari # build hatari cd "$md_build" rm -f CMakeCache.txt # add $md_inst to library search path for loading capsimage library LDFLAGS+="-Wl,-rpath='$md_inst'" \ cmake . \ -DCMAKE_SKIP_RPATH=ON \ -DCMAKE_INSTALL_PREFIX:PATH="$md_inst" \ -DCAPSIMAGE_INCLUDE_DIR="$md_build/src/includes" \ -DCAPSIMAGE_LIBRARY="$md_build/lib/libcapsimage.so.5.1" \ -DENABLE_SDL2:BOOL=1 make clean make md_ret_require="$md_build/src/hatari" } function _install_libcapsimage_hatari() { cp "$md_build/lib/libcapsimage.so.5.1" "$md_inst" cd "$md_inst" ln -sf libcapsimage.so.5.1 libcapsimage.so.5 } function install_hatari() { make install _install_libcapsimage_hatari } function configure_hatari() { mkRomDir "atarist" local common_config=("--confirm-quit 0" "--statusbar 0") if ! isPlatform "x11"; then common_config+=("--zoom 1" "-w") else common_config+=("-f") fi addEmulator 1 "$md_id-fast" "atarist" "$md_inst/bin/hatari ${common_config[*]} --compatible 0 --timer-d 1 --borders 0 %ROM%" addEmulator 0 "$md_id-fast-borders" "atarist" "$md_inst/bin/hatari ${common_config[*]} --compatible 0 --timer-d 1 --borders 1 %ROM%" addEmulator 0 "$md_id-compatible" "atarist" "$md_inst/bin/hatari ${common_config[*]} --compatible 1 --timer-d 0 --borders 0 %ROM%" addEmulator 0 "$md_id-compatible-borders" "atarist" "$md_inst/bin/hatari ${common_config[*]} --compatible 1 --timer-d 0 --borders 1 %ROM%" addSystem "atarist" [[ "$md_mode" == "remove" ]] && return # move any old configs to new location moveConfigDir "$home/.hatari" "$md_conf_root/atarist" ln -sf "$biosdir/tos.img" "$md_inst/share/hatari/tos.img" } ================================================ FILE: scriptmodules/emulators/hypseus/hypinput.ini ================================================ # Sample hypinput.ini # All key options listed # Hypseus uses SDL2 Keycodes # # The first two entries are SDL2 keyboard codes or names (0 for "none") # # Find SDL2 keyboard code information here: # https://github.com/DirtBagXon/hypseus-singe/blob/master/doc/keylist.txt # # Hypseus Singe supports configuration on multiple joysticks # First joystick is defined as 0, second joystick as 1 etc. # # IMPORTANT: Find the joystick button and axis by running: # jstest /dev/input/js0 || jstest /dev/input/js1 # # The third number in config is a joystick button code (or 0 for "none") # Since 0 is reserved for special meaning, joystick button 0 is # identified as 1. Button 1 is identified as 2, and so on. # # Defining 001 (or 1) identifies first joystick(0) button 0 # Defining 111 identifies second joystick(1) button 10 # # The fourth number in config (if specified) is the joystick axis # configuration (or 0 for "none"). Since 0 is reserved for # special meaning, joystick axis 0 is identified as 1. # Axis 1 is identified as 2, and so on. # # Only the first four switches are defined (SWITCH_UP->SWITCH_RIGHT) for axis # # Defining -001 (or -1) identifies first joystick(0) axis 0 in negative direction # Defining +102 identifies second joystick(1) axis 1 in positive direction # KEY_BUTTON3 Turns scoreboard on/off in lair/ace # Key1 Key2 Button (Axis) [KEYBOARD] KEY_UP = SDLK_UP SDLK_r 5 -002 KEY_DOWN = SDLK_DOWN SDLK_f 7 +002 KEY_LEFT = SDLK_LEFT SDLK_d 8 -001 KEY_RIGHT = SDLK_RIGHT SDLK_g 6 +001 KEY_COIN1 = SDLK_5 0 1 KEY_COIN2 = SDLK_6 0 0 KEY_START1 = SDLK_1 0 4 KEY_START2 = SDLK_2 0 0 KEY_BUTTON1 = SDLK_LCTRL SDLK_a 14 KEY_BUTTON2 = SDLK_LALT SDLK_s 15 KEY_BUTTON3 = SDLK_SPACE SDLK_d 16 KEY_SKILL1 = SDLK_LSHIFT SDLK_w 0 KEY_SKILL2 = SDLK_z SDLK_i 0 KEY_SKILL3 = SDLK_x SDLK_k 0 KEY_SERVICE = SDLK_9 0 0 KEY_TEST = SDLK_F2 0 0 KEY_RESET = SDLK_0 0 0 KEY_SCREENSHOT = SDLK_F12 0 0 KEY_QUIT = SDLK_ESCAPE SDLK_q 17 KEY_PAUSE = SDLK_p 0 0 KEY_CONSOLE = SDLK_BACKSLASH 0 0 KEY_TILT = SDLK_t 0 0 END ================================================ FILE: scriptmodules/emulators/hypseus/hypinput_gamepad.ini ================================================ # Sample hypinput.ini using SDL_GameController # All key options listed for use with -gamepad # # Hypseus uses SDL2 Keycodes and SDL_GameController # SWITCH = Key1 Key2 Pad0 (Axis Pad0) Pad1 (Axis Pad1) # Available AXIS MACROS # # AXIS_LEFT_UP # AXIS_LEFT_DOWN # AXIS_LEFT_LEFT # AXIS_LEFT_RIGHT # AXIS_RIGHT_UP # AXIS_RIGHT_DOWN # AXIS_RIGHT_LEFT # AXIS_RIGHT_RIGHT # # Available BUTTON MACROS # # BUTTON_A # BUTTON_B # BUTTON_X # BUTTON_Y # BUTTON_BACK # BUTTON_GUIDE # BUTTON_START # BUTTON_LEFTSTICK # BUTTON_RIGHTSTICK # BUTTON_LEFTSHOULDER # BUTTON_RIGHTSHOULDER # BUTTON_DPAD_UP # BUTTON_DPAD_DOWN # BUTTON_DPAD_LEFT # BUTTON_DPAD_RIGHT # AXIS_TRIGGER_LEFT # AXIS_TRIGGER_RIGHT # Key1 Key2 Pad0 Button (Axis Pad0) Pad1 Button (Axis Pad1) [KEYBOARD] KEY_UP = SDLK_UP 0 BUTTON_DPAD_UP AXIS_LEFT_UP 0 0 KEY_DOWN = SDLK_DOWN 0 BUTTON_DPAD_DOWN AXIS_LEFT_DOWN 0 0 KEY_LEFT = SDLK_LEFT 0 BUTTON_DPAD_LEFT AXIS_LEFT_LEFT 0 0 KEY_RIGHT = SDLK_RIGHT 0 BUTTON_DPAD_RIGHT AXIS_LEFT_RIGHT 0 0 KEY_COIN1 = SDLK_5 0 BUTTON_BACK 0 0 KEY_COIN2 = SDLK_6 0 0 0 BUTTON_BACK KEY_START1 = SDLK_1 0 BUTTON_START 0 0 KEY_START2 = SDLK_2 0 0 0 BUTTON_START KEY_BUTTON1 = SDLK_LCTRL 0 BUTTON_A 0 0 KEY_BUTTON2 = SDLK_LALT 0 BUTTON_B 0 0 KEY_BUTTON3 = SDLK_SPACE 0 AXIS_TRIGGER_RIGHT 0 0 KEY_SKILL1 = SDLK_LSHIFT 0 0 0 0 KEY_SKILL2 = SDLK_z 0 0 0 0 KEY_SKILL3 = SDLK_x 0 0 0 0 KEY_SERVICE = SDLK_9 0 0 0 0 KEY_TEST = SDLK_F2 SDLK_F4 0 0 0 KEY_RESET = SDLK_0 0 0 0 0 KEY_SCREENSHOT = SDLK_F12 0 0 0 0 KEY_QUIT = SDLK_ESCAPE 0 0 0 0 KEY_PAUSE = SDLK_p 0 0 0 0 KEY_CONSOLE = SDLK_BACKSLASH 0 0 0 0 KEY_TILT = SDLK_t 0 0 0 0 END ================================================ FILE: scriptmodules/emulators/hypseus.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="hypseus" rp_module_desc="Hypseus Singe - Laserdisc Emulator" rp_module_help="ROM Extension: .daphne\n\nCopy your Daphne roms to $romdir/daphne" rp_module_licence="GPL3 https://raw.githubusercontent.com/DirtBagXon/hypseus-singe/master/LICENSE" rp_module_repo="git https://github.com/DirtBagXon/hypseus-singe.git RetroPie" rp_module_section="opt" rp_module_flags="sdl2" function depends_hypseus() { getDepends libvorbis-dev libogg-dev zlib1g-dev libzip-dev libmpeg2-4-dev libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsdl2-mixer-dev cmake } function sources_hypseus() { gitPullOrClone } function build_hypseus() { rm -rf build mkdir build cd build rpSwap on 1024 cmake ../src make rpSwap off cp hypseus ../hypseus.bin md_ret_require="hypseus" } function install_hypseus() { md_ret_files=( 'sound' 'midi' 'pics' 'fonts' 'hypseus.bin' 'LICENSE' ) } function configure_hypseus() { mkRomDir "daphne" mkRomDir "daphne/roms" addEmulator 0 "$md_id" "daphne" "$md_inst/hypseus.sh %ROM%" addSystem "daphne" "Hypseus" ".zlua" [[ "$md_mode" == "remove" ]] && return mkUserDir "$md_conf_root/daphne" local dir for dir in ram logs screenshots bezels; do mkUserDir "$md_conf_root/daphne/$dir" ln -snf "$md_conf_root/daphne/$dir" "$md_inst/$dir" done copyDefaultConfig "$md_data/hypinput.ini" "$md_conf_root/daphne/hypinput.ini" copyDefaultConfig "$md_data/hypinput_gamepad.ini" "$md_conf_root/daphne/hypinput_gamepad.ini" ln -snf "$romdir/daphne/roms" "$md_inst/roms" ln -snf "$romdir/daphne/roms" "$md_inst/singe" ln -sf "$md_conf_root/daphne/hypinput.ini" "$md_inst/hypinput.ini" ln -sf "$md_conf_root/daphne/hypinput_gamepad.ini" "$md_inst/hypinput_gamepad.ini" local common_args="-framefile \"\$dir/\$name.txt\" -homedir \"$md_inst\" -fullscreen \$params" # prevents SDL doing an internal software conversion since 2.0.16+ isPlatform "arm" && common_args="-texturestream $common_args" cat >"$md_inst/hypseus.sh" <<_EOF_ #!/bin/bash dir="\$1" path=\$(dirname "\$dir") name=\$(basename "\${dir%.*}") ext="\${dir##*.}" if [[ "\$ext" == "zlua" ]]; then parent=\$(awk '{\$1=\$1; print}' < "\$1") dir="\$path/\$parent" parent="\${parent##*/}" params="-usealt \$name" else parent="\$name" fi if [[ -f "\$dir/\$name.commands" ]]; then params="\${params:+\$params }\$(<"\$dir/\$name.commands")" fi if [[ -f "\$dir/\$parent.singe" ]]; then singerom="\$dir/\$parent.singe" elif [[ -f "\$dir/\$parent.zip" ]]; then singerom="\$dir/\$parent.zip" fi if [[ -n "\$singerom" ]]; then "$md_inst/hypseus.bin" singe vldp -retropath -manymouse -script "\$singerom" $common_args else "$md_inst/hypseus.bin" "\$name" vldp $common_args fi _EOF_ chmod +x "$md_inst/hypseus.sh" } ================================================ FILE: scriptmodules/emulators/jzintv/01_rpi_hide_cursor_sdl2.patch ================================================ --- a/gfx/gfx_sdl2.c +++ b/gfx/gfx_sdl2.c @@ -420,7 +420,12 @@ LOCAL int gfx_setup_sdl_display /* Hide the mouse if full screen. */ /* -------------------------------------------------------------------- */ SDL_ShowCursor( +#ifndef PLAT_LINUX_RPI + /* SDL_GetNumVideoDisplays() may return two on rpi3, thus disable */ + /* this clause on rpi. This is not only cosmetic, it fixes the */ + /* UI freeze (not of jzintv itself), if mouse is attached and moved.*/ SDL_GetNumVideoDisplays() == 1 && +#endif (act_wind_flags & SDL_WINDOW_FULLSCREEN) ? SDL_DISABLE : SDL_ENABLE); SDL_PumpEvents(); ================================================ FILE: scriptmodules/emulators/jzintv/01_rpi_pillar_boxing_black_background_sdl2.patch ================================================ --- a/gfx/gfx_sdl2.c +++ b/gfx/gfx_sdl2.c @@ -511,7 +511,7 @@ LOCAL int gfx_flip(const gfx_t *const gfx) /* need to clear the backdrop to our border color before copying the */ /* texture to the display. */ /* -------------------------------------------------------------------- */ - SDL_SetRenderDrawColor(rend, bord_color.r, bord_color.g, bord_color.b, 255); + SDL_SetRenderDrawColor(rend, 0, 0, 0, 255); SDL_RenderClear(rend); if (pvt->vid_enable || gfx->debug_blank) SDL_RenderCopy(rend, text, NULL, ================================================ FILE: scriptmodules/emulators/jzintv/02_Makefile_multiarch_pkg_config.patch ================================================ --- a/Makefile +++ a/Makefile @@ -39,8 +39,8 @@ GNU_READLINE ?= 1 # Get SDL2 related build flags. -SDL2_CFLAGS := $(shell sdl2-config --cflags) -DUSE_SDL2 -SDL2_LFLAGS := $(shell sdl2-config --static-libs || sdl2-config --libs) +SDL2_CFLAGS := $(shell pkg-config --cflags sdl2) -DUSE_SDL2 +SDL2_LFLAGS := $(shell pkg-config --libs --static --keep-system-libs sdl2 || pkg-config --libs sdl2) # Override these in a .mak file. See buidlcfg/00-compiler*.txt for examples. # ================================================ FILE: scriptmodules/emulators/jzintv.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="jzintv" rp_module_desc="Intellivision emulator" rp_module_help="ROM Extensions: .int .bin .rom\n\nCopy your Intellivision roms to $romdir/intellivision\n\nCopy the required BIOS files exec.bin and grom.bin to $biosdir" rp_module_licence="GPL2 http://spatula-city.org/%7Eim14u2c/intv/" rp_module_repo="file $__archive_url/jzintv-20200712-src.zip" rp_module_section="opt" rp_module_flags="sdl2 nodistcc" function depends_jzintv() { getDepends libsdl2-dev libreadline-dev } function sources_jzintv() { rm -rf "$md_build/jzintv" downloadAndExtract "$md_repo_url" "$md_build" # jzintv-YYYYMMDD/ --> jzintv/ mv jzintv-[0-9]* jzintv cd jzintv/src if isPlatform "rpi" ; then applyPatch "$md_data/01_rpi_hide_cursor_sdl2.patch" applyPatch "$md_data/01_rpi_pillar_boxing_black_background_sdl2.patch" fi applyPatch "$md_data/02_Makefile_multiarch_pkg_config.patch" # Add source release date information to build mv buildcfg/90-svn.mak buildcfg/90-svn.mak.txt echo "SVN_REV := $(echo $md_repo_url | grep -o -P '[\d]{8}')" > buildcfg/90-src_releasedate.mak sed -i.zip-dist "s/SVN Revision/Releasedate/" svn_revision.c # aarch64 doesn't include sys/io.h - but it's not needed so we can remove grep -rl "include.*sys/io.h" | xargs sed -i "/include.*sys\/io.h/d" # remove shipped binaries / libraries rm -rf ../bin } function build_jzintv() { mkdir -p jzintv/bin cd jzintv/src local extra if isPlatform "rpi" ; then extra='EXTRA=-DPLAT_LINUX_RPI' fi make clean make $extra md_ret_require="$md_build/jzintv/bin/jzintv" } function install_jzintv() { md_ret_files=( 'jzintv/bin' 'jzintv/doc' 'jzintv/src/COPYING.txt' 'jzintv/src/COPYRIGHT.txt' $(find jzintv/Release*) ) } function configure_jzintv() { mkRomDir "intellivision" local start_script="$md_inst/jzintv_launcher.sh" cat > "$start_script" << _EOF_ #! /usr/bin/env bash # \$1: width of display # \$2: height of display # \$3: --ecs=1, optional # \$4,5,6...: more optional parameters # last parameter: %ROM% jzintv_bin="$md_inst/bin/jzintv" # regular case: w>=h (rotation 90/270 not supported by jzintv) disp_w=\$1; shift disp_h=\$1; shift ratio="4/3" read intv_w intv_h < <(python3 <= \$ratio): # left/right padding intv_w=round(\$disp_h * \$ratio) intv_h=\$disp_h else: # top/bottom padding (letterboxing; e.g., on 5:4 displays) intv_w=\$disp_w intv_h=round(\$disp_w / (\$ratio)) print(intv_w,intv_h) PYSCRIPT ) # set --gfx-verbose instead of --quiet for verbose output options=( -f1 # fullscreen --quiet # --gfx-verbose --displaysize="\${intv_w}x\${intv_h}" --rom-path="$biosdir" --voice=1 ) echo "Launching: \$jzintv_bin \${options[@]} \$@" \$jzintv_bin \${options[@]} "\$@" _EOF_ chown $user:$user "$start_script" chmod u+x "$start_script" addEmulator 1 "$md_id" "intellivision" "'$start_script' %XRES% %YRES% %ROM%" addEmulator 0 "$md_id-ecs" "intellivision" "'$start_script' %XRES% %YRES% --ecs=1 %ROM%" addSystem "intellivision" } ================================================ FILE: scriptmodules/emulators/linapple.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="linapple" rp_module_desc="Apple 2 emulator LinApple" rp_module_help="ROM Extensions: .dsk\n\nCopy your Apple 2 games to $romdir/apple2" rp_module_licence="GPL2 https://raw.githubusercontent.com/dabonetn/linapple-pie/master/LICENSE" rp_module_repo="git https://github.com/dabonetn/linapple-pie.git master" rp_module_section="opt" rp_module_flags="sdl1 !mali" function depends_linapple() { getDepends libzip-dev libsdl1.2-dev libsdl-image1.2-dev libcurl4-openssl-dev } function sources_linapple() { gitPullOrClone } function build_linapple() { cd src make clean make md_ret_require="$md_build/linapple" } function install_linapple() { md_ret_files=( 'CHANGELOG' 'INSTALL' 'LICENSE' 'linapple' 'linapple.conf' 'Master.dsk' 'README' 'README-linapple-pie' ) } function configure_linapple() { mkRomDir "apple2" addEmulator 1 "$md_id" "apple2" "$md_inst/linapple.sh -1 %ROM%" addSystem "apple2" [[ "$md_mode" == "remove" ]] && return # copy default config/disk if user doesn't have them installed local file for file in Master.dsk linapple.conf; do copyDefaultConfig "$file" "$md_conf_root/apple2/$file" done isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" ! isPlatform "dispmanx" && isPlatform "kms" && setBackend "$md_id" "sdl12-compat" mkUserDir "$md_conf_root/apple2" moveConfigDir "$home/.linapple" "$md_conf_root/apple2" local file="$md_inst/linapple.sh" cat >"$file" << _EOF_ #!/bin/bash pushd "$romdir/apple2" $md_inst/linapple "\$@" popd _EOF_ chmod +x "$file" } ================================================ FILE: scriptmodules/emulators/mame/lzma_armv7_crc.diff ================================================ diff --git a/3rdparty/lzma/C/7zCrc.c b/3rdparty/lzma/C/7zCrc.c index f186324d..f39fe1c9 100644 --- a/3rdparty/lzma/C/7zCrc.c +++ b/3rdparty/lzma/C/7zCrc.c @@ -71,7 +71,7 @@ UInt32 MY_FAST_CALL CrcUpdateT1(UInt32 v, const void *data, size_t size, const U #ifdef MY_CPU_LE -#if defined(MY_CPU_ARM_OR_ARM64) +#if defined(MY_CPU_ARM_OR_ARM64) && 0 // #pragma message("ARM*") ================================================ FILE: scriptmodules/emulators/mame.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="mame" rp_module_desc="MAME emulator" rp_module_help="ROM Extensions: .zip .7z\n\nCopy your MAME roms to either $romdir/mame or\n$romdir/arcade" rp_module_licence="GPL2 https://raw.githubusercontent.com/mamedev/mame/master/COPYING" rp_module_repo="git https://github.com/mamedev/mame.git :_get_branch_mame" rp_module_section="exp" rp_module_flags="!mali !armv6 !:\$__gcc_version:-lt:7 nodistcc" function _get_branch_mame() { # starting with 0.265, GCC 10.3 or later is required for full C++17 support if compareVersions "$(gcc -dumpfullversion)" lt 10.3.0; then echo "mame0264" return fi download https://api.github.com/repos/mamedev/mame/releases/latest - | grep -m 1 tag_name | cut -d\" -f4 } function depends_mame() { # Install required libraries required for compilation and running # Note: libxi-dev is required as of v0.210, because of flag changes for XInput local depends=(libfontconfig1-dev libsdl2-ttf-dev libflac-dev libxinerama-dev libxi-dev libpulse-dev) # build the MAME debugger only on X11 (desktop) platforms isPlatform "x11" && depends+=(qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools) getDepends "${depends[@]}" } function sources_mame() { gitPullOrClone # lzma assumes hardware crc support on arm which breaks when building on armv7 isPlatform "armv7" && applyPatch "$md_data/lzma_armv7_crc.diff" } function build_mame() { # More memory is required for 64bit platforms if isPlatform "64bit"; then rpSwap on 10240 else rpSwap on 8192 fi local params=(NOWERROR=1 ARCHOPTS="-U_FORTIFY_SOURCE -Wl,-s" PYTHON_EXECUTABLE=python3 OPTIMIZE=2 USE_SYSTEM_LIB_FLAC=1) isPlatform "x11" && params+=(USE_QTDEBUG=1) || params+=(USE_QTDEBUG=0) # array for storing ARCHOPTS_CXX parameters local arch_opts_cxx=() # when building on ARM enable 'fsigned-char' for compiled code, fixes crashes in a few drivers isPlatform "arm" || isPlatform "aarch64" && arch_opts_cxx+=(-fsigned-char) # workaround g++-12 compiler bug/compilation issue on 32bit arm userland with aarch64 kernel on the rpi3 (cortex-a53) # disabling -ftree-slp-vectorize works around the issue: # {standard input}: Assembler messages: # {standard input}:4045: Error: co-processor offset out of range # make[2]: *** [skeleton.make:2727: obj/Release/src/mame/skeleton/scopus.o] Error 1 if [[ "$__gcc_version" -eq 12 ]] && isPlatform "rpi3" && isPlatform "32bit" && [[ "$(uname -m)" == "aarch64" ]]; then arch_opts_cxx+=(-fno-tree-slp-vectorize) fi # if we have any arch opts set, add them if [[ ${#arch_opts_cxx[@]} -gt 0 ]]; then params+=(ARCHOPTS_CXX="${arch_opts_cxx[*]}") fi # force arm on arm platform - fixes building mame on when using 32bit arm userland with aarch64 kernel isPlatform "arm" && params+=(PLATFORM=arm) # workaround for linker crash on bullseye (use gold linker) if [[ "$__os_debian_ver" -eq 11 ]] && isPlatform "arm"; then LDFLAGS+=" -fuse-ld=gold -Wl,--long-plt" make "${params[@]}" else QT_SELECT=5 make "${params[@]}" fi rpSwap off md_ret_require="$md_build/mame" } function install_mame() { md_ret_files=( 'artwork' 'bgfx' 'ctrlr' 'docs' 'hash' 'hlsl' 'ini' 'language' 'mame' 'plugins' 'roms' 'samples' 'uismall.bdf' 'COPYING' ) } function configure_mame() { local system="mame" if [[ "$md_mode" == "install" ]]; then mkRomDir "arcade" mkRomDir "$system" # Create required MAME directories underneath the ROM directory local mame_sub_dir for mame_sub_dir in artwork cfg comments diff inp nvram samples scores snap sta; do mkRomDir "$system/$mame_sub_dir" done # Create a BIOS directory, where people will be able to store their BIOS files, separate from ROMs mkUserDir "$biosdir/$system" # Create the configuration directory for the MAME ini files moveConfigDir "$home/.mame" "$md_conf_root/$system" # Create new INI files if they do not already exist # Create MAME config file local temp_ini_mame="$(mktemp)" iniConfig " " "" "$temp_ini_mame" iniSet "rompath" "$romdir/$system;$romdir/arcade;$biosdir/$system" iniSet "hashpath" "$md_inst/hash" iniSet "samplepath" "$romdir/$system/samples;$romdir/arcade/samples" iniSet "artpath" "$romdir/$system/artwork;$romdir/arcade/artwork" iniSet "ctrlrpath" "$md_inst/ctrlr" iniSet "pluginspath" "$md_inst/plugins" iniSet "languagepath" "$md_inst/language" iniSet "cfg_directory" "$romdir/$system/cfg" iniSet "nvram_directory" "$romdir/$system/nvram" iniSet "input_directory" "$romdir/$system/inp" iniSet "state_directory" "$romdir/$system/sta" iniSet "snapshot_directory" "$romdir/$system/snap" iniSet "diff_directory" "$romdir/$system/diff" iniSet "comment_directory" "$romdir/$system/comments" iniSet "skip_gameinfo" "1" iniSet "plugin" "hiscore" iniSet "samplerate" "44100" # Raspberry Pis show improved performance using accelerated mode which enables SDL_RENDERER_TARGETTEXTURE. # On RPI4 it uses OpenGL as a renderer, while on earlier RPIs it uses OpenGLES2 as the renderer. # X86 Ubuntu by default uses OpenGL as a renderer, but SDL doesn't have target texture enabled as default. # Enabling accel will use target texture on X86 Ubuntu (and likely other X86 Linux platforms). iniSet "video" "accel" copyDefaultConfig "$temp_ini_mame" "$md_conf_root/$system/mame.ini" rm "$temp_ini_mame" # Create MAME UI config file local temp_ini_ui="$(mktemp)" iniConfig " " "" "$temp_ini_ui" iniSet "scores_directory" "$romdir/$system/scores" copyDefaultConfig "$temp_ini_ui" "$md_conf_root/$system/ui.ini" rm "$temp_ini_ui" # Create MAME Plugin config file local temp_ini_plugin="$(mktemp)" iniConfig " " "" "$temp_ini_plugin" iniSet "hiscore" "1" copyDefaultConfig "$temp_ini_plugin" "$md_conf_root/$system/plugin.ini" rm "$temp_ini_plugin" # Create MAME Hi Score config file local temp_ini_hiscore="$(mktemp)" iniConfig " " "" "$temp_ini_hiscore" iniSet "hi_path" "$romdir/$system/scores" copyDefaultConfig "$temp_ini_hiscore" "$md_conf_root/$system/hiscore.ini" rm "$temp_ini_hiscore" fi addEmulator 0 "$md_id" "arcade" "$md_inst/mame %BASENAME%" addEmulator 1 "$md_id" "$system" "$md_inst/mame %BASENAME%" addSystem "arcade" addSystem "$system" } ================================================ FILE: scriptmodules/emulators/mame4all.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="mame4all" rp_module_desc="MAME emulator MAME4All-Pi" rp_module_help="ROM Extension: .zip\n\nCopy your MAME4all-Pi roms to either $romdir/mame-mame4all or\n$romdir/arcade" rp_module_licence="NONCOM https://raw.githubusercontent.com/RetroPie/mame4all-pi/master/readme.txt" rp_module_repo="git https://github.com/RetroPie/mame4all-pi.git master" rp_module_section="opt armv6=main" rp_module_flags="!all videocore" function depends_mame4all() { getDepends libasound2-dev libsdl1.2-dev libraspberrypi-dev } function sources_mame4all() { gitPullOrClone } function build_mame4all() { make clean # drz80 contains obsoleted arm assembler that gcc/as will not like for arm8 cpu targets if isPlatform "armv8"; then CFLAGS="-O2 -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard" make else make fi md_ret_require="$md_build/mame" } function install_mame4all() { md_ret_files=( 'cheat.dat' 'clrmame.dat' 'folders' 'hiscore.dat' 'mame' 'mame.cfg.template' 'readme.txt' 'skins' ) } function configure_mame4all() { local system="mame-mame4all" mkRomDir "arcade" mkRomDir "$system" mkRomDir "$system/artwork" mkRomDir "$system/samples" if [[ "$md_mode" == "install" ]]; then mkdir -p "$md_conf_root/$system/"{cfg,hi,inp,memcard,nvram,snap,sta} # move old config moveConfigFile "$md_inst/mame.cfg" "$md_conf_root/$system/mame.cfg" local config="$(mktemp)" cp "mame.cfg.template" "$config" iniConfig "=" "" "$config" iniSet "cfg" "$md_conf_root/$system/cfg" iniSet "hi" "$md_conf_root/$system/hi" iniSet "inp" "$md_conf_root/$system/inp" iniSet "memcard" "$md_conf_root/$system/memcard" iniSet "nvram" "$md_conf_root/$system/nvram" iniSet "snap" "$md_conf_root/$system/snap" iniSet "sta" "$md_conf_root/$system/sta" iniSet "artwork" "$romdir/$system/artwork" iniSet "samplepath" "$romdir/$system/samples;$romdir/arcade/samples" iniSet "rompath" "$romdir/$system;$romdir/arcade" iniSet "samplerate" "44100" copyDefaultConfig "$config" "$md_conf_root/$system/mame.cfg" rm "$config" chown -R "$__user":"$__group" "$md_conf_root/$system" fi addEmulator 0 "$md_id" "arcade" "$md_inst/mame %BASENAME%" addEmulator 1 "$md_id" "$system" "$md_inst/mame %BASENAME%" addSystem "arcade" addSystem "$system" } ================================================ FILE: scriptmodules/emulators/minivmac.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="minivmac" rp_module_desc="Macintosh Plus Emulator" rp_module_help="ROM Extensions: .dsk \n\nCopy your Macintosh Plus disks to $romdir/macintosh \n\n You need to copy the Macintosh bios file vMac.ROM into "$biosdir" and System Tools.dsk to $romdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/minivmac/minivmac/refs/heads/master/COPYING.txt" rp_module_repo="git https://github.com/minivmac/minivmac.git master" rp_module_section="exp" rp_module_flags="" function depends_minivmac() { getDepends libsdl2-dev } function sources_minivmac() { gitPullOrClone } function __cpu_minivmac() { if isPlatform "64bit"; then isPlatform "aarch64" && echo "a64" isPlatform "x86" && echo "x64" else isPlatform "arm" && echo "arm" isPlatform "x86" && echo "x86" fi } function __target_minivmac() { isPlatform "arm" || isPlatform "aarch64" && echo "larm" isPlatform "x86" && ! isPlatform "64bit" && echo "lx86" isPlatform "x86" && isPlatform "64bit" && echo "lx64" } function build_minivmac() { cc -o setup_t setup/tool.c local em_speed=4 isPlatform "armv6" && em_speed=2 ./setup_t \ -maintainer "egon.rath@gmail.com" \ -homepage "https://github.com/egrath" \ -t "$(__target_minivmac)" \ -cpu "$(__cpu_minivmac)" \ -e bgc \ -hres 640 -vres 480 -depth 0 \ -magnify 1 -mf 2 \ -m Plus \ -sound 1 \ -sony-sum 1 -sony-tag 1 \ -speed $em_speed -ta 2 -em-cpu 2 \ -chr 0 -drc 1 -sss 4 \ -fullscreen 1 \ -var-fullscreen 1 \ -api sd2 \ > setup.sh bash setup.sh # amend the CFLAGS auto-generated by the build system sed -i "s/^mk_COptions =.*/mk_COptions = \$(mk_COptionsCommon) $CFLAGS/" Makefile make clean make md_ret_require="$md_build/minivmac" } function install_minivmac() { md_ret_files=( 'minivmac' 'COPYING.txt' 'README.md' 'README.txt' ) } function configure_minivmac() { mkRomDir "macintosh" ln -sf "$biosdir/vMac.ROM" "$md_inst/vMac.ROM" addEmulator 1 "$md_id" "macintosh" "pushd $md_inst; $md_inst/minivmac $romdir/macintosh/System\ Tools.dsk %ROM%; popd" addSystem "macintosh" } ================================================ FILE: scriptmodules/emulators/mupen64plus/0001-GLideN64-use-emplace.patch ================================================ diff --git a/GLideN64/src/Combiner.cpp b/GLideN64/src/Combiner.cpp index f724cc0..0141f6c 100644 --- a/GLideN64/src/Combiner.cpp +++ b/GLideN64/src/Combiner.cpp @@ -295,7 +295,7 @@ void CombinerInfo::setCombine(u64 _mux ) } else { m_pCurrent = Combiner_Compile(key); m_pCurrent->update(true); - m_combiners[m_pCurrent->getKey()] = m_pCurrent; + m_combiners.emplace(m_pCurrent->getKey(), m_pCurrent); } m_bChanged = true; } ================================================ FILE: scriptmodules/emulators/mupen64plus/mupen64plus.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # AUDIO_PLUGIN="mupen64plus-audio-sdl" VIDEO_PLUGIN="$1" ROM="$2" [[ "$3" != 0 ]] && RES="$3" [[ "$4" -ne 0 ]] && RSP_PLUGIN="$4" PARAMS="${@:5}" [[ -n "$RES" ]] && RES="--resolution $RES" [[ -z "$RSP_PLUGIN" ]] && RSP_PLUGIN="mupen64plus-rsp-hle" WINDOW_MODE="--fullscreen $RES" rootdir="/opt/retropie" configdir="$rootdir/configs" config="$configdir/n64/mupen64plus.cfg" inputconfig="$configdir/n64/InputAutoCfg.ini" datadir="$HOME/RetroPie" romdir="$datadir/roms" source "$rootdir/lib/inifuncs.sh" # arg 1: hotkey name, arg 2: device number, arg 3: retroarch auto config file function getBind() { local key="$1" local m64p_hotkey="J$2" local file="$3" iniConfig " = " "" "$file" # search hotkey enable button local hotkey local input_type local i=0 for hotkey in input_enable_hotkey "$key"; do for input_type in "_btn" "_axis"; do iniGet "${hotkey}${input_type}" ini_value="${ini_value// /}" if [[ -n "$ini_value" ]]; then ini_value="${ini_value//\"/}" case "$input_type" in _axis) m64p_hotkey+="A${ini_value:1}${ini_value:0:1}" ;; _btn) # if ini_value contains "h" it should be a hat device if [[ "$ini_value" == *h* ]]; then local dir="${ini_value:2}" ini_value="${ini_value:1}" case $dir in up) dir="1" ;; right) dir="2" ;; down) dir="4" ;; left) dir="8" ;; esac m64p_hotkey+="H${ini_value}V${dir}" else [[ "$atebitdo_hack" -eq 1 && "$ini_value" -ge 11 ]] && ((ini_value-=11)) m64p_hotkey+="B${ini_value}" fi ;; esac fi done [[ "$i" -eq 0 ]] && m64p_hotkey+="/" ((i++)) done echo "$m64p_hotkey" } function remap() { local device local devices local device_num # get lists of all present js device numbers and device names # get device count while read -r device; do device_num="${device##*/js}" devices[$device_num]=$(
> "$config" echo "Version = 1" >> "$config" fi local atebitdo_hack for i in {0..2}; do bind="" for device_num in "${!devices[@]}"; do # get name of retroarch auto config file file=$(grep -lF "\"${devices[$device_num]}\"" "$configdir/all/retroarch-joypads/"*.cfg) atebitdo_hack=0 [[ "$file" == *8Bitdo* ]] && getAutoConf "8bitdo_hack" && atebitdo_hack=1 if [[ -f "$file" ]]; then if [[ -n "$bind" && "$bind" != *, ]]; then bind+="," fi bind+=$(getBind "${hotkeys_rp[$i]}" "${device_num}" "$file") fi done # write hotkey to mupen64plus.cfg iniConfig " = " "\"" "$config" iniSet "${hotkeys_m64p[$i]}" "$bind" done } function setAudio() { if tr -d '\0' < /proc/device-tree/compatible | grep -Eq raspberrypi,[0-4]; then # If a Raspberry Pi is used, try to set the right output and use audio OMX if possible # check for the presence of the non-KMS audio driver if aplay -l | grep -qm1 "bcm2835 HDMI"; then # use audio OMX when the RPI has enabled the internal audio cards AUDIO_PLUGIN="mupen64plus-audio-omx" iniConfig " = " "\"" "$config" # create section if necessary if ! grep -q "\[Audio-OMX\]" "$config"; then echo "[Audio-OMX]" >> "$config" echo "Version = 1" >> "$config" fi # try to find which audio card is default by looking at the mixer's volume control name if amixer -Ddefault cget numid=1 | grep -qm1 HDMI; then iniSet "OUTPUT_PORT" "1" fi if amixer -Ddefault cget numid=1 | grep -qm1 Headphones; then iniSet "OUTPUT_PORT" "0" fi fi fi } function testCompatibility() { # fallback for glesn64 and rice plugin # some roms lead to a black screen of death local game # these games need RSP-LLE local blacklist=( naboo body ) # these games do not run with gles2n64 local glesn64_blacklist=( zelda paper kazooie tooie instinct beetle rogue squadron gauntlet ) # these games do not run with rice local glesn64rice_blacklist=( yoshi rogue squadron gauntlet infernal ) # these games have massive glitches if legacy blending is enabled local GLideN64LegacyBlending_blacklist=( empire beetle donkey zelda bomberman infernal ) local GLideN64NativeResolution_blacklist=( majora ) # these games have major problems with GLideN64 local gliden64_blacklist=( zelda conker ) # these games crash if audio-omx is selected local AudioOMX_blacklist=( pokemon resident starcraft rogue squadron infernal ) for game in "${blacklist[@]}"; do if [[ "${ROM,,}" == *"$game"* ]]; then exit fi done for game in "${AudioOMX_blacklist[@]}"; do if [[ "${ROM,,}" == *"$game"* ]]; then AUDIO_PLUGIN="mupen64plus-audio-sdl" fi done case "$VIDEO_PLUGIN" in "mupen64plus-video-GLideN64") if ! grep -q "\[Video-GLideN64\]" "$config"; then echo "[Video-GLideN64]" >> "$config" fi iniConfig " = " "" "$config" # Settings version. Don't touch it. local config_version="20" if [[ -f "$configdir/n64/GLideN64_config_version.ini" ]]; then config_version=$(<"$configdir/n64/GLideN64_config_version.ini") fi iniSet "configVersion" "$config_version" # Set native resolution factor of 1 iniSet "UseNativeResolutionFactor" "1" for game in "${GLideN64NativeResolution_blacklist[@]}"; do if [[ "${ROM,,}" == *"$game"* ]]; then iniSet "UseNativeResolutionFactor" "0" break fi done # Disable LegacyBlending if necessary iniSet "EnableLegacyBlending" "True" for game in "${GLideN64LegacyBlending_blacklist[@]}"; do if [[ "${ROM,,}" == *"$game"* ]]; then iniSet "EnableLegacyBlending" "False" break fi done for game in "${gliden64_blacklist[@]}"; do if [[ "${ROM,,}" == *"$game"* ]]; then VIDEO_PLUGIN="mupen64plus-video-rice" fi done ;; "mupen64plus-video-n64"|"mupen64plus-video-rice") for game in "${glesn64_blacklist[@]}"; do if [[ "${ROM,,}" == *"$game"* ]]; then VIDEO_PLUGIN="mupen64plus-video-rice" fi done for game in "${glesn64rice_blacklist[@]}"; do if [[ "${ROM,,}" == *"$game"* ]]; then VIDEO_PLUGIN="mupen64plus-video-GLideN64" fi done ;; esac # fix Audio-SDL crackle iniConfig " = " "\"" "$config" # create section if necessary if ! grep -q "\[Audio-SDL\]" "$config"; then echo "[Audio-SDL]" >> "$config" echo "Version = 1" >> "$config" fi iniSet "RESAMPLE" "src-sinc-fastest" } function useTexturePacks() { # video-GLideN64 if ! grep -q "\[Video-GLideN64\]" "$config"; then echo "[Video-GLideN64]" >> "$config" fi iniConfig " = " "" "$config" # Settings version. Don't touch it. local config_version="17" if [[ -f "$configdir/n64/GLideN64_config_version.ini" ]]; then config_version=$(<"$configdir/n64/GLideN64_config_version.ini") fi iniSet "configVersion" "$config_version" iniSet "txHiresEnable" "True" # video-rice if ! grep -q "\[Video-Rice\]" "$config"; then echo "[Video-Rice]" >> "$config" fi iniSet "LoadHiResTextures" "True" } function autoset() { VIDEO_PLUGIN="mupen64plus-video-GLideN64" RES="--resolution 320x240" PARAMS="--set Video-GLideN64[UseNativeResolutionFactor]=1" local game # these games run fine and look better with 640x480 local highres=( yoshi worms party pokemon bomberman harvest diddy 1080 starcraft wipeout dark ) for game in "${highres[@]}"; do if [[ "${ROM,,}" == *"$game"* ]]; then RES="--resolution 640x480" PARAMS="--set Video-GLideN64[UseNativeResolutionFactor]=2" break fi done # these games have no glitches and run faster with gles2n64 local gles2n64=( wave kart ) for game in "${gles2n64[@]}"; do if [[ "${ROM,,}" == *"$game"* ]]; then VIDEO_PLUGIN="mupen64plus-video-n64" break fi done # these games have no glitches or run faster with rice local gles2rice=( diddy 1080 conker tooie darkness ) for game in "${gles2rice[@]}"; do if [[ "${ROM,,}" == *"$game"* ]]; then VIDEO_PLUGIN="mupen64plus-video-rice" break fi done } if ! grep -q "\[Core\]" "$config"; then echo "[Core]" >> "$config" echo "Version = 1.010000" >> "$config" fi iniConfig " = " "\"" "$config" function setPath() { iniSet "ScreenshotPath" "$romdir/n64" iniSet "SaveStatePath" "$romdir/n64" iniSet "SaveSRAMPath" "$romdir/n64" } # add default keyboard configuration if InputAutoCFG.ini is missing if [[ ! -f "$inputconfig" ]]; then cat > "$inputconfig" << _EOF_ ; InputAutoCfg.ini for Mupen64Plus SDL Input plugin ; Keyboard_START [Keyboard] plugged = True plugin = 2 mouse = False DPad R = key(100) DPad L = key(97) DPad D = key(115) DPad U = key(119) Start = key(13) Z Trig = key(122) B Button = key(306) A Button = key(304) C Button R = key(108) C Button L = key(106) C Button D = key(107) C Button U = key(105) R Trig = key(99) L Trig = key(120) Mempak switch = key(44) Rumblepak switch = key(46) X Axis = key(276,275) Y Axis = key(273,274) ; Keyboard_END _EOF_ fi getAutoConf mupen64plus_savepath && setPath getAutoConf mupen64plus_hotkeys && remap getAutoConf mupen64plus_audio && setAudio [[ "$VIDEO_PLUGIN" == "AUTO" ]] && autoset getAutoConf mupen64plus_compatibility_check && testCompatibility getAutoConf mupen64plus_texture_packs && useTexturePacks if tr -d '\0' < /proc/device-tree/compatible | grep -Eq raspberrypi,[0-4]; then WINDOW_MODE="--windowed $RES" SDL_VIDEO_RPI_SCALE_MODE=1 # If a Raspberry Pi (<5) device is used, lower resolution to 320x240 and enable SDL dispmanx scaling mode 1 fi if [[ -e /opt/vero3/lib/libMali.so ]]; then SDL_AUDIODRIVER=alsa fi SDL_AUDIODRIVER=${SDL_AUDIODRIVER} SDL_VIDEO_RPI_SCALE_MODE=${SDL_VIDEO_RPI_SCALE_MODE} "$rootdir/emulators/mupen64plus/bin/mupen64plus" --noosd $PARAMS ${WINDOW_MODE} --rsp ${RSP_PLUGIN}.so --gfx ${VIDEO_PLUGIN}.so --audio ${AUDIO_PLUGIN}.so --configdir "$configdir/n64" --datadir "$configdir/n64" "$ROM" ================================================ FILE: scriptmodules/emulators/mupen64plus/remove_fast_math.diff ================================================ --- a/mupen64plus-audio-sdl/projects/unix/Makefile +++ b/mupen64plus-audio-sdl/projects/unix/Makefile @@ -99,7 +99,7 @@ OBJDIR = _obj$(POSTFIX) # base CFLAGS, LDLIBS, and LDFLAGS OPTFLAGS ?= -O3 -flto WARNFLAGS ?= -Wall -CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fvisibility=hidden -I$(SRCDIR) +CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -fvisibility=hidden -I$(SRCDIR) LDFLAGS += $(SHARED) # Since we are building a shared library, we must compile with -fPIC on some architectures --- a/mupen64plus-input-sdl/projects/unix/Makefile +++ b/mupen64plus-input-sdlprojects/unix/Makefile @@ -96,7 +96,7 @@ OBJDIR = _obj$(POSTFIX) # base CFLAGS, LDLIBS, and LDFLAGS OPTFLAGS ?= -O3 -flto WARNFLAGS ?= -Wall -CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fvisibility=hidden -I$(SRCDIR) -D_GNU_SOURCE=1 +CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -fvisibility=hidden -I$(SRCDIR) -D_GNU_SOURCE=1 LDFLAGS += $(SHARED) LDLIBS += -lm --- a/mupen64plus-rsp-hle/projects/unix/Makefile +++ b/mupen64plus-rsp-hle/projects/unix/Makefile @@ -147,7 +147,7 @@ OBJDIR = _obj$(POSTFIX) # base CFLAGS, LDLIBS, and LDFLAGS OPTFLAGS ?= -O3 -flto WARNFLAGS ?= -Wall -CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fvisibility=hidden -I$(SRCDIR) +CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -fvisibility=hidden -I$(SRCDIR) LDFLAGS += $(SHARED) # Since we are building a shared library, we must compile with -fPIC on some architectures --- a/mupen64plus-ui-console/projects/unix/Makefile +++ b/mupen64plus-ui-console/projects/unix/Makefile @@ -74,7 +74,7 @@ OBJDIR = _obj$(POSTFIX) OPTFLAGS ?= -O3 -flto WARNFLAGS ?= -Wall -CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -I$(SRCDIR) +CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -I$(SRCDIR) ifeq ($(OS), MINGW) CFLAGS += -lpthread LDLIBS += -lpthread --- a/mupen64plus-video-gles2n64/projects/unix/Makefile +++ b/mupen64plus-video-gles2n64/projects/unix/Makefile @@ -132,7 +132,7 @@ endif # base CFLAGS, LDLIBS, and LDFLAGS OPTFLAGS ?= -O3 -flto WARNFLAGS ?= -Wall -CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src -DSDL_VIDEO_OPENGL_ES2=1 -DSDL_VIDEO_OPENGL=0 +CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -fno-strict-aliasing -fvisibility=hidden -I../../src -DSDL_VIDEO_OPENGL_ES2=1 -DSDL_VIDEO_OPENGL=0 CXXFLAGS += $(OPTFLAGS) -std=c++11 -fvisibility-inlines-hidden -DSDL_VIDEO_OPENGL_ES2=1 -DSDL_VIDEO_OPENGL=0 LDFLAGS += $(SHARED) --- a/mupen64plus-video-gles2rice/projects/unix/Makefile +++ b/mupen64plus-video-gles2rice/projects/unix/Makefile @@ -133,7 +133,7 @@ endif # base CFLAGS, LDLIBS, and LDFLAGS OPTFLAGS ?= -flto WARNFLAGS ?= -Wall -CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fsingle-precision-constant -fno-strict-aliasing -fvisibility=hidden -I../../src -DSDL_VIDEO_OPENGL_ES2=1 -DSDL_VIDEO_OPENGL=0 +CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -fsingle-precision-constant -fno-strict-aliasing -fvisibility=hidden -I../../src -DSDL_VIDEO_OPENGL_ES2=1 -DSDL_VIDEO_OPENGL=0 CXXFLAGS += -fvisibility-inlines-hidden -DSDL_VIDEO_OPENGL_ES2=1 -DSDL_VIDEO_OPENGL=0 LDFLAGS += $(SHARED) ================================================ FILE: scriptmodules/emulators/mupen64plus.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="mupen64plus" rp_module_desc="N64 emulator MUPEN64Plus" rp_module_help="ROM Extensions: .z64 .n64 .v64\n\nCopy your N64 roms to $romdir/n64" rp_module_licence="GPL2 https://raw.githubusercontent.com/mupen64plus/mupen64plus-core/master/LICENSES" rp_module_repo=":_pkg_info_mupen64plus" rp_module_section="main" rp_module_flags="sdl2 nodistcc" function depends_mupen64plus() { local depends=(cmake libsamplerate0-dev libspeexdsp-dev libsdl2-dev libpng-dev libfreetype6-dev fonts-freefont-ttf libboost-filesystem-dev libglu1-mesa-dev) isPlatform "videocore" && depends+=(libraspberrypi-dev) isPlatform "mesa" && depends+=(libgles2-mesa-dev) isPlatform "x86" && depends+=(nasm) isPlatform "vero4k" && depends+=(vero3-userland-dev-osmc) # was a vero4k only line - I think it's not needed or can use a smaller subset of boost isPlatform "osmc" && depends+=(libboost-all-dev) getDepends "${depends[@]}" } function _get_repos_mupen64plus() { local repos=( 'mupen64plus mupen64plus-core master' 'mupen64plus mupen64plus-ui-console master' 'mupen64plus mupen64plus-audio-sdl master' 'mupen64plus mupen64plus-input-sdl master' 'mupen64plus mupen64plus-rsp-hle master' ) if isPlatform "videocore" && isPlatform "32bit"; then repos+=('gizmo98 mupen64plus-audio-omx master') fi if isPlatform "gles"; then ! isPlatform "rpi" && repos+=('mupen64plus mupen64plus-video-glide64mk2 master') if isPlatform "32bit"; then repos+=('ricrpi mupen64plus-video-gles2rice pandora-backport') repos+=('ricrpi mupen64plus-video-gles2n64 master') fi fi if isPlatform "gl"; then repos+=( 'mupen64plus mupen64plus-video-glide64mk2 master' 'mupen64plus mupen64plus-rsp-cxd4 master' 'mupen64plus mupen64plus-rsp-z64 master' ) fi local commit="" # GLideN64 now requires cmake 3.9 so use an older commit as a workaround for systems with older cmake (pre buster). # Test using "apt-cache madison" as this code could be called when cmake isn't yet installed but correct version # is available - eg via update check with builder module which removes dependencies after building. # Multiple versions may be available, so grab the versions via cut, sort by version, take the latest from the top # and pipe to xargs to strip whitespace local cmake_ver=$(apt-cache madison cmake | cut -d\| -f2 | sort --version-sort | head -1 | xargs) if compareVersions "$cmake_ver" lt 3.9; then commit="8a9d52b41b33d853445f0779dd2b9f5ec4ecdda8" fi # avoid a GLideN64 regression introduced in 1a0621d isPlatform "gles" && commit="5bbf55df8c61ab86b5e41a97906bc99ce9b00a36" repos+=("gonetz GLideN64 master $commit") local repo for repo in "${repos[@]}"; do echo "$repo" done } function _pkg_info_mupen64plus() { local mode="$1" local repo case "$mode" in get) local hashes=() local hash local date local newest_date while read repo; do repo=($repo) date=$(git -C "$md_build/${repo[1]}" log -1 --format=%aI) hash="$(git -C "$md_build/${repo[1]}" log -1 --format=%H)" hashes+=("$hash") if rp_dateIsNewer "$newest_date" "$date"; then newest_date="$date" fi done < <(_get_repos_mupen64plus) # store an md5sum of the various last commit hashes to be used to check for changes local hash="$(echo "${hashes[@]}" | md5sum | cut -d" " -f1)" echo "local pkg_repo_date=\"$newest_date\"" echo "local pkg_repo_extra=\"$hash\"" ;; newer) local hashes=() local hash while read repo; do repo=($repo) # if we have any repos set to a specific git hash (eg GLideN64 then we use that) otherwise check if [[ -n "${repo[3]}" ]]; then hash="${repo[3]}" else if ! hash="$(rp_getRemoteRepoHash git https://github.com/${repo[0]}/${repo[1]} ${repo[2]})"; then __ERRMSGS+=("$hash") return 3 fi fi hashes+=("$hash") done < <(_get_repos_mupen64plus) # store an md5sum of the various last commit hashes to be used to check for changes local hash="$(echo "${hashes[@]}" | md5sum | cut -d" " -f1)" if [[ "$hash" != "$pkg_repo_extra" ]]; then return 0 fi return 1 ;; check) local ret=0 while read repo; do repo=($repo) out=$(rp_getRemoteRepoHash git https://github.com/${repo[0]}/${repo[1]} ${repo[2]}) if [[ -z "$out" ]]; then printMsgs "console" "$id repository failed - https://github.com/${repo[0]}/${repo[1]} ${repo[2]}" ret=1 fi done < <(_get_repos_mupen64plus) return "$ret" ;; esac } function sources_mupen64plus() { local commit local repo while read repo; do repo=($repo) gitPullOrClone "$md_build/${repo[1]}" https://github.com/${repo[0]}/${repo[1]} ${repo[2]} ${repo[3]} done < <(_get_repos_mupen64plus) if isPlatform "videocore"; then # workaround for shader cache crash issue on Raspbian stretch. See: https://github.com/gonetz/GLideN64/issues/1665 applyPatch "$md_data/0001-GLideN64-use-emplace.patch" fi if isPlatform "armv8"; then # remove -ffast-math as it causes build errors building on cortex-a76 (rpi5) applyPatch "$md_data/remove_fast_math.diff" fi local config_version=$(grep -oP '(?<=CONFIG_VERSION_CURRENT ).+?(?=U)' GLideN64/src/Config.h) echo "$config_version" > "$md_build/GLideN64_config_version.ini" } function _params_mupen64plus() { local dir="$1" local params=() isPlatform "rpi1" && params+=("VFP=1" "VFP_HARD=1") isPlatform "videocore" || [[ "$dir" == "mupen64plus-audio-omx" ]] && params+=("VC=1") if isPlatform "mesa" || isPlatform "mali"; then params+=("USE_GLES=1") fi isPlatform "neon" && params+=("NEON=1") isPlatform "x11" && params+=("OSD=1" "PIE=1") isPlatform "x86" && params+=("SSE=SSE2") isPlatform "armv6" && params+=("HOST_CPU=armv6") isPlatform "armv7" && params+=("HOST_CPU=armv7") isPlatform "armv8" && params+=("HOST_CPU=armv8") isPlatform "aarch64" && params+=("HOST_CPU=aarch64") # we don't ship a Vulkan enabled front-end, so disable Vulkan in the core project params+=("VULKAN=0") echo "${params[@]}" } function build_mupen64plus() { rpSwap on 750 local dir local params for dir in *; do if [[ -f "$dir/projects/unix/Makefile" ]]; then # get make parameters params=($(_params_mupen64plus $dir)) [[ "$dir" == "mupen64plus-ui-console" ]] && params+=("COREDIR=$md_inst/lib/" "PLUGINDIR=$md_inst/lib/mupen64plus/") make -C "$dir/projects/unix" "${params[@]}" clean make -C "$dir/projects/unix" all "${params[@]}" OPTFLAGS="$CFLAGS -O3 -flto" fi done # build GLideN64 "$md_build/GLideN64/src/getRevision.sh" pushd "$md_build/GLideN64/projects/cmake" params=("-DMUPENPLUSAPI=On" "-DVEC4_OPT=On" "-DUSE_SYSTEM_LIBS=On") isPlatform "neon" && params+=("-DNEON_OPT=On") isPlatform "mesa" && params+=("-DMESA=On" "-DEGL=On") isPlatform "vero4k" && params+=("-DVERO4K=On") isPlatform "armv8" && params+=("-DCRC_ARMV8=On") isPlatform "mali" && params+=("-DVERO4K=On" "-DCRC_OPT=On" "-DEGL=On") isPlatform "x86" && params+=("-DCRC_OPT=On") cmake "${params[@]}" ../../src/ make popd rpSwap off md_ret_require=( 'mupen64plus-ui-console/projects/unix/mupen64plus' 'mupen64plus-core/projects/unix/libmupen64plus.so.2.0.0' 'mupen64plus-audio-sdl/projects/unix/mupen64plus-audio-sdl.so' 'mupen64plus-input-sdl/projects/unix/mupen64plus-input-sdl.so' 'mupen64plus-rsp-hle/projects/unix/mupen64plus-rsp-hle.so' 'GLideN64/projects/cmake/plugin/Release/mupen64plus-video-GLideN64.so' ) if isPlatform "videocore" && ! isPlatform " 64bit"; then md_ret_require+=('mupen64plus-audio-omx/projects/unix/mupen64plus-audio-omx.so') fi if isPlatform "gles"; then ! isPlatform "rpi" && md_ret_require+=('mupen64plus-video-glide64mk2/projects/unix/mupen64plus-video-glide64mk2.so') if isPlatform "32bit"; then md_ret_require+=('mupen64plus-video-gles2rice/projects/unix/mupen64plus-video-rice.so') md_ret_require+=('mupen64plus-video-gles2n64/projects/unix/mupen64plus-video-n64.so') fi fi if isPlatform "gl"; then md_ret_require+=( 'mupen64plus-video-glide64mk2/projects/unix/mupen64plus-video-glide64mk2.so' 'mupen64plus-rsp-z64/projects/unix/mupen64plus-rsp-z64.so' ) if isPlatform "x86"; then md_ret_require+=('mupen64plus-rsp-cxd4/projects/unix/mupen64plus-rsp-cxd4-sse2.so') else md_ret_require+=('mupen64plus-rsp-cxd4/projects/unix/mupen64plus-rsp-cxd4.so') fi fi } function install_mupen64plus() { local dir local params for dir in *; do if [[ -f "$dir/projects/unix/Makefile" ]]; then # get make parameters params=($(_params_mupen64plus $dir)) # optflags is needed due to the fact the core seems to rebuild 2 files and relink during install stage most likely due to a buggy makefile make -C "$dir/projects/unix" PREFIX="$md_inst" OPTFLAGS="$CFLAGS -O3 -flto" "${params[@]}" install fi done cp "$md_build/GLideN64/ini/GLideN64.custom.ini" "$md_inst/share/mupen64plus/" cp "$md_build/GLideN64/projects/cmake/plugin/Release/mupen64plus-video-GLideN64.so" "$md_inst/lib/mupen64plus/" cp "$md_build/GLideN64_config_version.ini" "$md_inst/share/mupen64plus/" # remove default InputAutoConfig.ini. inputconfigscript writes a clean file rm -f "$md_inst/share/mupen64plus/InputAutoCfg.ini" } function configure_mupen64plus() { local res local resolutions=("320x240" "640x480") isPlatform "kms" && res="%XRES%x%YRES%" if isPlatform "rpi"; then # kms needs to run at full screen as it doesn't benefit from our SDL scaling hint if isPlatform "mesa"; then addEmulator 0 "${md_id}-GLideN64" "n64" "$md_inst/bin/mupen64plus.sh mupen64plus-video-GLideN64 %ROM% $res 0 --set Video-GLideN64[UseNativeResolutionFactor]\=1" addEmulator 0 "${md_id}-GLideN64-highres" "n64" "$md_inst/bin/mupen64plus.sh mupen64plus-video-GLideN64 %ROM% $res 0 --set Video-GLideN64[UseNativeResolutionFactor]\=2" addEmulator 0 "${md_id}-gles2n64" "n64" "$md_inst/bin/mupen64plus.sh mupen64plus-video-n64 %ROM%" if isPlatform "32bit"; then addEmulator 0 "${md_id}-gles2rice" "n64" "$md_inst/bin/mupen64plus.sh mupen64plus-video-rice %ROM% $res" fi else for res in "${resolutions[@]}"; do local name="" local nativeResFactor=1 if [[ "$res" == "640x480" ]]; then name="-highres" nativeResFactor=2 fi addEmulator 0 "${md_id}-GLideN64$name" "n64" "$md_inst/bin/mupen64plus.sh mupen64plus-video-GLideN64 %ROM% $res 0 --set Video-GLideN64[UseNativeResolutionFactor]\=$nativeResFactor" addEmulator 0 "${md_id}-gles2rice$name" "n64" "$md_inst/bin/mupen64plus.sh mupen64plus-video-rice %ROM% $res" done addEmulator 1 "${md_id}-auto" "n64" "$md_inst/bin/mupen64plus.sh AUTO %ROM%" fi addEmulator 0 "${md_id}-gles2n64" "n64" "$md_inst/bin/mupen64plus.sh mupen64plus-video-n64 %ROM%" elif isPlatform "mali"; then addEmulator 1 "${md_id}-gles2n64" "n64" "$md_inst/bin/mupen64plus.sh mupen64plus-video-n64 %ROM%" addEmulator 0 "${md_id}-GLideN64" "n64" "$md_inst/bin/mupen64plus.sh mupen64plus-video-GLideN64 %ROM%" addEmulator 0 "${md_id}-glide64" "n64" "$md_inst/bin/mupen64plus.sh mupen64plus-video-glide64mk2 %ROM%" addEmulator 0 "${md_id}-gles2rice" "n64" "$md_inst/bin/mupen64plus.sh mupen64plus-video-rice %ROM%" addEmulator 0 "${md_id}-auto" "n64" "$md_inst/bin/mupen64plus.sh AUTO %ROM%" else addEmulator 0 "${md_id}-GLideN64" "n64" "$md_inst/bin/mupen64plus.sh mupen64plus-video-GLideN64 %ROM% $res" addEmulator 1 "${md_id}-glide64" "n64" "$md_inst/bin/mupen64plus.sh mupen64plus-video-glide64mk2 %ROM% $res" if isPlatform "x86"; then ! isPlatform "kms" && res="640x480" addEmulator 0 "${md_id}-GLideN64-LLE" "n64" "$md_inst/bin/mupen64plus.sh mupen64plus-video-GLideN64 %ROM% $res mupen64plus-rsp-cxd4-sse2" fi fi addSystem "n64" mkRomDir "n64" moveConfigDir "$home/.local/share/mupen64plus" "$md_conf_root/n64/mupen64plus" [[ "$md_mode" == "remove" ]] && return # copy hotkey remapping start script cp "$md_data/mupen64plus.sh" "$md_inst/bin/" chmod +x "$md_inst/bin/mupen64plus.sh" mkUserDir "$md_conf_root/n64/" # Copy config files cp -v "$md_inst/share/mupen64plus/"{*.ini,font.ttf} "$md_conf_root/n64/" isPlatform "rpi" && cp -v "$md_inst/share/mupen64plus/"*.conf "$md_conf_root/n64/" local config="$md_conf_root/n64/mupen64plus.cfg" local cmd="$md_inst/bin/mupen64plus --configdir $md_conf_root/n64 --datadir $md_conf_root/n64" # if the user has an existing mupen64plus config we back it up, generate a new configuration # copy that to rp-dist and put the original config back again. We then make any ini changes # on the rp-dist file. This preserves any user configs from modification and allows us to have # a default config for reference if [[ -f "$config" ]]; then mv "$config" "$config.user" su "$__user" -c "$cmd" mv "$config" "$config.rp-dist" mv "$config.user" "$config" config+=".rp-dist" else su "$__user" -c "$cmd" fi # RPI main/GLideN64 settings if isPlatform "rpi"; then iniConfig " = " "" "$config" # VSync is mandatory for good performance on KMS if isPlatform "kms"; then if ! grep -q "\[Video-General\]" "$config"; then echo "[Video-General]" >> "$config" fi iniSet "VerticalSync" "True" fi # Create GlideN64 section in .cfg if ! grep -q "\[Video-GLideN64\]" "$config"; then echo "[Video-GLideN64]" >> "$config" fi # Settings version. Don't touch it. iniSet "configVersion" "29" # Bilinear filtering mode (0=N64 3point, 1=standard) iniSet "bilinearMode" "1" iniSet "EnableFBEmulation" "True" # Use native res iniSet "UseNativeResolutionFactor" "1" # Enable legacy blending iniSet "EnableLegacyBlending" "True" # Enable Threaded GL calls iniSet "ThreadedVideo" "True" # Swap frame buffers On buffer update (most performant) iniSet "BufferSwapMode" "2" # Disable hybrid upscaling filter (needs better GPU) iniSet "EnableHybridFilter" "False" # Use fast but less accurate shaders. Can help with low-end GPUs. iniSet "EnableInaccurateTextureCoordinates" "True" if isPlatform "videocore"; then # Disable gles2n64 autores feature and use dispmanx upscaling iniConfig "=" "" "$md_conf_root/n64/gles2n64.conf" iniSet "auto resolution" "0" setAutoConf mupen64plus_audio 1 setAutoConf mupen64plus_compatibility_check 1 elif isPlatform "mesa"; then # Create Video-Rice section in .cfg if ! grep -q "\[Video-Rice\]" "$config"; then echo "[Video-Rice]" >> "$config" fi # Fix flickering and black screen issues with rice video plugin iniSet "ScreenUpdateSetting" "7" setAutoConf mupen64plus_audio 0 setAutoConf mupen64plus_compatibility_check 0 fi else addAutoConf mupen64plus_audio 0 addAutoConf mupen64plus_compatibility_check 0 fi addAutoConf mupen64plus_hotkeys 1 addAutoConf mupen64plus_texture_packs 1 chown -R "$__user":"$__group" "$md_conf_root/n64" } ================================================ FILE: scriptmodules/emulators/np2pi.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="np2pi" rp_module_desc="NEC PC-9801 emulator" rp_module_help="ROM Extensions: .d88 .d98 .88d .98d .fdi .xdf .hdm .dup .2hd .tfd .hdi .thd .nhd .hdd\n\nCopy your pc98 games to to $romdir/pc88\n\nCopy bios files 2608_bd.wav, 2608_hh.wav, 2608_rim.wav, 2608_sd.wav, 2608_tom.wav 2608_top.wav, bios.rom, FONT.ROM and sound.rom to $biosdir/pc98" rp_module_repo="git https://github.com/eagle0wl/np2pi.git master" rp_module_section="exp" rp_module_flags="sdl1 !all rpi !aarch64" function depends_np2pi() { getDepends libsdl1.2-dev libasound2-dev libsdl-ttf2.0-dev fonts-takao-gothic } function sources_np2pi() { gitPullOrClone } function build_np2pi() { cd sdl make -j 1 -f makefile.rpi md_ret_require="$md_build/bin/np2" } function install_np2pi() { md_ret_files=( 'bin/np2' ) } function configure_np2pi() { mkRomDir "pc98" mkUserDir "$md_conf_root/pc98" isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" # we launch from $md_conf_root/pc98 as emulator wants to create files in # the current directory (eg font.tmp). # symlink bios files mkUserDir "$biosdir/pc98" local bios for bios in 2608_bd.wav 2608_hh.wav 2608_rim.wav 2608_sd.wav 2608_tom.wav 2608_top.wav bios.rom FONT.ROM sound.rom; do ln -sf "$biosdir/pc98/$bios" "$md_conf_root/pc98/$bios" done # symlink font ln -sf /usr/share/fonts/truetype/takao-gothic/TakaoGothic.ttf "$md_conf_root/pc98/default.ttf" addEmulator 1 "$md_id" "pc98" "pushd $md_conf_root/pc98; $md_inst/np2 %ROM%; popd" addSystem "pc98" } ================================================ FILE: scriptmodules/emulators/openmsx/retropie-init.tcl ================================================ namespace eval retropie { proc init {} { set rom_name [guess_title] set config_dir [file normalize "$::env(OPENMSX_USER_DATA)/joystick"] # sanitize the rom name regsub -all {[:> "$config" mkUserDir "$home/.openMSX/share/scripts" mkUserDir "$home/.openMSX/share/systemroms" moveConfigDir "$home/.openMSX" "$configdir/msx/openmsx" moveConfigDir "$configdir/msx/openmsx/share/systemroms" "$home/RetroPie/BIOS/openmsx" copyDefaultConfig "$config" "$home/.openMSX/share/settings.xml" rm "$config" # Add an autostart script, used for joypad configuration cp "$md_data/retropie-init.tcl" "$home/.openMSX/share/scripts" chown -R "$__user":"$__group" "$home/.openMSX/share/scripts" } function _default_settings_openmsx() { local header local body local conf_reverse read -r -d '' header <<_EOF_ C-BIOS_MSX $romdir/msx $romdir/msx $romdir/msx $romdir/msx true false _EOF_ if isPlatform "armv6" ; then IFS= read -r -d '' body <<_EOF_ 1 320 fast 0 5 _EOF_ fi ! isPlatform "x86" && conf_reverse=" off\n" } ================================================ FILE: scriptmodules/emulators/oricutron.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="oricutron" rp_module_desc="Oricutron Oric 1/Oric Atmos emulator" rp_module_help="ROM Extensions: .dsk .tap\n\nCopy your Oric games to $romdir/oric" rp_module_licence="GPL2 https://raw.githubusercontent.com/pete-gordon/oricutron/4c359acfb6bd36d44e6d37891d7b6453324faf7d/main.h" rp_module_repo="git https://github.com/HerbFargus/oricutron.git extras" rp_module_section="exp" function depends_oricutron() { local depends=(cmake libsdl2-dev) isPlatform "x11" && depends+=(libgtk-3-dev) getDepends "${depends[@]}" } function sources_oricutron() { gitPullOrClone } function build_oricutron() { make clean if isPlatform "rpi" || isPlatform "mali"; then make PLATFORM=rpi SDL_LIB=sdl2 else make SDL_LIB=sdl2 fi md_ret_require="$md_build/oricutron" } function install_oricutron() { md_ret_files=( 'oricutron' 'oricutron.cfg' 'roms' 'disks' 'images' ) } function game_data_oricutron() { if [[ -d "$md_inst/disks" && ! -f "$romdir/oric/barbitoric.dsk" ]]; then # copy demo disks cp -v "$md_inst/disks/"* "$romdir/oric/" chown -R "$__user":"$__group" "$romdir/oric" fi } function configure_oricutron() { mkRomDir "oric" local machine local default for machine in atmos oric1 o16k telestrat pravetz; do default=0 [[ "$machine" == "atmos" ]] && default=1 addEmulator "$default" "$md_id-$machine" "oric" "pushd $md_inst; $md_inst/oricutron --machine $machine %ROM% --fullscreen; popd" done addSystem "oric" [[ "$md_mode" == "install" ]] && game_data_oricutron } ================================================ FILE: scriptmodules/emulators/osmose.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="osmose" rp_module_desc="Gamegear emulator Osmose" rp_module_help="ROM Extensions: .bin .gg .sms .zip\nCopy your Game Gear roms to $romdir/gamegear\n\nMasterSystem roms to $romdir/mastersystem" rp_module_licence="GPL2 https://raw.githubusercontent.com/RetroPie/osmose-rpi/master/license.txt" rp_module_repo="git https://github.com/RetroPie/osmose-rpi.git master" rp_module_section="opt" rp_module_flags="!mali sdl1" function depends_osmose() { getDepends libsdl1.2-dev } function sources_osmose() { gitPullOrClone } function build_osmose() { make clean # not safe for building in parallel make -j1 md_ret_require="$md_build/osmose" } function install_osmose() { md_ret_files=( 'changes.txt' 'license.txt' 'osmose' ) } function configure_osmose() { mkRomDir "gamegear" mkRomDir "mastersystem" addEmulator 0 "$md_id" "gamegear" "$md_inst/osmose %ROM% -tv -fs" addEmulator 0 "$md_id" "mastersystem" "$md_inst/osmose %ROM% -tv -fs" addSystem "gamegear" addSystem "mastersystem" [[ $mode == "configure" ]] && isPlatform "kms" && setBackend "$md_id" "sdl12-compat" } ================================================ FILE: scriptmodules/emulators/pcsx-rearmed.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="pcsx-rearmed" rp_module_desc="Playstation emulator - PCSX (arm optimised)" rp_module_help="ROM Extensions: .bin .cue .cbn .img .iso .m3u .mdf .pbp .toc .z .znx\n\nCopy your PSX roms to $romdir/psx\n\nCopy the required BIOS file SCPH1001.BIN to $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/notaz/pcsx_rearmed/master/COPYING" rp_module_repo="git https://github.com/notaz/pcsx_rearmed.git master" rp_module_section="opt" rp_module_flags="sdl1 !all videocore" function depends_pcsx-rearmed() { getDepends libsdl1.2-dev libasound2-dev libpng-dev libx11-dev } function sources_pcsx-rearmed() { gitPullOrClone } function build_pcsx-rearmed() { if isPlatform "neon"; then ./configure --sound-drivers=alsa --enable-neon else ./configure --sound-drivers=alsa --disable-neon fi make clean make md_ret_require="$md_build/pcsx" } function install_pcsx-rearmed() { md_ret_files=( 'AUTHORS' 'COPYING' 'ChangeLog' 'ChangeLog.df' 'NEWS' 'README.md' 'pcsx' ) mkdir "$md_inst/plugins" cp "$md_build/plugins/spunull/spunull.so" "$md_inst/plugins/spunull.so" cp "$md_build/plugins/gpu_unai/gpu_unai.so" "$md_inst/plugins/gpu_unai.so" cp "$md_build/plugins/gpu-gles/gpu_gles.so" "$md_inst/plugins/gpu_gles.so" cp "$md_build/plugins/dfxvideo/gpu_peops.so" "$md_inst/plugins/gpu_peops.so" } function configure_pcsx-rearmed() { mkRomDir "psx" mkUserDir "$md_conf_root/psx" mkdir -p "$md_inst/bios" # symlink the bios so it can be installed with the other bios files ln -sf "$biosdir/SCPH1001.BIN" "$md_inst/bios/SCPH1001.BIN" # symlink config folder moveConfigDir "$md_inst/.pcsx" "$md_conf_root/psx/pcsx" isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" addEmulator 0 "$md_id" "psx" "pushd $md_inst; ./pcsx -cdfile %ROM%; popd" addSystem "psx" } ================================================ FILE: scriptmodules/emulators/pcsx2.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="pcsx2" rp_module_desc="PS2 emulator PCSX2" rp_module_help="ROM Extensions: .bin .iso .img .mdf .z .z2 .bz2 .cso .chd .ima .gz\n\nCopy your PS2 roms to $romdir/ps2\n\nCopy the required BIOS file to $biosdir" rp_module_licence="GPL3 https://raw.githubusercontent.com/PCSX2/pcsx2/master/COPYING.GPLv3" rp_module_section="exp" rp_module_flags="!all x86" function _64bit_available_pcsx2() { # detect if a 64bit version for pcsx2 is available in the Ubuntu PPA if [[ -n "${__os_ubuntu_ver}" ]] && compareVersions "${__os_ubuntu_ver}" ge 21.04; then return 0 fi return 1 } function depends_pcsx2() { if isPlatform "64bit" && ! _64bit_available_pcsx2 ; then iniConfig " = " '"' "$configdir/all/retropie.cfg" iniGet "own_sdl2" if [[ "$ini_value" != "0" ]]; then if dialog --yesno "PCSX2 cannot be installed on a 64bit system with the RetroPie custom version of SDL2 installed due to version conflicts with the multiarch i386 version of SDL2.\n\nDo you want to downgrade to your OS version of SDL2 and continue to install PCSX2?" 22 76 2>&1 >/dev/tty; then chown "$__user":"$__group" "$configdir/all/retropie.cfg" if rp_callModule sdl2 revert; then iniSet "own_sdl2" "0" else md_ret_errors+=("Failed to install $md_desc") fi else md_ret_errors+=("$md_desc install aborted.") fi fi fi if [[ "$md_mode" == "install" ]]; then # On Ubuntu, add the PCSX2 PPA to get the latest version [[ -n "${__os_ubuntu_ver}" ]] && add-apt-repository -y ppa:pcsx2-team/pcsx2-daily if ! _64bit_available_pcsx2 ; then dpkg --add-architecture i386 fi else rm -f /etc/apt/sources.list.d/pcsx2-team-ubuntu-pcsx2-daily-*.list apt-key del "D7B4 49CF E17E 659E 5A12 EE8E DD6E EEA2 BD74 7717" >/dev/null fi } function install_bin_pcsx2() { local version [[ -n "${__os_ubuntu_ver}" ]] && version="-unstable" aptInstall "pcsx2$version" } function remove_pcsx2() { local version [[ -n "${__os_ubuntu_ver}" ]] && version="-unstable" aptRemove "pcsx2$version" rp_callModule pcsx2 depends remove } function configure_pcsx2() { mkRomDir "ps2" # detect if the new (QT) UI is installed and add the fullscreen/windowed commands if [[ -f /usr/bin/pcsx2-qt ]]; then addEmulator 0 "$md_id" "ps2" "pcsx2-qt -nofullscreen %ROM%" addEmulator 1 "$md_id-nogui" "ps2" "pcsx2-qt -fullscreen -nogui %ROM%" else local emu_path="/usr/games/PCSX2" [[ -f "/usr/games/pcsx2" ]] && emu_path="/usr/games/pcsx2" addEmulator 0 "$md_id" "ps2" "$emu_path --windowed %ROM%" addEmulator 1 "$md_id-nogui" "ps2" "$emu_path --fullscreen --nogui %ROM%" fi addSystem "ps2" } ================================================ FILE: scriptmodules/emulators/pifba.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="pifba" rp_module_desc="FBA emulator PiFBA" rp_module_help="ROM Extension: .zip\n\nCopy your FBA roms to\n$romdir/fba or\n$romdir/neogeo or\n$romdir/arcade\n\nFor NeoGeo games the neogeo.zip BIOS is required and must be placed in the same directory as your FBA roms." rp_module_licence="GPL2 https://raw.githubusercontent.com/RetroPie/pifba/master/FBAcapex_src/COPYING" rp_module_repo="git https://github.com/RetroPie/pifba.git master" rp_module_section="opt armv6=main" rp_module_flags="!all videocore" function depends_pifba() { getDepends libasound2-dev libsdl1.2-dev libraspberrypi-dev } function sources_pifba() { gitPullOrClone } function build_pifba() { mkdir ".obj" make clean make md_ret_require="$md_build/fba2x" } function install_pifba() { mkdir -p "$md_inst/"{roms,skin,preview} md_ret_files=( 'fba2x' 'fba2x.cfg.template' 'capex.cfg.template' 'zipname.fba' 'rominfo.fba' 'FBACache_windows.zip' 'fba_029671_clrmame_dat.zip' ) } function configure_pifba() { mkRomDir "arcade" mkRomDir "fba" mkRomDir "neogeo" if [[ "$md_mode" == "install" ]]; then mkUserDir "$md_conf_root/fba" local config for config in fba2x.cfg capex.cfg; do # move old config if it exists moveConfigFile "$md_inst/$config" "$md_conf_root/fba/$config" copyDefaultConfig "$config.template" "$md_conf_root/fba/$config" done fi local def=0 isPlatform "rpi1" && def=1 addEmulator 0 "$md_id" "arcade" "$md_inst/fba2x %ROM%" addEmulator $def "$md_id" "neogeo" "$md_inst/fba2x %ROM%" addEmulator $def "$md_id" "fba" "$md_inst/fba2x %ROM%" addSystem "arcade" addSystem "neogeo" addSystem "fba" } ================================================ FILE: scriptmodules/emulators/pisnes.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="pisnes" rp_module_desc="SNES emulator PiSNES" rp_module_help="ROM Extensions: .bin .smc .sfc .fig .swc .mgd .zip\n\nCopy your SNES roms to $romdir/snes" rp_module_licence="NONCOM https://raw.githubusercontent.com/RetroPie/pisnes/master/snes9x.h" rp_module_repo="git https://github.com/RetroPie/pisnes.git master" rp_module_section="opt" rp_module_flags="!all videocore" function depends_pisnes() { getDepends libasound2-dev libsdl1.2-dev libraspberrypi-dev libjpeg-dev } function sources_pisnes() { gitPullOrClone } function build_pisnes() { make clean make md_ret_require="$md_build/snes9x" } function install_pisnes() { md_ret_files=( 'changes.txt' 'hardware.txt' 'problems.txt' 'readme_snes9x.txt' 'readme.txt' 'roms' 'skins' 'snes9x' 'snes9x.cfg.template' 'snes9x.gui' ) } function configure_pisnes() { mkRomDir "snes" addEmulator 0 "$md_id" "snes" "$md_inst/snes9x %ROM%" addSystem "snes" [[ "$md_mode" == "remove" ]] && return moveConfigFile "$md_inst/snes9x.cfg" "$md_conf_root/snes/snes9x.cfg" copyDefaultConfig "$md_inst/snes9x.cfg.template" "$md_conf_root/snes/snes9x.cfg" } ================================================ FILE: scriptmodules/emulators/ppsspp/gles2_fix.diff ================================================ diff --git a/Common/GPU/OpenGL/DataFormatGL.cpp b/Common/GPU/OpenGL/DataFormatGL.cpp index 425f247..ea690d8 100644 --- a/Common/GPU/OpenGL/DataFormatGL.cpp +++ b/Common/GPU/OpenGL/DataFormatGL.cpp @@ -146,12 +146,14 @@ bool Thin3DFormatToGLFormatAndType(DataFormat fmt, GLuint &internalFormat, GLuin alignment = 16; break; +#ifdef GL_COMPRESSED_RGBA_ASTC_4x4_KHR case DataFormat::ASTC_4x4_UNORM_BLOCK: internalFormat = GL_COMPRESSED_RGBA_ASTC_4x4_KHR; format = GL_RGBA; type = GL_FLOAT; alignment = 16; break; +#endif default: return false; diff --git a/Common/GPU/OpenGL/GLFeatures.cpp b/Common/GPU/OpenGL/GLFeatures.cpp index c17f1d1..fa3463e 100644 --- a/Common/GPU/OpenGL/GLFeatures.cpp +++ b/Common/GPU/OpenGL/GLFeatures.cpp @@ -592,7 +592,9 @@ bool CheckGLExtensions() { for (int i = 0; i < numCompressedFormats; i++) { switch (compressedFormats[i]) { case GL_COMPRESSED_RGB8_ETC2: gl_extensions.supportsETC2 = true; break; +#ifdef GL_COMPRESSED_RGBA_ASTC_4x4_KHR case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: gl_extensions.supportsASTC = true; break; +#endif #ifndef USING_GLES2 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: gl_extensions.supportsBC123 = true; break; case GL_COMPRESSED_RGBA_BPTC_UNORM: gl_extensions.supportsBC7 = true; break; ================================================ FILE: scriptmodules/emulators/ppsspp/sdl_ttf_fix_before_1.19.diff ================================================ diff --git a/Common/Render/Text/draw_text_sdl.h b/Common/Render/Text/draw_text_sdl.h index 87c543a..bfd3842 100644 --- a/Common/Render/Text/draw_text_sdl.h +++ b/Common/Render/Text/draw_text_sdl.h @@ -5,13 +5,15 @@ #include #include "Common/Render/Text/draw_text.h" +#if defined(USE_SDL2_TTF) + +#include "SDL2/SDL.h" +#include "SDL2/SDL_ttf.h" + #if defined(USE_SDL2_TTF_FONTCONFIG) #include #endif -// SDL2_ttf's TTF_Font is a typedef of _TTF_Font. -struct _TTF_Font; - class TextDrawerSDL : public TextDrawer { public: TextDrawerSDL(Draw::DrawContext *draw); @@ -33,15 +35,17 @@ class TextDrawerSDL : public TextDrawer { bool FindFallbackFonts(uint32_t missingGlyph, int ptSize); uint32_t fontHash_; - std::map fontMap_; + std::map fontMap_; std::map> cache_; std::map> sizeCache_; - std::vector<_TTF_Font *> fallbackFonts_; + std::vector fallbackFonts_; std::vector> fallbackFontPaths_; // path and font face index #if defined(USE_SDL2_TTF_FONTCONFIG) FcConfig *config; #endif }; + +#endif ================================================ FILE: scriptmodules/emulators/ppsspp/tinker.armv7.cmake ================================================ include_directories(SYSTEM /usr/local/include /usr/include ) set(ARCH_FLAGS "-O2 -marm -march=armv7-a -mfpu=neon-vfpv4 -mtune=cortex-a17 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations -pipe") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARCH_FLAGS}" CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_FLAGS}" CACHE STRING "" FORCE) set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${ARCH_FLAGS}" CACHE STRING "" FORCE) set(OPENGL_LIBRARIES GLESv2) set(ARMV7 ON) set(USING_GLES2 ON) ================================================ FILE: scriptmodules/emulators/ppsspp-1.5.4.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="ppsspp-1.5.4" rp_module_desc="PlayStation Portable emulator PPSSPP v1.5.4" rp_module_help="ROM Extensions: .iso .pbp .cso\n\nCopy your PlayStation Portable roms to $romdir/psp" rp_module_licence="GPL2 https://raw.githubusercontent.com/hrydgard/ppsspp/master/LICENSE.TXT" rp_module_repo="git https://github.com/hrydgard/ppsspp.git v1.5.4" rp_module_section="opt" rp_module_flags="!all videocore" function depends_ppsspp-1.5.4() { depends_ppsspp } function sources_ppsspp-1.5.4() { sources_ppsspp } function build_ppsspp-1.5.4() { build_ppsspp } function install_ppsspp-1.5.4() { install_ppsspp } function configure_ppsspp-1.5.4() { configure_ppsspp } ================================================ FILE: scriptmodules/emulators/ppsspp.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="ppsspp" rp_module_desc="PlayStation Portable emulator PPSSPP" rp_module_help="ROM Extensions: .iso .pbp .cso\n\nCopy your PlayStation Portable roms to $romdir/psp" rp_module_licence="GPL2 https://raw.githubusercontent.com/hrydgard/ppsspp/master/LICENSE.TXT" rp_module_repo="git https://github.com/hrydgard/ppsspp.git :_get_release_ppsspp" rp_module_section="opt" rp_module_flags="" function _get_release_ppsspp() { local tagged_version="v1.20.1" # buster and older can't compile recent PPSSPP if [[ "$__os_debian_ver" -lt 11 ]]; then # the V3D Mesa driver before 21.x has issues with v1.14 and later if isPlatform "kms" && isPlatform "rpi"; then tagged_version="v1.13.2" else tagged_version="v1.16.6" fi fi echo $tagged_version } function depends_ppsspp() { local depends=(cmake libbrotli-dev libsnappy-dev libbz2-dev libzip-dev zlib1g-dev libzstd-dev libminiupnpc-dev) [[ $md_id != "lr-ppsspp" ]] && depends+=(libsdl2-dev libsdl2-ttf-dev libfontconfig-dev) [[ $md_id != "lr-ppsspp" ]] && isPlatform "x11" && depends+=(libx11-dev wayland-protocols libwayland-dev) isPlatform "x86" && depends+=(nasm) isPlatform "videocore" && depends+=(libraspberrypi-dev) isPlatform "mesa" && depends+=(libgles2-mesa-dev) isPlatform "vero4k" && depends+=(vero3-userland-dev-osmc) getDepends "${depends[@]}" } function sources_ppsspp() { gitPullOrClone "$md_build/ppsspp" cd "ppsspp" # remove the lines that trigger the ffmpeg build script functions - we will just use the variables from it sed -i "/^build_ARMv6$/,$ d" ffmpeg/linux_arm.sh # remove -U__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 as we handle this ourselves if armv7 on Raspbian sed -i "/^ -U__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2/d" cmake/Toolchains/raspberry.armv7.cmake # set ARCH_FLAGS to our own CXXFLAGS (which includes GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 if needed) sed -i "s/^set(ARCH_FLAGS.*/set(ARCH_FLAGS \"$CXXFLAGS\")/" cmake/Toolchains/raspberry.armv7.cmake # remove file(READ "/sys/firmware/devicetree/base/compatible" PPSSPP_PI_MODEL) # as it fails when building in a chroot sed -i "/^file(READ .*/d" cmake/Toolchains/raspberry.armv7.cmake # ensure Pi vendor libraries are available for linking of shared library sed -n -i "p; s/^set(CMAKE_EXE_LINKER_FLAGS/set(CMAKE_SHARED_LINKER_FLAGS/p" cmake/Toolchains/raspberry.armv?.cmake # fix missing defines on opengles2 on v1.16.6 lr-ppsspp/ppsspp # fix building with recent SDL_TTF on v1.16.6 for ppsspp if [[ "$md_id" == "ppsspp" && "$(_get_release_ppsspp)" == "v1.16.6" ]]; then applyPatch "${__mod_info[ppsspp/path]%/*}/ppsspp/gles2_fix.diff" applyPatch "${__mod_info[ppsspp/path]%/*}/ppsspp/sdl_ttf_fix_before_1.19.diff" fi } function build_ffmpeg_ppsspp() { cd "$1" local arch if isPlatform "arm"; then if isPlatform "armv6"; then arch="arm" else arch="armv7" fi elif isPlatform "x86"; then if isPlatform "x86_64"; then arch="x86_64"; else arch="x86"; fi elif isPlatform "aarch64"; then arch="aarch64" fi # force to arm arch on arm - fixes building on 32bit arm userland with aarch64 kernel isPlatform "arm" && local extra_params='--arch=arm' local MODULES local VIDEO_DECODERS local AUDIO_DECODERS local VIDEO_ENCODERS local AUDIO_ENCODERS local DEMUXERS local MUXERS local PARSERS local GENERAL local OPTS # used by older lr-ppsspp fork # get the ffmpeg configure variables from the ppsspp ffmpeg distributed script source linux_arm.sh # linux_arm.sh has set -e which we need to switch off set +e ./configure $extra_params \ --prefix="./linux/$arch" \ --extra-cflags="-fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300" \ --disable-shared \ --enable-static \ --enable-zlib \ --enable-pic \ --disable-everything \ ${MODULES} \ ${VIDEO_DECODERS} \ ${AUDIO_DECODERS} \ ${VIDEO_ENCODERS} \ ${AUDIO_ENCODERS} \ ${DEMUXERS} \ ${MUXERS} \ ${PARSERS} make clean make install } function build_ppsspp() { local ppsspp_binary="PPSSPPSDL" # build ffmpeg build_ffmpeg_ppsspp "$md_build/ppsspp/ffmpeg" # build ppsspp cd "$md_build/ppsspp" rm -fr "build" && mkdir "build" cd "build" local params=() if isPlatform "videocore"; then if isPlatform "armv6"; then params+=(-DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/raspberry.armv6.cmake -DFORCED_CPU=armv6 -DATOMIC_LIB=atomic) else params+=(-DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/raspberry.armv7.cmake) fi elif isPlatform "mesa"; then params+=(-DUSING_GLES2=ON -DUSING_EGL=OFF) # force arm target on arm platforms to fix building on arm 32bit userland with aarch64 kernel if isPlatform "arm"; then if isPlatform "armv6"; then params+=(-DFORCED_CPU=armv6) else params+=(-DFORCED_CPU=armv7) fi fi elif isPlatform "mali"; then params+=(-DUSING_GLES2=ON -DUSING_FBDEV=ON) # remove -DGL_GLEXT_PROTOTYPES on odroid-xu/tinker to avoid errors due to header prototype differences params+=(-DCMAKE_C_FLAGS="${CFLAGS/-DGL_GLEXT_PROTOTYPES/}") params+=(-DCMAKE_CXX_FLAGS="${CXXFLAGS/-DGL_GLEXT_PROTOTYPES/}") elif isPlatform "tinker"; then params+=(-DCMAKE_TOOLCHAIN_FILE="$md_data/tinker.armv7.cmake") fi isPlatform "vero4k" && params+=(-DCMAKE_TOOLCHAIN_FILE="cmake/Toolchains/vero4k.armv8.cmake") if isPlatform "arm" && ! isPlatform "vulkan"; then params+=(-DARM_NO_VULKAN=ON) fi if isPlatform "vulkan"; then params+=(-DUSE_VULKAN_DISPLAY_KHR=ON) fi if isPlatform "x11"; then params+=(-DUSE_WAYLAND_WSI=ON -DUSING_X11_VULKAN=ON) fi if [[ "$md_id" == "lr-ppsspp" ]]; then params+=(-DLIBRETRO=On) ppsspp_binary="lib/ppsspp_libretro.so" fi params+=(-DUSE_SYSTEM_SNAPPY=ON -DUSE_SYSTEM_ZSTD=ON -DUSE_SYSTEM_LIBZIP=ON -DUSE_SYSTEM_LIBSDL2=ON -DUSE_SYSTEM_ZSTD=ON -DUSE_SYSTEM_MINIUPNPC=ON) params+=(-DUSE_DISCORD=OFF) cmake "${params[@]}" .. make clean make md_ret_require="$md_build/ppsspp/build/$ppsspp_binary" } function install_ppsspp() { md_ret_files=( 'ppsspp/build/assets' 'ppsspp/build/PPSSPPSDL' ) } function configure_ppsspp() { local extra_params=() if ! isPlatform "x11"; then extra_params+=(--fullscreen) fi mkRomDir "psp" if [[ "$md_mode" == "install" ]]; then moveConfigDir "$home/.config/ppsspp" "$md_conf_root/psp" mkUserDir "$md_conf_root/psp/PSP" ln -snf "$romdir/psp" "$md_conf_root/psp/PSP/GAME" fi addEmulator 0 "$md_id" "psp" "pushd $md_inst; $md_inst/PPSSPPSDL ${extra_params[*]} %ROM%; popd" addSystem "psp" # if we are removing the last remaining psp emu - remove the symlink if [[ "$md_mode" == "remove" ]]; then if [[ -h "$home/.config/ppsspp" && ! -f "$md_conf_root/psp/emulators.cfg" ]]; then rm -f "$home/.config/ppsspp" fi fi } ================================================ FILE: scriptmodules/emulators/px68k/001-missing-typedef.diff ================================================ diff --git a/win32api/peace.c b/win32api/peace.c index 86989db..8a09337 100755 --- a/win32api/peace.c +++ b/win32api/peace.c @@ -69,8 +69,8 @@ enum { HTYPE_CONSOLE, HTYPE_KEY, }; -#ifdef _WIN32 typedef unsigned int u_int; +#ifdef _WIN32 #define bzero(s,d) memset(s,0,d) #endif struct internal_handle { ================================================ FILE: scriptmodules/emulators/px68k.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="px68k" rp_module_desc="SHARP X68000 Emulator" rp_module_help="You need to copy a X68000 bios file (iplrom30.dat, iplromco.dat, iplrom.dat, or iplromxv.dat), and the font file (cgrom.dat or cgrom.tmp) to $biosdir/keropi. Use F12 to access the in emulator menu." rp_module_repo="git https://github.com/TurtleBazooka/px68k.git master" rp_module_section="exp" rp_module_flags="sdl2" function depends_px68k() { local depends=(cmake libsdl2-dev libsdl2-ttf-dev) # MIDI support is through Fluidsynth, but it needs version 2 of the library [[ "$__os_debian_ver" -gt 10 ]] && depends+=(libfluidsynth-dev timgm6mb-soundfont) getDepends "${depends[@]}" } function sources_px68k() { gitPullOrClone applyPatch "$md_data/001-missing-typedef.diff" } function build_px68k() { local has_fluid [[ "$__os_debian_ver" -gt 10 ]] && has_fluid="FLUID=1" make clean make CDEBUGFLAGS="$CFLAGS -DNO_MERCURY -DSDL2" SDL2=1 $has_fluid md_ret_require="$md_build/px68k.sdl2" } function install_px68k() { md_ret_files=( 'px68k.sdl2' 'readme.txt' 'README.md' 'version.txt' ) } function configure_px68k() { mkRomDir "x68000" moveConfigDir "$home/.keropi" "$md_conf_root/x68000" mkUserDir "$biosdir/keropi" local bios for bios in cgrom.dat iplrom30.dat iplromco.dat iplrom.dat iplromxv.dat; do if [[ -f "$biosdir/$bios" ]]; then mv "$biosdir/$bios" "$biosdir/keropi/$bios" fi ln -sf "$biosdir/keropi/$bios" "$md_conf_root/x68000/$bios" done addEmulator 1 "$md_id" "x68000" "$md_inst/px68k.sdl2 %ROM%" addSystem "x68000" [[ "$md_mode" == "remove" ]] && return # generate a minimal config file when no configuration is present local conf="$md_conf_root/x68000/config" if [[ ! -f "$conf" ]]; then echo "[WinX68k]" > "$conf" echo "StartDir=$romdir/x68000" >> "$conf" echo "MenuLanguage=1" >> "$conf" # anything non-zero means US # when fluidsynth is enabled, add the soundfont path [[ "$__os_debian_ver" -gt 10 ]] && echo "SoundFontFile=/usr/share/sounds/sf2/TimGM6mb.sf2" >> "$conf" fi chown "$__user":"$__group" "$conf" } ================================================ FILE: scriptmodules/emulators/quasi88/01_cmake.diff ================================================ diff --git a/CMakeLists.txt b/CMakeLists.txt index 83c52bc..98deb4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,7 +229,7 @@ if(ENABLE_SDL) add_definitions(-DQUASI88_SDL) find_package(SDL2 CONFIG REQUIRED) - list(APPEND SDL_LIBS SDL2::SDL2 SDL2::SDL2main) + list(APPEND SDL_LIBS ${SDL2_LIBRARIES}) list(APPEND SDL_INCLUDES src/SDL ) @@ -257,6 +257,7 @@ if(ENABLE_SDL) ) target_include_directories(${PROJECT_NAME}.sdl PRIVATE ${SDL_INCLUDES}) target_link_libraries(${PROJECT_NAME}.sdl ${COMMON_LIBS} ${SDL_LIBS}) + target_link_libraries(${PROJECT_NAME}.sdl $<$,$,9.0>>:stdc++fs>) #### macOS needs rpath set if using a Framework if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") ================================================ FILE: scriptmodules/emulators/quasi88.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="quasi88" rp_module_desc="NEC PC-8801 emulator" rp_module_help="ROM Extensions: .d88 .88d .cmt .t88\n\nCopy your pc88 games to to $romdir/pc88\n\nCopy bios files FONT.ROM, N88.ROM, N88KNJ1.ROM, N88KNJ2.ROM, and N88SUB.ROM to $biosdir/pc88" rp_module_repo="git https://github.com/winterheart/quasi88.git master" rp_module_licence="BSD https://raw.githubusercontent.com/winterheart/quasi88/master/LICENSE.txt" rp_module_section="exp" rp_module_flags="sdl2" function depends_quasi88() { getDepends cmake libsdl2-dev libfmt-dev libspdlog-dev } function sources_quasi88() { gitPullOrClone applyPatch "$md_data/01_cmake.diff" } function build_quasi88() { rm -fr build mkdir -p build && pushd build cmake -DROMDIR="$biosdir/pc88" -DDISKDIR="$romdir/pc88" -DTAPEDIR="$romdir/pc88" .. make popd } function install_quasi88() { md_ret_files=( "build/quasi88.sdl" "document" "LICENSE.txt" "README.md" "ChangeLog.md" ) } function configure_quasi88() { mkRomDir "pc88" moveConfigDir "$home/.quasi88" "$md_conf_root/pc88" mkUserDir "$biosdir/pc88" addEmulator 1 "$md_id" "pc88" "$md_inst/quasi88.sdl -f6 IMAGE-NEXT1 -f7 IMAGE-NEXT2 -f8 NOWAIT -f9 ROMAJI -f10 NUMLOCK -fullscreen %ROM%" addSystem "pc88" [[ "$mode" == "remove" ]] && return # add a minimal configuration file local conf="$md_conf_root/pc88/quasi88.ini" if [[ ! -f "$conf" ]]; then cat > "$conf" << EOF -auto_mouse -nostatus -double -english -use_joy -verbose 1 -romdir "$biosdir/pc88" -diskdir "$romdir/pc88" -tapedir "$romdir/pc88" EOF chown "$__user":"$__group" "$conf" fi } ================================================ FILE: scriptmodules/emulators/redream.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="redream" rp_module_desc="Redream Dreamcast emulator" rp_module_help="ROM Extensions: .cdi .cue .chd .gdi .iso\n\nCopy your Dreamcast roms to $romdir/dreamcast" rp_module_licence="PROP" rp_module_section="exp" rp_module_flags="noinstclean !all gles31 aarch64 x86_64" function __binary_url_redream() { local platf="universal-raspberry" isPlatform "x86_64" && platf="x86_64" local url="https://redream.io/download/redream.${platf}-linux-latest.tar.gz" echo "$url" } function install_bin_redream() { downloadAndExtract "$(__binary_url_redream)" "$md_inst" } function configure_redream() { mkRomDir "dreamcast" addEmulator 1 "$md_id" "dreamcast" "$md_inst/redream %ROM%" addSystem "dreamcast" [[ "$md_mode" == "remove" ]] && return chown -R "$__user":"$__group" "$md_inst" local dest="$md_conf_root/dreamcast/redream" mkUserDir "$dest" # symlinks configs and cache moveConfigFile "$md_inst/redream.cfg" "$dest/redream.cfg" moveConfigDir "$md_inst/cache" "$dest/cache" moveConfigDir "$md_inst/saves" "$dest/saves" moveConfigDir "$md_inst/states" "$dest/states" # copy / symlink vmus (memory cards) local i for i in 0 1 2 3; do moveConfigFile "$md_inst/vmu$i.bin" "$dest/vmu$i.bin" done # symlink bios files to libretro core install locations mkUserDir "$biosdir/dc" ln -sf "$biosdir/dc/dc_boot.bin" "$md_inst/boot.bin" ln -sf "$biosdir/dc/dc_flash.bin" "$md_inst/flash.bin" } ================================================ FILE: scriptmodules/emulators/reicast/0001-enable-rpi4-sdl2-target.patch ================================================ diff --git a/shell/linux/Makefile b/shell/linux/Makefile index 96c2e58..a975698 100644 --- a/shell/linux/Makefile +++ b/shell/linux/Makefile @@ -185,9 +185,13 @@ else ifneq (,$(findstring lincpp,$(platform))) else ifneq (,$(findstring rpi4,$(platform))) CFLAGS += -D TARGET_BEAGLE -D TARGET_LINUX_ARMELv7 -DARM_HARDFP -fsingle-precision-constant - CFLAGS += -DGLES3 + ifneq (,$(findstring sdl,$(platform))) + USE_SDL := 1 + else + CFLAGS += -DGLES3 + USE_X11 := 1 + endif - USE_X11 := 1 USE_GLES := 1 MFLAGS += -march=armv8-a+crc -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard ================================================ FILE: scriptmodules/emulators/reicast/0002-enable-vsync.patch ================================================ diff --git a/core/sdl/sdl.cpp b/core/sdl/sdl.cpp index 6dc0eea..c161fa1 100644 --- a/core/sdl/sdl.cpp +++ b/core/sdl/sdl.cpp @@ -272,6 +272,8 @@ void sdl_window_create() bool gl_init(void* wind, void* disp) { SDL_GL_MakeCurrent(window, glcontext); + SDL_GL_SetSwapInterval(1); + #ifdef GLES return true; #else ================================================ FILE: scriptmodules/emulators/reicast/0003-fix-sdl2-sighandler-conflict.patch ================================================ diff --git a/core/linux-dist/main.cpp b/core/linux-dist/main.cpp index aa29515..f53c871 100644 --- a/core/linux-dist/main.cpp +++ b/core/linux-dist/main.cpp @@ -374,6 +374,9 @@ int main(int argc, wchar* argv[]) printf("Data dir is: %s\n", get_writable_data_path("/").c_str()); #if defined(USE_SDL) + // bypass SDL internal signal handlers due to conflict with reicast handlers + SDL_SetHint(SDL_HINT_NO_SIGNAL_HANDLERS, "1"); + if (SDL_Init(0) != 0) { die("SDL: Initialization failed!"); @@ -410,6 +413,10 @@ int main(int argc, wchar* argv[]) x11_window_destroy(); #endif + #if defined(USE_SDL) + SDL_Quit(); + #endif + return 0; } #endif diff --git a/core/linux/common.cpp b/core/linux/common.cpp index 26449cb..fd73602 100644 --- a/core/linux/common.cpp +++ b/core/linux/common.cpp @@ -1,6 +1,8 @@ #include "types.h" #include "cfg/cfg.h" +extern void dc_exit(); + #if HOST_OS==OS_LINUX || HOST_OS == OS_DARWIN #if HOST_OS == OS_DARWIN #define _XOPEN_SOURCE 1 @@ -195,7 +197,8 @@ void common_linux_setup() enable_runfast(); install_fault_handler(); - signal(SIGINT, exit); + signal(SIGINT, dc_exit); + signal(SIGTERM, dc_exit); settings.profile.run_counts=0; ================================================ FILE: scriptmodules/emulators/reicast/reicast.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # AUDIO="$1" ROM="$2" XRES="$3" YRES="$4" rootdir="/opt/retropie" configdir="$rootdir/configs" biosdir="$HOME/RetroPie/BIOS/dc" source "$rootdir/lib/inifuncs.sh" if [[ ! -f "$biosdir/dc_boot.bin" ]]; then dialog --no-cancel --pause "You need to copy the Dreamcast BIOS files (dc_boot.bin and dc_flash.bin) to the folder $biosdir to boot the Dreamcast emulator." 22 76 15 exit 1 fi params=(-config config:homedir=$HOME -config x11:fullscreen=1) [[ -n "$XRES" ]] && params+=(-config x11:width=$XRES -config x11:height=$YRES) [[ -n "$AUDIO" ]] && params+=(-config audio:backend=$AUDIO -config audio:disable=0) [[ -n "$ROM" ]] && params+=(-config config:image="$ROM") if [[ "$AUDIO" == "oss" ]]; then aoss "$rootdir/emulators/reicast/bin/reicast" "${params[@]}" else "$rootdir/emulators/reicast/bin/reicast" "${params[@]}" fi ================================================ FILE: scriptmodules/emulators/reicast.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="reicast" rp_module_desc="Dreamcast emulator Reicast" rp_module_help="ROM Extensions: .cdi .gdi\n\nCopy your Dreamcast roms to $romdir/dreamcast\n\nCopy the required BIOS files dc_boot.bin and dc_flash.bin to $biosdir/dc" rp_module_licence="GPL2 https://raw.githubusercontent.com/reicast/reicast-emulator/master/LICENSE" rp_module_repo="git https://github.com/reicast/reicast-emulator.git master" rp_module_section="opt" rp_module_flags="!armv6" function depends_reicast() { local depends=(libsdl2-dev python3-dev python3-pip alsa-oss python3-setuptools libevdev-dev libasound2-dev libudev-dev) isPlatform "vero4k" && depends+=(vero3-userland-dev-osmc) isPlatform "mesa" && depends+=(libgles2-mesa-dev) getDepends "${depends[@]}" isPlatform "vero4k" && pip3 install wheel pip3 install evdev } function sources_reicast() { gitPullOrClone applyPatch "$md_data/0001-enable-rpi4-sdl2-target.patch" applyPatch "$md_data/0002-enable-vsync.patch" applyPatch "$md_data/0003-fix-sdl2-sighandler-conflict.patch" sed -i "s#/usr/bin/env python#/usr/bin/env python3#" shell/linux/tools/reicast-joyconfig.py } function _params_reicast() { local platform local subplatform local params=() # platform-specific params if isPlatform "rpi" && isPlatform "32bit"; then # platform configuration if isPlatform "rpi4"; then platform="rpi4" elif isPlatform "rpi3"; then platform="rpi3" else platform="rpi2" fi # subplatform configuration if isPlatform "rpi4"; then # we need to target SDL with GLES3 disabled for KMSDRM compatibility subplatform="-sdl" elif isPlatform "mesa"; then subplatform="-mesa" fi params+=("platform=${platform}${subplatform}") else # generic flags isPlatform "x11" && params+=("USE_X11=1") isPlatform "kms" || isPlatform "gles" && params+=("USE_GLES=1") isPlatform "kms" || isPlatform "tinker" && params+=("USE_X11=" "HAS_SOFTREND=" "USE_SDL=1") fi echo "${params[*]}" } function build_reicast() { cd shell/linux make $(_params_reicast) clean make $(_params_reicast) md_ret_require="$md_build/shell/linux/reicast.elf" } function install_reicast() { cd shell/linux make $(_params_reicast) PREFIX="$md_inst" install md_ret_files=( 'LICENSE' 'README.md' ) } function configure_reicast() { local backend local backends=(alsa omx oss) local params=("%ROM%") # KMS reqires Xorg context & X/Y res passed. if isPlatform "kms"; then params+=("%XRES%" "%YRES%") fi # copy hotkey remapping start script cp "$md_data/reicast.sh" "$md_inst/bin/" chmod +x "$md_inst/bin/reicast.sh" mkRomDir "dreamcast" # move any old configs to the new location moveConfigDir "$home/.reicast" "$md_conf_root/dreamcast/" # Create home VMU, cfg, and data folders. Copy dc_boot.bin and dc_flash.bin to the ~/.reicast/data/ folder. mkdir -p "$md_conf_root/dreamcast/"{data,mappings} # symlink bios mkUserDir "$biosdir/dc" ln -sf "$biosdir/dc/"{dc_boot.bin,dc_flash.bin} "$md_conf_root/dreamcast/data" # copy default mappings cp "$md_inst/share/reicast/mappings/"*.cfg "$md_conf_root/dreamcast/mappings/" chown -R "$__user":"$__group" "$md_conf_root/dreamcast" if [[ "$md_mode" == "install" ]]; then cat > "$romdir/dreamcast/+Start Reicast.sh" << _EOF_ #!/bin/bash $md_inst/bin/reicast.sh _EOF_ chmod a+x "$romdir/dreamcast/+Start Reicast.sh" chown "$__user":"$__group" "$romdir/dreamcast/+Start Reicast.sh" else rm "$romdir/dreamcast/+Start Reicast.sh" fi if [[ "$md_mode" == "install" ]]; then # possible audio backends: alsa, oss, omx if isPlatform "videocore"; then backends=(omx oss) else backends=(alsa) fi fi # add system(s) for backend in "${backends[@]}"; do addEmulator 1 "${md_id}-audio-${backend}" "dreamcast" "$md_inst/bin/reicast.sh $backend ${params[*]}" done addSystem "dreamcast" addAutoConf reicast_input 1 } function input_reicast() { local temp_file="$(mktemp)" cd "$md_inst/bin" ./reicast-joyconfig -f "$temp_file" >/dev/tty iniConfig " = " "" "$temp_file" iniGet "mapping_name" local mapping_file="$configdir/dreamcast/mappings/evdev_${ini_value//[:>&1 >/dev/tty) [[ -z "$choice" ]] && break case "$choice" in 1) clear input_reicast ;; esac done } ================================================ FILE: scriptmodules/emulators/retroarch/mess2016_libretro.info ================================================ # Software Information display_name = "Mess (MAME 2016)" authors = "MAMEdev" supported_extensions = "zip|chd|7z|cmd" corename = "MAME 2016 (0.174)" license = "GPLv2+" permissions = "" display_version = "0.174" categories = "Emulator" # Hardware Information manufacturer = "Various" systemname = "MESS (various)" systemid = "mame" # Libretro Features supports_no_game = "false" database = "MAME 2016" savestate = "false" savestate_features = "null" cheats = "false" input_descriptors = "false" memory_descriptors = "false" libretro_saves = "false" core_options = "true" core_options_version = "1.0" hw_render = "false" disk_control = "false" notes = "[1] MAME 2016 (0.174) supports MAME save states.|[2] MAME 2016 (0.174) supports extracted MAME cheats.|[3] The BIOS files must be inside the ROM directory.|[4] The same directory with CHD files inside must be inside the ROM directory.|[5] If desired, the ARTWORK, CHEATS, and SAMPLES directories can be|[^] inside the 'SYSTEMDIR\mame' directory.|[6] When saving, the following directories will be created in the 'SAVEDIR\mame'|[^] directory: STATES, NVRAM, INPUT, SNAPS, CFG, MEMCARD, and DIFF." description = "Based on a snapshot of the MAME codebase circa 2016, 'MAME 2016' is compatible with MAME 0.174 ROM sets. MAME is the most compatible emulator in the world, and it can run almost any game from any platform (though running console games through this core requires additional steps). If your device can run the up-to-date MAME - Current core at full speed, most users will have a better experience with that core, while FBNeo is typically a better choice for speed vs accuracy, as long as it supports the game(s) in question. Otherwise, this core is notable as the most recent snapshot core with an unchanging ROM set." ================================================ FILE: scriptmodules/emulators/retroarch/mupen64plus_libretro.info ================================================ # Software Information display_name = "Nintendo - Nintendo 64 (Mupen64Plus-Legacy)" authors = "m4xw|Hacktarux|gonetz|GLideN64 Contributors|Mupen64Plus Team" supported_extensions = "n64|v64|z64|bin|u1" corename = "Mupen64Plus" license = "GPLv2" permissions = "dynarec_optional" display_version = "1.0" categories = "Emulator" # Hardware Information manufacturer = "Nintendo" systemname = "Nintendo 64" systemid = "nintendo_64" # Libretro Features supports_no_game = "false" database = "Nintendo - Nintendo 64" hw_render = "true" required_hw_api = "OpenGL Core >= 3.3 | OpenGL ES >= 2.0" savestate = "true" savestate_features = "serialized" cheats = "true" input_descriptors = "true" memory_descriptors = "true" libretro_saves = "true" core_options = "true" load_subsystem = "true" needs_fullpath = "false" disk_control = "false" is_experimental = "false" description = "The legacy version of the Mupen64Plus N64 emulator, ported to libretro. It uses the GLideN64 plugin as its default graphics plug, though the high-accuracy Angrylion and ParaLLEl-RDP plugins are also available. This core is no longer developed, but it's still useful for low power devices - for other platforms use the Mupen64Plus-Next core" ================================================ FILE: scriptmodules/emulators/retroarch.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="retroarch" rp_module_desc="RetroArch - frontend to the libretro emulator cores - required by all lr-* emulators" rp_module_licence="GPL3 https://raw.githubusercontent.com/libretro/RetroArch/master/COPYING" rp_module_repo="git https://github.com/retropie/RetroArch.git retropie-v1.19.0" rp_module_section="core" function depends_retroarch() { local depends=(libudev-dev libxkbcommon-dev libsdl2-dev libasound2-dev libusb-1.0-0-dev) isPlatform "dispmanx" && depends+=(libraspberrypi-dev) isPlatform "gles" && ! isPlatform "vero4k" && depends+=(libgles2-mesa-dev) isPlatform "mesa" && depends+=(libx11-xcb-dev) isPlatform "mali" && depends+=(mali-fbdev) isPlatform "x11" && depends+=(libx11-xcb-dev libpulse-dev) isPlatform "vulkan" && depends+=(libvulkan-dev mesa-vulkan-drivers) isPlatform "vero4k" && depends+=(vero3-userland-dev-osmc zlib1g-dev libfreetype6-dev) isPlatform "kms" && depends+=(libgbm-dev) if [[ "$__os_debian_ver" -ge 9 ]]; then depends+=(libavcodec-dev libavformat-dev libavdevice-dev) fi getDepends "${depends[@]}" } function sources_retroarch() { gitPullOrClone } function build_retroarch() { local params=(--disable-sdl --enable-sdl2 --disable-oss --disable-al --disable-jack --disable-qt --enable-builtinmbedtls) if ! isPlatform "x11"; then params+=(--disable-pulse) ! isPlatform "mesa" && params+=(--disable-x11) fi if [[ "$__os_debian_ver" -lt 9 ]]; then params+=(--disable-ffmpeg) fi isPlatform "gles" && params+=(--enable-opengles) if isPlatform "gles3"; then params+=(--enable-opengles3) isPlatform "gles31" && params+=(--enable-opengles3_1) isPlatform "gles32" && params+=(--enable-opengles3_2) fi isPlatform "videocore" && params+=(--disable-crtswitchres) isPlatform "rpi" && isPlatform "mesa" && params+=(--disable-videocore) # Temporarily block dispmanx support for fkms until upstream support is fixed isPlatform "dispmanx" && ! isPlatform "kms" && params+=(--enable-dispmanx --disable-opengl1) isPlatform "mali" && params+=(--enable-mali_fbdev) isPlatform "kms" && params+=(--enable-kms --enable-egl) isPlatform "arm" && params+=(--enable-floathard) isPlatform "neon" && params+=(--enable-neon) isPlatform "vulkan" && params+=(--enable-vulkan) || params+=(--disable-vulkan) ! isPlatform "x11" && params+=(--disable-wayland) isPlatform "vero4k" && params+=(--enable-mali_fbdev --with-opengles_libs='-L/opt/vero3/lib') ./configure --prefix="$md_inst" "${params[@]}" make clean make md_ret_require="$md_build/retroarch" } function install_retroarch() { make install md_ret_files=( 'retroarch.cfg' ) } function update_shaders_retroarch() { local dir="$configdir/all/retroarch/shaders" local branch="" isPlatform "rpi" && branch="rpi" # remove if not git repository for fresh checkout [[ ! -d "$dir/.git" ]] && rm -rf "$dir" gitPullOrClone "$dir" https://github.com/RetroPie/common-shaders.git "$branch" chown -R "$__user":"$__group" "$dir" } function update_overlays_retroarch() { local dir="$configdir/all/retroarch/overlay" # remove if not a git repository for fresh checkout [[ ! -d "$dir/.git" ]] && rm -rf "$dir" gitPullOrClone "$dir" https://github.com/libretro/common-overlays.git chown -R "$__user":"$__group" "$dir" } function update_joypad_autoconfigs_retroarch() { gitPullOrClone "$md_build/autoconfigs" https://github.com/libretro/retroarch-joypad-autoconfig.git cp -a "$md_build/autoconfigs/." "$md_inst/autoconfig-presets/" } function update_assets_retroarch() { local dir="$configdir/all/retroarch/assets" # remove if not a git repository for fresh checkout [[ ! -d "$dir/.git" ]] && rm -rf "$dir" gitPullOrClone "$dir" https://github.com/libretro/retroarch-assets.git chown -R "$__user":"$__group" "$dir" } function update_core_info_retroarch() { local dir="$configdir/all/retroarch/cores" # remove if not a git repository and do a fresh checkout [[ ! -d "$dir/.git" ]] && rm -fr "$dir" # remove our locally generated `.info` files, just in case upstream adds them [[ -d "$dir/.git" ]] && git -C "$dir" clean -q -f "*.info" gitPullOrClone "$dir" https://github.com/libretro/libretro-core-info.git # add our info files for cores not included in the upstream repo cp --update "$md_data"/*.info "$dir" chown -R "$__user":"$__group" "$dir" } function install_minimal_assets_retroarch() { local dir="$configdir/all/retroarch/assets" [[ -d "$dir/.git" ]] && return [[ ! -d "$dir" ]] && mkUserDir "$dir" downloadAndExtract "$__binary_base_url/retroarch-minimal-assets.tar.gz" "$dir" chown -R "$__user":"$__group" "$dir" } function _package_minimal_assets_retroarch() { gitPullOrClone "$md_build/assets" https://github.com/libretro/retroarch-assets.git mkdir -p "$__tmpdir/archives" local archive="$__tmpdir/archives/retroarch-minimal-assets.tar.gz" rm -f "$archive" tar cvzf "$archive" -C "$md_build/assets" ozone menu_widgets xmb/monochrome } function configure_retroarch() { [[ "$md_mode" == "remove" ]] && return addUdevInputRules # move / symlink the retroarch configuration moveConfigDir "$home/.config/retroarch" "$configdir/all/retroarch" # move / symlink our old retroarch-joypads folder moveConfigDir "$configdir/all/retroarch-joypads" "$configdir/all/retroarch/autoconfig" # move / symlink old assets / overlays and shader folder moveConfigDir "$md_inst/assets" "$configdir/all/retroarch/assets" moveConfigDir "$md_inst/overlays" "$configdir/all/retroarch/overlay" moveConfigDir "$md_inst/shader" "$configdir/all/retroarch/shaders" # install shaders by default update_shaders_retroarch # install minimal assets install_minimal_assets_retroarch # install core info files update_core_info_retroarch # install joypad autoconfig presets update_joypad_autoconfigs_retroarch local config="$(mktemp)" cp "$md_inst/retroarch.cfg" "$config" # query ES A/B key swap configuration local es_swap="false" getAutoConf "es_swap_a_b" && es_swap="true" # configure default options iniConfig " = " '"' "$config" iniSet "cache_directory" "/tmp/retroarch" iniSet "system_directory" "$biosdir" iniSet "config_save_on_exit" "false" iniSet "video_aspect_ratio_auto" "true" if ! isPlatform "x86"; then iniSet "video_threaded" "true" fi iniSet "video_font_size" "24" iniSet "core_options_path" "$configdir/all/retroarch-core-options.cfg" iniSet "global_core_options" "true" isPlatform "x11" && iniSet "video_fullscreen" "true" isPlatform "mesa" && iniSet "video_fullscreen" "true" # set default render resolution to 640x480 for rpi1 if isPlatform "videocore" && isPlatform "rpi1"; then iniSet "video_fullscreen_x" "640" iniSet "video_fullscreen_y" "480" fi # enable hotkey ("select" button) iniSet "input_enable_hotkey" "nul" iniSet "input_exit_emulator" "escape" # enable and configure rewind feature iniSet "rewind_enable" "false" iniSet "rewind_buffer_size" "10" iniSet "rewind_granularity" "2" iniSet "input_rewind" "r" # enable gpu screenshots iniSet "video_gpu_screenshot" "true" # enable and configure shaders iniSet "input_shader_next" "m" iniSet "input_shader_prev" "n" # configure keyboard mappings iniSet "input_player1_a" "x" iniSet "input_player1_b" "z" iniSet "input_player1_y" "a" iniSet "input_player1_x" "s" iniSet "input_player1_start" "enter" iniSet "input_player1_select" "rshift" iniSet "input_player1_l" "q" iniSet "input_player1_r" "w" iniSet "input_player1_left" "left" iniSet "input_player1_right" "right" iniSet "input_player1_up" "up" iniSet "input_player1_down" "down" # input settings iniSet "input_autodetect_enable" "true" iniSet "auto_remaps_enable" "true" iniSet "input_joypad_driver" "udev" iniSet "all_users_control_menu" "true" iniSet "remap_save_on_exit" "false" # rgui by default iniSet "menu_driver" "rgui" iniSet "rgui_aspect_ratio_lock" "2" iniSet "rgui_browser_directory" "$romdir" iniSet "rgui_switch_icons" "false" iniSet "menu_rgui_shadows" "true" iniSet "rgui_menu_color_theme" "29" # Tango Dark theme # hide online updater menu options and the restart option iniSet "menu_show_core_updater" "false" iniSet "menu_show_online_updater" "false" iniSet "menu_show_restart_retroarch" "false" # disable the search action iniSet "menu_disable_search_button" "true" # remove some rarely used entries from the quick menu iniSet "quick_menu_show_close_content" "false" iniSet "quick_menu_show_add_to_favorites" "false" iniSet "quick_menu_show_replay" "false" iniSet "quick_menu_show_start_recording" "false" iniSet "quick_menu_show_start_streaming" "false" iniSet "menu_show_overlays" "false" # disable the load notification message with core and game info iniSet "menu_show_load_content_animation" "false" # disable core cache file iniSet "core_info_cache_enable" "false" # disable game runtime logging iniSet "content_runtime_log" "false" # disable unnecessary xmb menu tabs iniSet "xmb_show_add" "false" iniSet "xmb_show_history" "false" iniSet "xmb_show_images" "false" iniSet "xmb_show_music" "false" # disable xmb menu driver icon shadows iniSet "xmb_shadows_enable" "false" # swap A/B buttons based on ES configuration iniSet "menu_swap_ok_cancel_buttons" "$es_swap" # enable menu_unified_controls by default (see below for more info) iniSet "menu_unified_controls" "true" # disable 'press twice to quit' iniSet "quit_press_twice" "false" # enable video shaders iniSet "video_shader_enable" "true" # enable overlays by default iniSet "input_overlay_enable" "true" # disable save paths under sub-folders iniSet "sort_savestates_enable" "false" iniSet "sort_savefiles_enable" "false" copyDefaultConfig "$config" "$configdir/all/retroarch.cfg" rm "$config" # if no menu_driver is set, force RGUI, as the default has now changed to XMB. _set_config_option_retroarch "menu_driver" "rgui" # set RGUI aspect ratio to "Integer Scaling" to prevent stretching _set_config_option_retroarch "rgui_aspect_ratio_lock" "2" # if no menu_unified_controls is set, force it on so that keyboard player 1 can control # the RGUI menu which is important for arcade sticks etc that map to keyboard inputs _set_config_option_retroarch "menu_unified_controls" "true" # disable `quit_press_twice` on existing configs _set_config_option_retroarch "quit_press_twice" "false" # enable video shaders on existing configs _set_config_option_retroarch "video_shader_enable" "true" # (compat) keep all core options in a single file _set_config_option_retroarch "global_core_options" "true" # disable the content load info popup with core and game info _set_config_option_retroarch "menu_show_load_content_animation" "false" # disable search action _set_config_option_retroarch "menu_disable_search_button" "true" # don't save input remaps by default _set_config_option_retroarch "remap_save_on_exit" "false" # enable overlays by default on upgrades _set_config_option_retroarch "input_overlay_enable" "true" # don't sort save files in sub-folders _set_config_option_retroarch "sort_savefiles_enable" "false" _set_config_option_retroarch "sort_savestates_enable" "false" # remapping hack for old 8bitdo firmware addAutoConf "8bitdo_hack" 0 } function keyboard_retroarch() { if [[ ! -f "$configdir/all/retroarch.cfg" ]]; then printMsgs "dialog" "No RetroArch configuration file found at $configdir/all/retroarch.cfg" return fi local input local options local i=1 local key=() while read input; do local parts=($input) key+=("${parts[0]}") options+=("${parts[0]}" $i 2 "${parts[*]:2}" $i 26 16 0) ((i++)) done < <(grep "^[[:space:]]*input_player[0-9]_[a-z]*" "$configdir/all/retroarch.cfg") local cmd=(dialog --backtitle "$__backtitle" --form "RetroArch keyboard configuration" 22 48 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then local value local values readarray -t values <<<"$choice" iniConfig " = " '"' "$configdir/all/retroarch.cfg" i=0 for value in "${values[@]}"; do iniSet "${key[$i]}" "$value" >/dev/null ((i++)) done fi } function hotkey_retroarch() { iniConfig " = " '"' "$configdir/all/retroarch.cfg" local cmd=(dialog --backtitle "$__backtitle" --menu "Choose the desired hotkey behaviour." 22 76 16) local options=(1 "Hotkeys enabled. (default)" 2 "Press ALT to enable hotkeys." 3 "Hotkeys disabled. Press ESCAPE to open RGUI.") local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) iniSet "input_enable_hotkey" "nul" iniSet "input_exit_emulator" "escape" iniSet "input_menu_toggle" "F1" ;; 2) iniSet "input_enable_hotkey" "alt" iniSet "input_exit_emulator" "escape" iniSet "input_menu_toggle" "F1" ;; 3) iniSet "input_enable_hotkey" "escape" iniSet "input_exit_emulator" "nul" iniSet "input_menu_toggle" "escape" ;; esac fi } function gui_retroarch() { while true; do local names=(shaders overlays assets) local dirs=(shaders overlay assets) local options=() local name local dir local i=1 for name in "${names[@]}"; do if [[ -d "$configdir/all/retroarch/${dirs[i-1]}/.git" ]]; then options+=("$i" "Manage $name (installed)") else options+=("$i" "Manage $name (not installed)") fi ((i++)) done options+=( 4 "Configure keyboard for use with RetroArch" 5 "Configure keyboard hotkey behaviour for RetroArch" ) local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option" 22 76 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) case "$choice" in 1|2|3) name="${names[choice-1]}" dir="${dirs[choice-1]}" options=(1 "Install/Update $name" 2 "Uninstall $name" ) cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option for $dir" 12 40 06) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) case "$choice" in 1) "update_${name}_retroarch" ;; 2) rm -rf "$configdir/all/retroarch/$dir" [[ "$dir" == "assets" ]] && install_xmb_monochrome_assets_retroarch ;; *) continue ;; esac ;; 4) keyboard_retroarch ;; 5) hotkey_retroarch ;; *) break ;; esac done } # adds a retroarch global config option in `$configdir/all/retroarch.cfg`, if not already set function _set_config_option_retroarch() { local option="$1" local value="$2" iniConfig " = " '"' "$configdir/all/retroarch.cfg" iniGet "$option" if [[ -z "$ini_value" ]]; then iniSet "$option" "$value" fi } ================================================ FILE: scriptmodules/emulators/rpix86.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="rpix86" rp_module_desc="DOS Emulator rpix86" rp_module_help="ROM Extensions: .bat .com .exe .sh\n\nCopy your DOS games to $romdir/pc" rp_module_licence="FREEWARE http://rpix86.patrickaalto.com/rdown.html" rp_module_section="opt" rp_module_flags="!all rpi !kms" function install_bin_rpix86() { downloadAndExtract "$__archive_url/rpix86.tar.gz" "$md_inst" # install 4DOS.com downloadAndExtract "$__archive_url/4dos.zip" "$md_inst" patchVendorGraphics "$md_inst/rpix86" } function configure_rpix86() { mkRomDir "pc" rm -f "$romdir/pc/Start rpix86.sh" "$romdir/pc/+Start.txt" cat > "$romdir/pc/+Start rpix86.sh" << _EOF_ #!/bin/bash params=("\$@") pushd "$md_inst" if [[ "\${params[0]}" == *.sh ]]; then bash "\${params[@]}" else ./rpix86 -a0 -f2 "\${params[@]}" fi popd _EOF_ chmod +x "$romdir/pc/+Start rpix86.sh" chown "$__user":"$__group" "$romdir/pc/+Start rpix86.sh" ln -sfn "$romdir/pc" games addEmulator 0 "$md_id" "pc" "bash $romdir/pc/+Start\ rpix86.sh %ROM%" addSystem "pc" } ================================================ FILE: scriptmodules/emulators/scummvm-sdl1.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="scummvm-sdl1" rp_module_desc="ScummVM - built with legacy SDL1 support." rp_module_help="Copy your ScummVM games to $romdir/scummvm" rp_module_licence="GPL2 https://raw.githubusercontent.com/scummvm/scummvm/master/COPYING" rp_module_repo="git https://github.com/scummvm/scummvm.git v2026.1.0" rp_module_section="opt" rp_module_flags="sdl1 !mali !x11 !kms" function depends_scummvm-sdl1() { depends_scummvm } function sources_scummvm-sdl1() { # sources_scummvm() expects $md_data to be ../scummvm # the following only modifies $md_data for the function call md_data="$(dirname $md_data)/scummvm" sources_scummvm } function build_scummvm-sdl1() { build_scummvm } function install_scummvm-sdl1() { install_scummvm } function configure_scummvm-sdl1() { # use dispmanx by default on rpi with fkms isPlatform "dispmanx" && ! isPlatform "videocore" && setBackend "$md_id" "dispmanx" configure_scummvm } ================================================ FILE: scriptmodules/emulators/scummvm.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="scummvm" rp_module_desc="ScummVM" rp_module_help="Copy your ScummVM games to $romdir/scummvm" rp_module_licence="GPL3 https://raw.githubusercontent.com/scummvm/scummvm/master/COPYING" rp_module_repo="git https://github.com/scummvm/scummvm.git v2026.1.0" rp_module_section="opt" rp_module_flags="sdl2" function depends_scummvm() { local depends=( liba52-0.7.4-dev libmpeg2-4-dev libogg-dev libvorbis-dev libenet-dev libflac-dev libgif-dev libmad0-dev libpng-dev libtheora-dev libfaad-dev libfluidsynth-dev libfreetype6-dev zlib1g-dev libjpeg-dev libasound2-dev libcurl4-openssl-dev libmikmod-dev libvpx-dev ) if isPlatform "vero4k"; then depends+=(vero3-userland-dev-osmc) fi if [[ "$md_id" == "scummvm-sdl1" ]]; then depends+=(libsdl1.2-dev) else depends+=(libsdl2-dev) fi getDepends "${depends[@]}" } function sources_scummvm() { gitPullOrClone } function build_scummvm() { rpSwap on 750 local params=( --prefix="$md_inst" --enable-release --enable-vkeybd --disable-debug --disable-eventrecorder --disable-sonivox --disable-updates --disable-discord --disable-imgui --disable-gtk ) isPlatform "rpi" && [[ "$md_id" == "scummvm-sdl1" ]] && params+=(--opengl-mode=none) if [[ "$md_id" == "scummvm-sdl1" ]]; then SDL_CONFIG=sdl-config ./configure "${params[@]}" else ./configure "${params[@]}" fi make clean make strip "$md_build/scummvm" rpSwap off md_ret_require="$md_build/scummvm" } function install_scummvm() { make install mkdir -p "$md_inst/extra" cp -v backends/vkeybd/packs/vkeybd_*.zip "$md_inst/extra" } function configure_scummvm() { mkRomDir "scummvm" local dir for dir in .config .local/share; do moveConfigDir "$home/$dir/scummvm" "$md_conf_root/scummvm" done # Create startup script rm -f "$romdir/scummvm/+Launch GUI.sh" local name="ScummVM" [[ "$md_id" == "scummvm-sdl1" ]] && name="ScummVM-SDL1" cat > "$romdir/scummvm/+Start $name.sh" << _EOF_ #!/bin/bash game="\$1" pushd "$romdir/scummvm" >/dev/null if ! grep -qs extrapath "\$HOME/.config/scummvm/scummvm.ini"; then params="--extrapath="$md_inst/extra"" fi $md_inst/bin/scummvm --fullscreen \$params --joystick=0 "\$game" while read id desc; do echo "\$desc" > "$romdir/scummvm/\$id.svm" done < <($md_inst/bin/scummvm --list-targets | tail -n +3) popd >/dev/null _EOF_ chown "$__user":"$__group" "$romdir/scummvm/+Start $name.sh" chmod u+x "$romdir/scummvm/+Start $name.sh" addEmulator 1 "$md_id" "scummvm" "bash $romdir/scummvm/+Start\ $name.sh %BASENAME%" addSystem "scummvm" } ================================================ FILE: scriptmodules/emulators/sdltrs.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="sdltrs" rp_module_desc="Radio Shack TRS-80 Model I/III/4/4P emulator" rp_module_help="ROM Extension: .dsk\n\nCopy your TRS-80 games to $romdir/trs-80\n\nCopy the required BIOS file level2.rom, level3.rom, level4.rom or level4p.rom to $biosdir" rp_module_section="exp" rp_module_licence="BSD https://gitlab.com/jengun/sdltrs/-/raw/master/LICENSE" rp_module_repo="git https://gitlab.com/jengun/sdltrs.git sdl2" rp_module_flags="" function depends_sdltrs() { getDepends libsdl2-dev libreadline-dev } function sources_sdltrs() { gitPullOrClone } function build_sdltrs() { make clean ./autogen.sh ./configure --prefix="$md_inst" make md_ret_require="$md_build/sdl2trs" } function install_sdltrs() { md_ret_files=( 'sdl2trs' 'README.md' 'LICENSE' ) } function configure_sdltrs() { local common_args mkRomDir "trs-80" common_args="-fullscreen -nomousepointer -showled" addEmulator 1 "$md_id-model1" "trs-80" "$md_inst/sdl2trs $common_args -m1 -romfile $biosdir/level2.rom -disk0 %ROM%" addEmulator 0 "$md_id-model3" "trs-80" "$md_inst/sdl2trs $common_args -m3 -romfile3 $biosdir/level3.rom -disk0 %ROM%" addEmulator 0 "$md_id-model4" "trs-80" "$md_inst/sdl2trs $common_args -m4 -romfile3 $biosdir/level4.rom -disk0 %ROM%" addEmulator 0 "$md_id-model4p" "trs-80" "$md_inst/sdl2trs $common_args -m4p -romfile4p $biosdir/level4p.rom -disk0 %ROM%" addSystem "trs-80" [[ "$md_mode" == "remove" ]] && return # Migrate settings from the previous version if [[ -h "$home/sdltrs.t8c" || -f "$home/sdltrs.t8c" ]]; then mv "$(readlink -f "$home/sdltrs.t8c")" "$home/.sdltrs.t8c" fi local config config="$(mktemp)" iniConfig "=" "" "$config" iniSet "statedir" "$romdir/trs-80" iniSet "diskdir" "$romdir/trs-80" iniSet "cassdir" "$romdir/trs-80" iniSet "disksetdir" "$romdir/trs-80" iniSet "harddir" "$romdir/trs-80" copyDefaultConfig "$config" "$md_conf_root/trs-80/sdltrs.t8c" moveConfigFile "$home/.sdltrs.t8c" "$md_conf_root/trs-80/sdltrs.t8c" } ================================================ FILE: scriptmodules/emulators/simcoupe.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="simcoupe" rp_module_desc="SimCoupe SAM Coupe emulator" rp_module_help="ROM Extensions: .dsk .mgt .sbt .sad\n\nCopy your SAM Coupe games to $romdir/samcoupe." rp_module_licence="GPL2 https://raw.githubusercontent.com/simonowen/simcoupe/master/License.txt" rp_module_repo="git https://github.com/simonowen/simcoupe.git :_get_branch_simcoupe" rp_module_section="opt" rp_module_flags="" function _get_branch_simcoupe() { local branch="main" # latest simcoupe requires cmake 3.14 - on Stretch older versions throw a cmake error about CXX17 # dialect support but actually seem to build ok. Lock systems with older cmake to 20200711 tag, # which builds ok on Raspbian Stretch, and systems with cmake 3.12 to 20210501, which builds ok on Ubuntu 18.04. # Test using "apt-cache madison" as this code could be called when cmake isn't yet installed but correct version # is available - eg via update check with builder module which removes dependencies after building. # Multiple versions may be available, so grab the versions via cut, sort by version, take the latest from the top # and pipe to xargs to strip whitespace local cmake_ver=$(apt-cache madison cmake | cut -d\| -f2 | sort --version-sort | head -1 | xargs) if compareVersions "$cmake_ver" lt 3.8.2; then branch="20200711" elif compareVersions "$cmake_ver" lt 3.14; then branch="20210501" fi echo "$branch" } function depends_simcoupe() { getDepends cmake libsdl2-dev zlib1g-dev libbz2-dev libspectrum-dev } function sources_simcoupe() { gitPullOrClone } function build_simcoupe() { cmake -DCMAKE_INSTALL_PREFIX="$md_inst" . # force the downloaded 'SAAsound' dependency to be statically linked sed -i 's/ SHARED//' _deps/saasound-src/CMakeLists.txt make clean make md_ret_require="$md_build/simcoupe" } function install_simcoupe() { make install } function configure_simcoupe() { mkRomDir "samcoupe" moveConfigDir "$home/.simcoupe" "$md_conf_root/$md_id" addEmulator 1 "$md_id" "samcoupe" "pushd $md_inst; $md_inst/bin/simcoupe autoboot -disk1 %ROM% -fullscreen; popd" addSystem "samcoupe" } ================================================ FILE: scriptmodules/emulators/snes9x.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="snes9x" rp_module_desc="SNES emulator SNES9X-RPi" rp_module_help="ROM Extensions: .bin .smc .sfc .fig .swc .mgd .zip\n\nCopy your SNES roms to $romdir/snes" rp_module_licence="NONCOM https://raw.githubusercontent.com/RetroPie/snes9x-rpi/master/snes9x.h" rp_module_repo="git https://github.com/RetroPie/snes9x-rpi.git retropie" rp_module_section="opt" rp_module_flags="sdl1 !all videocore" function depends_snes9x() { getDepends libsdl1.2-dev libboost-thread-dev libboost-system-dev libsdl-ttf2.0-dev libasound2-dev } function sources_snes9x() { gitPullOrClone } function build_snes9x() { make clean make md_ret_require="$md_build/snes9x" } function install_snes9x() { md_ret_files=( 'changes.txt' 'hardware.txt' 'problems.txt' 'readme.txt' 'README.md' 'snes9x' ) } function configure_snes9x() { mkRomDir "snes" isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" addEmulator 0 "$md_id" "snes" "$md_inst/snes9x %ROM%" addSystem "snes" } ================================================ FILE: scriptmodules/emulators/stella.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="stella" rp_module_desc="Atari2600 emulator STELLA" rp_module_help="ROM Extensions: .a26 .bin .rom .zip .gz\n\nCopy your Atari 2600 roms to $romdir/atari2600" rp_module_licence="GPL2 https://raw.githubusercontent.com/stella-emu/stella/master/License.txt" rp_module_repo="git https://github.com/stella-emu/stella.git :_get_version_stella" rp_module_section="opt" rp_module_flags="" function _get_version_stella() { if [[ "$__gcc_version" -lt 11 ]]; then echo "6.7" else # latest version needs C++-20 support echo "7.0" fi } function depends_stella() { getDepends libsdl2-dev libpng-dev zlib1g-dev } function sources_stella() { gitPullOrClone } function build_stella() { ./configure --prefix="$md_inst" make clean make md_ret_require="$md_build/stella" } function install_stella() { make install } function configure_stella() { mkRomDir "atari2600" moveConfigDir "$home/.config/stella" "$md_conf_root/atari2600/stella" addEmulator 1 "$md_id" "atari2600" "$md_inst/bin/stella -maxres 320x240 -fullscreen 1 -tia.fsfill 1 %ROM%" addSystem "atari2600" } ================================================ FILE: scriptmodules/emulators/stratagus.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="stratagus" rp_module_desc="Stratagus - A strategy game engine to play Warcraft I or II, Starcraft, and some similar open-source games" rp_module_help="Copy your Stratagus games to $romdir/stratagus" rp_module_licence="GPL2 https://raw.githubusercontent.com/Wargus/stratagus/master/COPYING" rp_module_repo="git https://github.com/Wargus/stratagus.git v2.4.3" rp_module_section="opt" rp_module_flags="!mali !kms" function depends_stratagus() { getDepends cmake libsdl1.2-dev libbz2-dev libogg-dev libvorbis-dev libtheora-dev libpng-dev liblua5.1-0-dev libtolua++5.1-dev libfluidsynth-dev libmikmod-dev } function sources_stratagus() { gitPullOrClone } function build_stratagus() { mkdir build cd build cmake -DENABLE_STRIP=ON .. make md_ret_require="$md_build/build/stratagus" } function install_stratagus() { md_ret_files=( 'build/stratagus' 'COPYING' ) } function configure_stratagus() { mkRomDir "stratagus" addEmulator 0 "$md_id" "stratagus" "$md_inst/stratagus -F -d %ROM%" addSystem "stratagus" "Stratagus Strategy Engine" ".wc1 .wc2 .sc .data" } ================================================ FILE: scriptmodules/emulators/supermodel3.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="supermodel3" rp_module_desc="Super Model 3 Emulator" rp_module_help="Copy your Sega Model 3 roms to $romdir/arcade" rp_module_licence="GPL3 https://raw.githubusercontent.com/DirtBagXon/model3emu-code-sinden/main/Docs/LICENSE.txt" rp_module_repo="git https://github.com/DirtBagXon/model3emu-code-sinden.git :_get_branch_supermodel3" rp_module_section="exp" rp_module_flags="all !armv6 !armv7" function _get_branch_supermodel3() { if isPlatform "x86"; then echo "main" else echo "arm" fi } function depends_supermodel3() { local depends=(libsdl2-dev libsdl2-net-dev libxi-dev libglu1-mesa-dev) # on KMS we need x11 to start the emulator isPlatform "kms" && depends+=(xorg matchbox-window-manager) getDepends "${depends[@]}" } function sources_supermodel3() { gitPullOrClone } function build_supermodel3() { make -f Makefiles/Makefile.UNIX clean make -f Makefiles/Makefile.UNIX NET_BOARD=1 VERBOSE=1 ARCH="" OPT="$__default_cflags" md_ret_require="bin/supermodel" } function install_supermodel3() { md_ret_files=( 'bin/supermodel' 'Config' 'Docs/LICENSE.txt' 'Docs/README.txt' ) isPlatform "x86" && md_ret_files+=("Assets") } function configure_supermodel3() { mkRomDir "arcade" addSystem "arcade" local game_args="-vsync" local launch_prefix="" # launch the emulator with an X11 backend, has better scaling and mouse/lightgun support isPlatform "kms" && launch_prefix="XINIT:" addEmulator 0 "$md_id" "arcade" "${launch_prefix}$md_inst/supermodel.sh %ROM% $game_args" addEmulator 0 "$md_id-scaled" "arcade" "${launch_prefix}$md_inst/supermodel.sh %ROM% $game_args -res=%XRES%,%YRES%" if isPlatform "x86"; then # add a legacy3d entry for less powerful PC systems addEmulator 0 "$md_id-legacy3d" "arcade" "$md_inst/supermodel.sh %ROM% -legacy3d $game_args" fi [[ "$md_mode" == "remove" ]] && return local conf_dir="$md_conf_root/arcade/supermodel3" mkUserDir "$conf_dir" mkUserDir "$conf_dir/NVRAM" mkUserDir "$conf_dir/Saves" mkUserDir "$conf_dir/Config" isPlatform "x86" && mkUserDir "$conf_dir/Assets" # on upgrades keep the local config, but overwrite the game configs ! isPlatform "x86" && copyDefaultConfig "$md_inst/Config/Supermodel.ini" "$conf_dir/Config/Supermodel.ini" cp -f "$md_inst/Config/Games.xml" "$conf_dir/Config/" isPlatform "x86" && cp -fr "$md_inst/Assets" "$conf_dir" chown -R "$__user":"$__group" "$conf_dir" cat >"$md_inst/supermodel.sh" <<_EOF_ #!/usr/bin/env bash commands="\${1%.*}.commands" if [[ -f "\$commands" ]]; then params=\$(<"\$commands" tr -d '\r' | tr '\n' ' ') fi pushd $conf_dir $md_inst/supermodel "\$@" \$params popd _EOF_ chmod +x "$md_inst/supermodel.sh" } ================================================ FILE: scriptmodules/emulators/ti99sim/missing_cstring.diff ================================================ --- a/src/core/device-support.cpp +++ b/src/core/device-support.cpp @@ -26,6 +26,7 @@ // //---------------------------------------------------------------------------- +#include #include #include "idevice.hpp" #include "icomputer.hpp" ================================================ FILE: scriptmodules/emulators/ti99sim-sdl1/missing_cstdio.diff ================================================ --- a/include/common.hpp +++ b/include/common.hpp @@ -30,6 +30,7 @@ #define COMMON_HPP_ #include // For definition of size_t +#include //---------------------------------------------------------------------------- // Determine platform & OS ================================================ FILE: scriptmodules/emulators/ti99sim-sdl1.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="ti99sim-sdl1" rp_module_desc="TI-99/SIM - Texas Instruments Home Computer Emulator (SDL1 version)" rp_module_help="ROM Extension: .ctg\n\nCopy your TI-99 games to $romdir/ti99\n\nCopy the required BIOS file TI-994A.ctg (case sensitive) to $biosdir" rp_module_licence="GPL2 http://www.mrousseau.org/programs/ti99sim/" rp_module_repo="file $__archive_url/ti99sim-0.15.0.src.tar.gz" rp_module_section="exp" rp_module_flags="sdl1 !mali" function depends_ti99sim-sdl1() { getDepends libsdl1.2-dev libssl-dev libboost-regex-dev } function sources_ti99sim-sdl1() { downloadAndExtract "$md_repo_url" "$md_build" --strip-components 1 # add missing include to fix compilation on newer g++ applyPatch "$md_data/missing_cstdio.diff" } function build_ti99sim-sdl1() { build_ti99sim } function install_ti99sim-sdl1() { install_ti99sim } function configure_ti99sim-sdl1() { mkRomDir "ti99" addEmulator 0 "$md_id" "ti99" "$md_inst/ti99sim.sh -f %ROM%" addSystem "ti99" [[ "$md_mode" == "remove" ]] && return isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" moveConfigDir "$home/.ti99sim" "$md_conf_root/ti99/" ln -sf "$biosdir/TI-994A.ctg" "$md_inst/TI-994A.ctg" local file="$md_inst/ti99sim.sh" cat >"$file" << _EOF_ #!/bin/bash pushd "$md_inst" ./ti99sim-sdl "\$@" popd _EOF_ chmod +x "$file" } ================================================ FILE: scriptmodules/emulators/ti99sim.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="ti99sim" rp_module_desc="TI-99/SIM - Texas Instruments Home Computer Emulator" rp_module_help="ROM Extension: .ctg\n\nCopy your TI-99 games to $romdir/ti99\n\nCopy the required BIOS file TI-994A.ctg (case sensitive) to $biosdir" rp_module_licence="GPL2 https://www.mrousseau.org/programs/ti99sim" rp_module_repo="file $__archive_url/ti99sim-0.16.0.src.tar.gz" rp_module_section="exp" rp_module_flags="!:\$__gcc_version:-lt:8" function depends_ti99sim() { getDepends libsdl2-dev libssl-dev } function sources_ti99sim() { downloadAndExtract "$md_repo_url" "$md_build" --strip-components 1 # add missing include to fix compilation on newer g++ applyPatch "$md_data/missing_cstring.diff" } function build_ti99sim() { make clean make } function install_ti99sim() { md_ret_files=( 'bin/ti99sim-sdl' 'bin/convert-ctg' 'bin/catalog' 'bin/disk' 'bin/dumpgrom' 'bin/mkcart' 'bin/ti99sim-console' 'doc/COPYING' 'doc/main.css' 'doc/README.html' ) } function configure_ti99sim() { mkRomDir "ti99" addEmulator 1 "$md_id" "ti99" "$md_inst/ti99sim.sh -f %ROM%" addSystem "ti99" [[ "$md_mode" == "remove" ]] && return moveConfigDir "$home/.ti99sim" "$md_conf_root/ti99/" ln -sf "$biosdir/TI-994A.ctg" "$md_inst/TI-994A.ctg" local file="$md_inst/ti99sim.sh" cat >"$file" << _EOF_ #!/bin/bash pushd "$md_inst" ./ti99sim-sdl "\$@" popd _EOF_ chmod +x "$file" } ================================================ FILE: scriptmodules/emulators/uae4all/01_guichan.diff ================================================ diff --git a/src/widget.cpp b/src/widget.cpp index 7dfc7e1..97978a7 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -598,7 +598,8 @@ namespace gcn { if (mFocusHandler == NULL) { - throw GCN_EXCEPTION("No focushandler set (did you add the widget to the gui?)."); + return false; + //throw GCN_EXCEPTION("No focushandler set (isModalFocused: did you add the widget to the gui?)."); } if (getParent() != NULL) @@ -614,7 +615,8 @@ namespace gcn { if (mFocusHandler == NULL) { - throw GCN_EXCEPTION("No focushandler set (did you add the widget to the gui?)."); + return false; + //throw GCN_EXCEPTION("No focushandler set (isModalMouseInputFocused: did you add the widget to the gui?)."); } if (getParent() != NULL) diff --git a/src/widgets/tabbedarea.cpp b/src/widgets/tabbedarea.cpp index e07d14c..5ed9d39 100644 --- a/src/widgets/tabbedarea.cpp +++ b/src/widgets/tabbedarea.cpp @@ -317,6 +317,10 @@ namespace gcn void TabbedArea::logic() { + for (unsigned int i = 0; i < mTabs.size(); i++) + { + mTabs[i].second->logic(); + } } void TabbedArea::adjustSize() ================================================ FILE: scriptmodules/emulators/uae4all.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="uae4all" rp_module_desc="Amiga emulator UAE4All" rp_module_help="ROM Extension: .adf\n\nCopy your Amiga games to $romdir/amiga\n\nCopy the required BIOS files\nkick13.rom\nkick20.rom\nkick31.rom\nto $biosdir/amiga" rp_module_licence="GPL2 https://raw.githubusercontent.com/RetroPie/uae4all2/retropie/copying" rp_module_repo="git https://github.com/RetroPie/uae4all2.git retropie" rp_module_section="opt" rp_module_flags="sdl1 !all videocore" function depends_uae4all() { getDepends libsdl1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsdl-gfx1.2-dev libsdl-ttf2.0-dev } function sources_uae4all() { gitPullOrClone mkdir guichan downloadAndExtract "$__archive_url/guichan-0.8.2.tar.gz" "$md_build/guichan" --strip-components 1 cd guichan # fix from https://github.com/sphaero/guichan applyPatch "$md_data/01_guichan.diff" } function build_uae4all() { pushd guichan make clean ./configure --enable-sdlimage --enable-sdl --disable-allegro --disable-opengl --disable-shared make popd make -f Makefile.pi clean if isPlatform "neon"; then make -f Makefile.pi NEON=1 DEFS="-DUSE_ARMV7 -DUSE_ARMNEON" else make -f Makefile.pi fi md_ret_require="$md_build/uae4all" } function install_uae4all() { unzip -o "AndroidData/guichan26032014.zip" -d "$md_inst" "data/*" unzip -o "AndroidData/data.zip" -d "$md_inst" "data/*" md_ret_files=( 'copying' 'uae4all' 'Readme.txt' 'AndroidData/aros20140110.zip' ) rm -rf "$md_inst/"{blankdisks,roms,conf,customconf,saves} } function configure_uae4all() { mkRomDir "amiga" mkUserDir "$md_conf_root/amiga" mkUserDir "$md_conf_root/amiga/$md_id" # move config / save folders to $md_conf_root/amiga/$md_id local dir for dir in blankdisks conf customconf saves screenshots; do moveConfigDir "$md_inst/$dir" "$md_conf_root/amiga/$md_id/$dir" done # symlink rom dir moveConfigDir "$md_inst/roms" "$romdir/amiga" # and kickstart dir (removing old symlinks first) if [[ ! -h "$md_inst/kickstarts" ]]; then rm -f "$md_inst/kickstarts/"{kick12.rom,kick13.rom,kick20.rom,kick31.rom} fi moveConfigDir "$md_inst/kickstarts" "$biosdir/amiga" rm -f "$romdir/amiga/+Start UAE4All.sh" if [[ "$md_mode" == "install" ]]; then if [[ ! -f "$biosdir/aros-amiga-m68k-ext.bin" ]]; then # unpack aros kickstart unzip -j "aros20140110.zip" -d "$biosdir/amiga" fi cat > "$romdir/amiga/+Start UAE4All.sh" << _EOF_ #!/bin/bash pushd "$md_inst" ./uae4all popd _EOF_ chmod a+x "$romdir/amiga/+Start UAE4All.sh" chown "$__user":"$__group" "$romdir/amiga/+Start UAE4All.sh" isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" else rm -f "$biosdir/aros-amiga-m68k"* fi addEmulator 1 "$md_id" "amiga" "bash $romdir/amiga/+Start\ UAE4All.sh" addSystem "amiga" } ================================================ FILE: scriptmodules/emulators/uae4arm/uae4arm.sh ================================================ #!/bin/bash is_amiberry=0 emulator="./uae4arm" [[ "$is_amiberry" -eq 1 ]] && emulator="./amiberry" pushd "${0%/*}" >/dev/null source "../../lib/archivefuncs.sh" params=() arg="$1" if [[ "$arg" == *.uae ]]; then config="$arg" else rom="$arg" fi shift images=() if [[ "$is_amiberry" -eq 1 ]] && [[ "$rom" == *.lha || "$rom" == *.cue || "$rom" == *.chd ]]; then params+=(--autoload "$rom") elif [[ -n "$rom" ]]; then # check successful extraction and if we have at least one file if archiveExtract "$rom" ".adf .adz .dms .ipf"; then for i in {0..3}; do [[ -n "${arch_files[$i]}" ]] && images+=(-$i "${arch_files[$i]}") done name="${arch_files[0]}" elif [[ -n "$rom" ]]; then name="$rom" # try and find the disk series base="${name##*/}" base="${base%Disk*}" i=0 while read -r disk; do images+=(-$i "$disk") ((i++)) [[ "$i" -eq 4 ]] && break done < <(find "${rom%/*}" -iname "$base*" | sort) [[ "${#images[@]}" -eq 0 ]] && images=(-0 "$rom") fi rom_path="${rom%/*}" rom_name="${rom##*/}" rom_bn="${rom_name%.*}" # check for .uae files with the same base name as the adf/zip in the rom directory and conf if [[ -f "$rom_path/$rom_bn.uae" ]]; then config="$rom_path/$rom_bn.uae" elif [[ -f "conf/$rom_bn.uae" ]]; then config="conf/$rom_bn.uae" # if no config / model parameters are included in the arguments choose a config/model automatically elif [[ "$*" != *-config* && "$*" != *--model* ]]; then # if amiberry choose a model for amiberry based on the rom filename if [[ "$is_amiberry" -eq 1 ]]; then model="A500" case "$name" in *ECS*) model="A500P" ;; *AGA*) model="A1200" ;; *CD32*) model="CD32" ;; *CDTV*) model="CDTV" ;; esac params+=(--model "$model") else # or for uae4arm choose an Amiga config based on the rom filename if [[ "$name" =~ AGA|CD32 ]]; then config="conf/rp-a1200.uae" else config="conf/rp-a500.uae" fi fi fi fi # if there is a config set then use it if [[ -n "$config" ]]; then if [[ "$is_amiberry" -eq 1 ]]; then params+=(--config "$config") else params+=(-config="$config") fi fi # add any other provided arguments params+=("$@") # add images to parameters (needs to be after any config arguments) params+=("${images[@]}") # start directly into emulation if the first argument is set [[ -n "$arg" ]] && params+=(-G) echo "Launching ..." echo "$emulator" "${params[@]}" "$emulator" "${params[@]}" archiveCleanup popd ================================================ FILE: scriptmodules/emulators/uae4arm.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="uae4arm" rp_module_desc="Amiga emulator with JIT support" rp_module_help="ROM Extension: .adf .ipf\n\nCopy your Amiga games to $romdir/amiga\n\nCopy the required BIOS files\nkick13.rom\nkick20.rom\nkick31.rom\nto $biosdir/amiga" rp_module_licence="GPL2" rp_module_repo="git https://github.com/Chips-fr/uae4arm-rpi.git master" rp_module_section="opt" rp_module_flags="!all dispmanx" function depends_uae4arm() { getDepends libsdl1.2-dev libsdl-gfx1.2-dev libsdl-ttf2.0-dev libguichan-dev libmpg123-dev libxml2-dev libflac-dev libmpeg2-4-dev } function sources_uae4arm() { gitPullOrClone } function build_uae4arm() { make clean if isPlatform "rpi1"; then CXXFLAGS="" make PLATFORM=rpi1 else CXXFLAGS="" make PLATFORM=rpi2 fi md_ret_require="$md_build/uae4arm" } function install_uae4arm() { md_ret_files=( 'data' 'uae4arm' ) } function configure_uae4arm() { addEmulator 1 "uae4arm" "amiga" "$md_inst/uae4arm.sh %ROM%" addEmulator 0 "uae4arm-a500" "amiga" "$md_inst/uae4arm.sh %ROM% -config=conf/rp-a500.uae" addEmulator 0 "uae4arm-a1200" "amiga" "$md_inst/uae4arm.sh %ROM% -config=conf/rp-a1200.uae" addSystem "amiga" [[ "$md_mode" == "remove" ]] && return mkRomDir "amiga" mkUserDir "$md_conf_root/amiga" mkUserDir "$md_conf_root/amiga/uae4arm" # move config / save folders to $md_conf_root/amiga/uae4arm local dir for dir in conf savestates screenshots; do moveConfigDir "$md_inst/$dir" "$md_conf_root/amiga/uae4arm/$dir" done moveConfigDir "$md_inst/kickstarts" "$biosdir/amiga" chown -R "$__user":"$__group" "$biosdir/amiga" local conf="$(mktemp)" iniConfig "=" "" "$conf" iniSet "config_description" "RetroPie A500, 68000, OCS, 512KB Chip + 512KB Slow Fast" iniSet "chipmem_size" "1" iniSet "bogomem_size" "2" iniSet "chipset" "ocs" iniSet "cachesize" "0" iniSet "kickstart_rom_file" "\$(FILE_PATH)/kick13.rom" copyDefaultConfig "$conf" "$md_conf_root/amiga/uae4arm/conf/rp-a500.uae" rm "$conf" conf="$(mktemp)" iniConfig "=" "" "$conf" iniSet "config_description" "RetroPie A1200, 68EC020, AGA, 2MB Chip" iniSet "chipmem_size" "4" iniSet "finegrain_cpu_speed" "1024" iniSet "cpu_type" "68ec020" iniSet "cpu_model" "68020" iniSet "chipset" "aga" iniSet "cachesize" "0" iniSet "kickstart_rom_file" "\$(FILE_PATH)/kick31.rom" copyDefaultConfig "$conf" "$md_conf_root/amiga/uae4arm/conf/rp-a1200.uae" rm "$conf" # copy shared uae4arm/amiberry launch script cp "$md_data/uae4arm.sh" "$md_inst/" chmod a+x "$md_inst/uae4arm.sh" local script="+Start UAE4Arm.sh" cat > "$romdir/amiga/$script" << _EOF_ #!/bin/bash "$md_inst/uae4arm.sh" _EOF_ chmod a+x "$romdir/amiga/$script" chown "$__user":"$__group" "$romdir/amiga/$script" } ================================================ FILE: scriptmodules/emulators/vice.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="vice" rp_module_desc="C64 emulator VICE" rp_module_help="ROM Extensions: .crt .d64 .g64 .prg .t64 .tap .x64 .zip .vsf\n\nCopy your Commodore 64 games to $romdir/c64" rp_module_licence="GPL2 http://svn.code.sf.net/p/vice-emu/code/trunk/vice/COPYING" rp_module_repo="svn svn://svn.code.sf.net/p/vice-emu/code/tags/v3.7.1/vice - HEAD" rp_module_section="opt" rp_module_flags="" function depends_vice() { local depends=(libsdl2-dev libsdl2-image-dev libmpg123-dev libpng-dev zlib1g-dev libasound2-dev libvorbis-dev libflac-dev libpcap-dev automake bison flex libjpeg-dev portaudio19-dev xa65 dos2unix) isPlatform "x11" && depends+=(libpulse-dev) getDepends "${depends[@]}" } function sources_vice() { svn checkout "$md_repo_url" "$md_build" } function build_vice() { local params=(--enable-sdl2ui --without-oss --enable-ethernet --enable-x64 --disable-pdf-docs --with-fastsid) ! isPlatform "x11" && params+=(--disable-catweasel --without-pulse) ./autogen.sh ./configure --prefix="$md_inst" "${params[@]}" make md_ret_require="$md_build/src/x64" } function install_vice() { make install } function configure_vice() { # get a list of supported extensions local exts="$(getPlatformConfig c64_exts)" # install the vice start script mkdir -p "$md_inst/bin" cat > "$md_inst/bin/vice.sh" << _EOF_ #!/bin/bash BIN="\${0%/*}/\$1" ROM="\$2" PARAMS=("\${@:3}") romdir="\${ROM%/*}" ext="\${ROM##*.}" source "$rootdir/lib/archivefuncs.sh" archiveExtract "\$ROM" "$exts" # check successful extraction and if we have at least one file if [[ \$? == 0 ]]; then ROM="\${arch_files[0]}" romdir="\$arch_dir" fi "\$BIN" -chdir "\$romdir" "\${PARAMS[@]}" "\$ROM" archiveCleanup _EOF_ chmod +x "$md_inst/bin/vice.sh" mkRomDir "c64" addEmulator 1 "$md_id-x64" "c64" "$md_inst/bin/vice.sh x64 %ROM%" addEmulator 0 "$md_id-x64dtv" "c64" "$md_inst/bin/vice.sh x64dtv %ROM%" addEmulator 0 "$md_id-x64sc" "c64" "$md_inst/bin/vice.sh x64sc %ROM%" addEmulator 0 "$md_id-x128" "c64" "$md_inst/bin/vice.sh x128 %ROM%" addEmulator 0 "$md_id-xpet" "c64" "$md_inst/bin/vice.sh xpet %ROM%" addEmulator 0 "$md_id-xplus4" "c64" "$md_inst/bin/vice.sh xplus4 %ROM%" addEmulator 0 "$md_id-xvic" "c64" "$md_inst/bin/vice.sh xvic %ROM%" addEmulator 0 "$md_id-xvic-cart" "c64" "$md_inst/bin/vice.sh xvic %ROM% -cartgeneric" addSystem "c64" [[ "$md_mode" == "remove" ]] && return # copy configs and symlink the old and new config folders to $md_conf_root/c64/ moveConfigDir "$home/.vice" "$md_conf_root/c64" moveConfigDir "$home/.config/vice" "$md_conf_root/c64" local config="$(mktemp)" echo "[C64]" > "$config" iniConfig "=" "" "$config" if ! isPlatform "x11"; then iniSet "Mouse" "1" iniSet "VICIIDoubleSize" "0" iniSet "VICIIDoubleScan" "0" iniSet "VICIIFilter" "0" iniSet "VICIIVideoCache" "0" iniSet "SDLWindowWidth" "384" iniSet "SDLWindowHeight" "272" fi if isPlatform "arm"; then iniSet "SidEngine" "0" isPlatform "armv6" && iniSet "SoundSampleRate" "22050" fi if isPlatform "x11" || isPlatform "kms"; then iniSet "VICIIFullscreen" "1" fi copyDefaultConfig "$config" "$md_conf_root/c64/sdl-vicerc" rm "$config" if ! isPlatform "x11"; then # enforce a few settings to ensure a smooth upgrade from sdl1 iniConfig "=" "" "$md_conf_root/c64/sdl-vicerc" iniDel "SDLBitdepth" iniSet "VICIIDoubleSize" "0" iniSet "VICIIDoubleScan" "0" iniSet "SDLWindowWidth" "384" iniSet "SDLWindowHeight" "272" fi } ================================================ FILE: scriptmodules/emulators/xm7/01_fix_build.diff ================================================ diff --git a/linux-sdl/CMakeLists.txt b/linux-sdl/CMakeLists.txt index e6988ff..00582e5 100644 --- a/linux-sdl/CMakeLists.txt +++ b/linux-sdl/CMakeLists.txt @@ -41,7 +41,7 @@ else(WITH_AGAR_STATIC) link_directories(${WITH_LIBAGAR_PREFIX}/lib) endif() -set(AGAR_DEPLIBS m jpeg png z dl uim-scm uim Xinerama) +set(AGAR_DEPLIBS m jpeg png z dl uim-scm uim Xinerama X11) find_package(Gettext) diff --git a/linux-sdl/fmgen/psg.cpp b/linux-sdl/fmgen/psg.cpp index f590cc9..cee80a5 100644 --- a/linux-sdl/fmgen/psg.cpp +++ b/linux-sdl/fmgen/psg.cpp @@ -150,7 +150,7 @@ void PSG::MakeEnvelopTable() 2,2, 2,0, 2,1, 2,3, 1,1, 1,3, 1,2, 1,0, }; static uint8 table2[4] = { 0, 0, 31, 31 }; - static uint8 table3[4] = { 0, 1, -1, 0 }; + static uint8 table3[4] = { 0, 1, (uint8)-1, 0 }; if (!enveloptable[0][0]) { diff --git a/linux-sdl/resource/CMakeLists.txt b/linux-sdl/resource/CMakeLists.txt index deb1dfb..17053ee 100644 --- a/linux-sdl/resource/CMakeLists.txt +++ b/linux-sdl/resource/CMakeLists.txt @@ -47,7 +47,7 @@ if(ImageMagick_convert_FOUND) add_custom_target(${loop_var_target} ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${loop_var_src} COMMAND ${ImageMagick_convert_EXECUTABLE} - ${CMAKE_CURRENT_SOURCE_DIR}/${loop_var_src} + ${CMAKE_CURRENT_SOURCE_DIR}/${loop_var_src}[0] ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${loop_var_target} ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${loop_var_target} DESTINATION share/xm7) ================================================ FILE: scriptmodules/emulators/xm7.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="xm7" rp_module_desc="Fujitsu FM-7 series emulator" rp_module_help="ROM Extensions: .d77 .t77 .d88 .2d \n\nCopy your FM-7 games to to $romdir/xm7\n\nCopy bios files DICROM.ROM, EXTSUB.ROM, FBASIC30.ROM, INITIATE.ROM, KANJI1.ROM, KANJI2.ROM, SUBSYS_A.ROM, SUBSYS_B.ROM, SUBSYSCG.ROM, SUBSYS_C.ROM, fddseek.wav, relayoff.wav and relay_on.wav to $biosdir/xm7" rp_module_licence="NONCOM https://raw.githubusercontent.com/nakatamaho/XM7-for-SDL/master/Doc/mess/license.txt" rp_module_repo="git https://github.com/nakatamaho/XM7-for-SDL.git master" rp_module_section="exp" rp_module_flags="!mali !kms" function depends_xm7() { getDepends cmake libjpeg-dev libsdl1.2-dev libsdl-mixer1.2-dev libtool libpng-dev libuim-dev libfreetype6-dev libfontconfig1-dev gawk fonts-takao libxinerama-dev libx11-dev imagemagick } function sources_xm7() { gitPullOrClone mkdir -p "$md_build/agar" downloadAndExtract "http://stable.hypertriton.com/agar/agar-1.5.0.tar.gz" "$md_build/agar" --strip-components 1 # _BSD_SOURCE is deprecated and will throw an error during configure sed -i "s/_BSD_SOURCE/_DEFAULT_SOURCE/g" "$md_build/agar/configure" # needs libx11 to link applyPatch "$md_data/01_fix_build.diff" } function build_xm7() { cd agar # create fake freetype-config to use pkg-config due to freetype-config being removed in recent versions mkdir -p bin cat > bin/freetype-config << _EOF_ #!/bin/bash arg="\$1" [[ "\$arg" == "--version" ]] && arg="--modversion" pkg-config freetype2 \$arg _EOF_ chmod +x "bin/freetype-config" ./configure --disable-shared --prefix="$md_build/libagar" --enable-freetype="$md_build/agar" make -j1 depend all install cd "$md_build" mkdir linux-sdl/build cd linux-sdl/build cmake -DCMAKE_CXX_FLAGS="-DSHAREDIR='\"${md_inst}/share/xm7\"'" -DCMAKE_INSTALL_PREFIX:PATH="$md_inst" -DCMAKE_BUILD_TYPE=Release -DUSE_OPENCL=No -DUSE_OPENGL=No -DWITH_LIBAGAR_PREFIX="$md_build/libagar" -DWITH_AGAR_STATIC=yes .. make md_ret_require="$md_build/linux-sdl/build/sdl/xm7" } function install_xm7() { cd linux-sdl/build make install } function configure_xm7() { mkRomDir "fm7" addEmulator 1 "$md_id" "fm7" "$md_inst/bin/xm7 %ROM%" addSystem "fm7" [[ "$md_mode" == "remove" ]] && return moveConfigDir "$home/.xm7" "$md_conf_root/fm7" mkUserDir "$biosdir/fm7" local bios for bios in DICROM.ROM EXTSUB.ROM FBASIC30.ROM INITIATE.ROM KANJI1.ROM KANJI2.ROM SUBSYS_A.ROM SUBSYS_B.ROM SUBSYSCG.ROM SUBSYS_C.ROM fddseek.wav relayoff.wav relay_on.wav; do ln -sf "$biosdir/fm7/$bios" "$md_conf_root/fm7/$bios" done } ================================================ FILE: scriptmodules/emulators/xroar.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="xroar" rp_module_desc="Dragon / CoCo emulator XRoar" rp_module_help="ROM Extensions: .bin .cas .wav .bas .asc .dmk .jvc .os9 .dsk .vdk .rom .ccc .sna\n\nCopy your Dragon roms to $romdir/dragon32\n\nCopy your CoCo games to $romdir/coco\n\nCopy the required BIOS files d32.rom (Dragon 32), bas13.rom (CoCo), coco3.rom/coco3p.rom (CoCo3) to $biosdir" rp_module_licence="GPL3 http://www.6809.org.uk/xroar/" rp_module_repo="git http://www.6809.org.uk/git/xroar.git 1.10" rp_module_section="opt" rp_module_flags="" function depends_xroar() { local depends=(libsdl2-dev automake libasound2-dev libsndfile1-dev texinfo zlib1g-dev) isPlatform "x11" && depends+=(libpulse-dev) getDepends "${depends[@]}" } function sources_xroar() { gitPullOrClone "$md_build" "$md_repo_url" "$md_repo_branch" "" 0 } function build_xroar() { local params=(--without-gtk2 --without-gtkgl --without-oss) if ! isPlatform "x11"; then params+=(--without-pulse --without-x) fi ./autogen.sh ./configure --prefix="$md_inst" "${params[@]}" make clean make md_ret_require="$md_build/src/xroar" } function install_xroar() { make install } function configure_xroar() { mkRomDir "dragon32" mkRomDir "coco" mkdir -p "$md_inst/share/xroar" ln -snf "$biosdir" "$md_inst/share/xroar/roms" local params=() ! isPlatform "x11" && params+=(-vo sdl -ccr simple) ! isPlatform "videocore" && params+=(-fs) isPlatform "kms" && params+=(-vo-vsync) addEmulator 1 "$md_id-dragon32" "dragon32" "$md_inst/bin/xroar ${params[*]} -machine dragon32 -run %ROM%" addEmulator 1 "$md_id-cocous" "coco" "$md_inst/bin/xroar ${params[*]} -machine cocous -run %ROM%" addEmulator 0 "$md_id-coco" "coco" "$md_inst/bin/xroar ${params[*]} -machine coco -run %ROM%" addEmulator 0 "$md_id-coco3us" "coco" "$md_inst/bin/xroar ${params[*]} -machine coco3 -run %ROM%" addEmulator 0 "$md_id-coco3" "coco" "$md_inst/bin/xroar ${params[*]} -machine coco3p -run %ROM%" addSystem "dragon32" addSystem "coco" } ================================================ FILE: scriptmodules/emulators/yabasanshiro.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="yabasanshiro" rp_module_desc="SEGA Saturn emulator Yaba Sanshiro" rp_module_help="ROM Extensions: .cue .chd\n\nCopy your SEGA Saturn ios images to $romdir/saturn" rp_module_licence="GPL2 https://github.com/devmiyax/yabause/blob/master/LICENSE" rp_module_repo="git https://github.com/devmiyax/yabause.git pi4-1-9-0" rp_module_section="exp" rp_module_flags="!all rpi !videocore" function depends_yabasanshiro() { local depends=(cmake pkg-config protobuf-compiler libprotobuf-dev libsecret-1-dev libssl-dev libsdl2-dev libboost-all-dev) getDepends "${depends[@]}" } function sources_yabasanshiro() { gitPullOrClone } function build_yabasanshiro() { local params=(-DGIT_EXECUTABLE=/usr/bin/git -DUSE_EGL=ON -DYAB_PORTS=retro_arena -DYAB_WANT_DYNAREC_DEVMIYAX=ON -DYAB_WANT_ARM7=ON -DYAB_WANT_OPENAL=OFF -DCMAKE_INSTALL_PREFIX="$md_inst") isPlatform "32bit" && params+=(-DCMAKE_SYSTEM_PROCESSOR=armv7-a) isPlatform "64bit" && params+=(-DCMAKE_SYSTEM_PROCESSOR=aarch64) export CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L -D__PI4__ -D__RETORO_ARENA__" export CXXFLAGS="$CXXFLAGS -D__PI4__ -D__RETORO_ARENA_" rm -fr build && mkdir -p build cd build cmake ../yabause/ "${params[@]}" make md_ret_require="$md_build/build/src/retro_arena/yabasanshiro" } function install_yabasanshiro() { cd build make install } function configure_yabasanshiro() { mkRomDir "saturn" if [[ "$md_mode" == "install" ]]; then mkUserDir "$md_conf_root/saturn" mkUserDir "$md_conf_root/saturn/$md_id" moveConfigFile "$home/.$md_id" "$md_conf_root/saturn/$md_id" fi addEmulator 1 "$md_id" "saturn" "$md_inst/yabasanshiro -r 3 -i %ROM%" addSystem "saturn" } ================================================ FILE: scriptmodules/emulators/zesarux.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/petrockblog/RetroPie-Setup/master/LICENSE.md. # rp_module_id="zesarux" rp_module_desc="ZX Spectrum emulator ZEsarUX" rp_module_help="ROM Extensions: .sna .szx .z80 .tap .tzx .gz .udi .mgt .img .trd .scl .dsk .zip\n\nCopy your ZX Spectrum games to $romdir/zxspectrum" rp_module_licence="GPL3 https://raw.githubusercontent.com/chernandezba/zesarux/master/src/LICENSE" rp_module_repo="git https://github.com/chernandezba/zesarux.git ZEsarUX-12.1" rp_module_section="opt" rp_module_flags="sdl2 sdl1-videocore" function depends_zesarux() { local depends=(libssl-dev libpthread-stubs0-dev libasound2-dev) isPlatform "x11" && depends+=(libpulse-dev) if isPlatform "videocore"; then depends+=(libsdl1.2-dev) else depends+=(libsdl2-dev) fi getDepends "${depends[@]}" } function sources_zesarux() { gitPullOrClone } function build_zesarux() { local params=() isPlatform "videocore" && params+=(--enable-raspberry) ! isPlatform "x11" && params+=(--disable-pulse) ! isPlatform "videocore" && params+=(--enable-sdl2) cd src ./configure --prefix "$md_inst" "${params[@]}" --enable-ssl make clean make md_ret_require="$md_build/src/zesarux" } function install_zesarux() { cd src make install } function configure_zesarux() { mkRomDir "zxspectrum" mkRomDir "amstradcpc" mkRomDir "samcoupe" mkUserDir "$md_conf_root/zxspectrum" cat > "$romdir/zxspectrum/+Start ZEsarUX.sh" << _EOF_ #!/bin/bash "$md_inst/bin/zesarux" "\$@" _EOF_ chmod +x "$romdir/zxspectrum/+Start ZEsarUX.sh" chown "$__user":"$__group" "$romdir/zxspectrum/+Start ZEsarUX.sh" moveConfigFile "$home/.zesaruxrc" "$md_conf_root/zxspectrum/.zesaruxrc" local ao="sdl" isPlatform "x11" && ao="pulse" local config="$(mktemp)" cat > "$config" << _EOF_ ;ZEsarUX sample configuration file ; ;Lines beginning with ; or # are ignored ;Run zesarux with --help or --experthelp to see all the options --disableborder --disablefooter --vo sdl --ao $ao --hidemousepointer --fullscreen --smartloadpath $romdir/zxspectrum --joystickemulated Kempston ;Remap Fire Event. Uncomment and amend if you wish to change the default button 3. ;--joystickevent 3 Fire ;Remap On-screen keyboard. Uncomment and amend if you wish to change the default button 5. ;--joystickevent 5 Osdkeyboard _EOF_ copyDefaultConfig "$config" "$md_conf_root/zxspectrum/.zesaruxrc" rm "$config" isPlatform "videocore" && setBackend "$md_id" "dispmanx" addEmulator 1 "$md_id" "zxspectrum" "bash $romdir/zxspectrum/+Start\ ZEsarUX.sh %ROM%" addEmulator 1 "$md_id" "samcoupe" "bash $romdir/zxspectrum/+Start\ ZEsarUX.sh --machine sam %ROM%" addEmulator 1 "$md_id" "amstradcpc" "bash $romdir/zxspectrum/+Start\ ZEsarUX.sh --machine CPC464 %ROM%" addSystem "zxspectrum" addSystem "samcoupe" addSystem "amstradcpc" } ================================================ FILE: scriptmodules/helpers.sh ================================================ #!/bin/bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # ## @file helpers.sh ## @brief RetroPie helpers library ## @copyright GPLv3 ## @fn printMsgs() ## @param type style of display to use - dialog, console or heading ## @param message string or array of messages to display ## @brief Prints messages in a variety of ways. function printMsgs() { local type="$1" shift if [[ "$__nodialog" == "1" && "$type" == "dialog" ]]; then type="console" fi for msg in "$@"; do [[ "$type" == "dialog" ]] && dialog --backtitle "$__backtitle" --cr-wrap --no-collapse --msgbox "$msg" 20 60 >/dev/tty [[ "$type" == "console" ]] && echo -e "$msg" [[ "$type" == "heading" ]] && echo -e "\n= = = = = = = = = = = = = = = = = = = = =\n$msg\n= = = = = = = = = = = = = = = = = = = = =\n" done return 0 } ## @fn printHeading() ## @param message string or array of messages to display ## @brief Calls PrintMsgs with "heading" type. function printHeading() { printMsgs "heading" "$@" } ## @fn fatalError() ## @param message string or array of messages to display ## @brief Calls PrintMsgs with "heading" type, and exits immediately. function fatalError() { printHeading "Error" echo -e "$1" joy2keyStop exit 1 } # @fn fnExists() # @param name name of function to check for # @brief Checks if function name exists. # @retval 0 if the function name exists # @retval 1 if the function name does not exist function fnExists() { declare -f "$1" > /dev/null return $? } function ask() { echo -e -n "$@" '[y/n] ' ; read ans case "$ans" in y*|Y*) return 0 ;; *) return 1 ;; esac } ## @fn runCmd() ## @param command command to run ## @brief Calls command and record any non zero return codes for later printing. ## @return whatever the command returns. function runCmd() { local ret "$@" ret=$? if [[ "$ret" -ne 0 ]]; then md_ret_errors+=("Error running '$*' - returned $ret") fi return $ret } ## @fn hasFlag() ## @param string string to search in ## @param flag flag to search for ## @brief Checks for a flag in a string (consisting of space separated flags). ## @retval 0 if the flag was found ## @retval 1 if the flag was not found function hasFlag() { local string="$1" local flag="$2" [[ -z "$string" || -z "$flag" ]] && return 1 if [[ "$string" =~ (^| )$flag($| ) ]]; then return 0 else return 1 fi } ## @fn isPlatform() ## @param platform ## @brief Test for current platform / platform flags. function isPlatform() { local flag="$1" if hasFlag "${__platform_flags[*]}" "$flag"; then return 0 fi return 1 } ## @fn addLineToFile() ## @param line line to add ## @param file file to add line to ## @brief Adds a new line of text to a file. function addLineToFile() { if [[ -f "$2" ]]; then cp -p "$2" "$2.bak" else sed -i --follow-symlinks '$a\' "$2" fi echo "$1" >> "$2" } ## @fn editFile() ## @param file file to edit ## @brief Opens an editing dialog for specified file. function editFile() { local file="$1" local cmd=(dialog --backtitle "$__backtitle" --editbox "$file" 22 76) local choice=$("${cmd[@]}" 2>&1 >/dev/tty) [[ -n "$choice" ]] && echo "$choice" >"$file" } ## @fn inputBox() ## @param title title of dialog ## @param text default text ## @param minchars minimum chars to accept ## @brief Opens an inputbox dialog and echoes resulting text. Uses the OSK if installed. ## @details The input dialog has OK/Cancel buttons and can be cancelled by the user. ## The dialog will enforce the minimum number of characters expected, re-prompting the user. ## @retval 0 when the user entered the text and chose the OK button ## @retval != 0 when the user chose the Cancel button function inputBox() { local title="$1" local text="$2" local minchars="$3" [[ -z "$minchars" ]] && minchars=0 local params=(--backtitle "$__backtitle" --inputbox "Enter the $title") local osk="$(rp_getInstallPath joy2key)/osk.py" if [[ -f "$osk" ]]; then params+=(--minchars "$minchars") text=$(python3 "$osk" "${params[@]}" "$text" 2>&1 >/dev/tty) || return $? else while true; do text=$(dialog "${params[@]}" 10 60 "$text" 2>&1 >/dev/tty) || return $? [[ "${#text}" -ge "$minchars" ]] && break dialog --msgbox "$title must have at least $minchars characters" 8 60 2>&1 >/dev/tty done fi echo "$text" } ## @fn hasPackage() ## @param package name of Debian package ## @param version requested version (optional) ## @param comparison type of comparison - defaults to `ge` (greater than or equal) if a version parameter is provided. ## @brief Test for an installed Debian package / package version. ## @retval 0 if the requested package / version was installed ## @retval 1 if the requested package / version was not installed function hasPackage() { local pkg="$1" local req_ver="$2" local comp="$3" [[ -z "$comp" ]] && comp="ge" local ver local status # extract the first line only (for cases where both amd64 & i386 versions of a package are installed) local out=$(dpkg-query -W --showformat='${Status} ${Version}\n' $1 2>/dev/null | head -n1) if [[ "$?" -eq 0 ]]; then ver="${out##* }" status="${out% *}" fi local installed=0 [[ "$status" == *"ok installed" ]] && installed=1 # if we are not checking version if [[ -z "$req_ver" ]]; then # if the package is installed return true [[ "$installed" -eq 1 ]] && return 0 else # if checking version and the package is not installed we need to clear "ver" as it may contain # the version number of a removed package and give a false positive with compareVersions. # we still need to do the version check even if not installed due to the varied boolean operators [[ "$installed" -eq 0 ]] && ver="" compareVersions "$ver" "$comp" "$req_ver" && return 0 fi return 1 } ## @fn aptUpdate() ## @brief Calls apt-get update (if it has not been called before). function aptUpdate() { if [[ "$__apt_update" != "1" ]]; then apt-get update --allow-releaseinfo-change __apt_update="1" fi } ## @fn aptInstall() ## @param packages package / space separated list of packages to install ## @brief Calls apt-get install with the packages provided. function aptInstall() { aptUpdate apt-get install -y "$@" return $? } ## @fn aptRemove() ## @param packages package / space separated list of packages to install ## @brief Calls apt-get remove with the packages provided. function aptRemove() { aptUpdate apt-get remove -y "$@" return $? } function _mapPackage() { local pkg="$1" case "$pkg" in libraspberrypi-bin) isPlatform "osmc" && pkg="rbp-userland-osmc" isPlatform "xbian" && pkg="xbian-package-firmware" ;; libraspberrypi-dev) isPlatform "osmc" && pkg="rbp-userland-dev-osmc" isPlatform "xbian" && pkg="xbian-package-firmware" ;; mali-fbdev) isPlatform "vero4k" && pkg="" ;; # handle our custom package alias LINUX-HEADERS LINUX-HEADERS) if isPlatform "rpi"; then if [[ "$__os_debian_ver" -lt 12 ]]; then pkg="raspberrypi-kernel-headers" else # on RaspiOS bookworm and later, kernel packages are separated by arch and model isPlatform "rpi0" || isPlatform "rpi1" && pkg="linux-headers-rpi-v6" if isPlatform "32bit"; then isPlatform "rpi2" || isPlatform "rpi3" && pkg="linux-headers-rpi-v7" isPlatform "rpi4" && pkg="linux-headers-rpi-v7l" else isPlatform "rpi3" || isPlatform "rpi4" && pkg="linux-headers-rpi-v8" isPlatform "rpi5" && pkg="linux-headers-rpi-2712" fi fi elif isPlatform "armbian"; then local branch="$(grep -oP "BRANCH=\K.*" /etc/armbian-release)" local family="$(grep -oP "LINUXFAMILY=\K.*" /etc/armbian-release)" pkg="linux-headers-${branch}-${family}" elif [[ -z "$__os_ubuntu_ver" ]]; then pkg="linux-headers-$(uname -r)" else pkg="linux-headers-generic" fi ;; # map libpng-dev to libpng12-dev for Jessie libpng-dev) [[ "$__os_debian_ver" -lt 9 ]] && pkg="libpng12-dev" ;; libsdl1.2-dev) rp_isEnabled "sdl1" && pkg="RP sdl1 $pkg" ;; libsdl2-dev) if rp_isEnabled "sdl2"; then # check whether to use our own sdl2 - can be disabled to resolve issues with # mixing custom 64bit sdl2 and os distributed i386 version on multiarch local own_sdl2=1 # default to off for x11 targets due to issues with dependencies with recent # Ubuntu (19.04). eg libavdevice58 requiring exactly 2.0.9 sdl2. isPlatform "x11" && own_sdl2=0 iniConfig " = " '"' "$configdir/all/retropie.cfg" iniGet "own_sdl2" if [[ "$ini_value" == "1" ]]; then own_sdl2=1 elif [[ "$ini_value" == "0" ]]; then own_sdl2=0 fi [[ "$own_sdl2" -eq 1 ]] && pkg="RP sdl2 $pkg" fi ;; libfreetype6-dev) [[ "$__os_debian_ver" -gt 10 ]] || compareVersions "$__os_ubuntu_ver" gt 23.04 && pkg="libfreetype-dev" ;; polkitd) [[ "$__os_debian_ver" -lt 13 ]] && pkg="policykit-1" [[ -n "$__os_ubuntu_ver" ]] && compareVersions "$__os_ubuntu_ver" lt 24.04 && pkg="policykit-1" ;; esac echo "$pkg" } ## @fn getDepends() ## @param packages package / space separated list of packages to install ## @brief Installs packages if they are not installed. ## @retval 0 on success ## @retval 1 on failure function getDepends() { local own_pkgs=() local apt_pkgs=() local all_pkgs=() local pkg for pkg in "$@"; do pkg=($(_mapPackage "$pkg")) # manage our custom packages (pkg = "RP module_id pkg_name") if [[ "${pkg[0]}" == "RP" ]]; then # if removing, check if any version is installed and queue for removal via the custom module if [[ "$md_mode" == "remove" ]]; then if hasPackage "${pkg[2]}"; then own_pkgs+=("${pkg[1]}") all_pkgs+=("${pkg[2]}(custom)") fi else # if installing check if our version is installed and queue for installing via the custom module if hasPackage "${pkg[2]}" $(get_pkg_ver_${pkg[1]}) "ne"; then own_pkgs+=("${pkg[1]}") all_pkgs+=("${pkg[2]}(custom)") fi fi continue fi if [[ "$md_mode" == "remove" ]]; then # add package to apt_pkgs for removal if installed if hasPackage "$pkg"; then apt_pkgs+=("$pkg") all_pkgs+=("$pkg") fi else # add package to apt_pkgs for installation if not installed if ! hasPackage "$pkg"; then apt_pkgs+=("$pkg") all_pkgs+=("$pkg") fi fi done # return if no packages required [[ ${#apt_pkgs[@]} -eq 0 && ${#own_pkgs[@]} -eq 0 ]] && return # if we are removing, then remove packages, do an autoremove to clean up additional packages and return if [[ "$md_mode" == "remove" ]]; then printMsgs "console" "Removing dependencies: ${all_pkgs[*]}" for pkg in ${own_pkgs[@]}; do rp_callModule "$pkg" remove done apt-get remove --purge -y "${apt_pkgs[@]}" apt-get autoremove --purge -y return 0 fi printMsgs "console" "Did not find needed dependencies: ${all_pkgs[*]}. Trying to install them now." # install any custom packages for pkg in ${own_pkgs[@]}; do rp_callModule "$pkg" _auto_ done aptInstall --no-install-recommends "${apt_pkgs[@]}" local failed=() # check the required packages again rather than return code of apt-get, # as apt-get might fail for other reasons (eg other half installed packages) for pkg in ${apt_pkgs[@]}; do if ! hasPackage "$pkg"; then # workaround for installing samba in a chroot (fails due to failed smbd service restart) # we replace the init.d script with an empty script so the install completes if [[ "$pkg" == "samba" && "$__chroot" -eq 1 ]]; then mv /etc/init.d/smbd /etc/init.d/smbd.old echo "#!/bin/sh" >/etc/init.d/smbd chmod u+x /etc/init.d/smbd apt-get -f install mv /etc/init.d/smbd.old /etc/init.d/smbd else failed+=("$pkg") fi fi done if [[ ${#failed[@]} -gt 0 ]]; then md_ret_errors+=("Could not install package(s): ${failed[*]}.") return 1 fi return 0 } ## @fn rpSwap() ## @param command *on* to add swap if needed and *off* to remove later ## @param memory total memory needed (swap added = memory needed - available memory) ## @brief Adds additional swap to the system if needed. function rpSwap() { local command=$1 local swapfile="$__swapdir/swap" case $command in on) rpSwap off local needed=$2 local size=$((needed - __memory_avail)) mkdir -p "$__swapdir/" if [[ $size -ge 0 ]]; then echo "Adding $size MB of additional swap" fallocate -l ${size}M "$swapfile" chmod 600 "$swapfile" mkswap "$swapfile" swapon "$swapfile" fi ;; off) echo "Removing additional swap" swapoff "$swapfile" 2>/dev/null rm -f "$swapfile" ;; esac } ## @fn gitPullOrClone() ## @param dest destination directory ## @param repo repository to clone or pull from ## @param branch branch to clone or pull from (optional) ## @param commit specific commit to checkout (optional - requires branch to be set) ## @param depth depth parameter for git. (optional) ## @brief Git clones or pulls a repository. ## @details depth parameter will default to 1 (shallow clone) so long as __persistent_repos isn't set. ## A depth parameter of 0 will do a full clone with all history. function gitPullOrClone() { local dir="$1" [[ -z "$dir" ]] && dir="$md_build" local repo="$2" local branch="$3" local commit="$4" local depth="$5" # if repo is blank then use the rp_module_repo info if [[ -z "$repo" && -n "$md_repo_url" ]]; then repo="$(rp_resolveRepoParam "$md_repo_url")" branch="$(rp_resolveRepoParam "$md_repo_branch")" commit="$(rp_resolveRepoParam "$md_repo_commit")" fi [[ -z "$repo" ]] && return 1 [[ -z "$branch" ]] && branch="master" # if no depth is provided default to shallow clone (depth 1) [[ -z "$depth" ]] && depth=1 # if we are using persistent repos or checking out a specific commit, don't shallow clone if [[ "$__persistent_repos" -eq 1 || -n "$commit" ]]; then depth=0 fi # record the source directory in __mod_info[ID/repo_dir] if not previously set which will be used # by the packaging functions later to grab repository information if [[ -z "${__mod_info[$md_id/repo_dir]}" ]]; then __mod_info[$md_id/repo_dir]="$dir" fi if [[ -d "$dir/.git" ]]; then pushd "$dir" > /dev/null # if we are using persistent repos, fetch the latest remote changes and clean the source so # any patches can be re-applied as needed. if [[ "$__persistent_repos" -eq 1 ]]; then runCmd git fetch runCmd git reset --hard runCmd git clean -f -d fi runCmd git checkout "$branch" # only try to pull if we are on a tracking branch if [[ -n "$(git config --get branch.$branch.merge)" ]]; then runCmd git pull --ff-only runCmd git submodule update --init --recursive fi popd > /dev/null else local git="git clone --recursive" if [[ "$depth" -gt 0 ]]; then git+=" --depth $depth --shallow-submodules" fi git+=" --branch $branch" printMsgs "console" "$git \"$repo\" \"$dir\"" runCmd $git "$repo" "$dir" fi if [[ -n "$commit" ]]; then printMsgs "console" "Winding back $repo->$branch to commit: #$commit" git -C "$dir" branch -D "$commit" &>/dev/null runCmd git -C "$dir" checkout -f "$commit" -b "$commit" fi branch=$(runCmd git -C "$dir" rev-parse --abbrev-ref HEAD) commit=$(runCmd git -C "$dir" rev-parse HEAD) printMsgs "console" "HEAD is now in branch '$branch' at commit '$commit'" } # @fn setupDirectories() # @brief Makes sure some required retropie directories and files are created. function setupDirectories() { mkdir -p "$rootdir" mkUserDir "$datadir" mkUserDir "$romdir" mkUserDir "$biosdir" mkUserDir "$configdir" mkUserDir "$configdir/all" # some home folders for configs that modules rely on mkUserDir "$home/.cache" mkUserDir "$home/.config" mkUserDir "$home/.local" mkUserDir "$home/.local/share" # make sure we have inifuncs.sh in place and that it is up to date mkdir -p "$rootdir/lib" local helper for helper in inifuncs.sh archivefuncs.sh; do if [[ ! -f "$rootdir/lib/$helper" || "$rootdir/lib/$helper" -ot "$scriptdir/scriptmodules/$helper" ]]; then cp --preserve=timestamps "$scriptdir/scriptmodules/$helper" "$rootdir/lib/$helper" fi done # create template for autoconf.cfg and make sure it is owned by $__user local config="$configdir/all/autoconf.cfg" if [[ ! -f "$config" ]]; then echo "# this file can be used to enable/disable retropie autoconfiguration features" >"$config" fi chown "$__user":"$__group" "$config" } ## @fn rmDirExists() ## @param dir directory to remove ## @brief Removes a directory and all contents if it exists. function rmDirExists() { if [[ -d "$1" ]]; then rm -rf "$1" fi } ## @fn mkUserDir() ## @param dir directory to create ## @brief Creates a directory owned by the current user. function mkUserDir() { mkdir -p "$1" chown "$__user":"$__group" "$1" } ## @fn mkRomDir() ## @param dir rom directory to create ## @brief Creates a directory under $romdir owned by the current user. function mkRomDir() { mkUserDir "$romdir/$1" if [[ "$1" == "megadrive" ]]; then if [[ ! -e "$romdir/genesis" ]]; then pushd "$romdir" ln -snf "$1" "genesis" popd fi fi } ## @fn moveConfigDir() ## @param from source directory ## @param to destination directory ## @brief Moves the contents of a folder and symlinks to the new location. function moveConfigDir() { local from="$1" local to="$2" # if we are in remove mode - remove the symlink if [[ "$md_mode" == "remove" ]]; then [[ -h "$from" ]] && rm -f "$from" return fi mkUserDir "$to" # move any old configs to the new location if [[ -d "$from" && ! -h "$from" ]]; then cp -a "$from/." "$to/" rm -rf "$from" fi ln -snf "$to" "$from" # set ownership of the actual link to $__user chown -h "$__user":"$__group" "$from" } ## @fn moveConfigFile() ## @param from source file ## @param to destination file ## @brief Moves the file and symlinks to the new location. function moveConfigFile() { local from="$1" local to="$2" # if we are in remove mode - remove the symlink if [[ "$md_mode" == "remove" && -h "$from" ]]; then rm -f "$from" return fi # move old file if [[ -f "$from" && ! -h "$from" ]]; then mv "$from" "$to" fi ln -sf "$to" "$from" # set ownership of the actual link to $__user chown -h "$__user":"$__group" "$from" } ## @fn diffFiles() ## @param file1 file to compare ## @param file2 file to compare ## @brief Compares two files using diff. ## @retval 0 if the files were the same ## @retval 1 if they were not ## @retval >1 an error occurred function diffFiles() { diff -q "$1" "$2" >/dev/null return $? } ## @fn compareVersions() ## @param version first version to compare ## @param operator operator to use (lt le eq ne ge gt) ## @brief version second version to compare ## @retval 0 if the comparison was true ## @retval 1 if the comparison was false function compareVersions() { dpkg --compare-versions "$1" "$2" "$3" >/dev/null return $? } ## @fn dirIsEmpty() ## @param path path to directory ## @param files_only set to 1 to ignore sub directories ## @retval 0 if the directory is empty ## @retval 1 if the directory is not empty function dirIsEmpty() { if [[ "$2" -eq 1 ]]; then [[ -z "$(ls -lA1 "$1" | grep "^-")" ]] && return 0 else [[ -z "$(ls -A "$1")" ]] && return 0 fi return 1 } ## @fn copyDefaultConfig() ## @param from source file ## @param to destination file ## @brief Copies a default configuration. ## @details Copies from the source file to the destination file if the destination ## file doesn't exist. If the destination is the same nothing is done. If different ## the source is copied to `$destination.rp-dist`. function copyDefaultConfig() { local from="$1" local to="$2" # if the destination exists, and is different then copy the config as name.rp-dist if [[ -f "$to" ]]; then if ! diffFiles "$from" "$to"; then to+=".rp-dist" printMsgs "console" "Copying new default configuration to $to" cp "$from" "$to" fi else printMsgs "console" "Copying default configuration to $to" cp "$from" "$to" fi chown "$__user":"$__group" "$to" } ## @fn renameModule() ## @param from source file ## @param to destination file ## @brief Renames an existing module. ## @details Renames an existing module, moving it's install folder to the new location ## and changing any references to it in `emulators.cfg`. function renameModule() { local from="$1" local to="$2" # move from old location and update emulators.cfg if [[ -d "$rootdir/$md_type/$from" ]]; then rm -rf "$rootdir/$md_type/$to" mv "$rootdir/$md_type/$from" "$rootdir/$md_type/$to" # replace any default = "$from" sed -i --follow-symlinks "s/\"$from\"/\"$to\"/g" "$configdir"/*/emulators.cfg # replace any $from = "cmdline" sed -i --follow-symlinks "s/^$from\([ =]\)/$to\1/g" "$configdir"/*/emulators.cfg # replace any paths with /$from/ sed -i --follow-symlinks "s|/$from/|/$to/|g" "$configdir"/*/emulators.cfg fi } ## @fn addUdevInputRules() ## @brief Creates a udev rule to adjust input device permissions. ## @details Creates a udev rule in `/etc/udev/rules.d/99-input.rules` to ## make everything in `/dev/input` it writable by any user in group `input`. function addUdevInputRules() { if [[ ! -f /etc/udev/rules.d/99-input.rules ]]; then echo 'SUBSYSTEM=="input", GROUP="input", MODE="0660"' > /etc/udev/rules.d/99-input.rules fi # remove old 99-evdev.rules rm -f /etc/udev/rules.d/99-evdev.rules } ## @fn setBackend() ## @param emulator.cfg key to configure backend for ## @param backend name of the backend to set ## @param force set to 1 to force the change ## @brief Set a backend rendering driver for a module ## @details Set a backend rendering driver for a module - can be currently default, dispmanx or x11. ## This function will only set a backend if ## - It's not already configured, or ## - The 3rd parameter (force) is set to 1 ## The emulator.cfg key is usually the module_id but some modules add multiple emulator.cfg entries ## which are all handled separately. A module can use a _backend_set_MODULE function hook which is called ## from the backends module to handle calling setBackend for additional emulator.cfg entries. ## See "fuse" scriptmodule for an example. function setBackend() { local config="$configdir/all/backends.cfg" local id="$1" local mode="$2" local force="$3" iniConfig "=" "\"" "$config" iniGet "$id" if [[ "$force" -eq 1 || -z "$ini_value" ]]; then iniSet "$id" "$mode" chown "$__user":"$__group" "$config" fi } ## @fn getBackend() ## @param emulator.cfg key to get backend for ## @brief Get a backend rendering driver for a module ## @details Get a backend rendering driver for a module ## The function echos the result so the value can be captured using var=$(getBackend "$module_id") function getBackend() { local config="$configdir/all/backends.cfg" local id="$1" iniConfig " = " '"' "$config" iniGet "$id" if [[ -n "$ini_value" ]]; then # translate old value of 1 as dispmanx for backward compatibility [[ "$ini_value" == "1" ]] && ini_value="dispmanx" else ini_value="default" fi echo "$ini_value" } ## @fn setDispmanx() ## @param module_id name of module to add dispmanx flag for ## @param status initial status of flag (0 or 1) ## @brief Sets a dispmanx flag for a module. This function is deprecated. ## @details Set a dispmanx flag for a module as to whether it should use the ## sdl1 dispmanx backend by default or not (0 for framebuffer, 1 for dispmanx). ## This function is deprecated and instead setBackend should be used. function setDispmanx() { isPlatform "dispmanx" || return setBackend "$1" "dispmanx" } ## @fn iniFileEditor() ## @param delim ini file delimiter eg. ' = ' ## @param quote ini file quoting character eg. '"' ## @param config ini file to edit ## @brief Allows editing of ini files with a user friendly dialog based gui. ## @details Some arrays need to be configured before calling this, which are ## used to display what can be edited and the options available. ## ## The first array is `$ini_titles` which provides the titles for each ## entry.. ## ## The second array is `$ini_descs` which contains a help description for each ## entry. ## ## The third array is `$ini_options` which contains multiple space separated ## strings in each element to control how each entry should be managed. ## ## The `$ini_options` array is constructed as follows: ## ## If the first string is `_function_` then the next string should be a function ## name that will handle that entry. The function will be called with a parameter ## `get` or `set`. The function should return the value for get via `echo` ## and should handle any gui functionality when called with `set`. This can be ## used for example to build custom dialogs. ## ## If the first option is anything else, it is assumed to be a key name, followed ## by a control type and a list of parameters. ## ## Control types are: ## * `_id_` map the following values to an id ## * `_string_` allow the value to be inputted by the user ## * `_file_` select from a list of files. The following values are wildcard, ## then file path. ## ## If none of the above, then the rest of the array element should be a list of ## possible values for the key. ## ## Some examples for ini_options: ## ## ini_options=('video_smooth true false') ## Allow setting of the key `video_smooth` with the values of *true* or *false* ## ## ini_options=('aspect_ratio_index _id_ 4:3 16:9 16:10) ## Allow setting of the key `aspect_ratio_index` with the values 0 1 or 2 which ## correspond to the ratios. The user is shown the ratios, but the ini configuration ## is set to the id (4:3 = 0, 16:9 = 1, 16:10 = 2). ## ## ini_options=('_function_ _video_fullscreen_configedit') ## The function `_video_fullscreen_configedit` is called with *get* or *set* ## to manage this entry. ## ## ini_options=("video_shader _file_ *.*p $rootdir/emulators/retroarch/shader") ## The key `video_shader` will be able to be set to a list of files in ## `$rootdir/emulators/retroarch/shader` that match the wildcard `*.*p` ## ## For more examples you can check out the code in supplementary/configedit.sh function iniFileEditor() { local delim="$1" local quote="$2" local config="$3" [[ ! -f "$config" ]] && return iniConfig "$delim" "$quote" "$config" local sel local value local option local title while true; do local options=() local params=() local values=() local keys=() local i=0 # generate menu from options for option in "${ini_options[@]}"; do # split into new array (globbing safe) read -ra option <<<"$option" key="${option[0]}" keys+=("$key") params+=("${option[*]:1}") # if the first parameter is _function_ we call the second parameter as a function # so we can handle some options with a custom menu etc if [[ "$key" == "_function_" ]]; then value="$(${option[1]} get)" else # get current value iniGet "$key" if [[ -n "$ini_value" ]]; then value="$ini_value" else value="unset" fi fi values+=("$value") # add the matching value to our id in _id_ lists if [[ "${option[1]}" == "_id_" && "$value" != "unset" ]]; then value+=" - ${option[value+2]}" fi # use custom title if provided if [[ -n "${ini_titles[i]}" ]]; then title="${ini_titles[i]}" else title="$key" fi options+=("$i" "$title ($value)" "${ini_descs[i]}") ((i++)) done local cmd=(dialog --backtitle "$__backtitle" --default-item "$sel" --item-help --help-button --menu "Please choose the setting to modify in $config" 22 76 16) sel=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ "${sel[@]:0:4}" == "HELP" ]]; then printMsgs "dialog" "${sel[@]:5}" continue fi [[ -z "$sel" ]] && break # if the key is _function_ we handle the option with a custom function if [[ "${keys[sel]}" == "_function_" ]]; then "${params[sel]}" set "${values[sel]}" continue fi # process the editing of the option i=0 options=("U" "unset") local default="" # split into new array (globbing safe) read -ra params <<<"${params[sel]}" local mode="${params[0]}" case "$mode" in _string_) options+=("E" "Edit (Currently ${values[sel]})") ;; _file_) local match="${params[1]}" local path="${params[*]:2}" local file while read file; do [[ "${values[sel]}" == "$file" ]] && default="$i" file="${file//$path\//}" options+=("$i" "$file") ((i++)) done < <(find -L "$path" -type f -name "$match" | sort) ;; _id_|*) [[ "$mode" == "_id_" ]] && params=("${params[@]:1}") for option in "${params[@]}"; do if [[ "$mode" == "_id_" ]]; then [[ "${values[sel]}" == "$i" ]] && default="$i" else [[ "${values[sel]}" == "$option" ]] && default="$i" fi options+=("$i" "$option") ((i++)) done ;; esac [[ -z "$default" ]] && default="U" # display values cmd=(dialog --backtitle "$__backtitle" --default-item "$default" --menu "Please choose the value for ${keys[sel]}" 22 76 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) # if it is a _string_ type we will open an inputbox dialog to get a manual value if [[ -z "$choice" ]]; then continue elif [[ "$choice" == "E" ]]; then [[ "${values[sel]}" == "unset" ]] && values[sel]="" cmd=(dialog --backtitle "$__backtitle" --inputbox "Please enter the value for ${keys[sel]}" 10 60 "${values[sel]}") value=$("${cmd[@]}" 2>&1 >/dev/tty) elif [[ "$choice" == "U" ]]; then value="" else if [[ "$mode" == "_id_" ]]; then value="$choice" else # get the actual value from the options array local index=$((choice*2+3)) if [[ "$mode" == "_file_" ]]; then value="$path/${options[index]}" else value="${options[index]}" fi fi fi if [[ "$choice" == "U" ]]; then iniUnset "${keys[sel]}" "$value" else iniSet "${keys[sel]}" "$value" fi done } ## @fn setESSystem() ## @param fullname full name of system ## @param name short name of system ## @param path rom path ## @param extension file extensions to show ## @param command command to run ## @param platform name of platform (used by es for scraping) ## @param theme name of theme to use ## @brief Adds a system entry for Emulation Station (to /etc/emulationstation/es_systems.cfg). function setESSystem() { local function for function in $(compgen -A function _add_system_); do "$function" "$@" done } ## @fn ensureSystemretroconfig() ## @param system system to create retroarch.cfg for ## @brief Deprecated - use defaultRAConfig ## @details Creates a default retroarch.cfg for specified system in `$configdir/$system/retroarch.cfg`. function ensureSystemretroconfig() { # don't do any config work on module removal [[ "$md_mode" == "remove" ]] && return # reset "$md_conf_root" to "$configdir" as defaultRAConfig handles this whereas ensureSystemretroconfig # expects system to include any subdirectory in the first parameter such as "ports/$system". local save_conf_root="$md_conf_root" md_conf_root="$configdir" defaultRAConfig "$1" md_conf_root="$save_conf_root" } ## @fn defaultRAConfig() ## @param system system to create retroarch.cfg for ## @param ... optional key then value parameters to be used in the config ## @brief Creates a default retroarch.cfg for specified system in `$md_root_dir/$system/retroarch.cfg`. ## @details Additional default configuration values can be provided as parameters to the function - eg. "fps_show" "true" ## as two parameters would add a default entry of fps_show = "true" to the default configuration. ## This function uses $md_conf_root as a base, so there is no need to use "ports/$system" for libretro ports as with ## the older ensureSystemretroconfig function defaultRAConfig() { # don't do any config work on module removal [[ "$md_mode" == "remove" ]] && return local system="$1" shift local defaults=("$@") local config_path="$md_conf_root/$system" [[ ! -d "$config_path" ]] && mkUserDir "$config_path" local config="$(mktemp)" # add the initial comment regarding include order echo -e "# Settings made here will only override settings in the global retroarch.cfg if placed above the #include line\n" >"$config" # add the per system default settings iniConfig " = " '"' "$config" iniSet "input_remapping_directory" "$config_path" # add any additional config key / values from function parameters local key local value while read key value; do [[ -n "$key" ]] && iniSet "$key" "$value" done <<< "${defaults[@]}" # include the main retroarch config echo -e "\n#include \"$configdir/all/retroarch.cfg\"" >>"$config" copyDefaultConfig "$config" "$config_path/retroarch.cfg" rm "$config" } ## @fn setRetroArchCoreOption() ## @param option option to set ## @param value value to set ## @brief Sets a retroarch core option in `$configdir/all/retroarch-core-options.cfg`. function setRetroArchCoreOption() { local option="$1" local value="$2" iniConfig " = " "\"" "$configdir/all/retroarch-core-options.cfg" iniGet "$option" if [[ -z "$ini_value" ]]; then iniSet "$option" "$value" fi chown "$__user":"$__group" "$configdir/all/retroarch-core-options.cfg" } ## @fn setConfigRoot() ## @param dir directory under $configdir to use ## @brief Sets module config root `$md_conf_root` to subfolder from `$configdir` ## @details This is used for ports that are not actually in scriptmodules/ports ## as they would get the wrong config root otherwise. function setConfigRoot() { local dir="$1" md_conf_root="$configdir" [[ -n "$dir" ]] && md_conf_root+="/$dir" mkUserDir "$md_conf_root" } ## @fn loadModuleConfig() ## @param params space separated list of key=value parameters ## @brief Load the settings for a module. ## @details This allows modules to quickly load some settings from an ini file. ## It can provide a shortcut way to load a set of keys from an ini file into ## variables. ## ## It requires iniConfig to be called first to specify the format and file. ## eg. ## ## iniConfig " = " '"' "$configdir/all/mymodule.cfg" ## eval $(loadModuleConfig \ ## 'some_option=1' \ ## 'another_option=2' ## ## This would load the keys `some_option` and `another_option` into local ## variables `some_option` and `another_option`. If the keys did not exist ## in mymodule.cfg the variables would be initialised to 1 and 2. function loadModuleConfig() { local options=("$@") local option local key local value for option in "${options[@]}"; do option=(${option/=/ }) key="${option[0]}" value="${option[@]:1}" iniGet "$key" if [[ -z "$ini_value" ]]; then iniSet "$key" "$value" echo "local $key=\"$value\"" else echo "local $key=\"$ini_value\"" fi done } ## @fn applyPatch() ## @param patch filename of patch to apply ## @brief Apply a patch if it has not already been applied to current folder. ## @details This is used for applying patches against upstream code. ## @retval 0 on success ## @retval 1 on failure function applyPatch() { local patch="$1" local patch_applied="${patch##*/}.applied" if [[ ! -f "$patch_applied" ]]; then if patch -f -p1 <"$patch"; then touch "$patch_applied" printMsgs "console" "Successfully applied patch: $patch" else md_ret_errors+=("$md_id patch $patch failed to apply") return 1 fi fi return 0 } ## @fn runCurl() ## @params ... commandline arguments to pass to curl ## @brief Run curl with chosen parameters and handle curl errors ## @details Runs curl with the provided parameters, whilst also capturing the output and extracting ## any error message, which is stored in the global variable __NET_ERRMSG. Function returns the return ## code provided by curl. The environment variable __curl_opts can be set to override default curl ## parameters, eg - timeouts etc. ## @retval curl return value function runCurl() { local params=("$@") # add any user supplied curl opts - timeouts can be overridden as curl uses the last parameters given [[ -n "$__curl_opts" ]] && params+=($__curl_opts) local cmd_err local ret # get the last non zero exit status (ignoring tee) set -o pipefail # set up additional file descriptor for stdin exec 3>&1 # capture stderr - while passing both stdout and stderr to terminal # curl like wget outputs the progress meter to stderr, so we will extract the error line later cmd_err=$(curl "${params[@]}" 2>&1 1>&3 | tee /dev/stderr) ret="$?" # remove stdin copy exec 3>&- set +o pipefail # if there was an error, extract it and put in __NET_ERRMSG if [[ "$ret" -ne 0 ]]; then # as we also capture the curl progress output, extract the last line which contains the error __NET_ERRMSG="${cmd_err##*$'\n'}" else __NET_ERRMSG="" fi return "$ret" } ## @fn download() ## @param url url of file ## @param dest destination name (optional), use - for stdout ## @brief Download a file ## @details Download a file - if the dest parameter is omitted, the file will be downloaded to the current directory. ## If the destination name is a hyphen (-), then the file will be outputted to stdout, for piping to another command ## or retrieving the contents directly to a variable. If the destination is a folder, extract with the basename from ## the url to the destination folder. ## @retval 0 on success function download() { local url="$1" local dest="$2" local file="${url##*/}" # if no destination, get the basename from the url [[ -z "$dest" ]] && dest="${PWD}/$file" # if the destination is a folder, download to that with filename from url [[ -d "$dest" ]] && dest="$dest/$file" local params=(--location) if [[ "$dest" == "-" ]]; then params+=(--silent --no-buffer) else printMsgs "console" "Downloading $url to $dest ..." params+=(-o "$dest") fi params+=(--connect-timeout 10 --speed-limit 1 --speed-time 60 --fail) # add the url params+=("$url") local ret runCurl "${params[@]}" ret="$?" # if download failed, remove file, log error and return error code if [[ "$ret" -ne 0 ]]; then # remove dest if not set to stdout and exists [[ "$dest" != "-" && -f "$dest" ]] && rm "$dest" md_ret_errors+=("URL $url failed to download.\n\n$__NET_ERRMSG") fi return "$ret" } ## @fn downloadAndVerify() ## @param url url of file ## @param dest destination file (optional) ## @brief Download a file and a corresponding .asc signature and verify the contents ## @details Download a file and a corresponding .asc signature and verify the contents. ## The .asc file will be downloaded to verify the file, but will be removed after downloading. ## If the dest parameter is omitted, the file will be downloaded to the current directory ## @retval 0 on success function downloadAndVerify() { local url="$1" local dest="$2" local file="${url##*/}" # if no destination, get the basename from the url (supported by GNU basename) [[ -z "$dest" ]] && dest="${PWD}/$file" local cmd_out local ret=1 if download "${url}.asc" "${dest}.asc"; then if download "$url" "$dest"; then cmd_out="$(gpg --verify "${dest}.asc" 2>&1)" ret="$?" if [[ "$ret" -ne 0 ]]; then md_ret_errors+=("$dest failed signature check:\n\n$cmd_out") fi fi fi return "$ret" } ## @fn downloadAndExtract() ## @param url url of archive ## @param dest destination folder for the archive ## @param optional additional parameters to pass to the decompression tool. ## @brief Download and extract an archive ## @details Download and extract an archive. ## @retval 0 on success function downloadAndExtract() { local url="$1" local dest="$2" shift 2 local opts=("$@") local ext="${url##*.}" local file="${url##*/}" local temp="$(mktemp -d)" # download file, removing temporary folder and returning on error if ! download "$url" "$temp/$file"; then rm -rf "$temp" return 1 fi mkdir -p "$dest" local ret case "$ext" in exe|zip) runCmd unzip "${opts[@]}" -o "$temp/$file" -d "$dest" ;; *) tar -xvf "$temp/$file" -C "$dest" "${opts[@]}" ;; esac ret=$? rm -rf "$temp" return $ret } ## @fn ensureFBMode() ## @param res_x width of mode ## @param res_y height of mode ## @brief Add a framebuffer mode to /etc/fb.modes ## @details Useful for adding specific resolutions used by emulators so SDL1 can ## use them and utilise the RPI hardware scaling. Without for example a 320x240 ## mode in fb.modes many of the emulators that output to the framebuffer and ## were not set to use the dispmanx SDL1 backend would just show in a small ## area of the screen. function ensureFBMode() { [[ ! -f /etc/fb.modes ]] && return local res_x="$1" local res_y="$2" local res="${res_x}x${res_y}" sed -i --follow-symlinks "/$res mode/,/endmode/d" /etc/fb.modes cat >> /etc/fb.modes <<_EOF_ # added by RetroPie-Setup - $res mode for emulators mode "$res" geometry $res_x $res_y $res_x $res_y 16 timings 0 0 0 0 0 0 0 endmode _EOF_ } ## @fn joy2keyStart() ## @param left mapping for left ## @param right mapping for right ## @param up mapping for up ## @param down mapping for down ## @param but1 mapping for button 1 ## @param but2 mapping for button 2 ## @param but3 mapping for button 3 ## @param butX mapping for button X ... ## @brief Start joy2key process in background to map joystick presses to keyboard ## @details Arguments are curses capability names or hex values starting with '0x' ## see: http://pubs.opengroup.org/onlinepubs/7908799/xcurses/terminfo.html function joy2keyStart() { # don't start on SSH sessions # (check for bracket in output - ip/name in brackets over a SSH connection) [[ "$(who -m)" == *\(* ]] && return local params=("$@") # if joy2key is installed, run it if rp_isInstalled "joy2key"; then "$(rp_getInstallPath joy2key)/joy2key" start "${params[@]}" 2>/dev/null && return 0 fi return 1 } ## @fn joy2keyStop() ## @brief Stop previously started joy2key process. function joy2keyStop() { # if joy2key is installed, stop it if rp_isInstalled "joy2key"; then "$(rp_getInstallPath joy2key)/joy2key" stop fi } ## @fn getPlatformConfig() ## @param key key to look up ## @brief gets a config from a platforms.cfg ini ## @details gets a config from a platforms.cfg ini first looking in ## `$configdir/all/platforms.cfg` then `$scriptdir/platforms.cfg` ## allowing users to override any parts of `$scriptdir/platforms.cfg` function getPlatformConfig() { local key="$1" local conf for conf in "$configdir/all/platforms.cfg" "$scriptdir/platforms.cfg"; do [[ ! -f "$conf" ]] && continue iniConfig "=" '"' "$conf" iniGet "$key" [[ -n "$ini_value" ]] && break done # workaround for RetroPie platform [[ "$key" == "retropie_fullname" ]] && ini_value="RetroPie" echo "$ini_value" } ## @fn addSystem() ## @param system system to add ## @brief adds an emulator entry / system ## @param fullname optional fullname for the frontend (if not present in platforms.cfg) ## @param exts optional extensions for the frontend (if not present in platforms.cfg) ## @details Adds a system to one of the frontend launchers function addSystem() { local system="$1" local fullname="$2" local exts=($3) local platform="$system" local theme="$system" local cmd local path # if removing and we don't have an emulators.cfg we can remove the system from the frontends if [[ "$md_mode" == "remove" ]] && [[ ! -f "$md_conf_root/$system/emulators.cfg" ]]; then delSystem "$system" "$fullname" return fi # set system / platform / theme for configuration based on data in names field if [[ "$system" == "ports" ]]; then cmd="bash %ROM%" path="$romdir/ports" else cmd="$rootdir/supplementary/runcommand/runcommand.sh 0 _SYS_ $system %ROM%" path="$romdir/$system" fi exts+=("$(getPlatformConfig "${system}_exts")") local temp temp="$(getPlatformConfig "${system}_theme")" if [[ -n "$temp" ]]; then theme="$temp" else theme="$system" fi temp="$(getPlatformConfig "${system}_platform")" if [[ -n "$temp" ]]; then platform="$temp" else platform="$system" fi temp="$(getPlatformConfig "${system}_fullname")" [[ -n "$temp" ]] && fullname="$temp" exts="${exts[*]}" # add the extensions again as uppercase exts+=" ${exts^^}" setESSystem "$fullname" "$system" "$path" "$exts" "$cmd" "$platform" "$theme" } ## @fn delSystem() ## @param system system to delete ## @brief Deletes a system ## @details deletes a system from all frontends. function delSystem() { local system="$1" local fullname="$2" local temp temp="$(getPlatformConfig "${system}_fullname")" [[ -n "$temp" ]] && fullname="$temp" local function for function in $(compgen -A function _del_system_); do "$function" "$fullname" "$system" done } ## @fn addPort() ## @param id id of the module / command ## @param port name of the port ## @param name display name for the launch script ## @param cmd commandline to launch ## @param game rom/game parameter (optional) ## @brief Adds a port to the emulationstation ports menu. ## @details Adds an emulators.cfg entry as with addSystem but also creates a launch script in `$datadir/ports/$name.sh`. ## ## Can also optionally take a game parameter which can be used to create multiple launch ## scripts for different games using the same engine - eg for quake ## ## addPort "lr-tyrquake" "quake" "Quake" "$emudir/retroarch/bin/retroarch -L $md_inst/tyrquake_libretro.so --config $md_conf_root/quake/retroarch.cfg %ROM%" "$romdir/ports/quake/id1/pak0.pak" ## addPort "lr-tyrquake" "quake" "Quake Mission Pack 2 (rogue)" "$emudir/retroarch/bin/retroarch -L $md_inst/tyrquake_libretro.so --config $md_conf_root/quake/retroarch.cfg %ROM%" "$romdir/ports/quake/id1/rogue/pak0.pak" ## ## Would add an entry in $configdir/ports/quake/emulators.cfg for lr-tyrquake (setting it to default if no default set) ## and create a launch script in $romdir/ports for each game. function addPort() { local id="$1" local port="$2" local file="$romdir/ports/$3.sh" local cmd="$4" local game="$5" # move configurations from old ports location if [[ -d "$configdir/$port" ]]; then mv "$configdir/$port" "$md_conf_root/" fi # remove the emulator / port if [[ "$md_mode" == "remove" ]]; then delEmulator "$id" "$port" # remove launch script if in remove mode and the ports emulators.cfg is empty [[ ! -f "$md_conf_root/$port/emulators.cfg" ]] && rm -f "$file" # if there are no more port launch scripts we can remove ports from emulation station if [[ "$(find "$romdir/ports" -maxdepth 1 -name "*.sh" | wc -l)" -eq 0 ]]; then delSystem "ports" fi return fi mkUserDir "$romdir/ports" cat >"$file" << _EOF_ #!/bin/bash "$rootdir/supplementary/runcommand/runcommand.sh" 0 _PORT_ "$port" "$game" _EOF_ chown "$__user":"$__group" "$file" chmod +x "$file" [[ -n "$cmd" ]] && addEmulator 1 "$id" "$port" "$cmd" addSystem "ports" } ## @fn addEmulator() ## @param default 1 to make the emulator / command default for the system if no default already set ## @param id unique id of the module / command ## @param name name of the system to add the emulator to ## @param cmd commandline to launch ## @brief Adds a new emulator for a system. ## @details This is the primary function for adding emulators to a system which can be ## switched between via the runcommand launch menu ## ## addEmulator 1 "vice-x64" "c64" "$md_inst/bin/x64 %ROM%" ## addEmulator 0 "vice-xvic" "c64" "$md_inst/bin/xvic %ROM%" ## ## Would add two optional emulators for the c64 - with vice-x64 being the default if no default ## was already set. This adds entries to `$configdir/$system/emulators.cfg` with ## ## id = "cmd" ## default = id ## ## Which are then selectable from runcommand when launching roms ## ## For libretro emulators, cmd needs to only contain the path to the libretro library. ## ## eg. for the lr-fcuemm module ## ## addEmulator 1 "$md_id" "nes" "$md_inst/fceumm_libretro.so" function addEmulator() { local default="$1" local id="$2" local system="$3" local cmd="$4" # check if we are removing the system if [[ "$md_mode" == "remove" ]]; then delEmulator "$id" "$system" return fi # automatically add parameters for libretro modules if [[ "$id" == lr-* && "$cmd" =~ ^"$md_inst"[^[:space:]]*\.so ]]; then cmd="$emudir/retroarch/bin/retroarch -L $cmd --config $md_conf_root/$system/retroarch.cfg %ROM%" fi # create a config folder for the system / port mkUserDir "$md_conf_root/$system" # add the emulator to the $conf_dir/emulators.cfg if a commandline exists (not used for some ports) if [[ -n "$cmd" ]]; then iniConfig " = " '"' "$md_conf_root/$system/emulators.cfg" iniSet "$id" "$cmd" # set a default unless there is one already set iniGet "default" if [[ -z "$ini_value" && "$default" -eq 1 ]]; then iniSet "default" "$id" fi chown "$__user":"$__group" "$md_conf_root/$system/emulators.cfg" fi } ## @fn delEmulator() ## @param id id of emulator to delete ## @param system system to delete from ## @brief Deletes an emulator entry / system ## @details Delete the entry for the id from `$configdir/$system/emulators.cfg`. ## If there are no more emulators for the system present, it will also ## delete the system entry from the installed frontends. function delEmulator() { local id="$1" local system="$2" local config="$md_conf_root/$system/emulators.cfg" # remove from apps list for system if [[ -f "$config" && -n "$id" ]]; then # delete emulator entry iniConfig " = " '"' "$config" iniDel "$id" # if it is the default - remove it - runcommand will prompt to select a new default iniGet "default" [[ "$ini_value" == "$id" ]] && iniDel "default" # if we no longer have any entries in the emulators.cfg file we can remove it grep -q "=" "$config" || rm -f "$config" fi } ## @fn patchVendorGraphics() ## @param filename file to patch ## @details replace declared dependencies of old vendor graphics libraries with new names ## Temporary compatibility workaround for legacy software to work on new Raspberry Pi firmwares. function patchVendorGraphics() { local filename="$1" # patchelf is not available on Raspbian Jessie [[ "$__os_debian_ver" -lt 9 ]] && return getDepends patchelf printMsgs "console" "Applying vendor graphics patch: $filename" patchelf --replace-needed libEGL.so libbrcmEGL.so \ --replace-needed libGLES_CM.so libbrcmGLESv2.so \ --replace-needed libGLESv1_CM.so libbrcmGLESv2.so \ --replace-needed libGLESv2.so libbrcmGLESv2.so \ --replace-needed libOpenVG.so libbrcmOpenVG.so \ --replace-needed libWFC.so libbrcmWFC.so "$filename" } ## @fn dkmsManager() ## @param mode dkms operation type ## @module_name name of dkms module ## @module_ver version of dkms module ## Helper function to manage DKMS modules installed by RetroPie function dkmsManager() { local mode="$1" local module_name="$2" local module_ver="$3" local kernel="$(uname -r)" local ver case "$mode" in install) if dkms status | grep -q "^$module_name"; then dkmsManager remove "$module_name" "$module_ver" fi ln -sf "$md_inst" "/usr/src/${module_name}-${module_ver}" dkms install --no-initrd --force -m "$module_name" -v "$module_ver" -k "$kernel" if ! dkms status "$module_name/$module_ver" -k "$kernel" | grep -q installed; then # Force building for any kernel that has source/headers local k_ver while read k_ver; do if [[ -d "$(realpath /lib/modules/$k_ver/build)" ]]; then dkms install --no-initrd --force -m "$module_name/$module_ver" -k "$k_ver" fi done < <(ls -r1 /lib/modules) fi if ! dkms status "$module_name/$module_ver" | grep -q installed; then md_ret_errors+=("Failed to install $md_id") return 1 fi ;; remove) for ver in $(dkms status "$module_name" | awk -F'[/,:]' '{print $2}'); do dkms remove -m "$module_name" -v "$ver" --all rm -f "/usr/src/${module_name}-${ver}" done dkmsManager unload "$module_name" "$module_ver" ;; reload) dkmsManager unload "$module_name" "$module_ver" # No reason to load modules in chroot if [[ "$__chroot" -eq 0 ]]; then modprobe "$module_name" fi ;; unload) if [[ -n "$(lsmod | grep ${module_name/-/_})" ]]; then rmmod "$module_name" fi ;; esac } ## @fn getIPAddress() ## @param dev optional specific network device to use for address lookup ## @brief Obtains the current externally routable source IP address of the machine ## @details This function first tries to obtain an external IPv4 route and ## otherwise tries an IPv6 route if the IPv4 route can not be determined. ## If no external route can be determined, nothing will be returned. ## This function uses Google's DNS servers as the external lookup address. function getIPAddress() { local dev="$1" local ip_route # first try to obtain an external IPv4 route ip_route=$(ip -4 route get 8.8.8.8 ${dev:+dev $dev} 2>/dev/null) if [[ -z "$ip_route" ]]; then # if there is no IPv4 route, try to obtain an IPv6 route instead ip_route=$(ip -6 route get 2001:4860:4860::8888 ${dev:+dev $dev} 2>/dev/null) fi # if an external route was found, report its source address [[ -n "$ip_route" ]] && grep -oP "src \K[^\s]+" <<< "$ip_route" } ## @fn isConnected() ## @brief Simple check to see if there is a connection to the Internet. ## @details Uses the getIPAddress function to check if we have a route to the Internet. Also sets ## __NET_ERRMSG with an error message for use in packages / setup to display to the user if not. ## @retval 0 on success ## @retval 1 on failure function isConnected() { local ip="$(getIPAddress)" if [[ -z "$ip" ]]; then __NET_ERRMSG="Not connected to the Internet" return 1 fi return 0 } ## @fn adminRsync() ## @param src src folder on local system - eg "$__tmpdir/stats/" ## @param dest destination folder on remote system - eg "stats/" ## @param params additional rsync parameters - eg --delete ## @brief Rsyncs data to remote host for admin modules ## @details Used to rsync data to our server for admin modules. Default remote ## user is retropie, host is $__binary_host and default port is 22. These can be overridden with ## env vars __upload_user __upload_host and __upload_port ## ## The default parameters for rsync are "-av --delay-updates" - more can be added via the 3rd+ argument function adminRsync() { local src="$1" local dest="$2" shift 2 local params=("$@") local remote_user="$__upload_user" [[ -z "$remote_user" ]] && remote_user="retropie" local remote_host="$__upload_host" [[ -z "$remote_host" ]] && remote_host="$__binary_host" local remote_port="$__upload_port" [[ -z "$remote_port" ]] && remote_port=22 rsync -av --delay-updates -e "ssh -p $remote_port" "${params[@]}" "$src" "$remote_user@$remote_host:$dest" } ## @fn signFile() ## @param file path to file to sign ## @brief signs file with $__gpg_signing_key ## @details signs file with $__gpg_signing_key creating corresponding .asc file in the same folder function signFile() { local file="$1" local cmd_out cmd_out=$(gpg --default-key "$__gpg_signing_key" --detach-sign --armor --yes "$1" 2>&1) if [[ "$?" -ne 0 ]]; then md_ret_errors+=("Failed to sign $1\n\n$cmd_out") return 1 fi return 0 } ================================================ FILE: scriptmodules/inifuncs.sh ================================================ #!/bin/bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # ## @file inifuncs.sh ## @brief RetroPie inifuncs library ## @copyright GPLv3 # @fn fatalError() # @param message string or array of messages to display # @brief echos message, and exits immediately. function fatalError() { echo -e "$1" exit 1 } # arg 1: delimiter, arg 2: quote, arg 3: file ## @fn iniConfig() ## @param delim ini file delimiter eg. ' = ' ## @param quote ini file quoting character eg. '"' ## @param config ini file to edit ## @brief Configure an ini file for getting/setting values with `iniGet` and `iniSet` function iniConfig() { __ini_cfg_delim="$1" __ini_cfg_quote="$2" __ini_cfg_file="$3" } # arg 1: command, arg 2: key, arg 3: value, arg 4: file (optional - uses file from iniConfig if not used) # @fn iniProcess() # @param command `set`, `unset` or `del` # @param key ini key to operate on # @param value to set # @param file optional file to use another file than the one configured with iniConfig # @brief The main function for setting and deleting from ini files - usually # not called directly but via iniSet iniUnset and iniDel function iniProcess() { local cmd="$1" local key="$2" local value="$3" local file="$4" [[ -z "$file" ]] && file="$__ini_cfg_file" local delim="$__ini_cfg_delim" local quote="$__ini_cfg_quote" [[ -z "$file" ]] && fatalError "No file provided for ini/config change" [[ -z "$key" ]] && fatalError "No key provided for ini/config change on $file" # we strip the delimiter of spaces, so we can "fussy" match existing entries that have the wrong spacing local delim_strip=${delim// /} # if the stripped delimiter is empty - such as in the case of a space, just use the delimiter instead [[ -z "$delim_strip" ]] && delim_strip="$delim" local match_re="^[[:space:]#]*$key[[:space:]]*$delim_strip.*$" local match if [[ -f "$file" ]]; then match=$(grep -i "$match_re" "$file" | tail -1) else touch "$file" fi if [[ "$cmd" == "del" ]]; then [[ -n "$match" ]] && sed -i --follow-symlinks "\|$(sedQuote "$match")|d" "$file" return 0 fi [[ "$cmd" == "unset" ]] && key="# $key" local replace="$key$delim$quote$value$quote" if [[ -z "$match" ]]; then # make sure there is a newline then add the key-value pair sed -i --follow-symlinks '$a\' "$file" echo "$replace" >> "$file" else # replace existing key-value pair sed -i --follow-symlinks "s|$(sedQuote "$match")|$(sedQuote "$replace")|g" "$file" fi [[ "$file" =~ retroarch\.cfg$ ]] && retroarchIncludeToEnd "$file" return 0 } ## @fn iniUnset() ## @param key ini key to operate on ## @param value to Unset (key will be commented out, but the value can be changed also) ## @param file optional file to use another file than the one configured with iniConfig ## @brief Unset (comment out) a key / value pair in an ini file. ## @details The key does not have to exist - if it doesn't exist a new line will ## be added - eg. `# key = "value"` ## ## This function is useful for creating example configuration entries for users ## to manually enable later or if a configuration is to be disabled but left ## as an example. function iniUnset() { iniProcess "unset" "$1" "$2" "$3" } ## @fn iniSet() ## @param key ini key to operate on ## @param value to set ## @param file optional file to use another file than the one configured with iniConfig ## @brief Set a key / value pair in an ini file. ## @details If the key already exists the existing line will be changed. If not ## a new line will be created. function iniSet() { iniProcess "set" "$1" "$2" "$3" } ## @fn iniDel() ## @param key ini key to operate on ## @param file optional file to use another file than the one configured with iniConfig ## @brief Delete a key / value pair in an ini file. function iniDel() { iniProcess "del" "$1" "" "$2" } ## @fn iniGet() ## @param key ini key to get the value of ## @param file optional file to use another file than the one configured with iniConfig ## @brief Get the value of a key from an ini file. ## @details The value of the key will end up in the global ini_value variable. function iniGet() { local key="$1" local file="$2" [[ -z "$file" ]] && file="$__ini_cfg_file" if [[ ! -f "$file" ]]; then ini_value="" return 1 fi local delim="$__ini_cfg_delim" local quote="$__ini_cfg_quote" # we strip the delimiter of spaces, so we can "fussy" match existing entries that have the wrong spacing local delim_strip=${delim// /} # if the stripped delimiter is empty - such as in the case of a space, just use the delimiter instead [[ -z "$delim_strip" ]] && delim_strip="$delim" # create a regexp to match the value based on whether we are looking for quotes or not local value_m if [[ -n "$quote" ]]; then value_m="$quote*\([^$quote|\r]*\)$quote*" else value_m="\([^\r]*\)" fi ini_value="$(sed -n "s#^[ |\t]*$key[ |\t]*$delim_strip[ |\t]*$value_m.*#\1#p" "$file" | tail -1)" } # @fn retroarchIncludeToEnd() # @param file config file to process # @brief Makes sure a `retroarch.cfg` file has the `#include` line at the end. # @details Used in runcommand.sh and iniProcess to ensure the #include for the # main retroarch.cfg is always at the end of a system `retroarch.cfg`. This # is because when processing its config RetroArch will take the first value it # finds, so any overrides need to be above the `#include` line where the global # retroarch.cfg is included. function retroarchIncludeToEnd() { local config="$1" [[ ! -f "$config" ]] && return local re="^#include.*retroarch\.cfg" # extract the include line (unless it is the last line in the file) # (remove blank lines, the last line and search for an include line in remaining lines) local include=$(sed '/^$/d;$d' "$config" | grep "$re") # if matched remove it and re-add it at the end if [[ -n "$include" ]]; then sed -i --follow-symlinks "/$re/d" "$config" # add newline if missing and the #include line sed -i --follow-symlinks '$a\' "$config" echo "$include" >>"$config" fi } # arg 1: key, arg 2: default value (optional - is 1 if not used) function addAutoConf() { local key="$1" local default="$2" local file="$configdir/all/autoconf.cfg" if [[ -z "$default" ]]; then default="1" fi iniConfig " = " '"' "$file" iniGet "$key" ini_value="${ini_value// /}" if [[ -z "$ini_value" ]]; then iniSet "$key" "$default" chown "$__user":"$__group" "$file" fi } # arg 1: key, arg 2: value function setAutoConf() { local key="$1" local value="$2" local file="$configdir/all/autoconf.cfg" iniConfig " = " '"' "$file" iniSet "$key" "$value" chown "$__user":"$__group" "$file" } # arg 1: key function getAutoConf(){ local key="$1" iniConfig " = " '"' "$configdir/all/autoconf.cfg" iniGet "$key" [[ "$ini_value" == "1" ]] && return 0 return 1 } # escape special characters for sed function sedQuote() { local string="$1" string="${string//\\/\\\\}" string="${string//|/\\|}" string="${string//[/\\[}" string="${string//]/\\]}" echo "$string" } ================================================ FILE: scriptmodules/libretrocores/lr-81.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-81" rp_module_desc="Sinclair ZX81 emulator - EightyOne port for libretro" rp_module_help="ROM Extensions: .p .tzx .t81\n\nCopy your ZX81 roms to $romdir/zx81" rp_module_licence="GPL3 https://raw.githubusercontent.com/libretro/81-libretro/master/LICENSE" rp_module_repo="git https://github.com/libretro/81-libretro.git master" rp_module_section="exp" function sources_lr-81() { gitPullOrClone } function build_lr-81() { make clean make md_ret_require="$md_build/81_libretro.so" } function install_lr-81() { md_ret_files=( 'README.md' '81_libretro.so' ) } function configure_lr-81() { mkRomDir "zx81" defaultRAConfig "zx81" addEmulator 1 "$md_id" "zx81" "$md_inst/81_libretro.so" addSystem "zx81" } ================================================ FILE: scriptmodules/libretrocores/lr-atari800.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-atari800" rp_module_desc="Atari 8-bit/800/5200 emulator - Atari800 port for libretro" rp_module_help="ROM Extensions: .a52 .bas .bin .car .xex .atr .xfd .dcm .atr.gz .xfd.gz\n\nCopy your Atari800 games to $romdir/atari800\n\nCopy your Atari 5200 roms to $romdir/atari5200 You need to copy the Atari 800/5200 BIOS files (5200.ROM, ATARIBAS.ROM, ATARIOSB.ROM and ATARIXL.ROM) to the folder $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/libretro-atari800/master/atari800/COPYING" rp_module_repo="git https://github.com/libretro/libretro-atari800.git master" rp_module_section="main" function sources_lr-atari800() { gitPullOrClone } function build_lr-atari800() { make clean CFLAGS+=" -DDEFAULT_CFG_NAME=\\\".lr-atari800.cfg\\\"" make md_ret_require="$md_build/atari800_libretro.so" } function install_lr-atari800() { md_ret_files=( 'atari800_libretro.so' 'atari800/COPYING' ) } function configure_lr-atari800() { mkRomDir "atari800" mkRomDir "atari5200" defaultRAConfig "atari800" defaultRAConfig "atari5200" mkUserDir "$md_conf_root/atari800" moveConfigFile "$home/.lr-atari800.cfg" "$md_conf_root/atari800/lr-atari800.cfg" addEmulator 1 "lr-atari800" "atari800" "$md_inst/atari800_libretro.so" addEmulator 1 "lr-atari800" "atari5200" "$md_inst/atari800_libretro.so" addSystem "atari800" addSystem "atari5200" } ================================================ FILE: scriptmodules/libretrocores/lr-beetle-lynx.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-beetle-lynx" rp_module_desc="Atari Lynx emulator - Mednafen Lynx Port for libretro, itself a fork of Handy" rp_module_help="ROM Extensions: .lnx .zip\n\nCopy your Atari Lynx roms to $romdir/atarilynx\n\nCopy the required BIOS file lynxboot.img to $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/beetle-lynx-libretro/master/COPYING" rp_module_repo="git https://github.com/libretro/beetle-lynx-libretro.git master" rp_module_section="opt" function sources_lr-beetle-lynx() { gitPullOrClone } function build_lr-beetle-lynx() { make clean make md_ret_require="$md_build/mednafen_lynx_libretro.so" } function install_lr-beetle-lynx() { md_ret_files=( 'mednafen_lynx_libretro.so' ) } function configure_lr-beetle-lynx() { mkRomDir "atarilynx" defaultRAConfig "atarilynx" addEmulator 0 "$md_id" "atarilynx" "$md_inst/mednafen_lynx_libretro.so" addSystem "atarilynx" } ================================================ FILE: scriptmodules/libretrocores/lr-beetle-ngp.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-beetle-ngp" rp_module_desc="Neo Geo Pocket(Color)emu - Mednafen Neo Geo Pocket core port for libretro" rp_module_help="ROM Extensions: .ngc .ngp .zip\n\nCopy your Neo Geo Pocket roms to $romdir/ngp\n\nCopy your Neo Geo Pocket Color roms to $romdir/ngpc" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/beetle-ngp-libretro/master/COPYING" rp_module_repo="git https://github.com/libretro/beetle-ngp-libretro.git master" rp_module_section="main" function _update_hook_lr-beetle-ngp() { # move from old location and update emulators.cfg renameModule "lr-mednafen-ngp" "lr-beetle-ngp" } function sources_lr-beetle-ngp() { gitPullOrClone } function build_lr-beetle-ngp() { make clean make md_ret_require="$md_build/mednafen_ngp_libretro.so" } function install_lr-beetle-ngp() { md_ret_files=( 'mednafen_ngp_libretro.so' ) } function configure_lr-beetle-ngp() { local system for system in ngp ngpc; do mkRomDir "$system" defaultRAConfig "$system" addEmulator 1 "$md_id" "$system" "$md_inst/mednafen_ngp_libretro.so" addSystem "$system" done } ================================================ FILE: scriptmodules/libretrocores/lr-beetle-pce-fast.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-beetle-pce-fast" rp_module_desc="PCEngine emu - Mednafen PCE Fast port for libretro" rp_module_help="ROM Extensions: .pce .ccd .cue .zip\n\nCopy your PC Engine / TurboGrafx roms to $romdir/pcengine\n\nCopy the required BIOS file syscard3.pce to $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/beetle-pce-fast-libretro/master/COPYING" rp_module_repo="git https://github.com/libretro/beetle-pce-fast-libretro.git master" rp_module_section="main" function _update_hook_lr-beetle-pce-fast() { # move from old location and update emulators.cfg renameModule "lr-mednafen-pce-fast" "lr-beetle-pce-fast" } function sources_lr-beetle-pce-fast() { gitPullOrClone } function build_lr-beetle-pce-fast() { make clean make md_ret_require="$md_build/mednafen_pce_fast_libretro.so" } function install_lr-beetle-pce-fast() { md_ret_files=( 'mednafen_pce_fast_libretro.so' 'COPYING' 'README.md' ) } function configure_lr-beetle-pce-fast() { mkRomDir "pcengine" defaultRAConfig "pcengine" addEmulator 1 "$md_id" "pcengine" "$md_inst/mednafen_pce_fast_libretro.so" addSystem "pcengine" } ================================================ FILE: scriptmodules/libretrocores/lr-beetle-pce.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-beetle-pce" rp_module_desc="PC Engine/CD/SuperGrafx emulator - Mednafen PCE port for libretro" rp_module_help="ROM Extensions: .7z .ccd .chd .cue .pce .sgx\n\nCopy your PC Engine roms to $romdir/pcengine\n\nCopy the required BIOS file syscard3.pce to $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/beetle-pce-libretro/master/COPYING" rp_module_repo="git https://github.com/libretro/beetle-pce-libretro.git master" rp_module_section="opt" rp_module_flags="!armv6" function sources_lr-beetle-pce() { gitPullOrClone } function build_lr-beetle-pce() { make clean make md_ret_require="$md_build/mednafen_pce_libretro.so" } function install_lr-beetle-pce() { md_ret_files=( 'mednafen_pce_libretro.so' 'COPYING' 'README.md' ) } function configure_lr-beetle-pce() { mkRomDir "pcengine" defaultRAConfig "pcengine" addEmulator 1 "$md_id" "pcengine" "$md_inst/mednafen_pce_libretro.so" addSystem "pcengine" [[ "$md_mode" == "remove" ]] && return # Set core options setRetroArchCoreOption "pce_aspect_ratio" "4:3" setRetroArchCoreOption "pce_multitap" "disabled" setRetroArchCoreOption "pce_scaling" "hires" } ================================================ FILE: scriptmodules/libretrocores/lr-beetle-pcfx.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-beetle-pcfx" rp_module_desc="PCFX emulator - Mednafen PCFX Port for libretro" rp_module_help="ROM Extensions: .img .iso .ccd .cue\n\nCopy the required BIOS file pcfx.rom to $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/beetle-pcfx-libretro/master/COPYING" rp_module_repo="git https://github.com/libretro/beetle-pcfx-libretro master" rp_module_section="exp" function sources_lr-beetle-pcfx() { gitPullOrClone } function build_lr-beetle-pcfx() { make clean make md_ret_require="$md_build/mednafen_pcfx_libretro.so" } function install_lr-beetle-pcfx() { md_ret_files=( 'mednafen_pcfx_libretro.so' ) } function configure_lr-beetle-pcfx() { mkRomDir "pcfx" defaultRAConfig "pcfx" addEmulator 1 "$md_id" "pcfx" "$md_inst/mednafen_pcfx_libretro.so" addSystem "pcfx" } ================================================ FILE: scriptmodules/libretrocores/lr-beetle-psx.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-beetle-psx" rp_module_desc="PlayStation emulator - Mednafen PSX Port for libretro" rp_module_help="ROM Extensions: .bin .cue .cbn .img .iso .m3u .mdf .pbp .toc .z .znx\n\nCopy your PlayStation roms to $romdir/psx\n\nCopy the required BIOS files\n\nscph5500.bin and\nscph5501.bin and\nscph5502.bin to\n\n$biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/beetle-psx-libretro/master/COPYING" rp_module_repo="git https://github.com/libretro/beetle-psx-libretro.git master" rp_module_section="opt x86=main" rp_module_flags="!arm" function depends_lr-beetle-psx() { local depends=(libvulkan-dev libgl1-mesa-dev) getDepends "${depends[@]}" } function sources_lr-beetle-psx() { gitPullOrClone } function build_lr-beetle-psx() { make clean make HAVE_HW=1 md_ret_require=( 'mednafen_psx_hw_libretro.so' ) } function install_lr-beetle-psx() { md_ret_files=( 'mednafen_psx_hw_libretro.so' ) } function configure_lr-beetle-psx() { mkRomDir "psx" defaultRAConfig "psx" addEmulator 0 "$md_id" "psx" "$md_inst/mednafen_psx_hw_libretro.so" addSystem "psx" } ================================================ FILE: scriptmodules/libretrocores/lr-beetle-saturn.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-beetle-saturn" rp_module_desc="Saturn emulator - Mednafen Saturn port for libretro" rp_module_help="ROM Extensions: .chd .cue\n\nCopy your Saturn roms to $romdir/saturn\n\nCopy the required BIOS files sega_101.bin / mpr-17933.bin to $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/beetle-saturn-libretro/master/COPYING" rp_module_repo="git https://github.com/libretro/beetle-saturn-libretro.git master" rp_module_section="exp" rp_module_flags="!armv6" function sources_lr-beetle-saturn() { gitPullOrClone } function build_lr-beetle-saturn() { make clean make md_ret_require="$md_build/mednafen_saturn_libretro.so" } function install_lr-beetle-saturn() { md_ret_files=( 'mednafen_saturn_libretro.so' ) } function configure_lr-beetle-saturn() { mkRomDir "saturn" defaultRAConfig "saturn" addEmulator 1 "$md_id" "saturn" "$md_inst/mednafen_saturn_libretro.so" addSystem "saturn" } ================================================ FILE: scriptmodules/libretrocores/lr-beetle-supergrafx.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-beetle-supergrafx" rp_module_desc="SuperGrafx TG-16 emulator - Mednafen PCE Fast port for libretro" rp_module_help="ROM Extensions: .pce .ccd .cue .zip\n\nCopy your PC Engine / TurboGrafx roms to $romdir/pcengine\n\nCopy the required BIOS file syscard3.pce to $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/beetle-supergrafx-libretro/master/COPYING" rp_module_repo="git https://github.com/libretro/beetle-supergrafx-libretro.git master" rp_module_section="main" function sources_lr-beetle-supergrafx() { gitPullOrClone } function build_lr-beetle-supergrafx() { make clean make md_ret_require="$md_build/mednafen_supergrafx_libretro.so" } function install_lr-beetle-supergrafx() { md_ret_files=( 'mednafen_supergrafx_libretro.so' 'COPYING' ) } function configure_lr-beetle-supergrafx() { mkRomDir "pcengine" defaultRAConfig "pcengine" addEmulator 0 "$md_id" "pcengine" "$md_inst/mednafen_supergrafx_libretro.so" addSystem "pcengine" } ================================================ FILE: scriptmodules/libretrocores/lr-beetle-vb.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-beetle-vb" rp_module_desc="Virtual Boy emulator - Mednafen VB (optimised) port for libretro" rp_module_help="ROM Extensions: .vb .zip\n\nCopy your Virtual Boy roms to $romdir/virtualboy" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/beetle-vb-libretro/master/COPYING" rp_module_repo="git https://github.com/libretro/beetle-vb-libretro.git master" rp_module_section="opt" rp_module_flags="" function sources_lr-beetle-vb() { gitPullOrClone } function build_lr-beetle-vb() { local params=(NEED_STEREO_SOUND=1) isPlatform "arm" && params+=(platform=armv FRONTEND_SUPPORTS_RGB565=1) make clean make "${params[@]}" md_ret_require="$md_build/mednafen_vb_libretro.so" } function install_lr-beetle-vb() { md_ret_files=( 'mednafen_vb_libretro.so' ) } function configure_lr-beetle-vb() { mkRomDir "virtualboy" defaultRAConfig "virtualboy" addEmulator 1 "$md_id" "virtualboy" "$md_inst/mednafen_vb_libretro.so" addSystem "virtualboy" } ================================================ FILE: scriptmodules/libretrocores/lr-beetle-wswan.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-beetle-wswan" rp_module_desc="Wonderswan emu - Mednafen WonderSwan core port for libretro" rp_module_help="ROM Extensions: .ws .wsc .zip\n\nCopy your Wonderswan roms to $romdir/wonderswan\n\nCopy your Wonderswan Color roms to $romdir/wonderswancolor" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/beetle-wswan-libretro/master/COPYING" rp_module_repo="git https://github.com/libretro/beetle-wswan-libretro.git master" rp_module_section="opt" function _update_hook_lr-beetle-wswan() { # move from old location and update emulators.cfg renameModule "lr-mednafen-wswan" "lr-beetle-wswan" } function sources_lr-beetle-wswan() { gitPullOrClone } function build_lr-beetle-wswan() { make clean make md_ret_require="$md_build/mednafen_wswan_libretro.so" } function install_lr-beetle-wswan() { md_ret_files=( 'mednafen_wswan_libretro.so' ) } function configure_lr-beetle-wswan() { mkRomDir "wonderswan" mkRomDir "wonderswancolor" defaultRAConfig "wonderswan" defaultRAConfig "wonderswancolor" addEmulator 1 "$md_id" "wonderswan" "$md_inst/mednafen_wswan_libretro.so" addEmulator 1 "$md_id" "wonderswancolor" "$md_inst/mednafen_wswan_libretro.so" addSystem "wonderswan" addSystem "wonderswancolor" } ================================================ FILE: scriptmodules/libretrocores/lr-bennugd.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-bennugd" rp_module_desc="BennuGD as a libretro core" rp_module_help="ROM Extensions: .dat .dcb\n\nCopy your games to $romdir/bennugd" rp_module_licence="GPL3" rp_module_repo="git https://github.com/diekleinekuh/BennuGD_libretro.git master" rp_module_section="exp" rp_module_flags="" function depends_lr-bennugd() { getDepends cmake libssl-dev libogg-dev libvorbis-dev libmikmod-dev libpng-dev zlib1g-dev libfreetype6-dev } function sources_lr-bennugd() { gitPullOrClone } function build_lr-bennugd() { mkdir build cd build cmake .. -DNO_SYSTEM_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release cmake --build . --clean-first -j md_ret_require="$md_build/build/bennugd_libretro.so" } function install_lr-bennugd() { md_ret_files=( 'build/bennugd_libretro.so' ) } function configure_lr-bennugd() { mkRomDir "bennugd" defaultRAConfig "bennugd" addEmulator 1 "$md_id" "bennugd" "$md_inst/bennugd_libretro.so" addSystem "bennugd" "BennuGD" ".dat .dcb" } ================================================ FILE: scriptmodules/libretrocores/lr-bluemsx.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-bluemsx" rp_module_desc="MSX/MSX2/Colecovision emu - blueMSX port for libretro" rp_module_help="ROM Extensions: .cas .rom .mx1 .mx2 .col .dsk .zip\n\nCopy your MSX/MSX2 games to $romdir/msx\nCopy your Colecovision games to $romdir/coleco\n\nlr-bluemsx requires the BIOS files from the full standalone package of BlueMSX to be copied to '$biosdir/Machines' folder.\nColecovision BIOS needs to be copied to '$biosdir/Machines/COL - ColecoVision\coleco.rom'" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/blueMSX-libretro/master/license.txt" rp_module_repo="git https://github.com/libretro/blueMSX-libretro.git master" rp_module_section="opt" function sources_lr-bluemsx() { gitPullOrClone } function build_lr-bluemsx() { make -f Makefile.libretro clean make -f Makefile.libretro md_ret_require="$md_build/bluemsx_libretro.so" } function install_lr-bluemsx() { md_ret_files=( 'bluemsx_libretro.so' 'README.md' 'system/bluemsx/Databases' 'system/bluemsx/Machines' ) } function configure_lr-bluemsx() { addEmulator 1 "$md_id" "msx" "$md_inst/bluemsx_libretro.so" addSystem "msx" addEmulator 1 "$md_id" "coleco" "$md_inst/bluemsx_libretro.so" addSystem "coleco" [[ "$md_mode" == "remove" ]] && return mkRomDir "msx" defaultRAConfig "msx" # force colecovision system local core_config="$md_conf_root/coleco/retroarch-core-options.cfg" iniConfig " = " '"' "$core_config" iniSet "bluemsx_msxtype" "ColecoVision" "$core_config" chown "$__user":"$__group" "$core_config" mkRomDir "coleco" defaultRAConfig "coleco" "core_options_path" "$core_config" cp -rv "$md_inst/"{Databases,Machines} "$biosdir/" chown -R "$__user":"$__group" "$biosdir/"{Databases,Machines} } ================================================ FILE: scriptmodules/libretrocores/lr-bsnes.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-bsnes" rp_module_desc="Super Nintendo Emulator - bsnes port for libretro (v115)" rp_module_help="ROM Extensions: .bml .smc .sfc .zip\n\nCopy your SNES roms to $romdir/snes" rp_module_licence="GPL3 https://raw.githubusercontent.com/libretro/bsnes/master/LICENSE.txt" rp_module_repo="git https://github.com/libretro/bsnes.git master" rp_module_section="opt" rp_module_flags="!armv6 !:\$__gcc_version:-lt:7" function sources_lr-bsnes() { gitPullOrClone } function build_lr-bsnes() { local params=(target="libretro" build="release" binary="library") make -C bsnes clean "${params[@]}" make -C bsnes "${params[@]}" md_ret_require="$md_build/bsnes/out/bsnes_libretro.so" } function install_lr-bsnes() { md_ret_files=( 'bsnes/out/bsnes_libretro.so' 'LICENSE.txt' 'GPLv3.txt' 'CREDITS.md' 'README.md' ) } function configure_lr-bsnes() { mkRomDir "snes" defaultRAConfig "snes" addEmulator 1 "$md_id" "snes" "$md_inst/bsnes_libretro.so" addSystem "snes" } ================================================ FILE: scriptmodules/libretrocores/lr-caprice32.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-caprice32" rp_module_desc="Amstrad CPC emu - Caprice32 port for libretro" rp_module_help="ROM Extensions: .cdt .cpc .dsk\n\nCopy your Amstrad CPC games to $romdir/amstradcpc" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/libretro-cap32/master/cap32/COPYING.txt" rp_module_repo="git https://github.com/libretro/libretro-cap32.git master" rp_module_section="main" function sources_lr-caprice32() { gitPullOrClone } function build_lr-caprice32() { make clean make md_ret_require="$md_build/cap32_libretro.so" } function install_lr-caprice32() { md_ret_files=( 'cap32_libretro.so' ) } function configure_lr-caprice32() { mkRomDir "amstradcpc" defaultRAConfig "amstradcpc" setRetroArchCoreOption "cap32_autorun" "enabled" setRetroArchCoreOption "cap32_Model" "6128" setRetroArchCoreOption "cap32_Ram" "128" setRetroArchCoreOption "cap32_combokey" "y" addEmulator 1 "$md_id" "amstradcpc" "$md_inst/cap32_libretro.so" addSystem "amstradcpc" } ================================================ FILE: scriptmodules/libretrocores/lr-desmume.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-desmume" rp_module_desc="NDS emu - DESMUME" rp_module_help="ROM Extensions: .nds .zip\n\nCopy your Nintendo DS roms to $romdir/nds" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/desmume/master/desmume/COPYING" rp_module_repo="git https://github.com/libretro/desmume.git master" rp_module_section="exp" function _params_lr-desmume() { local params=() isPlatform "arm" && params+=("platform=unixarmvhardfloat") isPlatform "aarch64" && params+=("DESMUME_JIT=0") echo "${params[@]}" } function depends_lr-desmume() { getDepends libpcap-dev libgl1-mesa-dev } function sources_lr-desmume() { gitPullOrClone } function build_lr-desmume() { cd desmume/src/frontend/libretro make clean make $(_params_lr-desmume) md_ret_require="$md_build/desmume/src/frontend/libretro/desmume_libretro.so" } function install_lr-desmume() { md_ret_files=( 'desmume/src/frontend/libretro/desmume_libretro.so' ) } function configure_lr-desmume() { mkRomDir "nds" defaultRAConfig "nds" addEmulator 0 "$md_id" "nds" "$md_inst/desmume_libretro.so" addSystem "nds" } ================================================ FILE: scriptmodules/libretrocores/lr-desmume2015.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-desmume2015" rp_module_desc="NDS emu - DESMUME (2015 version)" rp_module_help="ROM Extensions: .nds .zip\n\nCopy your Nintendo DS roms to $romdir/nds" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/desmume/master/desmume/COPYING" rp_module_repo="git https://github.com/libretro/desmume2015.git master" rp_module_section="exp" function depends_lr-desmume2015() { depends_lr-desmume } function sources_lr-desmume2015() { gitPullOrClone } function build_lr-desmume2015() { cd desmume make clean make $(_params_lr-desmume) md_ret_require="$md_build/desmume/desmume2015_libretro.so" } function install_lr-desmume2015() { md_ret_files=( 'desmume/desmume2015_libretro.so' ) } function configure_lr-desmume2015() { mkRomDir "nds" defaultRAConfig "nds" addEmulator 0 "$md_id" "nds" "$md_inst/desmume2015_libretro.so" addSystem "nds" } ================================================ FILE: scriptmodules/libretrocores/lr-dinothawr.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-dinothawr" rp_module_desc="Dinothawr - standalone libretro puzzle game" rp_module_help="Dinothawr game assets are automatically installed to $romdir/ports/dinothawr/" rp_module_licence="NONCOM https://raw.githubusercontent.com/libretro/Dinothawr/master/LICENSE" rp_module_repo="git https://github.com/libretro/Dinothawr.git master" rp_module_section="exp" function sources_lr-dinothawr() { gitPullOrClone } function build_lr-dinothawr() { make clean # libretro-common has an issue with neon if isPlatform "neon"; then CFLAGS="" make else make fi md_ret_require="$md_build/dinothawr_libretro.so" } function install_lr-dinothawr() { md_ret_files=( 'dinothawr_libretro.so' 'dinothawr' ) } function configure_lr-dinothawr() { setConfigRoot "ports" addPort "$md_id" "dinothawr" "Dinothawr" "$md_inst/dinothawr_libretro.so" "$romdir/ports/dinothawr/dinothawr.game" mkRomDir "ports/dinothawr" defaultRAConfig "dinothawr" cp -Rv "$md_inst/dinothawr" "$romdir/ports" chown -R "$__user":"$__group" "$romdir/ports/dinothawr" } ================================================ FILE: scriptmodules/libretrocores/lr-dirksimple.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-dirksimple" rp_module_desc="laserdisc emu - DirkSimple" rp_module_help="ROM Extensions: .ogv .dirksimple\n\nCopy your laserdisc movies in Ogg Theora format to $romdir/daphne" rp_module_licence="zlib https://raw.githubusercontent.com/icculus/DirkSimple/main/LICENSE.txt" rp_module_repo="git https://github.com/icculus/DirkSimple.git main" rp_module_section="exp" function depends_lr-dirksimple() { getDepends cmake } function sources_lr-dirksimple() { gitPullOrClone } function build_lr-dirksimple() { rm -fr build && mkdir build cd build cmake -DDIRKSIMPLE_LIBRETRO=ON -DDIRKSIMPLE_SDL=OFF .. make dirksimple_libretro md_ret_require="$md_build/build/dirksimple_libretro.so" } function install_lr-dirksimple() { md_ret_files=( 'build/dirksimple_libretro.so' 'data' 'LICENSE.txt' ) } function configure_lr-dirksimple() { mkRomDir "daphne" defaultRAConfig "daphne" rm -rf "$biosdir/DirkSimple" mkUserDir "$biosdir/DirkSimple" cp -rf "$md_inst/data" "$biosdir/DirkSimple/" chown -R "$__user":"$__group" "$biosdir/DirkSimple" addEmulator 0 "$md_id" "daphne" "$md_inst/dirksimple_libretro.so" addSystem "daphne" } ================================================ FILE: scriptmodules/libretrocores/lr-dolphin.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-dolphin" rp_module_desc="Gamecube/Wii emulator - Dolphin port for libretro" rp_module_help="ROM Extensions: .gcm .iso .wbfs .ciso .gcz\n\nCopy your gamecube roms to $romdir/gc and Wii roms to $romdir/wii" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/dolphin/master/license.txt" rp_module_repo="git https://github.com/libretro/dolphin master" rp_module_section="exp" rp_module_flags="!all 64bit" function depends_lr-dolphin() { depends_dolphin } function sources_lr-dolphin() { gitPullOrClone } function build_lr-dolphin() { mkdir build cd build cmake .. -DLIBRETRO=ON -DLIBRETRO_STATIC=1 make clean make md_ret_require="$md_build/build/dolphin_libretro.so" } function install_lr-dolphin() { md_ret_files=( 'build/dolphin_libretro.so' ) } function configure_lr-dolphin() { mkRomDir "gc" mkRomDir "wii" defaultRAConfig "gc" defaultRAConfig "wii" addEmulator 1 "$md_id" "gc" "$md_inst/dolphin_libretro.so" addEmulator 1 "$md_id" "wii" "$md_inst/dolphin_libretro.so" addSystem "gc" addSystem "wii" } ================================================ FILE: scriptmodules/libretrocores/lr-dosbox-pure.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-dosbox-pure" rp_module_desc="DOS emulator" rp_module_help="ROM Extensions: .bat .com .cue .dosz .exe .ins .ima .img .iso .m3u .m3u8 .vhd .zip\n\nCopy your DOS games to $ROMDIR/pc" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/dosbox-pure/main/LICENSE" rp_module_repo="git https://github.com/libretro/dosbox-pure.git main" rp_module_section="exp" rp_module_flags="" function depends_lr-dosbox-pure() { # lr-dosbox-pure will try and use g++ v9 on arm if the system default is v10 due to bugs # see https://github.com/libretro/dosbox-pure/commit/603b1c7ae isPlatform "arm" && [[ "$__gcc_version" -eq 10 ]] && getDepends g++-9 } function sources_lr-dosbox-pure() { gitPullOrClone } function build_lr-dosbox-pure() { make clean make md_ret_require="$md_build/dosbox_pure_libretro.so" } function install_lr-dosbox-pure() { md_ret_files=( 'LICENSE' 'dosbox_pure_libretro.so' 'README.md' ) } function configure_lr-dosbox-pure() { mkRomDir "pc" defaultRAConfig "pc" addEmulator 0 "$md_id" "pc" "$md_inst/dosbox_pure_libretro.so" addSystem "pc" } ================================================ FILE: scriptmodules/libretrocores/lr-dosbox.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-dosbox" rp_module_desc="DOS emulator" rp_module_help="ROM Extensions: .bat .com .exe .sh\n\nCopy your DOS games to $ROMDIR/pc" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/dosbox-libretro/master/COPYING" rp_module_repo="git https://github.com/libretro/dosbox-libretro.git master" rp_module_section="exp" rp_module_flags="" function sources_lr-dosbox() { gitPullOrClone } function build_lr-dosbox() { local params=() if isPlatform "arm"; then if isPlatform "armv6"; then params+="WITH_DYNAREC=oldarm" else params+="WITH_DYNAREC=arm" fi fi make clean [[ "$__gcc_version" -gt 10 ]] && CXXFLAGS="$CXXFLAGS -std=gnu++11" make "${params[@]}" md_ret_require="$md_build/dosbox_libretro.so" } function install_lr-dosbox() { md_ret_files=( 'COPYING' 'dosbox_libretro.so' 'README' ) } function configure_lr-dosbox() { mkRomDir "pc" defaultRAConfig "pc" addEmulator 0 "$md_id" "pc" "$md_inst/dosbox_libretro.so" addSystem "pc" } ================================================ FILE: scriptmodules/libretrocores/lr-ep128emu.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-ep128emu" rp_module_desc="Enterprise 128 emulator" rp_module_help="ROM Extensions: .img .dsk .tap .dtf .wav .bas .com .trn .128\n\nCopy your Enterprise games to $romdir/enterprise" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/ep128emu-core/refs/heads/core/COPYING" rp_module_repo="git https://github.com/libretro/ep128emu-core.git core" rp_module_section="exp" function sources_lr-ep128emu() { gitPullOrClone } function build_lr-ep128emu() { make clean make md_ret_require="$md_build/ep128emu_core_libretro.so" } function install_lr-ep128emu() { md_ret_files=( 'ep128emu_core_libretro.so' ) } function configure_lr-ep128emu() { mkRomDir "enterprise" ensureSystemretroconfig "enterprise" addEmulator 1 "$md_id" "enterprise" "$md_inst/ep128emu_core_libretro.so" addSystem "enterprise" } ================================================ FILE: scriptmodules/libretrocores/lr-fbalpha2012.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-fbalpha2012" rp_module_desc="Arcade emu - Final Burn Alpha (0.2.97.30) port for libretro" rp_module_help="Previously called lr-fba\n\nROM Extension: .zip\n\nCopy your FBA roms to\n$romdir/fba or\n$romdir/neogeo or\n$romdir/arcade\n\nFor NeoGeo games the neogeo.zip BIOS is required and must be placed in the same directory as your FBA roms." rp_module_licence="NONCOM https://raw.githubusercontent.com/libretro/fbalpha2012/master/docs/license.txt" rp_module_repo="git https://github.com/libretro/fbalpha2012.git master" rp_module_section="opt armv6=main" function _update_hook_lr-fbalpha2012() { # move from old location and update emulators.cfg renameModule "lr-fba" "lr-fbalpha2012" } function sources_lr-fbalpha2012() { gitPullOrClone } function build_lr-fbalpha2012() { cd svn-current/trunk/ make -f makefile.libretro clean local params=() isPlatform "arm" && params+=("platform=armv") make -f makefile.libretro "${params[@]}" md_ret_require="$md_build/svn-current/trunk/fbalpha2012_libretro.so" } function install_lr-fbalpha2012() { md_ret_files=( 'svn-current/trunk/fba.chm' 'svn-current/trunk/fbalpha2012_libretro.so' 'svn-current/trunk/gamelist-gx.txt' 'svn-current/trunk/gamelist.txt' 'svn-current/trunk/whatsnew.html' 'svn-current/trunk/preset-example.zip' ) } function configure_lr-fbalpha2012() { local system for system in arcade fba neogeo; do mkRomDir "$system" defaultRAConfig "$system" addEmulator 0 "$md_id" "$system" "$md_inst/fbalpha2012_libretro.so" addSystem "$system" done } ================================================ FILE: scriptmodules/libretrocores/lr-fbneo.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-fbneo" rp_module_desc="Arcade emu - FinalBurn Neo (latest version) port for libretro" rp_module_help="Previously called lr-fba-next and fbalpha\n\ROM Extension: .zip\n\nCopy your FBA roms to\n$romdir/fba or\n$romdir/neogeo or\n$romdir/arcade\n\nFor NeoGeo games the neogeo.zip BIOS is required and must be placed in the same directory as your FBA roms." rp_module_licence="NONCOM https://raw.githubusercontent.com/libretro/FBNeo/master/src/license.txt" rp_module_repo="git https://github.com/libretro/FBNeo.git master" rp_module_section="main armv6=opt" function _update_hook_lr-fbneo() { # move from old location and update emulators.cfg renameModule "lr-fba-next" "lr-fbalpha" renameModule "lr-fbalpha" "lr-fbneo" } function sources_lr-fbneo() { gitPullOrClone } function build_lr-fbneo() { cd src/burner/libretro local params=() isPlatform "arm" && params+=(USE_CYCLONE=1) isPlatform "neon" && params+=(HAVE_NEON=1) isPlatform "x86" && isPlatform "64bit" && params+=(USE_X64_DRC=1) make clean make "${params[@]}" md_ret_require="$md_build/src/burner/libretro/fbneo_libretro.so" } function install_lr-fbneo() { md_ret_files=( 'fbahelpfilesrc/fbneo.chm' 'src/burner/libretro/fbneo_libretro.so' 'gamelist.txt' 'whatsnew.html' 'metadata' 'dats' ) } function configure_lr-fbneo() { local def=1 isPlatform "armv6" && def=0 addEmulator 0 "$md_id" "arcade" "$md_inst/fbneo_libretro.so" addEmulator 0 "$md_id-neocd" "arcade" "$md_inst/fbneo_libretro.so --subsystem neocd" addEmulator $def "$md_id" "neogeo" "$md_inst/fbneo_libretro.so" addEmulator 0 "$md_id-neocd" "neogeo" "$md_inst/fbneo_libretro.so --subsystem neocd" addEmulator $def "$md_id" "fba" "$md_inst/fbneo_libretro.so" addEmulator 0 "$md_id-neocd" "fba" "$md_inst/fbneo_libretro.so --subsystem neocd" addEmulator 0 "$md_id-pce" "pcengine" "$md_inst/fbneo_libretro.so --subsystem pce" addEmulator 0 "$md_id-sgx" "pcengine" "$md_inst/fbneo_libretro.so --subsystem sgx" addEmulator 0 "$md_id-tg" "pcengine" "$md_inst/fbneo_libretro.so --subsystem tg" addEmulator 0 "$md_id-gg" "gamegear" "$md_inst/fbneo_libretro.so --subsystem gg" addEmulator 0 "$md_id-sms" "mastersystem" "$md_inst/fbneo_libretro.so --subsystem sms" addEmulator 0 "$md_id-md" "megadrive" "$md_inst/fbneo_libretro.so --subsystem md" addEmulator 0 "$md_id-sg1k" "sg-1000" "$md_inst/fbneo_libretro.so --subsystem sg1k" addEmulator 0 "$md_id-cv" "coleco" "$md_inst/fbneo_libretro.so --subsystem cv" addEmulator 0 "$md_id-msx" "msx" "$md_inst/fbneo_libretro.so --subsystem msx" addEmulator 0 "$md_id-spec" "zxspectrum" "$md_inst/fbneo_libretro.so --subsystem spec" addEmulator 0 "$md_id-fds" "fds" "$md_inst/fbneo_libretro.so --subsystem fds" addEmulator 0 "$md_id-nes" "nes" "$md_inst/fbneo_libretro.so --subsystem nes" addEmulator 0 "$md_id-ngp" "ngp" "$md_inst/fbneo_libretro.so --subsystem ngp" addEmulator 0 "$md_id-ngpc" "ngpc" "$md_inst/fbneo_libretro.so --subsystem ngp" addEmulator 0 "$md_id-chf" "channelf" "$md_inst/fbneo_libretro.so --subsystem chf" addEmulator 0 "$md_id-snes" "snes" "$md_inst/fbneo_libretro.so --subsystem snes" local systems=( "arcade" "neogeo" "fba" "pcengine" "gamegear" "mastersystem" "megadrive" "sg-1000" "coleco" "msx" "zxspectrum" "fds" "nes" "ngp" "ngpc" "channelf" "snes" ) local system for system in "${systems[@]}"; do addSystem "$system" done [[ "$md_mode" == "remove" ]] && return for system in "${systems[@]}"; do mkRomDir "$system" defaultRAConfig "$system" done # Create directories for all support files mkUserDir "$biosdir/fbneo" mkUserDir "$biosdir/fbneo/blend" mkUserDir "$biosdir/fbneo/cheats" mkUserDir "$biosdir/fbneo/patched" mkUserDir "$biosdir/fbneo/samples" mkUserDir "$biosdir/fbneo/ips" mkUserDir "$biosdir/fbneo/romdata" # copy hiscore.dat cp "$md_inst/metadata/hiscore.dat" "$biosdir/fbneo/" chown "$__user":"$__group" "$biosdir/fbneo/hiscore.dat" # Set core options setRetroArchCoreOption "fbneo-diagnostic-input" "Hold Start" } ================================================ FILE: scriptmodules/libretrocores/lr-fceumm.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-fceumm" rp_module_desc="NES emu - FCEUmm port for libretro" rp_module_help="ROM Extensions: .nes .zip\n\nCopy your NES roms to $romdir/nes\n\nFor the Famicom Disk System copy your roms to $romdir/fds\n\nFor the Famicom Disk System copy the required BIOS file disksys.rom to $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/libretro-fceumm/master/Copying" rp_module_repo="git https://github.com/libretro/libretro-fceumm.git master" rp_module_section="main" function sources_lr-fceumm() { gitPullOrClone } function build_lr-fceumm() { make -f Makefile.libretro clean make -f Makefile.libretro md_ret_require="$md_build/fceumm_libretro.so" } function install_lr-fceumm() { md_ret_files=( 'Authors' 'changelog.txt' 'Copying' 'fceumm_libretro.so' 'whatsnew.txt' 'zzz_todo.txt' ) } function configure_lr-fceumm() { mkRomDir "nes" mkRomDir "fds" defaultRAConfig "nes" defaultRAConfig "fds" local def=1 isPlatform "armv6" && def=0 addEmulator "$def" "$md_id" "nes" "$md_inst/fceumm_libretro.so" addEmulator 0 "$md_id" "fds" "$md_inst/fceumm_libretro.so" addSystem "nes" addSystem "fds" } ================================================ FILE: scriptmodules/libretrocores/lr-flycast/01_flags_fix.diff ================================================ diff --git a/Makefile b/Makefile index 2c477b4d..92a67b62 100644 --- a/Makefile +++ b/Makefile @@ -44,8 +44,6 @@ LDFLAGS := LDFLAGS_END := INCFLAGS := LIBS := -CFLAGS := -CXXFLAGS := GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)" ifneq ($(GIT_VERSION)," unknown") @@ -208,6 +206,7 @@ else ifneq (,$(findstring rpi,$(platform))) endif CORE_DEFINES += -DLOW_END endif + LDFLAGS += $(CFLAGS) # Classic Platforms ##################### # Platform affix = classic__<µARCH> @@ -894,7 +893,7 @@ else else ifneq (,$(findstring classic_arm,$(platform))) OPTFLAGS := -O2 else ifeq (,$(findstring classic_arm,$(platform))) - OPTFLAGS := -O3 + OPTFLAGS := -O2 endif CORE_DEFINES += -DNDEBUG ================================================ FILE: scriptmodules/libretrocores/lr-flycast-dev.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-flycast-dev" rp_module_desc="Multiplatform Sega Dreamcast, Naomi, Naomi 2 and Atomiswave emulator" rp_module_help="Dreamcast ROM Extensions: .cdi .gdi .chd .m3u, Naomi/Atomiswave ROM Extension: .zip\n\nCopy your Dreamcast/Naomi roms to $romdir/dreamcast\n\nCopy the required Dreamcast BIOS files dc_boot.bin and dc_flash.bin to $biosdir/dc\n\nCopy the required Naomi/Atomiswave BIOS files naomi.zip/naomigd.zip and awbios.zip to $biosdir/dc" rp_module_licence="GPL2 https://raw.githubusercontent.com/flyinghead/flycast/master/LICENSE" rp_module_repo="git https://github.com/flyinghead/flycast.git master" rp_module_section="exp" rp_module_flags="!armv6 !videocore !:\$__gcc_version:-lt:9" function depends_lr-flycast-dev() { local depends=(zlib1g-dev libgl-dev cmake) getDepends "${depends[@]}" } function sources_lr-flycast-dev() { gitPullOrClone } function build_lr-flycast-dev() { local params=("-DLIBRETRO=ON -DWITH_SYSTEM_ZLIB=ON -DCMAKE_BUILD_TYPE=Release") if isPlatform "gles3"; then params+=("-DUSE_GLES=ON") elif isPlatform "gles"; then params+=("-DUSE_GLES2=ON") fi isPlatform "vulkan" && params+=("-DUSE_VULKAN=ON") || params+=("-DUSE_VULKAN=OFF") rm -fr build && mkdir build cd build cmake "${params[@]}" .. make md_ret_require="$md_build/build/flycast_libretro.so" } function install_lr-flycast-dev() { md_ret_files=( 'build/flycast_libretro.so' 'LICENSE' 'README.md' ) } function configure_lr-flycast-dev() { local sys local def for sys in "arcade" "dreamcast"; do def=0 isPlatform "kms" && [[ "$sys" == "dreamcast" ]] && def=1 # segfaults on the rpi without redirecting stdin from drive+Drive; /* Current drive where the track change occurred */ @@ -496,7 +497,7 @@ static void IPF_CallBack_Trk ( struct CapsFdc *pc , CapsULong State ) * Callback function used when the FDC change the IRQ signal */ #ifdef HAVE_CAPSIMAGE -static void IPF_CallBack_Irq ( struct CapsFdc *pc , CapsULong State ) +static void IPF_CallBack_Irq ( struct CapsFdc *pc , Uint32 State ) { LOG_TRACE(TRACE_FDC, "fdc ipf callback irq state=0x%x VBL=%d HBL=%d\n" , (int)State , nVBLs , nHBL ); @@ -515,7 +516,7 @@ static void IPF_CallBack_Irq ( struct CapsFdc *pc , CapsULong State ) * -> copy the byte to/from the DMA's FIFO if it's a read or a write to the disk */ #ifdef HAVE_CAPSIMAGE -static void IPF_CallBack_Drq ( struct CapsFdc *pc , CapsULong State ) +static void IPF_CallBack_Drq ( struct CapsFdc *pc , Uint32 State ) { Uint8 Byte; ================================================ FILE: scriptmodules/libretrocores/lr-hatari.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-hatari" rp_module_desc="Atari emulator - Hatari port for libretro" rp_module_help="ROM Extensions: .st .stx .img .rom .raw .ipf .ctr .zip\n\nCopy your Atari ST games to $romdir/atarist" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/hatari/master/gpl.txt" rp_module_repo="git https://github.com/libretro/hatari.git master" rp_module_section="exp" function depends_lr-hatari() { getDepends zlib1g-dev } function sources_lr-hatari() { gitPullOrClone applyPatch "$md_data/01_libcapsimage.diff" _sources_libcapsimage_hatari } function build_lr-hatari() { _build_libcapsimage_hatari cd "$md_build" CFLAGS+=" -D__cdecl='' -I\"$md_build/src/includes/caps\" -DHAVE_CAPSIMAGE=1 -DCAPSIMAGE_VERSION=5" CAPSIMG_LDFLAGS="-L./lib -l:libcapsimage.so.5.1" make -f Makefile.libretro md_ret_require="$md_build/hatari_libretro.so" } function install_lr-hatari() { _install_libcapsimage_hatari md_ret_files=( 'hatari_libretro.so' 'readme.txt' 'gpl.txt' ) } function configure_lr-hatari() { mkRomDir "atarist" defaultRAConfig "atarist" # move any old configs to new location moveConfigDir "$home/.hatari" "$md_conf_root/atarist" addEmulator 1 "$md_id" "atarist" "$md_inst/hatari_libretro.so" addSystem "atarist" [[ "$md_mode" == "remove" ]] && return # add LD_LIBRARY_PATH='$md_inst' to start of launch command iniConfig " = " '"' "$configdir/atarist/emulators.cfg" iniGet "$md_id" iniSet "$md_id" "LD_LIBRARY_PATH='$md_inst' $ini_value" } ================================================ FILE: scriptmodules/libretrocores/lr-kronos.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-kronos" rp_module_desc="Saturn & ST-V emulator - Kronos port for libretro" rp_module_help="ROM Extensions: .iso .cue .zip .ccd .mds\n\nCopy your Sega Saturn & ST-V roms to $romdir/saturn\n\nCopy the required BIOS file saturn_bios.bin / stvbios.zip to $biosdir/kronos" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/yabause/kronos/yabause/COPYING" rp_module_repo="git https://github.com/libretro/yabause.git kronos" rp_module_section="exp" rp_module_flags="!arm !aarch64" function sources_lr-kronos() { gitPullOrClone } function build_lr-kronos() { cd yabause/src/libretro make clean make md_ret_require="$md_build/yabause/src/libretro/kronos_libretro.so" } function install_lr-kronos() { md_ret_files=( 'yabause/src/libretro/kronos_libretro.so' 'yabause/AUTHORS' 'yabause/COPYING' 'yabause/ChangeLog' 'yabause/GOALS' 'yabause/README' 'yabause/README.LIN' ) } function configure_lr-kronos() { mkRomDir "saturn" defaultRAConfig "saturn" addEmulator 1 "$md_id" "saturn" "$md_inst/kronos_libretro.so" addSystem "saturn" } ================================================ FILE: scriptmodules/libretrocores/lr-mame.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-mame" rp_module_desc="MAME emulator - MAME (current) port for libretro" rp_module_help="ROM Extension: .zip\n\nCopy your MAME roms to either $romdir/mame-libretro or\n$romdir/arcade" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/mame/master/COPYING" rp_module_repo="git https://github.com/libretro/mame.git :_get_version_lr-mame" rp_module_section="exp" rp_module_flags="!:\$__gcc_version:-lt:7" function _get_version_lr-mame() { if compareVersions "$(gcc -dumpfullversion)" lt 10.3.0; then echo "lrmame0264" fi } function _get_params_lr-mame() { local params=(OSD=retro RETRO=1 PYTHON_EXECUTABLE=python3 NOWERROR=1 OS=linux OPTIMIZE=2 TARGETOS=linux CONFIG=libretro NO_USE_MIDI=1 NO_USE_PORTAUDIO=1 TARGET=mame) isPlatform "64bit" && params+=(PTR64=1) # force arm on arm platform - fixes building mame on when using 32bit arm userland with aarch64 kernel isPlatform "arm" && params+=(PLATFORM=arm) echo "${params[@]}" } function depends_lr-mame() { local depends=(libasound2-dev) isPlatform "gles" && depends+=(libgles2-mesa-dev) isPlatform "gl" && depends+=(libglu1-mesa-dev) getDepends "${depends[@]}" } function sources_lr-mame() { gitPullOrClone } function build_lr-mame() { if isPlatform "64bit"; then rpSwap on 10240 else rpSwap on 6144 fi local params=($(_get_params_lr-mame) SUBTARGET=arcade) make clean make "${params[@]}" rpSwap off md_ret_require="$md_build/mamearcade_libretro.so" } function install_lr-mame() { md_ret_files=( 'COPYING' 'mamearcade_libretro.so' 'README.md' 'plugins' ) } function configure_lr-mame() { local system for system in arcade mame-libretro; do mkRomDir "$system" defaultRAConfig "$system" addEmulator 0 "$md_id" "$system" "$md_inst/mamearcade_libretro.so" addSystem "$system" done [[ "$md_mode" == "remove" ]] && return mkUserDir "$biosdir/mame" mkUserDir "$biosdir/mame/ini" # Create new INI files if they do not already exist # Create mame.ini local temp_ini_mame="$(mktemp)" iniConfig " " "" "$temp_ini_mame" iniSet "pluginspath" "$biosdir/mame/plugins" copyDefaultConfig "$temp_ini_mame" "$biosdir/mame/ini/mame.ini" # Create plugin.ini local temp_ini_plugin="$(mktemp)" iniConfig " " "" "$temp_ini_plugin" iniSet "hiscore" "1" copyDefaultConfig "$temp_ini_plugin" "$biosdir/mame/ini/plugin.ini" # Copy plugins to BIOS directory cp -R "$md_inst/plugins" "$biosdir/mame/" # Set permissions chown "$__user":"$__group" -R "$biosdir/mame/" } ================================================ FILE: scriptmodules/libretrocores/lr-mame2000.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-mame2000" rp_module_desc="Arcade emu - MAME 0.37b5 port for libretro" rp_module_help="ROM Extension: .zip\n\nCopy your MAME 0.37b5 roms to either $romdir/mame-mame4all or\n$romdir/arcade" rp_module_licence="NONCOM https://raw.githubusercontent.com/libretro/mame2000-libretro/master/readme.txt" rp_module_repo="git https://github.com/libretro/mame2000-libretro.git master" rp_module_section="opt armv6=main" function _update_hook_lr-mame2000() { # move from old location and update emulators.cfg renameModule "lr-imame4all" "lr-mame2000" } function sources_lr-mame2000() { gitPullOrClone } function build_lr-mame2000() { make clean local params=() isPlatform "arm" && params+=("ARM=1" "USE_CYCLONE=1") isPlatform "aarch64" && params+=("IS_X86=0") make "${params[@]}" md_ret_require="$md_build/mame2000_libretro.so" } function install_lr-mame2000() { md_ret_files=( 'mame2000_libretro.so' 'readme.md' 'readme.txt' 'whatsnew.txt' ) } function configure_lr-mame2000() { local system for system in arcade mame-mame4all mame-libretro; do mkRomDir "$system" defaultRAConfig "$system" addEmulator 0 "$md_id" "$system" "$md_inst/mame2000_libretro.so" addSystem "$system" done } ================================================ FILE: scriptmodules/libretrocores/lr-mame2003-plus.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-mame2003-plus" rp_module_desc="Arcade emu - updated MAME 0.78 port for libretro with added game support" rp_module_help="ROM Extension: .zip\n\nCopy your MAME roms to either $romdir/mame-libretro or\n$romdir/arcade" rp_module_licence="NONCOM https://raw.githubusercontent.com/libretro/mame2003-plus-libretro/master/LICENSE.md" rp_module_repo="git https://github.com/libretro/mame2003-plus-libretro.git master" rp_module_section="opt" function _get_dir_name_lr-mame2003-plus() { echo "mame2003-plus" } function _get_so_name_lr-mame2003-plus() { echo "mame2003_plus" } function sources_lr-mame2003-plus() { gitPullOrClone } function build_lr-mame2003-plus() { build_lr-mame2003 } function install_lr-mame2003-plus() { install_lr-mame2003 } function configure_lr-mame2003-plus() { configure_lr-mame2003 } ================================================ FILE: scriptmodules/libretrocores/lr-mame2003.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-mame2003" rp_module_desc="Arcade emu - MAME 0.78 port for libretro" rp_module_help="ROM Extension: .zip\n\nCopy your MAME roms to either $romdir/mame-libretro or\n$romdir/arcade" rp_module_licence="NONCOM https://raw.githubusercontent.com/libretro/mame2003-libretro/master/LICENSE.md" rp_module_repo="git https://github.com/libretro/mame2003-libretro.git master" rp_module_section="main armv6=opt" function _get_dir_name_lr-mame2003() { echo "mame2003" } function _get_so_name_lr-mame2003() { echo "mame2003" } function sources_lr-mame2003() { gitPullOrClone } function build_lr-mame2003() { rpSwap on 750 make clean local params=() isPlatform "arm" && params+=("ARM=1") make ARCH="$CFLAGS" "${params[@]}" rpSwap off md_ret_require="$md_build/$(_get_so_name_${md_id})_libretro.so" } function install_lr-mame2003() { md_ret_files=( "$(_get_so_name_${md_id})_libretro.so" 'README.md' 'CHANGELOG.md' 'metadata' ) } function configure_lr-mame2003() { local so_name="$(_get_so_name_${md_id})" addEmulator 0 "$md_id" "arcade" "$md_inst/${so_name}_libretro.so" addEmulator 1 "$md_id" "mame-libretro" "$md_inst/${so_name}_libretro.so" addSystem "arcade" addSystem "mame-libretro" [[ "$md_mode" == "remove" ]] && return local dir_name="$(_get_dir_name_${md_id})" local mame_dir local mame_sub_dir for mame_dir in arcade mame-libretro; do mkRomDir "$mame_dir" mkRomDir "$mame_dir/$dir_name" defaultRAConfig "$mame_dir" for mame_sub_dir in cfg ctrlr diff hi memcard nvram; do mkRomDir "$mame_dir/$dir_name/$mame_sub_dir" done done mkUserDir "$biosdir/$dir_name" mkUserDir "$biosdir/$dir_name/samples" # copy hiscore.dat and cheat.dat cp "$md_inst/metadata/"{hiscore.dat,cheat.dat} "$biosdir/$dir_name/" chown "$__user":"$__group" "$biosdir/$dir_name/"{hiscore.dat,cheat.dat} # lr-mame2003-plus also has an artwork folder if [[ "$md_id" == "lr-mame2003-plus" ]]; then mkUserDir "$biosdir/$dir_name/artwork" cp "$md_inst/metadata/artwork/"* "$biosdir/$dir_name/artwork/" chown -R "$__user":"$__group" "$biosdir/$dir_name/artwork" fi # Set core options setRetroArchCoreOption "${dir_name}_skip_disclaimer" "enabled" } ================================================ FILE: scriptmodules/libretrocores/lr-mame2010.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-mame2010" rp_module_desc="Arcade emu - MAME 0.139 port for libretro" rp_module_help="ROM Extension: .zip\n\nCopy your MAME roms to either $romdir/mame-libretro or\n$romdir/arcade" rp_module_licence="NONCOM https://raw.githubusercontent.com/libretro/mame2010-libretro/master/docs/license.txt" rp_module_repo="git https://github.com/libretro/mame2010-libretro.git master" rp_module_section="opt" function depends_lr-mame2010() { getDepends zlib1g-dev } function sources_lr-mame2010() { gitPullOrClone } function build_lr-mame2010() { rpSwap on 750 make clean local params=() ! isPlatform "x86" && params+=("VRENDER=soft" "FORCE_DRC_C_BACKEND=1") # ARM_ENABLED flag is only used in osinline.h for the YieldProcessor macro and is needed also for aarch64 if isPlatform "arm" || isPlatform "aarch64"; then params+=("ARM_ENABLED=1") fi isPlatform "64bit" && params+=("PTR64=1") make "${params[@]}" ARCHOPTS="$CFLAGS" buildtools make "${params[@]}" ARCHOPTS="$CFLAGS" rpSwap off md_ret_require="$md_build/mame2010_libretro.so" } function install_lr-mame2010() { md_ret_files=( 'mame2010_libretro.so' 'README.md' ) } function configure_lr-mame2010() { local system for system in arcade mame-libretro; do mkRomDir "$system" defaultRAConfig "$system" addEmulator 0 "$md_id" "$system" "$md_inst/mame2010_libretro.so" addSystem "$system" done } ================================================ FILE: scriptmodules/libretrocores/lr-mame2015/01-python3-irgen.diff ================================================ diff --git a/src/emu/cpu/m6502/m6502make.py b/src/emu/cpu/m6502/m6502make.py index da29fc7..3de641d 100755 --- a/src/emu/cpu/m6502/m6502make.py +++ b/src/emu/cpu/m6502/m6502make.py @@ -16,7 +16,7 @@ def load_opcodes(fname): opcodes = [] logging.info("load_opcodes: %s", fname) try: - f = open(fname, "rU") + f = open(fname, "r") except Exception: err = sys.exc_info()[1] logging.error("cannot read opcodes file %s [%s]", fname, err) @@ -39,7 +39,7 @@ def load_disp(fname): logging.info("load_disp: %s", fname) states = [] try: - f = open(fname, "rU") + f = open(fname, "r") except Exception: err = sys.exc_info()[1] logging.error("cannot read display file %s [%s]", fname, err) diff --git a/src/emu/cpu/m6809/m6809make.py b/src/emu/cpu/m6809/m6809make.py index c3d5b0f..79f6f90 100644 --- a/src/emu/cpu/m6809/m6809make.py +++ b/src/emu/cpu/m6809/m6809make.py @@ -14,7 +14,7 @@ def load_file(fname, lines): if path != "": path += '/' try: - f = open(fname, "rU") + f = open(fname, "r") except Exception: err = sys.exc_info()[1] sys.stderr.write("Cannot read opcodes file %s [%s]\n" % (fname, err)) diff --git a/src/emu/cpu/mcs96/mcs96make.py b/src/emu/cpu/mcs96/mcs96make.py index ec5ec37..7ab806a 100644 --- a/src/emu/cpu/mcs96/mcs96make.py +++ b/src/emu/cpu/mcs96/mcs96make.py @@ -71,7 +71,7 @@ class OpcodeList: self.ea = {} self.macros = {} try: - f = open(fname, "rU") + f = open(fname, "r") except Exception: err = sys.exc_info()[1] sys.stderr.write("Cannot read opcodes file %s [%s]\n" % (fname, err)) diff --git a/src/emu/cpu/tms57002/tmsmake.py b/src/emu/cpu/tms57002/tmsmake.py index 6209209..78f9fe4 100755 --- a/src/emu/cpu/tms57002/tmsmake.py +++ b/src/emu/cpu/tms57002/tmsmake.py @@ -326,7 +326,7 @@ def ins_cmp_dasm(a, b): def LoadLst(filename): instructions = [] ins = None - for n, line in enumerate(open(filename, "rU")): + for n, line in enumerate(open(filename, "r")): line = line.rstrip() if not line and ins: # new lines separate intructions ================================================ FILE: scriptmodules/libretrocores/lr-mame2015.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-mame2015" rp_module_desc="Arcade emu - MAME 0.160 port for libretro" rp_module_help="ROM Extension: .zip\n\nCopy your MAME roms to either $romdir/mame-libretro or\n$romdir/arcade" rp_module_licence="NONCOM https://raw.githubusercontent.com/libretro/mame2015-libretro/master/docs/license.txt" rp_module_repo="git https://github.com/libretro/mame2015-libretro.git master" rp_module_section="exp" function _update_hook_lr-mame2015() { # move from old location and update emulators.cfg renameModule "lr-mame2014" "lr-mame2015" } function sources_lr-mame2015() { gitPullOrClone applyPatch "$md_data/01-python3-irgen.diff" } function build_lr-mame2015() { rpSwap on 1200 make clean make rpSwap off md_ret_require="$md_build/mame2015_libretro.so" } function install_lr-mame2015() { md_ret_files=( 'mame2015_libretro.so' 'docs/README-original.md' 'docs/license.txt' ) } function configure_lr-mame2015() { local system for system in arcade mame-libretro; do mkRomDir "$system" defaultRAConfig "$system" addEmulator 0 "$md_id" "$system" "$md_inst/mame2015_libretro.so" addSystem "$system" done } ================================================ FILE: scriptmodules/libretrocores/lr-mame2016/01-python3-irgen.diff ================================================ diff --git a/src/devices/cpu/m6502/m6502make.py b/src/devices/cpu/m6502/m6502make.py index 8bcd85f8..557b1759 100755 --- a/src/devices/cpu/m6502/m6502make.py +++ b/src/devices/cpu/m6502/m6502make.py @@ -18,7 +18,7 @@ def load_opcodes(fname): opcodes = [] logging.info("load_opcodes: %s", fname) try: - f = open(fname, "rU") + f = open(fname, "r") except Exception: err = sys.exc_info()[1] logging.error("cannot read opcodes file %s [%s]", fname, err) @@ -41,7 +41,7 @@ def load_disp(fname): logging.info("load_disp: %s", fname) states = [] try: - f = open(fname, "rU") + f = open(fname, "r") except Exception: err = sys.exc_info()[1] logging.error("cannot read display file %s [%s]", fname, err) diff --git a/src/devices/cpu/m6809/m6809make.py b/src/devices/cpu/m6809/m6809make.py index 8838b960..e1ea25db 100644 --- a/src/devices/cpu/m6809/m6809make.py +++ b/src/devices/cpu/m6809/m6809make.py @@ -16,7 +16,7 @@ def load_file(fname, lines): if path != "": path += '/' try: - f = open(fname, "rU") + f = open(fname, "r") except Exception: err = sys.exc_info()[1] sys.stderr.write("Cannot read opcodes file %s [%s]\n" % (fname, err)) diff --git a/src/devices/cpu/mcs96/mcs96make.py b/src/devices/cpu/mcs96/mcs96make.py index b4844942..207208d2 100644 --- a/src/devices/cpu/mcs96/mcs96make.py +++ b/src/devices/cpu/mcs96/mcs96make.py @@ -73,7 +73,7 @@ class OpcodeList: self.ea = {} self.macros = {} try: - f = open(fname, "rU") + f = open(fname, "r") except Exception: err = sys.exc_info()[1] sys.stderr.write("Cannot read opcodes file %s [%s]\n" % (fname, err)) diff --git a/src/devices/cpu/tms57002/tmsmake.py b/src/devices/cpu/tms57002/tmsmake.py index e2e12b5a..942ec095 100755 --- a/src/devices/cpu/tms57002/tmsmake.py +++ b/src/devices/cpu/tms57002/tmsmake.py @@ -323,7 +323,7 @@ class Instruction: def LoadLst(filename): instructions = [] ins = None - for n, line in enumerate(open(filename, "rU")): + for n, line in enumerate(open(filename, "r")): line = line.rstrip() if not line and ins: # new lines separate intructions ================================================ FILE: scriptmodules/libretrocores/lr-mame2016.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-mame2016" rp_module_desc="MAME emulator - MAME 0.174 port for libretro" rp_module_help="ROM Extension: .zip\n\nCopy your MAME roms to either $romdir/mame-libretro or\n$romdir/arcade" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/mame2016-libretro/master/LICENSE.md" rp_module_repo="git https://github.com/libretro/mame2016-libretro.git master" rp_module_section="exp" rp_module_flags="" function depends_lr-mame2016() { getDepends libasound2-dev } function sources_lr-mame2016() { gitPullOrClone applyPatch "${md_path%/*}/lr-mame2016/01-python3-irgen.diff" } function build_lr-mame2016() { rpSwap on 1200 local params=($(_get_params_lr-mame) SUBTARGET=arcade) make -f Makefile.libretro clean make -f Makefile.libretro "${params[@]}" rpSwap off md_ret_require="$md_build/mamearcade2016_libretro.so" } function install_lr-mame2016() { md_ret_files=( 'mamearcade2016_libretro.so' ) } function configure_lr-mame2016() { local system for system in arcade mame-libretro; do mkRomDir "$system" defaultRAConfig "$system" addEmulator 0 "$md_id" "$system" "$md_inst/mamearcade2016_libretro.so" addSystem "$system" done } ================================================ FILE: scriptmodules/libretrocores/lr-mesen.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-mesen" rp_module_desc="High-accuracy NES and Famicom emulator" rp_module_help="ROM Extensions: .nes .fds .unf .unif .zip\n\nCopy your NES roms to $romdir/nes\nFamicom roms to $romdir/fds\nCopy the recommended BIOS file disksys.rom to $biosdir" rp_module_licence="GPL3 https://raw.githubusercontent.com/sourmesen/mesen/master/LICENSE" rp_module_repo="git https://github.com/libretro/Mesen.git master" rp_module_section="exp" rp_module_flags="!armv6" function sources_lr-mesen() { gitPullOrClone } function build_lr-mesen() { make -C Libretro clean make -C Libretro md_ret_require="$md_build/Libretro/mesen_libretro.so" } function install_lr-mesen() { md_ret_files=( 'Libretro/mesen_libretro.so' 'LICENSE' 'README.md' ) } function configure_lr-mesen() { local system for system in "nes" "fds"; do mkRomDir "$system" defaultRAConfig "$system" addEmulator 0 "$md_id" "$system" "$md_inst/mesen_libretro.so" addSystem "$system" done } ================================================ FILE: scriptmodules/libretrocores/lr-mess.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-mess" rp_module_desc="MESS emulator - MESS Port for libretro" rp_module_help="see wiki for detailed explanation" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/mame/master/COPYING" rp_module_repo="git https://github.com/libretro/mame.git :_get_version_lr-mame" rp_module_section="exp" rp_module_flags="" function depends_lr-mess() { depends_lr-mame } function sources_lr-mess() { gitPullOrClone } function build_lr-mess() { if isPlatform "64bit"; then rpSwap on 10240 else rpSwap on 6144 fi local params=($(_get_params_lr-mame) SUBTARGET=mess) make clean make "${params[@]}" rpSwap off md_ret_require="$md_build/mamemess_libretro.so" } function install_lr-mess() { md_ret_files=( 'COPYING' 'mamemess_libretro.so' 'README.md' 'hash' ) } function configure_lr-mess() { local module="$1" [[ -z "$module" ]] && module="mamemess_libretro.so" local system for system in nes gb coleco arcadia crvision; do mkRomDir "$system" defaultRAConfig "$system" addEmulator 0 "$md_id" "$system" "$md_inst/$module" addSystem "$system" done [[ "$md_mode" == "remove" ]] && return setRetroArchCoreOption "mame_softlists_enable" "enabled" setRetroArchCoreOption "mame_softlists_auto_media" "enabled" setRetroArchCoreOption "mame_boot_from_cli" "enabled" mkUserDir "$biosdir/mame" cp -rv "$md_inst/hash" "$biosdir/mame/" chown -R "$__user":"$__group" "$biosdir/mame" } ================================================ FILE: scriptmodules/libretrocores/lr-mess2016.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-mess2016" rp_module_desc="MESS emulator - MESS Port for libretro" rp_module_help="see wiki for detailed explanation" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/mame2016-libretro/master/LICENSE.md" rp_module_repo="git https://github.com/libretro/mame2016-libretro.git master" rp_module_section="exp" rp_module_flags="" function depends_lr-mess2016() { depends_lr-mame2016 } function sources_lr-mess2016() { gitPullOrClone applyPatch "${md_path%/*}/lr-mame2016/01-python3-irgen.diff" } function build_lr-mess2016() { rpSwap on 1200 local params=($(_get_params_lr-mame) SUBTARGET=mess) make clean make "${params[@]}" rpSwap off md_ret_require="$md_build/mess2016_libretro.so" } function install_lr-mess2016() { md_ret_files=( 'mess2016_libretro.so' ) } function configure_lr-mess2016() { configure_lr-mess "mess2016_libretro.so" } ================================================ FILE: scriptmodules/libretrocores/lr-mgba.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-mgba" rp_module_desc="(Super) Game Boy Color/GBA emulator - MGBA (optimised) port for libretro" rp_module_help="ROM Extensions: .gb .gbc .gba .zip\n\nCopy your Game Boy roms to $romdir/gb\nGame Boy Color roms to $romdir/gbc\nGame Boy Advance roms to $romdir/gba\n\nCopy the recommended BIOS files gb_bios.bin, gbc_bios.bin, sgb_bios.bin and gba_bios.bin to $biosdir" rp_module_licence="MPL2 https://raw.githubusercontent.com/libretro/mgba/master/LICENSE" rp_module_repo="git https://github.com/libretro/mgba.git master" rp_module_section="main" rp_module_flags="" function sources_lr-mgba() { gitPullOrClone } function build_lr-mgba() { make -f Makefile.libretro clean make -f Makefile.libretro md_ret_require="$md_build/mgba_libretro.so" } function install_lr-mgba() { md_ret_files=( 'mgba_libretro.so' 'CHANGES' 'LICENSE' 'README.md' ) } function configure_lr-mgba() { local system local def for system in gb gbc gba; do def=0 [[ "$system" == "gba" ]] && ! isPlatform "armv6" && def=1 mkRomDir "$system" defaultRAConfig "$system" addEmulator "$def" "$md_id" "$system" "$md_inst/mgba_libretro.so" addSystem "$system" done } ================================================ FILE: scriptmodules/libretrocores/lr-mrboom.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-mrboom" rp_module_desc="Mr.Boom - 8 players Bomberman clone for libretro." rp_module_help="8 players Bomberman clone for libretro." rp_module_licence="MIT https://raw.githubusercontent.com/libretro/mrboom-libretro/master/LICENSE" rp_module_repo="git https://github.com/libretro/mrboom-libretro.git master" rp_module_section="opt" function sources_lr-mrboom() { gitPullOrClone } function build_lr-mrboom() { rpSwap on 1000 make clean if isPlatform "neon"; then make HAVE_NEON=1 else make fi md_ret_require="$md_build/mrboom_libretro.so" } function install_lr-mrboom() { md_ret_files=( 'mrboom_libretro.so' 'LICENSE' 'README.md' ) } function configure_lr-mrboom() { setConfigRoot "ports" addPort "$md_id" "mrboom" "Mr.Boom" "$emudir/retroarch/bin/retroarch -L $md_inst/mrboom_libretro.so --config $md_conf_root/mrboom/retroarch.cfg" mkRomDir "ports/mrboom" defaultRAConfig "mrboom" } ================================================ FILE: scriptmodules/libretrocores/lr-mupen64plus/0001-eliminate-conflicting-typedefs.patch ================================================ diff --git a/libretro-common/include/glsm/glsm.h b/libretro-common/include/glsm/glsm.h index d422267..ecafdb2 100644 --- a/libretro-common/include/glsm/glsm.h +++ b/libretro-common/include/glsm/glsm.h @@ -32,8 +32,8 @@ RETRO_BEGIN_DECLS #ifdef HAVE_OPENGLES2 -typedef GLfloat GLdouble; -typedef GLclampf GLclampd; +//typedef GLfloat GLdouble; +//typedef GLclampf GLclampd; #endif #if defined(HAVE_OPENGLES2) ================================================ FILE: scriptmodules/libretrocores/lr-mupen64plus/0002-rpi-gles3.patch ================================================ --- a/Makefile +++ b/Makefile @@ -94,7 +94,11 @@ ifneq (,$(findstring unix,$(platform))) else ifneq (,$(findstring rpi,$(platform))) TARGET := $(TARGET_NAME)_libretro.so LDFLAGS += -shared -Wl,--version-script=$(LIBRETRO_DIR)/link.T -Wl,--no-undefined - GLES = 1 + ifeq ($(FORCE_GLES3),1) + GLES3 = 1 + else + GLES = 1 + endif ifneq (,$(findstring mesa,$(platform))) GL_LIB := -lGLESv2 else ================================================ FILE: scriptmodules/libretrocores/lr-mupen64plus/0003-fix-fsqrt-conflict.patch ================================================ diff --git a/mupen64plus-core/src/r4300/x86/assemble.h b/mupen64plus-core/src/r4300/x86/assemble.h index 19edb19..0cd77aa 100644 --- a/mupen64plus-core/src/r4300/x86/assemble.h +++ b/mupen64plus-core/src/r4300/x86/assemble.h @@ -807,7 +807,7 @@ static osal_inline void fmul_preg32_qword(int reg32) put8(0x08 + reg32); } -static osal_inline void fsqrt(void) +static osal_inline void fsqrt_(void) { put8(0xD9); put8(0xFA); diff --git a/mupen64plus-core/src/r4300/x86/gcop1_d.c b/mupen64plus-core/src/r4300/x86/gcop1_d.c index fadcbb5..519c36e 100644 --- a/mupen64plus-core/src/r4300/x86/gcop1_d.c +++ b/mupen64plus-core/src/r4300/x86/gcop1_d.c @@ -96,7 +96,7 @@ void gensqrt_d(void) gencheck_cop1_unusable(); mov_eax_memoffs32((unsigned int *)(®_cop1_double[dst->f.cf.fs])); fld_preg32_qword(EAX); - fsqrt(); + fsqrt_(); mov_eax_memoffs32((unsigned int *)(®_cop1_double[dst->f.cf.fd])); fstp_preg32_qword(EAX); #endif diff --git a/mupen64plus-core/src/r4300/x86/gcop1_s.c b/mupen64plus-core/src/r4300/x86/gcop1_s.c index 699622d..96462c1 100644 --- a/mupen64plus-core/src/r4300/x86/gcop1_s.c +++ b/mupen64plus-core/src/r4300/x86/gcop1_s.c @@ -97,7 +97,7 @@ void gensqrt_s(void) gencheck_cop1_unusable(); mov_eax_memoffs32((unsigned int *)(®_cop1_simple[dst->f.cf.fs])); fld_preg32_dword(EAX); - fsqrt(); + fsqrt_(); mov_eax_memoffs32((unsigned int *)(®_cop1_simple[dst->f.cf.fd])); fstp_preg32_dword(EAX); #endif diff --git a/mupen64plus-core/src/r4300/x86_64/assemble.h b/mupen64plus-core/src/r4300/x86_64/assemble.h index 479843a..896233a 100644 --- a/mupen64plus-core/src/r4300/x86_64/assemble.h +++ b/mupen64plus-core/src/r4300/x86_64/assemble.h @@ -1154,7 +1154,7 @@ static osal_inline void fmul_preg64_qword(int reg64) put8(0x08 + reg64); } -static osal_inline void fsqrt(void) +static osal_inline void fsqrt_(void) { put8(0xD9); put8(0xFA); diff --git a/mupen64plus-core/src/r4300/x86_64/gcop1_d.c b/mupen64plus-core/src/r4300/x86_64/gcop1_d.c index af97347..4700206 100644 --- a/mupen64plus-core/src/r4300/x86_64/gcop1_d.c +++ b/mupen64plus-core/src/r4300/x86_64/gcop1_d.c @@ -117,7 +117,7 @@ void gensqrt_d(void) gencheck_cop1_unusable(); mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_double[dst->f.cf.fs])); fld_preg64_qword(RAX); - fsqrt(); + fsqrt_(); mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_double[dst->f.cf.fd])); fstp_preg64_qword(RAX); #endif diff --git a/mupen64plus-core/src/r4300/x86_64/gcop1_s.c b/mupen64plus-core/src/r4300/x86_64/gcop1_s.c index 63f4c9e..2f0c01c 100644 --- a/mupen64plus-core/src/r4300/x86_64/gcop1_s.c +++ b/mupen64plus-core/src/r4300/x86_64/gcop1_s.c @@ -118,7 +118,7 @@ void gensqrt_s(void) gencheck_cop1_unusable(); mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); fld_preg64_dword(RAX); - fsqrt(); + fsqrt_(); mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fd])); fstp_preg64_dword(RAX); #endif ================================================ FILE: scriptmodules/libretrocores/lr-mupen64plus-next.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-mupen64plus-next" rp_module_desc="N64 emulator - Mupen64Plus + GLideN64 for libretro (next version)" rp_module_help="ROM Extensions: .z64 .n64 .v64\n\nCopy your N64 roms to $romdir/n64" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/mupen64plus-libretro-nx/master/LICENSE" rp_module_repo="git https://github.com/libretro/mupen64plus-libretro-nx.git develop" rp_module_section="opt kms=main" rp_module_flags="" function depends_lr-mupen64plus-next() { local depends=() isPlatform "x86" && depends+=(nasm) isPlatform "videocore" && depends+=(libraspberrypi-dev) isPlatform "mesa" && depends+=(libgles2-mesa-dev) getDepends "${depends[@]}" } function sources_lr-mupen64plus-next() { gitPullOrClone } function build_lr-mupen64plus-next() { local params=() if isPlatform "arm"; then if isPlatform "videocore"; then params+=(platform="$__platform") elif isPlatform "mesa"; then params+=(platform="$__platform-mesa") elif isPlatform "mali"; then params+=(platform="odroid") fi if isPlatform "neon"; then params+=(HAVE_NEON=1) else # force disabling HAVE_NEON on armv6 as makefile sets it for all rpi targets params+=(HAVE_NEON=0) fi fi if isPlatform "gles3"; then params+=(FORCE_GLES3=1) elif isPlatform "gles"; then params+=(FORCE_GLES=1) fi # force ARCH=armv7 on arm platforms to fix building with 32bit arm userland on aarch64 kernel isPlatform "arm" && params+=(ARCH=armv7l) local add_cflags=() # workaround for linkage_arm.S including some armv7 instructions without this isPlatform "armv6" && add_cflags+=(-DARMv5_ONLY) # fix building on armv8.2 (rpi5) on 32bit arm bookworm. isPlatform "armv8" && add_cflags+=(-mfp16-format=ieee) # use a custom core name to avoid core option name clashes with lr-mupen64plus params+=(CORE_NAME=mupen64plus-next) make "${params[@]}" clean CFLAGS="$CFLAGS ${add_cflags[*]}" make "${params[@]}" md_ret_require="$md_build/mupen64plus_next_libretro.so" } function install_lr-mupen64plus-next() { md_ret_files=( 'mupen64plus_next_libretro.so' 'LICENSE' 'README.md' ) } function configure_lr-mupen64plus-next() { mkRomDir "n64" defaultRAConfig "n64" if isPlatform "rpi"; then # Disable hybrid upscaling filter (needs better GPU) setRetroArchCoreOption "mupen64plus-next-HybridFilter" "False" # Disable overscan/VI emulation (slight performance drain) setRetroArchCoreOption "mupen64plus-next-EnableOverscan" "Disabled" # Enable Threaded GL calls setRetroArchCoreOption "mupen64plus-next-ThreadedRenderer" "True" fi setRetroArchCoreOption "mupen64plus-next-EnableNativeResFactor" "1" addEmulator 1 "$md_id" "n64" "$md_inst/mupen64plus_next_libretro.so" addSystem "n64" } ================================================ FILE: scriptmodules/libretrocores/lr-mupen64plus.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-mupen64plus" rp_module_desc="N64 emu - Mupen64Plus + GLideN64 for libretro" rp_module_help="ROM Extensions: .z64 .n64 .v64\n\nCopy your N64 roms to $romdir/n64" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/mupen64plus-libretro/master/LICENSE" rp_module_repo="git https://github.com/RetroPie/mupen64plus-libretro.git master" rp_module_section="main" rp_module_flags="!aarch64" function _update_hook_lr-mupen64plus() { # retroarch renamed lr-mupen64plus to lr-parallel-n64 and # lr-glupen64 to lr-mupen64plus which makes this a little tricky as an update hook # we first need to rename lr-mupen64plus to lr-parallel-n64 # (if it's not the lr-glupen64 fork) if [[ -d "$md_inst" ]] && ! grep -q "GLideN64" "$md_inst/README.md"; then renameModule "lr-mupen64plus" "lr-parallel-n64" fi # then we can rename lr-glupen64 to lr-mupen64plus renameModule "lr-glupen64" "lr-mupen64plus" } function depends_lr-mupen64plus() { local depends=(flex bison libpng-dev) isPlatform "x11" && depends+=(libglew-dev libglu1-mesa-dev) isPlatform "x86" && depends+=(nasm) isPlatform "mesa" && depends+=(libgles2-mesa-dev) isPlatform "videocore" && depends+=(libraspberrypi-dev) getDepends "${depends[@]}" } function sources_lr-mupen64plus() { gitPullOrClone # mesa workaround; see: https://github.com/libretro/libretro-common/issues/98 if hasPackage libgles2-mesa-dev 18.2 ge; then applyPatch "$md_data/0001-eliminate-conflicting-typedefs.patch" fi # Allows GLES3 with rpi applyPatch "$md_data/0002-rpi-gles3.patch" # Fix building with GCC 15 applyPatch "$md_data/0003-fix-fsqrt-conflict.patch" } function build_lr-mupen64plus() { rpSwap on 750 local params=() if isPlatform "videocore"; then params+=(platform="$__platform") elif isPlatform "mesa"; then params+=(platform="$__platform-mesa") elif isPlatform "mali"; then params+=(platform="odroid") fi # set these ourselves, to fix missing platforms in the Makefile (eg. rpi5) isPlatform "arm" && params+=(WITH_DYNAREC=arm) isPlatform "neon" && params+=(HAVE_NEON=1) if isPlatform "gles3"; then params+=(FORCE_GLES3=1) elif isPlatform "gles"; then params+=(FORCE_GLES=1) fi # for GCC 15 and up CFLAGS+=" -Wno-incompatible-pointer-types" make clean make "${params[@]}" rpSwap off md_ret_require="$md_build/mupen64plus_libretro.so" } function install_lr-mupen64plus() { md_ret_files=( 'mupen64plus_libretro.so' 'LICENSE' 'README.md' 'BUILDING.md' ) } function configure_lr-mupen64plus() { mkRomDir "n64" defaultRAConfig "n64" addEmulator 0 "$md_id" "n64" "$md_inst/mupen64plus_libretro.so" addSystem "n64" } ================================================ FILE: scriptmodules/libretrocores/lr-neocd.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-neocd" rp_module_desc="Neo Geo CD Emulator - rewrite of NeoCD for libretro" rp_module_help="ROM Extension: .chd .cue\n\nCopy your roms to\n$romdir/neogeo\n\nYou will need a minimum of two BIOS files (eg. ng-lo.rom, uni-bioscd.rom) which should be copied to $biosdir/neocd" rp_module_licence="GPL3 https://raw.githubusercontent.com/libretro/neocd_libretro/master/LICENSE.md" rp_module_repo="git https://github.com/libretro/neocd_libretro.git master" rp_module_section="exp" function sources_lr-neocd() { gitPullOrClone } function build_lr-neocd() { make clean make USE_LTO=0 md_ret_require="$md_build/neocd_libretro.so" } function install_lr-neocd() { md_ret_files=( 'LICENSE.md' 'neocd_libretro.so' 'README.md' ) } function configure_lr-neocd() { mkRomDir "neogeo" defaultRAConfig "neogeo" addEmulator 0 "$md_id" "neogeo" "$md_inst/neocd_libretro.so" addSystem "neogeo" } ================================================ FILE: scriptmodules/libretrocores/lr-nestopia.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-nestopia" rp_module_desc="NES emu - Nestopia (enhanced) port for libretro" rp_module_help="ROM Extensions: .nes .zip\n\nCopy your NES roms to $romdir/nes\n\nFor the Famicom Disk System copy your roms to $romdir/fds\n\nFor the Famicom Disk System copy the required BIOS file disksys.rom to $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/nestopia/master/COPYING" rp_module_repo="git https://github.com/libretro/nestopia.git master" rp_module_section="main" function sources_lr-nestopia() { gitPullOrClone } function build_lr-nestopia() { cd libretro rpSwap on 512 make clean make rpSwap off md_ret_require="$md_build/libretro/nestopia_libretro.so" } function install_lr-nestopia() { md_ret_files=( 'libretro/nestopia_libretro.so' 'COPYING' ) } function configure_lr-nestopia() { mkRomDir "nes" mkRomDir "fds" defaultRAConfig "nes" defaultRAConfig "fds" addEmulator 0 "$md_id" "nes" "$md_inst/nestopia_libretro.so" addEmulator 1 "$md_id" "fds" "$md_inst/nestopia_libretro.so" addSystem "nes" addSystem "fds" } ================================================ FILE: scriptmodules/libretrocores/lr-np2kai.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-np2kai" rp_module_desc="PC98 emu - Modified Neko Project II port for libretro" rp_module_help="ROM Extensions: .d88 .d98 .88d .98d .fdi .xdf .hdm .dup .2hd .tfd .hdi .thd .nhd .hdd\n\nCopy your pc98 games to to $romdir/pc98\n\nCopy bios files 2608_bd.wav, 2608_hh.wav, 2608_rim.wav, 2608_sd.wav, 2608_tom.wav 2608_top.wav, bios.rom, FONT.ROM and sound.rom to $biosdir/np2kai" rp_module_licence="MIT https://raw.githubusercontent.com/libretro/NP2kai/master/LICENSE" rp_module_repo="git https://github.com/AZO234/NP2kai.git master" rp_module_section="exp" function sources_lr-np2kai() { gitPullOrClone } function build_lr-np2kai() { cd "$md_build/sdl" make -f Makefile.libretro clean GIT_TAG="master" make -f Makefile.libretro GIT_TAG="master" md_ret_require="$md_build/sdl/np2kai_libretro.so" } function install_lr-np2kai() { md_ret_files=( 'sdl/np2kai_libretro.so' ) } function configure_lr-np2kai() { mkRomDir "pc98" defaultRAConfig "pc98" addEmulator 1 "$md_id" "pc98" "$md_inst/np2kai_libretro.so" addSystem "pc98" } ================================================ FILE: scriptmodules/libretrocores/lr-nxengine.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-nxengine" rp_module_desc="Cave Story engine clone - NxEngine port for libretro" rp_module_help="Copy the original Cave Story game files to $romdir/ports/CaveStory so you have the file $romdir/ports/CaveStory/Doukutsu.exe present." rp_module_licence="GPL3 https://raw.githubusercontent.com/libretro/nxengine-libretro/master/nxengine/LICENSE" rp_module_repo="git https://github.com/libretro/nxengine-libretro.git master" rp_module_section="opt" function sources_lr-nxengine() { gitPullOrClone } function build_lr-nxengine() { make clean make md_ret_require="$md_build/nxengine_libretro.so" } function install_lr-nxengine() { md_ret_files=( 'nxengine_libretro.so' ) } function configure_lr-nxengine() { local script setConfigRoot "ports" addPort "$md_id" "cavestory" "Cave Story" "$md_inst/nxengine_libretro.so" local file="$romdir/ports/Cave Story.sh" # custom launch script - if the data files are not found, warn the user cat >"$file" << _EOF_ #!/bin/bash if [[ ! -f "$romdir/ports/CaveStory/Doukutsu.exe" ]]; then dialog --no-cancel --pause "$md_help" 22 76 15 else "$rootdir/supplementary/runcommand/runcommand.sh" 0 _PORT_ cavestory "$romdir/ports/CaveStory/Doukutsu.exe" fi _EOF_ chown "$__user":"$__group" "$file" chmod +x "$file" defaultRAConfig "cavestory" } ================================================ FILE: scriptmodules/libretrocores/lr-o2em.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-o2em" rp_module_desc="Odyssey 2 / Videopac emu - O2EM port for libretro" rp_module_help="ROM Extensions: .bin .zip\n\nCopy your Odyssey 2 / Videopac roms to $romdir/videopac\n\nCopy the required BIOS file o2rom.bin to $biosdir" rp_module_licence="OTHER" rp_module_repo="git https://github.com/libretro/libretro-o2em master" rp_module_section="opt" function sources_lr-o2em() { gitPullOrClone } function build_lr-o2em() { make clean make md_ret_require="$md_build/o2em_libretro.so" } function install_lr-o2em() { md_ret_files=( 'o2em_libretro.so' 'README.md' ) } function configure_lr-o2em() { mkRomDir "videopac" defaultRAConfig "videopac" addEmulator 1 "$md_id" "videopac" "$md_inst/o2em_libretro.so" addSystem "videopac" } ================================================ FILE: scriptmodules/libretrocores/lr-opera.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-opera" rp_module_desc="3DO emulator - fork of 4DO/FreeDO for libretro" rp_module_help="ROM Extension: .cue .chd .iso .zip\n\nCopy your 3do roms to $romdir/3do\n\nCopy the required BIOS file panazf10.bin to $biosdir" rp_module_licence="LGPL https://raw.githubusercontent.com/libretro/opera-libretro/master/libopera/opera_3do.c" rp_module_repo="git https://github.com/libretro/opera-libretro.git master" rp_module_section="exp" function sources_lr-opera() { gitPullOrClone } function _update_hook_lr-opera() { renameModule "lr-4do" "lr-opera" } function build_lr-opera() { make clean make md_ret_require="$md_build/opera_libretro.so" } function install_lr-opera() { md_ret_files=( 'opera_libretro.so' ) } function configure_lr-opera() { mkRomDir "3do" defaultRAConfig "3do" addEmulator 1 "$md_id" "3do" "$md_inst/opera_libretro.so" addSystem "3do" } ================================================ FILE: scriptmodules/libretrocores/lr-parallel-n64/01-fix-fsqrt-conflicts.diff ================================================ diff --git a/mupen64plus-core/src/r4300/hacktarux_dynarec/assemble.h b/mupen64plus-core/src/r4300/hacktarux_dynarec/assemble.h index 8161292..31f21b1 100644 --- a/mupen64plus-core/src/r4300/hacktarux_dynarec/assemble.h +++ b/mupen64plus-core/src/r4300/hacktarux_dynarec/assemble.h @@ -1650,7 +1650,7 @@ static INLINE void fchs(void) } -static INLINE void fsqrt(void) +static INLINE void fsqrt_(void) { put8(0xD9); put8(0xFA); diff --git a/mupen64plus-core/src/r4300/hacktarux_dynarec/hacktarux_dynarec.c b/mupen64plus-core/src/r4300/hacktarux_dynarec/hacktarux_dynarec.c index 89fb982..4f81f9d 100644 --- a/mupen64plus-core/src/r4300/hacktarux_dynarec/hacktarux_dynarec.c +++ b/mupen64plus-core/src/r4300/hacktarux_dynarec/hacktarux_dynarec.c @@ -6317,13 +6317,13 @@ void gensqrt_d(void) #ifdef __x86_64__ mov_xreg64_m64rel(RAX, (uint64_t *)(®_cop1_double[dst->f.cf.fs])); fld_preg64_qword(RAX); - fsqrt(); + fsqrt_(); mov_xreg64_m64rel(RAX, (uint64_t *)(®_cop1_double[dst->f.cf.fd])); fstp_preg64_qword(RAX); #else mov_eax_memoffs32((unsigned int *)(®_cop1_double[dst->f.cf.fs])); fld_preg32_qword(EAX); - fsqrt(); + fsqrt_(); mov_eax_memoffs32((unsigned int *)(®_cop1_double[dst->f.cf.fd])); fstp_preg32_qword(EAX); #endif @@ -7301,13 +7301,13 @@ void gensqrt_s(void) #ifdef __x86_64__ mov_xreg64_m64rel(RAX, (uint64_t *)(®_cop1_simple[dst->f.cf.fs])); fld_preg64_dword(RAX); - fsqrt(); + fsqrt_(); mov_xreg64_m64rel(RAX, (uint64_t *)(®_cop1_simple[dst->f.cf.fd])); fstp_preg64_dword(RAX); #else mov_eax_memoffs32((unsigned int *)(®_cop1_simple[dst->f.cf.fs])); fld_preg32_dword(EAX); - fsqrt(); + fsqrt_(); mov_eax_memoffs32((unsigned int *)(®_cop1_simple[dst->f.cf.fd])); fstp_preg32_dword(EAX); #endif ================================================ FILE: scriptmodules/libretrocores/lr-parallel-n64.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-parallel-n64" rp_module_desc="N64 emu - Highly modified Mupen64Plus port for libretro" rp_module_help="ROM Extensions: .z64 .n64 .v64\n\nCopy your N64 roms to $romdir/n64" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/parallel-n64/master/mupen64plus-core/LICENSES" rp_module_repo="git https://github.com/RetroPie/parallel-n64.git retropie" rp_module_section="exp x86=main" function depends_lr-parallel-n64() { local depends=() isPlatform "x11" && depends+=(libgl1-mesa-dev) isPlatform "videocore" && depends+=(libraspberrypi-dev) isPlatform "kms" && isPlatform "gles" && depends+=(libgles2-mesa-dev) getDepends "${depends[@]}" } function sources_lr-parallel-n64() { gitPullOrClone # fix building with gcc 15 applyPatch "$md_data/01-fix-fsqrt-conflicts.diff" } function build_lr-parallel-n64() { rpSwap on 1000 local params=() if isPlatform "videocore" || isPlatform "odroid-c1"; then params+=(platform="$__platform") else isPlatform "gles" && params+=(GLES=1 GL_LIB:=-lGLESv2) if isPlatform "arm"; then params+=(CPUFLAGS="-DNO_ASM -DARM -D__arm__ -DARM_ASM -D__NEON_OPT -DNOSSE -DARM_FIX") params+=(WITH_DYNAREC=arm) isPlatform "neon" && params+=(HAVE_NEON=1) elif isPlatform "aarch64"; then params+=(CPUFLAGS="-DARM_FIX") fi fi make clean make "${params[@]}" rpSwap off md_ret_require="$md_build/parallel_n64_libretro.so" } function install_lr-parallel-n64() { md_ret_files=( 'parallel_n64_libretro.so' 'README.md' 'mupen64plus-core/LICENSES' ) } function configure_lr-parallel-n64() { mkRomDir "n64" defaultRAConfig "n64" # Set core options setRetroArchCoreOption "parallel-n64-gfxplugin" "auto" setRetroArchCoreOption "parallel-n64-gfxplugin-accuracy" "low" setRetroArchCoreOption "parallel-n64-screensize" "640x480" # Copy config files cat > $home/RetroPie/BIOS/gles2n64rom.conf << _EOF_ #rom specific settings rom name=SUPER MARIO 64 target FPS=25 rom name=Kirby64 target FPS=25 rom name=Banjo-Kazooie framebuffer enable=1 update mode=4 target FPS=25 rom name=BANJO TOOIE hack banjo tooie=1 ignore offscreen rendering=1 framebuffer enable=1 update mode=4 rom name=STARFOX64 window width=864 window height=520 target FPS=27 rom name=MARIOKART64 target FPS=27 rom name=THE LEGEND OF ZELDA texture use IA=0 hack zelda=1 target FPS=17 rom name=ZELDA MAJORA'S MASK texture use IA=0 hack zelda=1 rom name=F-ZERO X window width=864 window height=520 target FPS=55 rom name=WAVE RACE 64 window width=864 window height=520 target FPS=27 rom name=SMASH BROTHERS framebuffer enable=1 window width=864 window height=520 target FPS=27 rom name=1080 SNOWBOARDING update mode=2 target FPS=27 rom name=PAPER MARIO update mode=4 rom name=STAR WARS EP1 RACER video force=1 video width=320 video height=480 rom name=JET FORCE GEMINI framebuffer enable=1 update mode=2 ignore offscreen rendering=1 target FPS=27 rom name=RIDGE RACER 64 window width=864 window height=520 enable lighting=0 target FPS=27 rom name=Diddy Kong Racing target FPS=27 rom name=MarioParty update mode=4 rom name=MarioParty3 update mode=4 rom name=Beetle Adventure Rac window width=864 window height=520 target FPS=27 rom name=EARTHWORM JIM 3D rom name=LEGORacers rom name=GOEMONS GREAT ADV window width=864 window height=520 rom name=Buck Bumble window width=864 window height=520 rom name=BOMBERMAN64U2 window width=864 window height=520 rom name=ROCKETROBOTONWHEELS window width=864 window height=520 rom name=GOLDENEYE force screen clear=1 framebuffer enable=1 window width=864 window height=520 target FPS=25 rom name=Mega Man 64 framebuffer enable=1 target FPS=25 _EOF_ chown "$__user":"$__group" "$biosdir/gles2n64rom.conf" addEmulator 0 "$md_id" "n64" "$md_inst/parallel_n64_libretro.so" addSystem "n64" } ================================================ FILE: scriptmodules/libretrocores/lr-pcsx-rearmed.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-pcsx-rearmed" rp_module_desc="Playstation emulator - PCSX (arm optimised) port for libretro" rp_module_help="ROM Extensions: .bin .cue .cbn .img .iso .m3u .mdf .pbp .toc .z .znx\n\nCopy your PSX roms to $romdir/psx\n\nCopy the required BIOS file SCPH1001.BIN to $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/pcsx_rearmed/master/COPYING" rp_module_repo="git https://github.com/libretro/pcsx_rearmed.git master" rp_module_section="opt arm=main aarch64=main" function depends_lr-pcsx-rearmed() { local depends=(libpng-dev) isPlatform "x11" && depends+=(libx11-dev) getDepends "${depends[@]}" } function sources_lr-pcsx-rearmed() { gitPullOrClone } function build_lr-pcsx-rearmed() { local params=(THREAD_RENDERING=0) if isPlatform "arm"; then params+=(ARCH=arm DYNAREC=ari64) if isPlatform "neon"; then params+=(HAVE_NEON=1 HAVE_NEON_ASM=1 BUILTIN_GPU=neon) else params+=(BUILTIN_GPU=peops) fi elif isPlatform "aarch64"; then params+=(ARCH=aarch64 DYNAREC=ari64) fi make -f Makefile.libretro "${params[@]}" clean make -f Makefile.libretro "${params[@]}" md_ret_require="$md_build/pcsx_rearmed_libretro.so" } function install_lr-pcsx-rearmed() { md_ret_files=( 'AUTHORS' 'ChangeLog.df' 'COPYING' 'pcsx_rearmed_libretro.so' 'NEWS' 'README.md' ) } function configure_lr-pcsx-rearmed() { mkRomDir "psx" defaultRAConfig "psx" addEmulator 1 "$md_id" "psx" "$md_inst/pcsx_rearmed_libretro.so" addSystem "psx" } ================================================ FILE: scriptmodules/libretrocores/lr-picodrive.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-picodrive" rp_module_desc="Sega 8/16 bit emu - picodrive arm optimised libretro core" rp_module_help="ROM Extensions: .32x .iso .cue .sms .smd .bin .gen .md .sg .zip\n\nCopy your Megadrive / Genesis roms to $romdir/megadrive\nMasterSystem roms to $romdir/mastersystem\nSega 32X roms to $romdir/sega32x and\nSegaCD roms to $romdir/segacd\nThe Sega CD requires the BIOS files us_scd1_9210.bin, eu_mcd1_9210.bin, jp_mcd1_9112.bin copied to $biosdir" rp_module_licence="NONCOM https://raw.githubusercontent.com/libretro/picodrive/master/COPYING" rp_module_repo="git https://github.com/libretro/picodrive.git master" rp_module_section="main" rp_module_flags="nodistcc" function sources_lr-picodrive() { gitPullOrClone } function build_lr-picodrive() { local params=() if isPlatform "arm"; then params+=(platform=armv ARM_ASM=1 use_fame=0 use_cyclone=1 use_sh2drc=1 use_svpdrc=1) if isPlatform "armv6"; then params+=(use_cz80=0 use_drz80=1) else params+=(use_cz80=1 use_drz80=0) fi elif isPlatform "aarch64"; then params+=(use_sh2drc=0) fi make clean make -f Makefile.libretro "${params[@]}" md_ret_require="$md_build/picodrive_libretro.so" } function install_lr-picodrive() { md_ret_files=( 'AUTHORS' 'COPYING' 'picodrive_libretro.so' 'README.md' ) } function configure_lr-picodrive() { local system local def for system in megadrive mastersystem segacd sega32x; do def=0 # default on megadrive / mastersystem only on armv6 for performance [[ "$system" =~ megadrive|mastersystem ]] && isPlatform "arm6" && def=1 mkRomDir "$system" defaultRAConfig "$system" addEmulator $def "$md_id" "$system" "$md_inst/picodrive_libretro.so" addSystem "$system" done } ================================================ FILE: scriptmodules/libretrocores/lr-pokemini.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-pokemini" rp_module_desc="Pokemon Mini emulator - PokeMini port for libretro" rp_module_help="ROM Extensions: .min .zip\n\nCopy your Pokemon Mini roms to $romdir/pokemini" rp_module_licence="GPL3 https://raw.githubusercontent.com/libretro/PokeMini/master/LICENSE" rp_module_repo="git https://github.com/libretro/pokemini.git master" rp_module_section="exp" function sources_lr-pokemini() { gitPullOrClone } function build_lr-pokemini() { make clean make md_ret_require="$md_build/pokemini_libretro.so" } function install_lr-pokemini() { md_ret_files=( 'pokemini_libretro.so' ) } function configure_lr-pokemini() { mkRomDir "pokemini" defaultRAConfig "pokemini" addEmulator 1 "$md_id" "pokemini" "$md_inst/pokemini_libretro.so" addSystem "pokemini" } ================================================ FILE: scriptmodules/libretrocores/lr-ppsspp/v13-libretro_fix.diff ================================================ diff --git a/Core/HLE/__sceAudio.cpp b/Core/HLE/__sceAudio.cpp index 3176d26..f05ad9d 100644 --- a/Core/HLE/__sceAudio.cpp +++ b/Core/HLE/__sceAudio.cpp @@ -82,6 +82,11 @@ static bool m_logAudio; static int chanQueueMaxSizeFactor; static int chanQueueMinSizeFactor; +// Accessor for libretro +int __AudioGetHostAttemptBlockSize() { + return hostAttemptBlockSize; +} + static void hleAudioUpdate(u64 userdata, int cyclesLate) { // Schedule the next cycle first. __AudioUpdate() may consume cycles. CoreTiming::ScheduleEvent(audioIntervalCycles - cyclesLate, eventAudioUpdate, 0); diff --git a/Core/HLE/__sceAudio.h b/Core/HLE/__sceAudio.h index ae9ca35..f26ae0d 100644 --- a/Core/HLE/__sceAudio.h +++ b/Core/HLE/__sceAudio.h @@ -50,6 +50,8 @@ int __AudioMix(short *outstereo, int numSamples, int sampleRate); void __AudioGetDebugStats(char *buf, size_t bufSize); void __PushExternalAudio(const s32 *audio, int numSamples); // Should not be used in-game, only at the menu! +int __AudioGetHostAttemptBlockSize(); + // Audio Dumping stuff void __StartLogAudio(const Path &filename); void __StopLogAudio(); diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index eacbca2..26f2cf6 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -379,7 +379,7 @@ class LibretroHost : public Host void InitSound() override {} void UpdateSound() override { - extern int hostAttemptBlockSize; + int hostAttemptBlockSize = __AudioGetHostAttemptBlockSize(); const int blockSizeMax = 512; static int16_t audio[blockSizeMax * 2]; assert(hostAttemptBlockSize <= blockSizeMax); ================================================ FILE: scriptmodules/libretrocores/lr-ppsspp/v16-clamp-include.diff ================================================ diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index 5a2f9104f1..5eabd5e54e 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "Common/CPUDetect.h" #include "Common/Log.h" ================================================ FILE: scriptmodules/libretrocores/lr-ppsspp.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-ppsspp" rp_module_desc="PlayStation Portable emu - PPSSPP port for libretro" rp_module_help="ROM Extensions: .iso .pbp .cso\n\nCopy your PlayStation Portable roms to $romdir/psp" rp_module_licence="GPL2 https://raw.githubusercontent.com/RetroPie/ppsspp/master/LICENSE.TXT" rp_module_repo="git https://github.com/hrydgard/ppsspp.git :_get_release_ppsspp" rp_module_section="opt" rp_module_flags="" function depends_lr-ppsspp() { depends_ppsspp } function sources_lr-ppsspp() { sources_ppsspp # fix missing defines on opengles2 and include on v1.16.6 lr-ppsspp if [[ "$(_get_release_ppsspp)" == "v1.16.6" ]]; then applyPatch "${__mod_info[ppsspp/path]%/*}/ppsspp/gles2_fix.diff" applyPatch "$md_data/v16-clamp-include.diff" fi # fix missing exported symbol for libretro on v1.13.2 if [[ "$(_get_release_ppsspp)" == "v1.13.2" ]]; then applyPatch "$md_data/v13-libretro_fix.diff" fi } function build_lr-ppsspp() { build_ppsspp } function install_lr-ppsspp() { md_ret_files=( 'ppsspp/build/lib/ppsspp_libretro.so' 'ppsspp/build/assets' ) } function configure_lr-ppsspp() { mkRomDir "psp" defaultRAConfig "psp" if [[ "$md_mode" == "install" ]]; then mkUserDir "$biosdir/PPSSPP" cp -Rv "$md_inst/assets/"* "$biosdir/PPSSPP/" chown -R "$__user":"$__group" "$biosdir/PPSSPP" # the core needs a save file directory, use the same folder as standalone 'ppsspp' iniConfig " = " "" "$configdir/psp/retroarch.cfg" iniSet "savefile_directory" "$home/.config/ppsspp" moveConfigDir "$home/.config/ppsspp" "$md_conf_root/psp" fi addEmulator 1 "$md_id" "psp" "$md_inst/ppsspp_libretro.so" addSystem "psp" # if we are removing the last remaining psp emu - remove the symlink if [[ "$md_mode" == "remove" ]]; then if [[ -h "$home/.config/ppsspp" && ! -f "$md_conf_root/psp/emulators.cfg" ]]; then rm -f "$home/.config/ppsspp" fi fi } ================================================ FILE: scriptmodules/libretrocores/lr-prboom.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-prboom" rp_module_desc="Doom/Doom II engine - PrBoom port for libretro" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/libretro-prboom/master/COPYING" rp_module_repo="git https://github.com/libretro/libretro-prboom.git master" rp_module_section="opt" function sources_lr-prboom() { gitPullOrClone } function build_lr-prboom() { make clean make md_ret_require="$md_build/prboom_libretro.so" } function install_lr-prboom() { md_ret_files=( 'prboom_libretro.so' 'prboom.wad' ) } function game_data_lr-prboom() { local dest="$romdir/ports/doom" mkUserDir "$dest" if [[ ! -f "$dest/doom1.wad" ]]; then # download doom 1 shareware download "$__archive_url/doom1.wad" "$dest/doom1.wad" fi if ! echo "97bb88094a51457a8dcad98c58be22a2d0fa9a37 $romdir/ports/doom/freedoom1.wad" | sha1sum -c &>/dev/null; then # download (or update) freedoom downloadAndExtract "https://github.com/freedoom/freedoom/releases/download/v0.13.0/freedoom-0.13.0.zip" "$dest" -j -LL fi mkUserDir "$dest/addon" chown -R "$__user":"$__group" "$dest" } function _add_games_lr-prboom() { local cmd="${@}" local addon="$romdir/ports/doom/addon" declare -A games=( ['doom1.wad']="Doom" ['doom2.wad']="Doom II" ['doomu.wad']="The Ultimate Doom" ['freedoom1.wad']="Freedoom - Phase I" ['freedoom2.wad']="Freedoom - Phase II" ['tnt.wad']="TNT - Evilution" ['plutonia.wad']="The Plutonia Experiment" ) if [[ "$md_id" =~ "zdoom" ]]; then games+=( ['heretic.wad']="Heretic - Shadow of the Serpent Riders" ['hexen.wad']="Hexen - Beyond Heretic" ['hexdd.wad']="Hexen - Deathkings of the Dark Citadel" ['chex3.wad']="Chex Quest 3" ['strife1.wad']="Strife" ) fi local game local doswad local wad for game in "${!games[@]}"; do doswad="$romdir/ports/doom/${game^^}" wad="$romdir/ports/doom/$game" if [[ -f "$doswad" ]]; then mv "$doswad" "$wad" fi if [[ -f "$wad" ]]; then addPort "$md_id" "doom" "${games[$game]}" "$cmd" "$wad" if [[ "$md_id" =~ "zdoom" ]]; then addPort "$md_id-addon" "doom" "${games[$game]}" "$cmd -file ${addon}/*" "$wad" fi fi done } function add_games_lr-prboom() { _add_games_lr-prboom "$md_inst/prboom_libretro.so" } function configure_lr-prboom() { setConfigRoot "ports" mkRomDir "ports/doom" defaultRAConfig "doom" [[ "$md_mode" == "install" ]] && game_data_lr-prboom add_games_lr-prboom cp prboom.wad "$romdir/ports/doom/" chown "$__user":"$__group" "$romdir/ports/doom/prboom.wad" } ================================================ FILE: scriptmodules/libretrocores/lr-prosystem.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-prosystem" rp_module_desc="Atari 7800 ProSystem emu - ProSystem port for libretro" rp_module_help="ROM Extensions: .a78 .bin .zip\n\nCopy your Atari 7800 roms to $romdir/atari7800\n\nCopy the optional BIOS file 7800 BIOS (U).rom to $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/prosystem-libretro/master/License.txt" rp_module_repo="git https://github.com/libretro/prosystem-libretro.git master" rp_module_section="main" function sources_lr-prosystem() { gitPullOrClone } function build_lr-prosystem() { make clean CXXFLAGS="$CXXFLAGS -fsigned-char" make md_ret_require="$md_build/prosystem_libretro.so" } function install_lr-prosystem() { md_ret_files=( 'prosystem_libretro.so' 'README.md' ) } function configure_lr-prosystem() { mkRomDir "atari7800" defaultRAConfig "atari7800" addEmulator 1 "$md_id" "atari7800" "$md_inst/prosystem_libretro.so" addSystem "atari7800" } ================================================ FILE: scriptmodules/libretrocores/lr-puae.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-puae" rp_module_desc="P-UAE Amiga emulator port for libretro" rp_module_help="ROM Extensions: .adf .uae\n\nCopy your roms to $romdir/amiga and create configs as .uae" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/PUAE/master/COPYING" rp_module_repo="git https://github.com/libretro/libretro-uae.git master" rp_module_section="opt" function sources_lr-puae() { gitPullOrClone } function build_lr-puae() { make md_ret_require="$md_build/puae_libretro.so" } function install_lr-puae() { md_ret_files=( 'puae_libretro.so' 'README.md' ) } function configure_lr-puae() { mkRomDir "amiga" defaultRAConfig "amiga" addEmulator 1 "$md_id" "amiga" "$md_inst/puae_libretro.so" addSystem "amiga" } ================================================ FILE: scriptmodules/libretrocores/lr-puae2021.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-puae2021" rp_module_desc="P-UAE Amiga emulator port for libretro from 2021 (v2.6.1)" rp_module_help="ROM Extensions: .adf .uae\n\nCopy your roms to $romdir/amiga and create configs as .uae" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/PUAE/master/COPYING" rp_module_repo="git https://github.com/libretro/libretro-uae.git 2.6.1" rp_module_section="opt" function sources_lr-puae2021() { gitPullOrClone } function build_lr-puae2021() { make md_ret_require="$md_build/puae2021_libretro.so" } function install_lr-puae2021() { md_ret_files=( 'puae2021_libretro.so' 'README.md' ) } function configure_lr-puae2021() { mkRomDir "amiga" defaultRAConfig "amiga" addEmulator 1 "lr-puae2021" "amiga" "$md_inst/puae2021_libretro.so" addSystem "amiga" } ================================================ FILE: scriptmodules/libretrocores/lr-px68k.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-px68k" rp_module_desc="SHARP X68000 Emulator" rp_module_help="You need to copy a X68000 bios file (iplrom30.dat, iplromco.dat, iplrom.dat, or iplromxv.dat), and the font file (cgrom.dat or cgrom.tmp) to $biosdir/keropi. Use F12 to access the in emulator menu." rp_module_repo="git https://github.com/libretro/px68k-libretro.git master" rp_module_section="exp" rp_module_flags="" function sources_lr-px68k() { gitPullOrClone } function build_lr-px68k() { make clean make md_ret_require="$md_build/px68k_libretro.so" } function install_lr-px68k() { md_ret_files=( 'px68k_libretro.so' 'README.MD' 'readme.txt' ) } function configure_lr-px68k() { mkRomDir "x68000" defaultRAConfig "x68000" mkUserDir "$biosdir/keropi" addEmulator 1 "$md_id" "x68000" "$md_inst/px68k_libretro.so" addSystem "x68000" } ================================================ FILE: scriptmodules/libretrocores/lr-quasi88.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-quasi88" rp_module_desc="NEC PC-8801 emu - Quasi88 port for libretro" rp_module_help="ROM Extensions: .d88 .88d .cmt .m3u .t88\n\nCopy your pc88 games to to $romdir/pc88\n\nCopy bios files n88.rom, n88_0.rom, n88_1.rom, n88_2.rom, n88_3.rom, n88n.rom, disk.rom, n88knj1.rom, n88knj2.rom, and n88jisho.rom to $biosdir/quasi88" rp_module_licence="BSD https://raw.githubusercontent.com/libretro/quasi88-libretro/master/LICENSE" rp_module_repo="git https://github.com/libretro/quasi88-libretro.git master" rp_module_section="exp" function sources_lr-quasi88() { gitPullOrClone } function build_lr-quasi88() { make clean make md_ret_require="$md_build/quasi88_libretro.so" } function install_lr-quasi88() { md_ret_files=( 'README.md' 'quasi88_libretro.so' ) } function configure_lr-quasi88() { mkRomDir "pc88" defaultRAConfig "pc88" addEmulator 1 "$md_id" "pc88" "$md_inst/quasi88_libretro.so" addSystem "pc88" } ================================================ FILE: scriptmodules/libretrocores/lr-quicknes.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-quicknes" rp_module_desc="NES emulator - QuickNES Port for libretro" rp_module_help="ROM Extensions: .nes .zip\n\nCopy your NES roms to $romdir/nes" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/QuickNES_Core/master/LICENSE" rp_module_repo="git https://github.com/libretro/QuickNES_Core.git master" rp_module_section="opt armv6=main" function sources_lr-quicknes() { gitPullOrClone } function build_lr-quicknes() { make clean make md_ret_require="$md_build/quicknes_libretro.so" } function install_lr-quicknes() { md_ret_files=( 'quicknes_libretro.so' ) } function configure_lr-quicknes() { mkRomDir "nes" defaultRAConfig "nes" local def=0 isPlatform "armv6" && def=1 addEmulator "$def" "$md_id" "nes" "$md_inst/quicknes_libretro.so" addSystem "nes" } ================================================ FILE: scriptmodules/libretrocores/lr-retro8.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-retro8" rp_module_desc="PICO-8 compatible engine - port of retro8 for libretro" rp_module_help="ROM Extensions: .p8 .p8.png .zip\n\nCopy your roms to $romdir/pico8" rp_module_licence="GPL3 https://raw.githubusercontent.com/libretro/retro8/master/LICENSE" rp_module_repo="git https://github.com/libretro/retro8.git master" rp_module_section="exp" function sources_lr-retro8() { gitPullOrClone } function build_lr-retro8() { make clean make md_ret_require="$md_build/retro8_libretro.so" } function install_lr-retro8() { md_ret_files=( 'retro8_libretro.so' 'README.md' 'LICENSE' ) } function configure_lr-retro8() { mkRomDir "pico8" addEmulator 1 "$md_id" "pico8" "$md_inst/retro8_libretro.so" addSystem "pico8" [[ "$md_mode" == "remove" ]] && return # disable retroarch built-in imageviewer so we can run .p8.png files defaultRAConfig "pico8" "builtin_imageviewer_enable" "false" } ================================================ FILE: scriptmodules/libretrocores/lr-scummvm.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-scummvm" rp_module_desc="ScummVM port for libretro" rp_module_help="Copy your ScummVM games to $romdir/scummvm\n\nThe name of your game directories must be suffixed with '.svm' for direct launch in EmulationStation." rp_module_licence="GPL3 https://raw.githubusercontent.com/libretro/scummvm/master/COPYING" rp_module_repo="git https://github.com/libretro/scummvm.git master" rp_module_section="exp" function depends_lr-scummvm() { getDepends zip } function sources_lr-scummvm() { gitPullOrClone } function build_lr-scummvm() { local gl_platform=OPENGL isPlatform "gles" && gl_platform=OPENGLES2 cd backends/platform/libretro make clean make USE_MT32EMU=1 FORCE_${gl_platform}=1 make datafiles md_ret_require="$md_build/backends/platform/libretro/scummvm_libretro.so" } function install_lr-scummvm() { md_ret_files=( "backends/platform/libretro/scummvm_libretro.so" "backends/platform/libretro/scummvm.zip" "COPYING" ) } function configure_lr-scummvm() { addEmulator 0 "$md_id" "scummvm" "$md_inst/romdir-launcher.sh %ROM%" addSystem "scummvm" [[ "$md_mode" == "remove" ]] && return # ensure rom dir and system retroconfig mkRomDir "scummvm" defaultRAConfig "scummvm" # unpack the data files to system dir runCmd unzip -q -o "$md_inst/scummvm.zip" -d "$biosdir" chown -R "$__user":"$__group" "$biosdir/scummvm" # basic initial configuration (if config file not found) if [[ ! -f "$biosdir/scummvm.ini" ]]; then echo "[scummvm]" > "$biosdir/scummvm.ini" iniConfig "=" "" "$biosdir/scummvm.ini" iniSet "extrapath" "$biosdir/scummvm/extra" iniSet "themepath" "$biosdir/scummvm/theme" iniSet "soundfont" "$biosdir/scummvm/extra/Roland_SC-55.sf2" iniSet "gui_theme" "scummremastered" iniSet "subtitles" "true" iniSet "multi_midi" "true" iniSet "gm_device" "fluidsynth" chown "$__user":"$__group" "$biosdir/scummvm.ini" fi # enable speed hack core option if running in arm platform isPlatform "arm" && setRetroArchCoreOption "scummvm_speed_hack" "enabled" # on videocore platforms, disable the HW GL context since it leads to a crash isPlatform "videocore" && setRetroArchCoreOption "scummvm_video_hw_acceleration" "disabled" # create retroarch launcher for lr-scummvm with support for rom directories # containing svm files inside (for direct game directory launching in ES) cat > "$md_inst/romdir-launcher.sh" << _EOF_ #!/usr/bin/env bash ROM=\$1; shift SVM_FILES=() [[ -d \$ROM ]] && mapfile -t SVM_FILES < <(compgen -G "\$ROM/*.svm") [[ \${#SVM_FILES[@]} -eq 1 ]] && ROM=\${SVM_FILES[0]} $emudir/retroarch/bin/retroarch \\ -L "$md_inst/scummvm_libretro.so" \\ --config "$md_conf_root/scummvm/retroarch.cfg" \\ "\$ROM" "\$@" _EOF_ chmod +x "$md_inst/romdir-launcher.sh" } ================================================ FILE: scriptmodules/libretrocores/lr-smsplus-gx.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-smsplus-gx" rp_module_desc="Sega Master System & Game Gear emu - SMSPlus (enhanced) port for libretro" rp_module_help="ROM Extensions: .gg .sms .bin .zip\nCopy your Game Gear roms to $romdir/gamegear\nMasterSystem roms to $romdir/mastersystem" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/smsplus-gx/master/docs/license" rp_module_repo="git https://github.com/libretro/smsplus-gx.git master" rp_module_section="exp" function sources_lr-smsplus-gx() { gitPullOrClone } function build_lr-smsplus-gx() { make -f Makefile.libretro clean make -f Makefile.libretro md_ret_require="$md_build/smsplus_libretro.so" } function install_lr-smsplus-gx() { md_ret_files=( 'smsplus_libretro.so' 'docs/license' 'README.md' ) } function configure_lr-smsplus-gx() { local system for system in gamegear mastersystem; do mkRomDir "$system" defaultRAConfig "$system" addEmulator 0 "$md_id" "$system" "$md_inst/smsplus_libretro.so" addSystem "$system" done } ================================================ FILE: scriptmodules/libretrocores/lr-snes9x.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-snes9x" rp_module_desc="Super Nintendo emu - Snes9x (current) port for libretro" rp_module_help="ROM Extensions: .bin .smc .sfc .fig .swc .mgd .zip\n\nCopy your SNES roms to $romdir/snes" rp_module_licence="NONCOM https://raw.githubusercontent.com/libretro/snes9x/master/LICENSE" rp_module_repo="git https://github.com/libretro/snes9x.git master" rp_module_section="main armv6=opt armv7=opt" rp_module_flags="nodistcc" function sources_lr-snes9x() { gitPullOrClone } function build_lr-snes9x() { local params=() isPlatform "arm" && params+=(platform="armv") cd libretro make "${params[@]}" clean make "${params[@]}" md_ret_require="$md_build/libretro/snes9x_libretro.so" } function install_lr-snes9x() { md_ret_files=( 'libretro/snes9x_libretro.so' 'docs' ) } function configure_lr-snes9x() { mkRomDir "snes" defaultRAConfig "snes" local def=0 ! isPlatform "armv6" && ! isPlatform "armv7" && def=1 addEmulator $def "$md_id" "snes" "$md_inst/snes9x_libretro.so" addSystem "snes" } ================================================ FILE: scriptmodules/libretrocores/lr-snes9x2002.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-snes9x2002" rp_module_desc="Super Nintendo emu - ARM optimised Snes9x 1.39 port for libretro" rp_module_help="Previously called lr-pocketsnes\n\nROM Extensions: .bin .smc .sfc .fig .swc .mgd .zip\n\nCopy your SNES roms to $romdir/snes" rp_module_licence="NONCOM https://raw.githubusercontent.com/libretro/snes9x2002/master/src/copyright.h" rp_module_repo="git https://github.com/libretro/snes9x2002.git master" rp_module_section="opt armv6=main" rp_module_flags="!all arm" function _update_hook_lr-snes9x2002() { # move from old location and update emulators.cfg renameModule "lr-pocketsnes" "lr-snes9x2002" } function sources_lr-snes9x2002() { gitPullOrClone } function build_lr-snes9x2002() { make clean CFLAGS="$CFLAGS -Wa,-mimplicit-it=thumb" make ARM_ASM=1 md_ret_require="$md_build/snes9x2002_libretro.so" } function install_lr-snes9x2002() { md_ret_files=( 'snes9x2002_libretro.so' 'README.txt' ) } function configure_lr-snes9x2002() { mkRomDir "snes" defaultRAConfig "snes" local def=0 isPlatform "armv6" && def=1 addEmulator $def "$md_id" "snes" "$md_inst/snes9x2002_libretro.so" addSystem "snes" } ================================================ FILE: scriptmodules/libretrocores/lr-snes9x2005.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-snes9x2005" rp_module_desc="Super Nintendo emu - Snes9x 1.43 based port for libretro" rp_module_help="Previously called lr-catsfc\n\nROM Extensions: .bin .smc .sfc .fig .swc .mgd .zip\n\nCopy your SNES roms to $romdir/snes" rp_module_licence="NONCOM https://raw.githubusercontent.com/libretro/snes9x2005/master/copyright" rp_module_repo="git https://github.com/libretro/snes9x2005.git master" rp_module_section="opt arm=main" function _update_hook_lr-snes9x2005() { # move from old location and update emulators.cfg renameModule "lr-catsfc" "lr-snes9x2005" } function sources_lr-snes9x2005() { gitPullOrClone } function build_lr-snes9x2005() { make clean make md_ret_require="$md_build/snes9x2005_libretro.so" } function install_lr-snes9x2005() { md_ret_files=( 'snes9x2005_libretro.so' ) } function configure_lr-snes9x2005() { mkRomDir "snes" defaultRAConfig "snes" addEmulator 0 "$md_id" "snes" "$md_inst/snes9x2005_libretro.so" addSystem "snes" } ================================================ FILE: scriptmodules/libretrocores/lr-snes9x2010.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-snes9x2010" rp_module_desc="Super Nintendo emu - Snes9x 1.52 based port for libretro" rp_module_help="Previously called lr-snes9x-next\n\nROM Extensions: .bin .smc .sfc .fig .swc .mgd .zip\n\nCopy your SNES roms to $romdir/snes" rp_module_licence="NONCOM https://raw.githubusercontent.com/libretro/snes9x2010/master/docs/snes9x-license.txt" rp_module_repo="git https://github.com/libretro/snes9x2010.git master" rp_module_section="opt arm=main" function _update_hook_lr-snes9x2010() { # move from old location and update emulators.cfg renameModule "lr-snes9x-next" "lr-snes9x2010" } function sources_lr-snes9x2010() { gitPullOrClone } function build_lr-snes9x2010() { make -f Makefile.libretro clean local platform="" isPlatform "arm" && platform+="armv" isPlatform "neon" && platform+="neon" if [[ -n "$platform" ]]; then make -f Makefile.libretro platform="$platform" else make -f Makefile.libretro fi md_ret_require="$md_build/snes9x2010_libretro.so" } function install_lr-snes9x2010() { md_ret_files=( 'snes9x2010_libretro.so' 'docs' ) } function configure_lr-snes9x2010() { mkRomDir "snes" defaultRAConfig "snes" local def=0 isPlatform "armv7" && def=1 addEmulator $def "$md_id" "snes" "$md_inst/snes9x2010_libretro.so" addSystem "snes" } ================================================ FILE: scriptmodules/libretrocores/lr-stella.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-stella" rp_module_desc="Atari 2600 emulator - Stella core for libretro" rp_module_help="ROM Extensions: .a26 .bin .rom .zip .gz\n\nCopy your Atari 2600 roms to $romdir/atari2600" rp_module_licence="GPL2 https://raw.githubusercontent.com/stella-emu/stella/master/License.txt" rp_module_repo="git https://github.com/stella-emu/stella.git master :_get_commit_lr-stella" rp_module_section="exp" function _get_commit_lr-stella() { # GCC 11 is required after 2d57f9e0 if [[ "$__gcc_version" -lt 11 ]]; then echo "2d57f9e0" fi } function sources_lr-stella() { gitPullOrClone } function build_lr-stella() { cd src/os/libretro make clean make LTO="" md_ret_require="$md_build/src/os/libretro/stella_libretro.so" } function install_lr-stella() { md_ret_files=( 'README.md' 'src/os/libretro/stella_libretro.so' 'License.txt' ) } function configure_lr-stella() { mkRomDir "atari2600" defaultRAConfig "atari2600" addEmulator 0 "$md_id" "atari2600" "$md_inst/stella_libretro.so" addSystem "atari2600" } ================================================ FILE: scriptmodules/libretrocores/lr-stella2014.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-stella2014" rp_module_desc="Atari 2600 emulator - Stella port for libretro" rp_module_help="ROM Extensions: .a26 .bin .rom .zip .gz\n\nCopy your Atari 2600 roms to $romdir/atari2600" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/stella2014-libretro/master/stella/license.txt" rp_module_repo="git https://github.com/libretro/stella2014-libretro.git master" rp_module_section="main" function sources_lr-stella2014() { gitPullOrClone } function build_lr-stella2014() { make clean make md_ret_require="$md_build/stella2014_libretro.so" } function install_lr-stella2014() { md_ret_files=( 'README.md' 'stella2014_libretro.so' 'stella/license.txt' ) } function configure_lr-stella2014() { mkRomDir "atari2600" defaultRAConfig "atari2600" addEmulator 1 "$md_id" "atari2600" "$md_inst/stella2014_libretro.so" addSystem "atari2600" } ================================================ FILE: scriptmodules/libretrocores/lr-superflappybirds.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-superflappybirds" rp_module_desc="Super Flappy Birds - Multiplayer Flappy Bird Clone" rp_module_help="https://github.com/IgniparousTempest/libretro-superflappybirds/wiki" rp_module_licence="GPL3 https://raw.githubusercontent.com/IgniparousTempest/libretro-superflappybirds/master/LICENSE" rp_module_repo="git https://github.com/IgniparousTempest/libretro-superflappybirds.git master" rp_module_section="exp" function depends_lr-superflappybirds() { getDepends cmake } function sources_lr-superflappybirds() { gitPullOrClone } function build_lr-superflappybirds() { cmake . make md_ret_require="$md_build/superflappybirds_libretro.so" } function install_lr-superflappybirds() { md_ret_files=( 'superflappybirds_libretro.so' 'resources' 'LICENSE' 'README.md' ) } function configure_lr-superflappybirds() { setConfigRoot "ports" addPort "$md_id" "superflappybirds" "Super Flappy Birds" "$md_inst/superflappybirds_libretro.so" defaultRAConfig "superflappybirds" } ================================================ FILE: scriptmodules/libretrocores/lr-tgbdual.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-tgbdual" rp_module_desc="Gameboy Color emu - TGB Dual port for libretro" rp_module_help="ROM Extensions: .gb .gbc .zip\n\nCopy your GameBoy roms to $romdir/gb\n\nCopy your GameBoy Color roms to $romdir/gbc" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/tgbdual-libretro/master/docs/COPYING-2.0.txt" rp_module_repo="git https://github.com/libretro/tgbdual-libretro.git master" rp_module_section="opt" function sources_lr-tgbdual() { gitPullOrClone } function build_lr-tgbdual() { make clean make md_ret_require="$md_build/tgbdual_libretro.so" } function install_lr-tgbdual() { md_ret_files=( 'tgbdual_libretro.so' ) } function configure_lr-tgbdual() { mkRomDir "gbc" mkRomDir "gb" defaultRAConfig "gb" defaultRAConfig "gbc" # enable dual / link by default setRetroArchCoreOption "tgbdual_gblink_enable" "enabled" addEmulator 0 "$md_id" "gb" "$md_inst/tgbdual_libretro.so" addEmulator 0 "$md_id" "gbc" "$md_inst/tgbdual_libretro.so" addSystem "gb" addSystem "gbc" } ================================================ FILE: scriptmodules/libretrocores/lr-theodore.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-theodore" rp_module_desc="Thomson MO/TO system emulator" rp_module_help="ROM Extensions: *.fd, *.sap, *.k7, *.m5, *.m7, *.rom\n\nAdd your game files in $romdir/moto" rp_module_licence="GPL3 https://raw.githubusercontent.com/Zlika/theodore/master/LICENSE" rp_module_repo="git https://github.com/Zlika/theodore master" rp_module_section="exp" rp_module_flags="" function sources_lr-theodore() { gitPullOrClone } function build_lr-theodore() { make clean make md_ret_require="theodore_libretro.so" } function install_lr-theodore() { md_ret_files=( 'theodore_libretro.so' 'README.md' 'README-FR.md' 'LICENSE' ) } function configure_lr-theodore() { mkRomDir "moto" defaultRAConfig "moto" addEmulator 1 "$md_id" "moto" "$md_inst/theodore_libretro.so" addSystem "moto" } ================================================ FILE: scriptmodules/libretrocores/lr-tic80.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-tic80" rp_module_desc="TIC-80 fantasy computer - port for libretro" rp_module_help="ROM Extensions: .tic .zip\n\nCopy your roms to $romdir/tic80\n\n" rp_module_licence="MIT https://raw.githubusercontent.com/libretro/TIC-80/master/LICENSE" rp_module_repo="git https://github.com/libretro/TIC-80.git master" rp_module_section="exp" function depends_lr-tic80() { getDepends cmake } function sources_lr-tic80() { gitPullOrClone } function build_lr-tic80() { rm -rf retropie mkdir -p retropie cd retropie cmake -DBUILD_PLAYER=OFF -DBUILD_SOKOL=OFF -DBUILD_SDL=OFF -DBUILD_DEMO_CARTS=OFF -DBUILD_LIBRETRO=ON ../core make md_ret_require="$md_build/retropie/lib/tic80_libretro.so" } function install_lr-tic80() { md_ret_files=( 'retropie/lib/tic80_libretro.so' 'README.md' 'LICENSE' ) } function configure_lr-tic80() { mkRomDir "tic80" defaultRAConfig "tic80" addEmulator 1 "$md_id" "tic80" "$md_inst/tic80_libretro.so" addSystem "tic80" "TIC-80" } ================================================ FILE: scriptmodules/libretrocores/lr-tyrquake.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-tyrquake" rp_module_desc="Quake 1 engine - Tyrquake port for libretro" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/tyrquake/master/LICENSE.txt" rp_module_repo="git https://github.com/libretro/tyrquake.git master" rp_module_section="opt" function sources_lr-tyrquake() { gitPullOrClone } function build_lr-tyrquake() { make clean make md_ret_require="$md_build/tyrquake_libretro.so" } function install_lr-tyrquake() { md_ret_files=( 'LICENSE.txt' 'readme-id.txt' 'readme.txt' 'tyrquake_libretro.so' ) } function game_data_lr-tyrquake() { if [[ ! -f "$romdir/ports/quake/id1/pak0.pak" ]]; then getDepends lhasa mkUserDir "$romdir/ports" mkUserDir "$romdir/ports/quake" local temp="$(mktemp -d)" # download / unpack / install quake shareware files downloadAndExtract "$__archive_url/quake106.zip" "$temp" pushd "$temp" lhasa ef resource.1 cp -rf id1 "$romdir/ports/quake/" popd rm -rf "$temp" chown -R "$__user":"$__group" "$romdir/ports/quake" chmod 644 "$romdir/ports/quake/id1/"* fi } function _add_games_lr-tyrquake() { local cmd="$1" declare -A games=( ['id1']="Quake" ['hipnotic']="Quake Mission Pack 1 (hipnotic)" ['rogue']="Quake Mission Pack 2 (rogue)" ['dopa']="Quake Episode 5 (dopa)" ) local dir local pak for dir in "${!games[@]}"; do pak="$romdir/ports/quake/$dir/pak0.pak" if [[ -f "$pak" ]]; then addPort "$md_id" "quake" "${games[$dir]}" "$cmd" "$pak" fi done } function add_games_lr-tyrquake() { _add_games_lr-tyrquake "$md_inst/tyrquake_libretro.so" } function configure_lr-tyrquake() { setConfigRoot "ports" mkRomDir "ports/quake" [[ "$md_mode" == "install" ]] && game_data_lr-tyrquake add_games_lr-tyrquake defaultRAConfig "quake" } ================================================ FILE: scriptmodules/libretrocores/lr-uae4arm.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-uae4arm" rp_module_desc="Uae4arm port for libretro" rp_module_help="ROM Extensions: .adf .uae .lha .ipf .iso\n\nCopy your Amigas games to $romdir/amiga." rp_module_licence="GPL2" rp_module_repo="git https://github.com/Chips-fr/uae4arm-rpi.git master" rp_module_section="exp" rp_module_flags="!all arm aarch64" function depends_lr-uae4arm() { getDepends zlib1g-dev libmpg123-dev libflac-dev } function sources_lr-uae4arm() { gitPullOrClone } function build_lr-uae4arm() { make -f Makefile.libretro clean local params=(platform=unix) isPlatform "neon" && params=(platform=unix-neon) isPlatform "aarch64" && params=(platform=unix-aarch64) make -f Makefile.libretro "${params[@]}" md_ret_require="$md_build/uae4arm_libretro.so" } function install_lr-uae4arm() { md_ret_files=( 'uae4arm_libretro.so' 'README.md' ) } function configure_lr-uae4arm() { mkRomDir "amiga" defaultRAConfig "amiga" addEmulator 1 "$md_id" "amiga" "$md_inst/uae4arm_libretro.so" addSystem "amiga" } ================================================ FILE: scriptmodules/libretrocores/lr-vba-next.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-vba-next" rp_module_desc="GBA emulator - VBA-M (optimised) port for libretro" rp_module_help="ROM Extensions: .gba .zip\n\nCopy your Game Boy Advance roms to $romdir/gba\n\nCopy the required BIOS file gba_bios.bin to $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/vba-next/master/LICENSE" rp_module_repo="git https://github.com/libretro/vba-next.git master" rp_module_section="main" rp_module_flags="!armv6" function sources_lr-vba-next() { gitPullOrClone } function build_lr-vba-next() { make -f Makefile.libretro clean if isPlatform "neon"; then make -f Makefile.libretro platform=armvhardfloatunix TILED_RENDERING=1 HAVE_NEON=1 else make -f Makefile.libretro fi md_ret_require="$md_build/vba_next_libretro.so" } function install_lr-vba-next() { md_ret_files=( 'vba_next_libretro.so' ) } function configure_lr-vba-next() { mkRomDir "gba" defaultRAConfig "gba" addEmulator 0 "$md_id" "gba" "$md_inst/vba_next_libretro.so" addSystem "gba" } ================================================ FILE: scriptmodules/libretrocores/lr-vecx.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-vecx" rp_module_desc="Vectrex emulator - vecx port for libretro" rp_module_help="ROM Extensions: .vec .gam .bin .zip\n\nCopy your Vectrex roms to $romdir/vectrex" rp_module_licence="GPL3 https://raw.githubusercontent.com/libretro/libretro-vecx/master/LICENSE.md" rp_module_repo="git https://github.com/libretro/libretro-vecx.git master" rp_module_section="main" function depends_lr-vecx() { local depends=() isPlatform "mesa" && depends+=(libgles2-mesa-dev) isPlatform "videocore" && depends+=(libraspberrypi-dev) getDepends "${depends[@]}" } function sources_lr-vecx() { gitPullOrClone } function build_lr-vecx() { local params isPlatform "videocore" && params+="platform=rpi" isPlatform "gles" && params+=" HAS_GLES=1" make clean make -f Makefile.libretro $params md_ret_require="$md_build/vecx_libretro.so" } function install_lr-vecx() { md_ret_files=( 'vecx_libretro.so' 'bios/fast.bin' 'bios/skip.bin' 'bios/system.bin' ) } function configure_lr-vecx() { mkRomDir "vectrex" defaultRAConfig "vectrex" if [[ "$md_mode" == "install" ]]; then # Copy bios files cp -v "$md_inst/"{fast.bin,skip.bin,system.bin} "$biosdir/" chown "$__user":"$__group" "$biosdir/"{fast.bin,skip.bin,system.bin} else rm -f "$biosdir/"{fast.bin,skip.bin,system.bin} fi addEmulator 1 "$md_id" "vectrex" "$md_inst/vecx_libretro.so" addSystem "vectrex" } ================================================ FILE: scriptmodules/libretrocores/lr-vice.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-vice" rp_module_desc="C64 / C128 / PET / Plus4 / VIC20 emulator - port of VICE for libretro" rp_module_help="ROM Extensions: .cmd .crt .d64 .d71 .d80 .d81 .g64 .m3u .prg .t64 .tap .x64 .zip .vsf\n\nCopy your games to $romdir/c64" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/vice-libretro/master/vice/COPYING" rp_module_repo="git https://github.com/libretro/vice-libretro.git master" rp_module_section="opt" rp_module_flags="" function _get_targets_lr-vice() { echo x64 x64dtv x64sc x128 xpet xplus4 xvic } function sources_lr-vice() { gitPullOrClone } function build_lr-vice() { mkdir -p "$md_build/cores" local target for target in $(_get_targets_lr-vice); do make clean make EMUTYPE="$target" cp "$md_build/vice_${target}_libretro.so" "cores/" md_ret_require+=("$md_build/cores/vice_${target}_libretro.so") done } function install_lr-vice() { md_ret_files=( 'vice/data' 'vice/COPYING' ) local target for target in $(_get_targets_lr-vice); do md_ret_files+=("cores/vice_${target}_libretro.so") done } function configure_lr-vice() { mkRomDir "c64" defaultRAConfig "c64" local target local name local def for target in $(_get_targets_lr-vice); do def=0 name="-${target}" if [[ "$target" == "x64" ]]; then name="" def=1 fi addEmulator "$def" "$md_id${name}" "c64" "$md_inst/vice_${target}_libretro.so" done addSystem "c64" [[ "$md_mode" == "remove" ]] && return if isPlatform "arm"; then setRetroArchCoreOption "vice_sid_engine" "FastSID" isPlatform "armv6" && setRetroArchCoreOption "vice_sound_sample_rate" "22050" fi cp -R "$md_inst/data" "$biosdir" chown -R "$__user":"$__group" "$biosdir/data" } ================================================ FILE: scriptmodules/libretrocores/lr-virtualjaguar.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-virtualjaguar" rp_module_desc="Atari Jaguar emu - Virtual Jaguar (optimised) port for libretro" rp_module_help="ROM Extensions: .j64 .jag .zip\n\nCopy your Atari Jaguar roms to $romdir/atarijaguar" rp_module_licence="GPL3 https://raw.githubusercontent.com/libretro/virtualjaguar-libretro/master/docs/GPLv3" rp_module_repo="git https://github.com/libretro/virtualjaguar-libretro.git master" rp_module_section="exp" rp_module_flags="!armv6" function sources_lr-virtualjaguar() { gitPullOrClone } function build_lr-virtualjaguar() { make clean make md_ret_require="$md_build/virtualjaguar_libretro.so" } function install_lr-virtualjaguar() { md_ret_files=( 'virtualjaguar_libretro.so' 'README.md' ) } function configure_lr-virtualjaguar() { mkRomDir "atarijaguar" defaultRAConfig "atarijaguar" addEmulator 1 "$md_id" "atarijaguar" "$md_inst/virtualjaguar_libretro.so" addSystem "atarijaguar" } ================================================ FILE: scriptmodules/libretrocores/lr-x1.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-x1" rp_module_desc="Sharp X1 emulator - X Millenium port for libretro" rp_module_help="ROM Extensions: .dx1 .zip .2d .2hd .tfd .d88 .88d .hdm .xdf .dup .cmd\n\nCopy your X1 roms to $romdir/x1\n\nCopy the required BIOS files IPLROM.X1 and IPLROM.X1T to $biosdir" rp_module_repo="git https://github.com/libretro/xmil-libretro.git master" rp_module_licence="BSD https://raw.githubusercontent.com/libretro/xmil-libretro/master/LICENSE" rp_module_section="exp" function sources_lr-x1() { gitPullOrClone } function build_lr-x1() { cd libretro make clean make md_ret_require="$md_build/libretro/x1_libretro.so" } function install_lr-x1() { md_ret_files=( 'libretro/x1_libretro.so' ) } function configure_lr-x1() { mkRomDir "x1" defaultRAConfig "x1" addEmulator 1 "$md_id" "x1" "$md_inst/x1_libretro.so" addSystem "x1" } ================================================ FILE: scriptmodules/libretrocores/lr-xrick.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-xrick" rp_module_desc="Open source implementation of Rick Dangerous - xrick ported for libretro" rp_module_help="Install the xrick data.zip to $romdir/ports/xrick/data.zip" rp_module_licence="GPL https://raw.githubusercontent.com/libretro/xrick-libretro/master/README" rp_module_repo="git https://github.com/libretro/xrick-libretro.git master" rp_module_section="opt" function sources_lr-xrick() { gitPullOrClone } function build_lr-xrick() { make clean make md_ret_require="$md_build/xrick_libretro.so" } function install_lr-xrick() { md_ret_files=( 'README' 'README.md' 'xrick_libretro.so' ) } function configure_lr-xrick() { setConfigRoot "ports" addPort "$md_id" "xrick" "XRick" "$md_inst/xrick_libretro.so" "$romdir/ports/xrick/data.zip" [[ "$md_mode" == "remove" ]] && return defaultRAConfig "xrick" } ================================================ FILE: scriptmodules/libretrocores/lr-yabause.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-yabause" rp_module_desc="Sega Saturn emu - Yabause (optimised) port for libretro" rp_module_help="ROM Extensions: .iso .bin .zip\n\nCopy your Sega Saturn roms to $romdir/saturn\n\nCopy the required BIOS file saturn_bios.bin to $biosdir" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/yabause/master/yabause/COPYING" rp_module_repo="git https://github.com/libretro/yabause.git master" rp_module_section="exp" rp_module_flags="!armv6" function sources_lr-yabause() { gitPullOrClone } function build_lr-yabause() { local params=() cd yabause/src/libretro isPlatform "neon" && params+=(platform=armvneonhardfloat) ! isPlatform "x86" && params+=(HAVE_SSE=0) make "${params[@]}" clean make "${params[@]}" md_ret_require="$md_build/yabause/src/libretro/yabause_libretro.so" } function install_lr-yabause() { md_ret_files=( 'yabause/src/libretro/yabause_libretro.so' 'yabause/COPYING' 'yabause/ChangeLog' 'yabause/AUTHORS' 'yabause/README' ) } function configure_lr-yabause() { mkRomDir "saturn" defaultRAConfig "saturn" addEmulator 1 "$md_id" "saturn" "$md_inst/yabause_libretro.so" addSystem "saturn" } ================================================ FILE: scriptmodules/packages.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # declare -A __sections=( [core]="core" [main]="main" [opt]="optional" [exp]="experimental" [driver]="driver" [config]="configuration" [depends]="dependency" ) __NET_ERRMSG="" function rp_listFunctions() { local id local desc local mode local func local enabled echo -e "ID: Description: List of available functions" echo "-----------------------------------------------------------------------------------------------------------------------------------" for id in ${__mod_id[@]}; do if rp_isEnabled "$id"; then printf "%-20s: %-42s :" "$id" "${__mod_info[$id/desc]}" else printf "*%-20s: %-42s : %s\n" "$id" "${__mod_info[$id/desc]}" "This module is not available for your platform" continue fi while read mode; do # skip private module functions (start with an underscore) [[ "$mode" = _* ]] && continue mode=${mode//_$id/} echo -n " $mode" done < <(compgen -A function -X \!*_$id) fnExists "sources_${id}" && echo -n " clean" fnExists "install_${id}" || fnExists "install_bin_${id}" && ! fnExists "remove_${id}" && echo -n " remove" echo "" done echo "===================================================================================================================================" } function rp_printUsageinfo() { echo -e "Usage:\n$0 \nThis will run the functions depends, sources, build, install, configure and clean automatically.\n" echo -e "Alternatively, $0 can be called as\n$0 [function] where function is a supported module functions as listed below\n" echo "Details of some common functions:" echo "depends: install the dependencies for the module." echo "sources: install the sources for the module" echo "build: build/compile the module" echo "install: install the compiled module" echo "configure: configure the installed module (es_systems.cfg / launch parameters etc)" echo "clean: remove the sources/build folder for the module" echo "remove: remove/uninstall the module" echo "help: get additional help on the module (available for all modules)" echo -e "\nThis is a list of valid modules/packages and supported functions:\n" rp_listFunctions } function rp_moduleVars() { local id="$1" # create variables that can be used in modules local code read -d "" -r code <<_EOF_ local md_desc="${__mod_info[$id/desc]}" local md_help="${__mod_info[$id/help]}" local md_type="${__mod_info[$id/type]}" local md_flags="${__mod_info[$id/flags]}" local md_path="${__mod_info[$id/path]}" local md_licence="${__mod_info[$id/licence]}" local md_repo_type="${__mod_info[$id/repo_type]}" local md_repo_url="${__mod_info[$id/repo_url]}" local md_repo_branch="${__mod_info[$id/repo_branch]}" local md_repo_commit="${__mod_info[$id/repo_commit]}" local md_build="$__builddir/$id" local md_inst="$(rp_getInstallPath $id)" # get module path folder + md_id for $md_data local md_data="${__mod_info[$id/path]%/*}/$id" _EOF_ echo "$code" } function rp_callModule() { local md_id="$1" local mode="$2" # shift the function parameters left so $@ will contain any additional parameters which we can use in modules shift 2 # check if module exists if ! rp_hasModule "$md_id"; then printMsgs "console" "No module '$md_id' found." return 2 fi # check if module is enabled for platform if ! rp_isEnabled "$md_id"; then printMsgs "console" "Module '$md_id' is not available for your system ($__platform)" return 3 fi # skip for modules 'builder' and 'setup' so that distcc settings do not propagate from them if [[ "$md_id" != "builder" && "$md_id" != "setup" ]]; then # if distcc is used and the module doesn't exclude it, add /usr/lib/distcc to PATH and MAKEFLAGS if [[ -n "$DISTCC_HOSTS" ]] && ! hasFlag "${__mod_info[$md_id/flags]}" "nodistcc"; then # use local variables so they are available to all child functions without changing the globals local PATH="/usr/lib/distcc:$PATH" local MAKEFLAGS="$MAKEFLAGS PATH=$PATH" fi fi # parameters _auto_ _binary or _source_ (_source_ is used if no parameters are given for a module) case "$mode" in # install the module if not installed, and update if it is _autoupdate_) if rp_isInstalled "$md_id"; then rp_callModule "$md_id" "_update_" || return 1 else rp_callModule "$md_id" "_auto_" || return 1 fi return 0 ;; # automatic modes used by rp_installModule to choose between binary/source based on pkg info _auto_|_update_) # if updating and a package isn't installed, return an error if [[ "$mode" == "_update_" ]] && ! rp_isInstalled "$md_id"; then __ERRMSGS+=("$md_id is not installed, so can't update") return 1 fi rp_loadPackageInfo "$md_id" "pkg_origin" local pkg_origin="${__mod_info[$md_id/pkg_origin]}" local has_binary=0 local has_net=0 isConnected && has_net=1 # for modules with nonet flag that don't need to download data, we force has_net to 1 hasFlag "${__mod_info[$md_id/flags]}" "nonet" && has_net=1 if [[ "$has_net" -eq 1 ]]; then rp_hasBinary "$md_id" local ret="$?" [[ "$ret" -eq 0 ]] && has_binary=1 [[ "$ret" -eq 2 ]] && has_net=0 fi # fail if we don't seem to be connected if [[ "$has_net" -eq 0 ]]; then __ERRMSGS+=("Can't install/update $md_id - $__NET_ERRMSG") return 1 fi local do_update=0 # if we are in _update_ mode we only update if there is a newer version of the binary or source if [[ "$mode" == "_update_" ]]; then printMsgs "heading" "Checking for updates for $md_id" rp_hasNewerModule "$md_id" "$pkg_origin" [[ "$?" -eq 0 || "$?" == 2 ]] && do_update=1 # if rp_hasNewerModule returns 3, then there was an error and we should abort [[ "$?" -eq 3 ]] && return 1 else do_update=1 fi if [[ "$do_update" -eq 1 ]]; then printMsgs "console" "Update is available - updating ..." else printMsgs "console" "No update was found." fi if [[ "$do_update" -eq 1 ]]; then if [[ "$pkg_origin" != "source" && "$has_binary" -eq 1 ]]; then rp_callModule "$md_id" _binary_ || return 1 else rp_callModule "$md_id" _source_ || return 1 fi fi return 0 ;; _binary_) for mode in depends install_bin configure; do rp_callModule "$md_id" "$mode" || return 1 done return 0 ;; # automatically build/install module from source if no _source_ or no parameters are given ""|_source_) for mode in depends sources build install configure clean; do rp_callModule "$md_id" "$mode" || return 1 done return 0 ;; esac # load our md_* variables eval "$(rp_moduleVars $md_id)" local md_mode="install" # set md_conf_root to $configdir and to $configdir/ports for ports # ports in libretrocores or systems (as ES sees them) in ports will need to change it manually with setConfigRoot local md_conf_root if [[ "$md_type" == "ports" ]]; then setConfigRoot "ports" else setConfigRoot "" fi case "$mode" in # remove sources clean) if [[ "$__persistent_repos" -eq 1 ]]; then if [[ -d "$md_build/.git" ]]; then git -C "$md_build" reset --hard git -C "$md_build" clean -f -d fi else rmDirExists "$md_build" fi return 0 ;; # create binary archive create_bin) rp_createBin || return 1 return 0 ;; # echo module help to console help) printMsgs "console" "$md_desc\n\n$md_help" return 0; ;; esac # create function name function="${mode}_${md_id}" # automatically switch to install_bin if present while install is not, and handle cases where we have # fallback functions when not present in modules - currently install_bin and remove if ! fnExists "$function"; then if [[ "$mode" == "install" ]] && fnExists "install_bin_${md_id}"; then function="install_bin_${md_id}" mode="install_bin" elif [[ "$mode" != "install_bin" && "$mode" != "remove" ]]; then return 0 fi fi # these can be returned by a module local md_ret_require=() local md_ret_files=() local md_ret_errors=() local md_ret_info=() local action local pushed=1 case "$mode" in depends) if [[ "$1" == "remove" ]]; then md_mode="remove" action="Removing" else action="Installing" fi action+=" dependencies for" ;; sources) action="Getting sources for" mkdir -p "$md_build" pushd "$md_build" pushed=$? ;; build) action="Building" pushd "$md_build" 2>/dev/null pushed=$? ;; install) pushd "$md_build" 2>/dev/null pushed=$? ;; install_bin) action="Installing (binary)" ;; configure) action="Configuring" pushd "$md_inst" 2>/dev/null pushed=$? ;; remove) action="Removing" ;; _update_hook) ;; *) action="Running action '$mode' for" ;; esac # print an action and a description if [[ -n "$action" ]]; then printHeading "$action '$md_id' : $md_desc" fi case "$mode" in remove) fnExists "$function" && "$function" "$@" md_mode="remove" if fnExists "configure_${md_id}"; then pushd "$md_inst" 2>/dev/null pushed=$? "configure_${md_id}" fi rm -rf "$md_inst" rp_clearCachedInfo "$md_id" printMsgs "console" "Removed directory $md_inst" ;; install) action="Installing" # remove any previous install folder unless noinstclean flag is set if ! hasFlag "${__mod_info[$md_id/flags]}" "noinstclean"; then rmDirExists "$md_inst" fi mkdir -p "$md_inst" "$function" "$@" ;; install_bin) if fnExists "install_bin_${md_id}"; then mkdir -p "$md_inst" if ! "$function" "$@"; then md_ret_errors+=("Unable to install binary for $md_id") fi else if rp_hasBinary "$md_id"; then rp_installBin else md_ret_errors+=("Could not find a binary for $md_id") fi fi ;; *) # call the function with parameters "$function" "$@" ;; esac # check if any required files are found if [[ -n "$md_ret_require" ]]; then for file in "${md_ret_require[@]}"; do if [[ ! -e "$file" ]]; then md_ret_errors+=("Could not successfully $mode $md_id - $md_desc ($file not found).") break fi done fi if [[ "${#md_ret_errors}" -eq 0 && -n "$md_ret_files" ]]; then # check for existence and copy any files/directories returned local file for file in "${md_ret_files[@]}"; do if [[ ! -e "$md_build/$file" ]]; then md_ret_errors+=("Could not successfully install $md_desc ($md_build/$file not found).") break fi cp -Rvf "$md_build/$file" "$md_inst" done fi # remove build folder if empty [[ -d "$md_build" ]] && find "$md_build" -maxdepth 0 -empty -exec rmdir {} \; local ret=0 # some errors were returned. if [[ "${#md_ret_errors[@]}" -gt 0 ]]; then __ERRMSGS+=("${md_ret_errors[@]}") printMsgs "console" "${md_ret_errors[@]}" >&2 # if sources fails and we were called from the setup gui module clean sources if [[ "$mode" == "sources" && "$__setup" -eq 1 ]]; then rp_callModule "$md_id" clean fi # remove install folder if there is an error (and it is empty) [[ -d "$md_inst" ]] && find "$md_inst" -maxdepth 0 -empty -exec rmdir {} \; ret=1 else [[ "$mode" == "install_bin" ]] && rp_setPackageInfo "$md_id" "binary" [[ "$mode" == "install" ]] && rp_setPackageInfo "$md_id" "source" # handle the case of a few drivers that don't have an install function and set the package info at build stage if ! fnExists "install_${md_id}" && [[ "$mode" == "build" ]]; then rp_setPackageInfo "$md_id" "source" fi fi # some information messages were returned if [[ "${#md_ret_info[@]}" -gt 0 ]]; then __INFMSGS+=("${md_ret_info[@]}") fi [[ "$pushed" -eq 0 ]] && popd return "$ret" } function rp_hasBinaries() { [[ "$__has_binaries" -eq 1 ]] && return 0 return 1 } function rp_getBinaryUrl() { local id="$1" local url="" rp_hasBinaries && url="$__binary_url/${__mod_info[$id/type]}/$id.tar.gz" if fnExists "install_bin_${id}"; then if fnExists "__binary_url_${id}"; then url="$(__binary_url_${id})" else url="notest" fi fi echo "$url" } # returns 0 if file exists, 1 if it doesn't and 2 on other error function rp_remoteFileExists() { local url="$1" local ret # runCurl will cause stderr to be copied to output so we redirect both stdout/stderr to /dev/null. # any errors will have been captured by runCurl runCurl --location --max-time 10 --silent --show-error --fail --head "$url" &>/dev/null ret="$?" if [[ "$ret" -eq 0 ]]; then return 0 elif [[ "$ret" -eq 22 ]]; then return 1 else return 2 fi } function rp_hasBinary() { local id="$1" # binary blacklist for armv7 Debian/OSMC due to GCC ABI incompatibility with # threaded C++ apps on Raspbian (armv6 userland) if [[ "$__os_id" != "Raspbian" ]] && ! isPlatform "armv6"; then case "$id" in emulationstation|lzdoom|lr-dinothawr|lr-ppsspp|ppsspp) return 1 ;; esac fi local url="$(rp_getBinaryUrl $id)" [[ "$url" == "notest" ]] && return 0 [[ -z "$url" ]] && return 1 [[ -n "${__mod_info[$id/has_binary]}" ]] && return "${__mod_info[$id/has_binary]}" local ret=1 rp_remoteFileExists "$url" ret="$?" # if there wasn't an error, cache the result [[ "$ret" -ne 2 ]] && __mod_info[$id/has_binary]="$ret" return "$ret" } function rp_getFileDate() { local url="$1" [[ -z "$url" ]] && return 1 # get last-modified date stripping any CR in the output local file_date=$(runCurl --location --silent --fail --head --no-styled-output "$url" | tr -d "\r" | grep -ioP "last-modified: \K.+") # if there is a date set in last-modified header, then convert to iso-8601 format if [[ -n "$file_date" ]]; then file_date="$(date -Iseconds --date="$file_date")" echo "$file_date" return 0 fi return 1 } function rp_getBinaryDate() { local id="$1" local url="$(rp_getBinaryUrl $id)" [[ -z "$url" || "$url" == "notest" ]] && return 1 local bin_date if bin_date="$(rp_getFileDate "$url")"; then echo "$bin_date" return 0 fi return 1 } function rp_dateIsNewer() { local date_a="$1" local date_b="$2" [[ -z "$date_a" || -z "$date_b" ]] && return 0 if date_a="$(date -d "$date_a" +%s 2>/dev/null)" && date_b="$(date -d "$date_b" +%s 2>/dev/null)"; then [[ "$date_b" -gt "$date_a" ]] && return 0 else return 0 fi return 1 } # resolve repository parameters - any parameters with a : will get the data from the following function name function rp_resolveRepoParam() { local param="$1" if [[ "$param" == :* ]]; then param="${param:1}" if fnExists "$param"; then echo "$($param)" return fi fi echo "$param" } # gets remote repository hash/revision - echos hash of remote repo and returns 0, or # echos an error and returns 1 on failure function rp_getRemoteRepoHash() { local type="$1" local url="$2" local branch="$3" local commit="$4" local hash local ret local cmd=() set -o pipefail case "$type" in git) # when the remote repository uses an annotated git tag, the real commit is found by looking for the # "tag^{}" reference, since the tag ref will point to the tag object itself, instead of the tagged # commit. See gitrevisions(7). cmd=(git ls-remote "$url" "$branch" "$branch^{}") # grep to make sure we only return refs/heads/BRANCH and refs/tags/BRANCH in case there are additional # references to the branch/tag eg refs/heads/SOMETHINGELSE/master which can be the case. # we grab the last match reported by grep, as tags that also have a tag^{} reference # will be displayed after. hash=$("${cmd[@]}" 2>/dev/null | grep -P "\trefs/(heads|tags)/$branch" | tail -n1 | cut -f1) ;; svn) cmd=(svn info -r"$commit" "$url") hash=$("${cmd[@]}" 2>/dev/null | grep -oP "Last Changed Rev: \K.*") ;; esac ret="$?" set +o pipefail if [[ "$ret" -ne 0 ]]; then echo "${cmd[*]} failed with return code $ret - please check your network connection" return 1 fi echo "$hash" return 0 } # returns 0 if a module has a newer version, 1 if it doesn't, 2 if unknown (always update), or 3 if there is an error function rp_hasNewerModule() { local id="$1" local type="$2" [[ -n "${__mod_info[$id/has_newer]}" ]] && return "${__mod_info[$id/has_newer]}" rp_loadPackageInfo "$id" local pkg_origin="${__mod_info[$id/pkg_origin]}" local pkg_date="${__mod_info[$id/pkg_date]}" local pkg_repo_date="${__mod_info[$id/pkg_repo_date]}" local pkg_repo_commit="${__mod_info[$id/pkg_repo_commit]}" local ret=1 case "$type" in binary) ret="" if [[ -n "$pkg_date" ]]; then local bin_date="$(rp_getBinaryDate $id)" if [[ -n "$bin_date" ]]; then rp_dateIsNewer "$pkg_date" "$bin_date" ret="$?" fi fi [[ -z "$ret" ]] && ret=2 ;; source) local repo_type="${__mod_info[$id/repo_type]}" local repo_url="$(rp_resolveRepoParam "${__mod_info[$id/repo_url]}")" case "$repo_type" in file) if [[ -n "$pkg_repo_date" ]]; then local file_date="$(rp_getFileDate "$repo_url")" rp_dateIsNewer "$pkg_repo_date" "$file_date" ret="$?" fi ;; git|svn) local repo_branch="$(rp_resolveRepoParam "${__mod_info[$id/repo_branch]}")" local repo_commit="$(rp_resolveRepoParam "${__mod_info[$id/repo_commit]}")" # if we are locked to a single commit, then we compare against the current module commit only if [[ -n "$repo_commit" && "$repo_commit" != "HEAD" ]]; then # if we are using git and the module has a commit hash, then adjust # the package commit length for the comparison if [[ "$repo_type" == "git" && "${#repo_commit}" -ge 4 ]]; then pkg_repo_commit="${pkg_repo_commit::${#repo_commit}}" fi if [[ "$pkg_repo_commit" != "$repo_commit" ]]; then ret=0 fi else local remote_commit if remote_commit="$(rp_getRemoteRepoHash "$repo_type" "$repo_url" "$repo_branch" "$repo_commit")"; then if [[ -n "$remote_commit" && "$pkg_repo_commit" != "$remote_commit" ]]; then ret=0 fi else __ERRMSGS+=("$remote_commit") ret=3 fi fi ;; :*) local pkg_repo_extra="${__mod_info[$id/pkg_repo_extra]}" # handle checking via module function - function should return 0 if there is a newer version local function="${repo_type:1}" if fnExists "$function"; then "$function" newer ret="$?" fi ;; *) # fallback on forcing an update ret=2 ;; esac # if we are currently not going to update - check the last commit date of the module code # if it's newer than the install date of the module we force an update, in case patches or build # related options have been changed if [[ "$ret" -eq 1 && "$__ignore_module_date" -ne 1 ]]; then local vendor="${__mod_info[$id/vendor]}" local repo_dir="$scriptdir" [[ "$vendor" != "RetroPie" ]] && repo_dir+="/ext/$vendor" local module_date="$(sudo -u "$__user" git -C "$repo_dir" log -1 --format=%cI -- "${__mod_info[$id/path]}")" # just in case the module is not known to git, get the file last modified date [[ -z "$module_date" ]] && module_date="$(date -Iseconds -r "${__mod_info[$id/path]}")" if rp_dateIsNewer "$pkg_date" "$module_date"; then ret=0 fi fi ;; *) # for unknown or in the case of a blank pkg_origin assume there is an update ret=2 ;; esac # cache our return value __mod_info[$id/has_newer]="$ret" return "$ret" } function rp_getInstallPath() { local id="$1" echo "$rootdir/${__mod_info[$id/type]}/$id" } function rp_installBin() { rp_hasBinaries || fatalError "There are no binary archives for platform $__platform" local archive="$md_id.tar.gz"; local dest="$rootdir/$md_type" local cmd_out # create temporary folder local tmp=$(mktemp -d) if downloadAndVerify "$__binary_url/$md_type/$archive" "$tmp/$archive"; then mkdir -p "$dest" rm -rf "$dest/$md_id" if tar -xvf "$tmp/$archive" -C "$dest"; then rm -rf "$tmp" return 0 else md_ret_errors+=("Archive $archive failed to unpack correctly to $dest") fi fi rm -rf "$tmp" return 1 } function rp_createBin() { printHeading "Creating binary archive for $md_desc" if [[ ! -d "$md_inst" ]]; then printMsgs "console" "No install directory $md_inst - no archive created" return 1 fi if dirIsEmpty "$md_inst"; then printMsgs "console" "Empty install directory $md_inst - no archive created" return 1 fi local archive="$md_id.tar.gz" local dest="$__tmpdir/archives/$__binary_path/$md_type" mkdir -p "$dest" rm -f "$dest/$archive" "$dest/$archive.asc" local ret=1 if tar cvzf "$dest/$archive" -C "$rootdir/$md_type" "$md_id"; then if [[ -n "$__gpg_signing_key" ]]; then if signFile "$dest/$archive"; then chown "$__user":"$__group" "$dest/$archive" "$dest/$archive.asc" ret=0 fi else ret=0 fi fi if [[ "$ret" -eq 0 ]]; then cp "$md_inst/retropie.pkg" "$dest/$md_id.pkg" else rm -f "$dest/$archive" fi return "$ret" } function rp_hasModule() { local id="$1" [[ -n "${__mod_idx[$id]}" ]] && return 0 return 1 } function rp_installModule() { local id="$1" local mode="$2" [[ -z "$mode" ]] && mode="_auto_" rp_callModule "$id" "$mode" || return 1 return 0 } function rp_clearCachedInfo() { local id="$1" # clear cached data # set pkg_info to 0 to force a reload when needed __mod_info[$id/pkg_info]=0 __mod_info[$id/has_binary]="" __mod_info[$id/has_newer]="" } # this is run after the install_ID function for a module - which by default would be from the # folder set by md_build. However some modules install directly to md_inst which would mean unless # they change directory also to md_inst in the install stage (which is common), it's possible this # function could be run and not find the source. Therefore, we currently record the first directory used # by gitPullOrClone and record it in __mod_info to be used here - but this needs further work to handle # other cases. function rp_setPackageInfo() { local id="$1" local install_path="$(rp_getInstallPath $id)" [[ ! -d "$install_path" ]] && return 1 local pkg="$install_path/retropie.pkg" local origin="$2" rp_clearCachedInfo "$id" iniConfig "=" '"' "$pkg" iniSet "pkg_origin" "$origin" local pkg_date local pkg_repo_type local pkg_repo_url local pkg_repo_branch local pkg_repo_commit local pkg_repo_date local pkg_repo_extra if [[ "$origin" == "binary" ]]; then pkg_date="$(rp_getBinaryDate $id)" iniSet "pkg_date" "$pkg_date" else pkg_date="$(date -Iseconds)" pkg_repo_type="${__mod_info[$id/repo_type]}" pkg_repo_url="$(rp_resolveRepoParam "${__mod_info[$id/repo_url]}")" pkg_repo_branch="$(rp_resolveRepoParam "${__mod_info[$id/repo_branch]}")" case "$pkg_repo_type" in git|svn) if [[ "$pkg_repo_type" == "git" ]]; then # if we have recorded a source install dir during gitPullOrClone use it, or default to md_build local repo_dir="${__mod_info[$id/repo_dir]}" [[ -z "$repo_dir" ]] && repo_dir="$md_build" # date cannot understand the default date format of git pkg_repo_date="$(git -C "$repo_dir" log -1 --format=%cI)" pkg_repo_commit="$(git -C "$repo_dir" log -1 --format=%H)" else pkg_repo_date="$(svn info . | grep -oP "Last Changed Date: \K.*")" pkg_repo_date="$(date -Iseconds -d "$pkg_repo_date")" pkg_repo_commit="$(svn info . | grep -oP "Last Changed Rev: \K.*")" fi ;; file) pkg_repo_date="$(rp_getFileDate "$pkg_repo_url")" ;; :*) # set data based on function hook - function should return code to define any pkg_* vars # eg. local pkg_repo_date="something" local function="${pkg_repo_type:1}" fnExists "$function" && eval $("$function" get) ;; esac iniSet "pkg_date" "$pkg_date" iniSet "pkg_repo_type" "$pkg_repo_type" iniSet "pkg_repo_url" "$pkg_repo_url" iniSet "pkg_repo_branch" "$pkg_repo_branch" iniSet "pkg_repo_commit" "$pkg_repo_commit" iniSet "pkg_repo_date" "$pkg_repo_date" iniSet "pkg_repo_extra" "$pkg_repo_extra" fi } # loads installed package information into __mod_info/pkg_* fields # additional parameters are optional keys to load, but the data won't be cached if this is provided function rp_loadPackageInfo() { local id="$1" # if we have cached the package information already, return [[ "${__mod_info[$id/pkg_info]}" -eq 1 ]] && return local keys local cache=1 if [[ -z "$2" ]]; then keys=( pkg_origin pkg_date pkg_repo_type pkg_repo_url pkg_repo_branch pkg_repo_commit pkg_repo_date pkg_repo_extra ) else # get user supplied keys but don't cache shift keys=("$@") cache=0 fi local load=0 local pkg_file="$(rp_getInstallPath $id)/retropie.pkg" local builder_pkg_file="$__tmpdir/archives/$__binary_path/${__mod_info[$id/type]}/$id.pkg" # fallback to using package info for built binaries so the binary builder code can update only changed modules if [[ ! -f "$pkg_file" && -f "$builder_pkg_file" ]]; then pkg_file="$builder_pkg_file" fi # if the pkg file is available, we will load the data in the next loop [[ -f "$pkg_file" ]] && load=1 local key local data for key in "${keys[@]}"; do # clear any previous data we have stored, but default "pkg_origin" to "unknown" data="" [[ "$key" == "pkg_origin" ]] && data="unknown" __mod_info[$id/$key]="$data" # if the package file is available and the field is set, override the default values if [[ "$load" -eq 1 ]]; then data="$(grep -oP "$key=\"\K[^\"]+" "$pkg_file")" [[ -n "$data" ]] && __mod_info[$id/$key]="$data" fi done # if loading all data set pkg_info to 1 so we avoid loading when not needed [[ "$cache" -eq 1 ]] && __mod_info[$id/pkg_info]=1 } function rp_registerModule() { local path="$1" local type="$2" local vendor="$3" # type is the last folder in the path as we now send a full path to rp_registerModule type="${type##*/}" local rp_module_id="" local rp_module_desc="" local rp_module_help="" local rp_module_licence="" local rp_module_section="" local rp_module_flags="" local rp_module_repo="" local error=0 # for 3rd party modules, extract the module id and make sure it is unique # as we don't want 3rd party repos overriding our built-in modules if [[ "$vendor" != "RetroPie" ]]; then rp_module_id=$(grep -oP "rp_module_id=\"\K([^\"]+)" "$path") if [[ -n "${__mod_idx[$rp_module_id]}" ]]; then __INFMSGS+=("Module $path was skipped as $rp_module_id is already used by ${__mod_info[$rp_module_id/path]}") return fi fi source "$path" local var for var in rp_module_id rp_module_desc; do if [[ -z "${!var}" ]]; then echo "Module $path is missing valid $var" error=1 fi done [[ $error -eq 1 ]] && exit 1 local flags=($rp_module_flags) local flag local enabled=1 # flags are parsed in the order provided in the module - so the !all flag only makes sense first # by default modules are enabled for all platforms if [[ "$__ignore_flags" -ne 1 ]]; then for flag in "${flags[@]}"; do # !all excludes the module from all platforms if [[ "$flag" == "!all" ]]; then enabled=0 continue fi # flags without ! make the module valid for the platform if isPlatform "$flag"; then enabled=1 continue fi # flags with !flag will exclude the module for the platform if [[ "$flag" =~ ^\!(.+) ]] && isPlatform "${BASH_REMATCH[1]}"; then enabled=0 continue fi # enable or disable based on a comparison in the format :\$var:cmp:val or !:\$var:cmp:val # eg. :\$__gcc_version:-lt:7 would be evaluated as [[ $__gcc_version -lt 7 ]] # this would enable a module if the comparison was true # !:\$__gcc_version:-lt:7 would disable if the comparison was true # match and extract the parameters if [[ "$flag" =~ ^(\!?):([^:]+):([^:]+):(.+)$ ]]; then # enable or disable based on the first parameter (!) local e=1 [[ ${BASH_REMATCH[1]} == "!" ]] && e=0 # evaluate the comparison if eval "[[ ${BASH_REMATCH[2]} ${BASH_REMATCH[3]} ${BASH_REMATCH[4]} ]]"; then enabled=$e fi continue fi done fi local sections=($rp_module_section) # get default section rp_module_section="${sections[0]}" # loop through any additional flag=section parameters local flag section for section in "${sections[@]:1}"; do section=(${section/=/ }) flag="${section[0]}" section="${section[1]}" isPlatform "$flag" && rp_module_section="$section" done # create numerical index for each module id from nunber of added modules __mod_idx["$rp_module_id"]="${#__mod_id[@]}" __mod_id+=("$rp_module_id") __mod_info["$rp_module_id/enabled"]="$enabled" __mod_info["$rp_module_id/path"]="$path" __mod_info["$rp_module_id/vendor"]="$vendor" __mod_info["$rp_module_id/type"]="$type" __mod_info["$rp_module_id/desc"]="$rp_module_desc" __mod_info["$rp_module_id/help"]="$rp_module_help" __mod_info["$rp_module_id/licence"]="$rp_module_licence" __mod_info["$rp_module_id/section"]="$rp_module_section" __mod_info["$rp_module_id/flags"]="$rp_module_flags" # split module repo into type, url, branch and commit if [[ -n "$rp_module_repo" ]]; then local repo=($rp_module_repo) __mod_info["$rp_module_id/repo_type"]="${repo[0]}" __mod_info["$rp_module_id/repo_url"]="${repo[1]}" __mod_info["$rp_module_id/repo_branch"]="${repo[2]}" __mod_info["$rp_module_id/repo_commit"]="${repo[3]}" fi } function rp_registerModuleDir() { local dir="$1" [[ ! -d "$dir" ]] && return 1 local vendor="$2" [[ -z "$vendor" ]] && return 1 local module while read module; do rp_registerModule "$module" "$dir" "$vendor" done < <(find "$dir" -mindepth 1 -maxdepth 1 -type f -name "*.sh" | sort) return 0 } function rp_registerAllModules() { __mod_id=() declare -Ag __mod_idx=() declare -Ag __mod_info=() local dir local type local vendor while read dir; do # get parent folder vendor="${dir%/*}" # if the folder isn't RetroPie-Setup then get the repo name which will be used for module vendor if [[ "$vendor" != "$scriptdir" ]]; then vendor="${vendor##*/}" else vendor="RetroPie" fi for type in emulators libretrocores ports supplementary admin; do rp_registerModuleDir "$dir/$type" "$vendor" done done < <(find "$scriptdir"/scriptmodules "$scriptdir"/ext/*/scriptmodules -maxdepth 0 2>/dev/null) } function rp_getSectionIds() { local section local id local ids=() for id in "${__mod_id[@]}"; do for section in "$@"; do [[ "${__mod_info[$id/section]}" == "$section" ]] && ids+=("$id") done done echo "${ids[@]}" } function rp_isInstalled() { local id="$1" local md_inst="$rootdir/${__mod_info[$id/type]}/$id" [[ -d "$md_inst" ]] && return 0 return 1 } function rp_isEnabled() { local id="$1" [[ "${__mod_info[$id/enabled]}" -eq 0 ]] && return 1 return 0 } function rp_updateHooks() { local function local id for function in $(compgen -A function _update_hook_); do id="${function/_update_hook_/}" [[ -n "$id" && "${__mod_info[$id/enabled]}" -eq 1 ]] && rp_callModule "$id" _update_hook done } ================================================ FILE: scriptmodules/ports/alephone.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="alephone" rp_module_desc="AlephOne - Marathon Engine" rp_module_help="To get the games running on the Raspberry Pi/Odroid, make sure to set each game to use the software renderer and disable the enhanced HUD from the Plugins menu. For Marathon 1, disable both HUDs from the Plugins menu, start a game, quit back to the title screen and enable Enhanced HUD and it will work and properly." rp_module_licence="GPL3 https://raw.githubusercontent.com/Aleph-One-Marathon/alephone/master/COPYING" rp_module_repo="git https://github.com/Aleph-One-Marathon/alephone.git :_get_branch_alephone" rp_module_section="opt" rp_module_flags="!mali" function _get_version_alephone() { local version="20250829" # newer versions need libboost 1.69.0+ if [[ "$__os_debian_ver" -lt 11 ]]; then version="20250302" fi echo "$version" } function _get_branch_alephone() { echo "release-$(_get_version_alephone)" } function depends_alephone() { local depends=(libboost-all-dev libspeexdsp-dev libzzip-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev autoconf automake libboost-system-dev libcurl4-openssl-dev autoconf-archive libopenal-dev libsndfile1-dev libsdl2-dev libsdl2-net-dev libsdl2-image-dev libsdl2-ttf-dev libglu1-mesa-dev libgl1-mesa-dev libasio-dev) getDepends "${depends[@]}" } function sources_alephone() { gitPullOrClone } function build_alephone() { params=(--prefix="$md_inst") isPlatform "arm" && params+=(--with-boost-libdir=/usr/lib/arm-linux-gnueabihf) autoreconf -iv ./configure "${params[@]}" make clean make md_ret_require="$md_build/Source_Files/alephone" } function install_alephone() { make install } function game_data_alephone() { local version="$(_get_version_alephone)" local release_url="https://github.com/Aleph-One-Marathon/alephone/releases/download/release-$version" if [[ ! -f "$romdir/ports/$md_id/Marathon/Shapes.shps" ]]; then downloadAndExtract "$release_url/Marathon-$version-Data.zip" "$romdir/ports/$md_id" fi if [[ ! -f "$romdir/ports/$md_id/Marathon 2/Shapes.shpA" ]]; then downloadAndExtract "$release_url/Marathon2-$version-Data.zip" "$romdir/ports/$md_id" fi if [[ ! -f "$romdir/ports/$md_id/Marathon Infinity/Shapes.shpA" ]]; then downloadAndExtract "$release_url/MarathonInfinity-$version-Data.zip" "$romdir/ports/$md_id" fi chown -R "$__user":"$__group" "$romdir/ports/$md_id" } function configure_alephone() { addPort "$md_id" "alephone" "Aleph One Engine - Marathon" "$md_inst/bin/alephone %ROM%" "$romdir/ports/$md_id/Marathon/" addPort "$md_id" "alephone" "Aleph One Engine - Marathon 2" "$md_inst/bin/alephone %ROM%" "$romdir/ports/$md_id/Marathon 2/" addPort "$md_id" "alephone" "Aleph One Engine - Marathon Infinity" "$md_inst/bin/alephone %ROM%" "$romdir/ports/$md_id/Marathon Infinity/" mkRomDir "ports/$md_id" moveConfigDir "$home/.alephone" "$md_conf_root/alephone" [[ "$md_mode" == "install" ]] && game_data_alephone } ================================================ FILE: scriptmodules/ports/cannonball.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="cannonball" rp_module_desc="Cannonball - An Enhanced OutRun Engine" rp_module_help="You need to unzip your OutRun set B from latest MAME (outrun.zip) to $romdir/ports/cannonball. They should match the file names listed in the roms.txt file found in the roms folder. You will also need to rename the epr-10381a.132 file to epr-10381b.132 before it will work." rp_module_licence="NONCOM https://raw.githubusercontent.com/djyt/cannonball/master/docs/license.txt" rp_module_repo="git https://github.com/djyt/cannonball.git master 2b3839dd34c1b4263ec5006fdeeb1ae2689cd401" rp_module_section="opt" function depends_cannonball() { local depends=(cmake libsdl2-dev libboost-dev) isPlatform "dispmanx" && depends+=(libraspberrypi-dev) isPlatform "mesa" && depends+=(libgles2-mesa-dev) getDepends "${depends[@]}" } function sources_cannonball() { gitPullOrClone sed -i "s/-march=armv6 -mfpu=vfp -mfloat-abi=hard//" "$md_build/cmake/sdl2_rpi.cmake" "$md_build/cmake/sdl2gles_rpi.cmake" } function build_cannonball() { local target mkdir build cd build if isPlatform "videocore"; then target="sdl2gles_rpi" elif isPlatform "gles"; then target="sdl2gles" else target="sdl2gl" fi cmake -G "Unix Makefiles" -DTARGET=$target ../cmake/ make clean make md_ret_require="$md_build/build/cannonball" } function install_cannonball() { md_ret_files=( 'build/cannonball' 'roms/roms.txt' ) mkdir -p "$md_inst/res" cp -v res/*.bin "$md_inst/res/" cp -v res/config_sdl2.xml "$md_inst/config.xml.def" } function configure_cannonball() { addPort "$md_id" "cannonball" "Cannonball - OutRun Engine" "pushd $md_inst; $md_inst/cannonball; popd" mkRomDir "ports/$md_id" moveConfigFile "config.xml" "$md_conf_root/$md_id/config.xml" moveConfigFile "hiscores.xml" "$md_conf_root/$md_id/hiscores.xml" [[ "$md_mode" == "remove" ]] && return copyDefaultConfig "$md_inst/config.xml.def" "$md_conf_root/$md_id/config.xml" cp -v roms.txt "$romdir/ports/$md_id/" chown -R "$__user":"$__group" "$romdir/ports/$md_id" "$md_conf_root/$md_id" ln -snf "$romdir/ports/$md_id" "$md_inst/roms" } ================================================ FILE: scriptmodules/ports/cdogs-sdl.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="cdogs-sdl" rp_module_desc="C-Dogs SDL - Classic overhead run-and-gun game" rp_module_licence="GPL2 https://raw.githubusercontent.com/cxong/cdogs-sdl/master/COPYING" rp_module_repo="git https://github.com/cxong/cdogs-sdl.git 1.4.1" rp_module_section="exp" rp_module_flags="sdl2" function depends_cdogs-sdl() { getDepends cmake libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev } function sources_cdogs-sdl() { gitPullOrClone } function build_cdogs-sdl() { cmake . -DCMAKE_INSTALL_PREFIX="$md_inst" -DCDOGS_DATA_DIR="$md_inst/" make md_ret_require="$md_build/src/cdogs-sdl" } function install_cdogs-sdl() { md_ret_files=( 'data' 'dogfights' 'graphics' 'missions' 'music' 'sounds' 'COPYING' 'src/cdogs-sdl' 'src/cdogs-sdl-editor' ) } function configure_cdogs-sdl() { addPort "$md_id" "cdogs-sdl" "C-Dogs SDL" "pushd $md_inst; $md_inst/cdogs-sdl; popd" [[ "$md_mode" == "remove" ]] && return isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" moveConfigDir "$home/.config/cdogs-sdl" "$md_conf_root/cdogs-sdl" } ================================================ FILE: scriptmodules/ports/cgenius.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="cgenius" rp_module_desc="Commander Genius - Modern Interpreter for the Commander Keen Games (Vorticon and Galaxy Games)" rp_module_licence="GPL2 https://raw.githubusercontent.com/gerstrong/Commander-Genius/master/COPYRIGHT" rp_module_repo="git https://gitlab.com/Dringgstein/Commander-Genius.git v3.6.1" rp_module_section="opt" function depends_cgenius() { getDepends cmake libcurl4-openssl-dev libvorbis-dev libogg-dev libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev zlib1g-dev } function sources_cgenius() { gitPullOrClone } function build_cgenius() { # gcc8 mistakenly warns on certain conversion alignments, don't promote the warnings to errors sed -i 's/-Werror=cast-align//' src/CMakeLists.txt rm -fr build mkdir -p build && cd build cmake -DBUILD_COSMOS=1 -DNOTYPESAVE=on .. make md_ret_require="$md_build/build/src/CGeniusExe" } function install_cgenius() { md_ret_files=( 'vfsroot' 'build/src/CGeniusExe' ) } function configure_cgenius() { addPort "$md_id" "cgenius" "Commander Genius" "pushd $md_inst; ./CGeniusExe; popd" mkRomDir "ports/$md_id" moveConfigDir "$home/.CommanderGenius" "$md_conf_root/$md_id" [[ $md_mode == "remove" ]] && return # Create a minimal config file so the Commander can find the games local config="$(mktemp)" cat > "$config" << _INI_ [FileHandling] EnableLogfile = false SearchPath1 = \${HOME}/.CommanderGenius SearchPath2 = . SearchPath3 = $romdir/ports/$md_id _INI_ copyDefaultConfig "$config" "$md_conf_root/$md_id/cgenius.cfg" } ================================================ FILE: scriptmodules/ports/darkplaces-quake/01_rpi_fixes.diff ================================================ --- a/gl_textures.c +++ b/gl_textures.c @@ -14,6 +14,10 @@ extern LPDIRECT3DDEVICE9 vid_d3d9dev; #define GL_TEXTURE_3D 0x806F #endif +#define GL_RGBA32F 0x8814 +#define GL_RGBA16F 0x881A +#define GL_HALF_FLOAT_ARB 0x140B + cvar_t gl_max_size = {CVAR_SAVE, "gl_max_size", "2048", "maximum allowed texture size, can be used to reduce video memory usage, limited by hardware capabilities (typically 2048, 4096, or 8192)"}; cvar_t gl_max_lightmapsize = {CVAR_SAVE, "gl_max_lightmapsize", "1024", "maximum allowed texture size for lightmap textures, use larger values to improve rendering speed, as long as there is enough video memory available (setting it too high for the hardware will cause very bad performance)"}; cvar_t gl_picmip = {CVAR_SAVE, "gl_picmip", "0", "reduces resolution of textures by powers of 2, for example 1 will halve width/height, reducing texture memory usage by 75%"}; @@ -36,7 +40,7 @@ cvar_t gl_texturecompression_sky = {CVAR_SAVE, "gl_texturecompression_sky", "0", cvar_t gl_texturecompression_lightcubemaps = {CVAR_SAVE, "gl_texturecompression_lightcubemaps", "1", "whether to compress light cubemaps (spotlights and other light projection images)"}; cvar_t gl_texturecompression_reflectmask = {CVAR_SAVE, "gl_texturecompression_reflectmask", "1", "whether to compress reflection cubemap masks (mask of which areas of the texture should reflect the generic shiny cubemap)"}; cvar_t gl_texturecompression_sprites = {CVAR_SAVE, "gl_texturecompression_sprites", "1", "whether to compress sprites"}; -cvar_t gl_nopartialtextureupdates = {CVAR_SAVE, "gl_nopartialtextureupdates", "0", "use alternate path for dynamic lightmap updates that avoids a possibly slow code path in the driver"}; +cvar_t gl_nopartialtextureupdates = {CVAR_SAVE, "gl_nopartialtextureuopdates", "1", "use alternate path for dynamic lightmap updates that avoids a possibly slow code path in the driver"}; cvar_t r_texture_dds_load_alphamode = {0, "r_texture_dds_load_alphamode", "1", "0: trust DDPF_ALPHAPIXELS flag, 1: texture format and brute force search if ambiguous, 2: texture format only"}; cvar_t r_texture_dds_load_logfailure = {0, "r_texture_dds_load_logfailure", "0", "log missing DDS textures to ddstexturefailures.log, 0: done log, 1: log with no optional textures (_norm, glow etc.). 2: log all"}; cvar_t r_texture_dds_swdecode = {0, "r_texture_dds_swdecode", "0", "0: don't software decode DDS, 1: software decode DDS if unsupported, 2: always software decode DDS"}; ================================================ FILE: scriptmodules/ports/darkplaces-quake/02_makefile_fixes.diff ================================================ --- a/makefile.inc +++ b/makefile.inc @@ -436,8 +436,8 @@ bin-debug : $(MAKE) prepare BUILD_DIR=build-obj/debug/$(EXE) $(MAKE) -C build-obj/debug/$(EXE) $(EXE) \ DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \ - CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)'\ - LDFLAGS='$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)' LEVEL=2 + CFLAGS+='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)'\ + LDFLAGS+='$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)' LEVEL=2 bin-profile : $(CHECKLEVEL1) @@ -446,8 +446,8 @@ bin-profile : $(MAKE) prepare BUILD_DIR=build-obj/profile/$(EXE) $(MAKE) -C build-obj/profile/$(EXE) $(EXE) \ DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \ - CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)'\ - LDFLAGS='$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)' LEVEL=2 + CFLAGS+='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)'\ + LDFLAGS+='$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)' LEVEL=2 bin-release : $(CHECKLEVEL1) @@ -456,8 +456,8 @@ bin-release : $(MAKE) prepare BUILD_DIR=build-obj/release/$(EXE) $(MAKE) -C build-obj/release/$(EXE) $(EXE) \ DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \ - CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)'\ - LDFLAGS='$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)' LEVEL=2 + CFLAGS+='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)'\ + LDFLAGS+='$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)' LEVEL=2 $(STRIP) $(EXE) bin-release-profile : @@ -467,8 +467,8 @@ bin-release-profile : $(MAKE) prepare BUILD_DIR=build-obj/release-profile/$(EXE) $(MAKE) -C build-obj/release-profile/$(EXE) $(EXE) \ DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \ - CFLAGS='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE_PROFILE) $(OPTIM_RELEASE)'\ - LDFLAGS='$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)' LEVEL=2 + CFLAGS+='$(CFLAGS_COMMON) $(CFLAGS_FEATURES) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE_PROFILE) $(OPTIM_RELEASE)'\ + LDFLAGS+='$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)' LEVEL=2 $(STRIP) $(EXE) prepare : ================================================ FILE: scriptmodules/ports/darkplaces-quake.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="darkplaces-quake" rp_module_desc="Quake 1 engine - Darkplaces Quake port with GLES rendering" rp_module_licence="GPL2 https://raw.githubusercontent.com/xonotic/darkplaces/master/COPYING" rp_module_repo="git https://github.com/xonotic/darkplaces.git div0-stable" rp_module_section="opt" rp_module_flags="!mali" function depends_darkplaces-quake() { local depends=(libsdl2-dev libjpeg-dev) isPlatform "videocore" && depends+=(libraspberrypi-dev) isPlatform "mesa" && depends+=(libgles2-mesa-dev) getDepends "${depends[@]}" } function sources_darkplaces-quake() { gitPullOrClone isPlatform "rpi" && applyPatch "$md_data/01_rpi_fixes.diff" applyPatch "$md_data/02_makefile_fixes.diff" # comment out problematic invariant qualifier which fails to compile with mesa gles on rpi4 isPlatform "rpi4" && sed -i 's#^"invariant#"//invariant#' "$md_build/shader_glsl.h" } function build_darkplaces-quake() { local force_opengl="$1" # on the rpi4, we build gles first, and then force an opengl build (which is the default) [[ -z "$force_opengl" ]] && force_opengl=0 local params=(OPTIM_RELEASE="") if isPlatform "gles" && [[ "$force_opengl" -eq 0 ]]; then params+=(SDLCONFIG_UNIXCFLAGS_X11="-DUSE_GLES2") if isPlatform "videocore"; then params+=(SDLCONFIG_UNIXLIBS_X11="-L /opt/vc/lib -lbrcmGLESv2") else params+=(SDLCONFIG_UNIXLIBS_X11="-lGLESv2") fi fi make clean make sdl-release "${params[@]}" if isPlatform "rpi4" && [[ "$force_opengl" -eq 0 ]]; then mv "$md_build/darkplaces-sdl" "$md_build/darkplaces-sdl-gles" # revert rpi4 gles change which commented out invariant line from earlier. sed -i 's#^"//invariant#"invariant#' "$md_build/shader_glsl.h" # rebuild opengl version on rpi4 build_darkplaces-quake 1 md_ret_require+=("$md_build/darkplaces-sdl-gles") else md_ret_require+=("$md_build/darkplaces-sdl") fi } function install_darkplaces-quake() { md_ret_files=( 'darkplaces.txt' 'darkplaces-sdl' 'COPYING' ) isPlatform "rpi4" && md_ret_files+=("darkplaces-sdl-gles") } function add_games_darkplaces-quake() { local params=(-basedir "$romdir/ports/quake" -game %QUAKEDIR%) isPlatform "kms" && params+=("+vid_vsync 1") if isPlatform "rpi4"; then addEmulator 0 "$md_id-gles" "quake" "$md_inst/darkplaces-sdl-gles ${params[*]}" fi _add_games_lr-tyrquake "$md_inst/darkplaces-sdl ${params[*]}" } function configure_darkplaces-quake() { mkRomDir "ports/quake" [[ "$md_mode" == "install" ]] && game_data_lr-tyrquake add_games_darkplaces-quake moveConfigDir "$home/.darkplaces" "$md_conf_root/quake/darkplaces" } ================================================ FILE: scriptmodules/ports/dsda-doom.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="dsda-doom" rp_module_desc="DOOM source port based on PrBoom+, focused on speedrunning and QoL" rp_module_licence="GPL2 https://raw.githubusercontent.com/kraflab/dsda-doom/master/prboom2/COPYING" rp_module_repo="git https://github.com/kraflab/dsda-doom :_get_branch_dsda-doom" rp_module_section="exp" rp_module_flags="sdl2" function _get_branch_dsda-doom() { local branch="v0.29.4" if [[ "$__os_debian_ver" -lt 11 ]]; then branch="v0.29.3" fi echo "$branch" } function _check_fluidsynth_dsda-doom() { dpkg-query -W -f '${Version}' libfluidsynth1 2>/dev/null } function depends_dsda-doom() { local depends=(cmake libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libogg-dev libmad0-dev libvorbis-dev libzip-dev zlib1g-dev zipcmp zipmerge ziptool) # we need Fluidsynth 2+, check whether the platform has the older libfluidsynth1 [[ -z "$(_check_fluidsynth_dsda-doom)" ]] && depends+=(libfluidsynth-dev fluidsynth libsndfile1-dev) getDepends "${depends[@]}" } function sources_dsda-doom() { gitPullOrClone } function build_dsda-doom() { rm -rf release && mkdir -p release cd release local params=(-DCMAKE_INSTALL_PREFIX="$md_inst" -DCMAKE_BUILD_TYPE=Release -DWITH_PORTMIDI=OFF) # disable fluidsynth when the v1 is found [[ -n "$(_check_fluidsynth_dsda-doom)" ]] && params+=(-DWITH_FLUIDSYNTH=OFF) cmake "${params[@]}" ../prboom2 make md_ret_require="$md_build/release/dsda-doom" } function install_dsda-doom() { md_ret_files=( 'release/dsda-doom' 'release/dsda-doom.wad' 'README.md' 'docs' 'prboom2/COPYING' 'prboom2/AUTHORS' ) } function add_games_dsda-doom() { local params=("-fullscreen" "-width %XRES%" "-height %YRES%") local launcher_prefix="DOOMWADDIR=$romdir/ports/doom" _add_games_lr-prboom "$launcher_prefix $md_inst/$md_id -iwad %ROM% ${params[*]}" } function configure_dsda-doom() { mkRomDir "ports/doom" moveConfigDir "$home/.dsda-doom" "$md_conf_root/doom" [[ "$md_mode" == "remove" ]] && return game_data_lr-prboom add_games_${md_id} } ================================================ FILE: scriptmodules/ports/dxx-rebirth.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="dxx-rebirth" rp_module_desc="DXX-Rebirth (Descent & Descent 2) source port" rp_module_licence="NONCOM https://raw.githubusercontent.com/dxx-rebirth/dxx-rebirth/master/COPYING.txt" rp_module_repo="git https://github.com/dxx-rebirth/dxx-rebirth master :_get_commit_dxx-rebirth" rp_module_section="opt" rp_module_flags="!mali" function _get_commit_dxx-rebirth() { local commit="" # last version to build on gcc 10 [[ "$__gcc_version" -le 10 ]] && commit="ec41384d" # last version to build on Debian Buster due to pkg-config issue with physfs # newer versions also have incompatible scons changes [[ "$__os_debian_ver" -le 10 ]] && commit="15bd145d" # latest code requires gcc 7+ [[ "$__gcc_version" -lt 7 ]] && commit="a1b3a86c" echo "$commit" } function depends_dxx-rebirth() { local depends=(libpng-dev libphysfs-dev scons) if isPlatform "videocore"; then depends+=(libraspberrypi-dev libsdl1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev) else depends+=(libgl1-mesa-dev libglu1-mesa-dev libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev) fi getDepends "${depends[@]}" } function sources_dxx-rebirth() { gitPullOrClone } function _get_build_path_dxx-rebirth() { # later versions use a build subfolder [[ -d "$md_build/build" ]] && echo "build" } function build_dxx-rebirth() { local params=() isPlatform "arm" && params+=("words_need_alignment=1") if isPlatform "videocore"; then params+=("raspberrypi=1") elif isPlatform "mesa"; then # GLES is limited to ES 1 and blocks SDL2; GL works at fullspeed on Pi 3. params+=("raspberrypi=mesa" "opengl=1" "opengles=0" "sdl2=1") else params+=("opengl=1" "opengles=0" "sdl2=1") fi scons -c scons "${params[@]}" -j$__jobs local build_path="$md_build/$(_get_build_path_dxx-rebirth)" md_ret_require=( "$build_path/d1x-rebirth/d1x-rebirth" "$build_path/d2x-rebirth/d2x-rebirth" ) } function install_dxx-rebirth() { # Rename generic files mv -f "$md_build/d1x-rebirth/INSTALL.txt" "$md_build/d1x-rebirth/D1X-INSTALL.txt" mv -f "$md_build/d1x-rebirth/RELEASE-NOTES.txt" "$md_build/d1x-rebirth/D1X-RELEASE-NOTES.txt" mv -f "$md_build/d2x-rebirth/INSTALL.txt" "$md_build/d2x-rebirth/D2X-INSTALL.txt" mv -f "$md_build/d2x-rebirth/RELEASE-NOTES.txt" "$md_build/d2x-rebirth/D2X-RELEASE-NOTES.txt" local build_path="$(_get_build_path_dxx-rebirth)" md_ret_files=( 'COPYING.txt' 'GPL-3.txt' 'd1x-rebirth/README.RPi' "$build_path/d1x-rebirth/d1x-rebirth" 'd1x-rebirth/d1x.ini' 'd1x-rebirth/D1X-INSTALL.txt' 'd1x-rebirth/D1X-RELEASE-NOTES.txt' "$build_path/d2x-rebirth/d2x-rebirth" 'd2x-rebirth/d2x.ini' 'd2x-rebirth/D2X-INSTALL.txt' 'd2x-rebirth/D2X-RELEASE-NOTES.txt' ) } function game_data_dxx-rebirth() { local base_url="$__archive_url/descent" local D1X_SHARE_URL="$base_url/descent-pc-shareware.zip" local D2X_SHARE_URL="$base_url/descent2-pc-demo.zip" local D1X_HIGH_TEXTURE_URL="$base_url/d1xr-hires.dxa" local D1X_OGG_URL="$base_url/d1xr-sc55-music.dxa" local D2X_OGG_URL="$base_url/d2xr-sc55-music.dxa" local dest_d1="$romdir/ports/descent1" local dest_d2="$romdir/ports/descent2" mkUserDir "$dest_d1" mkUserDir "$dest_d2" # Download / unpack / install Descent shareware files if [[ -z "$(find "$dest_d1" -maxdepth 1 -iname descent.hog)" ]]; then downloadAndExtract "$D1X_SHARE_URL" "$dest_d1" fi # High Res Texture Pack if [[ ! -f "$dest_d1/d1xr-hires.dxa" ]]; then download "$D1X_HIGH_TEXTURE_URL" "$dest_d1" fi # Ogg Sound Replacement (Roland Sound Canvas SC-55 MIDI) if [[ ! -f "$dest_d1/d1xr-sc55-music.dxa" ]]; then download "$D1X_OGG_URL" "$dest_d1" fi # Download / unpack / install Descent 2 shareware files if [[ -z "$(find "$dest_d2" -maxdepth 1 \( -iname D2DEMO.HOG -o -iname DESCENT2.HOG \))" ]]; then downloadAndExtract "$D2X_SHARE_URL" "$dest_d2" fi # Ogg Sound Replacement (Roland Sound Canvas SC-55 MIDI) if [[ ! -f "$dest_d2/d2xr-sc55-music.dxa" ]]; then download "$D2X_OGG_URL" "$dest_d2" fi chown -R "$__user":"$__group" "$dest_d1" "$dest_d2" } function configure_dxx-rebirth() { local config local ver local name="Descent Rebirth" for ver in 1 2; do [[ "$ver" -eq 2 ]] && name="Descent 2 Rebirth" addPort "$md_id" "descent${ver}" "$name" "$md_inst/d${ver}x-rebirth -hogdir $romdir/ports/descent${ver}" # skip folder / config work on removal [[ "$md_mode" == "remove" ]] && continue mkRomDir "ports/descent${ver}" # copy any existing configs from ~/.d1x-rebirth and symlink the config folder to $md_conf_root/descent1/ moveConfigDir "$home/.d${ver}x-rebirth" "$md_conf_root/descent${ver}/" if isPlatform "kms"; then config="$md_conf_root/descent${ver}/descent.cfg" iniConfig "=" '' "$config" iniSet "VSync" "1" chown "$__user":"$__group" "$config" fi done [[ "$md_mode" == "install" ]] && game_data_dxx-rebirth } ================================================ FILE: scriptmodules/ports/eduke32/0001-revert-r6918.patch ================================================ Index: source/build/src/tilepacker.cpp =================================================================== --- a/source/build/src/tilepacker.cpp (revision 8090) +++ b/source/build/src/tilepacker.cpp (working copy) @@ -33,7 +33,6 @@ uint32_t rejectQueueHeadIndex = 0; uint32_t numRejected = 0; -#if 0 static void maxheap_bubbleUp(uint32_t nodeIndex) { while (true) @@ -57,7 +56,6 @@ nodeIndex = parentIndex; } } -#endif static void maxheap_bubbleDown(uint32_t nodeIndex) { @@ -90,14 +88,6 @@ } } -static void maxheap_buildHeap() -{ - for (int i = (heapNodes-2)/2; i >= 0; --i) - { - maxheap_bubbleDown(i); - } -} - static TreeNode* maxheap_pop() { if (heapNodes == 0) @@ -307,6 +297,7 @@ (TreeNode*) 0, {0, 0, tileWidth, tileHeight}, tileUID); + maxheap_bubbleUp(heapNodes-1); } char tilepacker_pack(uint32_t tilesheetID) @@ -325,8 +316,6 @@ rejectQueue_add(pNode); } } - - maxheap_buildHeap(); for (TreeNode *pNode = maxheap_pop(); pNode != NULL; pNode = maxheap_pop()) { char success = kdtree_add(tilesheetID, pNode); ================================================ FILE: scriptmodules/ports/eduke32/0002-fix-skybox.patch ================================================ Index: source/build/src/polymost.cpp =================================================================== --- a/source/build/src/polymost.cpp (revision 8090) +++ b/source/build/src/polymost.cpp (working copy) @@ -360,7 +360,7 @@ } gltexfiltermode = clamp(gltexfiltermode, 0, NUMGLFILTERMODES-1); - r_useindexedcolortextures = !gltexfiltermode; + //r_useindexedcolortextures = !gltexfiltermode; for (bssize_t i=0; i<=GLTEXCACHEADSIZ-1; i++) { @@ -5437,7 +5437,7 @@ else if ((nextsectnum < 0) || (!(sector[nextsectnum].floorstat&1))) { //Parallaxing sky... hacked for Ken's mountain texture - if ((usehightile && hicfindsubst(globalpicnum, globalpal, hictinting[globalpal].f & HICTINT_ALWAYSUSEART))) + if (!r_useindexedcolortextures || (usehightile && hicfindsubst(globalpicnum, globalpal, hictinting[globalpal].f & HICTINT_ALWAYSUSEART))) calc_and_apply_fog_factor(sec->floorshade, sec->visibility, sec->floorpal, 0.005f); globvis2 = globalpisibility; @@ -5831,7 +5831,7 @@ else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat&1))) { //Parallaxing sky... hacked for Ken's mountain texture - if ((usehightile && hicfindsubst(globalpicnum, globalpal, hictinting[globalpal].f & HICTINT_ALWAYSUSEART))) + if (!r_useindexedcolortextures || (usehightile && hicfindsubst(globalpicnum, globalpal, hictinting[globalpal].f & HICTINT_ALWAYSUSEART))) calc_and_apply_fog_factor(sec->ceilingshade, sec->visibility, sec->ceilingpal, 0.005f); globvis2 = globalpisibility; ================================================ FILE: scriptmodules/ports/eduke32/0003-replace-gl_red.patch ================================================ Index: source/build/src/glsurface.cpp =================================================================== --- a/source/build/src/glsurface.cpp (revision 8090) +++ b/source/build/src/glsurface.cpp (working copy) @@ -94,7 +94,7 @@ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, bufferRes.x, bufferRes.y, 0, GL_RED, GL_UNSIGNED_BYTE, 0); + glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, bufferRes.x, bufferRes.y, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, 0); glsurface_setPalette(curpalettefaded); @@ -227,7 +227,7 @@ return; glActiveTexture(GL_TEXTURE0); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bufferRes.x, bufferRes.y, GL_RED, GL_UNSIGNED_BYTE, (void*) buffer); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bufferRes.x, bufferRes.y, GL_LUMINANCE, GL_UNSIGNED_BYTE, (void*) buffer); glDrawArrays(GL_TRIANGLE_STRIP, 0, Index: source/build/src/polymost.cpp =================================================================== --- a/source/build/src/polymost.cpp (revision 8090) +++ b/source/build/src/polymost.cpp (working copy) @@ -1874,11 +1874,11 @@ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, siz.y, siz.x, 0, GL_RED, GL_UNSIGNED_BYTE, (void*) tile); + glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, siz.y, siz.x, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, (void*) tile); } else { - glTexSubImage2D(GL_TEXTURE_2D, 0, offset.x, offset.y, siz.y, siz.x, GL_RED, GL_UNSIGNED_BYTE, (void*) tile); + glTexSubImage2D(GL_TEXTURE_2D, 0, offset.x, offset.y, siz.y, siz.x, GL_LUMINANCE, GL_UNSIGNED_BYTE, (void*) tile); } } @@ -1954,7 +1954,7 @@ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, PALSWAP_TEXTURE_SIZE, PALSWAP_TEXTURE_SIZE, 0, GL_RED, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, PALSWAP_TEXTURE_SIZE, PALSWAP_TEXTURE_SIZE, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, NULL); } int32_t column = palookupnum%(PALSWAP_TEXTURE_SIZE/256); @@ -1965,7 +1965,7 @@ OSD_Printf("Polymost: palswaps are too large for palswap tilesheet!\n"); return; } - glTexSubImage2D(GL_TEXTURE_2D, 0, 256*column, rowOffset, 256, numshades+1, GL_RED, GL_UNSIGNED_BYTE, palookup[palookupnum]); + glTexSubImage2D(GL_TEXTURE_2D, 0, 256*column, rowOffset, 256, numshades+1, GL_LUMINANCE, GL_UNSIGNED_BYTE, palookup[palookupnum]); } Index: source/build/src/voxmodel.cpp =================================================================== --- a/source/build/src/voxmodel.cpp (revision 8090) +++ b/source/build/src/voxmodel.cpp (working copy) @@ -60,7 +60,7 @@ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, ysiz, xsiz, 0, GL_RED, GL_UNSIGNED_BYTE, (char *) pic2); + glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, ysiz, xsiz, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, (char *) pic2); Xfree(pic2); ================================================ FILE: scriptmodules/ports/eduke32/0004-recast-function.patch ================================================ Index: source/duke3d/src/astub.cpp =================================================================== --- a/source/duke3d/src/astub.cpp (revision 8090) +++ b/source/duke3d/src/astub.cpp (working copy) @@ -4291,7 +4291,7 @@ i = (i&0x4)+((i>>4)&3); i = eitherSHIFT ? prev3[i] : next3[i]; message("Sector %d %s flip %d deg%s", sectnum, typestr[search], - klabs(orient[i])%360, orient[i] < 0 ? " mirrored":""); + (int)klabs(orient[i])%360, orient[i] < 0 ? " mirrored":""); i = (i&0x4)+((i&3)<<4); *stat &= ~0x34; *stat |= i; Index: source/duke3d/src/player.cpp =================================================================== --- a/source/duke3d/src/player.cpp (revision 8090) +++ b/source/duke3d/src/player.cpp (working copy) @@ -1666,7 +1666,7 @@ for (bssize_t i=0; i < pPlayer->numloogs; i++) { - int const rotAng = klabs(sintable[((loogCounter + i) << 5) & 2047]) >> 5; + int const rotAng = (int)klabs(sintable[((loogCounter + i) << 5) & 2047]) >> 5; int const rotZoom = 4096 + ((loogCounter + i) << 9); int const rotX = (-fix16_to_int(g_player[screenpeek].input->q16avel) >> 1) + (sintable[((loogCounter + i) << 6) & 2047] >> 10); ================================================ FILE: scriptmodules/ports/eduke32/0005-e1m4-shrinker-bug.patch ================================================ diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index 9a4405b2b..21f2570a4 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -507,25 +507,16 @@ int32_t A_MoveSpriteClipdist(int32_t spriteNum, vec3_t const * const change, uin int returnValue; int32_t diffZ; - spriteheightofs(spriteNum, &diffZ, 0); - int newZ = pSprite->z - diffZ; + spriteheightofs(spriteNum, &diffZ, 1); - pSprite->z -= diffZ >> 1; - switch (pSprite->statnum) + if (pSprite->statnum == STAT_PROJECTILE) + returnValue = clipmovex(&pSprite->pos, &newSectnum, change->x << 13, change->y << 13, clipDist, diffZ >> 3, diffZ >> 3, clipType, 1); + else { - default: - { - returnValue = clipmove(&pSprite->pos, &newSectnum, change->x << 13, change->y << 13, clipDist, ZOFFSET6, ZOFFSET6, clipType); - break; - } - - case STAT_PROJECTILE: - { - returnValue = clipmovex(&pSprite->pos, &newSectnum, change->x << 13, change->y << 13, clipDist, diffZ >> 1, diffZ >> 1, clipType, 1); - break; - } + pSprite->z -= diffZ >> 1; + returnValue = clipmove(&pSprite->pos, &newSectnum, change->x << 13, change->y << 13, clipDist, ZOFFSET6, ZOFFSET6, clipType); + pSprite->z += diffZ >> 1; } - pSprite->z += diffZ >> 1; // Testing: For some reason the assert below this was tripping for clients EDUKE32_UNUSED int16_t dbg_ClipMoveSectnum = newSectnum; @@ -573,6 +564,7 @@ int32_t A_MoveSpriteClipdist(int32_t spriteNum, vec3_t const * const change, uin Bassert(newSectnum == pSprite->sectnum); + int newZ = pSprite->z; int32_t ceilhit, florhit; int const doZUpdate = change->z ? A_CheckNeedZUpdate(spriteNum, change->z, &newZ, &ceilhit, &florhit) : 0; ================================================ FILE: scriptmodules/ports/eduke32/0006-e4m4-water-bug.patch ================================================ diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index 24eb02368..1a7b57bb5 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -945,14 +945,22 @@ static int get_floorspr_clipyou(vec2_t const v1, vec2_t const v2, vec2_t const v return clipyou; } -static void clipupdatesector(vec2_t const pos, int16_t * const sectnum, int const walldist) +static void clipupdatesector(vec2_t const pos, int16_t * const sectnum, int walldist) { if (inside_p(pos.x, pos.y, *sectnum)) return; + int16_t nsecs = min(getsectordist(pos, *sectnum), INT16_MAX); + + if (nsecs > (walldist + 8)) + { + OSD_Printf("%s():%d shortest distance between origin point (%d, %d) and sector %d is %d. Sector may be corrupt!\n", + EDUKE32_FUNCTION, __LINE__, pos.x, pos.y, *sectnum, nsecs); + walldist = 0x7fff; + } + static int16_t sectlist[MAXSECTORS]; static uint8_t sectbitmap[(MAXSECTORS+7)>>3]; - int16_t nsecs; bfirst_search_init(sectlist, sectbitmap, &nsecs, MAXSECTORS, *sectnum); ================================================ FILE: scriptmodules/ports/eduke32.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="eduke32" rp_module_desc="Duke3D source port" rp_module_licence="GPL2 https://voidpoint.io/terminx/eduke32/-/raw/master/package/common/gpl-2.0.txt?inline=false" rp_module_repo="git https://voidpoint.io/terminx/eduke32.git master dfc16b08" rp_module_section="opt" function depends_eduke32() { local depends=( flac libflac-dev libvorbis-dev libpng-dev libvpx-dev freepats libsdl2-dev libsdl2-mixer-dev ) isPlatform "x86" && depends+=(nasm) isPlatform "gl" || isPlatform "mesa" && depends+=(libgl1-mesa-dev libglu1-mesa-dev) isPlatform "x11" && depends+=(libgtk2.0-dev) getDepends "${depends[@]}" } function sources_eduke32() { gitPullOrClone # r6918 causes a 20+ second delay on startup on ARM devices isPlatform "arm" && applyPatch "$md_data/0001-revert-r6918.patch" # r7424 gives a black skybox when r_useindexedcolortextures is 0 applyPatch "$md_data/0002-fix-skybox.patch" # r6776 breaks VC4 & GLES 2.0 devices that lack GL_RED internal # format support for glTexImage2D/glTexSubImage2D isPlatform "gles" && applyPatch "$md_data/0003-replace-gl_red.patch" # gcc 6.3.x compiler fix applyPatch "$md_data/0004-recast-function.patch" # cherry-picked commit fixing a game bug in E1M4 (shrinker ray stuck) applyPatch "$md_data/0005-e1m4-shrinker-bug.patch" # two more commits r8241 + r8247 fixing a bug in E4M4 (instant death in water) applyPatch "$md_data/0006-e4m4-water-bug.patch" } function build_eduke32() { local params=(LTO=0 SDL_TARGET=2) [[ "$md_id" == "ionfury" ]] && params+=(FURY=1) ! isPlatform "x86" && params+=(NOASM=1) ! isPlatform "x11" && params+=(HAVE_GTK2=0) ! isPlatform "gl3" && params+=(POLYMER=0) ! ( isPlatform "gl" || isPlatform "mesa" ) && params+=(USE_OPENGL=0) # r7242 requires >1GB memory allocation due to netcode changes. isPlatform "arm" && params+=(NETCODE=0) make veryclean CFLAGS+=" -DSDL_USEFOLDER" make "${params[@]}" if [[ "$md_id" == "ionfury" ]]; then md_ret_require="$md_build/fury" else md_ret_require="$md_build/eduke32" fi } function install_eduke32() { md_ret_files=('mapster32') if [[ "$md_id" == "ionfury" ]]; then md_ret_files+=('fury') else md_ret_files+=('eduke32') fi } function game_data_eduke32() { local dest="$romdir/ports/duke3d" if [[ "$md_id" == "eduke32" ]]; then mkUserDir "$dest" if [[ -z "$(find "$dest" -maxdepth 1 -iname duke3d.grp)" ]]; then local temp="$(mktemp -d)" download "$__archive_url/3dduke13.zip" "$temp" unzip -L -o "$temp/3dduke13.zip" -d "$temp" dn3dsw13.shr unzip -L -o "$temp/dn3dsw13.shr" -d "$dest" duke3d.grp duke.rts rm -rf "$temp" chown -R "$__user":"$__group" "$dest" fi fi } function configure_eduke32() { local appname="eduke32" local portname="duke3d" if [[ "$md_id" == "ionfury" ]]; then appname="fury" portname="ionfury" fi local config="$md_conf_root/$portname/settings.cfg" mkRomDir "ports/$portname" moveConfigDir "$home/.config/$appname" "$md_conf_root/$portname" add_games_eduke32 "$portname" "$md_inst/$appname" # remove old launch script rm -f "$romdir/ports/Duke3D Shareware.sh" if [[ "$md_mode" == "install" ]]; then game_data_eduke32 touch "$config" iniConfig " " '"' "$config" # enforce vsync for kms targets isPlatform "kms" && iniSet "r_swapinterval" "1" # the VC4 & V3D drivers render menu splash colours incorrectly without this isPlatform "mesa" && iniSet "r_useindexedcolortextures" "0" chown -R "$__user":"$__group" "$config" fi } function add_games_eduke32() { local portname="$1" local binary="$2" local game local game_args local game_path local game_launcher local num_games=4 if [[ "$md_id" == "ionfury" ]]; then num_games=0 local game0=('Ion Fury' '' '') else local game0=('Duke Nukem 3D' '' '-addon 0') local game1=('Duke Nukem 3D - Duke It Out In DC' 'addons/dc' '-addon 1') local game2=('Duke Nukem 3D - Nuclear Winter' 'addons/nw' '-addon 2') local game3=('Duke Nukem 3D - Caribbean - Lifes A Beach' 'addons/vacation' '-addon 3') local game4=('NAM' 'addons/nam' '-nam') fi for ((game=0;game<=num_games;game++)); do game_launcher="game$game[0]" game_path="game$game[1]" game_args="game$game[2]" if [[ -d "$romdir/ports/$portname/${!game_path}" ]]; then addPort "$md_id" "$portname" "${!game_launcher}" "pushd $md_conf_root/$portname; ${binary}.sh %ROM%; popd" "-j$romdir/ports/$portname/${game0[1]} -j$romdir/ports/$portname/${!game_path} ${!game_args}" fi done if [[ "$md_mode" == "install" ]]; then # we need to use a dumb launcher script to strip quotes from runcommand's generated arguments cat > "${binary}.sh" << _EOF_ #!/bin/bash # HACK: force vsync for RPI Mesa driver for now VC4_DEBUG=always_sync $binary \$* _EOF_ chmod +x "${binary}.sh" fi } ================================================ FILE: scriptmodules/ports/gemrb.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="gemrb" rp_module_desc="gemrb - open-source implementation of Infinity Engine" rp_module_licence="GPL2 https://raw.githubusercontent.com/gemrb/gemrb/master/COPYING" rp_module_repo="git https://github.com/gemrb/gemrb.git v0.8.6" rp_module_section="exp" rp_module_flags="!mali dispmanx" function depends_gemrb() { getDepends python2-dev libopenal-dev cmake libpng-dev libfreetype6-dev libsdl2-dev libvorbis-dev libvlc-dev libvlccore-dev } function sources_gemrb() { gitPullOrClone } function build_gemrb() { mkdir -p build cd build make clean cmake .. -DCMAKE_INSTALL_PREFIX="$md_inst" -DCMAKE_BUILD_TYPE=Release -DFREETYPE_INCLUDE_DIRS=/usr/include/freetype2/ -DSDL_BACKEND=SDL2 -DUSE_SDLMIXER=OFF make md_ret_require="$md_build/build/gemrb/gemrb" } function install_gemrb() { cd build make install } function configure_gemrb() { mkRomDir "ports/baldurs1" mkRomDir "ports/baldurs2" mkRomDir "ports/icewind1" mkRomDir "ports/icewind2" mkRomDir "ports/planescape" mkRomDir "ports/cache" addPort "$md_id" "baldursgate1" "Baldurs Gate 1" "$md_inst/bin/gemrb -C $md_conf_root/baldursgate1/GemRB.cfg" addPort "$md_id" "baldursgate2" "Baldurs Gate 2" "$md_inst/bin/gemrb -C $md_conf_root/baldursgate2/GemRB.cfg" addPort "$md_id" "icewind1" "Icewind Dale 1" "$md_inst/bin/gemrb -C $md_conf_root/icewind1/GemRB.cfg" addPort "$md_id" "icewind2" "Icewind Dale 2" "$md_inst/bin/gemrb -C $md_conf_root/icewind2/GemRB.cfg" addPort "$md_id" "planescape" "Planescape Torment" "$md_inst/bin/gemrb -C $md_conf_root/planescape/GemRB.cfg" #create Baldurs Gate 1 configuration cat > "$md_conf_root/baldursgate1/GemRB.cfg" << _EOF_ GameType=bg1 GameName=Baldurs Gate 1 Width=640 Height=480 Bpp=32 Fullscreen=0 TooltipDelay=500 AudioDriver = openal GUIEnhancements = 15 DrawFPS=0 CaseSensitive=1 GamePath=$romdir/ports/baldurs1/ CD1=$romdir/ports/baldurs1/ CachePath=$romdir/ports/cache/ _EOF_ #create Baldurs Gate 2 configuration cat > "$md_conf_root/baldursgate2/GemRB.cfg" << _EOF_ GameType=bg2 GameName=Baldurs Gate 2 Width=640 Height=480 Bpp=32 Fullscreen=0 TooltipDelay=500 AudioDriver = openal GUIEnhancements = 15 DrawFPS=0 CaseSensitive=1 GamePath=$romdir/ports/baldurs2/ CD1=$romdir/ports/baldurs2/data/ CachePath=$romdir/ports/cache/ _EOF_ #create Icewind 1 configuration cat > "$md_conf_root/icewind1/GemRB.cfg" << _EOF_ GameType=auto GameName=Icewind Dale 1 Width=640 Height=480 Bpp=32 Fullscreen=0 TooltipDelay=500 AudioDriver = openal GUIEnhancements = 15 DrawFPS=0 CaseSensitive=1 GamePath=$romdir/ports/icewind1/ CD1=$romdir/ports/icewind1/Data/ CD2=$romdir/ports/icewind1/CD2/Data/ CD3=$romdir/ports/icewind1/CD3/Data/ CachePath=$romdir/ports/cache/ _EOF_ #create Icewind2 configuration cat > "$md_conf_root/icewind2/GemRB.cfg" << _EOF_ GameType=iwd2 GameName=Icewind Dale 2 Width=800 Height=600 Bpp=32 Fullscreen=0 TooltipDelay=500 AudioDriver = openal GUIEnhancements = 15 DrawFPS=0 CaseSensitive=1 GamePath=$romdir/ports/icewind2/ CD1=$romdir/ports/icewind2/data/ CachePath=$romdir/ports/cache/ _EOF_ #create Planescape configuration cat > "$md_conf_root/planescape/GemRB.cfg" << _EOF_ GameType=pst GameName=Planescape Torment Width=640 Height=480 Bpp=32 Fullscreen=0 TooltipDelay=500 AudioDriver = openal GUIEnhancements = 15 DrawFPS=0 CaseSensitive=1 GamePath=$romdir/ports/planescape/ CD1=$romdir/ports/planescape/data/ CachePath=$romdir/ports/cache/ _EOF_ chown "$__user":"$__group" "$md_conf_root/baldursgate1/GemRB.cfg" chown "$__user":"$__group" "$md_conf_root/baldursgate2/GemRB.cfg" chown "$__user":"$__group" "$md_conf_root/icewind1/GemRB.cfg" chown "$__user":"$__group" "$md_conf_root/icewind2/GemRB.cfg" chown "$__user":"$__group" "$md_conf_root/planescape/GemRB.cfg" } ================================================ FILE: scriptmodules/ports/giana.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="giana" rp_module_desc="Giana's Return" rp_module_licence="NONCOM https://www.gianas-return.de/?page_id=6" rp_module_section="opt" rp_module_flags="!all videocore" function depends_giana() { getDepends libsdl1.2-dev libsdl-mixer1.2-dev libraspberrypi-dev } function install_bin_giana() { downloadAndExtract "http://www.retroguru.com/gianas-return/gianas-return-v.latest-raspberrypi.zip" "$md_inst" patchVendorGraphics "$md_inst/giana_rpi" } function configure_giana() { moveConfigDir "$home/.giana" "$md_conf_root/giana" addPort "$md_id" "giana" "Giana's Return" "pushd $md_inst; $md_inst/giana_rpi; popd" chmod +x "$md_inst/giana_rpi" } ================================================ FILE: scriptmodules/ports/gzdoom/armv8_gcc12_fix.diff ================================================ Fails to build with gcc 12 for armv8 on aarch64 kernel due to -ffast-math options. Enabling -fmath-errno resolves it. Fixes: /usr/lib/gcc/arm-linux-gnueabihf/12/include/arm_neon.h: In function ‘float16x8_t vmulq_n_f16(float16x8_t, float16_t)’: /usr/lib/gcc/arm-linux-gnueabihf/12/include/arm_neon.h:17784:14: error: conversion of scalar ‘float’ to vector ‘float16x8_t’ involves truncation 17784 | return __a * __b; | ~~~~^~~~~ make[2]: *** [src/CMakeFiles/zdoom.dir/build.make:685: src/CMakeFiles/zdoom.dir/common/rendering/gles/gles_renderer.cpp.o] Error 1 diff --git a/CMakeLists.txt b/CMakeLists.txt index c6ba69a..b4ef587 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -158,7 +158,7 @@ endif() # Fast math flags, required by some subprojects set( ZD_FASTMATH_FLAG "" ) if( DEM_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) - set( ZD_FASTMATH_FLAG "-ffast-math -ffp-contract=fast" ) + set( ZD_FASTMATH_FLAG "-ffast-math -ffp-contract=fast -fmath-errno" ) elseif( MSVC ) set( ZD_FASTMATH_FLAG "/fp:fast" ) endif() ================================================ FILE: scriptmodules/ports/gzdoom/lzma_armv7_crc.diff ================================================ --- a/libraries/lzma/C/7zCrc.c +++ b/libraries/lzma/C/7zCrc.c @@ -71,7 +71,7 @@ #ifdef MY_CPU_LE -#if defined(MY_CPU_ARM_OR_ARM64) +#if defined(MY_CPU_ARM_OR_ARM64) && 0 // #pragma message("ARM*") ================================================ FILE: scriptmodules/ports/gzdoom.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="gzdoom" rp_module_desc="GZDoom is a feature centric port for all Doom engine games, based on ZDoom" rp_module_licence="GPL3 https://raw.githubusercontent.com/ZDoom/gzdoom/master/LICENSE" rp_module_repo="git https://github.com/ZDoom/gzdoom :_get_version_gzdoom" rp_module_section="opt" rp_module_flags="sdl2 !armv6" function _get_version_gzdoom() { # default GZDoom version local gzdoom_version="g4.14.2" # 32 bit is no longer supported since g4.8.1 isPlatform "32bit" && gzdoom_version="g4.8.0" echo $gzdoom_version } function _get_version_zmusic_gzdoom() { echo "1.3.0" } function depends_gzdoom() { local depends=( cmake libfluidsynth-dev libsdl2-dev libmpg123-dev libsndfile1-dev libbz2-dev libopenal-dev libjpeg-dev libgl1-mesa-dev libasound2-dev libmpg123-dev libsndfile1-dev libvpx-dev libwebp-dev pkg-config zlib1g-dev) getDepends "${depends[@]}" } function sources_gzdoom() { gitPullOrClone # add 'ZMusic' repo cd "$md_build" gitPullOrClone zmusic https://github.com/ZDoom/ZMusic $(_get_version_zmusic_gzdoom) # workaround for Ubuntu 20.04 older vpx/wepm dev libraries sed -i 's/IMPORTED_TARGET libw/IMPORTED_TARGET GLOBAL libw/' CMakeLists.txt # lzma assumes hardware crc support on arm which breaks when building on armv7 isPlatform "armv7" && applyPatch "$md_data/lzma_armv7_crc.diff" # fix build with gcc 12 for armv8 on aarch64 kernel due to -ffast-math options isPlatform "armv8" && [[ "$__gcc_version" -eq 12 ]] && applyPatch "$md_data/armv8_gcc12_fix.diff" } function build_gzdoom() { mkdir -p release # build 'ZMusic' first pushd zmusic cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$md_build/release/zmusic" . make make install popd cd release local params=(-DCMAKE_INSTALL_PREFIX="$md_inst" -DPK3_QUIET_ZIPDIR=ON -DCMAKE_BUILD_TYPE=Release -DDYN_OPENAL=ON -DCMAKE_PREFIX_PATH="$md_build/release/zmusic") ! hasFlag "vulkan" && params+=(-DHAVE_VULKAN=OFF) cmake "${params[@]}" .. make md_ret_require="$md_build/release/$md_id" } function install_gzdoom() { md_ret_files=( 'release/brightmaps.pk3' 'release/gzdoom' 'release/gzdoom.pk3' 'release/lights.pk3' 'release/game_support.pk3' 'release/game_widescreen_gfx.pk3' 'release/soundfonts' "release/zmusic/lib/libzmusic.so.1" "release/zmusic/lib/libzmusic.so.$(_get_version_zmusic_gzdoom)" 'README.md' ) } function add_games_gzdoom() { local params=("-fullscreen") local launcher_prefix="DOOMWADDIR=$romdir/ports/doom" # FluidSynth is too memory/CPU intensive, use OPL emulation for MIDI if isPlatform "arm"; then params+=("+set snd_mididevice -3") fi # when using the 32bit version on GLES platforms, pre-set the renderer if isPlatform "32bit" && hasFlag "gles"; then params+=("+set vid_preferbackend 2") fi if isPlatform "kms"; then params+=("-width %XRES%" "-height %YRES%") fi _add_games_lr-prboom "$launcher_prefix $md_inst/$md_id -iwad %ROM% ${params[*]}" } function configure_gzdoom() { mkRomDir "ports/doom" moveConfigDir "$home/.config/$md_id" "$md_conf_root/doom" [[ "$md_mode" == "remove" ]] && return game_data_lr-prboom add_games_${md_id} } ================================================ FILE: scriptmodules/ports/ionfury.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="ionfury" rp_module_desc="Ion Fury - commercial FPS game based on eduke32 source port" rp_module_licence="GPL2 https://voidpoint.io/terminx/eduke32/-/raw/master/package/common/gpl-2.0.txt?inline=false" rp_module_repo="git https://voidpoint.io/terminx/eduke32.git master dfc16b08" rp_module_section="exp" function depends_ionfury() { depends_eduke32 } function sources_ionfury() { # patches are also shared with eduke32, so avoid duplication md_data="$(dirname $md_data)/eduke32" sources_eduke32 } function build_ionfury() { build_eduke32 } function install_ionfury() { install_eduke32 } function configure_ionfury() { configure_eduke32 } ================================================ FILE: scriptmodules/ports/ioquake3.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="ioquake3" rp_module_desc="Quake 3 source port" rp_module_licence="GPL2 https://github.com/ioquake/ioq3/blob/master/COPYING.txt" rp_module_repo="git https://github.com/ioquake/ioq3 main :_get_commit_ioquake3" rp_module_section="opt" rp_module_flags="!videocore" function _get_commit_ioquake3() { # On Buster and Bullseye we have to build using make (an old method) instead of cmake. # This is because ioquake3 requires CMake 3.25 or higher which is satisfied only on Bookworm. if [[ "$__os_debian_ver" -lt 12 ]]; then # This is the latest commit before the Makefile was removed. echo 7ac92951f2da597611ab4525023979df2f92047a fi } function depends_ioquake3() { getDepends cmake libsdl2-dev libgl1-mesa-dev } function sources_ioquake3() { gitPullOrClone } function build_ioquake3() { if [[ "$__os_debian_ver" -lt 12 ]]; then make clean I_ACKNOWLEDGE_THE_MAKEFILE_IS_DEPRECATED=1 make else cmake -S . -B build -DCMAKE_BUILD_TYPE=Release cmake --build build --clean-first fi md_ret_require="$md_build/$(_release_dir)/ioquake3" } function _release_dir() { if [[ "$__os_debian_ver" -lt 12 ]]; then # exact parsing from Makefile local arch_ioquake3="$(uname -m | sed -e 's/i.86/x86/' | sed -e 's/^arm.*/arm/' | sed -e 's/aarch64/arm64/')" echo "build/release-linux-${arch_ioquake3}" else echo "build/Release" fi } function install_ioquake3() { md_ret_files=( "$(_release_dir)/ioq3ded" "$(_release_dir)/ioquake3" "$(_release_dir)/renderer_opengl1.so" "$(_release_dir)/renderer_opengl2.so" ) } function configure_ioquake3() { local launcher=("$md_inst/ioquake3") isPlatform "mesa" && launcher+=("+set cl_renderer opengl1") isPlatform "kms" && launcher+=("+set r_mode -1" "+set r_customwidth %XRES%" "+set r_customheight %YRES%" "+set r_swapInterval 1") addPort "$md_id" "quake3" "Quake III Arena" "${launcher[*]}" mkRomDir "ports/quake3" moveConfigDir "$md_inst/baseq3" "$romdir/ports/quake3" moveConfigDir "$home/.q3a" "$md_conf_root/ioquake3" [[ "$md_mode" == "install" ]] && game_data_quake3 } ================================================ FILE: scriptmodules/ports/jumpnbump/jumpnbump.sh ================================================ #!/usr/bin/env bash ROOTDIR="" MD_CONF_ROOT="" ROMDIR="" MD_INST="" DIALOG=(dialog --backtitle "RetroPie Jump n' Bump Launcher") # source ini functions from RetroPie source "$ROOTDIR/lib/inifuncs.sh" # init program args function init_args() { args=(-fullscreen) iniConfig " = " "" "$MD_CONF_ROOT/jumpnbump/options.cfg" iniGet "nogore" && [[ "$ini_value" -eq 1 ]] && args+=(-nogore) iniGet "noflies" && [[ "$ini_value" -eq 1 ]] && args+=(-noflies) iniGet "scaleup" && [[ "$ini_value" -eq 1 ]] && args+=(-scaleup) iniGet "musicnosound" && [[ "$ini_value" -eq 1 ]] && args+=(-musicnosound) return 0 } # main menu function main_menu() { local cmd local options local choice while true; do cmd=("${DIALOG[@]}" --menu "Main Menu" 0 0 0) options=( L "Local Game Mode" S "Net: Start Server" C "Net: Connect to Server" H "Net: Help" ) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) || return case "$choice" in L) init_args && select_level_menu && return ;; S) init_args && start_server_menu && select_level_menu && return ;; C) init_args && connect_server_menu && select_level_menu && return ;; H) netplay_help ;; esac done } # select level menu function select_level_menu() { local cmd=("${DIALOG[@]}" --ok-label "Start" --extra-button --extra-label "Start Mirror" --menu "Select Level" 16 0 16) local levels=(D "(default level)") local idx=1 local choice local ret for file in "$ROMDIR"/ports/jumpnbump/*.dat; do levels+=("$idx" "${file##*/}") ((idx++)) done choice=$("${cmd[@]}" "${levels[@]}" 2>&1 >/dev/tty) ret=$? [[ "$ret" -eq 1 ]] && return 1 [[ "$ret" -eq 3 ]] && args+=(-mirror) [[ "$choice" == "D" ]] && return args+=(-dat "$ROMDIR/ports/jumpnbump/${levels[$((choice * 2 + 1))]}") } # start server menu function start_server_menu() { local cmd=("${DIALOG[@]}" --menu "Number of players" 0 0 0) local options=( 1 "One Remote + One Local" 2 "Two Remotes + One Local" 3 "Three Remotes + One Local" ) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) || return args+=(-server "$choice") } # connect to server menu function connect_server_menu() { local cmd=("${DIALOG[@]}" --inputbox "Please enter the address of the remote server" 10 35) choice=$("${cmd[@]}" 2>&1 >/dev/tty) || return args+=(-connect "$choice") } # netplay help function netplay_help() { local help read -r -d "" help <<"_EOF_" 1. On the server device, select "Start Server" and choose the number of additional players (1-3) to wait for. 2. On each remote player device, select "Connect to Server" and enter the IP address of the server. 3. All players (server and clients) must select the same level and mirror settings. _EOF_ "${DIALOG[@]}" --title "Net Help" --msgbox "$help" 16 50 2>&1 >/dev/tty } # start main menu main_menu || exit "$MD_INST"/bin/jumpnbump "${args[@]}" "$@" ================================================ FILE: scriptmodules/ports/jumpnbump.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="jumpnbump" rp_module_desc="Jump 'n Bump, play cute bunnies jumping on each other's heads - Modernization fork" rp_module_help="Copy custom game levels (.dat) to $romdir/ports/jumpnbump" rp_module_licence="GPL2 https://gitlab.com/LibreGames/jumpnbump/raw/master/COPYING" rp_module_repo="git https://gitlab.com/LibreGames/jumpnbump.git master" rp_module_section="exp" rp_module_flags="" function depends_jumpnbump() { getDepends libsdl2-dev libsdl2-net-dev libsdl2-mixer-dev libbz2-dev zlib1g-dev } function sources_jumpnbump() { gitPullOrClone } function build_jumpnbump() { make clean CFLAGS="$CFLAGS -fsigned-char" make PREFIX="$md_inst" md_ret_require="$md_build/jumpnbump" } function install_jumpnbump() { make PREFIX="$md_inst" install strip "$md_inst"/bin/{gobpack,jnbpack,jnbunpack,jumpnbump} } function game_data_jumpnbump() { local tmpdir="$(mktemp -d)" local compressed local uncompressed # install extra levels from Debian's jumpnbump-levels package downloadAndExtract "https://salsa.debian.org/games-team/jumpnbump-levels/-/archive/master/jumpnbump-levels-master.tar.bz2" "$tmpdir" --strip-components 1 --wildcards "*.bz2" for compressed in "$tmpdir"/*.bz2; do uncompressed="${compressed##*/}" uncompressed="${uncompressed%.bz2}" if [[ ! -f "$romdir/ports/jumpnbump/$uncompressed" ]]; then bzcat "$compressed" > "$romdir/ports/jumpnbump/$uncompressed" chown -R "$__user":"$__group" "$romdir/ports/jumpnbump/$uncompressed" fi done rm -rf "$tmpdir" } function configure_jumpnbump() { addPort "$md_id" "jumpnbump" "Jump 'n Bump" "$md_inst/jumpnbump.sh" mkRomDir "ports/jumpnbump" [[ "$md_mode" == "remove" ]] && return # install game data game_data_jumpnbump # install launch script cp "$md_data/jumpnbump.sh" "$md_inst" iniConfig "=" '"' "$md_inst/jumpnbump.sh" iniSet "ROOTDIR" "$rootdir" iniSet "MD_CONF_ROOT" "$md_conf_root" iniSet "ROMDIR" "$romdir" iniSet "MD_INST" "$md_inst" # set default game options on first install if [[ ! -f "$md_conf_root/jumpnbump/options.cfg" ]]; then iniConfig " = " "" "$md_conf_root/jumpnbump/options.cfg" iniSet "nogore" "1" fi } ================================================ FILE: scriptmodules/ports/kodi.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="kodi" rp_module_desc="Kodi - Open source home theatre software" rp_module_licence="GPL2 https://raw.githubusercontent.com/xbmc/xbmc/master/LICENSE.md" rp_module_section="opt" rp_module_flags="!mali !osmc !xbian" function _update_hook_kodi() { # to show as installed in retropie-setup 4.x hasPackage kodi && mkdir -p "$md_inst" } function depends_kodi() { # Raspberry Pi OS if [[ "$__os_id" = "Raspbian" ]] && isPlatform "rpi"; then if [[ "$__os_debian_ver" -le 10 ]]; then if [[ "$md_mode" == "install" ]]; then # remove old repository rm -f /etc/apt/sources.list.d/mene.list echo "deb http://pipplware.pplware.pt/pipplware/dists/$__os_codename/main/binary/ ./" >/etc/apt/sources.list.d/pipplware.list download http://pipplware.pplware.pt/pipplware/key.asc - | apt-key add - &>/dev/null else rm -f /etc/apt/sources.list.d/pipplware.list apt-key del 4096R/BAA567BB >/dev/null fi fi if [[ "$__os_debian_ver" -gt 10 ]]; then # install Kodi from the RPI repos directly # make sure we're not installing Debian/Raspbian version by pinning the origin of the packages local apt_pin_file="/etc/apt/preferences.d/01-rpie-pin-kodi" if [[ ! -f "$apt_pin_file" ]]; then echo -e "Package: kodi*\nPin: release o=Raspberry Pi Foundation\nPin-Priority: 900" > "$apt_pin_file" fi fi # ubuntu elif [[ -n "$__os_ubuntu_ver" ]] && isPlatform "x86"; then if [[ "$md_mode" == "install" ]]; then apt-add-repository -y ppa:team-xbmc/ppa else apt-add-repository --remove -y ppa:team-xbmc/ppa fi # others else md_ret_errors+=("Sorry, but kodi is not installable for your OS/Platform via RetroPie-Setup") return 1 fi # required for reboot/shutdown options. Don't try and remove if removing dependencies [[ "$md_mode" == "install" ]] && getDepends polkitd addUdevInputRules } function install_bin_kodi() { # force aptInstall to get a fresh list before installing __apt_update=0 # not all the kodi packages may be available depending on repository # so we will check and install what's available local all_pkgs=(kodi kodi-peripheral-joystick kodi-inputstream-adaptive kodi-vfs-libarchive kodi-vfs-sftp kodi-vfs-nfs) compareVersions "$__os_ubuntu_ver" lt 22.04 && all_pkgs+=(kodi-inputstream-rtmp) local avail_pkgs=() local pkg for pkg in "${all_pkgs[@]}"; do # check if the package is available - we use "madison" rather than "show" # as madison won't show referenced virtual packages which we don't want local ret=$(apt-cache madison "$pkg" 2>/dev/null) [[ -n "$ret" ]] && avail_pkgs+=("$pkg") done aptInstall "${avail_pkgs[@]}" } function remove_kodi() { aptRemove kodi rp_callModule kodi depends remove } function configure_kodi() { moveConfigDir "$home/.kodi" "$md_conf_root/kodi" addPort "$md_id" "kodi" "Kodi" "kodi-standalone" } ================================================ FILE: scriptmodules/ports/lincity-ng.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lincity-ng" rp_module_desc="lincity-ng - Open Source City Building Game" rp_module_licence="GPL2 https://raw.githubusercontent.com/lincity-ng/lincity-ng/master/COPYING" rp_module_section="opt" rp_module_flags="!mali" function _update_hook_lincity-ng() { # to show as installed in retropie-setup 4.x hasPackage lincity-ng && mkdir -p "$md_inst" } function depends_lincity-ng() { ! isPlatform "x11" && getDepends xorg } function install_bin_lincity-ng() { aptInstall lincity-ng } function remove_lincity-ng() { aptRemove lincity-ng } function configure_lincity-ng() { local binary="XINIT:/usr/games/lincity-ng" addPort "$md_id" "lincity-ng" "LinCity-NG" "$binary" moveConfigDir "$home/.lincity-ng" "$md_conf_root/lincity-ng" # fix for wrong config location if [[ -d "/lincity-ng" ]]; then cp -R /lincity-ng "$md_conf_root/" rm -rf /lincity-ng chown "$__user":"$__group" "$md_conf_root/lincity-ng" fi } ================================================ FILE: scriptmodules/ports/love-0.10.2.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="love-0.10.2" rp_module_desc="Love - 2d Game Engine v0.10.2" rp_module_help="Copy your Love games to $romdir/love" rp_module_licence="ZLIB https://raw.githubusercontent.com/love2d/love/0.10.2/license.txt" rp_module_repo="git https://github.com/love2d/love 0.10.2" rp_module_section="opt" rp_module_flags="!aarch64" function depends_love-0.10.2() { depends_love } function sources_love-0.10.2() { gitPullOrClone # libluajit-5.1-dev in buster (and also on Ubuntu 18.04+) still has # LUA_VERSION_NUM defined as 501 but requires the newer luaL_Reg named struct. # adjusting the compatibility code #if to check for LUA_VERSION_NUM >= 501 fixes this. sed -i "s/LUA_VERSION_NUM > 501/LUA_VERSION_NUM >= 501/" "$md_build/src/libraries/luasocket/libluasocket/lua.h" } function build_love-0.10.2() { build_love } function install_love-0.10.2() { install_love } function game_data_love-0.10.2() { game_data_love } function configure_love-0.10.2() { configure_love } ================================================ FILE: scriptmodules/ports/love.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="love" rp_module_desc="Love - 2d Game Engine" rp_module_help="Copy your Love games to $romdir/love" rp_module_licence="ZLIB https://raw.githubusercontent.com/love2d/love/master/license.txt" rp_module_repo="git https://github.com/love2d/love 11.5" rp_module_section="opt" function depends_love() { local depends=(autotools-dev automake libtool pkg-config libfreetype6-dev libluajit-5.1-dev libphysfs-dev libsdl2-dev libopenal-dev libogg-dev libtheora-dev libvorbis-dev libflac-dev libflac++-dev libmodplug-dev libmpg123-dev libmng-dev libjpeg-dev) getDepends "${depends[@]}" } function sources_love() { gitPullOrClone } function build_love() { ./platform/unix/automagic local params=(--prefix="$md_inst") # workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65612 on gcc 5.x+ if isPlatform "x86"; then CXXFLAGS+=" -lgcc_s -lgcc" ./configure "${params[@]}" else ./configure "${params[@]}" fi make clean make md_ret_require="$md_build/src/love" } function install_love() { make install } function game_data_love() { # get Mari0 1.6.2 (freeware game data) if [[ ! -f "$romdir/love/mari0.love" ]]; then downloadAndExtract "https://github.com/Stabyourself/mari0/archive/1.6.2.tar.gz" "$__tmpdir/mari0" --strip-components 1 pushd "$__tmpdir/mari0" zip -qr "$romdir/love/mari0.love" . popd rm -fr "$__tmpdir/mari0" chown "$__user":"$__group" "$romdir/love/mari0.love" fi } function configure_love() { setConfigRoot "" mkRomDir "love" addEmulator 1 "$md_id" "love" "$md_inst/bin/love %ROM%" addSystem "love" [[ "$md_mode" == "install" ]] && game_data_love } ================================================ FILE: scriptmodules/ports/lzdoom/01_remove_cmake_arm_options.diff ================================================ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5b3e777..0bce388 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -334,16 +334,6 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) set( CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers -ffp-contract=off ${CMAKE_C_FLAGS}" ) set( CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers -ffp-contract=off ${CMAKE_CXX_FLAGS}" ) - # ARM processors (Raspberry Pi, et al) - enable ARM NEON support. - if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") - set (USE_ARMV8 0 CACHE BOOL "Use ARMv8 instructions - Raspberry Pi 3") - if (USE_ARMV8) - set( CMAKE_CXX_FLAGS "-mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mtune=cortex-a53 -mhard-float -DNO_SSE ${CMAKE_CXX_FLAGS}" ) - else () - set( CMAKE_CXX_FLAGS "-mcpu=cortex-a7 -mfpu=neon-vfpv4 -mtune=cortex-a7 -mhard-float -DNO_SSE ${CMAKE_CXX_FLAGS}" ) - endif () - endif () - if( NOT X64 AND NOT CAN_DO_MFPMATH ) set( CMAKE_C_FLAGS "-DNO_SSE ${CMAKE_C_FLAGS}" ) set( CMAKE_CXX_FLAGS "-DNO_SSE ${CMAKE_CXX_FLAGS}" ) ================================================ FILE: scriptmodules/ports/lzdoom/02_lzma_sdk_dont_force_arm_crc32.diff ================================================ diff --git a/libraries/lzma/C/7zCrc.c b/libraries/lzma/C/7zCrc.c index f186324..f3ae7be 100644 --- a/libraries/lzma/C/7zCrc.c +++ b/libraries/lzma/C/7zCrc.c @@ -83,12 +83,6 @@ UInt32 MY_FAST_CALL CrcUpdateT1(UInt32 v, const void *data, size_t size, const U #endif #elif (defined(__clang__) && (__clang_major__ >= 3)) \ || (defined(__GNUC__) && (__GNUC__ > 4)) - #if !defined(__ARM_FEATURE_CRC32) - #define __ARM_FEATURE_CRC32 1 - #if (!defined(__clang__) || (__clang_major__ > 3)) // fix these numbers - #define ATTRIB_CRC __attribute__((__target__("arch=armv8-a+crc"))) - #endif - #endif #if defined(__ARM_FEATURE_CRC32) #define USE_ARM64_CRC #include ================================================ FILE: scriptmodules/ports/lzdoom/03_extra_includes.diff ================================================ diff --git a/libraries/music_common/fileio.h b/libraries/music_common/fileio.h index dcea971..8affc3b 100644 --- a/libraries/music_common/fileio.h +++ b/libraries/music_common/fileio.h @@ -27,6 +27,7 @@ #include #include #include +#include #if defined _WIN32 && !defined _WINDOWS_ // only define this if windows.h is not included. // I'd rather not include Windows.h for just this. This header is not supposed to pollute everything it touches. diff --git a/libraries/zmusic/mididevices/music_adlmidi_mididevice.cpp b/libraries/zmusic/mididevices/music_adlmidi_mididevice.cpp index 4d1f844..6c5e6b3 100644 --- a/libraries/zmusic/mididevices/music_adlmidi_mididevice.cpp +++ b/libraries/zmusic/mididevices/music_adlmidi_mididevice.cpp @@ -35,6 +35,7 @@ // HEADER FILES ------------------------------------------------------------ #include +#include #include "zmusic/zmusic_internal.h" #include "mididevice.h" diff --git a/libraries/zmusic/mididevices/music_fluidsynth_mididevice.cpp b/libraries/zmusic/mididevices/music_fluidsynth_mididevice.cpp index 4e0edf4..7196830 100644 --- a/libraries/zmusic/mididevices/music_fluidsynth_mididevice.cpp +++ b/libraries/zmusic/mididevices/music_fluidsynth_mididevice.cpp @@ -41,6 +41,7 @@ #include "mididevice.h" #include "zmusic/mus2midi.h" +#include // FluidSynth implementation of a MIDI device ------------------------------- FluidConfig fluidConfig; diff --git a/libraries/zmusic/mididevices/music_opl_mididevice.cpp b/libraries/zmusic/mididevices/music_opl_mididevice.cpp index 8ed7446..5e17edc 100644 --- a/libraries/zmusic/mididevices/music_opl_mididevice.cpp +++ b/libraries/zmusic/mididevices/music_opl_mididevice.cpp @@ -39,6 +39,8 @@ #include "mididevice.h" #include "zmusic/mus2midi.h" +#include + #ifdef HAVE_OPL #include "oplsynth/opl.h" #include "oplsynth/opl_mus_player.h" @@ -333,4 +335,4 @@ MIDIDevice* CreateOplMIDIDevice(const char* Args) { throw std::runtime_error("OPL device not supported in this configuration"); } -#endif \ No newline at end of file +#endif diff --git a/libraries/zmusic/mididevices/music_opnmidi_mididevice.cpp b/libraries/zmusic/mididevices/music_opnmidi_mididevice.cpp index fece81a..30447a7 100644 --- a/libraries/zmusic/mididevices/music_opnmidi_mididevice.cpp +++ b/libraries/zmusic/mididevices/music_opnmidi_mididevice.cpp @@ -37,6 +37,8 @@ #include "mididevice.h" #include "zmusic/zmusic_internal.h" +#include + #ifdef HAVE_OPN #include "opnmidi.h" diff --git a/libraries/zmusic/mididevices/music_timidity_mididevice.cpp b/libraries/zmusic/mididevices/music_timidity_mididevice.cpp index 2d22192..0538d3d 100644 --- a/libraries/zmusic/mididevices/music_timidity_mididevice.cpp +++ b/libraries/zmusic/mididevices/music_timidity_mididevice.cpp @@ -38,6 +38,7 @@ #include "mididevice.h" #include "zmusic/zmusic_internal.h" +#include #ifdef HAVE_GUS #include "timidity/timidity.h" diff --git a/libraries/zmusic/mididevices/music_timiditypp_mididevice.cpp b/libraries/zmusic/mididevices/music_timiditypp_mididevice.cpp index 825e80e..342d642 100644 --- a/libraries/zmusic/mididevices/music_timiditypp_mididevice.cpp +++ b/libraries/zmusic/mididevices/music_timiditypp_mididevice.cpp @@ -35,6 +35,8 @@ #include "mididevice.h" #include "zmusic/zmusic_internal.h" +#include + #ifdef HAVE_TIMIDITY #include "timiditypp/timidity.h" @@ -239,4 +241,4 @@ MIDIDevice* CreateTimidityPPMIDIDevice(const char* Args, int samplerate) { throw std::runtime_error("Timidity++ device not supported in this configuration"); } -#endif \ No newline at end of file +#endif diff --git a/libraries/zmusic/mididevices/music_wavewriter_mididevice.cpp b/libraries/zmusic/mididevices/music_wavewriter_mididevice.cpp index d610566..a2e1809 100644 --- a/libraries/zmusic/mididevices/music_wavewriter_mididevice.cpp +++ b/libraries/zmusic/mididevices/music_wavewriter_mididevice.cpp @@ -40,6 +40,7 @@ #include "../music_common/fileio.h" #include +#include // MACROS ------------------------------------------------------------------ // TYPES ------------------------------------------------------------------- diff --git a/libraries/zmusic/mididevices/music_wildmidi_mididevice.cpp b/libraries/zmusic/mididevices/music_wildmidi_mididevice.cpp index 2146830..685bbe1 100644 --- a/libraries/zmusic/mididevices/music_wildmidi_mididevice.cpp +++ b/libraries/zmusic/mididevices/music_wildmidi_mididevice.cpp @@ -37,6 +37,7 @@ #include "mididevice.h" #include "zmusic/zmusic_internal.h" +#include #ifdef HAVE_WILDMIDI #include "wildmidi/wildmidi_lib.h" @@ -284,4 +285,4 @@ MIDIDevice* CreateWildMIDIDevice(const char* Args, int samplerate) { throw std::runtime_error("WildMidi device not supported in this configuration"); } -#endif \ No newline at end of file +#endif diff --git a/libraries/zmusic/musicformats/music_midi.cpp b/libraries/zmusic/musicformats/music_midi.cpp index 6c261f9..e693dca 100644 --- a/libraries/zmusic/musicformats/music_midi.cpp +++ b/libraries/zmusic/musicformats/music_midi.cpp @@ -36,6 +36,7 @@ #include #include +#include #include #include "zmusic/zmusic_internal.h" #include "zmusic/musinfo.h" diff --git a/libraries/zmusic/streamsources/music_gme.cpp b/libraries/zmusic/streamsources/music_gme.cpp index 16fdc77..4ae886e 100644 --- a/libraries/zmusic/streamsources/music_gme.cpp +++ b/libraries/zmusic/streamsources/music_gme.cpp @@ -43,6 +43,7 @@ #include #include "../..//libraries/music_common/fileio.h" +#include // MACROS ------------------------------------------------------------------ // TYPES ------------------------------------------------------------------- diff --git a/libraries/zmusic/streamsources/music_opl.cpp b/libraries/zmusic/streamsources/music_opl.cpp index 87f2723..90e5388 100644 --- a/libraries/zmusic/streamsources/music_opl.cpp +++ b/libraries/zmusic/streamsources/music_opl.cpp @@ -37,7 +37,7 @@ #include "../../libraries/music_common/fileio.h" #include "zmusic/midiconfig.h" - +#include //========================================================================== // // OPL file played by a software OPL2 synth and streamed through the sound system ================================================ FILE: scriptmodules/ports/lzdoom.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lzdoom" rp_module_desc="lzdoom - DOOM source port (legacy version of GZDoom)" rp_module_licence="GPL3 https://raw.githubusercontent.com/drfrag666/gzdoom/master/LICENSE" rp_module_repo="git https://github.com/drfrag666/gzdoom 3.88b" rp_module_section="opt" rp_module_flags="" function depends_lzdoom() { local depends=( libev-dev libfluidsynth-dev libgme-dev libsdl2-dev libmpg123-dev libsndfile1-dev zlib1g-dev libbz2-dev timidity freepats cmake libopenal-dev libjpeg-dev libgl1-mesa-dev fluid-soundfont-gm ) getDepends "${depends[@]}" } function sources_lzdoom() { gitPullOrClone if isPlatform "arm"; then # patch the CMake build file to remove the ARMv8 options, we handle `gcc`'s CPU flags ourselves applyPatch "$md_data/01_remove_cmake_arm_options.diff" # patch the 21.06 version of LZMA-SDK to disable the CRC32 ARMv8 intrinsics forced for ARM CPUs applyPatch "$md_data/02_lzma_sdk_dont_force_arm_crc32.diff" fi applyPatch "$md_data/03_extra_includes.diff" } function build_lzdoom() { rm -rf release mkdir -p release cd release local params=(-DNO_GTK=On -DCMAKE_INSTALL_PREFIX="$md_inst" -DPK3_QUIET_ZIPDIR=ON -DCMAKE_BUILD_TYPE=Release) # Note: `-funsafe-math-optimizations` should be avoided, see: https://forum.zdoom.org/viewtopic.php?f=7&t=57781 cmake "${params[@]}" .. make md_ret_require="$md_build/release/$md_id" } function install_lzdoom() { md_ret_files=( 'release/brightmaps.pk3' 'release/lzdoom' 'release/lzdoom.pk3' 'release/lights.pk3' 'release/game_support.pk3' 'release/soundfonts' 'README.md' ) } function add_games_lzdoom() { local params=("+fullscreen 1") local launcher_prefix="DOOMWADDIR=$romdir/ports/doom" if isPlatform "mesa" || isPlatform "gl"; then params+=("+vid_renderer 1") elif isPlatform "gles"; then params+=("+vid_renderer 0") fi # FluidSynth is too memory/CPU intensive if isPlatform "arm"; then params+=("+snd_mididevice -3") fi if isPlatform "kms"; then params+=("+vid_vsync 1" "-width %XRES%" "-height %YRES%") fi _add_games_lr-prboom "$launcher_prefix $md_inst/$md_id -iwad %ROM% ${params[*]}" } function configure_lzdoom() { mkRomDir "ports/doom" moveConfigDir "$home/.config/$md_id" "$md_conf_root/doom" [[ "$md_mode" == "install" ]] && game_data_lr-prboom add_games_${md_id} } ================================================ FILE: scriptmodules/ports/micropolis.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="micropolis" rp_module_desc="Micropolis - Open Source City Building Game" rp_module_licence="GPL https://raw.githubusercontent.com/SimHacker/micropolis/wiki/License.md" rp_module_section="opt" rp_module_flags="!mali" function depends_micropolis() { ! isPlatform "x11" getDepends xorg matchbox-window-manager } function install_bin_micropolis() { aptInstall micropolis } function remove_micropolis() { aptRemove micropolis } function configure_micropolis() { local binary="/usr/games/micropolis" ! isPlatform "x11" && binary="XINIT-WMC:/usr/games/micropolis" addPort "$md_id" "micropolis" "Micropolis" "$binary" } ================================================ FILE: scriptmodules/ports/minecraft.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="minecraft" rp_module_desc="Minecraft - Pi Edition" rp_module_licence="PROP" rp_module_section="exp" rp_module_flags="!all videocore" function depends_minecraft() { getDepends xorg matchbox-window-manager } function install_bin_minecraft() { [[ -f "$md_inst/minecraft-pi" ]] && rm -rf "$md_inst/"* aptInstall minecraft-pi } function remove_minecraft() { aptRemove minecraft-pi } function configure_minecraft() { addPort "$md_id" "minecraft" "Minecraft" "XINIT-WM:/usr/bin/minecraft-pi" } ================================================ FILE: scriptmodules/ports/mysticmine.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="mysticmine" rp_module_desc="Mystic Mine - Rail game for up to six players on one keyboard" rp_module_licence="MIT https://raw.githubusercontent.com/dewitters/MysticMine/master/LICENSE.txt" rp_module_repo="git https://github.com/dewitters/MysticMine.git master" rp_module_section="exp" rp_module_flags="!:\$__os_debian_ver:-gt:10" function depends_mysticmine() { getDepends python-pyrex python-numpy python-pygame } function sources_mysticmine() { gitPullOrClone } function build_mysticmine() { make } function install_mysticmine() { python2 setup.py install --prefix "$md_inst" } function configure_mysticmine() { addPort "$md_id" "mysticmine" "MysticMine" "pushd $md_inst; PYTHONPATH=$PYTHONPATH:${md_inst}/lib/python2.7/site-packages ./bin/MysticMine; popd" } ================================================ FILE: scriptmodules/ports/openblok.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="openblok" rp_module_desc="OpenBlok: A Block Dropping Game" rp_module_licence="GPL3 https://raw.githubusercontent.com/mmatyas/openblok/master/LICENSE.md" rp_module_repo="git https://github.com/mmatyas/openblok.git v0.8.7" rp_module_section="exp" rp_module_flags="" function depends_openblok() { getDepends cmake libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev gettext } function sources_openblok() { gitPullOrClone } function build_openblok() { cmake -DCMAKE_BUILD_TYPE=Release -DINSTALL_PORTABLE=ON -DCMAKE_INSTALL_PREFIX="$md_inst" -DENABLE_MP3=OFF make md_ret_require="$md_build/src/openblok" } function install_openblok() { make install/strip } function configure_openblok() { moveConfigDir "$home/.local/share/openblok" "$md_conf_root/openblok" addPort "$md_id" "openblok" "OpenBlok" "$md_inst/openblok" } ================================================ FILE: scriptmodules/ports/openbor.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="openbor" rp_module_desc="OpenBOR - Beat 'em Up Game Engine" rp_module_help="OpenBOR games need to be extracted to function properly. Place your pak files in $romdir/ports/openbor and then run $rootdir/ports/openbor/extract.sh. When the script is done, your original pak files will be found in $romdir/ports/openbor/originals and can be deleted." rp_module_licence="BSD https://raw.githubusercontent.com/rofl0r/openbor/master/LICENSE" rp_module_repo="git https://github.com/rofl0r/openbor.git master" rp_module_section="exp" rp_module_flags="sdl1 !mali !x11" function depends_openbor() { getDepends libsdl1.2-dev libsdl-gfx1.2-dev libogg-dev libvorbisidec-dev libvorbis-dev libpng-dev zlib1g-dev } function sources_openbor() { gitPullOrClone } function build_openbor() { local params=() ! isPlatform "x11" && params+=(NO_GL=1) make clean make "${params[@]}" cd "$md_build/tools/borpak/" ./build-linux.sh md_ret_require="$md_build/OpenBOR" } function install_openbor() { md_ret_files=( 'OpenBOR' 'tools/borpak/borpak' 'tools/unpack.sh' ) } function configure_openbor() { addPort "$md_id" "openbor" "OpenBOR - Beats of Rage Engine" "$md_inst/openbor.sh" mkRomDir "ports/$md_id" isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" ! isPlatform "dispmanx" && isPlatform "kms" && setBackend "$md_id" "sdl12-compat" cat >"$md_inst/openbor.sh" << _EOF_ #!/bin/bash pushd "$md_inst" ./OpenBOR "\$@" popd _EOF_ chmod +x "$md_inst/openbor.sh" cat >"$md_inst/extract.sh" <<_EOF_ #!/bin/bash PORTDIR="$md_inst" BORROMDIR="$romdir/ports/$md_id" mkdir \$BORROMDIR/original/ mkdir \$BORROMDIR/original/borpak/ mv \$BORROMDIR/*.pak \$BORROMDIR/original/ cp \$PORTDIR/unpack.sh \$BORROMDIR/original/ cp \$PORTDIR/borpak \$BORROMDIR/original/borpak/ cd \$BORROMDIR/original/ for i in *.pak do CURRENTFILE=\`basename "\$i" .pak\` ./unpack.sh "\$i" mkdir "\$CURRENTFILE" mv data/ "\$CURRENTFILE"/ mv "\$CURRENTFILE"/ ../ done echo "Your games are extracted and ready to be played. Your originals are stored safely in $BORROMDIR/original/ but they won't be needed anymore. Everything within it can be deleted." _EOF_ chmod +x "$md_inst/extract.sh" local dir for dir in ScreenShots Logs Saves; do mkUserDir "$md_conf_root/$md_id/$dir" ln -snf "$md_conf_root/$md_id/$dir" "$md_inst/$dir" done ln -snf "$romdir/ports/$md_id" "$md_inst/Paks" } ================================================ FILE: scriptmodules/ports/openpht.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="openpht" rp_module_desc="OpenPHT is a community driven fork of Plex Home Theater" rp_module_licence="GPL2 https://raw.githubusercontent.com/RasPlex/OpenPHT/openpht-1.7/LICENSE.GPL" rp_module_section="exp" rp_module_flags="!arm" function depends_openpht() { getDepends pulseaudio-utils addUdevInputRules } function install_bin_openpht() { local version="1.7.1.137-b604995c" local package="openpht_${version}-${__os_codename}_amd64.deb" local url="https://github.com/RasPlex/OpenPHT/releases/download/v$version/$package" local temp="$(mktemp -d)" download "$url" "$temp/$package" if hasPackage "apt" "1.1" "ge"; then apt install -y --allow-downgrades "$temp/$package" else # Falling back to dpkg dpkg -i "$temp/$package" apt-get -f -y install fi rm -rf "$temp" } function remove_openpht() { aptRemove openpht } function configure_openpht() { addPort "openpht" "openpht" "OpenPHT" "pasuspender -- env AE_SINK=ALSA openpht" } ================================================ FILE: scriptmodules/ports/openttd.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="openttd" rp_module_desc="Open Source Simulator Based On Transport Tycoon Deluxe" rp_module_licence="GPL2 https://raw.githubusercontent.com/OpenTTD/OpenTTD/master/COPYING.md" rp_module_section="opt" rp_module_flags="sdl1 !mali" function _update_hook_openttd() { # to show as installed in retropie-setup 4.x hasPackage openttd && mkdir -p "$md_inst" } function install_bin_openttd() { aptInstall openttd } function remove_openttd() { aptRemove openttd } function configure_openttd() { addPort "$md_id" "openttd" "OpenTTD" "openttd" [[ "$md_mode" == "remove" ]] && return isPlatform "dispmanx" && setBackend "$md_id" "dispmanx" local dir for dir in .config .local/share; do moveConfigDir "$home/$dir/openttd" "$md_conf_root/openttd" done moveConfigDir "$home/.local/openttd" "$md_conf_root/openttd" } ================================================ FILE: scriptmodules/ports/opentyrian/01_fullscreen.diff ================================================ diff --git a/src/config.c b/src/config.c index c4f4330..4c77a5d 100644 --- a/src/config.c +++ b/src/config.c @@ -249,7 +249,7 @@ Config opentyrian_config; // implicitly initialized bool load_opentyrian_config( void ) { // defaults - fullscreen_display = -1; + fullscreen_display = 0; set_scaler_by_name("Scale2x"); Config *config = &opentyrian_config; ================================================ FILE: scriptmodules/ports/opentyrian.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="opentyrian" rp_module_desc="Open Tyrian - port of the DOS shoot-em-up Tyrian" rp_module_licence="GPL2 https://raw.githubusercontent.com/opentyrian/opentyrian/master/COPYING" rp_module_repo="git https://github.com/opentyrian/opentyrian.git master" rp_module_section="opt" rp_module_flags="" function depends_opentyrian() { getDepends libsdl2-dev libsdl2-net-dev } function sources_opentyrian() { gitPullOrClone # patch to default to fullscreen applyPatch "$md_data/01_fullscreen.diff" } function build_opentyrian() { rpSwap on 512 make clean make rpSwap off md_ret_require="$md_build/opentyrian" } function install_opentyrian() { make install prefix="$md_inst" } function game_data_opentyrian() { if [[ ! -d "$romdir/ports/opentyrian/data" ]]; then cd "$__tmpdir" # get Tyrian 2.1 (freeware game data) downloadAndExtract "$__archive_url/tyrian21.zip" "$romdir/ports/opentyrian/data" -j chown -R "$__user":"$__group" "$romdir/ports/opentyrian" fi } function configure_opentyrian() { addPort "$md_id" "opentyrian" "OpenTyrian" "$md_inst/bin/opentyrian --data $romdir/ports/opentyrian/data" mkRomDir "ports/opentyrian" moveConfigDir "$home/.config/opentyrian" "$md_conf_root/opentyrian" [[ "$md_mode" == "install" ]] && game_data_opentyrian } ================================================ FILE: scriptmodules/ports/quake3.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="quake3" rp_module_desc="Quake 3" rp_module_licence="GPL2 https://raw.githubusercontent.com/raspberrypi/quake3/master/COPYING.txt" rp_module_repo="git https://github.com/raspberrypi/quake3.git master" rp_module_section="opt" rp_module_flags="!all videocore" function depends_quake3() { getDepends libsdl1.2-dev libraspberrypi-dev } function sources_quake3() { gitPullOrClone } function build_quake3() { ./build_rpi_raspbian.sh md_ret_require="$md_build/build/release-linux-arm/ioquake3.arm" } function install_quake3() { md_ret_files=( 'build/release-linux-arm/ioq3ded.arm' 'build/release-linux-arm/ioquake3.arm' ) } function game_data_quake3() { if [[ ! -f "$romdir/ports/quake3/pak0.pk3" ]]; then downloadAndExtract "$__archive_url/Q3DemoPaks.zip" "$romdir/ports/quake3" -j fi # always chown as moveConfigDir in the configure_ script would move the root owned demo files chown -R "$__user":"$__group" "$romdir/ports/quake3" } function configure_quake3() { mkRomDir "ports/quake3" addPort "$md_id" "quake3" "Quake III Arena" "LD_LIBRARY_PATH=lib $md_inst/ioquake3.arm" [[ "$md_mode" == "remove" ]] && return game_data_quake3 moveConfigDir "$md_inst/baseq3" "$romdir/ports/quake3" } ================================================ FILE: scriptmodules/ports/sdlpop.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="sdlpop" rp_module_desc="SDLPoP - Port of Prince of Persia" rp_module_licence="GPL3 https://raw.githubusercontent.com/NagyD/SDLPoP/master/COPYING" rp_module_repo="git https://github.com/NagyD/SDLPoP.git master" rp_module_section="opt" function depends_sdlpop() { getDepends libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev } function sources_sdlpop() { gitPullOrClone } function build_sdlpop() { cd src make md_ret_require="$md_build/prince" } function install_sdlpop() { md_ret_files=( 'prince' 'data' 'doc' 'COPYING' ) cp -v "SDLPoP.ini" "$md_inst/SDLPoP.ini.def" sed -i "s/use_correct_aspect_ratio = false/use_correct_aspect_ratio = true/" "$md_inst/SDLPoP.ini.def" } function configure_sdlpop() { addPort "$md_id" "sdlpop" "Prince of Persia" "pushd $md_inst; $md_inst/prince full; popd" [[ "$md_mode" == "remove" ]] && return copyDefaultConfig "$md_inst/SDLPoP.ini.def" "$md_conf_root/$md_id/SDLPoP.ini" moveConfigFile "$md_inst/SDLPoP.ini" "$md_conf_root/$md_id/SDLPoP.ini" moveConfigFile "$md_inst/PRINCE.SAV" "$md_conf_root/$md_id/PRINCE.SAV" moveConfigFile "$md_inst/QUICKSAVE.SAV" "$md_conf_root/$md_id/QUICKSAVE.SAV" moveConfigFile "$md_inst/SDLPoP.cfg" "$md_conf_root/$md_id/SDLPoP.cfg" chown -R "$__user":"$__group" "$md_conf_root/$md_id" } ================================================ FILE: scriptmodules/ports/smw.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="smw" rp_module_desc="Super Mario War - A fan-made multiplayer Super Mario Bros. style deathmatch game" rp_module_licence="GPL2 https://smwstuff.net" rp_module_repo="git https://github.com/mmatyas/supermariowar master" rp_module_section="opt" rp_module_flags="sdl2" function depends_smw() { getDepends cmake libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev zlib1g-dev } function sources_smw() { gitPullOrClone } function build_smw() { local params=(-DUSE_SDL2_LIBS=ON -DSMW_INSTALL_PORTABLE=ON) isPlatform "gles2" && params+=(-DSDL2_FORCE_GLES=ON) rm -fr build mkdir -p build && cd build cmake .. "${params[@]}" make smw md_ret_require="$md_build/build/smw" } function install_smw() { md_ret_files=( "build/smw" "data" "docs" "README.md" "CREDITS" ) } function configure_smw() { addPort "$md_id" "smw" "Super Mario War" "$md_inst/smw" [[ "$md_mode" == "remove" ]] && return moveConfigDir "$home/.smw" "$md_conf_root/smw" # try to migrate existing settings to the new conf folder if [[ -f "$md_conf_root/smw/.smw.options.bin" ]] ; then mv "$md_conf_root/smw/.smw.options.bin" "$md_conf_root/smw/options.bin" fi } ================================================ FILE: scriptmodules/ports/solarus.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="solarus" rp_module_desc="Solarus - A lightweight, free and open-source game engine for Action-RPGs" rp_module_help="Copy your Solarus quests (games) to $romdir/solarus" rp_module_licence="GPL3 https://gitlab.com/solarus-games/solarus/-/raw/dev/license" rp_module_repo="git https://gitlab.com/solarus-games/solarus.git :_get_branch_solarus" rp_module_section="opt" function _get_branch_solarus() { local branch="release-2.0.1" if [[ "$__os_debian_ver" -lt 11 ]]; then branch="release-1.6.5" fi echo "$branch" } function _options_cfg_file_solarus() { echo "$configdir/solarus/options.cfg" } function depends_solarus() { # ref: https://gitlab.com/solarus-games/solarus/blob/dev/compilation.md local depends=( cmake pkg-config libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libopenal-dev libvorbis-dev libogg-dev libmodplug-dev libphysfs-dev libglm-dev libluajit-5.1-dev ) isPlatform "videocore" && depends+=(libraspberrypi-dev) getDepends "${depends[@]}" } function sources_solarus() { gitPullOrClone } function build_solarus() { local params=( -DSOLARUS_GUI=OFF -DSOLARUS_TESTS=OFF -DSOLARUS_FILE_LOGGING=OFF -DSOLARUS_LIBRARY_INSTALL_DESTINATION="$md_inst/lib" -DCMAKE_INSTALL_PREFIX="$md_inst" -DCMAKE_INSTALL_RPATH="$md_inst/lib" -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE ) isPlatform "gles" && params+=(-DSOLARUS_GL_ES=ON) rm -rf build mkdir build cd build cmake "${params[@]}" .. make # solarus v2.x moved the executable to build/cli local exe_path="$md_build/build" [[ -d "$exe_path/cli" ]] && exe_path="$exe_path/cli" md_ret_require=( "$exe_path/solarus-run" ) } function install_solarus() { cd build make install/strip } function configure_solarus() { setConfigRoot "" addEmulator 1 "$md_id" "solarus" "$md_inst/solarus.sh %ROM%" addSystem "solarus" moveConfigDir "$home/.solarus" "$configdir/solarus" [[ "$md_mode" == "remove" ]] && return # ensure rom dir exists mkRomDir "solarus" # create launcher for Solarus that: # * starts in fullscreen mode # * disables mouse cursor, the JACK driver in OpenAL and the Lua console # * configures the joypad deadzone and quit combo options # * preloads the legacy videocore GLES2 driver (if necessary) cat > "$md_inst/solarus.sh" << _EOF_ #!/usr/bin/env bash export ALSOFT_DRIVERS="-jack," ARGS=("-fullscreen=yes" "-cursor-visible=no" "-lua-console=no") [[ -f "$(_options_cfg_file_solarus)" ]] && source "$(_options_cfg_file_solarus)" [[ -n "\$JOYPAD_DEADZONE" ]] && ARGS+=("-joypad-deadzone=\$JOYPAD_DEADZONE") [[ -n "\$QUIT_COMBO" ]] && ARGS+=("-quit-combo=\$QUIT_COMBO") if $(isPlatform "videocore" && echo true || echo false); then if [[ -f /opt/vc/lib/libbrcmGLESv2.so ]]; then export LD_PRELOAD="/opt/vc/lib/libbrcmGLESv2.so" fi fi exec "$md_inst"/bin/solarus-run "\${ARGS[@]}" "\$@" _EOF_ chmod +x "$md_inst/solarus.sh" } function gui_solarus() { local options=() local default local cmd local choice local joypad_deadzone local quit_combo # initialise options config file iniConfig "=" "\"" "$(_options_cfg_file_solarus)" # start the menu gui default="D" while true; do # read current options iniGet "JOYPAD_DEADZONE" && joypad_deadzone="$ini_value" iniGet "QUIT_COMBO" && quit_combo="$ini_value" # create menu options options=( D "Set joypad axis deadzone (${joypad_deadzone:-default})" Q "Set joypad quit buttons combo (${quit_combo:-unset})" ) # show main menu cmd=(dialog --backtitle "$__backtitle" --default-item "$default" --menu "Choose an option" 16 60 16) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) default="$choice" case "$choice" in D) cmd=(dialog --backtitle "$__backtitle" --inputbox "Please enter a joypad axis deadzone value between 0-32767, higher is less sensitive (leave BLANK to use engine default)" 10 65) choice=$("${cmd[@]}" 2>&1 >/dev/tty) if [[ $? -eq 0 ]]; then if [[ -n "$choice" ]]; then iniSet "JOYPAD_DEADZONE" "$choice" else iniDel "JOYPAD_DEADZONE" fi chown "$__user":"$__group" "$(_options_cfg_file_solarus)" fi ;; Q) cmd=(dialog --backtitle "$__backtitle" --inputbox "Please enter joypad button numbers to use for quitting separated by '+' signs (leave BLANK to unset)\n\nTip: use 'jstest' to find button numbers for your joypad" 12 65) choice=$("${cmd[@]}" 2>&1 >/dev/tty) if [[ $? -eq 0 ]]; then if [[ -n "$choice" ]]; then iniSet "QUIT_COMBO" "$choice" else iniDel "QUIT_COMBO" fi chown "$__user":"$__group" "$(_options_cfg_file_solarus)" fi ;; *) break ;; esac done } ================================================ FILE: scriptmodules/ports/splitwolf.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="splitwolf" rp_module_desc="SplitWolf - 2-4 player split-screen Wolfenstein 3D / Spear of Destiny" rp_module_help="Game File Extension: .wl6, .sod, .sd2, .sd3\n\nCopy your game files to $romdir/ports/wolf3d/\n\nIf you add new game files, run: sudo ~/RetroPie-Setup/retropie_packages.sh splitwolf configure" rp_module_licence="NONCOM https://bitbucket.org/linuxwolf6/splitwolf/raw/scrubbed/license-mame.txt" rp_module_repo="git https://bitbucket.org/linuxwolf6/splitwolf.git scrubbed" rp_module_section="exp" function depends_splitwolf() { getDepends libsdl2-dev libsdl2-mixer-dev } function sources_splitwolf() { gitPullOrClone } function _get_opts_splitwolf() { echo 'splitwolf-wolf3d VERSION_WOLF3D_SHAREWARE=y' # shareware v1.4 echo 'splitwolf-wolf3d_apogee VERSION_WOLF3D_APOGEE=y' # 3d realms / apogee v1.4 full echo 'splitwolf-wolf3d_full VERSION_WOLF3D=y' # gt / id / activision v1.4 full echo 'splitwolf-sod VERSION_SPEAR=y' # spear of destiny echo 'splitwolf-sodmp VERSION_SPEAR_MP=y' # spear of destiny mission packs echo 'splitwolf-spear_demo VERSION_SPEAR_DEMO=y' # spear of destiny } function game_data_splitwolf() { if [[ ! -d "$md_inst/bin/lwmp" ]]; then # Get game assets downloadAndExtract "https://bitbucket.org/linuxwolf6/splitwolf/downloads/lwmp.zip" "$md_inst/bin/" fi } function add_games_splitwolf() { declare -A games_wolf4sdl=( ['vswap.wl1']="Splitwolf - Wolf 3D Demo" ['vswap.wl6']="Splitwolf - Wolf 3D" ['vswap.sod']="Splitwolf - Spear of Destiny Ep 1" ['vswap.sd2']="Splitwolf - Spear of Destiny Ep 2" ['vswap.sd3']="Splitwolf - Spear of Destiny Ep 3" ['vswap.sdm']="Splitwolf - Spear of Destiny Demo" ) add_ports_wolf4sdl "$md_inst/bin/splitwolf.sh %ROM%" "splitwolf" } function build_splitwolf() { mkdir -p "bin" local opt while read -r opt; do local bin="${opt%% *}" local defs="${opt#* }" make clean make "$defs" DATADIR="$romdir/ports/wolf3d/" mv "$bin" "bin/$bin" md_ret_require+=("bin/$bin") done < <(_get_opts_splitwolf) } function install_splitwolf() { cp "$md_build/gamecontrollerdb.txt" "$md_build/bin/" md_ret_files=('bin') } function configure_splitwolf() { local game mkRomDir "ports/wolf3d" if [[ "$md_mode" == "install" ]]; then game_data_splitwolf game_data_wolf4sdl cat > "$md_inst/bin/splitwolf.sh" << _EOF_ #!/bin/bash function get_md5sum() { local file="\$1" [[ -n "\$file" ]] && md5sum "\$file" 2>/dev/null | cut -d" " -f1 } function launch_splitwolf() { local wad_file="\$1" declare -A game_checksums=( ['6efa079414b817c97db779cecfb081c9']="splitwolf-wolf3d" ['a6d901dfb455dfac96db5e4705837cdb']="splitwolf-wolf3d_apogee" ['b8ff4997461bafa5ef2a94c11f9de001']="splitwolf-wolf3d_full" ['b1dac0a8786c7cdbb09331a4eba00652']="splitwolf-sod" ['25d92ac0ba012a1e9335c747eb4ab177']="splitwolf-sodmp --mission 2" ['94aeef7980ef640c448087f92be16d83']="splitwolf-sodmp --mission 3" ['35afda760bea840b547d686a930322dc']="splitwolf-spear_demo" ) if [[ "\${game_checksums[\$(get_md5sum \$wad_file)]}" ]] 2>/dev/null; then $md_inst/bin/\${game_checksums[\$(get_md5sum \$wad_file)]} --splitdatadir $md_inst/bin/lwmp/ --split 2 --splitlayout 2x1 else echo "Error: \$wad_file (md5: \$(get_md5sum \$wad_file)) is not a supported version" fi } launch_splitwolf "\$1" _EOF_ chmod +x "$md_inst/bin/splitwolf.sh" fi add_games_splitwolf moveConfigDir "$home/.splitwolf" "$md_conf_root/splitwolf" } ================================================ FILE: scriptmodules/ports/srb2/001-cmake-libfind.diff ================================================ diff --git a/cmake/Modules/Findlibopenmpt.cmake b/cmake/Modules/Findlibopenmpt.cmake index 96cc310..d509c25 100644 --- a/cmake/Modules/Findlibopenmpt.cmake +++ b/cmake/Modules/Findlibopenmpt.cmake @@ -26,7 +26,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(libopenmpt REQUIRED_VARS libopenmpt_LIBRARY libopenmpt_INCLUDE_DIR) if(libopenmpt_FOUND AND NOT TARGET openmpt) - add_library(openmpt UNKNOWN IMPORTED) + add_library(openmpt UNKNOWN IMPORTED GLOBAL) set_target_properties( openmpt PROPERTIES diff --git a/cmake/Modules/Findminiupnpc.cmake b/cmake/Modules/Findminiupnpc.cmake index f4931ad..eb12927 100644 --- a/cmake/Modules/Findminiupnpc.cmake +++ b/cmake/Modules/Findminiupnpc.cmake @@ -26,7 +26,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(miniupnpc REQUIRED_VARS libminiupnpc_LIBRARY libminiupnpc_INCLUDE_DIR) if(miniupnpc_FOUND AND NOT TARGET miniupnpc) - add_library(miniupnpc UNKNOWN IMPORTED) + add_library(miniupnpc UNKNOWN IMPORTED GLOBAL) set_target_properties( miniupnpc PROPERTIES ================================================ FILE: scriptmodules/ports/srb2.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="srb2" rp_module_desc="Sonic Robo Blast 2 - 3D Sonic the Hedgehog fan-game built using a modified version of the Doom Legacy source port of Doom" rp_module_licence="GPL2 https://git.do.srb2.org/STJr/SRB2/-/raw/next/LICENSE?ref_type=heads" rp_module_repo="git https://git.do.srb2.org/STJr/SRB2 :_get_branch_srb2" rp_module_section="exp" function _version_srb2() { echo "2.2.15" } function _get_branch_srb2() { echo "SRB2_release_$(_version_srb2)" } function depends_srb2() { getDepends cmake libsdl2-dev libsdl2-mixer-dev libgme-dev libpng-dev libcurl4-openssl-dev libopenmpt-dev } function sources_srb2() { gitPullOrClone local ver="$(_version_srb2)" ver=${ver//\./} downloadAndExtract "https://github.com/STJr/SRB2/releases/download/SRB2_release_$(_version_srb2)/SRB2-v${ver}-Full.zip" "$md_build/assets" # patch detection for CMake < 3.18 if hasPackage cmake 3.18 lt; then applyPatch "$md_data/001-cmake-libfind.diff" fi } function build_srb2() { rm -fr build && mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$md_inst" -DSRB2_SDL2_EXE_NAME=srb2 make md_ret_require="$md_build/build/bin/srb2" } function install_srb2() { md_ret_files=( 'build/bin/srb2' 'assets/characters.pk3' 'assets/srb2.pk3' 'assets/music.pk3' 'assets/zones.pk3' 'assets/README.txt' 'assets/LICENSE.txt' ) } function configure_srb2() { addPort "$md_id" "srb2" "Sonic Robo Blast 2" "pushd $md_inst; ./srb2; popd" moveConfigDir "$home/.srb2" "$md_conf_root/$md_id" } ================================================ FILE: scriptmodules/ports/steamlink.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="steamlink" rp_module_desc="Steam Link for Raspberry Pi 3 or later" rp_module_licence="PROP https://steamcommunity.com/app/353380/discussions/0/1743353164093954254/" rp_module_section="exp" rp_module_flags="!all rpi3 rpi4 rpi5" rp_module_help="Stream games from your computer with Steam" function depends_steamlink() { getDepends libxkbcommon-x11-0 libinput10 libpulse0 libx11-6 libx11-xcb1 cec-utils openssl } function install_bin_steamlink() { aptInstall steamlink } function remove_steamlink() { aptRemove steamlink } function configure_steamlink() { local sl_dir="$home/.local/share/SteamLink" local valve_dir="$home/.local/share/Valve Corporation" if [[ "$md_mode" == "install" ]]; then mkUserDir "$sl_dir" mkUserDir "$valve_dir" mkUserDir "$valve_dir/SteamLink" mkUserDir "$md_conf_root/$md_id" # create optional streaming_args.txt for user modification touch "$valve_dir/SteamLink/streaming_args.txt" chown "$__user":"$__group" "$valve_dir/SteamLink/streaming_args.txt" moveConfigFile "$valve_dir/SteamLink/streaming_args.txt" "$md_conf_root/$md_id/streaming_args.txt" fi addPort "$md_id" "steamlink" "Steam Link" "steamlink" } ================================================ FILE: scriptmodules/ports/supertux.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="supertux" rp_module_desc="SuperTux 2d scrolling platform" rp_module_licence="GPL3 https://raw.githubusercontent.com/SuperTux/supertux/master/LICENSE.txt" rp_module_section="opt" rp_module_flags="!mali" function _update_hook_supertux() { # to show as installed in retropie-setup 4.x hasPackage supertux && mkdir -p "$md_inst" } function install_bin_supertux() { aptInstall supertux } function remove_supertux() { aptRemove supertux supertux-data } function configure_supertux() { addPort "$md_id" "supertux" "SuperTux" "supertux2" } ================================================ FILE: scriptmodules/ports/tyrquake.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="tyrquake" rp_module_desc="Quake 1 engine - TyrQuake port" rp_module_licence="GPL2 https://disenchant.net/git/tyrquake.git/plain/gnu.txt" rp_module_repo="git https://github.com/RetroPie/tyrquake.git master" rp_module_section="opt" function depends_tyrquake() { local depends=(libsdl2-dev) if isPlatform "gl" || isPlatform "mesa"; then depends+=(libgl1-mesa-dev) fi getDepends "${depends[@]}" } function sources_tyrquake() { gitPullOrClone } function build_tyrquake() { local params=(USE_SDL=Y USE_XF86DGA=N) make clean make "${params[@]}" bin/tyr-quake bin/tyr-glquake md_ret_require=( "$md_build/bin/tyr-quake" "$md_build/bin/tyr-glquake" ) } function install_tyrquake() { md_ret_files=( 'changelog.txt' 'readme.txt' 'readme-id.txt' 'gnu.txt' 'bin' ) } function add_games_tyrquake() { local params=("-basedir $romdir/ports/quake" "-game %QUAKEDIR%") local binary="$md_inst/bin/tyr-quake" isPlatform "kms" && params+=("-width %XRES%" "-height %YRES%" "+set vid_vsync 2") if isPlatform "gl" || isPlatform "mesa"; then binary="$md_inst/bin/tyr-glquake" fi _add_games_lr-tyrquake "$binary ${params[*]}" } function configure_tyrquake() { mkRomDir "ports/quake" [[ "$md_mode" == "install" ]] && game_data_lr-tyrquake add_games_tyrquake moveConfigDir "$home/.tyrquake" "$md_conf_root/quake/tyrquake" } ================================================ FILE: scriptmodules/ports/uqm.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="uqm" rp_module_desc="The Ur-Quan Masters (Port of DOS game Star Control 2)" rp_module_licence="GPL https://sourceforce.net/p/sc2/uqm/ci/master/tree/sc2/COPYING?format=raw" rp_module_repo="file :_get_archive_uqm" rp_module_section="exp" function _get_ver_uqm() { echo "0.8.0" } function _update_hook_uqm() { # to show as installed in retropie-setup 4.x hasPackage uqm && mkdir -p "$md_inst" } function _get_archive_uqm() { echo "$__archive_url/uqm-$(_get_ver_uqm)-src.tgz" } function depends_uqm() { getDepends libsdl2-dev libogg-dev libvorbis-dev libpng-dev zlib1g-dev } function sources_uqm() { downloadAndExtract "$(rp_resolveRepoParam "$md_repo_url")" "$md_build" --strip-components 1 local packages="$md_build/content/packages" mkdir -p "$packages" local addons="$md_build/content/addons" mkdir -p "$addons" local ver="$(_get_ver_uqm)" download "$__archive_url/uqm-${ver}-content.uqm" "$packages" download "$__archive_url/uqm-${ver}-voice.uqm" "$addons" download "$__archive_url/uqm-${ver}-3domusic.uqm" "$addons" } function build_uqm() { ./build.sh uqm clean echo "\n" | CHOICE_debug_VALUE="nodebug" INPUT_install_prefix_VALUE="$md_inst" ./build.sh uqm config ./build.sh uqm md_ret_require="$md_build/src/uqm" } function install_uqm() { ./build.sh uqm install } function configure_uqm() { addPort "$md_id" "uqm" "Ur-quan Masters" "$md_inst/bin/uqm -f" [[ "$md_mode" == "remove" ]] && return moveConfigDir "$home/.uqm" "$md_conf_root/uqm" } ================================================ FILE: scriptmodules/ports/vvvvvv.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="vvvvvv" rp_module_desc="VVVVVV - 2D puzzle game by Terry Cavanagh" rp_module_licence="NONCOM https://raw.githubusercontent.com/TerryCavanagh/VVVVVV/master/LICENSE.md" rp_module_repo="git https://github.com/TerryCavanagh/VVVVVV master 39abcfa8" rp_module_help="Copy data.zip from a purchased or Make and Play edition of VVVVVV to $romdir/ports/vvvvvv" rp_module_section="exp" function depends_vvvvvv() { getDepends cmake libsdl2-dev libsdl2-mixer-dev } function sources_vvvvvv() { gitPullOrClone # default to fullscreen sed -i "s/fullscreen = false/fullscreen = true/" "$md_build/desktop_version/src/Game.cpp" } function build_vvvvvv() { cmake desktop_version rpSwap on 1500 make clean make rpSwap off md_ret_require="$md_build/VVVVVV" } function install_vvvvvv() { md_ret_files=( 'LICENSE.md' 'VVVVVV' ) } function configure_vvvvvv() { addPort "$md_id" "vvvvvv" "VVVVVV" "$md_inst/VVVVVV" local file="$romdir/ports/VVVVVV.sh" # add a check to launch script - if the data file is not found, inform user cat >"$file" << _EOF_ #!/bin/bash if [[ ! -f "$romdir/ports/vvvvvv/data.zip" ]]; then dialog --no-cancel --pause "The data.zip file is missing. Please ensure it is placed in $romdir/ports/vvvvvv/." 22 76 15 else "$rootdir/supplementary/runcommand/runcommand.sh" 0 _PORT_ vvvvvv "$md_inst/VVVVVV" fi _EOF_ chown "$__user":"$__group" "$file" chmod +x "$file" [[ "$md_mode" != "install" ]] && return moveConfigDir "$home/.local/share/VVVVVV" "$md_conf_root/vvvvvv" mkUserDir "$romdir/ports/$md_id" # symlink game data ln -snf "$romdir/ports/$md_id/data.zip" "$md_inst/data.zip" } ================================================ FILE: scriptmodules/ports/wolf4sdl.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="wolf4sdl" rp_module_desc="Wolf4SDL - port of Wolfenstein 3D / Spear of Destiny engine" rp_module_licence="GPL2 https://raw.githubusercontent.com/AryanWolf3D/Wolf4SDL/master/license-gpl.txt" rp_module_repo="git https://github.com/AryanWolf3D/Wolf4SDL.git master" rp_module_section="opt" rp_module_flags="sdl2" function depends_wolf4sdl() { getDepends libsdl2-dev libsdl2-mixer-dev rename } function sources_wolf4sdl() { gitPullOrClone } function _get_opts_wolf4sdl() { echo 'wolf4sdl-sw-v14 -DCARMACIZED -DUPLOAD' # shareware v1.4 echo 'wolf4sdl-3dr-v14 -DCARMACIZED' # 3d realms / apogee v1.4 full echo 'wolf4sdl-gt-v14 -DCARMACIZED -DGOODTIMES' # gt / id / activision v1.4 full echo 'wolf4sdl-spear -DCARMACIZED -DGOODTIMES -DSPEAR' # spear of destiny echo 'wolf4sdl-spear-sw -DCARMACIZED -DSPEARDEMO -DSPEAR' # spear of destiny demo } function add_games_wolf4sdl() { declare -A -g games_wolf4sdl=( ['vswap.wl1']="Wolfenstein 3D demo" ['vswap.wl6']="Wolfenstein 3D" ['vswap.sd1']="Wolfenstein 3D - Spear of Destiny Ep 1" ['vswap.sd2']="Wolfenstein 3D - Spear of Destiny Ep 2" ['vswap.sd3']="Wolfenstein 3D - Spear of Destiny Ep 3" ['vswap.sdm']="Wolfenstein 3D - Spear of Destiny Demo" ) add_ports_wolf4sdl "$md_inst/bin/wolf4sdl.sh %ROM%" "wolf3d" } function add_ports_wolf4sdl() { local port="$2" local cmd="$1" local game local wad for game in "${!games_wolf4sdl[@]}"; do wad="$romdir/ports/wolf3d/$game" if [[ -f "$wad" ]]; then addPort "$md_id" "$port" "${games_wolf4sdl[$game]}" "$cmd" "$wad" fi done } function build_wolf4sdl() { mkdir -p "bin" local opt while read -r opt; do local bin="${opt%% *}" local defs="${opt#* }" make clean CFLAGS+=" -DVERSIONALREADYCHOSEN -DGPL $defs" make mv wolf4sdl "bin/$bin" md_ret_require+=("bin/$bin") done < <(_get_opts_wolf4sdl) } function install_wolf4sdl() { mkdir -p "$md_inst/share/man" cp -Rv "$md_build/man6" "$md_inst/share/man/" md_ret_files=('bin') } function game_data_wolf4sdl() { pushd "$romdir/ports/wolf3d" rename 'y/A-Z/a-z/' * popd if [[ ! -f "$romdir/ports/wolf3d/vswap.wl6" && ! -f "$romdir/ports/wolf3d/vswap.wl1" ]]; then cd "$__tmpdir" # Get shareware game data downloadAndExtract "http://maniacsvault.net/ecwolf/files/shareware/wolf3d14.zip" "$romdir/ports/wolf3d" -j -LL fi if [[ ! -f "$romdir/ports/wolf3d/vswap.sdm" && ! -f "$romdir/ports/wolf3d/vswap.sod" ]]; then cd "$__tmpdir" # Get shareware game data downloadAndExtract "http://maniacsvault.net/ecwolf/files/shareware/soddemo.zip" "$romdir/ports/wolf3d" -j -LL fi chown -R "$__user":"$__group" "$romdir/ports/wolf3d" } function configure_wolf4sdl() { local game mkRomDir "ports/wolf3d" # remove obsolete emulator entries while read game; do delEmulator "${game%% *}" "wolf3d" done < <(_get_opts_wolf4sdl; echo -e "wolf4sdl-spear2\nwolf4sdl-spear3") if [[ "$md_mode" == "install" ]]; then game_data_wolf4sdl cat > "$md_inst/bin/wolf4sdl.sh" << _EOF_ #!/bin/bash function get_md5sum() { local file="\$1" [[ -n "\$file" ]] && md5sum "\$file" 2>/dev/null | cut -d" " -f1 } function launch_wolf4sdl() { local wad_file="\$1" declare -A game_checksums=( ['6efa079414b817c97db779cecfb081c9']="wolf4sdl-sw-v14" ['a6d901dfb455dfac96db5e4705837cdb']="wolf4sdl-3dr-v14" ['b8ff4997461bafa5ef2a94c11f9de001']="wolf4sdl-gt-v14" ['b1dac0a8786c7cdbb09331a4eba00652']="wolf4sdl-spear --mission 1" ['25d92ac0ba012a1e9335c747eb4ab177']="wolf4sdl-spear --mission 2" ['94aeef7980ef640c448087f92be16d83']="wolf4sdl-spear --mission 3" ['e3e87518f51414872c454b7d72a45af6']="wolf4sdl-spear --mission 3" ['35afda760bea840b547d686a930322dc']="wolf4sdl-spear-sw" ) if [[ "\${game_checksums[\$(get_md5sum \$wad_file)]}" ]] 2>/dev/null; then pushd "$romdir/ports/wolf3d" $md_inst/bin/\${game_checksums[\$(get_md5sum \$wad_file)]} popd else echo "Error: \$wad_file (md5: \$(get_md5sum \$wad_file)) is not a supported version" fi } launch_wolf4sdl "\$1" _EOF_ chmod +x "$md_inst/bin/wolf4sdl.sh" fi add_games_wolf4sdl moveConfigDir "$home/.wolf4sdl" "$md_conf_root/wolf3d" } ================================================ FILE: scriptmodules/ports/xrick.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="xrick" rp_module_desc="xrick - Open source implementation of Rick Dangerous" rp_module_help="Install the xrick data.zip to $romdir/ports/xrick/data.zip" rp_module_licence="GPL https://raw.githubusercontent.com/RetroPie/xrick/master/README" rp_module_repo="git https://github.com/RetroPie/xrick.git master" rp_module_section="opt" rp_module_flags="sdl1" function depends_xrick() { getDepends libsdl1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev zlib1g } function sources_xrick() { gitPullOrClone } function build_xrick() { make clean make md_ret_require="$md_build/xrick" } function install_xrick() { md_ret_files=( 'README' 'xrick' ) } function configure_xrick() { addPort "$md_id" "xrick" "XRick" "$md_inst/xrick.sh -fullscreen" "$romdir/ports/xrick/data.zip" [[ "$md_mode" == "remove" ]] && return ln -sf "$romdir/ports/xrick/data.zip" "$md_inst/data.zip" # set dispmanx by default on rpi with fkms isPlatform "dispmanx" && ! isPlatform "videocore" && setBackend "$md_id" "dispmanx" # on KMS and without dispmanx, use sdl12-compat ! isPlatform "dispmanx" && isPlatform "kms" && setBackend "$md_id" "sdl12-compat" local file="$md_inst/xrick.sh" cat >"$file" << _EOF_ #!/usr/bin/env bash pushd "$md_inst" ./xrick "\$@" popd _EOF_ chmod +x "$file" } ================================================ FILE: scriptmodules/ports/yquake2/hotkey_exit.diff ================================================ diff --git a/src/client/input/sdl2.c b/src/client/input/sdl2.c index 527e3f5c..1c693749 100644 --- a/src/client/input/sdl2.c +++ b/src/client/input/sdl2.c @@ -94,10 +94,11 @@ typedef enum // IN_Update() called at the beginning of a frame to the // actual movement functions called at a later time. static float mouse_x, mouse_y; -static unsigned char joy_escbutton = SDL_CONTROLLER_BUTTON_START; static int joystick_left_x, joystick_left_y, joystick_right_x, joystick_right_y; static qboolean mlooking; +static qboolean hotkey_back = false; // RetroPie Hotkey is Back instead of Guide + // The last time input events were processed. // Used throughout the client. int sys_frame_time; @@ -857,6 +858,7 @@ IN_Update(void) static qboolean left_trigger = false; static qboolean right_trigger = false; static qboolean left_stick[4] = {false, false, false, false}; // left, right, up, down virtual keys + static qboolean hotkey_pressed = false; // is Hotkey in RetroPie pressed static int consoleKeyCode = 0; @@ -1057,9 +1059,22 @@ IN_Update(void) qboolean down = (event.type == SDL_CONTROLLERBUTTONDOWN); unsigned char btn = event.cbutton.button; - // Handle Esc button first, to override its original key - Key_Event( (btn == joy_escbutton)? K_ESCAPE : K_JOY_FIRST_BTN + btn, - down, true ); + switch (btn) + { + case SDL_CONTROLLER_BUTTON_START: + if (hotkey_pressed && down) + Cbuf_AddText("quit"); + else + Key_Event( K_ESCAPE, down, true ); + break; + + case SDL_CONTROLLER_BUTTON_BACK: + if (hotkey_back) + case SDL_CONTROLLER_BUTTON_GUIDE: + hotkey_pressed = down; + default: + Key_Event( K_JOY_FIRST_BTN + btn, down, true ); + } break; } @@ -2524,22 +2539,6 @@ IN_Controller_Init(qboolean notify_user) SDL_Joystick *joystick = NULL; SDL_bool is_controller = SDL_FALSE; - cvar = Cvar_Get("joy_escbutton", "0", CVAR_ARCHIVE); - if (cvar) - { - switch ((int)cvar->value) - { - case 1: - joy_escbutton = SDL_CONTROLLER_BUTTON_BACK; - break; - case 2: - joy_escbutton = SDL_CONTROLLER_BUTTON_GUIDE; - break; - default: - joy_escbutton = SDL_CONTROLLER_BUTTON_START; - } - } - cvar = Cvar_Get("in_initjoy", "1", CVAR_NOSET); if (!cvar->value) { @@ -2685,6 +2684,7 @@ IN_Controller_Init(qboolean notify_user) show_gamepad = true; Com_Printf("Enabled as Game Controller, settings:\n%s\n", SDL_GameControllerMapping(controller)); + hotkey_back = ( !strstr(SDL_GameControllerMapping(controller), "guide:") ); #ifndef NO_SDL_GYRO @@ -2960,6 +2960,7 @@ IN_Controller_Shutdown(qboolean notify_user) joystick_left_x = joystick_left_y = joystick_right_x = joystick_right_y = 0; joy_active_layout = LAYOUT_NONE; gyro_enabled = false; + hotkey_back = false; #ifdef NO_SDL_GYRO if (imu_joystick) ================================================ FILE: scriptmodules/ports/yquake2/sdl2_joylabels.diff ================================================ diff --git a/src/client/cl_keyboard.c b/src/client/cl_keyboard.c index 20ba3fcc..c9b24c41 100644 --- a/src/client/cl_keyboard.c +++ b/src/client/cl_keyboard.c @@ -216,10 +216,10 @@ static char *gamepadbtns[] = // It is imperative that this list of buttons follow EXACTLY the order they // appear in QKEYS enum in keyboard.h, which in turn is the same order as // they appear in SDL_GamepadButton / SDL_GameControllerButton enum. - "BTN_SOUTH", - "BTN_EAST", - "BTN_WEST", - "BTN_NORTH", + "BTN_A", + "BTN_B", + "BTN_X", + "BTN_Y", "BTN_BACK", "BTN_GUIDE", "BTN_START", @@ -245,10 +245,10 @@ static char *gamepadbtns[] = "TRIG_LEFT", "TRIG_RIGHT", // Same with _ALT buttons ( button + 'alt modifier' pressed ) - "BTN_SOUTH_ALT", - "BTN_EAST_ALT", - "BTN_WEST_ALT", - "BTN_NORTH_ALT", + "BTN_A_ALT", + "BTN_B_ALT", + "BTN_X_ALT", + "BTN_Y_ALT", "BTN_BACK_ALT", "BTN_GUIDE_ALT", "BTN_START_ALT", diff --git a/src/client/input/sdl2.c b/src/client/input/sdl2.c index 1c693749..2921a498 100644 --- a/src/client/input/sdl2.c +++ b/src/client/input/sdl2.c @@ -2559,9 +2559,6 @@ IN_Controller_Init(qboolean notify_user) #ifdef SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE SDL_SetHint( SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1" ); #endif -#ifdef SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS // use button positions instead of labels, like SDL3 - SDL_SetHint( SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, "0" ); -#endif if (SDL_Init(SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC) == -1) { @@ -2878,8 +2875,8 @@ IN_Init(void) joy_forwardsensitivity = Cvar_Get("joy_forwardsensitivity", "1.0", CVAR_ARCHIVE); joy_sidesensitivity = Cvar_Get("joy_sidesensitivity", "1.0", CVAR_ARCHIVE); - joy_labels = Cvar_Get("joy_labels", "-1", CVAR_ARCHIVE); - joy_confirm = Cvar_Get("joy_confirm", "-1", CVAR_ARCHIVE); + joy_labels = Cvar_Get("joy_labels", "0", CVAR_ARCHIVE); + joy_confirm = Cvar_Get("joy_confirm", "0", CVAR_ARCHIVE); joy_layout = Cvar_Get("joy_layout", "0", CVAR_ARCHIVE); joy_left_expo = Cvar_Get("joy_left_expo", "2.0", CVAR_ARCHIVE); joy_left_snapaxis = Cvar_Get("joy_left_snapaxis", "0.15", CVAR_ARCHIVE); ================================================ FILE: scriptmodules/ports/yquake2/yq2.cfg ================================================ // Default gamepad controls bind SHOULDR_LEFT "+movedown" bind TRIG_LEFT "+moveup" bind SHOULDR_RIGHT "+joyaltselector" bind TRIG_RIGHT "+attack" bind BTN_A "+movedown" bind BTN_B "+moveup" bind BTN_X "weapprev" bind BTN_Y "weapnext" bind BTN_BACK "cmd help" bind BTN_GUIDE "+joyaltselector" bind STICK_LEFT "+gyroaction" bind STICK_RIGHT "centerview" bind DP_UP "cycleweap weapon_plasmabeam weapon_boomer weapon_chaingun weapon_etf_rifle weapon_machinegun weapon_blaster" bind DP_DOWN "cycleweap weapon_supershotgun weapon_shotgun weapon_chainfist" bind DP_LEFT "cycleweap weapon_phalanx weapon_rocketlauncher weapon_proxlauncher weapon_grenadelauncher ammo_grenades" bind DP_RIGHT "cycleweap weapon_bfg weapon_disintegrator weapon_railgun weapon_hyperblaster ammo_tesla ammo_trap" bind BTN_X_ALT "invdrop" bind BTN_Y_ALT "invuse" bind BTN_BACK_ALT "inven" bind DP_UP_ALT "invprev" bind DP_DOWN_ALT "invnext" bind DP_LEFT_ALT "invprev" bind DP_RIGHT_ALT "invnext" // Gameplay options, check YQ2 documentation set cl_run "1" set aimfix "1" set g_machinegun_norecoil "1" set g_quick_weap "1" set g_swap_speed "2" // Audio options set s_openal "0" set ogg_ignoretrack0 "1" // Video options set vid_renderer "soft" set gl_znear "3.2" set gl1_discardfb "1" set gl1_lightmapcopies "1" set gl1_pointparameters "0" set r_mode "-2" ================================================ FILE: scriptmodules/ports/yquake2.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="yquake2" rp_module_desc="yquake2 - The Yamagi Quake II client" rp_module_licence="GPL2 https://raw.githubusercontent.com/yquake2/yquake2/master/LICENSE" rp_module_repo="git https://github.com/yquake2/yquake2.git QUAKE2_8_60" rp_module_section="exp" rp_module_flags="sdl2" function depends_yquake2() { local depends=(libgl1-mesa-dev libglu1-mesa-dev libogg-dev libopenal-dev libsdl2-dev libvorbis-dev zlib1g-dev libcurl4-openssl-dev) getDepends "${depends[@]}" } function sources_yquake2() { gitPullOrClone # get the add-ons sources gitPullOrClone "$md_build/xatrix" "https://github.com/yquake2/xatrix" "XATRIX_2_16" gitPullOrClone "$md_build/rogue" "https://github.com/yquake2/rogue" "ROGUE_2_15" # 1st enables Guide+Start to quit. 2nd restores buttons to SDL2 style (from SDL3). applyPatch "$md_data/hotkey_exit.diff" applyPatch "$md_data/sdl2_joylabels.diff" } function build_yquake2() { local params=(config client game ref_soft) local repo isPlatform "gl" || isPlatform "mesa" && params+=(ref_gl1) isPlatform "gl3" && params+=(ref_gl3) isPlatform "gles" && [[ "$__os_debian_ver" -lt 12 ]] && params+=(ref_gles1) isPlatform "gles3" && params+=(ref_gles3) make clean make ${params[@]} # build the add-ons source for repo in 'xatrix' 'rogue'; do make -C "$repo" clean make -C "$repo" # add-ons: rename the 'release' folder so it's installed under '$repo' by the install func [[ -f "$repo/release/game.so" ]] && mv "$repo/release" "$repo/$repo" done md_ret_require="$md_build/release/quake2" } function install_yquake2() { md_ret_files=( 'release/baseq2' 'release/quake2' 'release/ref_soft.so' 'LICENSE' 'README.md' 'xatrix/xatrix' 'rogue/rogue' ) isPlatform "gl" || isPlatform "mesa" && md_ret_files+=('release/ref_gl1.so') isPlatform "gl3" && md_ret_files+=('release/ref_gl3.so') isPlatform "gles" && [[ "$__os_debian_ver" -lt 12 ]] && md_ret_files+=('release/ref_gles1.so') isPlatform "gles3" && md_ret_files+=('release/ref_gles3.so') } function add_games_yquake2() { local cmd="$1" declare -A games=( ['baseq2']="Quake II" ['xatrix']="Quake II XP1 - The Reckoning" ['rogue']="Quake II XP2 - Ground Zero" ) local game for game in "${!games[@]}"; do if [[ -f "$romdir/ports/quake2/$game/pak0.pak" ]]; then addPort "$md_id" "quake2" "${games[$game]}" "$cmd" "$game" fi done } function game_data_yquake2() { if [[ ! -f "$romdir/ports/quake2/baseq2/pak1.pak" && ! -f "$romdir/ports/quake2/baseq2/pak0.pak" ]]; then # get shareware game data downloadAndExtract "https://deponie.yamagi.org/quake2/idstuff/q2-314-demo-x86.exe" "$romdir/ports/quake2/baseq2" -j -LL # remove files that are likely to cause conflicts or unwanted default settings local unwanted for unwanted in $(find "$romdir/ports/quake2" -maxdepth 2 -name "*.so" -o -name "*.cfg" -o -name "*.dll" -o -name "*.exe"); do rm -f "$unwanted" done fi chown -R "$__user":"$__group" "$romdir/ports/quake2" } function configure_yquake2() { local config="$md_conf_root/quake2/yquake2/baseq2/yq2.cfg" local renderer="soft" mkRomDir "ports/quake2" moveConfigDir "$home/.yq2" "$md_conf_root/quake2/yquake2" mkUserDir "$md_conf_root/quake2/yquake2/baseq2" copyDefaultConfig "$md_data/yq2.cfg" "$config" iniConfig " " '"' "$config" # Don't apply GL1 mobile optimizations to x86 if isPlatform "x86"; then iniSet "set gl1_discardfb" "0" iniSet "set gl1_lightmapcopies" "0" iniSet "set gl1_pointparameters" "1" iniSet "set s_openal" "1" fi # Select most efficient renderer as default if isPlatform "gl3"; then renderer="gl3" elif isPlatform "gles3"; then renderer="gles3" elif isPlatform "gles" && [[ "$__os_debian_ver" -lt 11 ]]; then renderer="gles1" iniSet "set gl1_pointparameters" "1" elif isPlatform "gl" || isPlatform "mesa"; then renderer="gl1" fi iniSet "set vid_renderer" "$renderer" [[ "$md_mode" == "install" ]] && game_data_yquake2 add_games_yquake2 "$md_inst/quake2 -datadir $romdir/ports/quake2 +set game %ROM%" } ================================================ FILE: scriptmodules/supplementary/attractmode.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="attractmode" rp_module_desc="Attract Mode emulator frontend" rp_module_licence="GPL3 https://raw.githubusercontent.com/mickelson/attract/master/License.txt" rp_module_repo="git https://github.com/mickelson/attract master" rp_module_section="exp" rp_module_flags="!mali frontend" function _get_configdir_attractmode() { echo "$configdir/all/attractmode" } function _add_system_attractmode() { local attract_dir="$(_get_configdir_attractmode)" [[ ! -d "$attract_dir" || ! -f /usr/bin/attract ]] && return 0 local fullname="$1" local name="$2" local path="$3" local extensions="$4" local command="$5" local platform="$6" local theme="$7" # replace any / characters in fullname fullname="${fullname//\/}" local config="$attract_dir/emulators/$fullname.cfg" iniConfig " " "" "$config" # replace %ROM% with "[romfilename]" and convert to array command=(${command//%ROM%/\"[romfilename]\"}) iniSet "executable" "${command[0]}" iniSet "args" "${command[*]:1}" iniSet "rompath" "$path" iniSet "system" "$fullname" # extensions separated by semicolon extensions="${extensions// /;}" iniSet "romext" "$extensions" # snap path local snap="snap" [[ "$name" == "retropie" ]] && snap="icons" iniSet "artwork flyer" "$path/flyer" iniSet "artwork marquee" "$path/marquee" iniSet "artwork snap" "$path/$snap" iniSet "artwork wheel" "$path/wheel" chown "$__user":"$__group" "$config" # if no gameslist, generate one if [[ ! -f "$attract_dir/romlists/$fullname.txt" ]]; then sudo -u "$__user" attract --build-romlist "$fullname" -o "$fullname" fi local config="$attract_dir/attract.cfg" local tab=$'\t' if [[ -f "$config" ]] && ! grep -q "display$tab$fullname" "$config"; then cp "$config" "$config.bak" cat >>"$config" <<_EOF_ display${tab}$fullname ${tab}layout Basic ${tab}romlist $fullname _EOF_ chown "$__user":"$__group" "$config" fi } function _del_system_attractmode() { local attract_dir="$(_get_configdir_attractmode)" [[ ! -d "$attract_dir" ]] && return 0 local fullname="$1" local name="$2" # Don't remove an empty system [[ -z "$fullname" ]] && return 0 # replace any / characters in fullname fullname="${fullname//\/}" rm -rf "$attract_dir/romlists/$fullname.txt" local tab=$'\t' # remove display block from "^display$tab$fullname" to next "^display" or empty line keeping the next display line sed -i "/^display$tab$fullname/,/^display\|^$/{/^display$tab$fullname/d;/^display\$/!d}" "$attract_dir/attract.cfg" } function _add_rom_attractmode() { local attract_dir="$(_get_configdir_attractmode)" [[ ! -d "$attract_dir" ]] && return 0 local system_name="$1" local system_fullname="$2" local path="$3" local name="$4" local desc="$5" local image="$6" local config="$attract_dir/romlists/$system_fullname.txt" # remove extension path="${path/%.*}" if [[ ! -f "$config" ]]; then echo "#Name;Title;Emulator;CloneOf;Year;Manufacturer;Category;Players;Rotation;Control;Status;DisplayCount;DisplayType;AltRomname;AltTitle;Extra;Buttons" >"$config" fi # if the entry already exists, remove it if grep -q "^$path;" "$config"; then sed -i "/^$path/d" "$config" fi echo "$path;$name;$system_fullname;;;;;;;;;;;;;;" >>"$config" chown "$__user":"$__group" "$config" } function depends_attractmode() { local depends=( cmake fonts-freefont-ttf libflac-dev libcurl4-openssl-dev libogg-dev libvorbis-dev libopenal-dev libfreetype6-dev libudev-dev libjpeg-dev libudev-dev libavutil-dev libavcodec-dev libavformat-dev libavfilter-dev libswscale-dev libswresample-dev libfontconfig1-dev ) isPlatform "videocore" && depends+=(libraspberrypi-dev) isPlatform "kms" && depends+=(libegl1-mesa-dev libgl-dev libglu1-mesa-dev libdrm-dev libgbm-dev) isPlatform "x11" && depends+=(libsfml-dev) getDepends "${depends[@]}" } function sources_attractmode() { gitPullOrClone "$md_build/attract" isPlatform "rpi" && gitPullOrClone "$md_build/sfml-pi" "https://github.com/mickelson/sfml-pi" } function build_attractmode() { if isPlatform "rpi"; then local params cd sfml-pi isPlatform "videocore" && params="-DSFML_RPI=1 -DEGL_INCLUDE_DIR=/opt/vc/include -DEGL_LIBRARY=/opt/vc/lib/libbrcmEGL.so -DGLES_INCLUDE_DIR=/opt/vc/include -DGLES_LIBRARY=/opt/vc/lib/libbrcmGLESv2.so" isPlatform "kms" && params="-DSFML_DRM=1" cmake . -DCMAKE_INSTALL_PREFIX="$md_inst/sfml" $params make clean make cd .. fi cd attract make clean local params=(prefix="$md_inst") isPlatform "videocore" && params+=(USE_GLES=1 EXTRA_CXXFLAGS="$CFLAGS -I$md_build/sfml-pi/include -L$md_build/sfml-pi/lib") isPlatform "kms" && params+=(USE_DRM=1 EXTRA_CXXFLAGS="$CFLAGS -I$md_build/sfml-pi/include -L$md_build/sfml-pi/lib") isPlatform "rpi" && params+=(USE_MMAL=1) make "${params[@]}" # remove example configs rm -rf "$md_build/attract/config/emulators/"* md_ret_require="$md_build/attract/attract" } function install_attractmode() { make -C sfml-pi install mkdir -p "$md_inst"/{bin,share,share/attract} cp -v attract/attract "$md_inst/bin/" cp -Rv attract/config/* "$md_inst/share/attract" } function remove_attractmode() { rm -f /usr/bin/attract } function configure_attractmode() { moveConfigDir "$home/.attract" "$md_conf_root/all/attractmode" [[ "$md_mode" == "remove" ]] && return local config="$md_conf_root/all/attractmode/attract.cfg" if [[ ! -f "$config" ]]; then echo "general" >"$config" echo -e "\twindow_mode fullscreen" >>"$config" fi mkUserDir "$md_conf_root/all/attractmode/emulators" cat >/usr/bin/attract <<_EOF_ #!/bin/bash MODELIST=/opt/retropie/supplementary/kmsxx/kmsprint-rp if [[ -z "\$DISPLAY" && -f "\$MODELIST" && ! "\$1" =~ build-romlist ]]; then MODELIST="\$(\$MODELIST 2>/dev/null)" default_mode="\$(echo "\$MODELIST" | grep -Em1 "^Mode: [0-9]+ crtc" | grep -oE [0-9]+x[0-9]+)" default_vrefresh="\$(echo "\$MODELIST" | grep -Em1 "^Mode: [0-9]+ crtc" | grep -oE [0-9]+Hz)" # Strip Hz from the refresh rate default_vrefresh="\${default_vrefresh%Hz}" echo "Using default video mode: \$default_mode @ \$default_vrefresh" [[ ! -z "\$default_mode" ]] && export SFML_DRM_MODE="\$default_mode" [[ ! -z "\$default_vrefresh" ]] && export SFML_DRM_REFRESH="\$default_vrefresh" fi LD_LIBRARY_PATH="$md_inst/sfml/lib" "$md_inst/bin/attract" "\$@" _EOF_ chmod +x "/usr/bin/attract" local id for id in "${__mod_id[@]}"; do if rp_isInstalled "$id" && [[ -n "${__mod_info[$id/section]}" ]] && ! hasFlag "${__mod_info[$id/flags]}" "frontend"; then rp_callModule "$id" configure fi done } ================================================ FILE: scriptmodules/supplementary/audiosettings.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="audiosettings" rp_module_desc="Configure audio settings" rp_module_section="config" rp_module_flags="!all rpi" function depends_audiosettings() { if [[ "$md_mode" == "install" ]]; then getDepends alsa-utils fi } function gui_audiosettings() { # Check if the internal audio is enabled if [[ `aplay -ql | grep -e bcm2835 -e vc4hdmi | wc -l` < 1 ]]; then printMsgs "dialog" "On-board audio disabled or not present" return fi # The list of ALSA cards/devices depends on the 'snd-bcm2385' module parameter 'enable_compat_alsa' # * enable_compat_alsa: true - single soundcard, output is routed based on the `numid` control # * enable_compat_alsa: false - one soundcard per output type (HDMI/Headphones) # When PulseAudio/PipeWire is enabled, try to configure it and leave ALSA alone if _pa_cmd_audiosettings systemctl -q --user is-enabled {pulseaudio,pipewire-pulse}.service; then _pulseaudio_audiosettings elif aplay -l | grep -q "bcm2835 ALSA"; then _bcm2835_alsa_compat_audiosettings else _bcm2835_alsa_internal_audiosettings fi } function _reset_alsa_audiosettings() { /etc/init.d/alsa-utils reset alsactl store rm -f "$home/.asoundrc" "/etc/alsa/conf.d/99-retropie.conf" printMsgs "dialog" "Audio settings reset to defaults" } function _move_old_config_audiosettings() { if [[ -f "$home/.asoundrc" && ! -f "/etc/alsa/conf.d/99-retropie.conf" ]]; then if dialog --yesno "The ALSA audio configuration for RetroPie has moved from $home/.asoundrc to /etc/alsa/conf.d/99-retropie.conf\n\nYou have a configuration in $home/.asoundrc - do you want to move it to the new location? If $home/.asoundrc contains your own changes you should choose 'No'." 20 76 2>&1 >/dev/tty; then mkdir -p /etc/alsa/conf.d mv "$home/.asoundrc" "/etc/alsa/conf.d/" fi fi } function _bcm2835_alsa_compat_audiosettings() { _move_old_config_audiosettings local cmd=(dialog --backtitle "$__backtitle" --menu "Set audio output (ALSA - compat)" 22 86 16) local hdmi="HDMI" # the Pi 4/5 have 2 HDMI ports, so number them (isPlatform "rpi4" || isPlatform "rpi5") && hdmi="HDMI 1" local options=( 1 "Auto" 2 "Headphones - 3.5mm jack" 3 "$hdmi" ) # add 2nd HDMI port on the Pi 4/5 (isPlatform "rpi4" || isPlatform "rpi5") && options+=(4 "HDMI 2") options+=( M "Mixer - adjust output volume" R "Reset to default" ) # If PulseAudio (PipeWire) is installed, add an option to enable it local sound_server="PulseAudio" if hasPackage "wireplumber"; then options+=(P "Enable PipeWire") else hasPackage "pulseaudio" && options+=(P "Enable PulseAudio") fi choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) amixer cset numid=3 0 alsactl store printMsgs "dialog" "Set audio output to Auto" ;; 2) amixer cset numid=3 1 alsactl store printMsgs "dialog" "Set audio output to Headphones - 3.5mm jack" ;; 3) amixer cset numid=3 2 alsactl store printMsgs "dialog" "Set audio output to $hdmi" ;; 4) amixer cset numid=3 3 alsactl store printMsgs "dialog" "Set audio output to HDMI 2" ;; M) alsamixer >/dev/tty &1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in [0-9]) _asoundrc_save_audiosettings $choice ${options[$((choice*2+1))]} printMsgs "dialog" "Set audio output to ${options[$((choice*2+1))]}" ;; M) alsamixer >/dev/tty "$tmpfile" pcm.hdmi${card_index} { type asym playback.pcm { type plug slave.pcm "hdmi:${card_name}" } } ctl.!default { type hw card $card_index } pcm.softvolume { type softvol slave.pcm "hdmi${card_index}" control.name "HDMI Playback Volume" control.card ${card_index} } pcm.softmute { type softvol slave.pcm "softvolume" control.name "HDMI Playback Switch" control.card ${card_index} resolution 2 } pcm.!default { type plug slave.pcm "softmute" } EOF else cat << EOF > "$tmpfile" pcm.!default { type asym playback.pcm { type plug slave.pcm "output" } } pcm.output { type hw card $card_index } ctl.!default { type hw card $card_index } EOF fi local dest="/etc/alsa/conf.d/99-retropie.conf" mkdir -p /etc/alsa/conf.d mv "$tmpfile" "$dest" chmod 644 "$dest" } function _pulseaudio_audiosettings() { local options=() local sinks=() local sink_index local sink_label local sound_server="PulseAudio" # Check if PulseAudio is running, otherwise 'pactl' will not work if ! _pa_cmd_audiosettings pactl info >/dev/null; then printMsgs "dialog" "PulseAudio is present, but not running.\nAudio settings cannot be set right now." return fi while read sink_index sink_label sink_id; do options+=("$sink_index" "$sink_label") sinks[$sink_index]=$sink_id done < <(_pa_cmd_audiosettings pactl list sinks | \ awk -F [:=#] 'BEGIN {idx=0} /Sink/ { ctl_index=$2 do {getline} while($0 !~ /card.name/ && $0 !~ /Formats/); if ( $2 != "" ) { gsub(/"|bcm2835[^a-zA-Z]+/, "", $2); # strip bcm2835 suffix on analog output gsub(/vc4[-]?/ , "", $2); # strip the vc4 suffix on HDMI output(s) if ( $2 ~ /hdmi/ ) $2=toupper($2) print idx,$2,ctl_index idx++ } }' ) _pa_cmd_audiosettings pactl info | grep -i pipewire >/dev/null && sound_server="PipeWire" local cmd=(dialog --backtitle "$__backtitle" --menu "Set audio output ($sound_server)" 22 86 16) options+=( M "Mixer - adjust output volume" R "Reset to default" P "Disable $sound_server" ) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in [0-9]*) _pa_cmd_audiosettings pactl set-default-sink ${sinks[$choice]} rm -f "/etc/alsa/conf.d/99-retropie.conf" printMsgs "dialog" "Set audio output to ${options[$((choice*2+1))]}" ;; M) _pa_cmd_audiosettings alsamixer >/dev/tty /dev/null } ================================================ FILE: scriptmodules/supplementary/autostart.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="autostart" rp_module_desc="Auto-start EmulationStation / Pegasus / Kodi on boot" rp_module_section="config" function _update_hook_autostart() { if [[ -f /etc/profile.d/10-emulationstation.sh ]]; then enable_autostart fi } function _autostart_script_autostart() { local mode="$1" # delete old startup script rm -f /etc/profile.d/10-emulationstation.sh local script="$configdir/all/autostart.sh" cat >/etc/profile.d/10-retropie.sh <<_EOF_ # launch our autostart apps (if we are on the correct tty and not in X) if [ "\`tty\`" = "/dev/tty1" ] && [ -z "\$DISPLAY" ] && [ "\$USER" = "$__user" ]; then bash "$script" fi _EOF_ touch "$script" # delete any previous entries for emulationstation / kodi in autostart.sh sed -i '/#auto/d' "$script" # make sure there is a newline sed -i '$a\' "$script" case "$mode" in kodi) echo -e "kodi-standalone #auto\nemulationstation #auto" >>"$script" ;; pegasus) echo "pegasus-fe #auto" >> "$script" ;; es|*) echo "emulationstation #auto" >>"$script" ;; esac chown "$__user":"$__group" "$script" } function enable_autostart() { local mode="$1" if isPlatform "x11"; then mkUserDir "$home/.config/autostart" ln -sf "/usr/local/share/applications/retropie.desktop" "$home/.config/autostart/" else if [[ "$__os_id" == "Raspbian" ]]; then # remove any old autologin.conf - we use raspi-config now rm -f /etc/systemd/system/getty@tty1.service.d/autologin.conf raspi-config nonint do_boot_behaviour B2 elif [[ "$(cat /proc/1/comm)" == "systemd" ]]; then mkdir -p /etc/systemd/system/getty@tty1.service.d/ cat >/etc/systemd/system/getty@tty1.service.d/autologin.conf <<_EOF_ [Service] ExecStart= ExecStart=-/sbin/agetty --autologin $__user --noclear %I \$TERM _EOF_ fi _autostart_script_autostart "$mode" fi } function disable_autostart() { local login_type="$1" [[ -z "$login_type" ]] && login_type="B2" if isPlatform "x11"; then rm "$home/.config/autostart/retropie.desktop" else if [[ "$__os_id" == "Raspbian" ]]; then if [[ "$__chroot" -eq 1 ]]; then systemctl set-default graphical.target ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service else raspi-config nonint do_boot_behaviour "$login_type" fi elif [[ "$(cat /proc/1/comm)" == "systemd" ]]; then rm -f /etc/systemd/system/getty@tty1.service.d/autologin.conf systemctl set-default graphical.target systemctl enable lightdm.service fi rm -f /etc/profile.d/10-emulationstation.sh rm -f /etc/profile.d/10-retropie.sh fi } function remove_autostart() { disable_autostart } function gui_autostart() { cmd=(dialog --backtitle "$__backtitle" --menu "Choose the desired boot behaviour." 22 76 16) local has_pegasus=0 local has_kodi=0 command -v pegasus-fe >/dev/null && has_pegasus=1 command -v kodi-standalone >/dev/null && has_kodi=1 while true; do if isPlatform "x11"; then local x11_autostart if [[ -f "$home/.config/autostart/retropie.desktop" ]]; then options=(1 "Autostart EmulationStation after login (Enabled)") x11_autostart=1 else options=(1 "Autostart EmulationStation after login (Disabled)") x11_autostart=0 fi else options=( 1 "Start EmulationStation at boot" ) [[ "$has_kodi" -eq 1 ]] && options+=(2 "Start Kodi at boot (exit starts EmulationStation)") [[ "$has_pegasus" -eq 1 ]] && options+=(3 "Start Pegasus at boot") options+=( E "Manually edit $configdir/all/autostart.sh" ) if [[ "$__os_id" == "Raspbian" ]]; then options+=( CL "Boot to text console (require login)" CA "Boot to text console (auto login as $__user)" ) fi options+=(DL "Boot to desktop (require login)") if [[ "$__os_id" == "Raspbian" ]]; then options+=(DA "Boot to desktop (auto login as $__user)") fi fi choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) if isPlatform "x11"; then if [[ "$x11_autostart" -eq 0 ]]; then enable_autostart printMsgs "dialog" "EmulationStation is set to autostart after login." else disable_autostart printMsgs "dialog" "Autostarting of EmulationStation is disabled." fi x11_autostart=$((x11_autostart ^ 1)) else enable_autostart printMsgs "dialog" "EmulationStation is set to launch at boot." fi ;; 2) enable_autostart kodi printMsgs "dialog" "Kodi is set to launch at boot." ;; 3) enable_autostart pegasus printMsgs "dialog" "Pegasus is set to launch at boot." ;; E) editFile "$configdir/all/autostart.sh" ;; CL) disable_autostart B1 printMsgs "dialog" "Booting to text console (require login)." ;; CA) disable_autostart B2 printMsgs "dialog" "Booting to text console (auto login as $__user)." ;; DL) disable_autostart B3 printMsgs "dialog" "Booting to desktop (require login)." ;; DA) disable_autostart B4 printMsgs "dialog" "Booting to desktop (auto login as $__user)." ;; esac else break fi done } ================================================ FILE: scriptmodules/supplementary/backends.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="backends" rp_module_desc="Configure display/driver backends for emulators" rp_module_section="config" rp_module_flags="!mali !x11" function _list_backends() { local id="$1" backends=() # skip the 'depends' packages [[ ${__mod_info[$id/section]} == "depends" ]] && return 1 local flags="${__mod_info[$id/flags]}" local sdl if isPlatform "videocore" && hasFlag "$flags" "sdl1-videocore"; then sdl="sdl1" elif hasFlag "$flags" "sdl1" || hasFlag "$flags" "dispmanx"; then sdl="sdl1" elif hasFlag "$flags" "sdl2"; then sdl="sdl2" else return 1 fi local default local sdl_name="${sdl^^}" if [[ "$sdl" == "sdl1" ]]; then backends["default"]="SDL1 Framebuffer driver" isPlatform "dispmanx" && backends["dispmanx"]="SDL1 DispmanX driver" isPlatform "kms" && ! isPlatform "dispmanx" && backends["sdl12-compat"]="SDL1 Compat driver" elif [[ "$sdl" == "sdl2" ]]; then if isPlatform "videocore"; then default="SDL2 videocore driver" elif isPlatform "kms"; then default="SDL2 KMS driver" fi backends["default"]="$default" fi backends["x11"]="$sdl_name on Desktop" backends["x11-c"]="$sdl_name on Desktop + Cursor" return 0 } function _update_hook_backends() { local dispmanx_cfg="$configdir/all/dispmanx.cfg" local backends_cfg="$configdir/all/backends.cfg" if [[ -f "$dispmanx_cfg" ]]; then mv "$dispmanx_cfg" "$backends_cfg" fi } function gui_backends() { declare -A backends local id local backend local default local flags local valid while true; do local options=() for id in "${__mod_id[@]}"; do valid=0 if rp_isInstalled "$id"; then if _list_backends "$id" >/dev/null; then backend="$(getBackend "$id")" options+=("$id" "Using ${backends[$backend]} ($backend)") fi fi done local cmd=(dialog --backtitle "$__backtitle" --default-item "$default" --menu "Configure display/driver backends for emulators" 22 76 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && break default="$choice" gui_configure_backends "$choice" done } function gui_configure_backends() { local id="$1" declare -A backends _list_backends "$id" while true; do local current="$(getBackend "$id")" local options=() local selected local backend local flags for backend in $(echo "${!backends[@]}" | xargs -n1 | sort); do selected="" [[ "$current" == "$backend" ]] && selected="(Currently selected)" options+=("$backend" "${backends[$backend]} $selected") done local cmd=(dialog --default-item "$current" --backtitle "$__backtitle" --menu "Select backend for $id" 22 76 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then if [[ "$choice" == "x11" ]] && ( ! hasPackage "xorg" || ! hasPackage "matchbox-window-manager" ); then if dialog --defaultno --yesno "To use the X11/Xorg backend, some additional packages are needed (xorg / matchbox-window-manager) - do you want to continue?" 22 76 2>&1 >/dev/tty; then aptInstall xorg matchbox-window-manager else continue fi fi if [[ "$choice" == "sdl12-compat" ]] && ! rp_isInstalled "sdl12-compat"; then rp_callModule "sdl12-compat" _auto_ fi local func="_backend_set_$id" if fnExists "$func"; then rp_callModule "$id" _backend_set "$choice" 1 else setBackend "$id" "$choice" 1 fi fi break done } ================================================ FILE: scriptmodules/supplementary/bashwelcometweak.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="bashwelcometweak" rp_module_desc="Bash Welcome Tweak (shows additional system info on login)" rp_module_section="config" function install_bashwelcometweak() { remove_bashwelcometweak cat >> "$home/.bashrc" <<\_EOF_ # RETROPIE PROFILE START function getIPAddress() { local ip_route ip_route=$(ip -4 route get 8.8.8.8 2>/dev/null) if [[ -z "$ip_route" ]]; then ip_route=$(ip -6 route get 2001:4860:4860::8888 2>/dev/null) fi [[ -n "$ip_route" ]] && grep -oP "src \K[^\s]+" <<< "$ip_route" } function retropie_welcome() { local upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)" local secs=$((upSeconds%60)) local mins=$((upSeconds/60%60)) local hours=$((upSeconds/3600%24)) local days=$((upSeconds/86400)) local UPTIME=$(printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs") # calculate rough CPU and GPU temperatures: local cpuTempC local cpuTempF local gpuTempC local gpuTempF if [[ -f "/sys/class/thermal/thermal_zone0/temp" ]]; then cpuTempC=$(($(cat /sys/class/thermal/thermal_zone0/temp)/1000)) && cpuTempF=$((cpuTempC*9/5+32)) fi if [[ -n $(command -v vcgencmd) ]]; then if gpuTempC=$(vcgencmd measure_temp); then gpuTempC=${gpuTempC:5:2} gpuTempF=$((gpuTempC*9/5+32)) else gpuTempC="" fi fi local df_out=() local line while read line; do df_out+=("$line") done < <(df -h /) local rst="$(tput sgr0)" local fgblk="${rst}$(tput setaf 0)" # Black - Regular local fgred="${rst}$(tput setaf 1)" # Red local fggrn="${rst}$(tput setaf 2)" # Green local fgylw="${rst}$(tput setaf 3)" # Yellow local fgblu="${rst}$(tput setaf 4)" # Blue local fgpur="${rst}$(tput setaf 5)" # Purple local fgcyn="${rst}$(tput setaf 6)" # Cyan local fgwht="${rst}$(tput setaf 7)" # White local bld="$(tput bold)" local bfgblk="${bld}$(tput setaf 0)" local bfgred="${bld}$(tput setaf 1)" local bfggrn="${bld}$(tput setaf 2)" local bfgylw="${bld}$(tput setaf 3)" local bfgblu="${bld}$(tput setaf 4)" local bfgpur="${bld}$(tput setaf 5)" local bfgcyn="${bld}$(tput setaf 6)" local bfgwht="${bld}$(tput setaf 7)" local logo=( "${fgred} .***. " "${fgred} ***${bfgwht}*${fgred}* " "${fgred} \`***' " "${bfgwht} |*| " "${bfgwht} |*| " "${bfgred} ..${bfgwht}|*|${bfgred}.. " "${bfgred}.*** ${bfgwht}*${bfgred} ***." "${bfgred}*******${fggrn}@@${bfgred}**" "${fgred}\`*${bfgred}****${bfgylw}@@${bfgred}*${fgred}*'" "${fgred} \`*******'${fgrst} " "${fgred} \`\"\"\"'${fgrst} " ) local out local i for i in "${!logo[@]}"; do out+=" ${logo[$i]} " case "$i" in 0) out+="${fggrn}$(date +"%A, %e %B %Y, %X")" ;; 1) out+="${fggrn}$(uname -srmo)" ;; 3) out+="${fgylw}${df_out[0]}" ;; 4) out+="${fgwht}${df_out[1]}" ;; 5) out+="${fgred}Uptime.............: ${UPTIME}" ;; 6) out+="${fgred}Memory.............: $(free -h | awk 'NR==2 {printf("%s (Free) / %s (Total)", $4, $2)}')" ;; 7) out+="${fgred}Running Processes..: $(ps ax | wc -l | tr -d " ")" ;; 8) out+="${fgred}IP Address.........: $(getIPAddress)" ;; 9) out+="Temperature........: CPU: ${cpuTempC}°C/${cpuTempF}°F GPU: ${gpuTempC}°C/${gpuTempF}°F" ;; 10) out+="${fgwht}The RetroPie Project, https://retropie.org.uk" ;; esac out+="${rst}\n" done echo -e "\n$out" } retropie_welcome # RETROPIE PROFILE END _EOF_ } function remove_bashwelcometweak() { sed -i '/RETROPIE PROFILE START/,/RETROPIE PROFILE END/d' "$home/.bashrc" } function gui_bashwelcometweak() { local cmd=(dialog --backtitle "$__backtitle" --menu "Bash Welcome Tweak Configuration" 22 86 16) local options=( 1 "Install Bash Welcome Tweak" 2 "Remove Bash Welcome Tweak" ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) rp_callModule bashwelcometweak install printMsgs "dialog" "Installed Bash Welcome Tweak." ;; 2) rp_callModule bashwelcometweak remove printMsgs "dialog" "Removed Bash Welcome Tweak." ;; esac fi } ================================================ FILE: scriptmodules/supplementary/bluetooth/COPYING ================================================ GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. ================================================ FILE: scriptmodules/supplementary/bluetooth/bluez-simple-agent ================================================ #!/usr/bin/python3 from optparse import OptionParser import sys import dbus import dbus.service import dbus.mainloop.glib from gi.repository import GLib import bluezutils BUS_NAME = 'org.bluez' AGENT_INTERFACE = 'org.bluez.Agent1' AGENT_PATH = "/test/agent" bus = None device_obj = None dev_path = None def ask(prompt): try: return raw_input(prompt) except: return input(prompt) def set_trusted(path): props = dbus.Interface(bus.get_object("org.bluez", path), "org.freedesktop.DBus.Properties") props.Set("org.bluez.Device1", "Trusted", True) def dev_connect(path): dev = dbus.Interface(bus.get_object("org.bluez", path), "org.bluez.Device1") dev.Connect() class Rejected(dbus.DBusException): _dbus_error_name = "org.bluez.Error.Rejected" class Agent(dbus.service.Object): exit_on_release = True def set_exit_on_release(self, exit_on_release): self.exit_on_release = exit_on_release @dbus.service.method(AGENT_INTERFACE, in_signature="", out_signature="") def Release(self): print("Release") if self.exit_on_release: mainloop.quit() @dbus.service.method(AGENT_INTERFACE, in_signature="os", out_signature="") def AuthorizeService(self, device, uuid): print("AuthorizeService (%s, %s)" % (device, uuid)) authorize = ask("Authorize connection (yes/no): ") if (authorize == "yes"): return raise Rejected("Connection rejected by user") @dbus.service.method(AGENT_INTERFACE, in_signature="o", out_signature="s") def RequestPinCode(self, device): print("RequestPinCode (%s)" % (device)) set_trusted(device) return ask("Enter PIN Code: ") @dbus.service.method(AGENT_INTERFACE, in_signature="o", out_signature="u") def RequestPasskey(self, device): print("RequestPasskey (%s)" % (device)) set_trusted(device) passkey = ask("Enter passkey: ") return dbus.UInt32(passkey) @dbus.service.method(AGENT_INTERFACE, in_signature="ouq", out_signature="") def DisplayPasskey(self, device, passkey, entered): print("DisplayPasskey (%s, %06u entered %u)" % (device, passkey, entered)) @dbus.service.method(AGENT_INTERFACE, in_signature="os", out_signature="") def DisplayPinCode(self, device, pincode): print("DisplayPinCode (%s, %s)" % (device, pincode)) @dbus.service.method(AGENT_INTERFACE, in_signature="ou", out_signature="") def RequestConfirmation(self, device, passkey): print("RequestConfirmation (%s, %06d)" % (device, passkey)) confirm = ask("Confirm passkey (yes/no): ") if (confirm == "yes"): set_trusted(device) return raise Rejected("Passkey doesn't match") @dbus.service.method(AGENT_INTERFACE, in_signature="o", out_signature="") def RequestAuthorization(self, device): print("RequestAuthorization (%s)" % (device)) auth = ask("Authorize? (yes/no): ") if (auth == "yes"): return raise Rejected("Pairing rejected") @dbus.service.method(AGENT_INTERFACE, in_signature="", out_signature="") def Cancel(self): print("Cancel") def pair_reply(): print("Device paired") set_trusted(dev_path) dev_connect(dev_path) mainloop.quit() def pair_error(error): err_name = error.get_dbus_name() if err_name == "org.freedesktop.DBus.Error.NoReply" and device_obj: print("Timed out. Cancelling pairing") device_obj.CancelPairing() else: print("Creating device failed: %s" % (error)) mainloop.quit() if __name__ == '__main__': dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) bus = dbus.SystemBus() capability = "KeyboardDisplay" parser = OptionParser() parser.add_option("-i", "--adapter", action="store", type="string", dest="adapter_pattern", default=None) parser.add_option("-c", "--capability", action="store", type="string", dest="capability") parser.add_option("-t", "--timeout", action="store", type="int", dest="timeout", default=60000) (options, args) = parser.parse_args() if options.capability: capability = options.capability path = "/test/agent" agent = Agent(bus, path) mainloop = GLib.MainLoop() obj = bus.get_object(BUS_NAME, "/org/bluez"); manager = dbus.Interface(obj, "org.bluez.AgentManager1") manager.RegisterAgent(path, capability) print("Agent registered") # Fix-up old style invocation (BlueZ 4) if len(args) > 0 and args[0].startswith("hci"): options.adapter_pattern = args[0] del args[:1] if len(args) > 0: device = bluezutils.find_device(args[0], options.adapter_pattern) dev_path = device.object_path agent.set_exit_on_release(False) device.Pair(reply_handler=pair_reply, error_handler=pair_error, timeout=60000) device_obj = device else: manager.RequestDefaultAgent(path) mainloop.run() #adapter.UnregisterAgent(path) #print("Agent unregistered") ================================================ FILE: scriptmodules/supplementary/bluetooth/bluez-test-device ================================================ #!/usr/bin/python3 from optparse import OptionParser, make_option import re import sys import dbus import dbus.mainloop.glib from gi.repository import GLib import bluezutils dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) bus = dbus.SystemBus() mainloop = GLib.MainLoop() option_list = [ make_option("-i", "--device", action="store", type="string", dest="dev_id"), ] parser = OptionParser(option_list=option_list) (options, args) = parser.parse_args() if (len(args) < 1): print("Usage: %s " % (sys.argv[0])) print("") print(" list") print(" create
") print(" remove ") print(" connect
[profile]") print(" disconnect
[profile]") print(" class
") print(" name
") print(" alias
[alias]") print(" trusted
[yes/no]") print(" blocked
[yes/no]") sys.exit(1) if (args[0] == "list"): adapter = bluezutils.find_adapter(options.dev_id) adapter_path = adapter.object_path om = dbus.Interface(bus.get_object("org.bluez", "/"), "org.freedesktop.DBus.ObjectManager") objects = om.GetManagedObjects() for path, interfaces in objects.items(): if "org.bluez.Device1" not in interfaces: continue properties = interfaces["org.bluez.Device1"] if properties["Adapter"] != adapter_path: continue; device_string = "%s %s" % (properties["Address"], properties["Alias"]) print(device_string.encode('ascii', 'ignore')) sys.exit(0) def create_device_reply(device): print("New device (%s)" % device) mainloop.quit() sys.exit(0) def create_device_error(error): print("Creating device failed: %s" % error) mainloop.quit() sys.exit(1) if (args[0] == "create"): if (len(args) < 2): print("Need address parameter") else: adapter = bluezutils.find_adapter(options.dev_id) adapter.CreateDevice(args[1], reply_handler=create_device_reply, error_handler=create_device_error) mainloop.run() if (args[0] == "remove"): if (len(args) < 2): print("Need address or object path parameter") else: managed_objects = bluezutils.get_managed_objects() adapter = bluezutils.find_adapter_in_objects(managed_objects, options.dev_id) try: dev = bluezutils.find_device_in_objects(managed_objects, args[1], options.dev_id) path = dev.object_path except: path = args[1] adapter.RemoveDevice(path) sys.exit(0) if (args[0] == "connect"): if (len(args) < 2): print("Need address parameter") else: device = bluezutils.find_device(args[1], options.dev_id) if (len(args) > 2): device.ConnectProfile(args[2]) else: device.Connect() sys.exit(0) if (args[0] == "disconnect"): if (len(args) < 2): print("Need address parameter") else: device = bluezutils.find_device(args[1], options.dev_id) if (len(args) > 2): device.DisconnectProfile(args[2]) else: device.Disconnect() sys.exit(0) if (args[0] == "class"): if (len(args) < 2): print("Need address parameter") else: device = bluezutils.find_device(args[1], options.dev_id) path = device.object_path props = dbus.Interface(bus.get_object("org.bluez", path), "org.freedesktop.DBus.Properties") cls = props.Get("org.bluez.Device1", "Class") print("0x%06x" % cls) sys.exit(0) if (args[0] == "name"): if (len(args) < 2): print("Need address parameter") else: device = bluezutils.find_device(args[1], options.dev_id) path = device.object_path props = dbus.Interface(bus.get_object("org.bluez", path), "org.freedesktop.DBus.Properties") name = props.Get("org.bluez.Device1", "Name") print(name) sys.exit(0) if (args[0] == "alias"): if (len(args) < 2): print("Need address parameter") else: device = bluezutils.find_device(args[1], options.dev_id) path = device.object_path props = dbus.Interface(bus.get_object("org.bluez", path), "org.freedesktop.DBus.Properties") if (len(args) < 3): alias = props.Get("org.bluez.Device1", "Alias") print(alias) else: props.Set("org.bluez.Device1", "Alias", args[2]) sys.exit(0) if (args[0] == "trusted"): if (len(args) < 2): print("Need address parameter") else: device = bluezutils.find_device(args[1], options.dev_id) path = device.object_path props = dbus.Interface(bus.get_object("org.bluez", path), "org.freedesktop.DBus.Properties") if (len(args) < 3): trusted = props.Get("org.bluez.Device1", "Trusted") print(trusted) else: if (args[2] == "yes"): value = dbus.Boolean(1) elif (args[2] == "no"): value = dbus.Boolean(0) else: value = dbus.Boolean(args[2]) props.Set("org.bluez.Device1", "Trusted", value) sys.exit(0) if (args[0] == "blocked"): if (len(args) < 2): print("Need address parameter") else: device = bluezutils.find_device(args[1], options.dev_id) path = device.object_path props = dbus.Interface(bus.get_object("org.bluez", path), "org.freedesktop.DBus.Properties") if (len(args) < 3): blocked = props.Get("org.bluez.Device1", "Blocked") print(blocked) else: if (args[2] == "yes"): value = dbus.Boolean(1) elif (args[2] == "no"): value = dbus.Boolean(0) else: value = dbus.Boolean(args[2]) props.Set("org.bluez.Device1", "Blocked", value) sys.exit(0) print("Unknown command") sys.exit(1) ================================================ FILE: scriptmodules/supplementary/bluetooth/bluezutils.py ================================================ import dbus SERVICE_NAME = "org.bluez" ADAPTER_INTERFACE = SERVICE_NAME + ".Adapter1" DEVICE_INTERFACE = SERVICE_NAME + ".Device1" def get_managed_objects(): bus = dbus.SystemBus() manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.freedesktop.DBus.ObjectManager") return manager.GetManagedObjects() def find_adapter(pattern=None): return find_adapter_in_objects(get_managed_objects(), pattern) def find_adapter_in_objects(objects, pattern=None): bus = dbus.SystemBus() for path, ifaces in objects.items(): adapter = ifaces.get(ADAPTER_INTERFACE) if adapter is None: continue if not pattern or pattern == adapter["Address"] or \ path.endswith(pattern): obj = bus.get_object(SERVICE_NAME, path) return dbus.Interface(obj, ADAPTER_INTERFACE) raise Exception("Bluetooth adapter not found") def find_device(device_address, adapter_pattern=None): return find_device_in_objects(get_managed_objects(), device_address, adapter_pattern) def find_device_in_objects(objects, device_address, adapter_pattern=None): bus = dbus.SystemBus() path_prefix = "" if adapter_pattern: adapter = find_adapter_in_objects(objects, adapter_pattern) path_prefix = adapter.object_path for path, ifaces in objects.items(): device = ifaces.get(DEVICE_INTERFACE) if device is None: continue if (device["Address"] == device_address and path.startswith(path_prefix)): obj = bus.get_object(SERVICE_NAME, path) return dbus.Interface(obj, DEVICE_INTERFACE) raise Exception("Bluetooth device not found") ================================================ FILE: scriptmodules/supplementary/bluetooth/connect.sh ================================================ #!/usr/bin/env bash configdir="CONFIGDIR" source "ROOTDIR/lib/inifuncs.sh" mode="$1" if [[ -z "$mode" ]]; then iniConfig "=" '"' "$configdir/all/bluetooth.cfg" iniGet "connect_mode" [[ -n "$ini_value" ]] && mode="$ini_value" fi function connect() { local line local mac local conn while read line; do if [[ "$line" =~ ^(.+)\ \((.+)\)$ ]]; then mac="${BASH_REMATCH[2]}" conn=$(bt-device -i "$mac" | grep "Connected:" | tail -c 2 2>/dev/null) [[ "$conn" -eq 0 ]] && bt-device --connect "$mac" &>/dev/null fi done < <(bt-device --list) } case "$mode" in boot) connect ;; background) while true; do connect sleep 10 done esac exit 0 ================================================ FILE: scriptmodules/supplementary/bluetooth/readme.txt ================================================ these files are included from http://git.kernel.org/cgit/bluetooth/bluez.git/tree/test ================================================ FILE: scriptmodules/supplementary/bluetooth.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="bluetooth" rp_module_desc="Configure Bluetooth Devices" rp_module_section="config" function _update_hook_bluetooth() { # fix config location [[ -f "$configdir/bluetooth.cfg" ]] && mv "$configdir/bluetooth.cfg" "$configdir/all/bluetooth.cfg" local mode="$(_get_connect_mode)" # if user has set bluetooth connect mode to boot or background, make sure we # have the latest dependencies and update systemd script if [[ "$mode" != "default" ]]; then # make sure dependencies are up to date ! hasPackage "bluez-tools" && depends_bluetooth connect_mode_set_bluetooth "$mode" fi } function _get_connect_mode() { # get bluetooth config iniConfig "=" '"' "$configdir/all/bluetooth.cfg" iniGet "connect_mode" if [[ -n "$ini_value" ]]; then echo "$ini_value" else echo "default" fi } function depends_bluetooth() { local depends=(bluetooth python3-dbus python3-gi bluez-tools) if [[ "$__os_id" == "Raspbian" ]]; then depends+=(pi-bluetooth raspberrypi-sys-mods) fi getDepends "${depends[@]}" } function get_script_bluetooth() { name="$1" if ! which "$name"; then [[ "$name" == "bluez-test-input" ]] && name="bluez-test-device" name="$md_data/$name" fi echo "$name" } function _slowecho_bluetooth() { local line IFS=$'\n' for line in $(echo -e "${1}"); do echo -e "$line" sleep 1 done unset IFS } function bluez_cmd_bluetooth() { # create a named pipe & fd for input for bluetoothctl local fifo="$(mktemp -u)" mkfifo "$fifo" exec 3<>"$fifo" local line while true; do _slowecho_bluetooth "$1" >&3 # collect output for specified amount of time, then echo it while read -r line; do printf '%s\n' "$line" # (slow) reply to any optional challenges if [[ -n "$3" && "$line" =~ $3 ]]; then _slowecho_bluetooth "$4" >&3 fi done _slowecho_bluetooth "quit\n" >&3 break # read from bluetoothctl buffered line by line done < <(timeout "$2" stdbuf -oL bluetoothctl --agent=NoInputNoOutput <&3) exec 3>&- } function list_available_bluetooth() { local mac local name local info_text="\n\nSearching ..." declare -A paired=() declare -A found=() # get an asc array of paired mac addresses while read mac; read name; do paired+=(["$mac"]="$name") done < <(list_paired_bluetooth) # sixaxis: add USB pairing information [[ -n "$(lsmod | grep hid_sony)" ]] && info_text="Searching ...\n\nDualShock registration: while this text is visible, unplug the controller, press the PS/SHARE button, and then replug the controller." # sixaxis: configure workaround for PS3 when we detect one if cat /proc/bus/input/devices | grep Name | grep -qE "(Sony )?PLAY.*3" ; then _bonded_fix_bluetooth "add" systemctl -q is-active bluetooth.service && systemctl restart bluetooth.service fi dialog --backtitle "$__backtitle" --infobox "$info_text" 7 60 >/dev/tty if hasPackage bluez 5; then # sixaxis: reply to authorization challenge on USB cable connect while read mac; read name; do found+=(["$mac"]="$name") done < <(bluez_cmd_bluetooth "default-agent\nscan on" "15" "Authorize service$" "yes" >/dev/null; bluez_cmd_bluetooth "devices" "3" | grep "^Device " | cut -d" " -f2,3- | sed 's/ /\n/') else while read; read mac; read name; do found+=(["$mac"]="$name") done < <(hcitool scan --flush | tail -n +2 | sed 's/\t/\n/g') fi # display any found addresses that are not already paired for mac in "${!found[@]}"; do if [[ -z "${paired[$mac]}" ]]; then echo "$mac" echo "${found[$mac]}" fi done } function list_registered_bluetooth() { local line while read line; do if [[ "$line" =~ ^(.+)\ \((.+)\)$ ]]; then echo ${BASH_REMATCH[2]} echo ${BASH_REMATCH[1]} fi done < <(bt-device --list 2>/dev/null) } function _devices_grep_bluetooth() { declare -A devices=() local pattern="$1" local mac local name while read mac; read name; do if bt-device --info "$mac" 2>/dev/null | grep -q "$pattern"; then echo "$mac" echo "$name" fi done < <(list_registered_bluetooth) } function list_paired_bluetooth() { _devices_grep_bluetooth "Paired: 1" } function list_connected_bluetooth() { _devices_grep_bluetooth "Connected: 1" } function status_bluetooth() { local paired local connected local mac local name while read mac; read name; do paired+="$mac - $name\n" done < <(list_paired_bluetooth) [[ -z "$paired" ]] && paired="There are no paired devices" while read mac; read name; do connected+="$mac - $name\n" done < <(list_connected_bluetooth) [[ -z "$connected" ]] && connected="There are no connected devices" echo -e "Paired Devices:\n\n$paired\nConnected Devices:\n\n$connected" } function remove_device_bluetooth() { declare -A devices=() local mac local name local options=() # show paired devices first while read mac; read name; do devices+=(["$mac"]="$name") options+=("$mac" "$name") done < <(list_paired_bluetooth) # then list all other devices known while read mac; read name; do if [[ -z "${devices[$mac]}" ]]; then devices+=(["$mac"]="$name") options+=("$mac" "$name") fi done < <(list_registered_bluetooth) if [[ ${#devices[@]} -eq 0 ]] ; then printMsgs "dialog" "There are no devices to remove." else local cmd=(dialog --backtitle "$__backtitle" --menu "Please choose the bluetooth device you would like to remove" 22 76 16) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && return local out out=$(bt-device --remove "$choice" 2>&1) if [[ "$?" -eq 0 ]] ; then printMsgs "dialog" "Device ${devices[$choice]} removed" # remove Bluez workaround if it's the last PS3 device if [[ "${devices[$choice]}" == *PLAY*3* ]]; then list_paired_bluetooth | grep -qE "(Sony )?PLAY.*3" [[ ! $? -eq 0 ]] && _bonded_fix_bluetooth "remove" fi else printMsgs "dialog" "Error removing device:\n\n$out" fi fi } function pair_bluetooth() { declare -A devices=() local mac local name local options=() while read mac; read name; do devices+=(["$mac"]="$name") options+=("$mac" "$name") done < <(list_available_bluetooth) if [[ ${#devices[@]} -eq 0 ]] ; then printMsgs "dialog" "No devices were found. Ensure device is on and try again" return fi local cmd=(dialog --backtitle "$__backtitle" --menu "Please choose the bluetooth device you would like to connect to" 22 76 16) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && return mac="$choice" name="${devices[$choice]}" if [[ "$name" =~ "PLAYSTATION(R)3 Controller" ]]; then bt-device --disconnect="$mac" >/dev/null bt-device --set "$mac" Trusted 1 >/dev/null if [[ "$?" -eq 0 ]]; then printMsgs "dialog" "Successfully authenticated $name ($mac).\n\nYou can now remove the USB cable." else printMsgs "dialog" "Unable to authenticate $name ($mac).\n\nPlease try to pair the device again, making sure to follow the on-screen steps exactly." fi return fi local cmd=(dialog --backtitle "$__backtitle" --menu "Please choose the security mode - Try the first one, then second if that fails" 22 76 16) options=( 1 "DisplayYesNo" 2 "KeyboardDisplay" 3 "NoInputNoOutput" 4 "DisplayOnly" 5 "KeyboardOnly" ) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && return local mode="${options[choice*2-1]}" # create a named pipe & fd for input for bluez-simple-agent local fifo="$(mktemp -u)" mkfifo "$fifo" exec 3<>"$fifo" local line local pin local error="" local skip_connect=0 while read -r line; do case "$line" in "RequestPinCode"*) cmd=(dialog --nocancel --backtitle "$__backtitle" --menu "Please choose a pin" 22 76 16) options=( 1 "Pin 0000" 2 "Enter own Pin" ) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) pin="0000" if [[ "$choice" == "2" ]]; then pin=$(dialog --backtitle "$__backtitle" --inputbox "Please enter a pin" 10 60 2>&1 >/dev/tty) fi dialog --backtitle "$__backtitle" --infobox "Please enter pin $pin on your bluetooth device" 10 60 echo "$pin" >&3 # read "Enter PIN Code:" read -n 15 line ;; "RequestConfirmation"*) # read "Confirm passkey (yes/no): " echo "yes" >&3 read -n 26 line skip_connect=1 break ;; "DisplayPasskey"*|"DisplayPinCode"*) # extract key from end of line # DisplayPasskey (/org/bluez/1284/hci0/dev_01_02_03_04_05_06, 123456) [[ "$line" =~ ,\ (.+)\) ]] && pin=${BASH_REMATCH[1]} dialog --backtitle "$__backtitle" --infobox "Please enter pin $pin on your bluetooth device" 10 60 ;; "Creating device failed"*) error="$line" ;; esac # read from bluez-simple-agent buffered line by line done < <(stdbuf -oL $(get_script_bluetooth bluez-simple-agent) -c "$mode" hci0 "$mac" <&3) exec 3>&- rm -f "$fifo" if [[ "$skip_connect" -eq 1 ]]; then if hcitool con | grep -q "$mac"; then printMsgs "dialog" "Successfully paired and connected to $mac" return 0 else printMsgs "dialog" "Unable to connect to bluetooth device. Please try pairing with the commandline tool 'bluetoothctl'" return 1 fi fi if [[ -z "$error" ]]; then error=$(bt-device --set "$mac" Trusted 1 2>&1) if [[ "$?" -eq 0 ]] ; then return 0 fi fi printMsgs "dialog" "An error occurred connecting to the bluetooth device ($error)" return 1 } function udev_bluetooth() { declare -A devices=() local mac local name local options=() while read mac; read name; do devices+=(["$mac"]="$name") options+=("$mac" "$name") done < <(list_paired_bluetooth) if [[ ${#devices[@]} -eq 0 ]] ; then printMsgs "dialog" "There are no paired bluetooth devices." else local cmd=(dialog --backtitle "$__backtitle" --menu "Please choose the bluetooth device you would like to create a udev rule for" 22 76 16) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && return name="${devices[$choice]}" local config="/etc/udev/rules.d/99-bluetooth.rules" if ! grep -q "$name" "$config"; then local line="SUBSYSTEM==\"input\", ATTRS{name}==\"$name\", MODE=\"0666\", ENV{ID_INPUT_JOYSTICK}=\"1\"" addLineToFile "$line" "$config" printMsgs "dialog" "Added $line to $config\n\nPlease reboot for the configuration to take effect." else printMsgs "dialog" "An entry already exists for $name in $config" fi fi } function connect_bluetooth() { local mac local name while read mac; read name; do bt-device --connect "$mac" 2>/dev/null done < <(list_paired_bluetooth) } function connect_mode_gui_bluetooth() { local mode="$(_get_connect_mode)" [[ -z "$mode" ]] && mode="default" local cmd=(dialog --backtitle "$__backtitle" --default-item "$mode" --menu "Choose a connect mode" 22 76 16) local options=( default "Bluetooth stack default behaviour (recommended)" boot "Connect to devices once at boot" background "Force connecting to devices in the background" ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -n "$choice" ]] && connect_mode_set_bluetooth "$choice" } function connect_mode_set_bluetooth() { local mode="$1" [[ -z "$mode" ]] && mode="default" local config="/etc/systemd/system/connect-bluetooth.service" case "$mode" in boot|background) mkdir -p "$md_inst" sed -e "s#CONFIGDIR#$configdir#" -e "s#ROOTDIR#$rootdir#" "$md_data/connect.sh" >"$md_inst/connect.sh" chmod a+x "$md_inst/connect.sh" cat > "$config" << _EOF_ [Unit] Description=Connect Bluetooth [Service] Type=simple ExecStart=nice -n19 "$md_inst/connect.sh" [Install] WantedBy=multi-user.target _EOF_ systemctl enable "$config" ;; default) if systemctl is-enabled connect-bluetooth 2>/dev/null | grep -q "enabled"; then systemctl disable "$config" fi rm -f "$config" rm -rf "$md_inst" ;; esac iniConfig "=" '"' "$configdir/all/bluetooth.cfg" iniSet "connect_mode" "$mode" chown "$__user":"$__group" "$configdir/all/bluetooth.cfg" } function gui_bluetooth() { addAutoConf "8bitdo_hack" 0 while true; do local connect_mode="$(_get_connect_mode)" local cmd=(dialog --backtitle "$__backtitle" --menu "Configure Bluetooth Devices" 22 76 16) local options=( P "Pair and Connect to Bluetooth Device" X "Remove Bluetooth Device" S "Show Paired & Connected Bluetooth Devices" U "Set up udev rule for Joypad (required for joypads from 8Bitdo etc)" C "Connect now to all paired devices" M "Configure bluetooth connect mode (currently: $connect_mode)" ) local atebitdo if getAutoConf 8bitdo_hack; then atebitdo=1 options+=(8 "8Bitdo mapping hack (ON - old firmware)") else atebitdo=0 options+=(8 "8Bitdo mapping hack (OFF - new firmware)") fi local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then # temporarily restore Bluetooth stack (if needed) service sixad status &>/dev/null && sixad -r case "$choice" in P) pair_bluetooth ;; X) remove_device_bluetooth ;; S) printMsgs "dialog" "$(status_bluetooth)" ;; U) udev_bluetooth ;; C) connect_bluetooth ;; M) connect_mode_gui_bluetooth ;; 8) atebitdo="$((atebitdo ^ 1))" setAutoConf "8bitdo_hack" "$atebitdo" ;; esac else # restart sixad (if running) service sixad status &>/dev/null && service sixad restart && printMsgs "dialog" "NOTICE: The ps3controller driver was temporarily interrupted in order to allow compatibility with standard Bluetooth peripherals. Please re-pair your Dual Shock controller to continue (or disregard this message if currently using another controller)." break fi done } function _bonded_fix_bluetooth() { local mode=$1 # exit when we don't have an op mode (install/remove) or a config file [[ -z "$mode" ]] && return [[ ! -f "/etc/bluetooth/input.conf" ]] && return if [[ "$mode" == "add" ]]; then # configure the workaround iniConfig "=" '' "/etc/bluetooth/input.conf" iniSet "ClassicBondedOnly" "false" fi if [[ "$mode" == "remove" ]]; then # remove the workaround iniConfig "=" '' "/etc/bluetooth/input.conf" iniSet "ClassicBondedOnly" "true" fi } ================================================ FILE: scriptmodules/supplementary/configedit.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="configedit" rp_module_desc="Edit RetroPie/RetroArch configurations" rp_module_section="config" function _video_fullscreen_configedit() { local mode="$1" local value="$2" case "$mode" in get) iniGet "video_fullscreen_x" local res_x="$ini_value" iniGet "video_fullscreen_y" local res_y="$ini_value" if [[ -z "$res_x" && -z "$res_y" ]]; then echo "unset" elif [[ "$res_x" == "0" && "$res_y" == "0" ]]; then echo "Video output resolution" else echo "${res_x}x${res_y}" fi ;; set) local save="$1" local res=( "320x240" "640x480" "800x600" "960x720" "1280x960" ) local i=1 local item local options=(U "unset") local default for item in "${res[@]}"; do [[ "$item" == "$value" ]] && default="$i" options+=($i "$item") ((i++)) done options+=( O "Video output resolution" C "Custom" ) [[ "$value" == "Video output resolution" ]] && default="O" [[ "$value" == "unset" ]] && default="U" [[ -z "$default" ]] && default="C" local cmd=(dialog --default-item "$default" --cancel-label "Back" --menu "Choose RetroArch render resolution" 22 76 16 ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && return local res if [[ "$choice" == "U" ]]; then iniUnset "video_fullscreen_x" iniUnset "video_fullscreen_y" elif [[ "$choice" == "O" ]]; then iniSet "video_fullscreen_x" "0" iniSet "video_fullscreen_y" "0" else if [[ "$choice" == "C" ]]; then cmd=(dialog --backtitle "$__backtitle" --cancel-label "Back" --inputbox "Please enter the render resolution as WIDTHxHEIGHT" 10 60) res=$("${cmd[@]}" 2>&1 >/dev/tty) [[ -z "$res" || ! "$res" =~ ^[0-9]+x[0-9]+$ ]] && return else res="${res[$choice-1]}" fi res=(${res/x/ }) iniSet "video_fullscreen_x" "${res[0]}" iniSet "video_fullscreen_y" "${res[1]}" fi ;; esac } function _joypad_index_configedit() { local mode="$1" local value="$2" while true; do local players=() local player for player in 1 2 3 4; do iniGet "input_player${player}_joypad_index" if [[ -n "$ini_value" ]]; then players+=("$ini_value") else players+=("unset") fi done case "$mode" in get) echo "${players[@]}" return ;; set) local dev local devs_name=() local path local paths=() # get joystick device paths while read -r dev; do if udevadm info --name=$dev | grep -q "ID_INPUT_JOYSTICK=1"; then paths+=("$(udevadm info --name=$dev --query=name)") fi done < <(find /dev/input -name "js*") if [[ "${#paths[@]}" -gt 0 ]]; then # sort by path IFS=$'\n' while read -r path; do devs_name+=("$(cat /sys/class/$path/device/name)") done < <(sort <<<"${paths[*]}") unset IFS fi local options=() local i local value local joypad for i in 1 2 3 4; do player="${players[$i-1]}" value="$player" joypad="${devs_name[$player]}" [[ -z "$joypad" ]] && joypad="not connected" [[ "$player" != "unset" ]] && value+=" ($joypad)" options+=("$i" "$value") done local cmd=(dialog --backtitle "$__backtitle" --cancel-label "Back" --menu "Choose a player to adjust" 22 76 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && return player="$choice" options=(U Unset) local i=0 for dev in "${devs_name[@]}"; do options+=("$i" "$dev") ((i++)) done local cmd=(dialog --backtitle "$__backtitle" --cancel-label "Back" --menu "Choose a Gamepad" 22 76 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && continue case "$choice" in U) iniUnset "input_player${player}_joypad_index" ;; *) iniSet "input_player${player}_joypad_index" "$choice" ;; esac ;; esac done } function basic_configedit() { local config="$1" local ini_options=( 'video_smooth true false' 'aspect_ratio_index _id_ 4:3 16:9 16:10 16:15 21:9 1:1 2:1 3:2 3:4 4:1 4:4 5:4 6:5 7:9 8:3 8:7 19:12 19:14 30:17 32:9 config square core custom' '_function_ _video_fullscreen_configedit' 'video_shader_enable true false' "video_shader _file_ *.*p $rootdir/emulators/retroarch/shader" 'input_auto_game_focus _id_ off on detect' 'input_overlay_enable true false' "input_overlay _file_ *.cfg $rootdir/emulators/retroarch/overlays" '_function_ _joypad_index_configedit' 'input_player1_analog_dpad_mode _id_ disabled left-stick right-stick left-stick-forced right-stick-forced' 'input_player2_analog_dpad_mode _id_ disabled left-stick right-stick left-stick-forced right-stick-forced' 'input_player3_analog_dpad_mode _id_ disabled left-stick right-stick left-stick-forced right-stick-forced' 'input_player4_analog_dpad_mode _id_ disabled left-stick right-stick left-stick-forced right-stick-forced' ) local ini_titles=( 'Video Smoothing' 'Aspect Ratio' 'Render Resolution' 'Video Shader Enable' "Video Shader File" 'Auto Enable "Game Focus" Mode' 'Overlay Enable' 'Overlay File' 'Choose joypad order' 'Player 1 - use analogue stick as d-pad' 'Player 2 - use analogue stick as d-pad' 'Player 3 - use analogue stick as d-pad' 'Player 4 - use analogue stick as d-pad' ) local ini_descs=( 'Smoothens picture with bilinear filtering. Should be disabled if using pixel shaders.' 'Aspect ratio to use (default unset - will use core aspect if video_aspect_ratio_auto is true)' 'Configure the resolution to render the emulator output at - for better performance on full HD displays choose a lower resolution and it will be upscaled in hardware' 'Load video_shader on startup. Other shaders can still be loaded later in runtime.' 'Video shader to use (default none)' 'Controls the automatic loading of "Game Focus" mode when starting a game.' 'Load input overlay on startup. Other overlays can still be loaded later in runtime.' 'Input overlay to use (default none)' 'Manual selection of joypad order' 'Allow analogue sticks to be used as a d-pad - 0 = disabled, 1 = left stick, 2 = right stick, 3 = left stick forced, 4 = right stick forced' 'Allow analogue sticks to be used as a d-pad - 0 = disabled, 1 = left stick, 2 = right stick, 3 = left stick forced, 4 = right stick forced' 'Allow analogue sticks to be used as a d-pad - 0 = disabled, 1 = left stick, 2 = right stick, 3 = left stick forced, 4 = right stick forced' 'Allow analogue sticks to be used as a d-pad - 0 = disabled, 1 = left stick, 2 = right stick, 3 = left stick forced, 4 = right stick forced' ) iniFileEditor " = " '"' "$config" } function advanced_configedit() { local config="$1" local audio_opts="alsa alsathread sdl2" if isPlatform "x11"; then audio_opts+=" pulse" fi local ini_options=( 'video_smooth true false' 'aspect_ratio_index _id_ 4:3 16:9 16:10 16:15 21:9 1:1 2:1 3:2 3:4 4:1 4:4 5:4 6:5 7:9 8:3 8:7 19:12 19:14 30:17 32:9 config square core custom' 'video_shader_enable true false' "video_shader _file_ *.*p $rootdir/emulators/retroarch/shader" 'input_overlay_enable true false' "input_overlay _file_ *.cfg $rootdir/emulators/retroarch/overlays" "audio_driver $audio_opts" 'video_driver gl dispmanx sdl2 vg vulkan glcore gl1' 'menu_driver rgui xmb glui ozone' 'video_fullscreen_x _string_' 'video_fullscreen_y _string_' 'video_frame_delay _string_' 'video_threaded true false' 'video_force_aspect true false' 'video_scale_integer true false' 'video_aspect_ratio_auto true false' 'video_aspect_ratio _string_' 'video_allow_rotate true false' 'video_rotation 0 1 2 3' 'custom_viewport_width _string_' 'custom_viewport_height _string_' 'custom_viewport_x _string_' 'custom_viewport_y _string_' 'video_font_size _string_' 'fps_show true false' 'input_overlay_opacity _string_' 'input_overlay_scale _string_' 'input_joypad_driver udev sdl2 linuxraw hid' 'game_specific_options true false' 'input_player1_joypad_index _string_' 'input_player2_joypad_index _string_' 'input_player3_joypad_index _string_' 'input_player4_joypad_index _string_' 'input_player5_joypad_index _string_' 'input_player6_joypad_index _string_' 'input_player7_joypad_index _string_' 'input_player8_joypad_index _string_' 'input_player1_analog_dpad_mode _id_ disabled left-stick right-stick left-stick-forced right-stick-forced' 'input_player2_analog_dpad_mode _id_ disabled left-stick right-stick left-stick-forced right-stick-forced' 'input_player3_analog_dpad_mode _id_ disabled left-stick right-stick left-stick-forced right-stick-forced' 'input_player4_analog_dpad_mode _id_ disabled left-stick right-stick left-stick-forced right-stick-forced' 'input_player5_analog_dpad_mode _id_ disabled left-stick right-stick left-stick-forced right-stick-forced' 'input_player6_analog_dpad_mode _id_ disabled left-stick right-stick left-stick-forced right-stick-forced' 'input_player7_analog_dpad_mode _id_ disabled left-stick right-stick left-stick-forced right-stick-forced' 'input_player8_analog_dpad_mode _id_ disabled left-stick right-stick left-stick-forced right-stick-forced' ) local ini_descs=( 'Smoothens picture with bilinear filtering. Should be disabled if using pixel shaders.' 'Aspect ratio to use (default unset - will use core aspect if video_aspect_ratio_auto is true)' 'Load video_shader on startup. Other shaders can still be loaded later in runtime.' 'Video shader to use. Video driver gl supports *.glslp shader presets. Video drivers glcore and vulkan support *.slangp shader presets. (default none)' 'Load input overlay on startup. Other overlays can still be loaded later in runtime.' 'Input overlay to use (default none)' 'Audio driver to use (default is alsathread)' 'Video driver to use (default is gl)' 'Menu driver to use' 'Fullscreen x resolution. Resolution of 0 uses the resolution of the desktop. (defaults to 0 if unset)' 'Fullscreen y resolution. Resolution of 0 uses the resolution of the desktop. (defaults to 0 if unset)' 'Sets how many milliseconds to delay after VSync before running the core. Can reduce latency at cost of higher risk of stuttering. Maximum is 15' 'Use threaded video driver. Using this might improve performance at possible cost of latency and more video stuttering.' 'Forces rendering area to stay equal to content aspect ratio or as defined in video_aspect_ratio.' 'Only scales video in integer steps. The base size depends on system-reported geometry and aspect ratio. If video_force_aspect is not set, X/Y will be integer scaled independently.' 'If this is true and video_aspect_ratio or video_aspect_ratio_index is not set, aspect ratio is decided by libretro implementation. If this is false, 1:1 PAR will always be assumed if video_aspect_ratio or video_aspect_ratio_index is not set.' 'A floating point value for video aspect ratio (width / height). If this is not set, aspect ratio is assumed to be automatic. Behavior then is defined by video_aspect_ratio_auto.' 'Allows libretro cores to set rotation modes. Setting this to false will honor, but ignore this request. This is useful for vertically oriented content where one manually rotates the monitor. (defaults to true)' 'Forces a certain rotation of the screen. The rotation is added to rotations which the libretro core sets (see video_allow_rotate). The angle is * 90 degrees counter-clockwise.' 'Viewport resolution.' 'Viewport resolution.' 'Viewport position x.' 'Viewport position y.' 'Size of the OSD font.' 'Show current frames per second.' 'Opacity of overlay. Float value 1.000000.' 'Scale of overlay. Float value 1.000000.' 'Input joypad driver to use (default is udev)' 'Game specific core options in retroarch-core-options.cfg, rather than for all games via that core.' 'Manual selection of joypad order' 'Manual selection of joypad order' 'Manual selection of joypad order' 'Manual selection of joypad order' 'Manual selection of joypad order' 'Manual selection of joypad order' 'Manual selection of joypad order' 'Manual selection of joypad order' 'Allow analogue sticks to be used as a d-pad - 0 = disabled, 1 = left stick, 2 = right stick, 3 = left stick forced, 4 = right stick forced' 'Allow analogue sticks to be used as a d-pad - 0 = disabled, 1 = left stick, 2 = right stick, 3 = left stick forced, 4 = right stick forced' 'Allow analogue sticks to be used as a d-pad - 0 = disabled, 1 = left stick, 2 = right stick, 3 = left stick forced, 4 = right stick forced' 'Allow analogue sticks to be used as a d-pad - 0 = disabled, 1 = left stick, 2 = right stick, 3 = left stick forced, 4 = right stick forced' 'Allow analogue sticks to be used as a d-pad - 0 = disabled, 1 = left stick, 2 = right stick, 3 = left stick forced, 4 = right stick forced' 'Allow analogue sticks to be used as a d-pad - 0 = disabled, 1 = left stick, 2 = right stick, 3 = left stick forced, 4 = right stick forced' 'Allow analogue sticks to be used as a d-pad - 0 = disabled, 1 = left stick, 2 = right stick, 3 = left stick forced, 4 = right stick forced' 'Allow analogue sticks to be used as a d-pad - 0 = disabled, 1 = left stick, 2 = right stick, 3 = left stick forced, 4 = right stick forced' ) iniFileEditor " = " '"' "$config" } function choose_config_configedit() { local path="$1" local include="$2" local exclude="$3" local cmd=(dialog --backtitle "$__backtitle" --cancel-label "Back" --menu "Which configuration would you like to edit" 22 76 16) local configs=() local options=() local config local i=0 while read config; do config=${config//$path\//} configs+=("$config") options+=("$i" "$config") ((i++)) done < <(find "$path" -type f -regex "$include" ! -regex "$exclude" ! -regex ".*/downloaded_images/.*" | sort) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then echo "${configs[choice]}" fi } function basic_menu_configedit() { while true; do local cmd=(dialog --backtitle "$__backtitle" --cancel-label "Back" --menu "Which platform do you want to adjust" 22 76 16) local configs=() local options=() local config local dir local desc local i=0 while read config; do configs+=("$config") dir=${config%/*} dir=${dir//$configdir\//} if [[ "$dir" == "all" ]]; then desc="Configure default options for all libretro emulators" else desc="Configure additional options for $dir" fi options+=("$i" "$desc") ((i++)) done < <(find "$configdir" -type f -regex ".*/retroarch.cfg" | sort) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then basic_configedit "${configs[choice]}" else break fi done } function advanced_menu_configedit() { while true; do local cmd=(dialog --backtitle "$__backtitle" --cancel-label "Back" --menu "Choose an option" 22 76 16) local options=( 1 "Configure Libretro options" 2 "Manually edit RetroArch configurations" 3 "Manually edit global configs" 4 "Manually edit non RetroArch configurations" 5 "Manually edit all configurations" ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) local file="-" if [[ -n "$choice" ]]; then local ra_exclude='.*/all/retroarch/\(assets\|shaders\|thumbnails\)/.*' while [[ -n "$file" ]]; do case "$choice" in 1) file=$(choose_config_configedit "$configdir" ".*/retroarch.cfg") advanced_configedit "$configdir/$file" 2 ;; 2) file=$(choose_config_configedit "$configdir" ".*/retroarch.*" "$ra_exclude") editFile "$configdir/$file" ;; 3) file=$(choose_config_configedit "$configdir" ".*/all/.*" "$ra_exclude") editFile "$configdir/$file" ;; 4) file=$(choose_config_configedit "$configdir" ".*" ".*retroarch.*") editFile "$configdir/$file" ;; 5) file=$(choose_config_configedit "$configdir" ".*" "$ra_exclude") editFile "$configdir/$file" ;; esac done else break fi done } function gui_configedit() { while true; do local cmd=(dialog --backtitle "$__backtitle" --cancel-label "Exit" --menu "Choose an option" 22 76 16) local options=( 1 "Configure basic libretro emulator options" 2 "Advanced Configuration" ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) local file="-" if [[ -n "$choice" ]]; then case $choice in 1) basic_menu_configedit ;; 2) advanced_menu_configedit ;; esac else break fi done } ================================================ FILE: scriptmodules/supplementary/consolefont.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="consolefont" rp_module_desc="Configure default console font size/type" rp_module_section="config" rp_module_flags="!x11" function set_consolefont() { iniConfig "=" '"' "/etc/default/console-setup" iniSet "FONTFACE" "$1" iniSet "FONTSIZE" "$2" service console-setup restart # force font configuration update if running from a pseudo-terminal [[ "$(tty | egrep '/dev/tty[1-6]')" == "" ]] && setupcon -f --force } function check_consolefont() { local fontface local fontsize iniConfig "=" '"' "/etc/default/console-setup" iniGet "FONTFACE" fontface="$ini_value" iniGet "FONTSIZE" fontsize="$ini_value" echo "$fontface" "$fontsize" } function gui_consolefont() { local cmd local options local choice cmd=(dialog --backtitle "$__backtitle" --menu "Choose the desired console font configuration: \n(Current configuration: $(check_consolefont))" 22 86 16) options=( 1 "Large (VGA 16x32)" 2 "Large (TerminusBold 16x32)" 3 "Medium (VGA 16x28)" 4 "Medium (TerminusBold 14x28)" 5 "Small (Fixed 8x16)" 6 "Smaller (VGA 8x8)" D "Default (Kernel font 8x16 - Restart needed)" ) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) set_consolefont "VGA" "16x32" ;; 2) set_consolefont "TerminusBold" "16x32" ;; 3) set_consolefont "VGA" "16x28" ;; 4) set_consolefont "TerminusBold" "14x28" ;; 5) set_consolefont "Fixed" "8x16" ;; 6) set_consolefont "VGA" "8x8" ;; D) set_consolefont "" "" ;; esac if [[ "$choice" == "D" ]]; then printMsgs "dialog" "Default font will be used (provided by the Kernel).\n\nYou will need to reboot to see the change." else printMsgs "dialog" "New font configuration applied: $(check_consolefont)" fi fi } ================================================ FILE: scriptmodules/supplementary/controlblock.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="controlblock" rp_module_desc="ControlBlock Driver" rp_module_help="Please note that you need to manually enable or disable the ControlBlock Service in the Configuration section. IMPORTANT: If the service is enabled and the power switch functionality is enabled (which is the default setting) in the config file, you need to have a switch connected to the ControlBlock." rp_module_licence="NONCOM https://raw.githubusercontent.com/petrockblog/ControlBlockService2/master/LICENSE.txt" rp_module_repo="git https://github.com/petrockblog/ControlBlockService2.git master" rp_module_section="driver" rp_module_flags="noinstclean !all rpi" function depends_controlblock() { local depends=(cmake doxygen gpiod libgpiod-dev) isPlatform "videocore" && depends+=(libraspberrypi-dev) getDepends "${depends[@]}" } function sources_controlblock() { gitPullOrClone "$md_inst" } function build_controlblock() { cd "$md_inst" rm -rf "build" mkdir build cd build cmake .. make md_ret_require="$md_inst/build/controlblock" } function install_controlblock() { # install from there to system folders cd "$md_inst/build" make install } function gui_controlblock() { local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option." 22 86 16) local options=( 1 "Enable ControlBlock driver" 2 "Disable ControlBlock driver" ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) make -C "$md_inst/build" installservice printMsgs "dialog" "Enabled ControlBlock driver." ;; 2) make -C "$md_inst/build" uninstallservice printMsgs "dialog" "Disabled ControlBlock driver." ;; esac fi } function remove_controlblock() { make -C "$md_inst/build" uninstallservice make -C "$md_inst/build" uninstall } ================================================ FILE: scriptmodules/supplementary/custombluez/01_raspbian_patches.diff ================================================ From 480f82debde736f6511262cf1ecfa5ca02a22197 Mon Sep 17 00:00:00 2001 From: Conn O'Griofa Date: Sat, 17 Nov 2018 00:30:13 +0000 Subject: [PATCH] Import Raspbian patches --- debian/changelog | 6 ++++++ debian/libbluetooth3.symbols | 2 -- .../0050-bcm43xx-Add-bcm43xx-3wire-variant.patch | 21 +++++++++++++++++++++ ...0052-Increase-firmware-load-timeout-to-30s.patch | 20 ++++++++++++++++++++ .../0053-Move-43xx-firmware-to-lib-firmware.patch | 11 +++++++++++ debian/patches/0054-update-bluetooth.conf.patch | 11 +++++++++++ debian/patches/series | 4 ++++ 7 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 debian/patches/0050-bcm43xx-Add-bcm43xx-3wire-variant.patch create mode 100644 debian/patches/0052-Increase-firmware-load-timeout-to-30s.patch create mode 100644 debian/patches/0053-Move-43xx-firmware-to-lib-firmware.patch create mode 100644 debian/patches/0054-update-bluetooth.conf.patch diff --git a/debian/changelog b/debian/changelog index 85a875f53..7ff84df69 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +bluez (5.50-1~rpi1) UNRELEASED; urgency=medium + + * Import Raspbian patches. + + -- Conn O'Griofa Sat, 17 Nov 2018 00:27:54 +0000 + bluez (5.50-1) unstable; urgency=medium * Update to 5.50. diff --git a/debian/libbluetooth3.symbols b/debian/libbluetooth3.symbols index b395a17a7..d08b15d52 100644 --- a/debian/libbluetooth3.symbols +++ b/debian/libbluetooth3.symbols @@ -216,6 +216,4 @@ libbluetooth.so.3 libbluetooth3 #MINVER# str2ba@Base 4.91 strtoba@Base 4.91 sixaxis.so libbluetooth3 #MINVER# - __start___debug@Base 5.46 - __stop___debug@Base 5.46 bluetooth_plugin_desc@Base 5.20 diff --git a/debian/patches/0050-bcm43xx-Add-bcm43xx-3wire-variant.patch b/debian/patches/0050-bcm43xx-Add-bcm43xx-3wire-variant.patch new file mode 100644 index 000000000..14b2f4e17 --- /dev/null +++ b/debian/patches/0050-bcm43xx-Add-bcm43xx-3wire-variant.patch @@ -0,0 +1,21 @@ +From 874990be3b958bd3d5d5f61989f8d6314be3358a Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 16 Feb 2016 16:40:46 +0000 +Subject: [PATCH 1/3] bcm43xx: Add bcm43xx-3wire variant + +--- + tools/hciattach.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -1144,6 +1144,9 @@ + { "bcm43xx", 0x0000, 0x0000, HCI_UART_H4, 115200, 3000000, + FLOW_CTL, DISABLE_PM, NULL, bcm43xx, NULL }, + ++ { "bcm43xx-3wire", 0x0000, 0x0000, HCI_UART_3WIRE, 115200, 3000000, ++ 0, DISABLE_PM, NULL, bcm43xx, NULL }, ++ + { "ath3k", 0x0000, 0x0000, HCI_UART_ATH3K, 115200, 115200, + FLOW_CTL, DISABLE_PM, NULL, ath3k_ps, ath3k_pm }, + diff --git a/debian/patches/0052-Increase-firmware-load-timeout-to-30s.patch b/debian/patches/0052-Increase-firmware-load-timeout-to-30s.patch new file mode 100644 index 000000000..df264b091 --- /dev/null +++ b/debian/patches/0052-Increase-firmware-load-timeout-to-30s.patch @@ -0,0 +1,20 @@ +From 74e6869ecce13b1066741ba995fc47b437c4c72f Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 20 Jan 2016 16:00:37 +0000 +Subject: [PATCH 3/3] Increase firmware load timeout to 30s + +--- + tools/hciattach.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -1287,7 +1287,7 @@ + { + struct uart_t *u = NULL; + int detach, printpid, raw, opt, i, n, ld, err; +- int to = 10; ++ int to = 30; + int init_speed = 0; + int send_break = 0; + pid_t pid; diff --git a/debian/patches/0053-Move-43xx-firmware-to-lib-firmware.patch b/debian/patches/0053-Move-43xx-firmware-to-lib-firmware.patch new file mode 100644 index 000000000..61fbb7b2c --- /dev/null +++ b/debian/patches/0053-Move-43xx-firmware-to-lib-firmware.patch @@ -0,0 +1,11 @@ +--- a/tools/hciattach_bcm43xx.c ++++ b/tools/hciattach_bcm43xx.c +@@ -43,7 +43,7 @@ + #include "hciattach.h" + + #ifndef FIRMWARE_DIR +-#define FIRMWARE_DIR "/etc/firmware" ++#define FIRMWARE_DIR "/lib/firmware" + #endif + + #define FW_EXT ".hcd" diff --git a/debian/patches/0054-update-bluetooth.conf.patch b/debian/patches/0054-update-bluetooth.conf.patch new file mode 100644 index 000000000..58b8b3808 --- /dev/null +++ b/debian/patches/0054-update-bluetooth.conf.patch @@ -0,0 +1,11 @@ +--- a/src/bluetooth.conf ++++ b/src/bluetooth.conf +@@ -37,7 +37,7 @@ + + + +- ++ + + + diff --git a/debian/patches/series b/debian/patches/series index d4709adf3..7598d7426 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -9,3 +9,7 @@ org.bluez.obex.service.in.patch Fix-typo.patch shared-gatt-client-Fix-segfault-after-PIN-entry.patch main.conf-Add-more-details-Closes-904212.patch +0050-bcm43xx-Add-bcm43xx-3wire-variant.patch +0052-Increase-firmware-load-timeout-to-30s.patch +0053-Move-43xx-firmware-to-lib-firmware.patch +0054-update-bluetooth.conf.patch -- 2.11.0 ================================================ FILE: scriptmodules/supplementary/customhidsony/0001-hidsony-gasiafix.diff ================================================ From: Martyn Welch To: Jiri Kosina , Benjamin Tissoires Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Martyn Welch , Conn O'Griofa Subject: [PATCH] HID: Sony: Add support for Gasia controllers Date: Sun, 26 Jan 2020 19:45:13 +0000 Message-ID: <20200126194513.6359-1-martyn@welchs.me.uk> (raw) There seems to be a number of subtly different firmwares for the Playstation controllers made by "Gasia Co.,Ltd". Whilst such controllers are easily detectable when attached via USB that is not always the case via Bluetooth. Some controllers are named "PLAYSTATION(R)3 Controller" where as the official Sony controllers are named "Sony PLAYSTATION(R)3 Controller", however some versions of firmware use the exact name used by the official controllers. The only way I've been able to distinguish these versions of the controller (when connected via Bluetooth) is that the Bluetooth Class of Device incorrectly reports the controller as a keyboard rather than a gamepad. I've so far failed to work out how to access this information from a HID driver. The Gasia controllers need output reports to be configured in the same way as the Shanwan controllers. In order to ensure both types of Gasia firmware will work, this patch adds a quirk for those devices it can detect and reworks `sixaxis_send_output_report()` to attempt `hid_hw_output_report()` should `hid_hw_raw_request()` be known to be the wrong option (as is the case with the Shanwan controllers) or fails. This has got all the controllers I have working, with the slight anoyance that the Gasia controllers that don't currently get marked with a quirk require the call to `hid_hw_raw_request()` to fail before the controller finishes initialising (which adds a significant extra delay before the controller is ready). This patch is based on the following patch by Conn O'Griofa: https://github.com/RetroPie/RetroPie-Setup/pull/2263/commits/017f00f6e15f04b3272ff1abae8742dc4c47b608 Cc: Conn O'Griofa Signed-off-by: Martyn Welch --- drivers/hid/hid-sony.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 4c6ed6ef31f1..d1088a85cb59 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -56,6 +56,7 @@ #define NSG_MR5U_REMOTE_BT BIT(14) #define NSG_MR7U_REMOTE_BT BIT(15) #define SHANWAN_GAMEPAD BIT(16) +#define GASIA_GAMEPAD BIT(17) #define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT) #define MOTION_CONTROLLER (MOTION_CONTROLLER_USB | MOTION_CONTROLLER_BT) @@ -2067,6 +2068,7 @@ static void sixaxis_send_output_report(struct sony_sc *sc) struct sixaxis_output_report *report = (struct sixaxis_output_report *)sc->output_report_dmabuf; int n; + int ret = -1; /* Initialize the report with default values */ memcpy(report, &default_report, sizeof(struct sixaxis_output_report)); @@ -2101,14 +2103,23 @@ static void sixaxis_send_output_report(struct sony_sc *sc) } } - /* SHANWAN controllers require output reports via intr channel */ - if (sc->quirks & SHANWAN_GAMEPAD) - hid_hw_output_report(sc->hdev, (u8 *)report, - sizeof(struct sixaxis_output_report)); - else - hid_hw_raw_request(sc->hdev, report->report_id, (u8 *)report, + /* + * SHANWAN & GASIA controllers require output reports via intr channel. + * Some of the Gasia controllers are basically indistinguishable from + * the official ones and thus try hid_hw_output_report() should + * hid_hw_raw_request() fail. + */ + if (!(sc->quirks & (SHANWAN_GAMEPAD | GASIA_GAMEPAD))) + ret = hid_hw_raw_request(sc->hdev, report->report_id, + (u8 *)report, sizeof(struct sixaxis_output_report), HID_OUTPUT_REPORT, HID_REQ_SET_REPORT); + + if (ret >= 0) + return; + + hid_hw_output_report(sc->hdev, (u8 *)report, + sizeof(struct sixaxis_output_report)); } static void dualshock4_send_output_report(struct sony_sc *sc) @@ -2833,6 +2844,14 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) if (!strcmp(hdev->name, "SHANWAN PS3 GamePad")) quirks |= SHANWAN_GAMEPAD; + /* + * Some Gasia controllers are named "PLAYSTATION(R)3 Controller" + * where as the official Sony controllers are named + * "Sony PLAYSTATION(R)3 Controller". + */ + if (!strcmp(hdev->name, "PLAYSTATION(R)3 Controller")) + quirks |= GASIA_GAMEPAD; + sc = devm_kzalloc(&hdev->dev, sizeof(*sc), GFP_KERNEL); if (sc == NULL) { hid_err(hdev, "can't alloc sony descriptor\n"); -- 2.20.1 ================================================ FILE: scriptmodules/supplementary/customhidsony.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="customhidsony" rp_module_desc="Custom hid-sony (Sony DualShock) driver with enhanced third-party controller support" rp_module_help="Improves support for third-party (Shanwan & Gasia) DualShock 3 controllers." rp_module_section="driver" rp_module_flags="noinstclean" function _version_customhidsony() { echo "0.1.3" } function depends_customhidsony() { depends_xpad } function sources_customhidsony() { mkdir -p "$md_inst/patches" pushd "$md_inst" cat > "Makefile" << _EOF_ obj-m := drivers/hid/hid-sony.o _EOF_ cat > "dkms.conf" << _EOF_ PACKAGE_NAME="hid-sony" PACKAGE_VERSION="$(_version_customhidsony)" PRE_BUILD="hidsony_source.sh" BUILT_MODULE_LOCATION="drivers/hid" BUILT_MODULE_NAME="\$PACKAGE_NAME" DEST_MODULE_LOCATION="/updates/dkms" AUTOINSTALL="yes" _EOF_ cat > "hidsony_source.sh" << _EOF_ #!/bin/bash rpi_kernel_ver="rpi-5.10.y" mkdir -p "drivers/hid/" "patches" curl -s https://raw.githubusercontent.com/raspberrypi/linux/"\$rpi_kernel_ver"/drivers/hid/hid-sony.c -o "drivers/hid/hid-sony.c" curl -s https://raw.githubusercontent.com/raspberrypi/linux/"\$rpi_kernel_ver"/drivers/hid/hid-ids.h -o "drivers/hid/hid-ids.h" patch -p1 <"patches/0001-hidsony-gasiafix.diff" _EOF_ chmod +x "hidsony_source.sh" cp "$md_data/0001-hidsony-gasiafix.diff" "patches/" popd } function build_customhidsony() { dkmsManager install hid-sony "$(_version_customhidsony)" } function remove_customhidsony() { dkmsManager remove hid-sony "$(_version_customhidsony)" } function configure_customhidsony() { [[ "$md_mode" == "remove" ]] && return dkmsManager reload hid-sony "$(_version_customhidsony)" } ================================================ FILE: scriptmodules/supplementary/dbar4gun.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="dbar4gun" rp_module_desc="dbar4gun is a Linux userspace driver for the wiimote with DolphinBar support." rp_module_help="https://github.com/lowlevel-1989/dbar4gun" rp_module_licence="MIT https://raw.githubusercontent.com/lowlevel-1989/dbar4gun/master/LICENSE" rp_module_repo="git https://github.com/lowlevel-1989/dbar4gun master" rp_module_section="driver" function depends_dbar4gun() { getDepends python3 python3-dev python3-setuptools python3-virtualenv python3-pygame } function sources_dbar4gun() { gitPullOrClone } function install_dbar4gun() { python3 -m venv "$md_inst" source "$md_inst/bin/activate" pip3 install . deactivate md_ret_require="$md_inst/bin/dbar4gun" } function configure_dbar4gun() { if [[ "$md_mode" == "remove" ]]; then return fi touch "$configdir/all/dbar4gun.cfg" iniConfig " = " '"' "$configdir/all/dbar4gun.cfg" } function enable_dbar4gun() { local config="/etc/systemd/system/dbar4gun.service" iniConfig " = " '"' "$configdir/all/dbar4gun.cfg" eval $(_loadconfig_dbar4gun) local dbar4gun_params="--width $db_width --height $db_height" dbar4gun_params="$dbar4gun_params --calibration $db_calibration" dbar4gun_params="$dbar4gun_params --setup $db_setup" dbar4gun_params="$dbar4gun_params --port $db_port" dbar4gun_params="$dbar4gun_params --smoothing-level $db_smoothing_level" if [[ "$db_disable_tilt_correction" -eq 1 ]]; then dbar4gun_params="$dbar4gun_params --disable-tilt-correction" fi disable_dbar4gun cat > "$config" << _EOF_ [Unit] Description=dbar4gun [Service] Type=simple ExecStart=$md_inst/bin/dbar4gun start $dbar4gun_params [Install] WantedBy=multi-user.target _EOF_ systemctl daemon-reload systemctl enable dbar4gun --now printMsgs "dialog" "dbar4gun enabled." } function disable_dbar4gun() { systemctl disable dbar4gun --now } function remove_dbar4gun() { disable_dbar4gun rm -rf "/etc/systemd/system/dbar4gun.service" systemctl daemon-reload } function _loadconfig_dbar4gun() { echo "$(loadModuleConfig \ 'db_width=1920' \ 'db_height=1080' \ 'db_disable_tilt_correction=0' \ 'db_setup=1' \ 'db_port=35460' \ 'db_calibration=2' \ 'db_smoothing_level=3' )" } function _menu_start_dbar4gun() { local cmd=(dialog --backtitle "$__backtitle" --menu "dbar4gun service" 22 86 16) iniConfig " = " '"' "$configdir/all/dbar4gun.cfg" eval $(_loadconfig_dbar4gun) while true; do local options=( 1 "width: $db_width" 2 "height: $db_height" 3 "smoothing level: $db_smoothing_level" 4 "debug port: $db_port" ) if [[ "$db_disable_tilt_correction" -eq 1 ]]; then options+=(5 "enable tilt correction") else options+=(5 "disable tilt correction") fi options+=(6 "dbar4gun start") local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) local cmd_in=(dialog --backtitle "$__backtitle" --inputbox "Please enter the width" 10 60 "$db_width") db_width=$("${cmd_in[@]}" 2>&1 >/dev/tty) iniSet "db_width" "$db_width" ;; 2) local cmd_in=(dialog --backtitle "$__backtitle" --inputbox "Please enter the height" 10 60 "$db_height") db_height=$("${cmd_in[@]}" 2>&1 >/dev/tty) iniSet "db_height" "$db_height" ;; 3) local cmd_in=(dialog --backtitle "$__backtitle" --inputbox "Please enter the smoothing level" 10 60 "$db_smoothing_level") db_smoothing_level=$("${cmd_in[@]}" 2>&1 >/dev/tty) iniSet "db_smoothing_level" "$db_smoothing_level" ;; 4) local cmd_in=(dialog --backtitle "$__backtitle" --inputbox "Please enter the debug port" 10 60 "$db_port") db_port=$("${cmd_in[@]}" 2>&1 >/dev/tty) iniSet "db_port" "$db_port" ;; 5) db_disable_tilt_correction="$((db_disable_tilt_correction ^ 1))" iniSet "db_disable_tilt_correction" "$db_disable_tilt_correction" ;; 6) enable_dbar4gun break ;; esac else break fi done } function _menu_ir_setup() { local cmd=(dialog --backtitle "$__backtitle" --menu "IR Setup" 22 86 16) iniConfig " = " '"' "$configdir/all/dbar4gun.cfg" eval $(_loadconfig_dbar4gun) local options=( 1 "Standard" ) while true; do local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) iniSet "db_setup" "1" _menu_calibration_mode break ;; esac else break fi done } function _menu_calibration_mode() { local cmd=(dialog --backtitle "$__backtitle" --menu "Calibration Mode" 22 86 16) iniConfig " = " '"' "$configdir/all/dbar4gun.cfg" eval $(_loadconfig_dbar4gun) local options=( 1 "TopLeft, TopRight, BottomCenter" 2 "Center, TopLeft" 3 "disabled" ) while true; do local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) iniSet "db_calibration" "2" _menu_start_dbar4gun break ;; 2) iniSet "db_calibration" "1" _menu_start_dbar4gun break ;; 3) iniSet "db_calibration" "0" _menu_start_dbar4gun break ;; esac else break fi done } function _menu_set_resolution() { local cmd=(dialog --backtitle "$__backtitle" --menu "Choose Resolution" 22 86 16) iniConfig " = " '"' "$configdir/all/dbar4gun.cfg" eval $(_loadconfig_dbar4gun) local options=( 1 " 1080p" 2 " 720p" 3 "manual" ) while true; do local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) iniSet "db_width" "1920" iniSet "db_height" "1080" _menu_ir_setup break ;; 2) iniSet "db_width" "1280" iniSet "db_height" "720" _menu_ir_setup break ;; 3) _menu_ir_setup break ;; esac else break fi done } function gui_dbar4gun() { local title=$($md_inst/bin/dbar4gun version) local cmd=(dialog --backtitle "$__backtitle" --menu "$title" 22 86 16) local options=( 1 "Enable dbar4gun" 2 "Disable dbar4gun" 3 "Debug" ) iniConfig " = " '"' "$configdir/all/dbar4gun.cfg" eval $(_loadconfig_dbar4gun) while true; do local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) _menu_set_resolution ;; 2) disable_dbar4gun ;; 3) $md_inst/bin/dbar4gun gui --width 640 --height 480 --port $db_port ;; esac else break fi done } ================================================ FILE: scriptmodules/supplementary/docsview.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="docsview" rp_module_desc="RetroPie-Setup Docs Viewer" rp_module_section="config" function depends_docsview() { getDepends pandoc lynx } function choose_page_docsview() { local path="$1" local include="$2" local exclude="$3" local pages=() local options=() local page local i=0 while read page; do page=${page//$path\//} pages+=("$page") options+=("$i" "$page") ((i++)) done < <(find "$path" -type f -regex "$include" ! -regex "$exclude" | sort) local default local file while true; do local cmd=(dialog --default-item "$default" --backtitle "$__backtitle" --menu "Which page would you like to view?" 22 76 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) default="$choice" if [[ -n "$choice" ]]; then file="${pages[choice]}" joy2keyStop joy2keyStart 0x00 0x00 kich1 kdch1 0x20 0x71 pandoc "$dir/docs/$file" | lynx -localhost -restrictions=all -stdin >/dev/tty joy2keyStop joy2keyStart else break fi done } function gui_docsview() { local dir="$rootdir/RetroPie-Docs" while true; do local cmd=(dialog --backtitle "$__backtitle" --menu "RetroPie-Setup Docs Viewer" 22 76 16) local options=() if [[ -d "$dir" ]]; then options=( 1 "Update RetroPie-Setup Docs" 2 "View Pages" 3 "Remove RetroPie-Setup Docs" ) else options+=("1" "Download RetroPie-Setup Docs") fi local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) gitPullOrClone "$dir" "https://github.com/RetroPie/RetroPie-Docs.git" ;; 2) choose_page_docsview "$dir/docs" ".*.md" ".*_.*" ;; 3) if [[ -d "$dir" ]]; then rm -rf "$dir" fi ;; esac else break fi done } ================================================ FILE: scriptmodules/supplementary/emulationstation/configscripts/daphne.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # function check_daphne() { [[ ! -d "$configdir/daphne/" ]] && return 1 return 0 } function onstart_daphne_joystick() { local -r mapping_file="$configdir/daphne/dapinput.ini" local -r force_joy_file="$configdir/daphne/dapinput-forcejoy.ini" local -r force_key_file="$configdir/daphne/dapinput-forcekey.ini" if [[ ! -f "$mapping_file" ]]; then cat > "$mapping_file" << _EOF_ # Daphne custom keyboard and joystick mapping # # Each input is mapped to 2 keyboard keys and one joystick button. # A joystick's first analog stick is also automatically mapped. # # The first two numbers are SDL keyboard codes (or 0 for "none") # Find keyboard codes here: # http://www.daphne-emu.com/mediawiki/index.php/KeyList # # The third number is the joystick button code (or 0 for "none") # Since 0 is reserved for special meaning, joystick button 0 is identified # as 1 here. Button 1 is identified as 2, and so on. # # Find the button you want to map by running: # jstest /dev/input/js0 [KEYBOARD] KEY_UP = 273 114 5 KEY_DOWN = 274 102 7 KEY_LEFT = 276 100 8 KEY_RIGHT = 275 103 6 KEY_BUTTON1 = 306 97 14 KEY_BUTTON2 = 308 115 15 KEY_BUTTON3 = 32 113 16 KEY_START1 = 49 0 4 KEY_START2 = 50 0 0 KEY_COIN1 = 53 0 1 KEY_COIN2 = 54 0 0 KEY_SKILL1 = 304 119 0 KEY_SKILL2 = 122 105 0 KEY_SKILL3 = 120 107 0 KEY_SERVICE = 57 0 0 KEY_TEST = 283 0 0 KEY_RESET = 284 0 0 KEY_SCREENSHOT = 293 0 0 KEY_QUIT = 27 113 17 END _EOF_ fi if [[ ! -f "$force_joy_file" ]]; then cat > "$force_joy_file" << _EOF_ # Daphne custom joystick mapping # # Any inputs defined below will map a joystick button to # Daphne input, regardless of remapping that occurs in emulationstation. # # Each input is mapped to 1 joystick button (or 0 for "none") # # Find joystick button codes by running: # $ jstest /dev/input/js0 # and ADDING ONE to the button code you want. # # Example: Quit will always be js button 14 # KEY_QUIT = 15 # # (Place all entries after [KEYBOARD]) [KEYBOARD] END _EOF_ fi if [[ ! -f "$force_key_file" ]]; then cat > "$force_key_file" << _EOF_ # Daphne custom keyboard mapping # # Any inputs defined below will map keyboard keys to # Daphne input, regardless of remapping that occurs in emulationstation. # # Each input is mapped to 2 keyboard key codes (or 0 for "none") # # Find keyboard codes here: # http://www.daphne-emu.com/mediawiki/index.php/KeyList # # Example: Quit will always be key [Esc] or [Q] # KEY_QUIT = 27 113 # # (Place all entries after [KEYBOARD]) [KEYBOARD] END _EOF_ fi } function map_daphne_joystick() { local input_name="$1" local input_type="$2" local input_id="$3" local input_value="$4" local -r mapping_file="$configdir/daphne/dapinput.ini" local -r force_joy_file="$configdir/daphne/dapinput-forcejoy.ini" local -r force_key_file="$configdir/daphne/dapinput-forcekey.ini" local key case "$input_name" in up) key="KEY_UP" ;; down) key="KEY_DOWN" ;; left) key="KEY_LEFT" ;; right) key="KEY_RIGHT" ;; a) key="KEY_BUTTON1" ;; b) key="KEY_BUTTON2" ;; x) key="KEY_BUTTON3" ;; y) key="KEY_COIN1" ;; leftbottom) key="KEY_SKILL1" ;; rightbottom) key="KEY_SKILL2" ;; lefttop) key="KEY_SKILL3" ;; righttop) key="KEY_SERVICE" ;; start) key="KEY_START1" ;; select) key="KEY_QUIT" ;; *) return ;; esac local key_regex="^$key = (.*) (.*)\$" local button_regex="^$key = (.*)\$" local full_regex="^$key = (.*) (.*) (.*)\$" local line local key1 local key2 local button # See if this key is specified in the override file... while read -r line; do if [[ "$line" =~ $key_regex ]]; then key1="${BASH_REMATCH[1]}" key2="${BASH_REMATCH[2]}" fi done < "$force_key_file" # ...otherwise, use the defaults file. if [[ -z "$key1" || -z "$key2" ]]; then echo "Keymap not found in $force_key_file" while read -r line; do if [[ "$line" =~ $full_regex ]]; then key1="${BASH_REMATCH[1]}" key2="${BASH_REMATCH[2]}" fi done < "$mapping_file" fi # See if this button is specified in the override file... while read -r line; do if [[ "$line" =~ $button_regex ]]; then button="${BASH_REMATCH[1]}" fi done < "$force_joy_file" # ...otherwise, use the config sent to this function. if [[ -z "$button" ]]; then while read -r line; do if [[ "$line" =~ $key_regex ]]; then button=$((input_id+1)) fi done < "$mapping_file" fi # Write new button config sed -i "s/^$key = .* .* .*\$/$key = $key1 $key2 $button/g" "$mapping_file" } ================================================ FILE: scriptmodules/supplementary/emulationstation/configscripts/emulationstation.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # function onstart_emulationstation_joystick() { local es_conf="$home/.emulationstation/es_input.cfg" mkdir -p "$home/.emulationstation" if [[ ! -f "$es_conf" ]]; then echo "" >"$es_conf" else cp "$es_conf" "$es_conf.bak" fi # look for existing inputConfig in config by GUID if [[ $(xmlstarlet sel -t -v "count(/inputList/inputConfig[@deviceGUID=\"$DEVICE_GUID\"])" "$es_conf") -eq 0 ]]; then # if not found by GUID, look for inputConfig with deviceName only if [[ $(xmlstarlet sel -t -v "count(/inputList/inputConfig[@deviceName=\"$DEVICE_NAME\"][not(@deviceGUID)])" "$es_conf") -eq 0 ]]; then # insert new inputConfig entry xmlstarlet ed -L -s "/inputList" -t elem -n newInputConfig -v "" \ -i //newInputConfig -t attr -n "type" -v "$DEVICE_TYPE" \ -i //newInputConfig -t attr -n "deviceName" -v "$DEVICE_NAME" \ -i //newInputConfig -t attr -n "deviceGUID" -v "$DEVICE_GUID" \ -r //newInputConfig -v inputConfig \ "$es_conf" else # add deviceGUID to inputConfig xmlstarlet ed -L \ -i "/inputList/inputConfig[@deviceName=\"$DEVICE_NAME\"]" -t attr -n "deviceGUID" -v "$DEVICE_GUID" \ "$es_conf" fi fi } function map_emulationstation_joystick() { local input_name="$1" local input_type="$2" local input_id="$3" local input_value="$4" local key case "$input_name" in leftbottom|leftshoulder) key="pageup" ;; rightbottom|rightshoulder) key="pagedown" ;; up|right|down|left|start|select|x|y|leftanalogup|leftanalogright|leftanalogdown|leftanalogleft|rightanalogup|rightanalogright|rightanalogdown|rightanalogleft) key="$input_name" ;; a) key="$input_name" getAutoConf es_swap_a_b && key="b" ;; b) key="$input_name" getAutoConf es_swap_a_b && key="a" ;; *) return ;; esac local es_conf="$home/.emulationstation/es_input.cfg" # add or update element if [[ $(xmlstarlet sel -t -v "count(/inputList/inputConfig[@deviceGUID=\"$DEVICE_GUID\"]/input[@name=\"$key\"])" "$es_conf") -eq 0 ]]; then xmlstarlet ed -L -s "/inputList/inputConfig[@deviceGUID=\"$DEVICE_GUID\"]" -t elem -n newinput -v "" \ -i //newinput -t attr -n "name" -v "$key" \ -i //newinput -t attr -n "type" -v "$input_type" \ -i //newinput -t attr -n "id" -v "$input_id" \ -i //newinput -t attr -n "value" -v "$input_value" \ -r //newinput -v input \ "$es_conf" else # if device already exists, update it xmlstarlet ed -L \ -u "/inputList/inputConfig[@deviceGUID=\"$DEVICE_GUID\"]/input[@name=\"$key\"]/@type" -v "$input_type" \ -u "/inputList/inputConfig[@deviceGUID=\"$DEVICE_GUID\"]/input[@name=\"$key\"]/@id" -v "$input_id" \ -u "/inputList/inputConfig[@deviceGUID=\"$DEVICE_GUID\"]/input[@name=\"$key\"]/@value" -v "$input_value" \ "$es_conf" fi } function onstart_emulationstation_keyboard() { onstart_emulationstation_joystick "$@" } function map_emulationstation_keyboard() { map_emulationstation_joystick "$@" } function onstart_emulationstation_cec() { onstart_emulationstation_joystick "$@" } function map_emulationstation_cec() { map_emulationstation_joystick "$@" } ================================================ FILE: scriptmodules/supplementary/emulationstation/configscripts/mupen64plus.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # function onstart_mupen64plus_joystick() { # write temp file header echo "; ${DEVICE_NAME}_START " > /tmp/mp64tempconfig.cfg echo "[${DEVICE_NAME}]" >> /tmp/mp64tempconfig.cfg iniConfig " = " "" "/tmp/mp64tempconfig.cfg" iniSet "plugged" "True" iniSet "plugin" "2" iniSet "mouse" "False" iniSet "AnalogDeadzone" "4096,4096" iniSet "AnalogPeak" "32768,32768" iniSet "Mempak switch" "" iniSet "Rumblepak switch" "" } function map_mupen64plus_joystick() { local input_name="$1" local input_type="$2" local input_id="$3" local input_value="$4" local keys local dir case "$input_name" in up) keys=("DPad U") dir=("Up") ;; down) keys=("DPad D") dir=("Down") ;; left) keys=("DPad L") dir=("Left") ;; right) keys=("DPad R") dir=("Right") ;; b) keys=("A Button") ;; y) keys=("B Button") ;; a) keys=("C Button D") ;; x) keys=("C Button U") ;; leftbottom|leftshoulder) keys=("L Trig") ;; rightbottom|rightshoulder) keys=("R Trig") ;; lefttop|lefttrigger) keys=("Z Trig") ;; start) keys=("Start") ;; leftanalogleft) keys=("X Axis") dir=("Left") ;; leftanalogright) keys=("X Axis") dir=("Right") ;; leftanalogup) keys=("Y Axis") dir=("Up") ;; leftanalogdown) keys=("Y Axis") dir=("Down") ;; rightanalogleft) keys=("C Button L") dir=("Left") ;; rightanalogright) keys=("C Button R") dir=("Right") ;; rightanalogup) keys=("C Button U") dir=("Up") ;; rightanalogdown) keys=("C Button D") dir=("Down") ;; leftthumb) keys=("Mempak switch") ;; rightthumb) keys=("Rumblepak switch") ;; *) return ;; esac local key local value #iniConfig " = " "" "/tmp/mp64keys.cfg" for key in "${keys[@]}"; do # read key value. Axis takes two key/axis values. iniGet "$key" case "$input_type" in axis) # key "X/Y Axis" needs different button naming if [[ "$key" == *Axis* ]]; then # if there is already a "-" axis add "+" axis value if [[ "$ini_value" == *\(* ]]; then value="${ini_value}${input_id}+)" # if there is already a "+" axis add "-" axis value elif [[ "$ini_value" == *\)* ]]; then value="axis(${input_id}-,${ini_value}" # if there is no ini_value add "+" axis value elif [[ "$input_value" == "1" ]]; then value="${input_id}+)" else value="axis(${input_id}-," fi elif [[ "$input_value" == "1" ]]; then value="axis(${input_id}+) ${ini_value}" else value="axis(${input_id}-) ${ini_value}" fi ;; hat) if [[ "$key" == *Axis* ]]; then if [[ "$ini_value" == *\(* ]]; then value="${ini_value}${dir})" elif [[ "$ini_value" == *\)* ]]; then value="hat(${input_id} ${dir} ${ini_value}" elif [[ "$dir" == "Up" || "$dir" == "Left" ]]; then value="hat(${input_id} ${dir} " elif [[ "$dir" == "Right" || "$dir" == "Down" ]]; then value="${dir})" fi else if [[ -n "$dir" ]]; then value="hat(${input_id} ${dir}) ${ini_value}" fi fi ;; *) if [[ "$key" == *Axis* ]]; then if [[ "$ini_value" == *\(* ]]; then value="${ini_value}${input_id})" elif [[ "$ini_value" == *\)* ]]; then value="button(${input_id},${ini_value}" elif [[ "$dir" == "Up" || "$dir" == "Left" ]]; then value="button(${input_id}," elif [[ "$dir" == "Right" || "$dir" == "Down" ]]; then value="${input_id})" fi else value="button(${input_id}) ${ini_value}" fi ;; esac iniSet "$key" "$value" done } function onend_mupen64plus_joystick() { local bind local axis local axis_neg local axis_pos for axis in "X Axis" "Y Axis"; do if [[ "$axis" == *X* ]]; then axis_neg="DPad L" axis_pos="DPad R" else axis_neg="DPad U" axis_pos="DPad D" fi # analog stick sanity check # replace Axis values with DPAD values if there is no Axis # device setup if ! grep -q "$axis" /tmp/mp64tempconfig.cfg ; then iniGet "${axis_neg}" bind=${ini_value//)/,} iniGet "${axis_pos}" ini_value=${ini_value//axis(/} ini_value=${ini_value//hat(/} ini_value=${ini_value//button(/} bind="${bind}${ini_value}" iniSet "$axis" "$bind" iniDel "${axis_neg}" iniDel "${axis_pos}" fi done # If there is no Z Trig try to map the L shoulder # button to it via copying over the existing L Trig # value and deleting it (L Trig) after if ! grep -q "Z Trig" /tmp/mp64tempconfig.cfg ; then iniGet "L Trig" iniSet "Z Trig" "${ini_value}" iniDel "L Trig" fi echo "; ${DEVICE_NAME}_END " >> /tmp/mp64tempconfig.cfg echo "" >> /tmp/mp64tempconfig.cfg # abort if old device config cannot be deleted. # keep original mupen64plus-input-sdl configs. local file="$configdir/n64/InputAutoCfg.ini" if [[ -f "$file" ]]; then # backup current config file cp "$file" "${file}.bak" local escaped_device_name=$(echo "$DEVICE_NAME" | sed 's|[]\[^$.*/]|\\&|g') sed -i /"${escaped_device_name}_START"/,/"${escaped_device_name}_END"/d "$file" if grep -Fq "$DEVICE_NAME" "$file" ; then rm /tmp/mp64tempconfig.cfg return fi else cat > "$file" << _EOF_ ; InputAutoCfg.ini for Mupen64Plus SDL Input plugin ; Keyboard_START [Keyboard] plugged = True plugin = 2 mouse = False DPad R = key(100) DPad L = key(97) DPad D = key(115) DPad U = key(119) Start = key(13) Z Trig = key(122) B Button = key(306) A Button = key(304) C Button R = key(108) C Button L = key(106) C Button D = key(107) C Button U = key(105) R Trig = key(99) L Trig = key(120) Mempak switch = key(44) Rumblepak switch = key(46) X Axis = key(276,275) Y Axis = key(273,274) ; Keyboard_END _EOF_ fi # append temp device configuration to InputAutoCfg.ini cat /tmp/mp64tempconfig.cfg >> "$file" rm /tmp/mp64tempconfig.cfg } ================================================ FILE: scriptmodules/supplementary/emulationstation/configscripts/openmsx.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # function onstart_openmsx_joystick() { truncate --size 0 /tmp/openMSXtemp.cfg } # Function to return the binding configuration string, when mapping to the MSX machine joystick # See https://openmsx.org/manual/commands.html#joystickN_config function _get_msx_bind() { local input_name="$1" local input_type="$2" local input_id="$3" local input_value="$4" declare -A sdl_hat_directions=([1]="U" [2]="R" [4]="D" [8]="L") case "$input_type" in button) echo "button${input_id}" ;; axis) if [[ $input_value =~ ^- ]]; then echo "-axis${input_id}" else echo "+axis${input_id}" fi ;; hat) echo "${sdl_hat_directions[${input_value}]}_hat${input_id}" ;; *) ;; esac } # Function to return the binding configuration string, when mapping to openMSX emulator actions # See http://openmsx.org/manual/commands.html#bind function _get_emu_bind() { local input_name="$1" local input_type="$2" local input_id="$3" local input_value="$4" declare -A sdl_hat_directions=([1]="up" [2]="right" [4]="down" [8]="left") case "$input_type" in button) echo "button${input_id} down" ;; axis) if [[ $input_value =~ ^- ]]; then echo "axis${input_id} -1" else echo "+axis${input_id} +1" fi ;; hat) echo "hat${input_id} ${sdl_hat_directions[${input_value}]}" ;; *) ;; esac } function map_openmsx_joystick() { local input_name="$1" local input_type="$2" local input_id="$3" local input_value="$4" local bind_msx_joystick=$(_get_msx_bind "$1" "$2" "$3" "$4") local bind_msx_emulator=$(_get_emu_bind "$1" "$2" "$3" "$4") local msx_key local emu_key local temp_conf="/tmp/openMSXtemp.cfg" case "$input_name" in a) msx_key="A" ;; b) msx_key="B" ;; up|leftanalogup) msx_key="UP" ;; down|leftanalogdown) msx_key="DOWN" ;; left|leftanalogleft) msx_key="LEFT" ;; right|leftanalogright) msx_key="RIGHT" ;; x) emu_key="keymatrixdown 6 0x40" # F1 ;; y) emu_key="keymatrixdown 6 0x20" # F2 ;; lefttop|leftshoulder|pageup) emu_key="keymatrixdown 6 0x80" # F3 ;; righttop|rightshoulder|pagedown) emu_key="keymatrixdown 7 0x01" # F4 ;; start) emu_key="main_menu_open" ;; select) emu_key="toggle_osd_keyboard" ;; *) return ;; esac if [[ -n $msx_key ]]; then echo " dict lappend joystick1_config $msx_key $bind_msx_joystick" >> "$temp_conf" fi if [[ -n $emu_key ]]; then # Don't try to bind a non-button input to a keyboard key, there's no 'release' event for axis/hat inputs [[ $emu_key =~ ^keymatrixdown && ! $bind_msx_emulator =~ "button" ]] && return echo " bind_default \"joy1 $bind_msx_emulator\" \"$emu_key\"" >> "$temp_conf" if [[ $emu_key =~ ^keymatrixdown ]]; then echo " bind_default \"joy1 ${bind_msx_emulator//down/up}\" \"${emu_key//down/up}\"" >> "$temp_conf" fi fi # Add an extra configuration for 'Start' to close the OSD menu if [[ "$input_name" == "start" ]]; then echo " bind \"joy1 ${bind_msx_emulator}\" -layer osd_menu \"main_menu_close\"" >> "$temp_conf" fi } function onend_openmsx_joystick() { local conf # sanitize filename conf=${DEVICE_NAME//[:> "$home/.openMSX/share/joystick/${conf}.tcl" <<_EOF_ proc auto_config_joypad { } { # clear existing joypad configuration global joystick1_config dict for {btn binding} \$joystick1_config { dict set joystick1_config \$btn {} } $(sort /tmp/openMSXtemp.cfg ) } _EOF_ # Add a note about game overrides cat > "$home/.openMSX/share/joystick/README.txt" <<_EOF2_ This folder contains joypad configuration scripts, generated by EmulationStation's input configuration. They are read by openMSX at start-up and loaded automatically when the corresponding joypad is plugged in. If you wish to have a game specific joystick configuration, you can override the gamepad's configuration by: * copy an already existing controller '.tcl' configuration file to the 'game' subfolder. * edit the file and adjust the 'bind_default' commands or the 'joystick1_config' configuration. See the openMSX documentation for how to use those commands: - http://openmsx.org/manual/commands.html#bind - https://openmsx.org/manual/commands.html#joystickN_config - http://map.grauw.nl/articles/keymatrix.php * rename the new '.tcl' file so the name is similar to the disk/tape/rom name (i.e. 'Metal Gear.zip' will load 'Metal Gear.tcl'). If you are not sure which name to use, start the game, then press 'F10' and type 'guess_title', followed by Enter. openMSX will print the content name, which you can then use as a filename for the override configuration file. NOTE: special characters '(:?/\*)', are automatically striped from the name so if your content file is 'ABC?.dsk', then the configuration file should be 'ABC.tcl'. _EOF2_ rm /tmp/openMSXtemp.cfg } ================================================ FILE: scriptmodules/supplementary/emulationstation/configscripts/pifba.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # function _get_config_pifba() { echo "$configdir/fba/fba2x.cfg" } function _split_config_pifba() { local cfg="$(_get_config_pifba)" sed -n '/\[Keyboard\]/,/\[/p' "$cfg" | head -n -1 >/tmp/pifba-kb.cfg sed -n '/\[Joystick\]/,/\[/p' "$cfg" | head -n -1 >/tmp/pifba-js.cfg sed -n '/\[Graphics\]/,/\[/p' "$cfg" | head -n -1 >/tmp/pifba-gfx.cfg } function check_pifba() { [[ ! -f "$(_get_config_pifba)" ]] && return 1 return 0 } function onstart_pifba_joystick() { _split_config_pifba iniConfig "=" "" /tmp/pifba-js.cfg } function onstart_pifba_keyboard() { _split_config_pifba iniConfig "=" "" /tmp/pifba-kb.cfg sdl1_map } function map_pifba_keyboard() { local input_name="$1" local input_type="$2" local input_id="$3" local input_value="$4" local key case "$input_name" in up) key="UP_1" ;; down) key="DOWN_1" ;; left) key="LEFT_1" ;; right) key="RIGHT_1" ;; a) key="A_1" ;; b) key="B_1" ;; x) key="X_1" ;; y) key="Y_1" ;; leftbottom|leftshoulder) key="L_1" ;; rightbottom|rightshoulder) key="R_1" ;; start) key="START_1" ;; select) key="SELECT_1" ;; *) return ;; esac iniSet "$key" "${sdl1_map[$input_id]}" } function map_pifba_joystick() { local input_name="$3" local input_type="$4" local input_id="$5" local input_value="$6" local key case "$input_name" in up|down) key="JA_UD" ;; left|right) key="JA_LR" ;; a) key="A_1" ;; b) key="B_1" ;; x) key="X_1" ;; y) key="Y_1" ;; leftbottom|leftshoulder) key="L_1" ;; rightbottom|rightshoulder) key="R_1" ;; start) key="START_1" ;; select) key="SELECT_1" ;; leftthumb) key="QSAVE" ;; rightthumb) key="QLOAD" ;; *) return ;; esac iniSet "$key" "$input_id" } function onend_pifba_joystick() { local cfg="$configdir/fba/fba2x.cfg" cat "/tmp/pifba-kb.cfg" "/tmp/pifba-js.cfg" "/tmp/pifba-gfx.cfg" >"$cfg" rm /tmp/pifba-{kb,js,gfx}.cfg } function onend_pifba_keyboard() { onend_pifba_joystick } ================================================ FILE: scriptmodules/supplementary/emulationstation/configscripts/pisnes.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # function _get_config_pisnes() { echo "$configdir/snes/snes9x.cfg" } function _split_config_pisnes() { local cfg="$(_get_config_pisnes)" sed -n '/\[Keyboard\]/,/\[/p' "$cfg" | head -n -1 >/tmp/pisnes-kb.cfg sed -n '/\[Joystick\]/,/\[/p' "$cfg" | head -n -1 >/tmp/pisnes-js.cfg sed -n '/\[Graphics\]/,/\[/p' "$cfg" | head -n -1 >/tmp/pisnes-gfx.cfg } function check_pisnes() { [[ ! -f "$(_get_config_pisnes)" ]] && return 1 return 0 } function onstart_pisnes_joystick() { _split_config_pisnes iniConfig "=" "" /tmp/pisnes-js.cfg } function onstart_pisnes_keyboard() { _split_config_pisnes iniConfig "=" "" /tmp/pisnes-kb.cfg sdl1_map } function map_pisnes_keyboard() { map_pifba_keyboard "$@" } function map_pisnes_joystick() { map_pifba_joystick "$@" } function onend_pisnes_joystick() { local cfg="$configdir/snes/snes9x.cfg" cat "/tmp/pisnes-kb.cfg" "/tmp/pisnes-js.cfg" "/tmp/pisnes-gfx.cfg" >"$cfg" rm /tmp/pisnes-{kb,js,gfx}.cfg } function onend_pisnes_keyboard() { onend_pisnes_joystick } ================================================ FILE: scriptmodules/supplementary/emulationstation/configscripts/reicast.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # function onstart_reicast_joystick() { local file case "$DEVICE_NAME" in "Xbox 360 Controller (xpad driver)") file="$configdir/dreamcast/mappings/controller_xpad.cfg" ;; "Xbox 360 Controller (xboxdrv userspace driver)") file="$configdir/dreamcast/mappings/controller_xboxdrv.cfg" ;; *) file="$configdir/dreamcast/mappings/evdev_${DEVICE_NAME//[:> "$file" << _EOF_ [emulator] mapping_name = btn_escape = [dreamcast] btn_a = btn_b = btn_c = btn_d = btn_x = btn_y = btn_z = btn_start = btn_dpad1_left = btn_dpad1_right = btn_dpad1_up = btn_dpad1_down = btn_dpad2_left = btn_dpad2_right = btn_dpad2_up = btn_dpad2_down = axis_x = axis_y = axis_trigger_left = axis_trigger_right = [compat] btn_trigger_left = btn_trigger_right = axis_dpad1_x = axis_dpad1_y = axis_dpad2_x = axis_dpad2_y = axis_x_inverted = axis_y_inverted = axis_trigger_left_inverted = axis_trigger_right_inverted = _EOF_ # write temp file header iniConfig " = " "" "$file" iniSet "mapping_name" "$DEVICE_NAME" } function map_reicast_joystick() { local input_name="$1" local input_type="$2" local input_id="$3" local input_value="$4" local keys local dir case "$input_name" in up) keys=("btn_dpad1_up") ;; down) keys=("btn_dpad1_down") ;; left) keys=("btn_dpad1_left") ;; right) keys=("btn_dpad1_right") ;; a) keys=("btn_b") ;; b) keys=("btn_a") ;; x) keys=("btn_y") ;; y) keys=("btn_x") ;; leftbottom|leftshoulder) keys=("btn_trigger_left") ;; rightbottom|rightshoulder) keys=("btn_trigger_right") ;; lefttop|lefttrigger) keys=("axis_trigger_left") ;; righttop|righttrigger) keys=("axis_trigger_right") ;; start) keys=("btn_start") ;; select) keys=("btn_escape") ;; leftanalogleft) keys=("axis_x") ;; leftanalogright) keys=("axis_x") ;; leftanalogup) keys=("axis_y") ;; leftanalogdown) keys=("axis_y") ;; rightanalogleft) keys=("axis_dpad1_x") ;; rightanalogright) keys=("axis_dpad1_x") ;; rightanalogup) keys=("axis_dpad1_y") ;; rightanalogdown) keys=("axis_dpad1_y") ;; *) return ;; esac local key local value for key in "${keys[@]}"; do # read key value. Axis takes two key/axis values. case "$input_type" in axis) # key "X/Y Axis" needs different button naming if [[ "$key" == "btn_trigger_left" ]] ; then iniSet "axis_trigger_left" "$input_id" iniSet "axis_trigger_left_inverted" "no" elif [[ "$key" == "btn_trigger_right" ]] ; then iniSet "axis_trigger_right" "$input_id" iniSet "axis_trigger_right_inverted" "no" elif [[ "$key" == "btn_dpad1_up" || "$key" == "btn_dpad1_down" ]]; then iniSet "axis_y" "$input_id" iniSet "axis_y_inverted" "no" elif [[ "$key" == "btn_dpad1_left" || "$key" == "btn_dpad1_right" ]]; then iniSet "axis_x" "$input_id" iniSet "axis_x_inverted" "no" elif [[ "$key" == *axis* ]] ; then case "$DEVICE_NAME" in "Xbox 360 Controller (xpad driver)"|"Xbox 360 Controller (xboxdrv userspace driver)"|"Microsoft X-Box 360 pad"|"Xbox Gamepad (userspace driver)"|"Xbox 360 Wireless Receiver (XBOX)"|"Microsoft X-Box One pad"|"Microsoft X-Box pad (Japan)"|"Chinese-made Xbox Controller") if [[ "$input_id" -gt 2 && "$input_id" -lt 5 ]]; then input_id=$(($input_id+13)) fi ;; esac iniSet "${key}" "$input_id" iniSet "${key}_inverted" "no" fi ;; hat) ;; *) if [[ "$key" != *axis* ]] ; then # input_id must be recalculated: 288d = button 0 input_id=$(($input_id+288)) # workaround for specific controller button mismatch case "$DEVICE_NAME" in "Xbox 360 Controller (xpad driver)"|"Xbox 360 Controller (xboxdrv userspace driver)"|"Microsoft X-Box 360 pad"|"Xbox Gamepad (userspace driver)"|"Xbox 360 Wireless Receiver (XBOX)"|"Microsoft X-Box One pad"|"Microsoft X-Box pad (Japan)"|"Chinese-made Xbox Controller") if [[ "$input_id" -lt "294" ]]; then input_id=$(($input_id+16)) else input_id=$(($input_id+20)) fi ;; esac iniSet "$key" "$input_id" fi ;; esac done } function onend_reicast_joystick() { local file case "$DEVICE_NAME" in "Xbox 360 Controller (xpad driver)") file="$configdir/dreamcast/mappings/controller_xpad.cfg" ;; "Xbox 360 Controller (xboxdrv userspace driver)") file="$configdir/dreamcast/mappings/controller_xboxdrv.cfg" ;; *) file="$configdir/dreamcast/mappings/evdev_${DEVICE_NAME//[:>> "$file" } ================================================ FILE: scriptmodules/supplementary/emulationstation/configscripts/retroarch.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # function onstart_retroarch_joystick() { iniConfig " = " '"' "$configdir/all/retroarch.cfg" iniGet "input_joypad_driver" local input_joypad_driver="$ini_value" if [[ -z "$input_joypad_driver" ]]; then input_joypad_driver="udev" fi _retroarch_select_hotkey=1 _atebitdo_hack=0 getAutoConf "8bitdo_hack" && _atebitdo_hack=1 iniConfig " = " "\"" "/tmp/tempconfig.cfg" iniSet "input_device" "$DEVICE_NAME" iniSet "input_driver" "$input_joypad_driver" # add vendor and product ids if non-empty if [[ -n "$VENDOR_ID" && -n "$PRODUCT_ID" ]]; then iniSet "input_vendor_id" "$VENDOR_ID" iniSet "input_product_id" "$PRODUCT_ID" fi } function onstart_retroarch_keyboard() { iniConfig " = " '"' "$configdir/all/retroarch.cfg" _retroarch_select_hotkey=1 declare -Ag retroarchkeymap # SDL codes from https://wiki.libsdl.org/SDLKeycodeLookup retroarchkeymap["1073741904"]="left" retroarchkeymap["1073741903"]="right" retroarchkeymap["1073741906"]="up" retroarchkeymap["1073741905"]="down" retroarchkeymap["13"]="enter" retroarchkeymap["1073741912"]="kp_enter" retroarchkeymap["9"]="tab" retroarchkeymap["1073741897"]="insert" retroarchkeymap["127"]="del" retroarchkeymap["1073741901"]="end" retroarchkeymap["1073741898"]="home" retroarchkeymap["1073742053"]="rshift" retroarchkeymap["1073742049"]="shift" retroarchkeymap["1073742048"]="ctrl" retroarchkeymap["1073742050"]="alt" retroarchkeymap["32"]="space" retroarchkeymap["27"]="escape" retroarchkeymap["43"]="add" retroarchkeymap["45"]="subtract" retroarchkeymap["1073741911"]="kp_plus" retroarchkeymap["1073741910"]="kp_minus" retroarchkeymap["1073741882"]="f1" retroarchkeymap["1073741883"]="f2" retroarchkeymap["1073741884"]="f3" retroarchkeymap["1073741885"]="f4" retroarchkeymap["1073741886"]="f5" retroarchkeymap["1073741887"]="f6" retroarchkeymap["1073741888"]="f7" retroarchkeymap["1073741889"]="f8" retroarchkeymap["1073741890"]="f9" retroarchkeymap["1073741891"]="f10" retroarchkeymap["1073741892"]="f11" retroarchkeymap["1073741893"]="f12" retroarchkeymap["48"]="num0" retroarchkeymap["49"]="num1" retroarchkeymap["50"]="num2" retroarchkeymap["51"]="num3" retroarchkeymap["52"]="num4" retroarchkeymap["53"]="num5" retroarchkeymap["54"]="num6" retroarchkeymap["55"]="num7" retroarchkeymap["56"]="num8" retroarchkeymap["57"]="num9" retroarchkeymap["1073741899"]="pageup" retroarchkeymap["1073741902"]="pagedown" retroarchkeymap["1073741922"]="keypad0" retroarchkeymap["1073741913"]="keypad1" retroarchkeymap["1073741914"]="keypad2" retroarchkeymap["1073741915"]="keypad3" retroarchkeymap["1073741916"]="keypad4" retroarchkeymap["1073741917"]="keypad5" retroarchkeymap["1073741918"]="keypad6" retroarchkeymap["1073741919"]="keypad7" retroarchkeymap["1073741920"]="keypad8" retroarchkeymap["1073741921"]="keypad9" retroarchkeymap["46"]="period" retroarchkeymap["1073741881"]="capslock" retroarchkeymap["1073741907"]="numlock" retroarchkeymap["8"]="backspace" retroarchkeymap["42"]="multiply" retroarchkeymap["47"]="divide" retroarchkeymap["1073741894"]="print_screen" retroarchkeymap["1073741895"]="scroll_lock" retroarchkeymap["96"]="backquote" retroarchkeymap["1073741896"]="pause" retroarchkeymap["39"]="quote" retroarchkeymap["44"]="comma" retroarchkeymap["45"]="minus" retroarchkeymap["47"]="slash" retroarchkeymap["59"]="semicolon" retroarchkeymap["61"]="equals" retroarchkeymap["91"]="leftbracket" retroarchkeymap["92"]="backslash" retroarchkeymap["93"]="rightbracket" retroarchkeymap["1073741923"]="kp_period" retroarchkeymap["1073741927"]="kp_equals" retroarchkeymap["1073742052"]="rctrl" retroarchkeymap["1073742054"]="ralt" retroarchkeymap["97"]="a" retroarchkeymap["98"]="b" retroarchkeymap["99"]="c" retroarchkeymap["100"]="d" retroarchkeymap["101"]="e" retroarchkeymap["102"]="f" retroarchkeymap["103"]="g" retroarchkeymap["104"]="h" retroarchkeymap["105"]="i" retroarchkeymap["106"]="j" retroarchkeymap["107"]="k" retroarchkeymap["108"]="l" retroarchkeymap["109"]="m" retroarchkeymap["110"]="n" retroarchkeymap["111"]="o" retroarchkeymap["112"]="p" retroarchkeymap["113"]="q" retroarchkeymap["114"]="r" retroarchkeymap["115"]="s" retroarchkeymap["116"]="t" retroarchkeymap["117"]="u" retroarchkeymap["118"]="v" retroarchkeymap["119"]="w" retroarchkeymap["120"]="x" retroarchkeymap["121"]="y" retroarchkeymap["122"]="z" # special case for disabled hotkey retroarchkeymap["0"]="nul" } function map_retroarch_joystick() { local input_name="$1" local input_type="$2" local input_id="$3" local input_value="$4" local keys case "$input_name" in up) keys=("input_up") ;; down) keys=("input_down") ;; left) keys=("input_left" "input_state_slot_decrease") ;; right) keys=("input_right" "input_state_slot_increase") ;; a) keys=("input_a") ;; b) keys=("input_b" "input_reset") ;; x) keys=("input_x" "input_menu_toggle") ;; y) keys=("input_y") ;; leftbottom|leftshoulder) keys=("input_l" "input_load_state") ;; rightbottom|rightshoulder) keys=("input_r" "input_save_state") ;; lefttop|lefttrigger) keys=("input_l2") ;; righttop|righttrigger) keys=("input_r2") ;; leftthumb) keys=("input_l3") ;; rightthumb) keys=("input_r3") ;; start) keys=("input_start" "input_exit_emulator") ;; select) keys=("input_select") ;; leftanalogleft) keys=("input_l_x_minus") ;; leftanalogright) keys=("input_l_x_plus") ;; leftanalogup) keys=("input_l_y_minus") ;; leftanalogdown) keys=("input_l_y_plus") ;; rightanalogleft) keys=("input_r_x_minus") ;; rightanalogright) keys=("input_r_x_plus") ;; rightanalogup) keys=("input_r_y_minus") ;; rightanalogdown) keys=("input_r_y_plus") ;; hotkeyenable) keys=("input_enable_hotkey") _retroarch_select_hotkey=0 if [[ "$input_type" == "key" && "$input_id" == "0" ]]; then return fi ;; *) return ;; esac local key local value local type declare -A hat_map=([1]="up" [2]="right" [4]="down" [8]="left") iniGet "input_driver" local input_driver="$ini_value" local autoconfig_preset=$(grep -rwFl "$rootdir/emulators/retroarch/autoconfig-presets/$input_driver" -e "$DEVICE_NAME" | head -1) for key in "${keys[@]}"; do case "$input_type" in hat) # check if hat input value is correct [[ -z ${hat_map[$input_value]} ]] && return type="btn" value="h$input_id${hat_map[$input_value]}" ;; axis) type="axis" if [[ "$input_value" == "1" ]]; then value="+$input_id" else value="-$input_id" fi ;; *) type="btn" value="$input_id" # workaround for mismatched controller mappings if [[ "$input_driver" == "udev" ]]; then case "$DEVICE_NAME" in "8Bitdo FC30"*|"8Bitdo NES30"*|"8Bitdo SFC30"*|"8Bitdo SNES30"*|"8Bitdo Zero"*) if [[ "$_atebitdo_hack" -eq 1 ]]; then value="$((input_id+11))" fi ;; esac fi ;; esac if [[ "$input_name" == "select" && "$_retroarch_select_hotkey" -eq 1 ]]; then _retroarch_select_type="$type" fi key+="_$type" iniSet "$key" "$value" # set button labels from autoconfig preset (if available), when binding matches the preset if [[ -f "$autoconfig_preset" ]]; then iniGet "$key" "$autoconfig_preset" if [[ "$ini_value" == "$value" ]]; then key+="_label" iniGet "$key" "$autoconfig_preset" [[ -n "$ini_value" ]] && iniSet "$key" "$ini_value" fi fi done } function map_retroarch_keyboard() { local input_name="$1" local input_type="$2" local input_id="$3" local input_value="$4" local key case "$input_name" in up) keys=("input_player1_up") ;; down) keys=("input_player1_down") ;; left) keys=("input_player1_left" "input_state_slot_decrease") ;; right) keys=("input_player1_right" "input_state_slot_increase") ;; a) keys=("input_player1_a") ;; b) keys=("input_player1_b" "input_reset") ;; x) keys=("input_player1_x" "input_menu_toggle") ;; y) keys=("input_player1_y") ;; leftbottom|leftshoulder) keys=("input_player1_l" "input_load_state") ;; rightbottom|rightshoulder) keys=("input_player1_r" "input_save_state") ;; lefttop|lefttrigger) keys=("input_player1_l2") ;; righttop|righttrigger) keys=("input_player1_r2") ;; leftthumb) keys=("input_player1_l3") ;; rightthumb) keys=("input_player1_r3") ;; start) keys=("input_player1_start" "input_exit_emulator") ;; select) keys=("input_player1_select") ;; hotkeyenable) keys=("input_enable_hotkey") _retroarch_select_hotkey=0 ;; *) return ;; esac for key in "${keys[@]}"; do iniSet "$key" "${retroarchkeymap[$input_id]}" done } function onend_retroarch_joystick() { # if $_retroarch_select_hotkey is set here, then there was no hotkeyenable button # in the configuration, so we should use the select button as hotkey enable if set if [[ "$_retroarch_select_hotkey" -eq 1 ]]; then iniGet "input_select_${_retroarch_select_type}" [[ -n "$ini_value" ]] && iniSet "input_enable_hotkey_${_retroarch_select_type}" "$ini_value" fi # hotkey sanity check # remove hotkeys if there is no hotkey enable button if ! grep -q "input_enable_hotkey" /tmp/tempconfig.cfg; then local key for key in input_state_slot_decrease input_state_slot_increase input_reset input_menu_toggle input_load_state input_save_state input_exit_emulator; do sed -i "/$key/d" /tmp/tempconfig.cfg done fi # disable any auto configs for the same device to avoid duplicates local file local dir="$configdir/all/retroarch-joypads" while read -r file; do mv "$file" "$file.bak" done < <(grep -Fl "\"$DEVICE_NAME\"" "$dir/"*.cfg 2>/dev/null) # sanitise filename file="${DEVICE_NAME//[:> "$temp_file" } function map_sdl2_joystick() { local input_name="$1" local input_type="$2" local input_id="$3" local input_value="$4" local input_temp_map="$(_temp_file_sdl2)" # map ES input name => SDL Gamecontroller mapping label declare -A input_map=( [up]="dpup" [down]="dpdown" [left]="dpleft" [right]="dpright" [a]="a" [b]="b" [x]="x" [y]="y" [start]="start" [select]="back" [hotkeyenable]="guide" [leftshoulder]="leftshoulder" [lefttrigger]="lefttrigger" [rightshoulder]="rightshoulder" [righttrigger]="righttrigger" [leftthumb]="leftstick" [leftanalogright]="leftx" [leftanalogdown]="lefty" [rightthumb]="rightstick" [rightanalogright]="rightx" [rightanalogdown]="righty" [pageup]="rightshoulder" [pagedown]="leftshoulder" ) local sdl2_mapped_input sdl2_mapped_input=${input_map[$input_name]} # when the SDL mapped action/input is not defined skip the mapping [[ -z "$sdl2_mapped_input" ]] && return case "$input_type" in axis) # add the direction for D-Pads only if [[ "$sdl2_mapped_input" == "dp"* ]]; then if [[ "$input_value" == "-1" ]]; then echo "$sdl2_mapped_input:-a${input_id}" >> "$input_temp_map" else echo "$sdl2_mapped_input:+a${input_id}" >> "$input_temp_map" fi else echo "$sdl2_mapped_input:a${input_id}" >> "$input_temp_map" fi ;; hat) echo "$sdl2_mapped_input:h${input_id}.${input_value}" >> "$input_temp_map" ;; button) echo "$sdl2_mapped_input:b${input_id}" >> "$input_temp_map" ;; *) ;; esac } function onend_sdl2_joystick() { # check whether SDL2 already has a mapping for this GUID if [[ "$(_check_gamepad_sdl2)" == "MAPPED" ]]; then echo "W: Device \"$DEVICE_NAME\" (guid: $DEVICE_GUID) is already known by SDL2, gamecontroller mapping was not created" return fi # gamecontroller name sanitization: # - replace unexpected chars with '-' # - trim blanks from the name (beginning/end) # - replace ',' with space, since ',' is a delimiter in the mapping string local joyname="$(echo ${DEVICE_NAME//[:>> "$sdl_configs" fi rm -f "$input_temp_map" } # function to check whether a gamepad GUID is already in SDL2's mapping list # we need to load SDL2's GameController subsystem and query by GUID function _check_gamepad_sdl2() { cat << EOF > "/tmp/guid_check.py" from sdl2 import SDL_GameControllerMappingForGUID,\ SDL_Init,SDL_Quit,SDL_Error,\ SDL_INIT_GAMECONTROLLER from sdl2.joystick import SDL_JoystickGetGUIDFromString if SDL_Init(SDL_INIT_GAMECONTROLLER) < 0: exit(2) guid_str=b"${DEVICE_GUID}" guid = SDL_JoystickGetGUIDFromString(guid_str) map = SDL_GameControllerMappingForGUID(guid) SDL_Quit() if map is not None: exit(0) exit(1) EOF python3 /tmp/guid_check.py 1>/dev/null 2>&1 && echo "MAPPED" rm -f "/tmp/guid_check.py" } function _temp_file_sdl2() { echo "/tmp/sdl2temp.txt" } ================================================ FILE: scriptmodules/supplementary/emulationstation/inputconfiguration.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # ## @file scriptmodules/supplementary/emulationstation/inputconfiguration.sh ## @brief input configuration script ## @copyright GPLv3 ## @details ## @par global variables ## ## There are 5 global variables which are set to the current device being processed ## ## `DEVICE_TYPE` = device type is currently either joystick, keyboard or cec ## `DEVICE_NAME` = name of the device ## `DEVICE_GUID` = SDL2 joystick GUID of the device (-1 for keyboard, -2 for cec) ## `VENDOR_ID` = the USB vendor ID of the device ## `PRODUCT_ID` = the USB product ID of the device ## @par Interface functions ## ## each input configuration module can have an optional function ## `check_`. If this function returns 1, the module is ## skipped. This can be used to skip input configurations in some cases - eg ## to skip configuration when an existing config file is not installed. ## ## There are 3 main interface functions for each of the input types (joystick/keyboard) ## ## function `onstart__()` ## is run at the start of the input configuration ## ## function `onend__()` ## is run at the end of the input configuration ## ## Returns: ## None ## ## function map__() ## is run for each of the inputs - with the following arguments ## ## Arguments: ## * $1 - input name is one of the following ## * up, down, left, right ## * a, b, x, y ## * leftshoulder, rightshoulder, lefttrigger, righttrigger ## * leftthumb. rightthumb ## * start, select ## * leftanalogup, leftanalogdown, leftanalogleft, leftanalogright ## * rightanalogup, rightanalogdown, rightanalogleft, rightanalogright ## * $2 - input type is button, axis or hat for joysticks, key for keyboard and button for cec. ## * $3 - button id of the input for a joystick, SDL2 keycode for a keyboard, or button id for cec. ## * $4 - value of the joystick input or 1 for keyboard and cec. ## ## Returns: ## None function inputconfiguration() { local es_conf="$home/.emulationstation/es_temporaryinput.cfg" declare -A mapping # check if we have the temporary input file [[ ! -f "$es_conf" ]] && return local line while read line; do if [[ -n "$line" ]]; then local input=($line) mapping["${input[0]}"]=${input[@]:1} fi done < <(xmlstarlet sel --text -t -m "/inputList/inputConfig/input" -v "concat(@name,' ',@type,' ',@id,' ',@value)" -n "$es_conf") local inputscriptdir=$(dirname "$0") local inputscriptdir=$(cd "$inputscriptdir" && pwd) DEVICE_TYPE=$(xmlstarlet sel --text -t -v "/inputList/inputConfig/@type" "$es_conf") DEVICE_NAME=$(xmlstarlet sel --text -t -v "/inputList/inputConfig/@deviceName" "$es_conf") DEVICE_GUID=$(xmlstarlet sel --text -t -v "/inputList/inputConfig/@deviceGUID" "$es_conf") VENDOR_ID=$(xmlstarlet sel --text -t -v "/inputList/inputConfig/@vendorId" "$es_conf") PRODUCT_ID=$(xmlstarlet sel --text -t -v "/inputList/inputConfig/@productId" "$es_conf") echo "Input type is '$DEVICE_TYPE'." local module # call all configuration modules with the for module in $(find "$inputscriptdir/configscripts/" -maxdepth 1 -name "*.sh" | sort); do source "$module" # register functions from emulatorconfigs folder local module_id=${module##*/} local module_id=${module_id%.sh} local funcname="check_${module_id}" # call check_module to check if we should run it if fn_exists "$funcname"; then "$funcname" || continue fi echo "Configuring '$module_id'" # at the start, the onstart_module function is called. funcname="onstart_${module_id}_${DEVICE_TYPE}" fn_exists "$funcname" && "$funcname" local input_name # loop through all buttons and use corresponding config function if it exists for input_name in "${!mapping[@]}"; do funcname="map_${module_id}_${DEVICE_TYPE}" if fn_exists "$funcname"; then local params=(${mapping[$input_name]}) local input_type=${params[0]} local input_id=${params[1]} local input_value=${params[2]} "$funcname" "$input_name" "$input_type" "$input_id" "$input_value" fi done # at the end, the onend_module function is called funcname="onend_${module_id}_${DEVICE_TYPE}" fn_exists "$funcname" && "$funcname" done } function fn_exists() { declare -f "$1" > /dev/null return $? } function sdl1_map() { # check if sdl1_map already exists [[ -v sdl1_map[@] ]] && return # SDL codes from https://wiki.libsdl.org/SDLKeycodeLookup mapped to /usr/include/SDL/SDL_keysym.h declare -Ag sdl1_map local i for i in {0..127}; do sdl1_map["$i"]="$i" done sdl1_map["1073741881"]="301" # SDLK SDLK_CAPSLOCK sdl1_map["1073741882"]="282" # SDLK SDLK_F1 sdl1_map["1073741883"]="283" # SDLK SDLK_F2 sdl1_map["1073741884"]="284" # SDLK SDLK_F3 sdl1_map["1073741885"]="285" # SDLK SDLK_F4 sdl1_map["1073741886"]="286" # SDLK SDLK_F5 sdl1_map["1073741887"]="287" # SDLK SDLK_F6 sdl1_map["1073741888"]="288" # SDLK SDLK_F7 sdl1_map["1073741889"]="289" # SDLK SDLK_F8 sdl1_map["1073741890"]="290" # SDLK SDLK_F9 sdl1_map["1073741891"]="291" # SDLK SDLK_F10 sdl1_map["1073741892"]="292" # SDLK SDLK_F11 sdl1_map["1073741893"]="293" # SDLK SDLK_F12 sdl1_map["1073741894"]="316" # SDLK SDLK_PRINTSCREEN sdl1_map["1073741895"]="302" # SDLK SDLK_SCROLLLOCK sdl1_map["1073741896"]="19" # SDLK SDLK_PAUSE sdl1_map["1073741897"]="277" # SDLK SDLK_INSERT sdl1_map["1073741898"]="278" # SDLK SDLK_HOME sdl1_map["1073741899"]="280" # SDLK SDLK_PAGEUP sdl1_map["1073741901"]="279" # SDLK SDLK_END sdl1_map["1073741902"]="281" # SDLK SDLK_PAGEDOWN sdl1_map["1073741903"]="275" # SDLK SDLK_RIGHT sdl1_map["1073741904"]="276" # SDLK SDLK_LEFT sdl1_map["1073741905"]="274" # SDLK SDLK_DOWN sdl1_map["1073741906"]="273" # SDLK SDLK_UP sdl1_map["1073741908"]="267" # SDLK SDLK_KP_DIVIDE sdl1_map["1073741909"]="268" # SDLK SDLK_KP_MULTIPLY sdl1_map["1073741910"]="269" # SDLK SDLK_KP_MINUS sdl1_map["1073741911"]="270" # SDLK SDLK_KP_PLUS sdl1_map["1073741912"]="271" # SDLK SDLK_KP_ENTER sdl1_map["1073741913"]="257" # SDLK SDLK_KP_1 sdl1_map["1073741914"]="258" # SDLK SDLK_KP_2 sdl1_map["1073741915"]="259" # SDLK SDLK_KP_3 sdl1_map["1073741916"]="260" # SDLK SDLK_KP_4 sdl1_map["1073741917"]="261" # SDLK SDLK_KP_5 sdl1_map["1073741918"]="262" # SDLK SDLK_KP_6 sdl1_map["1073741919"]="263" # SDLK SDLK_KP_7 sdl1_map["1073741920"]="264" # SDLK SDLK_KP_8 sdl1_map["1073741921"]="265" # SDLK SDLK_KP_9 sdl1_map["1073741922"]="256" # SDLK SDLK_KP_0 sdl1_map["1073741923"]="266" # SDLK SDLK_KP_PERIOD sdl1_map["1073741926"]="320" # SDLK SDLK_POWER sdl1_map["1073741927"]="272" # SDLK SDLK_KP_EQUALS sdl1_map["1073741928"]="294" # SDLK SDLK_F13 sdl1_map["1073741929"]="295" # SDLK SDLK_F14 sdl1_map["1073741930"]="296" # SDLK SDLK_F15 sdl1_map["1073741941"]="315" # SDLK SDLK_HELP sdl1_map["1073741942"]="319" # SDLK SDLK_MENU sdl1_map["1073741946"]="322" # SDLK SDLK_UNDO sdl1_map["1073741978"]="317" # SDLK SDLK_SYSREQ sdl1_map["1073742048"]="306" # SDLK SDLK_LCTRL sdl1_map["1073742049"]="304" # SDLK SDLK_LSHIFT sdl1_map["1073742050"]="308" # SDLK SDLK_LALT sdl1_map["1073742051"]="311" # SDLK SDLK_LGUI sdl1_map["1073742052"]="305" # SDLK SDLK_RCTRL sdl1_map["1073742053"]="303" # SDLK SDLK_RSHIFT sdl1_map["1073742054"]="307" # SDLK SDLK_RALT sdl1_map["1073742055"]="312" # SDLK SDLK_RGUI sdl1_map["1073742081"]="313" # SDLK SDLK_MODE } ###### main ###### __user=$(id -un) home="$(eval echo ~$__user)" rootdir="/opt/retropie" configdir="$rootdir/configs" source "$rootdir/lib/inifuncs.sh" getAutoConf "disable" || inputconfiguration ================================================ FILE: scriptmodules/supplementary/emulationstation-dev.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="emulationstation-dev" rp_module_desc="EmulationStation (latest development version) - Frontend used by RetroPie for launching emulators" rp_module_licence="MIT https://raw.githubusercontent.com/RetroPie/EmulationStation/master/LICENSE.md" rp_module_repo="git https://github.com/RetroPie/EmulationStation master" rp_module_section="exp" rp_module_flags="frontend" function _update_hook_emulationstation-dev() { _update_hook_emulationstation } function depends_emulationstation-dev() { depends_emulationstation } function sources_emulationstation-dev() { sources_emulationstation } function build_emulationstation-dev() { build_emulationstation } function install_emulationstation-dev() { install_emulationstation } function configure_emulationstation-dev() { rp_callModule "emulationstation" remove configure_emulationstation } function remove_emulationstation-dev() { remove_emulationstation } function gui_emulationstation-dev() { gui_emulationstation } ================================================ FILE: scriptmodules/supplementary/emulationstation.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="emulationstation" rp_module_desc="EmulationStation - Frontend used by RetroPie for launching emulators" rp_module_licence="MIT https://raw.githubusercontent.com/RetroPie/EmulationStation/master/LICENSE.md" rp_module_repo="git https://github.com/RetroPie/EmulationStation :_get_branch_emulationstation" rp_module_section="core" rp_module_flags="frontend" function _get_input_cfg_emulationstation() { echo "$configdir/all/emulationstation/es_input.cfg" } function _update_hook_emulationstation() { # make sure the input configuration scripts and launch script are always up to date if rp_isInstalled "$md_id"; then copy_inputscripts_emulationstation install_launch_emulationstation fi } function _sort_systems_emulationstation() { local field="$1" cp "/etc/emulationstation/es_systems.cfg" "/etc/emulationstation/es_systems.cfg.bak" xmlstarlet sel -D -I \ -t -m "/" -e "systemList" \ -m "//system" -s A:T:U "$1" -c "." \ "/etc/emulationstation/es_systems.cfg.bak" >"/etc/emulationstation/es_systems.cfg" } function _add_system_emulationstation() { local fullname="$1" local name="$2" local path="$3" local extension="$4" local command="$5" local platform="$6" local theme="$7" local conf="/etc/emulationstation/es_systems.cfg" mkdir -p "/etc/emulationstation" if [[ ! -f "$conf" ]]; then echo "" >"$conf" fi cp "$conf" "$conf.bak" if [[ $(xmlstarlet sel -t -v "count(/systemList/system[name='$name'])" "$conf") -eq 0 ]]; then xmlstarlet ed -L -s "/systemList" -t elem -n "system" -v "" \ -s "/systemList/system[last()]" -t elem -n "name" -v "$name" \ -s "/systemList/system[last()]" -t elem -n "fullname" -v "$fullname" \ -s "/systemList/system[last()]" -t elem -n "path" -v "$path" \ -s "/systemList/system[last()]" -t elem -n "extension" -v "$extension" \ -s "/systemList/system[last()]" -t elem -n "command" -v "$command" \ -s "/systemList/system[last()]" -t elem -n "platform" -v "$platform" \ -s "/systemList/system[last()]" -t elem -n "theme" -v "$theme" \ "$conf" else xmlstarlet ed -L \ -u "/systemList/system[name='$name']/fullname" -v "$fullname" \ -u "/systemList/system[name='$name']/path" -v "$path" \ -u "/systemList/system[name='$name']/extension" -v "$extension" \ -u "/systemList/system[name='$name']/command" -v "$command" \ -u "/systemList/system[name='$name']/platform" -v "$platform" \ -u "/systemList/system[name='$name']/theme" -v "$theme" \ "$conf" fi # alert the user if they have a custom es_systems.cfg which doesn't contain the system we are adding local conf_local="$configdir/all/emulationstation/es_systems.cfg" if [[ -f "$conf_local" ]] && [[ "$(xmlstarlet sel -t -v "count(/systemList/system[name='$name'])" "$conf_local")" -eq 0 ]]; then md_ret_info+=("You have a custom override of the EmulationStation system config in:\n\n$conf_local\n\nYou will need to copy the updated $system config from $conf to your custom config for $system to show up in EmulationStation.") fi _sort_systems_emulationstation "name" } function _del_system_emulationstation() { local fullname="$1" local name="$2" if [[ -f /etc/emulationstation/es_systems.cfg ]]; then xmlstarlet ed -L -P -d "/systemList/system[name='$name']" /etc/emulationstation/es_systems.cfg fi } function _add_rom_emulationstation() { local system_name="$1" local system_fullname="$2" local path="./$3" local name="$4" local desc="$5" local image="$6" local config_dir="$configdir/all/emulationstation" mkUserDir "$config_dir" mkUserDir "$config_dir/gamelists" mkUserDir "$config_dir/gamelists/$system_name" local config="$config_dir/gamelists/$system_name/gamelist.xml" if [[ ! -f "$config" ]]; then echo "" >"$config" fi if [[ $(xmlstarlet sel -t -v "count(/gameList/game[path='$path'])" "$config") -eq 0 ]]; then xmlstarlet ed -L -s "/gameList" -t elem -n "game" -v "" \ -s "/gameList/game[last()]" -t elem -n "path" -v "$path" \ -s "/gameList/game[last()]" -t elem -n "name" -v "$name" \ -s "/gameList/game[last()]" -t elem -n "desc" -v "$desc" \ -s "/gameList/game[last()]" -t elem -n "image" -v "$image" \ "$config" else xmlstarlet ed -L \ -u "/gameList/game[name='$name']/path" -v "$path" \ -u "/gameList/game[name='$name']/name" -v "$name" \ -u "/gameList/game[name='$name']/desc" -v "$desc" \ -u "/gameList/game[name='$name']/image" -v "$image" \ "$config" fi chown "$__user":"$__group" "$config" } function depends_emulationstation() { local depends=( libfreeimage-dev libfreetype6-dev libcurl4-openssl-dev libasound2-dev cmake libsdl2-dev libsm-dev libvlc-dev libvlccore-dev python3-sdl2 vlc ) [[ "$__os_debian_ver" -gt 8 ]] && depends+=(rapidjson-dev) isPlatform "x11" && depends+=(gnome-terminal mesa-utils) if isPlatform "dispmanx" && ! isPlatform "osmc"; then depends+=(omxplayer) fi getDepends "${depends[@]}" } function _get_branch_emulationstation() { if [[ -z "$branch" ]]; then if [[ "$__os_debian_ver" -gt 8 ]]; then branch="stable" else branch="v2.7.6" fi fi echo "$branch" } function sources_emulationstation() { gitPullOrClone } function build_emulationstation() { local params=(-DFREETYPE_INCLUDE_DIRS=/usr/include/freetype2/) if isPlatform "rpi"; then params+=(-DRPI=On) # use OpenGL on RPI/KMS for now isPlatform "mesa" && params+=("-DGL=On" "-DUSE_GL21=On") # force GLESv1 on videocore due to performance issue with GLESv2 isPlatform "videocore" && params+=(-DUSE_GLES1=On) elif isPlatform "x11"; then if isPlatform "gles"; then params+=(-DGLES=On) local gles_ver=$(sudo -u $__user glxinfo -B | grep -oP 'Max GLES[23] profile version:\s\K.*') compareVersions $gles_ver lt 2.0 && params+=(-DUSE_GLES1=On) else params+=(-DGL=On) # mesa specific check of OpenGL version local gl_ver=$(sudo -u $__user glxinfo -B | grep -oP 'Max compat profile version:\s\K.*') # generic fallback check of OpenGL version [[ -z "$gl_ver" ]] && gl_ver=$(sudo -u $__user glxinfo -B | grep -oP "OpenGL version string: \K[^ ]+") compareVersions $gl_ver gt 2.0 && params+=(-DUSE_GL21=On) fi elif isPlatform "gles"; then params+=(-DGLES=On) elif isPlatform "gl"; then params+=(-DGL=On) fi if isPlatform "dispmanx"; then params+=(-DOMX=On) fi rpSwap on 1000 cmake . "${params[@]}" make clean make VERBOSE=1 rpSwap off md_ret_require="$md_build/emulationstation" } function install_emulationstation() { md_ret_files=( 'CREDITS.md' 'emulationstation' 'emulationstation.sh' 'GAMELISTS.md' 'README.md' 'THEMES.md' ) # This folder is present only from 2.8.x, don't include it for older releases if [[ "$__os_debian_ver" -gt 8 ]]; then md_ret_files+=('resources') fi } function init_input_emulationstation() { local es_config="$(_get_input_cfg_emulationstation)" # if there is no ES config (or empty file) create it with initial inputList element if [[ ! -s "$es_config" ]]; then echo "" >"$es_config" fi # add/update our inputconfiguration.sh inputAction if [[ $(xmlstarlet sel -t -v "count(/inputList/inputAction[@type='onfinish'])" "$es_config") -eq 0 ]]; then xmlstarlet ed -L -S \ -s "/inputList" -t elem -n "inputActionTMP" -v "" \ -s "//inputActionTMP" -t attr -n "type" -v "onfinish" \ -s "//inputActionTMP" -t elem -n "command" -v "$md_inst/scripts/inputconfiguration.sh" \ -r "//inputActionTMP" -v "inputAction" "$es_config" else xmlstarlet ed -L \ -u "/inputList/inputAction[@type='onfinish']/command[1]" -v "$md_inst/scripts/inputconfiguration.sh" \ "$es_config" fi chown "$__user":"$__group" "$es_config" } function copy_inputscripts_emulationstation() { mkdir -p "$md_inst/scripts" cp -r "$scriptdir/scriptmodules/$md_type/emulationstation/"* "$md_inst/scripts/" chmod +x "$md_inst/scripts/inputconfiguration.sh" } function install_launch_emulationstation() { cat > /usr/bin/emulationstation << _EOF_ #!/bin/bash if [[ \$(id -u) -eq 0 ]]; then echo "emulationstation should not be run as root. If you used 'sudo emulationstation' please run without sudo." exit 1 fi # use SDL2 wayland video driver if wayland session is detected, but... # Emulationstation has focus problems under Ubuntu 22.04's GNOME on Wayland session, so don't use the SDL2's Wayland driver in that combination if [[ "\$WAYLAND_DISPLAY" == wayland* ]]; then [[ "\$XDG_CURRENT_DESKTOP" == *GNOME ]] || export SDL_VIDEODRIVER=wayland fi # save current tty/vt number for use with X so it can be launched on the correct tty TTY=\$(tty) export TTY="\${TTY:8:1}" clear tput civis "$md_inst/emulationstation.sh" "\$@" if [[ \$? -eq 139 ]]; then dialog --cr-wrap --no-collapse --msgbox "Emulation Station crashed!\n\nIf this is your first boot of RetroPie - make sure you are using the correct image for your system.\n\\nCheck your rom file/folder permissions and if running on a Raspberry Pi, make sure your gpu_split is set high enough and/or switch back to using carbon theme.\n\nFor more help please use the RetroPie forum." 20 60 >/dev/tty fi tput cnorm _EOF_ chmod +x /usr/bin/emulationstation if isPlatform "x11"; then mkdir -p /usr/local/share/{icons,applications} cp "$scriptdir/scriptmodules/$md_type/emulationstation/retropie.svg" "/usr/local/share/icons/" cat > /usr/local/share/applications/retropie.desktop << _EOF_ [Desktop Entry] Type=Application Exec=gnome-terminal --full-screen --hide-menubar -e emulationstation Hidden=false NoDisplay=false X-GNOME-Autostart-enabled=true Name[de_DE]=RetroPie Name=rpie Comment[de_DE]=RetroPie Comment=retropie Icon=/usr/local/share/icons/retropie.svg Categories=Game _EOF_ fi } function clear_input_emulationstation() { rm "$(_get_input_cfg_emulationstation)" init_input_emulationstation } function remove_emulationstation() { rm -f "/usr/bin/emulationstation" if isPlatform "x11"; then rm -rfv "/usr/local/share/icons/retropie.svg" "/usr/local/share/applications/retropie.desktop" fi } function configure_emulationstation() { # move the $home/emulationstation configuration dir and symlink it moveConfigDir "$home/.emulationstation" "$configdir/all/emulationstation" [[ "$md_mode" == "remove" ]] && return # remove other emulation station if it's installed, so we don't end up with # both packages interfering - but leave configs alone so switching is easy if [[ "$md_id" == "emulationstation-dev" ]]; then rmDirExists "$rootdir/$md_type/emulationstation" else rmDirExists "$rootdir/$md_type/emulationstation-dev" fi init_input_emulationstation copy_inputscripts_emulationstation install_launch_emulationstation mkdir -p "/etc/emulationstation" # ensure we have a default theme rp_callModule esthemes install_theme addAutoConf "es_swap_a_b" 0 addAutoConf "disable" 0 } function gui_emulationstation() { local es_swap=0 getAutoConf "es_swap_a_b" && es_swap=1 local disable=0 getAutoConf "disable" && disable=1 local default local options while true; do local options=( 1 "Clear/Reset Emulation Station input configuration" ) if [[ "$disable" -eq 0 ]]; then options+=(2 "Auto Configuration (Currently: Enabled)") else options+=(2 "Auto Configuration (Currently: Disabled)") fi if [[ "$es_swap" -eq 0 ]]; then options+=(3 "Swap A/B Buttons in ES (Currently: Default)") else options+=(3 "Swap A/B Buttons in ES (Currently: Swapped)") fi local cmd=(dialog --backtitle "$__backtitle" --default-item "$default" --menu "Choose an option" 22 76 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && break default="$choice" case "$choice" in 1) if dialog --defaultno --yesno "Are you sure you want to reset the Emulation Station controller configuration ? This will wipe all controller configs for ES and it will prompt to reconfigure on next start" 22 76 2>&1 >/dev/tty; then clear_input_emulationstation printMsgs "dialog" "$(_get_input_cfg_emulationstation) has been reset to default values." fi ;; 2) disable="$((disable ^ 1))" setAutoConf "disable" "$disable" ;; 3) es_swap="$((es_swap ^ 1))" setAutoConf "es_swap_a_b" "$es_swap" local ra_swap="false" getAutoConf "es_swap_a_b" && ra_swap="true" iniSet "menu_swap_ok_cancel_buttons" "$ra_swap" "$configdir/all/retroarch.cfg" printMsgs "dialog" "You will need to reconfigure you controller in Emulation Station for the changes to take effect." ;; esac done } ================================================ FILE: scriptmodules/supplementary/esthemes/patch-ruckage-famicom-mini.diff ================================================ diff -u -r famicom-mini-master/layouts/1024x768.xml famicom-mini-mod/layouts/1024x768.xml --- famicom-mini-master/layouts/1024x768.xml 2017-08-07 02:15:59.000000000 +0300 +++ famicom-mini-mod/layouts/1024x768.xml 2023-11-19 20:50:59.665662200 +0200 @@ -10,10 +10,10 @@ - 0.573 0.5481481481481481 - 0.38 0.2185185185185185 + 0.5715 0.630208333333333 + 0.3807 0.1860 1.39 - 0.0740740740740741 + 0.0795 0 0.0166666666666667 diff -u -r famicom-mini-master/layouts/1280x720.xml famicom-mini-mod/layouts/1280x720.xml --- famicom-mini-master/layouts/1280x720.xml 2017-08-07 02:15:59.000000000 +0300 +++ famicom-mini-mod/layouts/1280x720.xml 2023-11-19 20:18:09.217099000 +0200 @@ -8,8 +8,8 @@ - 0.2854166666666667 0.2185185185185185 - 0.4291666666666667 0.5481481481481481 + 0.2854166666666667 0.1890 + 0.4291666666666667 0.629166666666667 1.3975 0.0740740740740741 0 diff -u -r famicom-mini-master/layouts/1280x960.xml famicom-mini-mod/layouts/1280x960.xml --- famicom-mini-master/layouts/1280x960.xml 2017-08-07 02:15:59.000000000 +0300 +++ famicom-mini-mod/layouts/1280x960.xml 2023-11-19 20:55:57.216498200 +0200 @@ -10,10 +10,10 @@ - 0.5725 0.5481481481481481 - 0.3805555555555556 0.2185185185185185 + 0.5715 0.630208333333333 + 0.3807 0.1860 1.395 - 0.0740740740740741 + 0.0795 0 0.0166666666666667 diff -u -r famicom-mini-master/layouts/1366x768.xml famicom-mini-mod/layouts/1366x768.xml --- famicom-mini-master/layouts/1366x768.xml 2017-08-07 02:15:59.000000000 +0300 +++ famicom-mini-mod/layouts/1366x768.xml 2023-11-19 20:33:51.952952100 +0200 @@ -8,8 +8,8 @@ - 0.2854166666666667 0.2185185185185185 - 0.4291666666666667 0.5481481481481481 + 0.2854166666666667 0.1890 + 0.4291666666666667 0.629166666666667 1.39 0.0740740740740741 0 diff -u -r famicom-mini-master/layouts/1440x1080.xml famicom-mini-mod/layouts/1440x1080.xml --- famicom-mini-master/layouts/1440x1080.xml 2017-08-07 02:15:59.000000000 +0300 +++ famicom-mini-mod/layouts/1440x1080.xml 2023-11-19 20:56:45.019045900 +0200 @@ -10,10 +10,10 @@ - 0.5722222222222222 0.5481481481481481 - 0.3805555555555556 0.2185185185185185 + 0.5715 0.630208333333333 + 0.3807 0.1860 1.375 - 0.0740740740740741 + 0.0795 0 0.0166666666666667 diff -u -r famicom-mini-master/layouts/1920x1080.xml famicom-mini-mod/layouts/1920x1080.xml --- famicom-mini-master/layouts/1920x1080.xml 2017-08-07 02:15:59.000000000 +0300 +++ famicom-mini-mod/layouts/1920x1080.xml 2023-11-19 20:18:27.434632200 +0200 @@ -8,8 +8,8 @@ - 0.2854166666666667 0.2185185185185185 - 0.4291666666666667 0.5481481481481481 + 0.2854166666666667 0.1890 + 0.4291666666666667 0.629166666666667 1.375 0.0740740740740741 0 diff -u -r famicom-mini-master/layouts/320x240.xml famicom-mini-mod/layouts/320x240.xml --- famicom-mini-master/layouts/320x240.xml 2017-08-07 02:15:59.000000000 +0300 +++ famicom-mini-mod/layouts/320x240.xml 2023-11-19 20:53:08.112267000 +0200 @@ -10,10 +10,10 @@ - 0.5722222222222222 0.5481481481481481 - 0.3805555555555556 0.2185185185185185 + 0.5715 0.6302 + 0.3807 0.1860 1.395 - 0.0740740740740741 + 0.0795 0 0.0166666666666667 diff -u -r famicom-mini-master/layouts/640x480.xml famicom-mini-mod/layouts/640x480.xml --- famicom-mini-master/layouts/640x480.xml 2017-08-07 02:15:59.000000000 +0300 +++ famicom-mini-mod/layouts/640x480.xml 2023-11-19 20:53:09.551257200 +0200 @@ -10,10 +10,10 @@ - 0.575 0.5481481481481481 - 0.378 0.2185185185185185 + 0.5715 0.6302 + 0.3807 0.1860 1.395 - 0.0740740740740741 + 0.0795 0 0.0166666666666667 diff -u -r famicom-mini-master/layouts/800x600.xml famicom-mini-mod/layouts/800x600.xml --- famicom-mini-master/layouts/800x600.xml 2017-08-07 02:15:59.000000000 +0300 +++ famicom-mini-mod/layouts/800x600.xml 2023-11-19 20:51:45.383240000 +0200 @@ -10,10 +10,10 @@ - 0.5722222222222222 0.5481481481481481 - 0.3805555555555556 0.2185185185185185 + 0.5715 0.6302 + 0.3807 0.1860 1.395 - 0.0740740740740741 + 0.0795 0 0.0166666666666667 diff -u -r famicom-mini-master/layouts/ntsc.xml famicom-mini-mod/layouts/ntsc.xml --- famicom-mini-master/layouts/ntsc.xml 2017-08-07 02:15:59.000000000 +0300 +++ famicom-mini-mod/layouts/ntsc.xml 2023-11-19 20:59:02.098705000 +0200 @@ -10,10 +10,10 @@ - 0.5722222222222222 0.5481481481481481 - 0.3805555555555556 0.2185185185185185 + 0.5715 0.630208333333333 + 0.3807 0.1860 1.395 - 0.0740740740740741 + 0.0795 0 0.0166666666666667 ================================================ FILE: scriptmodules/supplementary/esthemes/patch-ruckage-nes-mini.diff ================================================ --- nes-mini/layouts/1024x768.xml Wed May 2 15:18:27 2018 +++ nes-mini/layouts/1024x768.xml Mon Nov 20 16:04:57 2023 @@ -10,8 +10,8 @@ - 0.544 0.5481481481481481 - 0.3944444444444444 0.2185185185185185 + 0.5443 0.6302 + 0.3942 0.1890 1.39 0.0592592592592593 0.0074074074074074 --- nes-mini/layouts/1280x720.xml Wed May 2 15:18:27 2018 +++ nes-mini/layouts/1280x720.xml Mon Nov 20 15:56:00 2023 @@ -8,8 +8,8 @@ - 0.2958333333333333 0.2185185185185185 - 0.408 0.5481481481481481 + 0.408 0.629166666666667 + 0.2960 0.1890 1.3975 0.0592592592592593 0.0074074074074074 --- nes-mini/layouts/1280x960.xml Wed May 2 15:18:27 2018 +++ nes-mini/layouts/1280x960.xml Mon Nov 20 16:03:07 2023 @@ -10,8 +10,8 @@ - 0.5444444444444444 0.5481481481481481 - 0.3944444444444444 0.2185185185185185 + 0.5443 0.6302 + 0.3942 0.1890 1.396 0.0592592592592593 0.0074074074074074 --- nes-mini/layouts/1366x768.xml Wed May 2 15:18:27 2018 +++ nes-mini/layouts/1366x768.xml Mon Nov 20 15:56:46 2023 @@ -8,8 +8,8 @@ - 0.2958333333333333 0.2185185185185185 - 0.408 0.5481481481481481 + 0.408 0.629166666666667 + 0.2960 0.1890 1.39 0.0592592592592593 0.0074074074074074 --- nes-mini/layouts/1920x1080.xml Wed May 2 15:18:27 2018 +++ nes-mini/layouts/1920x1080.xml Mon Nov 20 15:57:24 2023 @@ -8,8 +8,8 @@ - 0.2958333333333333 0.2185185185185185 - 0.4083333333333333 0.5481481481481481 + 0.2960 0.1890 + 0.408 0.629166666666667 1.375 0.0592592592592593 0.0074074074074074 --- nes-mini/layouts/320x240.xml Wed May 2 15:18:27 2018 +++ nes-mini/layouts/320x240.xml Tue Nov 21 14:08:33 2023 @@ -10,11 +10,11 @@ - 0.546 0.5481481481481481 - 0.3944444444444444 0.2185185185185185 + 0.5475 0.6310 + 0.3935 0.1878 1.395 - 0.064 - 0.007 + 0.060 + 0.008 --- nes-mini/layouts/640x480.xml Wed May 2 15:18:27 2018 +++ nes-mini/layouts/640x480.xml Tue Nov 21 08:39:50 2023 @@ -10,10 +10,10 @@ - 0.546 0.5481481481481481 - 0.394 0.2185185185185185 + 0.5452 0.6310 + 0.3941 0.1882 1.395 - 0.06 + 0.0615 0.007 --- nes-mini/layouts/800x600.xml Wed May 2 15:18:27 2018 +++ nes-mini/layouts/800x600.xml Wed Nov 22 13:54:40 2023 @@ -10,10 +10,10 @@ - 0.544 0.5481481481481481 - 0.3944444444444444 0.2185185185185185 + 0.5443 0.6302 + 0.3954 0.1882 1.4 - 0.06 + 0.0592 0.0074074074074074 ================================================ FILE: scriptmodules/supplementary/esthemes/patch-ruckage-snes-mini.diff ================================================ diff --git a/layouts/1024x768.xml b/layouts/1024x768.xml index 0fa2e6d..2b29a33 100644 --- a/layouts/1024x768.xml +++ b/layouts/1024x768.xml @@ -10,12 +10,12 @@ author: ruckage - 0.5611111111111111 0.5481481481481481 - 0.9861111111111111 0.2259259259259259 + 0.5615234375 0.630208333333333 + 0.986328125 0.1953125 1.39 1 0 - 0.0814814814814815 - -0.0111111111111111 + 0.08203125 + -0.01171875 diff --git a/layouts/1280x720.xml b/layouts/1280x720.xml index f7fae91..0ad84f2 100644 --- a/layouts/1280x720.xml +++ b/layouts/1280x720.xml @@ -8,10 +8,10 @@ author: ruckage - ${listx} 0.2259259259259259 - ${listWidth} 0.5481481481481481 + ${listx} 0.195833333333333 + ${listWidth} 0.629166666666667 1.395 - 0.0814814814814815 + 0.081944444444444 -0.0111111111111111 diff --git a/layouts/1280x960.xml b/layouts/1280x960.xml index acb687f..dc17453 100644 --- a/layouts/1280x960.xml +++ b/layouts/1280x960.xml @@ -10,12 +10,12 @@ author: ruckage - 0.5611111111111111 0.5481481481481481 - 0.9861111111111111 0.2259259259259259 + 0.5611111111111111 0.630208333333333 + 0.9861111111111111 0.195833333333333 1.4 1 0 - 0.0814814814814815 - -0.0111111111111111 + 0.08125 + -0.011458333333333 diff --git a/layouts/1366x768.xml b/layouts/1366x768.xml index 0c268c3..6131217 100644 --- a/layouts/1366x768.xml +++ b/layouts/1366x768.xml @@ -8,11 +8,11 @@ author: ruckage - ${listx} 0.2259259259259259 - ${listWidth} 0.5481481481481481 + ${listx} 0.1953125 + ${listWidth} 0.630208333333333 1.39 - 0.0814814814814815 - -0.0111111111111111 + 0.08203125 + -0.01171875 diff --git a/layouts/1440x1080.xml b/layouts/1440x1080.xml index 044758d..f3d6fe4 100644 --- a/layouts/1440x1080.xml +++ b/layouts/1440x1080.xml @@ -10,8 +10,8 @@ author: ruckage - 0.5611111111111111 0.5481481481481481 - 0.9861111111111111 0.2259259259259259 + 0.5611111111111111 0.62962962962963 + 0.9861111111111111 0.19537037037037 1.375 1 0 0.0814814814814815 diff --git a/layouts/1920x1080.xml b/layouts/1920x1080.xml index f4c55ef..13008ed 100644 --- a/layouts/1920x1080.xml +++ b/layouts/1920x1080.xml @@ -8,8 +8,8 @@ author: ruckage - ${listx} 0.2259259259259259 - ${listWidth} 0.5481481481481481 + ${listx} 0.19537037037037 + ${listWidth} 0.62962962962963 1.375 0.0814814814814815 -0.0111111111111111 diff --git a/layouts/640x480.xml b/layouts/640x480.xml index c58ca21..05f0a24 100644 --- a/layouts/640x480.xml +++ b/layouts/640x480.xml @@ -10,11 +10,11 @@ author: ruckage - 0.5611111111111111 0.5481481481481481 - 0.9861111111111111 0.2259259259259259 + 0.5609375 0.629166666666667 + 0.9859375 0.195833333333333 1.395 1 0 - 0.0814814814814815 + 0.08125 -0.0111111111111111 diff --git a/layouts/800x600.xml b/layouts/800x600.xml index c58ca21..c32d8af 100644 --- a/layouts/800x600.xml +++ b/layouts/800x600.xml @@ -10,8 +10,8 @@ author: ruckage - 0.5611111111111111 0.5481481481481481 - 0.9861111111111111 0.2259259259259259 + 0.5611111111111111 0.63 + 0.9861111111111111 0.195 1.395 1 0 0.0814814814814815 ================================================ FILE: scriptmodules/supplementary/esthemes.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="esthemes" rp_module_desc="Install themes for Emulation Station" rp_module_section="config" function depends_esthemes() { if isPlatform "x11"; then getDepends feh else getDepends fbi fi } function _has_pixel_pos_esthemes() { local pixel_pos=0 # get the version of emulationstation installed so we can check whether to show # themes that use the new pixel based positioning - we run as $__user as the # emulationstation launch script will exit if run as root local es_ver="$(sudo -u $__user /usr/bin/emulationstation --help | grep -oP "Version \K[^,]+")" # if emulationstation is newer than 2.10, enable pixel based themes compareVersions "$es_ver" ge "2.10" && pixel_pos=1 echo "$pixel_pos" } function install_theme_esthemes() { local theme="$1" local repo="$2" local branch="$3" local pixel_pos="$(_has_pixel_pos_esthemes)" if [[ -z "$repo" ]]; then repo="RetroPie" fi if [[ -z "$theme" ]]; then theme="carbon" repo="RetroPie" [[ "$pixel_pos" -eq 1 ]] && theme+="-2021" fi local name="$theme" if [[ -z "$branch" ]]; then # Get the name of the default branch, fallback to 'master' if not found branch=$(runCmd git ls-remote --symref --exit-code "https://github.com/$repo/es-theme-$theme.git" HEAD | grep -oP ".*/\K[^\t]+") [[ -z "$branch" ]] && branch="master" else name+="-$branch" fi mkdir -p "/etc/emulationstation/themes" gitPullOrClone "/etc/emulationstation/themes/$name" "https://github.com/$repo/es-theme-$theme.git" "$branch" # apply any patches for themes broken due to ES fixes if [[ "$pixel_pos" == 1 && -f "$md_data/patch-$repo-$theme.diff" ]]; then pushd "/etc/emulationstation/themes/$name" applyPatch "$md_data/patch-$repo-$theme.diff" popd fi } function uninstall_theme_esthemes() { local theme="$1" if [[ -d "/etc/emulationstation/themes/$theme" ]]; then rm -rf "/etc/emulationstation/themes/$theme" fi } function gui_esthemes() { local themes=() local pixel_pos="$(_has_pixel_pos_esthemes)" if [[ "$pixel_pos" -eq 1 ]]; then themes+=( 'RetroPie carbon-2021' 'RetroPie carbon-2021 centered' 'RetroPie carbon-2021 nometa' ) fi local themes+=( 'RetroPie carbon' 'RetroPie carbon-centered' 'RetroPie carbon-nometa' 'RetroPie simple' 'RetroPie simple-dark' 'RetroPie clean-look' 'RetroPie color-pi' 'RetroPie nbba' 'RetroPie simplified-static-canela' 'RetroPie turtle-pi' 'RetroPie zoid' 'ehettervik pixel' 'ehettervik pixel-metadata' 'ehettervik pixel-tft' 'ehettervik luminous' 'ehettervik minilumi' 'ehettervik workbench' 'AmadhiX eudora' 'AmadhiX eudora-bigshot' 'AmadhiX eudora-concise' 'Omnija simpler-turtlepi' 'Omnija simpler-turtlemini' 'Omnija metro' 'lilbud material' 'mattrixk io' 'mattrixk metapixel' 'mattrixk spare' 'robertybob space' 'robertybob simplebigart' 'robertybob tv' 'HerbFargus tronkyfran' 'lilbud flat' 'lilbud flat-dark' 'lilbud minimal' 'lilbud switch' 'lilbud angular' 'FlyingTomahawk futura-V' 'FlyingTomahawk futura-dark-V' 'G-rila fundamental' 'ruckage nes-mini' 'ruckage famicom-mini' 'ruckage snes-mini' 'anthonycaccese crt' 'anthonycaccese crt-centered' 'anthonycaccese art-book' 'anthonycaccese art-book-4-3' 'anthonycaccese art-book-pocket' 'anthonycaccese art-book-micro' 'anthonycaccese tft' 'anthonycaccese picade' 'TMNTturtleguy ComicBook' 'TMNTturtleguy ComicBook_4-3' 'TMNTturtleguy ComicBook_SE-Wheelart' 'TMNTturtleguy ComicBook_4-3_SE-Wheelart' 'ChoccyHobNob cygnus' 'DTEAM-1 cygnus-blue-flames' 'dmmarti steampunk' 'dmmarti hurstyblue' 'dmmarti maximuspie' 'dmmarti showcase' 'dmmarti kidz' 'dmmarti unified' 'dmmarti gamehat' 'rxbrad freeplay' 'rxbrad gbz35' 'rxbrad gbz35-dark' 'garaine marioblue' 'garaine bigwood' 'MrTomixf Royal_Primicia' 'lostless playstation' 'mrharias superdisplay' 'coinjunkie synthwave' 'nickearl retrowave' 'nickearl retrowave_4_3' 'pacdude minijawn' 'RetroHursty69 magazinemadness' 'RetroHursty69 stirling' 'RetroHursty69 boxalloyred' 'RetroHursty69 boxalloyblue' 'RetroHursty69 greenilicious' 'RetroHursty69 retroroid' 'RetroHursty69 merryxmas' 'RetroHursty69 cardcrazy' 'RetroHursty69 license2game' 'RetroHursty69 comiccrazy' 'RetroHursty69 snazzy' 'RetroHursty69 tributeGoT' 'RetroHursty69 tributeSTrek' 'RetroHursty69 tributeSWars' 'RetroHursty69 crisp' 'RetroHursty69 crisp_light' 'RetroHursty69 primo' 'RetroHursty69 primo_light' 'RetroHursty69 back2basics' 'RetroHursty69 retrogamenews' 'RetroHursty69 bluray' 'RetroHursty69 soda' 'RetroHursty69 lightswitch' 'RetroHursty69 darkswitch' 'RetroHursty69 whiteslide' 'RetroHursty69 graffiti' 'RetroHursty69 whitewood' 'RetroHursty69 sublime' 'RetroHursty69 infinity' 'RetroHursty69 neogeo_only' 'RetroHursty69 boxcity' 'RetroHursty69 vertical_arcade' 'RetroHursty69 cabsnazzy' 'RetroHursty69 garfieldism' 'RetroHursty69 halloweenspecial' 'RetroHursty69 heychromey' 'RetroHursty69 homerism' 'RetroHursty69 spaceinvaders' 'RetroHursty69 disenchantment' 'RetroHursty69 minions' 'RetroHursty69 tmnt' 'RetroHursty69 pacman' 'RetroHursty69 dragonballz' 'RetroHursty69 minecraft' 'RetroHursty69 incredibles' 'RetroHursty69 mario_melee' 'RetroHursty69 evilresident' 'RetroHursty69 hurstyspin' 'RetroHursty69 cyber' 'RetroHursty69 supersweet' 'RetroHursty69 donkeykonkey' 'RetroHursty69 snapback' 'RetroHursty69 heman' 'RetroHursty69 pitube' 'RetroHursty69 batmanburton' 'RetroHursty69 NegativeColor' 'RetroHursty69 NegativeSepia' 'RetroHursty69 corg' 'RetroHursty69 mysticorb' 'RetroHursty69 joysticks' 'RetroHursty69 orbpilot' 'RetroHursty69 bitfit' 'RetroHursty69 circuit' 'RetroHursty69 retroboy' 'RetroHursty69 retroboy2' 'RetroHursty69 hurstybluetake2' 'RetroHursty69 fabuloso' 'RetroHursty69 arcade1up_aspectratio54' 'RetroHursty69 supersweet_aspectratio54' 'RetroHursty69 heychromey_aspectratio54' 'RetroHursty69 mariobrosiii' 'RetroHursty69 vertical_limit_verticaltheme' 'RetroHursty69 CapcomColorHorizontal' 'RetroHursty69 CapcomColorSpin' 'RetroHursty69 CapcomColorVertical' 'RetroHursty69 bluesteel' 'RetroHursty69 blueprism' 'RetroHursty69 bluesmooth' 'RetroHursty69 floyd' 'RetroHursty69 floyd_arcade' 'RetroHursty69 floyd_room' 'RetroHursty69 Slick_Bluey' 'RetroHursty69 Slick_Red' 'RetroHursty69 ghostbusters' 'RetroHursty69 realghostbusters' 'RetroHursty69 stirlingness' 'RetroHursty69 marco' 'RetroHursty69 swatch' 'RetroHursty69 meshy' 'RetroHursty69 magazinemadness2' 'RetroHursty69 CosmicRise' 'RetroHursty69 uniflyered' 'RetroHursty69 gametime' 'RetroHursty69 CRTBlast' 'RetroHursty69 CRTNeonBlast' 'RetroHursty69 CRTCabBlast' 'RetroHursty69 ComicCRASHB' 'RetroHursty69 ComicPACMAN' 'RetroHursty69 ComicSONIC' 'RetroHursty69 ComicXMEN' 'RetroHursty69 ComicZELDA' 'RetroHursty69 synthy16x9' 'RetroHursty69 synthyA1UP' 'RetroHursty69 supersynthy16x9' 'RetroHursty69 supersynthyA1UP' 'RetroHursty69 HyperCab' 'RetroHursty69 NeonFantasy' 'RetroHursty69 ShadowClean' 'RetroHursty69 shine' 'RetroHursty69 Vinyl-Hits' 'RetroHursty69 ColorfulExtreme' 'RetroHursty69 ColorfulSupreme' 'RetroHursty69 CircularEssence' 'RetroHursty69 BoomBoxStreet' 'RetroHursty69 ShabangCLEAN' 'RetroHursty69 ShabangCRT' 'RetroHursty69 PopCom16x9' 'RetroHursty69 PopCom5x4' 'RetroHursty69 ToggleBobble' 'RetroHursty69 Sheeny' 'RetroHursty69 ballsy' 'RetroHursty69 AIGEN' 'RetroHursty69 AIGEN_PLUS' 'Saracade scv720' 'chicueloarcade Chicuelo' 'SuperMagicom nostalgic' 'lipebello retrorama' 'lipebello retrorama-turbo' 'lipebello strangerstuff' 'lipebello spaceoddity' 'lipebello spaceoddity-43' 'lipebello spaceoddity-wide' 'lipebello swineapple' 'waweedman pii-wii' 'waweedman Blade-360' 'waweedman Venom' 'waweedman Spider-Man' 'blowfinger77 locomotion' 'justincaseurskynet Arcade1up-5x4-Horizontal' 'KALEL1981 Super-Retroboy' 'xovox RetroCRT-240p' 'xovox RetroCRT-240p-Rainbow' 'xovox RetroCRT-240p-Vertical' 'arcadeforge push-a' 'arcadeforge push-a-v' 'arcadeforge pixel-heaven' 'arcadeforge pixel-heaven-text' 'arcadeforge 240p_Bubblegum' 'arcadeforge 240p-honey' 'dionmunk clean' 'c64-dev epicnoir' 'AndreaMav arcade-crt' 'AndreaMav arcade-crt2020' 'Zechariel VectorPie' 'KALEL1981 nes-box' 'KALEL1981 super-arcade1up-5x4' 'KALEL1981 gold-standard' 'Elratauru angular-artwork' 'cjonasw raspixel-320-240' 'crxone 3twenty2fourty' 'leochely Guilty-Gear' 'flpowergamesretro-rtp ffarts' ) while true; do local theme local theme_dir local branch local name local installed_themes=() local repo local options=() local status=() local default local gallerydir="/etc/emulationstation/es-theme-gallery" if [[ -d "$gallerydir" ]]; then status+=("i") options+=(G "View or Update Theme Gallery") else status+=("n") options+=(G "Download Theme Gallery") fi options+=(U "Update all installed themes") local i=1 for theme in "${themes[@]}"; do theme=($theme) repo="${theme[0]}" theme="${theme[1]}" branch="${theme[2]}" name="$repo/$theme" theme_dir="$theme" if [[ -n "$branch" ]]; then name+=" ($branch)" theme_dir+="-$branch" fi if [[ -d "/etc/emulationstation/themes/$theme_dir" ]]; then status+=("i") options+=("$i" "Update or Uninstall $name (installed)") installed_themes+=("$theme $repo $branch") else status+=("n") options+=("$i" "Install $name") fi ((i++)) done local cmd=(dialog --default-item "$default" --backtitle "$__backtitle" --menu "Choose an option" 22 76 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) default="$choice" [[ -z "$choice" ]] && break case "$choice" in G) if [[ "${status[0]}" == "i" ]]; then options=(1 "View Theme Gallery" 2 "Update Theme Gallery" 3 "Remove Theme Gallery") cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option for gallery" 12 40 06) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) case "$choice" in 1) cd "$gallerydir" if isPlatform "x11"; then feh --info "echo %f" --slideshow-delay 6 --fullscreen --auto-zoom --filelist images.list else fbi --timeout 6 --once --autozoom --list images.list fi ;; 2) gitPullOrClone "$gallerydir" "https://github.com/wetriner/es-theme-gallery" ;; 3) if [[ -d "$gallerydir" ]]; then rm -rf "$gallerydir" fi ;; esac else gitPullOrClone "$gallerydir" "http://github.com/wetriner/es-theme-gallery" fi ;; U) for theme in "${installed_themes[@]}"; do theme=($theme) rp_callModule esthemes install_theme "${theme[0]}" "${theme[1]}" "${theme[2]}" done ;; *) theme=(${themes[choice-1]}) repo="${theme[0]}" theme="${theme[1]}" branch="${theme[2]}" name="$repo/$theme" theme_dir="$theme" if [[ -n "$branch" ]]; then name+=" ($branch)" theme_dir+="-$branch" fi if [[ "${status[choice]}" == "i" ]]; then options=(1 "Update $name" 2 "Uninstall $name") cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option for theme" 12 60 06) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) case "$choice" in 1) rp_callModule esthemes install_theme "$theme" "$repo" "$branch" ;; 2) rp_callModule esthemes uninstall_theme "$theme_dir" ;; esac else rp_callModule esthemes install_theme "$theme" "$repo" "$branch" fi ;; esac done } ================================================ FILE: scriptmodules/supplementary/gamecondriver.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="gamecondriver" rp_module_desc="Gamecon & Db9 drivers GPIO drivers" rp_module_licence="GPL2 https://raw.githubusercontent.com/marqs85/gamecon_gpio_rpi/master/gamecon_gpio_rpi/gamecon_gpio_rpi.c" rp_module_section="driver" rp_module_flags="!all rpi !rpi5" function depends_gamecondriver() { getDepends dkms LINUX-HEADERS } function _gamecon_version() { echo "1.5" } function _db9_version() { echo "1.3" } function install_bin_gamecondriver() { # install both modules declare -A modules=( [gamecon_gpio_rpi]=$(_gamecon_version) [db9_gpio_rpi]=$(_db9_version) ) local github_url="https://github.com/marqs85" _remove_gamecondriver_files pushd "$md_inst" for module_name in "${!modules[@]}"; do local module_ver="${modules[$module_name]}" gitPullOrClone "$module_name" "$github_url/$module_name" pushd "$module_name" dkmsManager remove "$module_name" ln -sfn "`pwd`/$module_name" /usr/src/"$module_name-$module_ver" dkms install --force -m "$module_name" -v "$module_ver" popd # test if module installation is OK if ! dkms status | grep -q "^$module_name"; then md_ret_errors+=("$module_name driver installation FAILED") fi done popd } function _remove_gamecondriver_config() { sed -i "/gamecon_gpio_rpi/d" /etc/modules rm -f /etc/modprobe.d/gamecon.conf } function _remove_gamecondriver_files() { dkmsManager remove gamecon_gpio_rpi dkmsManager remove db9_gpio_rpi # remove older version of the driver, installed as Debian packages hasPackage gamecon-gpio-rpi-dkms && aptRemove gamecon-gpio-rpi-dkms hasPackage db9-gpio-rpi-dkms && aptRemove db9-gpio-rpi-dkms } function remove_gamecondriver() { _remove_gamecondriver_files _remove_gamecondriver_config } function configure_gamecondriver() { [[ "$md_mode" == "remove" ]] && return if ! grep -q "gamecon_gpio_rpi" /etc/modules; then addLineToFile "gamecon_gpio_rpi" /etc/modules elif grep -q "gamecon_gpio_rpi.*map" /etc/modules; then sed -i "s/gamecon_gpio_rpi.*/gamecon_gpio_rpi/" /etc/modules fi } function dual_snes_gamecondriver() { local gpio_rev case "$(grep Revision /proc/cpuinfo | cut -d ':' -f 2 | tr -d ' \n' | tail -c 4)" in "0002"|"0003") gpio_rev=1 ;; *) gpio_rev=2 ;; esac if [[ "$gpio_rev" == 1 ]]; then echo "options gamecon_gpio_rpi map=0,1,1,0" >/etc/modprobe.d/gamecon.conf else echo "options gamecon_gpio_rpi map=0,0,1,0,0,1" >/etc/modprobe.d/gamecon.conf fi [[ -n "$(lsmod | grep gamecon_gpio_rpi)" ]] && rmmod gamecon_gpio_rpi modprobe gamecon_gpio_rpi iniConfig " = " "" "$configdir/all/retroarch.cfg" if dialog --yesno "Would you like to update button mappings in $configdir/all/retroarch.cfg for 2 SNES controllers?" 22 76 >/dev/tty; then if [[ "$GPIOREV" == 1 ]]; then iniSet "input_player1_joypad_index" "0" iniSet "input_player2_joypad_index" "1" else iniSet "input_player1_joypad_index" "1" iniSet "input_player2_joypad_index" "0" fi iniSet "input_player1_a_btn" "0" iniSet "input_player1_b_btn" "1" iniSet "input_player1_x_btn" "2" iniSet "input_player1_y_btn" "3" iniSet "input_player1_l_btn" "4" iniSet "input_player1_r_btn" "5" iniSet "input_player1_start_btn" "7" iniSet "input_player1_select_btn" "6" iniSet "input_player1_left_axis" "-0" iniSet "input_player1_up_axis" "-1" iniSet "input_player1_right_axis" "+0" iniSet "input_player1_down_axis" "+1" iniSet "input_player2_a_btn" "0" iniSet "input_player2_b_btn" "1" iniSet "input_player2_x_btn" "2" iniSet "input_player2_y_btn" "3" iniSet "input_player2_l_btn" "4" iniSet "input_player2_r_btn" "5" iniSet "input_player2_start_btn" "7" iniSet "input_player2_select_btn" "6" iniSet "input_player2_left_axis" "-0" iniSet "input_player2_up_axis" "-1" iniSet "input_player2_right_axis" "+0" iniSet "input_player2_down_axis" "+1" fi dialog --clear --msgbox "\ __________\n\ | ### Board gpio revision $gpio_rev detected ###\n\ + * |\n\ * * |\n\ 1 - | The driver is now set to use the following\n\ 2 * | configuration for 2 SNES controllers:\n\ * * | (compatible with RetroPie GPIO adapter)\n\ * * |\n\ * * | + = power\n\ * * | - = ground\n\ * * | C = clock\n\ C * | L = latch\n\ * * | 1 = player1 pad\n\ L * | 2 = player2 pad\n\ * * | * = unconnected\n\ |\n\ |" 22 76 >/dev/tty } function gui_gamecondriver() { local default local options=( 1 "Configure for two SNES controllers" 2 "Read Gamecon GPIO driver documentation" 3 "Read Db9 GPIO driver documentation" ) while true; do local cmd=(dialog --backtitle "$__backtitle" --default-item "$default" --menu "Choose an option." 22 86 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) default="$choice" if [[ -n "$choice" ]]; then case "$choice" in 1) dialog --defaultno --yesno "Gamecon driver supports RetroPie GPIO adapter board for 2 SNES controllers. Do you want to configure gamecon for 2 SNES controllers?" 22 76 >/dev/tty || continue dual_snes_gamecondriver ;; 2) dialog --msgbox "$(cat "$md_inst/gamecon_gpio_rpi/gamecon_gpio_rpi-$(_gamecon_version)/README")" 22 80 >/dev/tty ;; 3) dialog --msgbox "$(cat "$md_inst/db9_gpio_rpi/db9_gpio_rpi-$(_db9_version)/README")" 22 80 >/dev/tty ;; esac else break fi done } ================================================ FILE: scriptmodules/supplementary/golang.sh ================================================ # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="golang" rp_module_desc="Golang binary install" rp_module_licence="BSD https://golang.org/LICENSE" rp_module_section="depends" rp_module_flags="noinstclean" function _get_goroot_golang() { echo "$rootdir/supplementary/golang" } function install_bin_golang() { local target_version=1.11.13 local version if [[ -e "$md_inst/bin/go" ]]; then local version=$(GOROOT="$md_inst" "$md_inst/bin/go" version | sed 's/.*go\(1[^ ]*\).*/\1/') fi printMsgs "console" "Current Go version: $version" if compareVersions "$version" ge "$target_version" ; then return 0 fi rm -rf "$md_inst" mkdir -p "$md_inst" local arch="armv6l" if isPlatform "x86"; then if isPlatform "64bit"; then arch="amd64" else arch="386" fi fi if isPlatform "aarch64"; then arch="arm64" fi printMsgs "console" "Downloading go$target_version.linux-$arch.tar.gz" downloadAndExtract "https://go.dev/dl/go${target_version}.linux-$arch.tar.gz" "$md_inst" --strip-components 1 --exclude="go/test" } ================================================ FILE: scriptmodules/supplementary/kmsxx.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="kmsxx" rp_module_desc="library and utilities for Linux kernel mode setting" rp_module_licence="MPL2 https://raw.githubusercontent.com/cmitu/kmsxx/master/LICENSE" rp_module_repo="git https://github.com/cmitu/kmsxx retropie" rp_module_section="depends" rp_module_flags="" function depends_kmsxx() { getDepends meson ninja-build libdrm-dev libfmt-dev pkg-config } function sources_kmsxx() { gitPullOrClone } function build_kmsxx() { rm -fr build meson setup --prefix="$md_inst" -Dbuildtype=release -Ddefault_library=static -Domap=disabled -Dpykms=disabled -Dkmscube=false build ninja -C build md_ret_require="$md_build/build/utils/kmsprint-rp" } function install_kmsxx() { md_ret_files=( build/utils/kmsprint-rp build/utils/kmsprint build/utils/kmsview build/utils/kmsblank build/utils/fbtest ) } ================================================ FILE: scriptmodules/supplementary/launchingimages.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="launchingimages" rp_module_desc="Generate runcommand launching images based on emulationstation themes." rp_module_help="A runcommand launching image is displayed while loading a game, with this tool you can automatically create some cool images based on a chosen emulationstation theme you have on your system." rp_module_repo="git https://github.com/meleu/generate-launching-images.git master" rp_module_section="exp" rp_module_flags="noinstclean" function depends_launchingimages() { local depends=(imagemagick librsvg2-bin) if isPlatform "x11"; then depends+=(feh) else depends+=(fbi) fi getDepends "${depends[@]}" } function install_bin_launchingimages() { gitPullOrClone "$md_inst" } function _show_images_launchingimages() { local image local timeout=5 local is_list=0 if [[ "$1" = "1" ]]; then is_list=1 shift fi [[ -f "$1" ]] || return 1 image="$1" if isPlatform "x11"; then feh \ --cycle-once \ --hide-pointer \ --fullscreen \ --auto-zoom \ --no-menus \ --slideshow-delay $timeout \ --quiet \ $([[ "$is_list" -eq 1 ]] && echo --filelist) \ "$image" else fbi \ --once \ --timeout "$timeout" \ --noverbose \ --autozoom \ $([[ "$is_list" -eq 1 ]] && echo --list) \ "$image" /dev/null fi } function _dialog_menu_launchingimages() { local text="$1" shift local options=() local choice local opt local i [[ "$#" -eq 0 ]] && return 1 i=1 for opt in "$@"; do options+=( "$i" "$opt" ) ((i++)) done choice=$(dialog --backtitle "$__backtitle" --menu "$text" 22 86 16 "${options[@]}" 2>&1 >/dev/tty) || return echo "${options[choice*2-1]}" } function _set_theme_launchingimages() { _dialog_menu_launchingimages "List of available themes" $("$md_inst/generate-launching-images.sh" --list-themes) \ || echo "$theme" } function _set_system_launchingimages() { local options=() local choice options=( all ) options+=( $("$md_inst/generate-launching-images.sh" --list-systems) ) choice=$( _dialog_menu_launchingimages \ "List of available systems.\n\nSelect the system you want to generate a launching image or \"all\" to generate for all systems." \ "${options[@]}" ) case "$choice" in "all") echo "" ;; "") echo "$system" ;; *) echo "--system $choice" ;; esac } function _set_extension_launchingimages() { _dialog_menu_launchingimages "Choose the file extension of the final launching image." png jpg \ || echo "$extension" } function _set_show_timeout_launchingimages() { _dialog_menu_launchingimages \ "Set how long the image will be displayed before asking if you accept (in seconds)" \ 1 2 3 4 5 6 7 8 9 10 \ || echo "$show_timeout" } function _set_loading_text_launchingimages() { dialog \ --backtitle "$__backtitle" \ --inputbox "Enter the \"NOW LOADING\" text (or leave blank to no text):" \ 0 70 \ "NOW LOADING" \ 2>&1 >/dev/tty \ || echo "$loading_text" } function _set_press_button_text_launchingimages() { dialog \ --backtitle "$__backtitle" \ --inputbox "Enter the \"PRESS A BUTTON\" text (or leave blank to no text):" \ 0 70 \ "PRESS A BUTTON TO CONFIGURE LAUNCH OPTIONS" \ 2>&1 >/dev/tty \ || echo "$press_button_text" } function _select_color_launchingimages() { _dialog_menu_launchingimages \ "Pick a color for the $1" \ white black silver gray gray10 gray25 gray50 gray75 gray90 \ red orange yellow green cyan blue cyan purple pink brown } function _set_loading_text_color_launchingimages() { _select_color_launchingimages "\"LOADING\" text" || echo "$loading_text_color" } function _set_press_button_text_color_launchingimages() { _select_color_launchingimages "\"PRESS A BUTTON\" text" || echo "$press_button_text_color" } function _set_solid_bg_color_launchingimages() { local choice local cmd=(dialog --backtitle "$__backtitle" --menu "Color to use as background" 22 86 16) local options=( 0 "Disable \"solid background color\"" 1 "Use the system color defined by theme" 2 "Select a color" ) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) case "$choice" in 0) echo ;; 1) echo "--solid-bg-color" ;; 2) echo "--solid-bg-color $(_select_color_launchingimages background)" ;; *) echo "$solid_bg_color" ;; esac } function _dialog_yesno_launchingimages() { dialog --backtitle "$__backtitle" --yesno "$@" 20 60 2>&1 >/dev/tty } function _set_no_ask_launchingimages() { _dialog_yesno_launchingimages "If you enable \"no_ask\" all generated images will be automatically accepted.\n\nDo you want to enable it?" \ && echo "--no-ask" } function _set_no_logo_launchingimages() { _dialog_yesno_launchingimages "If you enable \"no_logo\" the images won't have the system logo (useful for tronkyfran theme, for example).\n\nDo you want to enable it?" \ && echo "--no-logo" } function _set_logo_belt_launchingimages() { _dialog_yesno_launchingimages "If you enable \"logo_belt\" the image will have a semi-transparent white belt behind the logo.\n\nDo you want to enable it?" \ && echo "--logo-belt" } function _get_all_launchingimages() { find "$configdir" -type f -regex ".*launching\.\(png\|jpg\)" | sort } function _is_theme_chosen_launchingimages() { if [[ -z "$1" ]]; then printMsgs "dialog" "You didn't choose a theme!\n\nGo to the \"Image generation settings\" and choose one." return 1 fi } function _get_config_file_launchingimages() { local file_list=$(find "$md_inst" -type f -name '*.cfg' ! -name '.current.cfg' | sort | xargs) if [[ -z "$file_list" ]]; then printMsgs "dialog" "There's no config file saved." return 1 fi _dialog_menu_launchingimages "Choose the file" $file_list # XXX: no quotes surrounding $file_list is mandatory! return $? } function _load_config_launchingimages() { echo "$(loadModuleConfig \ 'theme=' \ 'extension=png' \ 'show_timeout=5' \ 'loading_text=NOW LOADING' \ 'press_button_text=PRESS A BUTTON TO CONFIGURE LAUNCH OPTIONS' \ 'loading_text_color=white' \ 'press_button_text_color=gray50' \ 'no_ask=' \ 'no_logo=' \ 'solid_bg_color=' \ 'system=' \ 'logo_belt=' \ )" } function _settings_launchingimages() { local cmd=(dialog --backtitle "$__backtitle" --title " SETTINGS " --cancel-label "Back" --menu "runcommand launching images generation settings." 22 86 16) local options local choice local config_file iniConfig ' = ' '"' "$current_cfg" while true; do eval $(_load_config_launchingimages) options=( config_file "$( [[ "$config_file" == *"$theme.cfg" ]] && echo "$(basename "$config_file")" )" theme "$theme" system "$( if [[ -z "$system" ]]; then echo "all systems in es_systems.cfg" else echo "$system" | cut -d' ' -f2 fi )" extension ".$extension" loading_text "\"$loading_text\"" press_button_text "\"$press_button_text\"" loading_text_color "$loading_text_color" press_button_text_color "$press_button_text_color" show_timeout "$( [[ -n "$no_ask" ]] && echo "don't show (see no_ask)" || echo "$show_timeout seconds")" no_ask "$( [[ -n "$no_ask" ]] && echo true || echo false)" no_logo "$( [[ -n "$no_logo" ]] && echo true || echo false)" logo_belt "$( [[ -n "$logo_belt" ]] && echo true || echo false)" solid_bg_color "$( if [[ -z "$solid_bg_color" ]]; then echo false elif [[ -z "$(echo "$solid_bg_color" | cut -s -d' ' -f2)" ]]; then echo "get from the theme" else echo "$solid_bg_color" | cut -s -d' ' -f2 fi )" ) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && break if [[ "$choice" = "config_file" ]]; then config_file=$(_manage_config_file_launchingimages) continue fi iniSet "$choice" "$(_set_${choice}_launchingimages)" done } function _manage_config_file_launchingimages() { local choice local config_file eval $(_load_config_launchingimages) while true; do choice=$( dialog --backtitle "$__backtitle" --title " CONFIG FILE " --menu "Choose an option" 22 86 16 \ 1 "Load a file" \ 2 "Save current configs for \"$theme\"" \ 3 "Delete a config file" \ 2>&1 >/dev/tty ) case "$choice" in 1) # load config config_file=$(_get_config_file_launchingimages) || continue cat "$config_file" > "$current_cfg" echo "$config_file" break ;; 2) # save config _is_theme_chosen_launchingimages "$theme" || break config_file="$md_inst/$theme.cfg" if [[ -f "$config_file" ]]; then _dialog_yesno_launchingimages "\"$(basename "$config_file")\" exists.\nDo you want to overwrite it?" \ || continue fi cat "$current_cfg" > "$config_file" printMsgs "dialog" "\"$(basename "$config_file")\" saved!" echo "$config_file" break ;; 3) # delete config config_file=$(_get_config_file_launchingimages) || continue _dialog_yesno_launchingimages "Are you sure you want to delete \"$config_file\"?" \ || continue local err_msg=$(rm -v "$config_file") printMsgs "dialog" "$err_msg" ;; *) break ;; esac done } function _generate_launchingimages() { eval $(_load_config_launchingimages) _is_theme_chosen_launchingimages "$theme" || return "$md_inst/generate-launching-images.sh" \ --theme "$theme" \ --extension "$extension" \ --show-timeout "$show_timeout" \ --loading-text "$loading_text" \ --press-button-text "$press_button_text" \ --loading-text-color "$loading_text_color" \ --press-button-text-color "$press_button_text_color" \ $system \ $solid_bg_color \ $no_ask \ $no_logo \ $logo_belt \ 2>&1 >/dev/tty if [[ "$?" -ne 0 ]]; then printMsgs "dialog" "Unable to generate launching images. Please check the \"Image generation settings\"." return fi for file in $(_get_all_launchingimages); do chown "$__user":"$__group" "$file" done } function gui_launchingimages() { local cmd=() local options=() local choice local current_cfg="$md_inst/.current.cfg" rm -f "$current_cfg" while true; do cmd=(dialog --backtitle "$__backtitle" --title " runcommand launching images generation " --menu "Choose an option." 22 86 16) options=( 1 "Image generation settings" 2 "Generate launching images" 3 "View slideshow of all current launching images" 4 "View a specific system's launching image" ) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) # Image generation settings _settings_launchingimages ;; 2) # Generate launching images _generate_launchingimages ;; 3) # View slideshow of all current launching images local file=$(mktemp) _get_all_launchingimages > "$file" if [[ -s "$file" ]]; then _show_images_launchingimages 1 "$file" else printMsgs "dialog" "No launching image found." fi rm -f "$file" ;; 4) # View the launching image of a specific system while true; do local img_list=( $(_get_all_launchingimages) ) if [[ "${#img_list[@]}" -eq 0 ]]; then printMsgs "dialog" "No launching image found." break fi choice=$(_dialog_menu_launchingimages "Choose the system" "${img_list[@]}") [[ -z "$choice" ]] && break _show_images_launchingimages "$choice" done ;; esac else break fi done rm -f "$current_cfg" } ================================================ FILE: scriptmodules/supplementary/mehstation.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="mehstation" rp_module_desc="mehstation emulator frontend" rp_module_licence="MIT https://raw.githubusercontent.com/remeh/mehstation/master/LICENSE" rp_module_repo="git https://github.com/remeh/mehstation master" rp_module_section="exp" rp_module_flags="frontend nobin" function _get_database_mehstation() { echo "$configdir/all/mehstation/database.db" } function _add_system_mehstation() { local db="$(_get_database_mehstation)" [[ ! -f "$db" ]] && return 0 local fullname="$1" local name="$2" local path="$3" local extensions="$4" local command="$5" local platform="$6" local theme="$7" command="${command//%ROM%/%exec%}" extensions="${extensions// /,}" NAME="$fullname" COMMAND="$command" DIR="$path" EXTS="$extensions" "/opt/retropie/supplementary/mehstation/bin/mehtadata" -db="$db" -new-platform } function _del_system_mehstation() { local db="$(_get_database_mehstation)" [[ ! -f "$db" ]] && return 0 local fullname="$1" local name="$2" PLATFORM_NAME="$fullname" "/opt/retropie/supplementary/mehstation/bin/mehtadata" -db="$db" -del-platform } function _add_rom_mehstation() { local db="$(_get_database_mehstation)" [[ ! -f "$db" ]] && return 0 local system_name="$1" local system_fullname="$2" local path="$3" local name="$4" local desc="$5" local image="$6" NAME="$4" FILEPATH="$path" PLATFORM_NAME="$system_fullname" DESCRIPTION="$desc" "/opt/retropie/supplementary/mehstation/bin/mehtadata" -db="$db" -new-exec RESOURCE="$image" FILEPATH="$path" PLATFORM_NAME="$system_fullname" TYPE="cover" "/opt/retropie/supplementary/mehstation/bin/mehtadata" -db="$db" -new-res } function depends_mehstation() { local depends=( cmake automake libfreeimage-dev libopenal-dev libpango1.0-dev libsndfile1-dev libudev-dev libasound2-dev libjpeg-dev libtiff5-dev libwebp-dev libsqlite3-dev libavutil-dev libavcodec-dev libavformat-dev libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsdl2-image-dev sqlite3 golang ) getDepends "${depends[@]}" } function sources_mehstation() { gitPullOrClone GOPATH="$md_build/mehtadata" go get github.com/remeh/mehtadata } function build_mehstation() { cd mehtadata GOPATH="$md_build/mehtadata" go build cd .. cmake . make clean make md_ret_require=( "$md_build/mehstation" "$md_build/mehtadata/bin/mehtadata" ) } function install_mehstation() { mkdir -p "$md_inst"/{bin,share/mehstation} cp mehstation mehtadata/bin/mehtadata "$md_inst/bin/" cp -R res "$md_inst/share/" } function configure_mehstation() { # move / symlink the configuration moveConfigDir "$home/.config/mehstation" "$md_conf_root/all/mehstation" local db="$md_conf_root/all/mehstation/database.db" if [[ ! -f "$db" ]]; then local sql while read -r sql; do sudo -u "$__user" SCHEMA="$sql" "$md_inst/bin/mehtadata" -db="$db" -init done < <(find "$md_inst/share/res" -name "*.sql" | sort) fi cat >/usr/bin/mehstation <<_EOF_ #!/bin/bash pushd "$md_inst/share" >/dev/null "$md_inst/bin/mehstation" "\$@" popd _EOF_ chmod +x "/usr/bin/mehstation" local id for id in "${__mod_id[@]}"; do if rp_isInstalled "$id" && [[ -n "${__mod_info[$id/section]}" ]] && ! hasFlag "${__mod_info[$id/flags]}" "frontend"; then rp_callModule "$id" configure fi done } ================================================ FILE: scriptmodules/supplementary/mesa-drm.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="mesa-drm" rp_module_desc="libdrm - userspace library for drm" rp_module_licence="MIT https://www.mesa3d.org/license.html" rp_module_repo="git https://github.com/RetroPie/mesa-drm runcommand_debug" rp_module_section="depends" rp_module_flags="" function depends_mesa-drm() { local depends=(meson ninja-build libgbm-dev libdrm-dev libpciaccess-dev) getDepends "${depends[@]}" } function sources_mesa-drm() { gitPullOrClone } function build_mesa-drm() { local params=() # for RPI, disable all but VC4 driver to minimize startup delay isPlatform "rpi" && params+=(-Dintel=false -Dradeon=false \ -Damdgpu=false -Dexynos=false \ -Dnouveau=false -Dvmwgfx=false \ -Domap=false -Dfreedreno=false \ -Dtegra=false -Detnaviv=false -Dvc4=true) meson builddir --prefix="$md_inst" "${params[@]}" ninja -C builddir md_ret_require="$md_build/builddir/tests/modetest/modetest" } function install_mesa-drm() { md_ret_files=( builddir/libkms/libkms.so* builddir/tests/modetest/modetest ) } ================================================ FILE: scriptmodules/supplementary/mkarcadejoystick.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="mkarcadejoystick" rp_module_desc="Raspberry Pi GPIO Joystick Driver" rp_module_help="Installs the GPIO driver from https://github.com/cmitu/mk_arcade_joystick_rpi" rp_module_licence="GPL2 https://raw.githubusercontent.com/recalbox/mk_arcade_joystick_rpi/master/LICENSE" rp_module_repo="git https://github.com/cmitu/mk_arcade_joystick_rpi retropie" rp_module_section="driver" rp_module_flags="noinstclean !all rpi !rpi5" function _version_mkarcadejoystick() { echo "0.1.7" } function depends_mkarcadejoystick() { depends_gamecondriver } function sources_mkarcadejoystick() { gitPullOrClone "$md_inst" pushd "$md_inst" sed -i "s/\$MKVERSION/$(_version_mkarcadejoystick)/" "$md_inst/dkms.conf" popd } function build_mkarcadejoystick() { dkmsManager install mk_arcade_joystick_rpi "$(_version_mkarcadejoystick)" } function remove_mkarcadejoystick() { dkmsManager remove mk_arcade_joystick_rpi rm -f /etc/modprobe.d/mk_arcade_joystick_rpi.conf sed -i "/mk_arcade_joystick_rpi/d" /etc/modules } function configure_mkarcadejoystick() { [[ "$md_mode" == "remove" ]] && return if ! grep -q "mk_arcade_joystick_rpi" /etc/modules; then addLineToFile "mk_arcade_joystick_rpi" /etc/modules fi if [[ ! -f /etc/modprobe.d/mk_arcade_joystick_rpi.conf ]]; then echo "options mk_arcade_joystick_rpi map=1" >/etc/modprobe.d/mk_arcade_joystick_rpi.conf fi dkmsManager reload mk_arcade_joystick_rpi } ================================================ FILE: scriptmodules/supplementary/mobilegamepad.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="mobilegamepad" rp_module_desc="Mobile Universal Gamepad for RetroPie" rp_module_licence="GPL3 https://raw.githubusercontent.com/sbidolach/mobile-gamepad/master/LICENSE" rp_module_repo="git https://github.com/sbidolach/mobile-gamepad.git master" rp_module_section="exp" rp_module_flags="noinstclean nobin" function depends_mobilegamepad() { depends_virtualgamepad "$@" } function remove_mobilegamepad() { pm2 stop app pm2 delete app rm -f /etc/apt/sources.list.d/nodesource.list } function sources_mobilegamepad() { gitPullOrClone "$md_inst" chown -R "$__user":"$__group" "$md_inst" } function install_mobilegamepad() { npm install -g grunt-cli npm install pm2 -g --unsafe-perm cd "$md_inst" sudo -u "$__user" npm install } function configure_mobilegamepad() { [[ "$md_mode" == "remove" ]] && return pm2 start app.sh pm2 startup pm2 save } ================================================ FILE: scriptmodules/supplementary/moonlight.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="moonlight" rp_module_desc="Moonlight Embedded - an open source gamestream client for embedded systems" rp_module_help="ROM Extensions: .ml\n\nCopy your moonlight launch configurations to $romdir/steam\n\nDon't forget to first pair with your remote host before using moonlight. You can use the configuration menu for pairing/unpairing to/from a remote machine." rp_module_licence="GPL3 https://raw.githubusercontent.com/irtimmer/moonlight-embedded/master/LICENSE" rp_module_repo="git https://github.com/irtimmer/moonlight-embedded.git master" rp_module_section="exp" rp_module_flags="!all arm" function _scriptmodule_cfg_file_moonlight() { echo "$configdir/all/moonlight/scriptmodule.cfg" } function _global_cfg_file_moonlight() { echo "$configdir/all/moonlight/global.conf" } function _mangle_moonlight() { local -r type="$1" shift case "$type" in 1) # slugify, ref: https://gist.github.com/oneohthree/f528c7ae1e701ad990e6 iconv -c -t ascii//TRANSLIT <<< "$@" | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr "[:upper:]" "[:lower:]" ;; 2) # windows-compatible, ref: https://stackoverflow.com/a/35352640 iconv -c -t ascii//TRANSLIT <<< "$@" | sed -r s/[\<\>]+/\ /g | sed -r s/[\\/\|]+/-/g | sed -r s/[:\*\"]+//g ;; 0|*) # no mangling, but replace invalid "/" with "-" sed -r s/\\//-/g <<< "$@" ;; esac } function _mfmt_moonlight() { case "$1" in 1) echo "SLUGIFY" ;; 2) echo "WINDOWS" ;; 0|*) echo "NONE " ;; esac } function _bfmt_moonlight() { if [[ "$1" -eq 1 ]]; then echo "YES"; else echo "NO "; fi } function depends_moonlight() { # ref: https://github.com/irtimmer/moonlight-embedded/wiki/Compilation#debian-raspbian--osmc local depends=( libssl-dev libopus-dev libasound2-dev libudev-dev libavahi-client-dev libcurl4-openssl-dev libevdev-dev libexpat1-dev libpulse-dev libenet-dev uuid-dev cmake ) # for remote host autodiscovery features depends+=(avahi-daemon libnss-mdns) # platform-specific dependencies isPlatform "dispmanx" && depends+=(libraspberrypi-dev) isPlatform "osmc" && depends+=(rbp-userland-dev-osmc) isPlatform "vero4k" && depends+=(vero3-userland-dev-osmc) # install selected dependencies getDepends "${depends[@]}" } function sources_moonlight() { gitPullOrClone } function build_moonlight() { # ref: https://github.com/irtimmer/moonlight-embedded/wiki/Compilation rm -rf build mkdir build cd build cmake ../ -DCMAKE_INSTALL_PREFIX="$md_inst" \ -DCMAKE_INSTALL_RPATH="$md_inst/lib" \ -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE make } function install_moonlight() { cd build make install strip "$md_inst/bin/moonlight" } function configure_moonlight() { addEmulator 1 "$md_id" "steam" "$md_inst/moonlight.sh stream -config %ROM%" addSystem "steam" "Steam Game Streaming" ".ml" [[ "$md_mode" == "remove" ]] && return # ensure rom dir mkRomDir "steam" # create and symlink user configuration directory mkUserDir "$configdir/all/moonlight" moveConfigDir "$home/.config/moonlight" "$configdir/all/moonlight" # create a new global config file if not there already if [[ ! -f "$(_global_cfg_file_moonlight)" ]]; then cat > "$(_global_cfg_file_moonlight)" << "_EOF_" # global config file for moonlight quitappafter = true _EOF_ chown "$__user":"$__group" "$(_global_cfg_file_moonlight)" fi # create wrapper for moonlight with appropriate directories set # note: moonlight adds /moonlight to XDG_* variables cat > "$md_inst/moonlight.sh" << _EOF_ #!/usr/bin/env bash export XDG_DATA_DIRS=$md_inst/share export XDG_CONFIG_DIR=$configdir/all export XDG_CACHE_DIR=$configdir/all $md_inst/bin/moonlight "\$@" _EOF_ chmod +x "$md_inst/moonlight.sh" } function get_scriptmodule_cfg_moonlight() { local address local overwrite=0 local wipe=0 local mangle=0 iniConfig " = " "" "$(_scriptmodule_cfg_file_moonlight)" iniGet "address" && address="$ini_value" iniGet "overwrite" && overwrite="$ini_value" iniGet "wipe" && wipe="$ini_value" iniGet "mangle" && mangle="$ini_value" echo "$address;$overwrite;$wipe;$mangle" } function set_scriptmodule_cfg_moonlight() { local -r address="$1" local -r overwrite="$2" local -r wipe="$3" local -r mangle="$4" [[ -z "$overwrite" || -z "$wipe" || -z "$mangle" ]] && return iniConfig " = " "" "$(_scriptmodule_cfg_file_moonlight)" if [[ -n "$address" ]]; then iniSet "address" "$address" else iniDel "address" fi iniSet "overwrite" "$overwrite" iniSet "wipe" "$wipe" iniSet "mangle" "$mangle" chown "$__user":"$__group" "$(_scriptmodule_cfg_file_moonlight)" } function get_resolution_moonlight() { local width=0 local height=0 local fps=0 iniConfig " = " "" "$(_global_cfg_file_moonlight)" iniGet "width" && width="$ini_value" iniGet "height" && height="$ini_value" iniGet "fps" && fps="$ini_value" if [[ -n "$width" && -n "$height" && -n "$fps" ]]; then echo "$width;$height;$fps" else echo "0;0;0" fi } function get_host_moonlight() { local sops="true" local unsupported="false" iniConfig " = " "" "$(_global_cfg_file_moonlight)" iniGet "sops" && sops="$ini_value" iniGet "unsupported" && unsupported="$ini_value" if [[ -n "$sops" && -n "$unsupported" ]]; then echo "$sops;$unsupported" else echo "true;false" fi } function set_host_moonlight() { local -r sops="$1" local -r unsupported="$2" [[ -z "$sops" || -z "$unsupported" ]] && return iniConfig " = " "" "$(_global_cfg_file_moonlight)" iniSet "sops" "$sops" iniSet "unsupported" "$unsupported" chown "$__user":"$__group" "$(_global_cfg_file_moonlight)" } function set_resolution_moonlight() { local -r width="$1" local -r height="$2" local -r fps="$3" [[ -z "$width" || -z "$height" || -z "$fps" ]] && return iniConfig " = " "" "$(_global_cfg_file_moonlight)" if [[ "$width" -gt 0 && "$height" -gt 0 && "$fps" -gt 0 ]]; then iniSet "width" "$width" iniSet "height" "$height" iniSet "fps" "$fps" else iniDel "width" iniDel "height" iniDel "fps" fi chown "$__user":"$__group" "$(_global_cfg_file_moonlight)" } function get_bitrate_moonlight() { local bitrate=0 iniConfig " = " "" "$(_global_cfg_file_moonlight)" iniGet "bitrate" && bitrate="$ini_value" if [[ -n "$bitrate" ]]; then echo "$bitrate" else echo "0" fi } function set_bitrate_moonlight() { local -r bitrate="$1" [[ -z "$bitrate" ]] && return iniConfig " = " "" "$(_global_cfg_file_moonlight)" if [[ "$bitrate" -gt 0 ]]; then iniSet "bitrate" "$bitrate" else iniDel "bitrate" fi chown "$__user":"$__group" "$(_global_cfg_file_moonlight)" } function exec_moonlight() { trap "trap INT; echo; return" INT sudo -u "$__user" "$md_inst/moonlight.sh" "$@" trap INT } function pair_moonlight() { exec_moonlight pair "$@" } function unpair_moonlight() { exec_moonlight unpair "$@" } function list_moonlight() { exec_moonlight list "$@" } function clear_pairing_moonlight() { rm -rf "$configdir/all/moonlight"/{client*,key*,uniqueid.dat} } function gen_configs_moonlight() { local apps=() local app local fname local config # read scriptmodule config IFS=";" read -r -a config < <(get_scriptmodule_cfg_moonlight) # wipe existing configuration files? if [[ "${config[2]}" -eq 1 ]]; then printMsgs "console" "Wiping existing config files ..." rm -f "$romdir/steam/"*.ml fi # iterate over all apps in remote host mapfile -t apps < <(list_moonlight ${config[0]:+"${config[0]}"} | sed -nE 's/^[0-9]+\. //gp') for app in "${apps[@]}"; do if [[ "$app" == "." || "$app" == ".." ]]; then printMsgs "console" "warning: app name '$app' is not valid" continue fi fname="$(_mangle_moonlight "${config[3]}" "$app")" # app filename mangle [[ "${config[1]}" -eq 0 && -f "$romdir/steam/$fname.ml" ]] && continue # overwrite? # generate config file with defaults printMsgs "console" "Generating config file for '$app' ..." iniConfig " = " "" "$romdir/steam/$fname.ml" iniSet "config" "$(_global_cfg_file_moonlight)" [[ -n "${config[0]}" ]] && iniSet "address" "${config[0]}" iniSet "app" "$app" chown "$__user":"$__group" "$romdir/steam/$fname.ml" 2>/dev/null done } function apps_gui_moonlight() { local options=() local default local cmd local choice local config # read scriptmodule config IFS=";" read -r -a config < <(get_scriptmodule_cfg_moonlight) # start the menu gui default="O" while true; do # create menu options options=( O "Overwrite existing config files: $(_bfmt_moonlight ${config[1]})" "Overwrite existing files in '$romdir/steam'?" W "Wipe existing config files: $(_bfmt_moonlight ${config[2]})" "Delete all files in '$romdir/steam'?" S "Config filename mangling: $(_mfmt_moonlight ${config[3]})" "Use original app names, slugified names or Windows-compatible names?" G "Generate config files" "Start remote apps config files generation" ) # show main menu cmd=(dialog --backtitle "$__backtitle" --default-item "$default" --item-help --menu "Remote Apps" 13 60 16) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) default="$choice" case "$choice" in O) config[1]=$((1 - config[1])) set_scriptmodule_cfg_moonlight "${config[@]}" ;; W) config[2]=$((1 - config[2])) set_scriptmodule_cfg_moonlight "${config[@]}" ;; S) config[3]=$((config[3] + 1)) [[ "${config[3]}" -gt 2 ]] && config[3]=0 set_scriptmodule_cfg_moonlight "${config[@]}" ;; G) gen_configs_moonlight read -p "Press ENTER to continue... " ;; *) break ;; esac done } function host_gui_moonlight() { local options=() local default local cmd local choice local tuple # get current host options IFS=";" read -r -a tuple < <(get_host_moonlight) default="U" [[ "${tuple[0]}" == "false" && "${tuple[1]}" == "false" ]] && default="1" [[ "${tuple[0]}" == "true" && "${tuple[1]}" == "true" ]] && default="2" [[ "${tuple[0]}" == "false" && "${tuple[1]}" == "true" ]] && default="3" # create menu options options=( U "Unset (use default)" "Do not force host compatibility settings" 1 "No SOPS" "Don't allow GFE to modify game settings" 2 "Allow unsupported" "Try streaming if GFE version or options are unsupported" 3 "Open-source host compatibility" "Turn off SOPS and allow unsupported options (for Sunshine/Open-Stream GFE server)" ) # show main menu cmd=(dialog --backtitle "$__backtitle" --default-item "$default" --item-help --menu "Host Compatibility Options" 16 45 16) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) case "$choice" in U) set_host_moonlight "true" "false" ;; 1) set_host_moonlight "false" "false" ;; 2) set_host_moonlight "true" "true" ;; 3) set_host_moonlight "false" "true" ;; esac } function resolution_gui_moonlight() { local options=() local default local cmd local choice local resolution # get current resolution IFS=";" read -r -a resolution < <(get_resolution_moonlight) if [[ "${resolution[0]}" -gt 0 && "${resolution[1]}" -gt 0 && "${resolution[2]}" -gt 0 ]]; then default="C" [[ "${resolution[0]}" == 1920 && "${resolution[1]}" == 1080 && "${resolution[2]}" == 60 ]] && default="1" [[ "${resolution[0]}" == 1920 && "${resolution[1]}" == 1080 && "${resolution[2]}" == 30 ]] && default="2" [[ "${resolution[0]}" == 1280 && "${resolution[1]}" == 720 && "${resolution[2]}" == 60 ]] && default="3" [[ "${resolution[0]}" == 1280 && "${resolution[1]}" == 720 && "${resolution[2]}" == 30 ]] && default="4" resolution="${resolution[0]} x ${resolution[1]} @ ${resolution[2]} fps" else default="U" resolution="(using default)" fi # create menu options options=( U "Unset (use default)" "Do not force a resolution setting" 1 "1080p60" "Set resolution to 1920 x 1080 @ 60 fps" 2 "1080p30" "Set resolution to 1920 x 1080 @ 30 fps" 3 "720p60" "Set resolution to 1280 x 720 @ 60 fps" 4 "720p30" "Set resolution to 1280 x 720 @ 30 fps" C "Custom" "Set a custom resolution" ) # show main menu cmd=(dialog --backtitle "$__backtitle" --default-item "$default" --item-help --menu "Global Resolution\nCurrent: $resolution" 16 45 16) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) case "$choice" in U) set_resolution_moonlight "0" "0" "0" ;; 1) set_resolution_moonlight "1920" "1080" "60" ;; 2) set_resolution_moonlight "1920" "1080" "30" ;; 3) set_resolution_moonlight "1280" "720" "60" ;; 4) set_resolution_moonlight "1280" "720" "30" ;; C) cmd=(dialog --backtitle "$__backtitle" --inputbox "Please enter a custom resolution as WIDTH HEIGHT FPS (separated by spaces)" 10 50) choice=$("${cmd[@]}" 2>&1 >/dev/tty) if [[ $? -eq 0 ]]; then IFS=" " read -r -a choice <<< "$choice" set_resolution_moonlight "${choice[0]}" "${choice[1]}" "${choice[2]}" fi ;; esac } function bitrate_gui_moonlight() { local options=() local default local cmd local choice local bitrate # get current bitrate bitrate=$(get_bitrate_moonlight) if [[ "$bitrate" -gt 0 ]]; then default="C" [[ "$bitrate" == 20000 ]] && default="1" [[ "$bitrate" == 10000 ]] && default="2" [[ "$bitrate" == 5000 ]] && default="3" bitrate="$bitrate Kbps" else default="U" bitrate="(using default)" fi # create menu options options=( U "Unset (use default)" "Do not force a stream bitrate setting" 1 "20000" "Set stream bitrate to 20000 Kbps" 2 "10000" "Set stream bitrate to 10000 Kbps" 3 "5000" "Set stream bitrate to 5000 Kbps" C "Custom" "Set a custom stream bitrate" ) # show main menu cmd=(dialog --backtitle "$__backtitle" --default-item "$default" --item-help --menu "Stream Bitrate\nCurrent: $bitrate" 16 45 16) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) case "$choice" in U) set_bitrate_moonlight "0" ;; 1) set_bitrate_moonlight "20000" ;; 2) set_bitrate_moonlight "10000" ;; 3) set_bitrate_moonlight "5000" ;; C) cmd=(dialog --backtitle "$__backtitle" --inputbox "Please enter a custom stream bitrate in Kbps" 10 50) choice=$("${cmd[@]}" 2>&1 >/dev/tty) [[ $? -eq 0 ]] && set_bitrate_moonlight "$choice" ;; esac } function gui_moonlight() { local options=() local default local cmd local choice local config # read scriptmodule config IFS=";" read -r -a config < <(get_scriptmodule_cfg_moonlight) # start the menu gui default="A" while true; do # create menu options, if no address show "autodiscover" options=( A "Set remote host address (${config[0]:-autodiscover})" P "Pair to remote host" U "Unpair from remote host" G "Configure remote apps" R "Configure global resolution" B "Configure global stream bitrate" H "Configure host compatibility" C "Clear all pairing data" ) # show main menu cmd=(dialog --backtitle "$__backtitle" --default-item "$default" --menu "Choose an option" 16 60 16) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) default="$choice" case "$choice" in A) cmd=(dialog --backtitle "$__backtitle" --inputbox "Please enter the address of the remote host (leave BLANK for autodiscovery of the remote host)" 10 65) choice=$("${cmd[@]}" 2>&1 >/dev/tty) if [[ $? -eq 0 ]]; then config[0]="$choice" set_scriptmodule_cfg_moonlight "${config[@]}" fi ;; P) pair_moonlight ${config[0]:+"${config[0]}"} /dev/tty read -p "Press ENTER to continue... " ;; U) unpair_moonlight ${config[0]:+"${config[0]}"} /dev/tty read -p "Press ENTER to continue... " ;; G) apps_gui_moonlight ;; R) resolution_gui_moonlight ;; B) bitrate_gui_moonlight ;; H) host_gui_moonlight ;; C) if dialog --defaultno --yesno "Are you sure you want to CLEAR ALL pairing data?" 8 40 2>&1 >/dev/tty; then if clear_pairing_moonlight; then printMsgs "dialog" "All pairing data cleared." else printMsgs "dialog" "Could not clear pairing data." fi fi ;; *) break ;; esac done } ================================================ FILE: scriptmodules/supplementary/omxiv.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="omxiv" rp_module_desc="OpenMAX image viewer for the Raspberry Pi" rp_module_licence="GPL2 https://raw.githubusercontent.com/cmitu/omxiv/master/LICENSE" rp_module_repo="git https://github.com/retropie/omxiv.git master" rp_module_section="depends" rp_module_flags="!all rpi" function depends_omxiv() { getDepends libraspberrypi-dev libraspberrypi-doc libpng-dev libjpeg-dev } function sources_omxiv() { gitPullOrClone } function build_omxiv() { make clean make ilclient make md_ret_require="omxiv.bin" } function install_omxiv() { make install INSTALL="$md_inst" } ================================================ FILE: scriptmodules/supplementary/pegasus-fe-dev.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="pegasus-fe-dev" rp_module_desc="Pegasus: A cross platform, customizable graphical frontend (lastest master)" rp_module_help="Pegasus is a cross platform, customizable graphical frontend for launching emulators and managing your game collection.\nThis package provides source installation on platforms not covered by the upstream project pre-built binaries (i.e. ARM 64bit, Ubuntu 22.04 or later, Debian 11 or later)." rp_module_licence="GPL3 https://raw.githubusercontent.com/mmatyas/pegasus-frontend/master/LICENSE.md" rp_module_section="exp" rp_module_repo="git https://github.com/mmatyas/pegasus-frontend master" rp_module_flags="!mali frontend" function depends_pegasus-fe-dev() { if [[ "$__os_debian_ver" -lt 11 ]]; then md_ret_errors+=("Pegasus (dev) requires Debian 11 (bullseye) or later. Please install the 'pegasus-fe' package instead.") return 1 fi if [[ -n "$__os_ubuntu_ver" ]] && compareVersions "$__os_ubuntu_ver" lt 22.04; then md_ret_errors+=("Pegasus (dev) requires Ubuntu 22.04 or later. Please install the 'pegasus-fe' package instead.") return 1 fi local depends=( fontconfig gstreamer1.0-alsa gstreamer1.0-libav gstreamer1.0-plugins-good libqt5multimedia5-plugins libsdl2-dev pkg-config polkitd qml-module-qtgraphicaleffects qml-module-qtmultimedia qml-module-qtqml qml-module-qtqml-models2 qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qtquick-templates2 qml-module-qtquick-window2 qml-module-qtquick2 qml-module-qt-labs-qmlmodels qml-module-qtquick-shapes ) # Qt build dependencies depends+=(qtbase5-private-dev qtdeclarative5-dev qtmultimedia5-dev libqt5svg5-dev qttools5-dev) getDepends "${depends[@]}" } function sources_pegasus-fe-dev() { gitPullOrClone # on KMS, apply a patch to fix lanching games isPlatform "kms" && applyPatch "$md_build/etc/rpi4/kms_launch_fix.diff" } function build_pegasus-fe-dev() { rm -fr release && mkdir -p release pushd release qmake .. QMAKE_CXXFLAGS+="$__cxxflags" QMAKE_LIBS_LIBDL=-ldl USE_SDL_GAMEPAD=1 USE_SDL_POWER=1 INSTALLDIR="$md_inst" make md_ret_require=( "$md_build/release/src/app/pegasus-fe" ) } function install_pegasus-fe-dev() { make -C release install _add_launcher_pegasus-fe } function remove_pegasus-fe-dev() { remove_pegasus-fe } function configure_pegasus-fe-dev() { configure_pegasus-fe } ================================================ FILE: scriptmodules/supplementary/pegasus-fe.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="pegasus-fe" rp_module_desc="Pegasus: A cross platform, customizable graphical frontend (latest pre-built release)" rp_module_help="Pegasus is a cross platform, customizable graphical frontend for launching emulators and managing your game collection.\nThis package installs the upstream pre-built binaries. Use this package on RaspiOS Buster or PC/x86 installations" rp_module_licence="GPL3 https://raw.githubusercontent.com/mmatyas/pegasus-frontend/master/LICENSE.md" rp_module_section="exp" rp_module_flags="!mali frontend" function depends_pegasus-fe() { local depends=( fontconfig gstreamer1.0-alsa gstreamer1.0-libav gstreamer1.0-plugins-good jq libsdl2-dev polkitd ) # show an error on 64bit ARMs, since there are no pre-built packages for it if isPlatform "arm" && hasFlag "64bit"; then md_ret_errors+=("There are no pre-build binaries for 64bit ARM systems! Try installing Pegasus with the ${md_id}-dev package") return 1 fi getDepends "${depends[@]}" } function install_bin_pegasus-fe() { # get all asset urls for the latest continuous release local all_assets all_assets="$(download https://api.github.com/repos/mmatyas/pegasus-frontend/releases/tags/continuous -)" || return all_assets="$(echo "${all_assets}" | jq -r '.assets[] | .browser_download_url')" printMsgs "console" "Available releases:" printMsgs "console" "${all_assets}" # find out which platform's package we'll need local platform isPlatform "x11" && platform="x11" isPlatform "rpi" && platform="$__platform" if [[ -z "${platform}" ]]; then md_ret_errors+=("Sorry, Pegasus has no pre-built binaries for this platform. Consider installing the ${md_id}-dev package or reporting this on the RetroPie forum!") return fi printMsgs "console" "Package platform: ${platform}" # select the url for the platform local asset_url asset_url="$(echo "${all_assets}" | grep ${platform})" if [[ -z "${asset_url}" ]]; then md_ret_errors+=("Looks like the latest Pegasus release is not yet available for this platform. This happens when the build is so fresh it's being uploaded right now, or when there's a technical problem on the download server. Either way, this is a temporary problem, so please try again in 1-2 minutes. If the problem persists, consider reporting it on the forum!") return fi # download and extract the package printMsgs "console" "Download URL: ${asset_url}" downloadAndExtract "${asset_url}" "$md_inst" _add_launcher_pegasus-fe } function _add_launcher_pegasus-fe() { # create launcher script cat > /usr/bin/pegasus-fe << _EOF_ #!/bin/bash if [[ \$(id -u) -eq 0 ]]; then echo "Pegasus should not be run as root. If you used 'sudo pegasus-fe' please run without sudo." exit 1 fi _EOF_ # on KMS platforms, add some additional setup commands if isPlatform "kms"; then cat >> /usr/bin/pegasus-fe << _EOF_ # KMS setup export QT_QPA_EGLFS_FORCE888=1 # improve gradients export QT_QPA_EGLFS_KMS_ATOMIC=1 # use the atomic DRM API on Pi 4 export QT_QPA_PLATFORM=eglfs export QT_QPA_QT_QPA_EGLFS_INTEGRATION=eglfs_kms # find the right DRI card for i in \$(find /sys/devices/platform -name "card?"); do node=\${i:0-1} case "\$i" in *gpu*) card=\$node ;; esac done echo Using DRI card at /dev/dri/card\${card} file="/tmp/pegasus_\$\$.eglfs.json" echo "{ \"device\": \"/dev/dri/card\${card}\" }" > "\$file" export QT_QPA_EGLFS_KMS_CONFIG="\$file" _EOF_ fi cat >> /usr/bin/pegasus-fe << _EOF_ clear "$md_inst/pegasus-fe" "\$@" rm -f "/tmp/pegasus_\$\$.eglfs.json" _EOF_ chmod +x /usr/bin/pegasus-fe } function _update_themes_pegasus-fe() { # add some themes to Pegasus echo Installing themes declare themes=( "mmatyas/pegasus-theme-9999999-in-1" "mmatyas/pegasus-theme-es2-simple" "mmatyas/pegasus-theme-flixnet" "mmatyas/pegasus-theme-secretary" ) local theme pushd "$home/.config/pegasus-frontend/themes" || return for theme in ${themes[@]}; do local path=${theme//"mmatyas/pegasus-theme-"/} gitPullOrClone "$path" "https://github.com/$theme" done popd } function remove_pegasus-fe() { rm -f /usr/bin/pegasus-fe } function configure_pegasus-fe() { moveConfigDir "$home/.config/pegasus-frontend" "$md_conf_root/all/pegasus-fe" # create external directories mkUserDir "$md_conf_root/all/pegasus-fe/scripts" mkUserDir "$md_conf_root/all/pegasus-fe/themes" [[ "$md_mode" == "remove" ]] && return # remove the other Pegasus package if it's installed if [[ "$md_id" == "pegasus-fe-dev" ]]; then rmDirExists "$rootdir/$md_type/pegasus-fe" else rmDirExists "$rootdir/$md_type/pegasus-fe-dev" fi # update themes _update_themes_pegasus-fe } ================================================ FILE: scriptmodules/supplementary/powerblock.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="powerblock" rp_module_desc="PowerBlock Driver" rp_module_help="Please note that you need to manually enable or disable the PowerBlock Service in the Configuration section. IMPORTANT: If the service is enabled and the power switch functionality is enabled (which is the default setting) in the config file, you need to have a switch connected to the PowerBlock." rp_module_repo="git https://github.com/petrockblog/PowerBlock.git master" rp_module_section="driver" rp_module_flags="noinstclean !all rpi" function depends_powerblock() { local depends=(cmake doxygen) isPlatform "videocore" && depends+=(libraspberrypi-dev) getDepends "${depends[@]}" } function sources_powerblock() { if [[ -d "$md_inst" ]]; then git -C "$md_inst" reset --hard # ensure that no local changes exist fi gitPullOrClone "$md_inst" } function install_powerblock() { cd "$md_inst" bash install.sh } function remove_powerblock() { cd "$md_inst" bash uninstall.sh } function gui_powerblock() { local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option." 22 86 16) local options=( 1 "Enable PowerBlock driver" 2 "Disable PowerBlock driver" ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) install_powerblock printMsgs "dialog" "Enabled PowerBlock driver." ;; 2) remove_powerblock printMsgs "dialog" "Disabled PowerBlock driver." ;; esac fi } ================================================ FILE: scriptmodules/supplementary/ps3controller.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="ps3controller" rp_module_desc="PS3 controller driver and pair via sixad" rp_module_licence="GPL2 https://raw.githubusercontent.com/RetroPie/sixad/master/COPYING" rp_module_section="driver" function depends_ps3controller() { depends_bluetooth local depends=(checkinstall libusb-dev libbluetooth-dev joystick) getDepends "${depends[@]}" } function sources_ps3controller() { local branch="$1" [[ "$branch" == "gasia-only" ]] && branch="master" gitPullOrClone "$md_build/sixad" https://github.com/RetroPie/sixad.git $branch } function build_ps3controller() { local branch="$1" local params=("DEVICE_SHORT_NAME=1") [[ "$branch" == "gasia-only" ]] && params+=("GASIA_GAMEPAD_HACKS=1") cd sixad make clean make "${params[@]}" local bin for bin in sixad-bin sixpair sixad-sixaxis sixad-remote sixad-raw sixad-3in1; do md_ret_require+=("$md_build/sixad/bins/$bin") done } function install_ps3controller() { local branch="$1" [[ -z "$branch" ]] && branch="ps3" cd sixad checkinstall -y --fstrans=no echo "$branch" >"$md_inst/type.txt" # Disable timeouts iniConfig " = " "" "/etc/bluetooth/main.conf" iniSet "DiscoverableTimeout" "0" iniSet "PairableTimeout" "0" } function remove_ps3controller() { dpkg --purge sixad [[ -f /usr/sbin/bluetoothd ]] && chmod 755 /usr/sbin/bluetoothd } function pair_ps3controller() { local branch="$1" [[ -z "$branch" ]] && branch="ps3" if [[ ! -f "$md_inst/type.txt" || "$(<"$md_inst/type.txt")" != "$branch" ]]; then local mode for mode in sources build install clean; do rp_callModule ps3controller $mode $branch done return fi printMsgs "dialog" "Please connect your PS3 controller now or anytime to its USB connection, to setup Bluetooth connection. \n\nAfterwards disconnect your PS3 controller from its USB connection, and press the PS button to connect via Bluetooth." # enable old behaviour. run "sixad-helper sixpair" "now" for users who do not read info text sixad-helper sixpair } function gui_ps3controller() { declare -A drivers drivers["ps3"]="official ps3" drivers["gasia"]="clone support gasia" drivers["gasia-only"]="gasia only" drivers["shanwan"]="clone support shanwan" printMsgs "dialog" "WARNING: The ps3controller driver partially disables the standard Bluetooth stack so that Dual Shock controllers can pair correctly. Although the Bluetooth stack is temporarily re-enabled inside Retropie's Bluetooth menu to allow compatibility with standard Bluetooth peripherals, any other software that relies on the full Bluetooth stack will not work correctly while the ps3controller driver is active." local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option" 22 76 16) while true; do local i=1 local options=() local installed local id for id in ps3 gasia gasia-only shanwan; do installed="" if [[ -f "$md_inst/type.txt" && "$(<"$md_inst/type.txt")" == "$id" ]]; then options+=("$i" "Pair PS3 controller (${drivers[$id]})") else options+=("$i" "Install PS3 driver (${drivers[$id]})") fi ((i++)) done options+=( 5 "Remove PS3 controller configurations" ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) rp_callModule "$md_id" pair ;; 2) rp_callModule "$md_id" pair gasia ;; 3) rp_callModule "$md_id" pair gasia-only ;; 4) rp_callModule "$md_id" pair shanwan ;; 5) rp_callModule "$md_id" remove break ;; esac else break fi done } ================================================ FILE: scriptmodules/supplementary/raspbiantools.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="raspbiantools" rp_module_desc="Raspbian related tools" rp_module_section="config" rp_module_flags="!all rpi" function apt_upgrade_raspbiantools() { # install an older kernel/firmware for stretch to resolve newer kernel issues or unhold if updating to a newer release stretch_fix_raspbiantools # on Buster, use the legacy Raspbian archive for package installation buster_fix_apt_raspbiantools # on Buster, always install the Bluez package from the RPI repos buster_bluez_pin_raspbiantools # remove our own SDL1 package for non-dispmanx/non-videocore platforms if isPlatform "rpi" && ! isPlatform "dispmanx"; then sdl1_replace_raspbiantools fi # on RaspiOS Trixie, disable the 'fluidsynth' user service starting automatically if isPlatform "rpi" && [[ "$__os_debian_ver" -eq 13 ]]; then fluidsynth_service_raspbiantools off fi aptUpdate apt-get -y dist-upgrade --allow-downgrades } function lxde_raspbiantools() { aptInstall --no-install-recommends xorg lxde aptInstall raspberrypi-ui-mods rpi-chromium-mods gvfs # On `buster`, disable PulseAudio since it messes up the audio settings # remove the lxpanel plugin for PulseAudio volume, to prevent a crash due to missing PulseAudio # and install the volume lxpanel plugin that supports ALSA if [[ "$__os_debian_ver" -lt 11 ]]; then __toggle_pulseaudio_audiosettings "off" aptRemove lxplug-volumepulse aptInstall lxplug-volume fi # Firefox is supported starting with Bookworm, install it along with Chromium [[ "$__os_debian_ver" -ge 12 ]] && aptInstall --no-install-recommends firefox rpi-firefox-mods setConfigRoot "ports" addPort "lxde" "lxde" "Desktop" "XINIT:startx" if (isPlatform "rpi4" || isPlatform "rpi5") && [[ "$__os_debian_ver" -ge 12 ]]; then addPort "wayfire" "wayfire" "Desktop (Wayland)" "wayfire-pi" fi enable_autostart } function package_cleanup_raspbiantools() { # remove PulseAudio since this is slowing down the whole system significantly. Cups is also not needed apt-get remove -y pulseaudio cups wolfram-engine sonic-pi apt-get -y autoremove } function disable_blanker_raspbiantools() { sed -i 's/BLANK_TIME=\d*/BLANK_TIME=0/g' /etc/kbd/config sed -i 's/POWERDOWN_TIME=\d*/POWERDOWN_TIME=0/g' /etc/kbd/config } function stretch_fix_raspbiantools() { # install an older kernel/firmware and hold it for stretch to resolve sony bt, composite # and overscan issues, but also unhold for newer Raspbian versions to allow upgrading. local ver="1.20190401-1" # make sure we are on a rpi and have the raspberrypi-kernel package if isPlatform "rpi" && hasPackage raspberrypi-kernel; then if [[ "$__os_debian_ver" -eq 9 ]]; then # for Raspbian 9 (stretch) we want to install / hold the older kernel install_firmware_raspbiantools "$ver" hold elif hasPackage raspberrypi-kernel "$ver" eq; then # if we are not running Raspbian 9 (stretch), but are running the old kernel # we want to unhold it to allow kernel updates again install_firmware_raspbiantools "$ver" unhold fi fi } function buster_fix_apt_raspbiantools() { if isPlatform "rpi" && [[ "$__os_debian_ver" -eq 10 ]]; then sed -i 's/raspbian\.raspberrypi\.org/legacy.raspbian.org/' /etc/apt/sources.list fi } function buster_bluez_pin_raspbiantools() { # pin the 'bluez' package to the RPI repos to prevent any Debian updates overwriting it # use Priority 1001 to force the the installation even when the Debian package is installed local pin_file="/etc/apt/preferences.d/01-bluez-pin" if isPlatform "rpi" && [[ "$__os_debian_ver" -eq 10 && ! -f "$pin_file" ]] ; then cat << PIN_EOF > "$pin_file" Package: bluez Pin: origin archive.raspberrypi.org Pin-Priority: 1001 PIN_EOF fi } function sdl1_replace_raspbiantools() { local inst_ver="$(dpkg-query --show --showformat '${Version}' libsdl1.2-dev)" local sdl1_ver="$(get_pkg_ver_sdl1)" local repo_ver="$(apt-cache madison libsdl1.2-dev | head -n 1 | cut -d'|' -f 2 | tr -d '[:blank:]')" # check if the version installed is our own [[ -z "$inst_ver" || ! "$inst_ver" == "$sdl1_ver" || -z "$repo_ver" ]] && return printMsgs "console" "Replacing RetroPie SDL1 version since it's not needed anymore" apt-get -y --allow-downgrades --allow-change-held-packages install libsdl1.2debian=$repo_ver libsdl1.2-dev=$repo_ver } function install_firmware_raspbiantools() { local ver="$1" local state="$2" [[ -z "$ver" ]] && return 1 local url="http://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware" mkdir -p "$md_build" pushd "$md_build" >/dev/null local pkg local pkgs=(raspberrypi-bootloader libraspberrypi0 libraspberrypi-doc libraspberrypi-dev libraspberrypi-bin raspberrypi-kernel-headers raspberrypi-kernel) local deb # download all packages then install later to reduce issues if interrupted or a networking issue for pkg in "${pkgs[@]}"; do if hasPackage "$pkg" "$ver" ne; then deb="${pkg}_${ver}_armhf.deb" if ! download "$url/$deb"; then md_ret_errors+=("Failed to download $deb") return 1 fi fi done # install packages if needed for pkg in "${pkgs[@]}"; do deb="${pkg}_${ver}_armhf.deb" if hasPackage "$pkg" "$ver" ne && [[ -f "$deb" ]]; then dpkg -i "$deb" rm "$deb" fi # set package state [[ -n "$state" ]] && apt-mark "$state" "$pkg" done popd >/dev/null rm -rf "$md_build" return 0 } function enable_modules_raspbiantools() { sed -i '/snd_bcm2835/d' /etc/modules local modules=(uinput) local module for module in "${modules[@]}"; do modprobe $module if ! grep -q "$module" /etc/modules; then addLineToFile "$module" "/etc/modules" else echo "$module module already contained in /etc/modules" fi done } function enable_zram_raspbiantools() { if [[ "$__os_id" == "Raspbian" ]] || [[ "$__os_id" == "Debian" ]]; then aptInstall zram-tools # Use 50% of the current memory for ZRAM local percent="50" iniConfig "=" "" "/etc/default/zramswap" # Raspbian Buster uses keyword PERCENTAGE iniSet "PERCENTAGE" "$percent" # Debian Bullseye/Bookworm use keyword PERCENT iniSet "PERCENT" "$percent" # Use zstd compression algorithm if kernel supports it [[ -f /sys/class/block/zram0/comp_algorithm ]] && [[ "$(cat /sys/class/block/zram0/comp_algorithm)" == *zstd* ]] && iniSet "ALGO" "zstd" service zramswap stop service zramswap start elif [[ "$__os_id" == "Ubuntu" ]]; then aptInstall zram-config # Ubuntu has a automatic zram configuration fi } function disable_zram_raspbiantools() { if [[ "$__os_id" == "Raspbian" ]] || [[ "$__os_id" == "Debian" ]]; then aptRemove zram-tools elif [[ "$__os_id" == "Ubuntu" ]]; then aptRemove zram-config fi } function fluidsynth_service_raspbiantools() { # use the 1st parameter as service state local state=${1:-on} if [[ "$state" == "on" ]]; then rm "${home}/.config/systemd/user/fluidsynth.service" fi if [[ "$state" == "off" ]]; then mkdir -p "${home}/.config/systemd/user" ln -sf /dev/null "${home}/.config/systemd/user/fluidsynth.service" chown -R "$__user":"$__group" "${home}/.config/systemd/user" fi } function gui_raspbiantools() { while true; do local zram_status="Enable" [[ $(cat /proc/swaps) == *zram* ]] && zram_status="Disable" local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option" 22 76 16) local options=( 1 "Upgrade Raspbian packages" 2 "Install Pixel desktop environment" 3 "Remove some unneeded packages (pulseaudio / cups / wolfram)" 4 "Disable screen blanker" 5 "Enable needed kernel module uinput" ) # exclude ZRAM config for Armbian, it is handled by `armbian-config` ! isPlatform "armbian" && options+=(6 "$zram_status compressed memory (ZRAM)") local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) rp_callModule "$md_id" apt_upgrade ;; 2) dialog --defaultno --yesno "Are you sure you want to install the Pixel desktop?" 22 76 2>&1 >/dev/tty || continue rp_callModule "$md_id" lxde printMsgs "dialog" "Pixel desktop/LXDE is installed." ;; 3) rp_callModule "$md_id" package_cleanup ;; 4) rp_callModule "$md_id" disable_blanker ;; 5) rp_callModule "$md_id" enable_modules ;; 6) [[ "$zram_status" == "Enable" ]] && rp_callModule "$md_id" enable_zram || rp_callModule "$md_id" disable_zram ;; esac else break fi done } ================================================ FILE: scriptmodules/supplementary/resetromdirs.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="resetromdirs" rp_module_desc="Reset ownership/permissions of RetroPie/roms directory" rp_module_section="config" function gui_resetromdirs() { printHeading "Resetting $romdir ownershop/permissions" mkUserDir "$romdir" mkUserDir "$biosdir" chown -R "$__user":"$__group" "$romdir" chown -R "$__user":"$__group" "$biosdir" chmod -R ug+rwX "$romdir" chmod -R ug+rwX "$biosdir" } ================================================ FILE: scriptmodules/supplementary/retronetplay.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="retronetplay" rp_module_desc="RetroNetplay" rp_module_section="config" function rps_retronet_saveconfig() { local conf="$configdir/all/retronetplay.cfg" cat >"$conf" <<_EOF_ __netplaymode="$__netplaymode" __netplayport="$__netplayport" __netplayhostip="$__netplayhostip" __netplayhostip_cfile="$__netplayhostip_cfile" __netplaynickname="$__netplaynickname" _EOF_ chown "$__user":"$__group" "$conf" printMsgs "dialog" "Configuration has been saved to $conf" } function rps_retronet_loadconfig() { if [[ -f "$configdir/all/retronetplay.cfg" ]]; then source "$configdir/all/retronetplay.cfg" else __netplayenable="D" __netplaymode="H" __netplayport="55435" __netplayhostip="192.168.0.1" __netplayhostip_cfile="" __netplaynickname="RetroPie" fi } function rps_retronet_mode() { cmd=(dialog --backtitle "$__backtitle" --menu "Please set the netplay mode." 22 76 16) options=(1 "Set as HOST" 2 "Set as CLIENT" ) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) __netplaymode="H" __netplayhostip_cfile="" ;; 2) __netplaymode="C" __netplayhostip_cfile="$__netplayhostip" ;; esac fi } function rps_retronet_port() { choice=$(inputBox "Port for netplay" "$__netplayport" 4) if [[ -n "$choice" ]]; then __netplayport="$choice" fi } function rps_retronet_hostip() { choice=$(inputBox "IP Address of the host" "$__netplayhostip" 8) if [[ -n "$choice" ]]; then __netplayhostip="$choice" if [[ $__netplaymode == "H" ]]; then __netplayhostip_cfile="" else __netplayhostip_cfile="$__netplayhostip" fi fi } function rps_retronet_nickname() { choice=$(inputBox "Nickname you wish to use" "$__netplaynickname" 4) if [[ -n "$choice" ]]; then __netplaynickname="$choice" fi } function gui_retronetplay() { rps_retronet_loadconfig local ip_int=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1') local ip_ext=$(curl -4 http://ipecho.net/plain) while true; do cmd=(dialog --backtitle "$__backtitle" --cancel-label "Exit" --menu "Configure RetroArch Netplay.\nInternal IP: $ip_int External IP: $ip_ext" 22 76 16) options=( 1 "Set mode, (H)ost or (C)lient. Currently: $__netplaymode" 2 "Set port. Currently: $__netplayport" 3 "Set host IP address (for client mode). Currently: $__netplayhostip" 4 "Set netplay nickname. Currently: '$__netplaynickname'" 5 "Save configuration" ) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) rps_retronet_mode ;; 2) rps_retronet_port ;; 3) rps_retronet_hostip ;; 4) rps_retronet_nickname ;; 5) rps_retronet_saveconfig ;; esac else break fi done } ================================================ FILE: scriptmodules/supplementary/retropiemenu.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="retropiemenu" rp_module_desc="RetroPie configuration menu for EmulationStation" rp_module_section="core" rp_module_flags="nonet" function _update_hook_retropiemenu() { # to show as installed when upgrading to retropie-setup 4.x if ! rp_isInstalled "$md_id" && [[ -f "$home/.emulationstation/gamelists/retropie/gamelist.xml" ]]; then mkdir -p "$md_inst" # to stop older scripts removing when launching from retropie menu in ES due to not using exec or exiting after running retropie-setup from this module touch "$md_inst/.retropie" fi } function depends_retropiemenu() { getDepends mc p7zip } function install_bin_retropiemenu() { return } function configure_retropiemenu() { [[ "$md_mode" == "remove" ]] && return local rpdir="$home/RetroPie/retropiemenu" mkdir -p "$rpdir" cp -Rv "$md_data/icons" "$rpdir/" chown -R "$__user":"$__group" "$rpdir" isPlatform "rpi" && rm -f "$rpdir/dispmanx.rp" # add the gameslist / icons local files=( 'audiosettings' 'bluetooth' 'configedit' 'esthemes' 'filemanager' 'raspiconfig' 'retroarch' 'retronetplay' 'rpsetup' 'runcommand' 'showip' 'splashscreen' 'wifi' ) local names=( 'Audio' 'Bluetooth' 'Configuration Editor' 'ES Themes' 'File Manager' 'Raspi-Config' 'Retroarch' 'RetroArch Net Play' 'RetroPie Setup' 'Run Command Configuration' 'Show IP' 'Splash Screens' 'WiFi' ) local descs=( 'Configure audio settings. Choose default of auto, 3.5mm jack, or HDMI. Mixer controls, and apply default settings.' 'Register and connect to Bluetooth devices. Unregister and remove devices, and display registered and connected devices.' 'Change common RetroArch options, and manually edit RetroArch configs, global configs, and non-RetroArch configs.' 'Install, uninstall, or update EmulationStation themes. Most themes can be previewed at https://retropie.org.uk/docs/Themes/.' 'Basic ASCII file manager for Linux allowing you to browse, copy, delete, and move files.' 'Change user password, boot options, internationalization, camera, add your Pi to Rastrack, overclock, overscan, memory split, SSH and more.' 'Launches the RetroArch GUI so you can change RetroArch options. Note: Changes will not be saved unless you have enabled the "Save Configuration On Exit" option.' 'Set up RetroArch Netplay options, choose host or client, port, host IP, delay frames, and your nickname.' 'Install RetroPie from binary or source, install experimental packages, additional drivers, edit Samba shares, custom scraper, as well as other RetroPie-related configurations.' 'Change what appears on the runcommand screen. Enable or disable the menu, enable or disable box art, and change CPU configuration.' 'Displays your current IP address, as well as other information provided by the command "ip addr show."' 'Enable or disable the splashscreen on RetroPie boot. Choose a splashscreen, download new splashscreens, and return splashscreen to default.' 'Connect to or disconnect from a WiFi network and configure WiFi settings.' ) # 'legacy' joy2key uses direct tty I/O and needs the extra redirection arguments iniConfig " = " '"' "$configdir/all/runcommand.cfg" iniGet "legacy_joy2key" local tty_args [[ "$ini_value" == "1" ]] && tty_args=" /dev/tty" setESSystem "RetroPie" "retropie" "$rpdir" ".rp .sh" "sudo $scriptdir/retropie_packages.sh retropiemenu launch %ROM% $tty_args" "" "retropie" local file local name local desc local image local i for i in "${!files[@]}"; do case "${files[i]}" in audiosettings|raspiconfig|splashscreen) ! isPlatform "rpi" && continue ;; wifi) [[ "$__os_id" != "Raspbian" ]] && continue esac file="${files[i]}" name="${names[i]}" desc="${descs[i]}" image="$home/RetroPie/retropiemenu/icons/${files[i]}.png" touch "$rpdir/$file.rp" local function for function in $(compgen -A function _add_rom_); do "$function" "retropie" "RetroPie" "$file.rp" "$name" "$desc" "$image" done done } function remove_retropiemenu() { rm -rf "$home/RetroPie/retropiemenu" rm -rf "$home/.emulationstation/gamelists/retropie" delSystem retropie } function launch_retropiemenu() { clear local command="$1" local basename="${command##*/}" local no_ext="${basename%.rp}" joy2keyStart case "$basename" in retroarch.rp) joy2keyStop cp "$configdir/all/retroarch.cfg" "$configdir/all/retroarch.cfg.bak" chown "$__user":"$__group" "$configdir/all/retroarch.cfg.bak" su "$__user" -c "XDG_RUNTIME_DIR=/run/user/$SUDO_UID \"$emudir/retroarch/bin/retroarch\" --menu --config \"$configdir/all/retroarch.cfg\"" iniConfig " = " '"' "$configdir/all/retroarch.cfg" iniSet "config_save_on_exit" "false" ;; rpsetup.rp) rp_callModule setup gui ;; raspiconfig.rp) raspi-config ;; filemanager.rp) mc ;; showip.rp) local ip="$(getIPAddress)" printMsgs "dialog" "Your IP is: ${ip:-(unknown)}\n\nOutput of 'ip addr show':\n\n$(ip addr show)" ;; *.rp) rp_callModule $no_ext depends if fnExists gui_$no_ext; then rp_callModule $no_ext gui else rp_callModule $no_ext configure fi ;; *.sh) cd "$home/RetroPie/retropiemenu" sudo -u "$__user" bash "$command" ;; esac joy2keyStop clear } ================================================ FILE: scriptmodules/supplementary/runcommand/runcommand.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # # Editor's note: You may notice "\c \%" escape sequences, these are needed # to avoid the initial % char to be swallowed by doxygen. ## @file supplementary/runcommand/runcommand.sh ## @brief runcommand launching script ## @copyright GPLv3 ## @details ## @par Usage ## ## `runcommand.sh VIDEO_MODE COMMAND SAVE_NAME` ## ## or ## ## `runcommand.sh VIDEO_MODE _SYS_/_PORT_ SYSTEM ROM` ## ## Video mode switching is supported on X11, KMS and Raspberry Pi (legacy graphics) systems ## ## Automatic video mode selection (all): ## ## * VIDEO_MODE = 0: use the current video mode ## ## Automatic video mode (Raspberry Pi legacy graphics): ## ## * VIDEO_MODE = 1: set video mode to 640x480 (4:3) or 720x480 (16:9) @60hz ## * VIDEO_MODE = 4: set video mode to 1024x768 (4:3) or 1280x720 (16:9) @60hz ## ## Manual video mode selection (Raspberry Pi legacy graphics): ## ## * VIDEO_MODE = "CEA-#": set video mode to CEA mode # ## * VIDEO_MODE = "DMT-#": set video mode to DMT mode # ## * VIDEO_MODE = "PAL/NTSC-RATIO": set mode to SD output with RATIO of 4:3 / 16:10 or 16:9 ## ## Manual video mode selection (KMS): ## ## * VIDEO_MODE = "CRTCID-MODEID": set video mode to CRTC connector id and mode id ## ## Manual video mode selection (X11): ## ## * VIDEO_MODE = "OUTPUT:MODEID": set video mode to connected output name and mode index ## ## @note ## Video mode switching only happens if the monitor reports the modes as available ## (via tvservice) and the requested mode differs from the currently active mode ## ## Additionally it is possible to pass in the current screen resolution ## (selectable in the runcommand menu) to the emulator to be launched. The ## respective variables are \c \%XRES% and \c \%YRES% which will be replaced ## with the specific values as the placeholders \c \%ROM% and \c \%BASENAME% ## (see below). For example it is possible to set \c ## --displaysize=\%XRESx\%YRES% in emulators.cfg` if an emulator has a command ## line switch to set the resolution. ## ## If `_SYS_` or `_PORT_` is provided as the second parameter for the ## `runcommand.sh` script, the commandline will be extracted from ## `/opt/retropie/configs/SYSTEM/emulators.cfg` with \c \%ROM%, \c \%BASENAME% ## being replaced with the `ROM` parameter. This is the default mode used when ## launching in RetroPie so the user can switch emulator used as well as other ## options from the runcommand GUI. ## ## If `SAVE_NAME` is included, that is used for loading and saving of video output ## modes as well as rendering backend settings for the current `COMMAND`. If omitted, ## the binary name is used as a key for the loading and saving. The savename is ## also displayed in the video output menu (detailed below), so for our purposes ## we send the emulator module id, which is somewhat descriptive yet short. ## ## On launch this script waits for two seconds for a key or joystick press. If ## pressed the GUI is shown, where a user can set video modes, default emulators ## and other options (depending what is being launched). ROOTDIR="/opt/retropie" CONFIGDIR="$ROOTDIR/configs" LOG="/dev/shm/runcommand.log" RUNCOMMAND_CONF="$CONFIGDIR/all/runcommand.cfg" VIDEO_CONF="$CONFIGDIR/all/videomodes.cfg" EMU_CONF="$CONFIGDIR/all/emulators.cfg" BACKENDS_CONF="$CONFIGDIR/all/backends.cfg" RETRONETPLAY_CONF="$CONFIGDIR/all/retronetplay.cfg" JOY2KEY="$ROOTDIR/admin/joy2key/joy2key" SDL2_MAPPINGS="$CONFIGDIR/all/sdl2_gamecontrollerdb.txt" # modesetting tools TVSERVICE="/opt/vc/bin/tvservice" KMSTOOL="$ROOTDIR/supplementary/kmsxx/kmsprint-rp" XRANDR="xrandr" source "$ROOTDIR/lib/inifuncs.sh" # disable the `patsub_replacement` shell option, it breaks the string substitution when replacement contains '&' if shopt -s patsub_replacement 2>/dev/null; then shopt -u patsub_replacement fi function get_config() { declare -Ag MODE_MAP MODE_MAP[1-CEA-4:3]="CEA-1" MODE_MAP[1-DMT-4:3]="DMT-4" MODE_MAP[1-CEA-16:9]="CEA-1" MODE_MAP[4-CEA-4:3]="DMT-16" MODE_MAP[4-DMT-4:3]="DMT-16" MODE_MAP[4-CEA-16:9]="CEA-4" if [[ -f "$RUNCOMMAND_CONF" ]]; then iniConfig " = " '"' "$RUNCOMMAND_CONF" iniGet "governor" GOVERNOR="$ini_value" iniGet "use_art" USE_ART="$ini_value" iniGet "disable_joystick" DISABLE_JOYSTICK="$ini_value" iniGet "disable_menu" DISABLE_MENU="$ini_value" iniGet "image_delay" IMAGE_DELAY="$ini_value" [[ -z "$IMAGE_DELAY" ]] && IMAGE_DELAY=2 iniGet "legacy_joy2key" LEGACY_JOY2KEY="$ini_value" [[ -z "$LEGACY_JOY2KEY" ]] && LEGACY_JOY2KEY=0 fi if [[ -n "$DISPLAY" ]] && $XRANDR &>/dev/null; then HAS_MODESET="x11" # copy kms tool output to global variable to avoid multiple invocations elif [[ -c /dev/dri/card0 ]] && KMS_BUFFER="$($KMSTOOL 2>/dev/null)"; then HAS_MODESET="kms" elif [[ -f "$TVSERVICE" ]]; then HAS_MODESET="tvs" fi } function start_joy2key() { # check if joystick support is enabled and joy2key is available [[ "$DISABLE_JOYSTICK" -eq 1 || ! -f "$JOY2KEY" ]] && return "$JOY2KEY" start 2>/dev/null && return 0 } function stop_joy2key() { # if joy2key is installed, stop it [[ -f "$JOY2KEY" ]] && "$JOY2KEY" stop } function get_params() { MODE_REQ="$1" COMMAND="$2" [[ -z "$MODE_REQ" || -z "$COMMAND" ]] && return 1 CONSOLE_OUT=0 # if the COMMAND is _SYS_, or _PORT_ arg 3 should be system name, and arg 4 rom/game, and we look up the configured system for that combination if [[ "$COMMAND" == "_SYS_" || "$COMMAND" == "_PORT_" ]]; then # if the rom is actually a special +Start System.sh script, we should launch the script directly. if [[ "$4" =~ \/\+Start\ (.+)\.sh$ ]]; then # extract emulator from the name (and lowercase it) EMULATOR=${BASH_REMATCH[1],,} IS_SYS=0 COMMAND="bash \"$4\"" SYSTEM="$3" [[ -z "$SYSTEM" ]] && return 1 else IS_SYS=1 SYSTEM="$3" ROM="$4" ROM_BN_EXT="${ROM##*/}" ROM_BN="${ROM_BN_EXT%.*}" if [[ "$COMMAND" == "_PORT_" ]]; then CONF_ROOT="$CONFIGDIR/ports/$SYSTEM" EMU_SYS_CONF="$CONF_ROOT/emulators.cfg" IS_PORT=1 else CONF_ROOT="$CONFIGDIR/$SYSTEM" EMU_SYS_CONF="$CONF_ROOT/emulators.cfg" IS_PORT=0 fi SYS_SAVE_ROM_OLD="a$(echo "$SYSTEM$ROM" | md5sum | cut -d" " -f1)" SYS_SAVE_ROM="$(clean_name "${SYSTEM}_${ROM_BN}")" [[ -z "$SYSTEM" ]] && return 1 get_sys_command fi else IS_SYS=0 CONSOLE_OUT=1 EMULATOR="$3" # if we have an emulator name (such as module_id) we use that for storing/loading parameters for video mode / backend # if the parameter is empty we use the name of the binary (to avoid breakage with out of date emulationstation configs) [[ -z "$EMULATOR" ]] && EMULATOR="${COMMAND/% */}" fi NETPLAY=0 return 0 } function clean_name() { local name="$1" name="${name//\//_}" name="${name//[^a-zA-Z0-9_\-]/}" echo "$name" } function set_save_vars() { # convert emulator name / binary to a names usable as variables in our config files SAVE_EMU="$(clean_name "$EMULATOR")" SAVE_ROM_OLD=r$(echo "$COMMAND" | md5sum | cut -d" " -f1) if [[ "$IS_SYS" -eq 1 ]]; then SAVE_ROM="${SAVE_EMU}_$(clean_name "$ROM_BN")" else SAVE_ROM="$SAVE_EMU" fi } function get_all_tvs_modes() { declare -Ag MODE local group for group in CEA DMT; do while read -r line; do local id="$(echo "$line" | grep -oE "mode [0-9]*" | cut -d" " -f2)" local info="$(echo "$line" | cut -d":" -f2-)" info=${info/ /} if [[ -n "$id" ]]; then MODE_ID+=($group-$id) MODE[$group-$id]="$info" fi done < <($TVSERVICE -m $group) done local aspect for group in "NTSC" "PAL"; do for aspect in "4:3" "16:10" "16:9"; do MODE_ID+=($group-$aspect) MODE[$group-$aspect]="SDTV - $group-$aspect" done done } function get_all_kms_modes() { declare -Ag MODE default_mode="$(echo "$KMS_BUFFER" | grep -Em1 "^Mode: [0-9]+ crtc")" crtc="$(echo "$default_mode" | cut -d' ' -f 4)" crtc_encoder="$(echo "$KMS_BUFFER" | grep "Encoder map:" | awk -v crtc="$crtc" '$5 == crtc { print $3 }')" # add default mode as fallback in case real mode cannot be mapped MODE[def-def]="$(echo "$default_mode" | cut -d' ' -f5-)" # parse only the video modes connected to the current active crtc while read -r mode_str mode_id con encoder_id info; do # we only need 2nd column (mode index) and the 5+ columns (resolution info) # populate resolution info into arrays (using mapped crtc encoder value) MODE_ID+=($crtc-$mode_id) MODE[$crtc-$mode_id]="$info" # if string matches default mode, add a special mapped entry [[ "$default_mode" =~ "$info" ]] && MODE[map-map]="$crtc $mode_id" done < <(echo "$KMS_BUFFER" | grep -E "^Mode: [0-9]+ connector $crtc_encoder") } function get_all_x11_modes() { declare -Ag MODE local id local line while read -r id; do # populate CONNECTOR:0xID into an array MODE_ID+=($id) # output:id as in (hdmi:0x44) read -r line # array is x/y resolution @ vertical refresh rate ( details ) MODE[$id]="$line" done < <( $XRANDR --verbose | awk ' # defines the type of line # true is the "header" (output and id) # false is the "description" (Mode: and everything that begins with a space) { type = /^[^ \t]+/ } # Exit after the first output type && output {exit} # New header and output set means new output # many outputs can be connected, but only the ones with the id are in use. # output must be connected and have an (id) type && / connected/ && /\(0x[0-9a-f]+\)/ { output=$1; next } # parse mode and lines # If we are in a "description", and output is set (output being what we want) # And if $2 is an id, we are in a video mode description line !type && output && $2 ~ /^\(0x[0-9a-f]+\)$/ { # Print CRTC identifier (CONNECTOR:0xID) print output ":" substr($2,2,length($2)-2) # id # get rid of what we printed $1="";$2="" sub(/^[ \t]+/,"") # trim spaces # save rest of the line info=$0 # Save width from the 2nd line of the video mode getline; width=$3 # Save height & vrefresh from the 3rd line of video mode getline; height=$3; vrefresh=$NF # Print video mode details print width "x" height " @ " vrefresh " (" info ")" } ') } function get_tvs_mode_info() { local status="$($TVSERVICE -s)" local temp local mode_info=() # get mode type / id if [[ "$status" =~ (PAL|NTSC) ]]; then temp=($(echo "$status" | grep -oE "(PAL|NTSC) (4:3|16:10|16:9)")) else temp=($(echo "$status" | grep -oE "(CEA|DMT) \([0-9]+\)")) fi mode_info[0]="${temp[0]}" mode_info[1]="${temp[1]//[()]/}" # get mode resolution temp=$(echo "$status" | cut -d"," -f2 | grep -oE "[0-9]+x[0-9]+") temp=(${temp/x/ }) mode_info[2]="${temp[0]}" mode_info[3]="${temp[1]}" # get aspect ratio temp=$(echo "$status" | grep -oE "([0-9]+:[0-9]+)") mode_info[4]="$temp" # get refresh rate temp=$(echo "$status" | grep -oE "[0-9\.]+Hz" | cut -d"." -f1) mode_info[5]="$temp" echo "${mode_info[@]}" } function get_kms_mode_info() { local mode_id=(${1/-/ }) local mode_info=() local status if [[ -z "${mode_id[*]}" ]]; then if [[ -n "${MODE[map-map]}" ]]; then # use mapped mode directly mode_id=(${MODE[map-map]}) else # use fallback mode mode_id=(def def) fi fi # split resolution (1st column) status=(${MODE[${mode_id[0]}-${mode_id[1]}]/x/ }) # get crtc id mode_info[0]="${mode_id[0]}" # get mode id mode_info[1]="${mode_id[1]}" # get mode resolution mode_info[2]="${status[0]}" # yres may have an ending 'i'(nterlace) flag mode_info[3]="${status[1]/i/}" # get aspect ratio (5th column) mode_info[4]="${status[5]}" # get refresh rate (4th column, remove surrounding brackets) mode_info[5]="${status[4]//[()]/}" echo "${mode_info[@]}" } function get_x11_mode_info() { local mode_id=(${1/:/ }) local mode_info=() local status if [[ -z "$mode_id" ]]; then # determine current output mode_id[0]="$($XRANDR --verbose | awk '/ connected.*\(0x[a-f0-9]{1,}\)/ { print $1;exit }')" # determine current mode id & strip brackets mode_id[1]="$($XRANDR --verbose | awk '/ connected.*\(0x[a-f0-9]{1,}\)/ {print;exit}' | grep -o "(0x[a-f0-9]\{1,\})")" mode_id[1]="$(echo ${mode_id[1]:1:-1})" fi # mode type corresponds to the currently connected output name mode_info[0]="${mode_id[0]}" # get mode id mode_info[1]="${mode_id[1]}" # get status line and split resolution status=(${MODE[${mode_id[0]}:${mode_id[1]}]/x/ }) # get resolution mode_info[2]="${status[0]}" mode_info[3]="${status[1]}" # aspect ratio cannot be determined for X11 mode_info[4]="n/a" # get refresh rate (stripping Hz, rounded to integer) mode_info[5]="$(LC_NUMERIC=C printf '%.0f\n' ${status[3]::-2})" echo "${mode_info[@]}" } function default_process() { local config="$1" local mode="$2" local key="$3" local value="$4" iniConfig " = " '"' "$config" case "$mode" in get) iniGet "$key" echo "$ini_value" ;; set) iniSet "$key" "$value" ;; del) iniDel "$key" ;; esac } function default_mode() { local mode="$1" local type="$2" local value="$3" local key case "$type" in vid_emu) key="$SAVE_EMU" ;; vid_rom_old) key="$SAVE_ROM_OLD" ;; vid_rom) key="$SAVE_ROM" ;; fb_emu) key="${SAVE_EMU}_fb" ;; fb_rom_old) key="${SAVE_ROM_OLD}_fb" ;; fb_rom) key="${SAVE_ROM}_fb" ;; render) key="${SAVE_EMU}_render" ;; esac default_process "$VIDEO_CONF" "$mode" "$key" "$value" } function default_emulator() { local mode="$1" local type="$2" local value="$3" local key local config="$EMU_SYS_CONF" case "$type" in emu_sys) key="default" ;; emu_cmd) key="$EMULATOR" ;; emu_rom_old) key="$SYS_SAVE_ROM_OLD" config="$EMU_CONF" ;; emu_rom) key="$SYS_SAVE_ROM" config="$EMU_CONF" ;; esac default_process "$config" "$mode" "$key" "$value" } function load_mode_defaults() { local separator="-" [[ "$HAS_MODESET" == "x11" ]] && separator=":" local temp MODE_ORIG=() if [[ -n "$HAS_MODESET" ]]; then # populate available modes [[ -z "$MODE_ID" ]] && get_all_${HAS_MODESET}_modes # get current mode / aspect ratio MODE_ORIG=($(get_${HAS_MODESET}_mode_info)) MODE_CUR=("${MODE_ORIG[@]}") MODE_ORIG_ID="${MODE_ORIG[0]}${separator}${MODE_ORIG[1]}" if [[ "$MODE_REQ" == "0" ]]; then MODE_REQ_ID="$MODE_ORIG_ID" elif [[ "$HAS_MODESET" == "tvs" ]]; then # get default mode for requested mode of 1 or 4 if [[ "$MODE_REQ" =~ (1|4) ]]; then # if current aspect is anything else like 5:4 / 10:9 just choose a 4:3 mode local aspect="${MODE_ORIG[4]}" [[ "$aspect" =~ (4:3|16:9) ]] || aspect="4:3" temp="${MODE_REQ}-${MODE_ORIG[0]}-$aspect" MODE_REQ_ID="${MODE_MAP[$temp]}" else MODE_REQ_ID="$MODE_REQ" fi else MODE_REQ_ID="$MODE_REQ" fi fi # get default fb_res (if not running on X) FB_ORIG=() if [[ -z "$DISPLAY" ]]; then local status=($(fbset | tr -s '\n')) FB_ORIG[0]="${status[3]}" FB_ORIG[1]="${status[4]}" FB_ORIG[2]="${status[7]}" fi # default retroarch render res to config file RENDER_RES="config" local mode if [[ -f "$VIDEO_CONF" ]]; then # load default video mode for emulator / rom mode="$(default_mode get vid_emu)" [[ -n "$mode" ]] && MODE_REQ_ID="$mode" # get default mode for system + rom combination # try the old key first and convert to the new key if found mode="$(default_mode get vid_rom_old)" if [[ -n "$mode" ]]; then default_mode del vid_rom_old default_mode set vid_rom "$mode" MODE_REQ_ID="$mode" else mode="$(default_mode get vid_rom)" [[ -n "$mode" ]] && MODE_REQ_ID="$mode" fi if [[ "$HAS_MODESET" == "tvs" ]]; then # load default framebuffer res for emulator / rom mode="$(default_mode get fb_emu)" [[ -n "$mode" ]] && FB_NEW="$mode" # get default fb mode for system + rom combination # try the old key first and convert to the new key if found mode="$(default_mode get fb_rom_old)" if [[ -n "$mode" ]]; then default_mode del fb_rom_old default_mode set fb_rom "$mode" FB_NEW="$mode" else mode="$(default_mode get fb_rom)" [[ -n "$mode" ]] && FB_NEW="$mode" fi fi # get default retroarch render resolution for emulator mode="$(default_mode get render)" [[ -n "$mode" ]] && RENDER_RES="$mode" fi } function main_menu() { local save local cmd local choice local default local user_menu=0 [[ -d "$CONFIGDIR/all/runcommand-menu" && -n "$(find "$CONFIGDIR/all/runcommand-menu" -maxdepth 1 -name "*.sh")" ]] && user_menu=1 [[ -z "$ROM_BN" ]] && ROM_BN="game/rom" [[ -z "$SYSTEM" ]] && SYSTEM="emulator/port" while true; do local options=() if [[ "$IS_SYS" -eq 1 ]]; then local emu_sys="$(default_emulator get emu_sys)" local emu_rom="$(default_emulator get emu_rom)" options+=( ES "Select default emulator for $SYSTEM ($emu_sys)" ER "Select emulator for ROM ($emu_rom)" ) fi if [[ -n "$HAS_MODESET" ]]; then local vid_emu="$(default_mode get vid_emu)" local vid_rom="$(default_mode get vid_rom)" options+=( VE "Select video mode for $EMULATOR ($vid_emu)" VR "Select video mode for $EMULATOR + ROM ($vid_rom)" ) fi if [[ "$EMULATOR" == lr-* ]]; then if [[ "$HAS_MODESET" == "tvs" ]]; then options+=(R "Select RetroArch render res for $EMULATOR ($RENDER_RES)") fi options+=(C "Edit custom RetroArch config for this ROM") elif [[ "$HAS_MODESET" == "tvs" ]]; then local fb_emu="$(default_mode get fb_emu)" local fb_rom="$(default_mode get fb_rom)" options+=( FE "Select framebuffer res for $EMULATOR ($fb_emu)" FR "Select framebuffer res for $EMULATOR + ROM ($fb_rom)" ) fi options+=(X "Launch") if [[ "$EMULATOR" == lr-* ]]; then options+=(L "Launch with verbose logging") options+=(Z "Launch with netplay enabled") fi if [[ "$user_menu" -eq 1 ]]; then options+=(U "User Menu") fi options+=(Q "Exit (without launching)") local temp_mode if [[ -n "$HAS_MODESET" ]]; then temp_mode="${MODE[$MODE_REQ_ID]}" else temp_mode="n/a" fi cmd=(dialog --nocancel --default-item "$default" --menu "System: $SYSTEM\nEmulator: $EMULATOR\nVideo Mode: $temp_mode\nROM: $ROM_BN" 22 76 16 ) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) default="$choice" case "$choice" in ES) choose_emulator "emu_sys" "$emu_sys" ;; ER) choose_emulator "emu_rom" "$emu_rom" ;; VE) choose_mode "vid_emu" "$vid_emu" ;; VR) choose_mode "vid_rom" "$vid_rom" ;; R) choose_render_res "render" "$RENDER_RES" ;; C) touch "$ROM.cfg" cmd=(dialog --editbox "$ROM.cfg" 22 76) choice=$("${cmd[@]}" 2>&1 >/dev/tty) [[ -n "$choice" ]] && echo "$choice" >"$ROM.cfg" [[ ! -s "$ROM.cfg" ]] && rm "$ROM.cfg" ;; FE) choose_mode "fb_emu" "$fb_emu" ;; FR) choose_mode "fb_rom" "$fb_rom" ;; Z) NETPLAY=1 break ;; X) return 0 ;; L) COMMAND+=" --verbose" VERBOSE=1 return 0 ;; U) user_menu local ret="$?" [[ "$ret" -eq 1 ]] && return 1 [[ "$ret" -eq 2 ]] && return 0 ;; Q) return 1 ;; esac done return 0 } function choose_mode() { local mode="$1" local default="$2" local key local options=() local mode_desc="" options=("X" "Clear / Remove") if [[ "$mode" == vid_* ]]; then mode_desc="video mode for " for key in "${MODE_ID[@]}"; do options+=("$key" "${MODE[$key]}") done elif [[ "$mode" == fb_* ]]; then mode_desc="framebuffer resolution for " for key in $(get_resolutions); do options+=("$key" "$key") done fi if [[ "$mode" == *_emu ]]; then mode_desc+="$EMULATOR" else mode_desc+="$EMULATOR + ROM ($ROM_BN)" fi local menu_title="Choose $mode_desc\nCurrently: " if [[ -z "$default" ]]; then menu_title+="(not set)" else menu_title+="$default" fi local cmd=(dialog --default-item "$default" --menu "$menu_title" 22 76 16 ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && return if [[ "$choice" == "X" ]]; then default_mode del "$mode" else default_mode set "$mode" "$choice" fi load_mode_defaults } function choose_emulator() { local mode="$1" local default="$2" local cancel="$3" local mode_desc="default emulator for " if [[ "$mode" == "emu_sys" ]]; then mode_desc+="$SYSTEM" else mode_desc+="ROM ($ROM_BN)" fi local default_id local options=() local i=1 while read line; do # convert key=value to array local line=(${line/=/ }) local id=${line[0]} [[ "$id" == "default" ]] && continue local apps[$i]="$id" if [[ "$id" == "$default" ]]; then default_id="$i" fi options+=($i "$id") ((i++)) done < <(sort "$EMU_SYS_CONF") if [[ "${#options[@]}" -eq 0 ]]; then dialog --msgbox "No emulator options found for $SYSTEM - Do you have a valid $EMU_SYS_CONF ?" 20 60 >/dev/tty stop_joy2key exit 1 fi [[ "$mode" != "emu_sys" ]] && options=("X" "Clear / Remove" "${options[@]}") local menu_title="Choose $mode_desc\nCurrently: " if [[ -z "$default" ]]; then menu_title+="(not set)" else menu_title+="$default" fi local cmd=(dialog $cancel --default-item "$default_id" --menu "$menu_title" 22 76 16 ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && return if [[ "$choice" == "X" ]]; then default_emulator del "$mode" else default_emulator set "$mode" "${apps[$choice]}" fi get_sys_command set_save_vars load_mode_defaults } function get_resolutions() { local res=( "320x224" "320x240" "400x240" "480x320" "640x480" "720x480" "720x576" "800x480" "800x600" "960x720" "1024x600" "1024x768" "1024x800" "1280x720" "1280x800" "1280x960" "1280x1024" "1360x768" "1366x768" "1920x1080" ) echo "${res[@]}" } function choose_render_res() { local mode="$1" local default="$2" local res=($(get_resolutions)) local i=1 local item local options=() for item in "${res[@]}"; do [[ "$item" == "$default" ]] && default="$i" options+=($i "$item") ((i++)) done options+=( O "Use video output resolution" C "Use config file resolution" ) [[ "$default" == "output" ]] && default="O" [[ "$default" == "config" ]] && default="C" local cmd=(dialog --default-item "$default" --menu "Choose RetroArch render resolution" 22 76 16 ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && return case "$choice" in O) choice="output" ;; C) choice="config" ;; *) choice="${res[$choice-1]}" ;; esac default_mode set "$mode" "$choice" load_mode_defaults } function user_menu() { local default local options=() local script local i=1 while read -r script; do script="${script##*/}" script="${script%.*}" options+=($i "$script") ((i++)) done < <(find "$CONFIGDIR/all/runcommand-menu" -type f -name "*.sh" | sort) local default local cmd local choice local ret while true; do cmd=(dialog --default-item "$default" --cancel-label "Back" --menu "Choose option" 22 76 16) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && return 0 default="$choice" script="runcommand-menu/${options[choice*2-1]}.sh" user_script "$script" ret="$?" [[ "$ret" -eq 1 || "$ret" -eq 2 ]] && return "$ret" done } function switch_fb_res() { local res=(${1/x/ }) local res_x="${res[0]}" local res_y="${res[1]}" local depth="$2" [[ -z "$depth" ]] && depth="${FB_ORIG[2]}" if [[ -z "$res_x" || -z "$res_y" ]]; then fbset --all -depth 8 fbset --all -depth $depth else fbset --all -depth 8 fbset --all --geometry $res_x $res_y $res_x $res_y $depth fi } function build_xinitrc() { local mode="$1" local xinitrc="/dev/shm/retropie_xinitrc" case "$mode" in clear) rm -rf "$xinitrc" ;; build) echo "#!/bin/bash" >"$xinitrc" # do modesetting (if supported) if [[ -n "$HAS_MODESET" ]]; then cat >>"$xinitrc" <<_EOF_ XRANDR_OUTPUT="\$($XRANDR --verbose | grep " connected" | awk '{ print \$1 }')" $XRANDR --output \$XRANDR_OUTPUT --mode ${MODE_CUR[2]}x${MODE_CUR[3]} --refresh ${MODE_CUR[5]} echo "Set mode ${MODE_CUR[2]}x${MODE_CUR[3]}@${MODE_CUR[5]}Hz on \$XRANDR_OUTPUT" _EOF_ fi if [[ "$XINIT_WM" -gt 0 ]]; then local params=() [[ "$XINIT_WM" -eq 1 ]] && params+=(-use_cursor no) [[ "$XINIT_WM" -eq 2 ]] && params+=(-use_cursor yes) cat >>"$xinitrc" <<_EOF_ matchbox-window-manager ${params[@]} & sleep 0.5 xset -dpms s off s noblank _EOF_ fi # echo command line for runcommand log cat >>"$xinitrc" <<_EOF_ echo -e "\nExecuting (via xinit): "${COMMAND//\$/\\\$}"\n" ${COMMAND//\$/\\\$} _EOF_ chmod +x "$xinitrc" # rewrite command to launch our xinit script (if not startx) if ! [[ "$COMMAND" =~ ^startx ]]; then COMMAND="xinit $xinitrc" fi # workaround for launching xserver on correct/user owned tty # see https://github.com/RetroPie/RetroPie-Setup/issues/1805 # if no TTY env var is set, try and get it - eg if launching a ports script or runcommand manually if [[ -z "$TTY" ]]; then TTY=$(tty) TTY=${TTY:8:1} fi # if we managed to get the current tty then try and use it if [[ -n "$TTY" ]]; then COMMAND="$COMMAND -- vt$TTY -keeptty" fi ;; esac } function mode_switch() { local command_prefix local separator="-" # X11 uses hypens in connector names [[ $HAS_MODESET == "x11" ]] && separator=":" local mode_id=(${1/${separator}/ }) # if the requested mode is the same as the current mode, don't switch [[ "${mode_id[*]}" == "${MODE_CUR[0]} ${MODE_CUR[1]}" ]] && return 1 if [[ "$HAS_MODESET" == "kms" ]]; then # update the target resolution even though the underlying fb hasn't changed MODE_CUR=($(get_${HAS_MODESET}_mode_info "${mode_id[*]}")) # check the mode tuple against the list of current available CRCTID/MODEID values if [[ -n ${MODE["${MODE_CUR[0]}-${MODE_CUR[1]}"]} ]]; then # inject the environment variables to do modesetting for SDL2 applications command_prefix="SDL_VIDEO_KMSDRM_CRTCID=${MODE_CUR[0]} SDL_VIDEO_KMSDRM_MODEID=${MODE_CUR[1]}" fi COMMAND="$(echo "$command_prefix $COMMAND" | sed -e "s/;/; $command_prefix /g")" return 0 elif [[ "$HAS_MODESET" == "x11" ]]; then # query the target resolution MODE_CUR=($(get_${HAS_MODESET}_mode_info "${mode_id[*]}")) # set target resolution $XRANDR --output "${MODE_CUR[0]}" --mode "${MODE_CUR[1]}" [[ "$?" -eq 0 ]] && return 0 elif [[ "$HAS_MODESET" == "tvs" ]]; then if [[ "${mode_id[0]}" == "PAL" ]] || [[ "${mode_id[0]}" == "NTSC" ]]; then $TVSERVICE -c "${mode_id[*]}" >/dev/null else $TVSERVICE -e "${mode_id[*]}" >/dev/null fi # if we have switched mode, switch the framebuffer resolution also if [[ "$?" -eq 0 ]]; then sleep 1 clear MODE_CUR=($(get_${HAS_MODESET}_mode_info)) [[ -z "$FB_NEW" ]] && FB_NEW="${MODE_CUR[2]}x${MODE_CUR[3]}" return 0 fi fi return 1 } function restore_fb() { sleep 1 switch_fb_res "${FB_ORIG[0]}x${FB_ORIG[1]}" "${FB_ORIG[2]}" } function config_backend() { # if we are running under X then don't try and use a different backend [[ -n "$DISPLAY" || "$XINIT" -eq 1 ]] && return local name="$1" # if we have a backends.conf file and with an entry for the current emulator name, # change the library path to load dispmanx sdl first if [[ -f "$BACKENDS_CONF" ]]; then iniConfig " = " '"' "$BACKENDS_CONF" iniGet "$name" case "$ini_value" in 1|dispmanx) if [[ "$HAS_MODESET" == "kms" ]]; then COMMAND="SDL_DISPMANX_WIDTH=${MODE_CUR[2]} SDL_DISPMANX_HEIGHT=${MODE_CUR[3]} $COMMAND" fi COMMAND="SDL1_VIDEODRIVER=dispmanx $COMMAND" ;; sdl12-compat) COMMAND="LD_PRELOAD=\"$ROOTDIR/supplementary/sdl12-compat/libSDL-1.2.so.0\" $COMMAND" ;; x11) XINIT=1 XINIT_WM=1 ;; x11-c) XINIT=1 XINIT_WM=2 ;; esac fi } function retroarch_append_config() { local conf="/dev/shm/retroarch.cfg" local dim # only for retroarch emulators [[ "$EMULATOR" != lr-* ]] && return # make sure tmp folder exists for unpacking archives mkdir -p "/tmp/retroarch" rm -f "$conf" touch "$conf" iniConfig " = " '"' "$conf" # strip any suffix decimals appearing in refresh rate, just for comparison if [[ -n "$HAS_MODESET" && "${MODE_CUR[5]%.*}" -gt 0 ]]; then # set video_refresh_rate in our config to the same as the screen refresh iniSet "video_refresh_rate" "${MODE_CUR[5]}" fi # populate with target resolution & fullscreen flag if KMS is active if [[ "$HAS_MODESET" != "tvs" ]]; then iniSet "video_fullscreen" "true" iniSet "video_fullscreen_x" "${MODE_CUR[2]}" iniSet "video_fullscreen_y" "${MODE_CUR[3]}" # if our render resolution is "config", then we don't set anything (use the value in the retroarch.cfg) elif [[ "$RENDER_RES" != "config" ]]; then if [[ "$RENDER_RES" == "output" ]]; then dim=(0 0) else dim=(${RENDER_RES/x/ }) fi iniSet "video_fullscreen_x" "${dim[0]}" iniSet "video_fullscreen_y" "${dim[1]}" fi # set `libretro_directory` to the core parent folder local core_dir=$(echo "$COMMAND" | grep -Eo "$ROOTDIR/libretrocores/.*libretro\.so" | head -n 1) core_dir=$(dirname "$core_dir") [[ -n "$core_dir" ]] && iniSet "libretro_directory" "$core_dir" # if verbose logging is on, set core logging to INFO [[ "$VERBOSE" -eq 1 ]] && iniSet "libretro_log_level" "1" # if the ROM has a custom configuration then append that too if [[ -f "$ROM.cfg" ]]; then conf+="'|'\"$ROM.cfg\"" fi # if we already have an existing appendconfig parameter, we need to add our configs to that if [[ "$COMMAND" =~ "--appendconfig" ]]; then COMMAND=$(echo "$COMMAND" | sed "s#\(--appendconfig *[^ $]*\)#\1'|'$conf#") else COMMAND+=" --appendconfig $conf" fi # append any NETPLAY configuration if [[ "$NETPLAY" -eq 1 ]] && [[ -f "$RETRONETPLAY_CONF" ]]; then source "$RETRONETPLAY_CONF" COMMAND+=" -$__netplaymode $__netplayhostip_cfile --port $__netplayport --nick $__netplaynickname" fi } function set_governor() { governor_old=() # we save the previous states first, as setting any cpuX on the RPI will also set the value for the other cores # which would cause us to save the wrong state for cpu1/2/3 after setting cpu0. On the RPI we could just process # cpu0, but this code needs to work on other platforms that do support a "per core" CPU governor. for cpu in /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_governor; do governor_old+=($(<$cpu)) done for cpu in /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_governor; do echo "$1" | sudo tee "$cpu" >/dev/null done } function restore_governor() { local i=0 for cpu in /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_governor; do echo "${governor_old[$i]}" | sudo tee "$cpu" >/dev/null ((i++)) done } function get_sys_command() { if [[ ! -f "$EMU_SYS_CONF" ]]; then echo "No config found for system $SYSTEM" stop_joy2key exit 1 fi # get system & rom specific emulator if set local emulator="$(default_emulator get emu_sys)" if [[ -z "$emulator" ]]; then echo "No default emulator found for system $SYSTEM" start_joy2key choose_emulator "emu_sys" "" "--nocancel" stop_joy2key get_sys_command "$SYSTEM" "$ROM" return fi EMULATOR="$emulator" # get default emulator for system + rom combination # try the old key first and convert to the new key if found emulator="$(default_emulator get emu_rom_old)" if [[ -n "$emulator" ]]; then default_emulator del emu_rom_old default_emulator set emu_rom "$emulator" EMULATOR="$emulator" else emulator="$(default_emulator get emu_rom)" [[ -n "$emulator" ]] && EMULATOR="$emulator" fi COMMAND="$(default_emulator get emu_cmd)" # replace tokens COMMAND="${COMMAND//\%ROM\%/\"$ROM\"}" COMMAND="${COMMAND//\%BASENAME\%/\"$ROM_BN\"}" # special case to get the last 2 folders for quake games for the -game parameter # remove everything up to /quake/ local quake_dir="${ROM##*/quake/}" # remove filename quake_dir="${quake_dir%/*}" COMMAND="${COMMAND//\%QUAKEDIR\%/\"$quake_dir\"}" # check if COMMAND starts with a launch OPTION: if [[ "$COMMAND" =~ ^([A-Z\-]+?):(.*)$ ]]; then # extract the command COMMAND="${BASH_REMATCH[2]}" case "${BASH_REMATCH[1]}" in # if it starts with CON: it is a console application (so we don't redirect stdout later) CON) CONSOLE_OUT=1 ;; # if it starts with XINIT it is an X11 application (so we need to launch via xinit) XINIT*) XINIT=1 ;;& # if it starts with XINIT-WM or XINIT-WMC (with cursor) it is an X11 application needing a window manager XINIT-WM) XINIT_WM=1 ;; XINIT-WMC) XINIT_WM=2 ;; esac fi } function show_launch() { local images=() if [[ "$IS_SYS" -eq 1 && "$USE_ART" -eq 1 ]]; then # if using art look for images in paths for es art. images+=( "$HOME/RetroPie/roms/$SYSTEM/images/${ROM_BN}-image" "$HOME/.emulationstation/downloaded_images/$SYSTEM/${ROM_BN}-image" "$HOME/.emulationstation/downloaded_media/$SYSTEM/screenshots/${ROM_BN}" "$HOME/RetroPie/roms/$SYSTEM/media/screenshots/${ROM_BN}" ) fi # look for custom launching images if [[ "$IS_SYS" -eq 1 ]]; then images+=( "$HOME/RetroPie/roms/$SYSTEM/images/${ROM_BN}-launching" "$CONF_ROOT/launching" ) fi [[ "$IS_PORT" -eq 1 ]] && images+=("$CONFIGDIR/ports/launching") images+=("$CONFIGDIR/all/launching") local image local path local ext for path in "${images[@]}"; do for ext in jpg png; do if [[ -f "$path.$ext" ]]; then image="$path.$ext" break 2 fi done done if [[ -n "$image" ]]; then # if we are running under X use feh otherwise try and use fbi if [[ -n "$DISPLAY" ]]; then feh -F -N -Z -Y -q "$image" & &>/dev/null IMG_PID=$! sleep "$IMAGE_DELAY" # if we're not using the old Joy2Key script, we need feh to stop after the delay # otherwise the menu will not be triggered due to terminal being out of focus [[ "$LEGACY_JOY2KEY" -eq 0 && "DISABLE_MENU" -ne 1 ]] && kill -SIGINT "$IMG_PID" else fbi -1 -t "$IMAGE_DELAY" -noverbose -a "$image" /dev/null fi elif [[ "$DISABLE_MENU" -ne 1 && "$USE_ART" -ne 1 ]]; then local launch_name if [[ -n "$ROM_BN" ]]; then launch_name="$ROM_BN ($EMULATOR)" else launch_name="$EMULATOR" fi DIALOGRC="$CONFIGDIR/all/runcommand-launch-dialog.cfg" dialog --infobox "\nLaunching $launch_name ...\n\nPress a button to configure\n\nErrors are logged to $LOG" 9 60 fi } function check_menu() { local dont_launch=0 # check for key pressed to enter configuration IFS= read -s -t 2 -N 1 key >"$LOG" fi } function restore_cursor_and_exit() { # if we are not being run from emulationstation (get parent of parent), turn the cursor back on. if [[ "$(ps -o comm= -p $(ps -o ppid= -p $PPID))" != "emulationstatio" ]]; then tput cnorm fi exit 0 } function launch_command() { local ret # escape $ to avoid variable expansion (eg roms containing $!) COMMAND="${COMMAND//\$/\\\$}" # launch the command echo -e "Parameters: $@\nExecuting: $COMMAND" >>"$LOG" if [[ "$CONSOLE_OUT" -eq 1 ]]; then # turn cursor on tput cnorm eval "$COMMAND" >"$LOG" ret=$? tput civis else eval "$COMMAND" >"$LOG" ret=$? fi return $ret } function log_info() { echo -e "$SYSTEM\n$EMULATOR\n$ROM\n$COMMAND" >/dev/shm/runcommand.info } function runcommand() { get_config if ! get_params "$@"; then echo "$0 MODE COMMAND [SAVENAME]" echo "$0 MODE _SYS_/_PORT_ SYSTEM ROM" exit 1 fi # turn off cursor and clear screen tput civis clear rm -f "$LOG" log_info user_script "runcommand-onstart.sh" set_save_vars load_mode_defaults start_joy2key show_launch if [[ "$DISABLE_MENU" -ne 1 ]]; then if ! check_menu; then stop_joy2key user_script "runcommand-onend.sh" clear restore_cursor_and_exit 0 fi fi stop_joy2key mode_switch "$MODE_REQ_ID" # replace X/Y resolution and refresh (useful for KMS/modesetting) COMMAND="${COMMAND//\%XRES\%/${MODE_CUR[2]}}" COMMAND="${COMMAND//\%YRES\%/${MODE_CUR[3]}}" COMMAND="${COMMAND//\%REFRESH\%/${MODE_CUR[5]}}" # resave info after menu and resolution replacements so runcommand.info is up to date log_info [[ -n "$FB_NEW" ]] && switch_fb_res $FB_NEW config_backend "$SAVE_EMU" # switch to configured cpu scaling governor [[ -n "$GOVERNOR" ]] && set_governor "$GOVERNOR" retroarch_append_config # build xinitrc and rewrite command if not already in X11 context if [[ "$XINIT" -eq 1 && "$HAS_MODESET" != "x11" ]]; then build_xinitrc build fi user_script "runcommand-onlaunch.sh" # include our SDL gamecontroller mappings in the environment # but check if the environment doesn't already have the SDL GameController mapping hint if [[ -z $SDL_GAMECONTROLLERCONFIG && -f "$SDL2_MAPPINGS" ]]; then export SDL_GAMECONTROLLERCONFIG="$(cat "$SDL2_MAPPINGS")" fi local ret clear launch_command ret=$? [[ -n "$IMG_PID" ]] && kill -SIGINT "$IMG_PID" clear # remove tmp folder for unpacked archives if it exists rm -rf "/tmp/retroarch" # restore default cpu scaling governor [[ -n "$GOVERNOR" ]] && restore_governor # if we switched mode - restore preferred mode mode_switch "$MODE_ORIG_ID" # delete temporary xinitrc launch script if [[ "$XINIT" -eq 1 && "$HAS_MODESET" != "x11" ]]; then build_xinitrc clear fi # reset/restore framebuffer res (if it was changed) [[ -n "$FB_NEW" ]] && restore_fb [[ "$EMULATOR" == lr-* ]] && retroarchIncludeToEnd "$CONF_ROOT/retroarch.cfg" user_script "runcommand-onend.sh" restore_cursor_and_exit "$ret" } runcommand "$@" ================================================ FILE: scriptmodules/supplementary/runcommand.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="runcommand" rp_module_desc="The 'runcommand' launch script - needed for launching the emulators from the frontend" rp_module_section="core" rp_module_flags="nonet" function _update_hook_runcommand() { # make sure runcommand is always updated when updating retropie-setup and # install joy2key module when updating if the old joy2key is in place if rp_isInstalled "$md_id"; then [[ -f "$md_inst/joy2key.py" ]] && rp_callModule "joy2key" install_bin_runcommand fi if hasFlag "armv6" && [[ "$__os_debian_ver" -le 12 ]]; then iniConfig " = " '"' "$configdir/all/runcommand.cfg" iniSet "legacy_joy2key" "1" fi } function depends_runcommand() { local depends=() isPlatform "rpi" && isPlatform "dispmanx" && depends+=(libraspberrypi-bin) isPlatform "rpi" || isPlatform "kms" && depends+=(fbi fbset) isPlatform "x11" && depends+=(feh) getDepends "${depends[@]}" } function install_bin_runcommand() { rm -rf "$md_inst" mkdir -p "$md_inst" cp "$md_data/runcommand.sh" "$md_inst/" if [[ ! -f "$configdir/all/runcommand.cfg" ]]; then mkUserDir "$configdir/all" iniConfig " = " '"' "$configdir/all/runcommand.cfg" iniSet "use_art" "0" iniSet "disable_joystick" "0" iniSet "governor" "" iniSet "disable_menu" "0" iniSet "image_delay" "2" # weaker systems should use the old Joy2Key version hasFlag "armv6" && iniSet "legacy_joy2key" "1" chown "$__user":"$__group" "$configdir/all/runcommand.cfg" fi if [[ ! -f "$configdir/all/runcommand-launch-dialog.cfg" ]]; then dialog --create-rc "$configdir/all/runcommand-launch-dialog.cfg" chown "$__user":"$__group" "$configdir/all/runcommand-launch-dialog.cfg" fi # needed for KMS modesetting (debian buster or later only) if [[ "$__os_debian_ver" -ge 10 ]]; then rp_installModule "kmsxx" "_autoupdate_" fi md_ret_require="$md_inst/runcommand.sh" } function remove_runcommand() { rp_callModule "mesa-drm" "remove" } function governor_runcommand() { local config="$configdir/all/runcommand.cfg" iniConfig " = " '"' "$config" iniGet "governor" local current="$ini_value" local default=1 local status="Default (don't change)" [[ -n "$current" ]] && status="$current" local governors local governor local options=("1" "Default (don't change)") local i=2 if [[ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors ]]; then for governor in $(&1 >/dev/tty) if [[ -n "$choice" ]]; then governor="${governors[$choice]}" iniSet "governor" "$governor" chown "$__user":"$__group" "$config" fi } function gui_runcommand() { local config="$configdir/all/runcommand.cfg" iniConfig " = " '"' "$config" chown "$__user":"$__group" "$config" local cmd local option local default while true; do eval "$(loadModuleConfig \ 'disable_menu=0' \ 'use_art=0' \ 'disable_joystick=0' \ 'image_delay=2' \ 'governor=' \ 'legacy_joy2key=' \ )" [[ -z "$governor" ]] && governor="Default: don't change" [[ -z "$legacy_joy2key" ]] && legacy_joy2key="0" cmd=(dialog --backtitle "$__backtitle" --cancel-label "Exit" --default-item "$default" --menu "Choose an option." 22 86 16) options=() if [[ "$disable_menu" -eq 0 ]]; then options+=(1 "Launch menu (currently: Enabled)") else options+=(1 "Launch menu (currently: Disabled)") fi if [[ "$use_art" -eq 1 ]]; then options+=(2 "Launch menu art (currently: Enabled)") else options+=(2 "Launch menu art (currently: Disabled)") fi if [[ "$disable_joystick" -eq 0 ]]; then options+=(3 "Launch menu joystick control (currently: Enabled)") else options+=(3 "Launch menu joystick control (currently: Disabled)") fi options+=(4 "Launch image delay in seconds (currently $image_delay)") options+=(5 "CPU governor configuration (currently: $governor)") if [[ "$legacy_joy2key" -eq 1 ]]; then options+=(6 "Use old Joy2Key for joystick control (currently: Enabled)") else options+=(6 "Use old Joy2Key for joystick control (currently: Disabled)") fi local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && break default="$choice" case "$choice" in 1) iniSet "disable_menu" "$((disable_menu ^ 1))" ;; 2) iniSet "use_art" "$((use_art ^ 1))" ;; 3) iniSet "disable_joystick" "$((disable_joystick ^ 1))" ;; 4) cmd=(dialog --backtitle "$__backtitle" --inputbox "Please enter the delay in seconds" 10 60 "$image_delay") choice=$("${cmd[@]}" 2>&1 >/dev/tty) iniSet "image_delay" "$choice" ;; 5) governor_runcommand ;; 6) iniSet "legacy_joy2key" "$((legacy_joy2key ^ 1))" ;; esac done } ================================================ FILE: scriptmodules/supplementary/samba.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="samba" rp_module_desc="Configure Samba ROM Shares" rp_module_section="config" function depends_samba() { DEBIAN_FRONTEND=noninteractive getDepends samba } function remove_share_samba() { local name="$1" [[ -z "$name" || ! -f /etc/samba/smb.conf ]] && return sed -i "/^\[$name\]/,/^force user/d" /etc/samba/smb.conf } function add_share_samba() { local name="$1" local path="$2" [[ -z "name" || -z "$path" ]] && return remove_share_samba "$name" cat >>/etc/samba/smb.conf <<_EOF_ [$1] comment = $name path = "$path" writeable = yes guest ok = yes create mask = 0644 directory mask = 0755 force user = $__user _EOF_ } function restart_samba() { systemctl -q is-active smbd.service && systemctl -q reload-or-restart smbd.service } function install_shares_samba() { cp /etc/samba/smb.conf /etc/samba/smb.conf.bak add_share_samba "roms" "$romdir" add_share_samba "bios" "$home/RetroPie/BIOS" add_share_samba "configs" "$configdir" add_share_samba "splashscreens" "$datadir/splashscreens" # Add `wsdd` so that RetroPie is easily discovered by Windows clients # Only available on Debian 12/Ubuntu 22.04 and later if apt-cache -qq madison wsdd; then aptInstall wsdd fi restart_samba } function remove_shares_samba() { local name for name in roms bios configs splashscreens; do remove_share_samba "$name" done restart_samba } function gui_samba() { while true; do local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option" 22 76 16) local options=( 1 "Install RetroPie Samba shares" 2 "Remove RetroPie Samba shares" 3 "Manually edit /etc/samba/smb.conf" 4 "Restart Samba service" 5 "Remove Samba + configuration" ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) rp_callModule "$md_id" depends rp_callModule "$md_id" install_shares printMsgs "dialog" "Installed and enabled shares" ;; 2) rp_callModule "$md_id" remove_shares printMsgs "dialog" "Removed shares" ;; 3) editFile /etc/samba/smb.conf ;; 4) rp_callModule "$md_id" restart ;; 5) rp_callModule "$md_id" depends remove printMsgs "dialog" "Removed Samba service" ;; esac else break fi done } ================================================ FILE: scriptmodules/supplementary/scraper.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="scraper" rp_module_desc="Scraper for EmulationStation by Steven Selph" rp_module_licence="MIT https://raw.githubusercontent.com/sselph/scraper/master/LICENSE" rp_module_repo="git https://github.com/sselph/scraper.git master" rp_module_section="opt" rp_module_flags="nobin" function depends_scraper() { rp_callModule golang install_bin } function sources_scraper() { gitPullOrClone } function build_scraper() { local goroot="$(_get_goroot_golang)" GOROOT="$goroot" "$goroot/bin/go" mod init github.com/sselph/scraper GOROOT="$goroot" "$goroot/bin/go" get github.com/J-Swift/thegamesdb-swagger-client-go@43ed8a0b364ed2d8521d0 GOROOT="$goroot" "$goroot/bin/go" build -o scraper } function install_scraper() { md_ret_files=( 'scraper' 'LICENSE' 'README.md' 'hash.csv' ) } function remove_scraper() { rp_callModule golang remove } function get_ver_scraper() { [[ -f "$md_inst/scraper" ]] && "$md_inst/scraper" -version 2>/dev/null } function latest_ver_scraper() { download https://api.github.com/repos/sselph/scraper/releases/latest - | grep -m 1 tag_name | cut -d\" -f4 } function list_systems_scraper() { find -L "$romdir" -mindepth 1 -maxdepth 1 -not -empty -type d | sort } function scrape_scraper() { local system="$1" [[ -z "$system" ]] && return iniConfig " = " '"' "$configdir/all/scraper.cfg" eval $(_load_config_scraper) local gamelist local img_dir local img_path if [[ "$use_rom_folder" -eq 1 ]]; then gamelist="$romdir/$system/gamelist.xml" img_dir="$romdir/$system/images" img_path="./images" else gamelist="$home/.emulationstation/gamelists/$system/gamelist.xml" img_dir="$home/.emulationstation/downloaded_images/$system" img_path="~/.emulationstation/downloaded_images/$system" fi local params=() params+=(-image_dir "$img_dir") params+=(-image_path "$img_path") params+=(-video_dir "$img_dir") params+=(-video_path "$img_path") params+=(-marquee_dir "$img_dir") params+=(-marquee_path "$img_path") params+=(-output_file "$gamelist") params+=(-rom_dir "$romdir/$system") params+=(-workers "4") params+=(-skip_check) [[ "$system" =~ ^mame-|arcade|fba|neogeo ]] && params+=(-mame) if [[ "$use_thumbs" -eq 1 ]]; then params+=(-thumb_only) fi if [[ "$screenshots" -eq 1 ]]; then if [[ "$system" =~ ^mame-|arcade|fba|neogeo ]]; then params+=(-mame_img "s,m,t") else params+=(-console_img "s,b,3b,l,f") fi fi if [[ "$download_videos" -eq 1 ]]; then params+=(-download_videos) fi if [[ "$download_marquees" -eq 1 ]]; then params+=(-download_marquees) fi if [[ -n "$max_width" ]]; then params+=(-max_width "$max_width") fi if [[ -n "$max_height" ]]; then params+=(-max_height "$max_height") fi if [[ "$console_src" -eq 0 ]]; then params+=(-console_src="ovgdb") elif [[ "$console_src" -eq 1 ]]; then params+=(-console_src="gdb") else params+=(-console_src="ss") fi if [[ "$mame_src" -eq 0 ]]; then params+=(-mame_src="mamedb") elif [[ "$mame_src" -eq 1 ]]; then params+=(-mame_src="ss") else params+=(-mame_src="adb") fi if [[ "$rom_name" -eq 1 ]]; then params+=(-use_nointro_name=false) elif [[ "$rom_name" -eq 2 ]]; then params+=(-use_filename=true) fi if [[ "$append_only" -eq 1 ]]; then params+=(-append) fi # trap ctrl+c and return if pressed (rather than exiting retropie-setup etc) trap 'trap 2; return 1' INT sudo -u "$__user" "$md_inst/scraper" ${params[@]} trap 2 } function scrape_all_scraper() { local system while read system; do system=${system/$romdir\//} scrape_scraper "$system" "$@" || return 1 done < <(list_systems_scraper) } function scrape_chosen_scraper() { local options=() local system local i=1 while read system; do system=${system/$romdir\//} options+=($i "$system" OFF) ((i++)) done < <(list_systems_scraper) if [[ ${#options[@]} -eq 0 ]] ; then printMsgs "dialog" "No populated rom folders were found in $romdir." return fi local cmd=(dialog --backtitle "$__backtitle" --checklist "Select ROM Folders" 22 76 16) local choice=($("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)) [[ ${#choice[@]} -eq 0 ]] && return local choice for choice in "${choice[@]}"; do choice=${options[choice*3-2]} scrape_scraper "$choice" "$@" done } function _load_config_scraper() { echo "$(loadModuleConfig \ 'use_thumbs=1' \ 'screenshots=0' \ 'max_width=400' \ 'max_height=400' \ 'console_src=1' \ 'mame_src=2' \ 'rom_name=0' \ 'append_only=0' \ 'use_rom_folder=0' \ 'download_videos=0' \ 'download_marquees=0' \ )" } function gui_scraper() { if pgrep "emulationstatio" >/dev/null; then printMsgs "dialog" "This scraper must not be run while Emulation Station is running or the scraped data will be overwritten. \n\nPlease quit from Emulation Station, and run RetroPie-Setup from the terminal" return fi iniConfig " = " '"' "$configdir/all/scraper.cfg" eval $(_load_config_scraper) chown "$__user":"$__group" "$configdir/all/scraper.cfg" local default while true; do local ver=$(get_ver_scraper) [[ -z "$ver" ]] && ver="v(Git)" local cmd=(dialog --backtitle "$__backtitle" --default-item "$default" --menu "Scraper $ver by Steven Selph" 22 76 16) local options=( 1 "Scrape all systems" 2 "Scrape chosen systems" ) if [[ "$use_thumbs" -eq 1 ]]; then options+=(3 "Thumbnails only (Enabled)") else options+=(3 "Thumbnails only (Disabled)") fi if [[ "$screenshots" -eq 1 ]]; then options+=(4 "Prefer screenshots (Enabled)") else options+=(4 "Prefer screenshots (Disabled)") fi if [[ "$mame_src" -eq 0 ]]; then options+=(5 "Arcade Source (MameDB)") elif [[ "$mame_src" -eq 1 ]]; then options+=(5 "Arcade Source (ScreenScraper)") else options+=(5 "Arcade Source (ArcadeItalia)") fi if [[ "$console_src" -eq 0 ]]; then options+=(6 "Console Source (OpenVGDB)") elif [[ "$console_src" -eq 1 ]]; then options+=(6 "Console Source (thegamesdb)") else options+=(6 "Console Source (ScreenScraper)") fi if [[ "$rom_name" -eq 0 ]]; then options+=(7 "ROM Names (No-Intro)") elif [[ "$rom_name" -eq 1 ]]; then options+=(7 "ROM Names (theGamesDB)") else options+=(7 "ROM Names (Filename)") fi if [[ "$append_only" -eq 1 ]]; then options+=(8 "Gamelist (Append)") else options+=(8 "Gamelist (Overwrite)") fi if [[ "$use_rom_folder" -eq 1 ]]; then options+=(9 "Use rom folder for gamelist & images (Enabled)") else options+=(9 "Use rom folder for gamelist & images (Disabled)") fi if [[ "$download_videos" -eq 1 ]]; then options+=(V "Download Videos (Enabled)") else options+=(V "Download Videos (Disabled)") fi if [[ "$download_marquees" -eq 1 ]]; then options+=(M "Download Marquees (Enabled)") else options+=(M "Download Marquees (Disabled)") fi options+=(W "Max image width ($max_width)") options+=(H "Max image height ($max_height)") local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then default="$choice" case "$choice" in 1) if scrape_all_scraper; then printMsgs "dialog" "ROMS have been scraped." else printMsgs "dialog" "Scraping was aborted" fi ;; 2) if scrape_chosen_scraper; then printMsgs "dialog" "ROMS have been scraped." else printMsgs "dialog" "Scraping was aborted" fi ;; 3) use_thumbs="$((use_thumbs ^ 1))" iniSet "use_thumbs" "$use_thumbs" ;; 4) screenshots="$((screenshots ^ 1))" iniSet "screenshots" "$screenshots" ;; 5) mame_src="$((( mame_src + 1) % 3))" iniSet "mame_src" "$mame_src" ;; 6) console_src="$((( console_src + 1) % 3))" iniSet "console_src" "$console_src" ;; 7) rom_name="$((( rom_name + 1 ) % 3))" iniSet "rom_name" "$rom_name" ;; 8) append_only="$((append_only ^ 1))" iniSet "append_only" "$append_only" ;; 9) use_rom_folder="$((use_rom_folder ^ 1))" iniSet "use_rom_folder" "$use_rom_folder" ;; V) download_videos="$((download_videos ^ 1))" iniSet "download_videos" "$download_videos" ;; M) download_marquees="$((download_marquees ^ 1))" iniSet "download_marquees" "$download_marquees" ;; H) cmd=(dialog --backtitle "$__backtitle" --inputbox "Please enter the max image height in pixels" 10 60 "$max_height") max_height=$("${cmd[@]}" 2>&1 >/dev/tty) iniSet "max_height" "$max_height" ;; W) cmd=(dialog --backtitle "$__backtitle" --inputbox "Please enter the max image width in pixels" 10 60 "$max_width") max_width=$("${cmd[@]}" 2>&1 >/dev/tty) iniSet "max_width" "$max_width" ;; esac else break fi done } ================================================ FILE: scriptmodules/supplementary/sdl1.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="sdl1" rp_module_desc="SDL 1.2.15 with rpi fixes and dispmanx" rp_module_licence="GPL2 https://raw.githubusercontent.com/libsdl-org/SDL-1.2/main/COPYING" rp_module_section="depends" rp_module_flags="!all dispmanx" function get_pkg_ver_sdl1() { local basever local revision if [[ "$__os_debian_ver" -eq 9 ]]; then basever="1.2.15+dfsg1" revision="4" elif [[ "$__os_debian_ver" -ge 10 ]]; then basever="1.2.15+dfsg2" revision="6" else basever="1.2.15" revision="10" fi if [[ "$1" == "source" ]]; then echo "$basever-$revision" elif [[ "$1" == "base" ]]; then echo "$basever" else echo "$basever-$(($revision + 3))rpi" fi } function _get_arch_sdl1() { isPlatform "arm" && echo "armhf" isPlatform "aarch64" && echo "arm64" } function depends_sdl1() { getDepends debhelper dh-autoreconf devscripts libx11-dev libxext-dev libxt-dev libxv-dev x11proto-core-dev libaudiofile-dev libpulse-dev libgl1-mesa-dev libasound2-dev libcaca-dev libdirectfb-dev libglu1-mesa-dev libraspberrypi-dev } function sources_sdl1() { local files=() if [[ "$__os_debian_ver" -eq 9 ]]; then files+=(libsdl1.2_$(get_pkg_ver_sdl1 base).orig.tar.xz) else files+=(libsdl1.2_$(get_pkg_ver_sdl1 base).orig.tar.gz) fi files+=( libsdl1.2_$(get_pkg_ver_sdl1 source).dsc libsdl1.2_$(get_pkg_ver_sdl1 source).debian.tar.xz ) local file for file in "${files[@]}"; do download "http://mirrordirector.raspbian.org/raspbian/pool/main/libs/libsdl1.2/$file" "$file" done dpkg-source -x libsdl1.2_$(get_pkg_ver_sdl1 source).dsc cd libsdl1.2-$(get_pkg_ver_sdl1 base) # add fixes from https://github.com/RetroPie/sdl1/compare/master...rpi download "https://github.com/RetroPie/sdl1/compare/master...rpi.diff" "debian/patches/rpi.diff" echo "rpi.diff" >>debian/patches/series # force building without tslib on Jessie (as Raspbian Jessie has tslib, but Debian Jessie doesn't and we want cross compatibility sed -i "s/--enable-video-caca/--enable-video-caca --disable-input-tslib/" debian/rules DEBEMAIL="Jools Wills " dch -v $(get_pkg_ver_sdl1) "Added rpi fixes and dispmanx support from https://github.com/RetroPie/sdl1/compare/master...rpi" } function build_sdl1() { cd libsdl1.2-$(get_pkg_ver_sdl1 base) dpkg-buildpackage local dest="$__tmpdir/archives/$__binary_path" mkdir -p "$dest" local file for file in ../*.deb; do if gpg --list-secret-keys "$__gpg_signing_key" &>/dev/null; then signFile "$file" || return 1 cp "${file}.asc" "$dest/" fi cp ../*.deb "$dest/" done } function install_sdl1() { local arch="$(_get_arch_sdl1)" # if the packages don't install completely due to missing dependencies the apt-get -y -f install will correct it if ! dpkg -i libsdl1.2debian_$(get_pkg_ver_sdl1)_${arch}.deb libsdl1.2-dev_$(get_pkg_ver_sdl1)_${arch}.deb; then apt-get -y -f --no-install-recommends install fi echo "libsdl1.2-dev hold" | dpkg --set-selections } function __binary_url_sdl1() { rp_hasBinaries && echo "$__binary_url/libsdl1.2debian_$(get_pkg_ver_sdl1)_$(_get_arch_sdl1).deb" } function install_bin_sdl1() { local arch="$(_get_arch_sdl1)" local tmp="$(mktemp -d)" pushd "$tmp" >/dev/null local ret=1 if downloadAndVerify "$__binary_url/libsdl1.2debian_$(get_pkg_ver_sdl1)_${arch}.deb" && \ downloadAndVerify "$__binary_url/libsdl1.2-dev_$(get_pkg_ver_sdl1)_${arch}.deb"; then install_sdl1 ret=0 fi popd >/dev/null rm -rf "$tmp" return "$ret" } function remove_sdl1() { apt-get remove -y --allow-change-held-packages libsdl1.2-dev libsdl1.2debian apt-get autoremove -y } ================================================ FILE: scriptmodules/supplementary/sdl12-compat.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="sdl12-compat" rp_module_desc="SDL1.2 compatibility layer that uses SDL2 under the hood" rp_module_help="Provides a binary and source compatible API for programs written against SDL 1.2, but it uses SDL 2.0 behind the scenes" rp_module_licence="ZLIB https://raw.githubusercontent.com/libsdl-org/sdl12-compat/main/LICENSE.txt" rp_module_repo="git https://github.com/libsdl-org/sdl12-compat :_version_sdl12-compat" rp_module_section="depends" rp_module_flags="!x11" function _version_sdl12-compat() { local ver="1.2.68" if [[ "$1" == "short" ]]; then echo $ver else echo "release-$ver" fi } function depend_sdl12-compat() { getDepends libsdl2-dev cmake } function sources_sdl12-compat() { gitPullOrClone } function build_sdl12-compat() { cmake -DSDL12TESTS=OFF -DSDL12DEVEL=OFF . make md_ret_require="$md_build/libSDL-1.2.so.$(_version_sdl12-compat short)" } function install_sdl12-compat() { md_ret_files=( libSDL-1.2.so."$(_version_sdl12-compat short)" README.md LICENSE.txt ) } function configure_sdl12-compat() { ldconfig -nN "$md_inst" } ================================================ FILE: scriptmodules/supplementary/sdl2.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="sdl2" rp_module_desc="SDL (Simple DirectMedia Layer) v2.x" rp_module_licence="ZLIB https://raw.githubusercontent.com/libsdl-org/SDL/main/LICENSE.txt" rp_module_section="depends" rp_module_flags="" function get_ver_sdl2() { if [[ "$__os_debian_ver" -ge 11 ]]; then echo "2.32.10" else echo "2.0.10" fi } function get_pkg_ver_sdl2() { local ver="$(get_ver_sdl2)" if [[ "$__os_debian_ver" -ge 11 ]]; then ver+="+1" else ver+="+5" fi isPlatform "rpi" && ver+="rpi" isPlatform "mali" && ver+="mali" echo "$ver" } function get_arch_sdl2() { echo "$(dpkg --print-architecture)" } function _list_depends_sdl2() { # Dependencies from the debian package control + additional dependencies for the pi (some are excluded like dpkg-dev as they are # already covered by the build-essential package retropie relies on. local depends=(libasound2-dev libudev-dev libibus-1.0-dev libdbus-1-dev fcitx-libs-dev libsndio-dev libsamplerate0-dev) # these were removed by a PR for vero4k support (cannot test). Needed though at least for for RPI and X11 ! isPlatform "vero4k" && depends+=(libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxkbcommon-dev libxrandr-dev libxss-dev libxt-dev libxv-dev libxxf86vm-dev libgl1-mesa-dev) isPlatform "gles" || isPlatform "gl" && depends+=(libegl1-mesa-dev libgles2-mesa-dev) isPlatform "gl" || isPlatform "rpi" && depends+=(libgl1-mesa-dev libglu1-mesa-dev) isPlatform "kms" || isPlatform "rpi" && depends+=(libdrm-dev libgbm-dev) isPlatform "x11" && depends+=(libpulse-dev libwayland-dev) echo "${depends[@]}" } function depends_sdl2() { # install additional packages that are needed, but may be unsuitable as debian package dependencies due to distribution oddities local depends=(devscripts debhelper dh-autoreconf) isPlatform "mali" && depends+=(mali-fbdev) isPlatform "dispmanx" && depends+=(libraspberrypi-dev) isPlatform "vero4k" && depends+=(vero3-userland-dev-osmc) getDepends $(_list_depends_sdl2) "${depends[@]}" } function sources_sdl2() { local ver="$(get_ver_sdl2)" local pkg_ver="$(get_pkg_ver_sdl2)" local branch="retropie-${ver}" gitPullOrClone "$md_build/$pkg_ver" https://github.com/RetroPie/SDL.git "$branch" cd "$pkg_ver" DEBEMAIL="Jools Wills " dch -v "$pkg_ver" "SDL $ver configured for the $__platform" } function build_sdl2() { local conf_flags=() local conf_depends=( $(_list_depends_sdl2) ) cd "$(get_pkg_ver_sdl2)" if isPlatform "vero4k"; then # remove harmful (mesa) and un-needed (X11) dependencies from debian package control sed -i '/^\s*lib.*x\|mesa/ d' ./debian/control # disable vulkan and X11 video support conf_flags+=("--disable-video-x11") fi isPlatform "vulkan" && conf_flags+=("--enable-video-vulkan") || conf_flags+=("--disable-video-vulkan") isPlatform "mali" && conf_flags+=("--enable-video-mali" "--disable-video-opengl") isPlatform "dispmanx" && conf_flags+=("--enable-video-rpi") || conf_flags+=("--disable-video-rpi") isPlatform "kms" || isPlatform "rpi" && conf_flags+=("--enable-video-kmsdrm") # format debian package dependencies into comma-separated list conf_depends=( "${conf_depends[@]/%/,}" ) sed -i 's/libgl1-mesa-dev,/libgl1-mesa-dev, '"${conf_depends[*]}"'/' ./debian/control sed -i 's/confflags =/confflags = '"${conf_flags[*]}"' \\\n/' ./debian/rules if isPlatform "rpi" && [[ -d "/opt/vc/include" ]]; then # move proprietary videocore headers sed -i -e 's/\"EGL/\"brcmEGL/g' -e 's/\"GLES/\"brcmGLES/g' ./src/video/raspberry/SDL_rpivideo.h sed -i -e 's#/dev/null; then signFile "$file" || return 1 cp "${file}.asc" "$dest/" fi cp ../*.deb "$dest/" done } function remove_old_sdl2() { # remove our old libsdl2 packages hasPackage libsdl2 && dpkg --remove libsdl2 libsdl2-dev } function install_sdl2() { remove_old_sdl2 # if the packages don't install completely due to missing dependencies the apt-get -y -f install will correct it if ! dpkg -i libsdl2-2.0-0_$(get_pkg_ver_sdl2)_$(get_arch_sdl2).deb libsdl2-dev_$(get_pkg_ver_sdl2)_$(get_arch_sdl2).deb; then apt-get -y -f --no-install-recommends install fi echo "libsdl2-dev hold" | dpkg --set-selections } function __binary_url_sdl2() { rp_hasBinaries && echo "$__binary_url/libsdl2-dev_$(get_pkg_ver_sdl2)_$(get_arch_sdl2).deb" } function install_bin_sdl2() { local tmp="$(mktemp -d)" pushd "$tmp" >/dev/null local ret=1 if downloadAndVerify "$__binary_url/libsdl2-dev_$(get_pkg_ver_sdl2)_$(get_arch_sdl2).deb" && \ downloadAndVerify "$__binary_url/libsdl2-2.0-0_$(get_pkg_ver_sdl2)_$(get_arch_sdl2).deb"; then install_sdl2 ret=0 fi popd >/dev/null rm -rf "$tmp" return "$ret" } function revert_sdl2() { aptUpdate local packaged="$(apt-cache madison libsdl2-dev | cut -d" " -f3 | head -n1)" if ! aptInstall --allow-downgrades --allow-change-held-packages libsdl2-2.0-0="$packaged" libsdl2-dev="$packaged"; then md_ret_errors+=("Failed to revert to OS packaged sdl2 versions") fi } function remove_sdl2() { apt-get remove -y --allow-change-held-packages libsdl2-dev libsdl2-2.0-0 apt-get autoremove -y } ================================================ FILE: scriptmodules/supplementary/sixaxis.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="sixaxis" rp_module_desc="Helper service for official and third-party DualShock controllers (ps3controller replacement)" rp_module_help="For Shanwan/GASIA third-party controllers, enable third-party support in the configuration options.\n\nTo pair controllers, use the RetroPie Bluetooth menu, choose 'Register and Connect...', then follow the on-screen instructions." rp_module_licence="GPL2 https://raw.githubusercontent.com/RetroPie/sixaxis/master/COPYING" rp_module_repo="git https://github.com/RetroPie/sixaxis.git master" rp_module_section="driver" function depends_sixaxis() { getDepends checkinstall libevdev-tools # add special check for presence of sixaxis plugin, and restart bluetooth stack if necessary if ! hasPackage "libbluetooth3"; then getDepends libbluetooth3 service bluetooth restart fi rp_callModule ps3controller remove } function sources_sixaxis() { gitPullOrClone } function build_sixaxis() { make clean make md_ret_require="$md_build/bins/sixaxis-timeout" } function gui_sixaxis() { local sixaxis_config="$md_conf_root/all/sixaxis_timeout.cfg" local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option." 22 86 16) local options=( 1 "Enable support for third-party controllers" 2 "Disable support for third-party controllers" 3 "Configure controller timeout" ) local timeout_options=( 0 "No timeout" 300 "5 minutes" 600 "10 minutes" 900 "15 minutes" 1200 "20 minutes" 1800 "30 minutes" ) while true; do local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) rp_callModule "customhidsony" ;; 2) rp_callModule "customhidsony" remove ;; 3) local timeout_choice=$("${cmd[@]}" "${timeout_options[@]}" 2>&1 >/dev/tty) if [[ -n "$timeout_choice" ]] && [[ -f "$sixaxis_config" ]]; then case "$timeout_choice" in *) iniConfig "=" "" "$sixaxis_config" iniSet "SIXAXIS_TIMEOUT" "$timeout_choice" systemctl restart sixaxis@/* &>/dev/null ;; esac fi ;; esac else break fi done } function install_sixaxis() { checkinstall -y --fstrans=no } function configure_sixaxis() { [[ "$md_mode" == "remove" ]] && return local sixaxis_config="$(mktemp)" echo "# Set your preferred controller timeout in seconds (0 to disable)" >"$sixaxis_config" iniConfig "=" "" "$sixaxis_config" iniSet "SIXAXIS_TIMEOUT" "600" copyDefaultConfig "$sixaxis_config" "$md_conf_root/all/sixaxis_timeout.cfg" rm "$sixaxis_config" } function remove_sixaxis() { dpkg --purge sixaxis } ================================================ FILE: scriptmodules/supplementary/skyscraper.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="skyscraper" rp_module_desc="Scraper for EmulationStation" rp_module_licence="GPL3 https://raw.githubusercontent.com/Gemba/skyscraper/master/LICENSE" rp_module_repo="git https://github.com/Gemba/skyscraper :_get_branch_skyscraper" rp_module_section="opt" function _get_branch_skyscraper() { download https://api.github.com/repos/Gemba/skyscraper/releases/latest - | grep -m 1 tag_name | cut -d\" -f4 } function depends_skyscraper() { local deps=(p7zip-full) if [[ "$__os_debian_ver" -ge 12 ]]; then deps+=(qt6-base-dev qmake6 qt6-base-dev-tools libqt6sql6-sqlite) else deps+=(qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5sql5-sqlite) fi getDepends "${deps[@]}" } function sources_skyscraper() { gitPullOrClone } function build_skyscraper() { rm --force .qmake.stash if [[ "$__os_debian_ver" -ge 12 ]]; then qmake6 else QT_SELECT=5 qmake fi make md_ret_require="$md_build/Skyscraper" } function install_skyscraper() { local config_files=($(_config_files_skyscraper)) md_ret_files=( 'docs' 'LICENSE' 'README.md' 'Skyscraper' 'supplementary/scraperdata/check_screenscraper_json_to_idmap.py' 'supplementary/scraperdata/convert_platforms_json.py' 'supplementary/scraperdata/deepdiff_peas_jsonfiles.py' 'supplementary/scraperdata/mdb2sqlite.sh' 'supplementary/scraperdata/peas_and_idmap_verify.py' 'supplementary/scraperdata/README-Skyscraper-Scripts.md' ) local ver=$(_get_branch_skyscraper) if compareVersions "$ver" ge "3.19.0"; then md_ret_files+=( 'supplementary/scraperdata/peas-schema.json' 'supplementary/scraperdata/peas_validate_with_json_schema.py' ) fi md_ret_files+=("${config_files[@]}") } function _config_files_skyscraper() { local config_files=( 'aliasMap.csv' 'artwork.xml.example1' 'artwork.xml.example2' 'artwork.xml.example3' 'artwork.xml.example4' 'artwork.xml' 'cache/priorities.xml.example' 'config.ini.example' 'hints.xml' 'import' 'mameMap.csv' 'mobygames_platforms.json' 'peas.json' 'platforms_idmap.csv' 'resources' 'supplementary/bash-completion/Skyscraper.bash' 'screenscraper_platforms.json' 'tgdb_developers.json' 'tgdb_genres.json' 'tgdb_platforms.json' 'tgdb_publishers.json' ) echo "${config_files[@]}" } function remove_skyscraper() { md_ret_info+=("Skyscraper's cache in ~/.skyscraper/cache/ is not empty and is not removed.") # Remove possible per-user deployment introduced with v3.9.3 rm -f "$home/.bash_completion.d/Skyscraper.bash" rm -f "/etc/bash_completion.d/Skyscraper.bash" rm -f "/usr/local/bin/Skyscraper" } # Get the location of the cached resources folder. In v3+, this changed to 'cache'. # Note: the cache folder might be unavailable during first time installations function _cache_folder_skyscraper() { if [[ -d "$configdir/all/skyscraper/dbs" ]]; then echo "dbs" else echo "cache" fi } # Purge all Skyscraper caches function _purge_skyscraper() { local platform local cache_folder=$(_cache_folder_skyscraper) [[ ! -d "$configdir/all/skyscraper/$cache_folder" ]] && return while read platform; do # Find any sub-folders of the cache folder and clear them _clear_platform_skyscraper "$platform" done < <(find "$configdir/all/skyscraper/$cache_folder" -maxdepth 1 -mindepth 1 -type d -exec basename {} \;) } function _clear_platform_skyscraper() { local platform="$1" local mode="$2" local cache_folder=$(_cache_folder_skyscraper) [[ ! -d "$configdir/all/skyscraper/$cache_folder/$platform" ]] && return if [[ $mode == "vacuum" ]]; then sudo -u "$__user" stdbuf -o0 $md_inst/Skyscraper --flags unattend -p "$platform" --cache vacuum else sudo -u "$__user" stdbuf -o0 $md_inst/Skyscraper --flags unattend -p "$platform" --cache purge:all fi sleep 5 } function _purge_platform_skyscraper() { local options=() local cache_folder=$(_cache_folder_skyscraper) local system while read system; do # If there is no 'db.xml' file underneath the folder, skip it, it means folder is empty [[ ! -f "$configdir/all/skyscraper/$cache_folder/$system/db.xml" ]] && continue # Get the size on disk of the system and show it in the select list local size=$(du -sh "$configdir/all/skyscraper/$cache_folder/$system" | cut -f1) options+=("$system" "$size" OFF) done < <(find "$configdir/all/skyscraper/$cache_folder" -maxdepth 1 -mindepth 1 -type d -exec basename {} \;) # If not folders are found, show an info message instead of the selection list if [[ ${#options[@]} -eq 0 ]]; then printMsgs "dialog" "Nothing to delete ! No cached platforms found in \n$configdir/all/skyscraper/$cache_folder." return fi local mode="$1" [[ -z "$mode" ]] && mode="purge" local cmd=(dialog --backtitle "$__backtitle" --radiolist "Select platform to $mode" 20 60 12) local platform=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) # Exit if no platform chosen [[ -z "$platform" ]] && return _clear_platform_skyscraper "$platform" "$@" } function _get_ver_skyscraper() { if [[ -f "$md_inst/Skyscraper" ]]; then echo $(sudo -u "$__user" "$md_inst/Skyscraper" -h | grep 'Running Skyscraper' | cut -d' ' -f 3 | tr -d v 2>/dev/null) fi } function _check_ver_skyscraper() { ver=$(_get_ver_skyscraper) if ! compareVersions "$ver" ge "3.5"; then printMsgs "dialog" "The version of Skyscraper you currently have installed is incompatible with options used by this script. Please update Skyscraper to the latest version to continue." return 1 fi return 0 } # List any non-empty systems found in the ROM folder function _list_systems_skyscraper() { find -L "$romdir/" -mindepth 1 -maxdepth 1 -type d -not -empty | sort -u } function configure_skyscraper() { if [[ "$md_mode" == "remove" ]]; then return fi # Check if this a first time install local local_config local_config=$(readlink -qn "$home/.skyscraper") # Handle the cases where the user has an existing Skyscraper installation. if [[ -d "$home/.skyscraper" && "$local_config" != "$configdir/all/skyscraper" ]]; then # We have an existing Skyscraper installation, but not handled by this scriptmodule. # Since the $HOME/.skyscraper folder will be moved, make sure the 'cache' and 'import' folders are moved separately local f_size local cache_folder="dbs" [[ -d "$home/.skyscraper/cache" ]] && cache_folder="cache" f_size=$(du --total -sm "$home/.skyscraper/$cache_folder" "$home/.skyscraper/import" 2>/dev/null | tail -n 1 | cut -f 1) printMsgs "console" "INFO: Moving the Cache and Import folders to new configuration folder (total: $f_size Mb)" local folder for folder in $cache_folder import; do mv "$home/.skyscraper/$folder" "$home/.skyscraper-$folder" && printMsgs "console" "INFO: Moved $home/.skyscraper/$folder to $home/.skyscraper-$folder" done # When having an existing installation, chances are the gamelist is generated in the ROMs folder # Create a GUI config file with this setting pre-set. iniConfig " = " '"' "$configdir/all/skyscraper.cfg" iniSet "use_rom_folder" 1 fi moveConfigDir "$home/.skyscraper" "$configdir/all/skyscraper" # Move the Cache and Import folders back the new conf folder for folder in $cache_folder import; do if [[ -d "$home/.skyscraper-$folder" ]]; then printMsgs "console" "INFO: Moving "$home/.skyscraper-$folder" back to configuration folder" mv "$home/.skyscraper-$folder" "$configdir/all/skyscraper/$folder" fi done _init_config_skyscraper chown -R "$__user":"$__group" "$configdir/all/skyscraper" chmod a+x "$md_inst"/*.py } function _init_config_skyscraper() { local config_files=($(_config_files_skyscraper)) mkdir -p .pristine_cfgs # assume new(er) install for cf in "${config_files[@]}"; do bn=${cf##*/} # cut off all folders if [[ -e "$md_inst/$bn" ]]; then cp -rf "$md_inst/$bn" ".pristine_cfgs/" rm -rf "$md_inst/$bn" fi done local scraper_conf_dir="$configdir/all/skyscraper" # Make sure the 'artwork.xml' and other conf file(s) are present, but don't overwrite them on upgrades local f_conf for f_conf in artwork.xml aliasMap.csv peas.json platforms_idmap.csv; do copyDefaultConfig "$md_inst/.pristine_cfgs/$f_conf" "$scraper_conf_dir/$f_conf" done # If we don't have a previous config.ini file, copy the example one if [[ ! -f "$scraper_conf_dir/config.ini" ]]; then cp "$md_inst/.pristine_cfgs/config.ini.example" "$scraper_conf_dir/config.ini" fi # Artwork example files, always overwrite cp -f "$md_inst/.pristine_cfgs/artwork.xml.example"* "$scraper_conf_dir" # Copy remaining resources, always overwrite local resource_files=( 'hints.xml' 'mameMap.csv' 'mobygames_platforms.json' 'screenscraper_platforms.json' 'tgdb_developers.json' 'tgdb_genres.json' 'tgdb_platforms.json' 'tgdb_publishers.json' ) local resource_file for resource_file in "${resource_files[@]}"; do cp -f "$md_inst/.pristine_cfgs/$resource_file" "$scraper_conf_dir" done # Copy the resource folder cp -rf "$md_inst/.pristine_cfgs/resources" "$scraper_conf_dir" # Create the import folders and add the definition template examples. local folder for folder in covers marquees screenshots textual videos wheels; do mkUserDir "$scraper_conf_dir/import/$folder" done cp -rf "$md_inst/.pristine_cfgs/import" "$scraper_conf_dir" # Create the cache folder and add the sample 'priorities.xml' file to it mkUserDir "$scraper_conf_dir/cache" cp -f "$md_inst/.pristine_cfgs/priorities.xml.example" "$scraper_conf_dir/cache" # Deploy programmable completion script cp -f "$md_inst/.pristine_cfgs/Skyscraper.bash" "/etc/bash_completion.d/" # Ease of use but also needed for proper completion ln -sf "$md_inst/Skyscraper" "/usr/local/bin/Skyscraper" # Remove possible per-user deployment introduced with v3.9.3 rm -f "$home/.bash_completion.d/Skyscraper.bash" } # read scriptmodule's skyscraper.cfg and prepare the command line parameters function _get_clioptions_skyscraper() { local system=$1 local scrape_module=$2 local params=() local flags iniConfig " = " '"' "$configdir/all/skyscraper.cfg" eval $(_load_config_skyscraper) [[ "$system" != "" ]] && system=\"$system\" params+=(-p "$system") flags="unattend,skipped," [[ "$download_videos" -eq 1 ]] && flags+="videos," [[ "$cache_marquees" -eq 0 ]] && flags+="nomarquees," [[ "$cache_covers" -eq 0 ]] && flags+="nocovers," [[ "$cache_screenshots" -eq 0 ]] && flags+="noscreenshots," [[ "$cache_wheels" -eq 0 ]] && flags+="nowheels," [[ "$only_missing" -eq 1 ]] && flags+="onlymissing," [[ "$rom_name" -eq 1 ]] && flags+="forcefilename," [[ "$remove_brackets" -eq 1 ]] && flags+="nobrackets," if [[ "$use_rom_folder" -eq 1 ]]; then params+=(-g "$romdir/$system") params+=(-o "$romdir/$system/media") # If we're saving to the ROM folder, then use relative paths in the gamelist flags+="relative," else params+=(-g "$home/.emulationstation/gamelists/$system") params+=(-o "$home/.emulationstation/downloaded_media/$system") fi # If 2nd parameter is unset, use the configured scraping source, otherwise scrape from cache. # Scraping from cache means we can omit '-s' from the parameter list. if [[ -z "$scrape_module" ]]; then params+=(-s "$scrape_source") fi [[ "$force_refresh" -eq 1 ]] && params+=(--refresh) # There will always be a ',' at the end of $flags, so let's remove it flags=${flags::-1} params+=(--flags "$flags") echo "${params[@]}" } # Scrape one system, passed as parameter function _scrape_skyscraper() { local system="$1" local scrape_module="$2" [[ -z "$system" ]] && return local params params=$(_get_clioptions_skyscraper "$system" "$scrape_module") declare -a "params_arr=($params)" # trap ctrl+c and return if pressed (rather than exiting retropie-setup etc) trap 'trap 2; return 1' INT sudo -u "$__user" stdbuf -o0 "$md_inst/Skyscraper" "${params_arr[@]}" echo -e "\nCOMMAND LINE USED:\n $md_inst/Skyscraper" "${params}" sleep 2 trap 2 } # Scrape a list of systems, chosen by the user function _scrape_chosen_skyscraper() { ! _check_ver_skyscraper && return 1 local options=() local system local i=1 while read system; do system=${system/$romdir\//} options+=($i "$system" OFF) ((i++)) done < <(_list_systems_skyscraper) if [[ ${#options[@]} -eq 0 ]] ; then printMsgs "dialog" "No populated ROM folders were found in $romdir." return fi local choices local cmd=(dialog --backtitle "$__backtitle" --ok-label "Start" --cancel-label "Back" --checklist " Select platforms for resource gathering\n\n" 22 60 16) choices=($("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)) # Exit if nothing was chosen or Cancel was used [[ ${#choices[@]} -eq 0 || $? -eq 1 ]] && return 1 # Confirm with the user that scraping can start local cli=("$md_inst/Skyscraper ") cli+=$(_get_clioptions_skyscraper "" "") local sky_cmd sky_cmd=$(echo "${cli[@]}" | sed 's/ -/ \\\\n -/g') local msg="This will start the gathering process, which can take a long time if you have a large game collection.\n\n" msg+="You can interrupt this process anytime by pressing \ZbCtrl+C\Zn.\n\n" msg+="For each selected Skyscraper is run with these commandline options:\n\n$sky_cmd" dialog --clear --colors --yes-label "Proceed" --no-label "Abort" --yesno "$msg" 20 70 2>&1 >/dev/tty [[ ! $? -eq 0 ]] && return 1 local choice for choice in "${choices[@]}"; do choice="${options[choice*3-2]}" _scrape_skyscraper "$choice" "" done } # Generate gamelists for a list of systems, chosen by the user function _generate_chosen_skyscraper() { ! _check_ver_skyscraper && return 1 local options=() local system local i=1 while read system; do system=${system/$romdir\//} options+=($i "$system" OFF) ((i++)) done < <(_list_systems_skyscraper) if [[ ${#options[@]} -eq 0 ]] ; then printMsgs "dialog" "No populated ROM folders were found in $romdir." return fi local choices local cmd=(dialog --backtitle "$__backtitle" --ok-label "Start" --cancel-label "Back" --checklist " Select platforms for gamelist(s) generation\n\n" 22 60 16) choices=($("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)) # Exit if nothing was chosen or Cancel was used [[ ${#choices[@]} -eq 0 || $? -eq 1 ]] && return 1 for choice in "${choices[@]}"; do choice="${options[choice*3-2]}" _scrape_skyscraper "$choice" "cache" done } function _load_config_skyscraper() { echo "$(loadModuleConfig \ 'rom_name=0' \ 'use_rom_folder=0' \ 'download_videos=0' \ 'cache_marquees=1' \ 'cache_covers=1' \ 'cache_wheels=1' \ 'cache_screenshots=1' \ 'scrape_source=screenscraper' \ 'remove_brackets=0' \ 'force_refresh=0' \ 'only_missing=0' )" } # Try to guess the most appropriate editor. On Debian derivatives, we have `sensible-editor` for that. function _open_editor_skyscraper() { local editor if [[ -n $(command -v sensible-editor) ]]; then sudo -u "$__user" sensible-editor "$1" > /dev/tty < /dev/tty else editor="${EDITOR:-nano}" sudo -u "$__user" $editor "$1" > /dev/tty < /dev/tty fi } function _gui_advanced_skyscraper() { declare -A help_strings_adv iniConfig " = " '"' "$configdir/all/skyscraper.cfg" eval $(_load_config_skyscraper) help_strings_adv=( [E]="Opens the configuration file \Zbconfig.ini\Zn in an editor." [F]="Opens the artwork definition file \Zbartwork.xml\Zn in an editor." [G]="Opens the game alias configuration file \ZbaliasMap.csv\Zn in an editor." ) while true; do local cmd=(dialog --backtitle "$__backtitle" --help-button --colors --no-collapse --default-item "$default" --ok-label "Ok" --cancel-label "Back" --title "Advanced options" --menu " EXPERT - edit configurations\n" 14 50 5) local options=() options+=(E "Edit 'config.ini'") options+=(F "Edit 'artwork.xml'") options+=(G "Edit 'aliasMap.csv'") local choice=$("${cmd[@]}" "${options[@]}" 2>&1 > /dev/tty) if [[ -n "$choice" ]]; then local default="$choice" case "$choice" in E) _open_editor_skyscraper "$configdir/all/skyscraper/config.ini" ;; F) _open_editor_skyscraper "$configdir/all/skyscraper/artwork.xml" ;; G) _open_editor_skyscraper "$configdir/all/skyscraper/aliasMap.csv" ;; HELP*) # Retain choice default="${choice/HELP /}" if [[ ! -z "${help_strings_adv[${default}]}" ]]; then dialog --colors --no-collapse --ok-label "Close" --msgbox "${help_strings_adv[${default}]}" 22 65 >&1 fi esac else break fi done } function gui_skyscraper() { if pgrep "emulationstatio" >/dev/null; then printMsgs "dialog" "This scraper must not be run while EmulationStation is running or the scraped data will be overwritten.\n\nPlease quit EmulationStation and run RetroPie-Setup from the terminal:\n\n sudo \$HOME/RetroPie-Setup/retropie_setup.sh" return fi iniConfig " = " '"' "$configdir/all/skyscraper.cfg" eval $(_load_config_skyscraper) chown "$__user":"$__group" "$configdir/all/skyscraper.cfg" local -a s_source local -a s_source_names declare -A help_strings s_source=( [1]=screenscraper [2]=arcadedb [3]=thegamesdb [4]=mobygames [5]=openretro [6]=igdb [7]=worldofspectrum ) s_source+=( [10]=esgamelist [11]=import ) s_source_names=( [1]=ScreenScraper [2]=ArcadeDB [3]=TheGamesDB [4]=MobyGames [5]=OpenRetro [6]="Internet Game Database" [7]="World of Spectrum" ) s_source_names+=( [10]="EmulationStation Gamelist" [11]="Import Folder" ) local ver local lastest_ver # Help strings for this GUI help_strings=( [1]="Gather resources and cache them for the platforms found in \Zb$romdir\Zn.\nRuns the scraper to download the information and media from the selected gathering source." [2]="Select the source for ROM scraping. Supported sources:\n\ZbONLINE\Zn\n * ScreenScraper (screenscraper.fr)\n * TheGamesDB (thegamesdb.net)\n * OpenRetro (openretro.org)\n * ArcadeDB (adb.arcadeitalia.net)\n * World of Spectrum (worldofspectrum.org)\n\ZbLOCAL\Zn\n * EmulationStation Gamelist (imports data from ES gamelist)\n * Import (imports resources in the local cache)\n\n\Zb\ZrNOTE\Zn: Some sources require a username and password for access. These can be set per source in the \Zbconfig.ini\Zn configuration file.\n\n Skyscraper parameter: \Zb-s \Zn" [3]="Options for resource gathering and caching sub-menu.\nClick to open it." [4]="Generate EmulationStation game lists.\nRuns the scraper to incorporate downloaded information and media from the local cache and write them to \Zbgamelist.xml\Zn files to be used by EmulationStation." [5]="Options for EmulationStation game list generation sub-menu.\nClick to open it and change the options." [V]="Toggle the download and caching of videos.\nThis also toggles whether the videos will be included in the resulting gamelist.\n\nSkyscraper option: \Zb--flags videos\Zn" [A]="Advanced options sub-menu." [U]="Check for an update to Skyscraper." ) ver=$(_get_ver_skyscraper) while true; do [[ -z "$ver" ]] && ver="v(Git)" local cmd=(dialog --backtitle "$__backtitle" --colors --cancel-label "Exit" --help-button --no-collapse --cr-wrap --default-item "$default" --menu " Skyscraper: game scraper for EmulationStation ($ver)\\n \\n" 22 60 12) local options=( "-" "GATHER and cache resources" ) local source_found=0 local online="Online" local i options+=( 1 "Gather resources" ) for i in "${!s_source[@]}"; do if [[ "$scrape_source" == "${s_source[$i]}" ]]; then [[ $i -ge 10 ]] && online="Local" options+=(2 "Gather source - ${s_source_names[$i]} ($online) -->") source_found=1 fi done if [[ $source_found -ne 1 ]]; then options+=(2 "Gather from - Screenscraper (Online) -->") scrape_source="screenscraper" # default scraping source if none found iniSet "scrape_source" "$scrape_source" fi options+=(3 "Cache options and commands -->") options+=("-" "GAME LIST generation") options+=(4 "Generate game list(s)") options+=(5 "Generate options -->") options+=("-" "OTHER options") if [[ "$download_videos" -eq 1 ]]; then options+=(V "Download videos (Enabled)") else options+=(V "Download videos (Disabled)") fi options+=(A "Advanced options -->") options+=(U "Check for Updates") # Run the GUI local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then local default="$choice" case "$choice" in 1) if _scrape_chosen_skyscraper; then printMsgs "dialog" "ROMs information gathered.\nDon't forget to use 'Generate Game list(s)' to add this information to EmulationStation." elif [[ $? -eq 2 ]]; then printMsgs "dialog" "Gathering was aborted" fi ;; 2) # Scrape source options have a separate dialog local s_options=() local i for i in "${!s_source[@]}"; do online="Online:" [[ i -ge 10 ]] && online="Local:" if [[ "$scrape_source" == "${s_source[$i]}" ]]; then s_default="$online ${s_source_names[$i]}" fi s_options+=("$online ${s_source_names[$i]}" "") done if [[ -z "$s_default" ]]; then s_default="Online: ${s_source_names[1]}" fi local s_cmd=(dialog --title "Select Scraping source" --default-item "$s_default" \ --menu "Choose one of the available scraping sources" 18 50 9) # Run the Scraper source selection dialog local scrape_source_name=$("${s_cmd[@]}" "${s_options[@]}" 2>&1 >/dev/tty) # If Cancel was chosen, don't do anything [[ -z "$scrape_source_name" ]] && continue # Strip the "XYZ:" prefix from the chosen scraper source, then compare to our list local src=$(echo "$scrape_source_name" | cut -d' ' -f2-) for i in "${!s_source_names[@]}"; do [[ "${s_source_names[$i]}" == "$src" ]] && scrape_source=${s_source[$i]} done iniSet "scrape_source" "$scrape_source" ;; 3) _gui_cache_skyscraper ;; 4) if _generate_chosen_skyscraper "cache"; then printMsgs "dialog" "Game list(s) generated." elif [[ $? -eq 2 ]]; then printMsgs "dialog" "Game list generation aborted" fi ;; 5) _gui_generate_skyscraper ;; V) download_videos="$((download_videos ^ 1))" iniSet "download_videos" "$download_videos" ;; A) _gui_advanced_skyscraper ;; U) local latest_ver="$(_get_branch_skyscraper)" # check for update if compareVersions "$latest_ver" gt "$ver" ; then printMsgs "dialog" "There is a new version available. Latest released version is $latest_ver (You are running $ver).\n\nYou can update the package from RetroPie-Setup -> Manage Packages" else printMsgs "dialog" "You are running the latest version ($ver)." fi ;; HELP*) # Retain choice when the Help button is selected default="${choice/HELP /}" if [[ ! -z "${help_strings[$default]}" ]]; then dialog --colors --no-collapse --ok-label "Close" --msgbox "${help_strings[$default]}" 22 65 >&1 fi ;; esac else break fi done } function _gui_cache_skyscraper() { local db_size local cache_folder=$(_cache_folder_skyscraper) declare -A help_strings_cache iniConfig " = " '"' "$configdir/all/skyscraper.cfg" eval $(_load_config_skyscraper) help_strings_cache=( [1]="Toggle whether screenshots are cached locally when scraping.\n\nSkyscraper option: \Zb--flags noscreenshots\Zn" [2]="Toggle whether covers are cached locally when scraping.\n\nSkyscraper option: \Zb--flags nocovers\Zn" [3]="Toggle whether wheels are cached locally when scraping.\n\nSkyscraper option: \Zb--flags nowheels\Zn" [4]="Toggle whether marquees are cached locally when scraping.\n\nSkyscraper option: \Zb--flags nomarquees\Zn" [5]="Enable this to only scrape files that do not already have data in the Skyscraper resource cache.\n\nSkyscraper option: \Zb--flags onlymissing\Zn" [6]="Force the refresh of resources in the local cache when scraping.\n\nSkyscraper option: \Zb--cache refresh\Zn" [P]="Purge \ZbALL\Zn all cached resources for all platforms." [S]="Purge all cached resources for a chosen platform.\n\nSkyscraper option: \Zb--cache purge:all\Zn" [V]="Removes all non-used cached resources for a chosen platform (vacuum).\n\nSkyscraper option: \Zb--cache vacuum\Zn" ) while true; do db_size=$(du -sh "$configdir/all/skyscraper/$cache_folder" 2>/dev/null | cut -f 1 || echo 0m) [[ -z "$db_size" ]] && db_size="0Mb" local cmd=(dialog --backtitle "$__backtitle" --help-button --colors --no-collapse --default-item "$default" --ok-label "Ok" --cancel-label "Back" --title "Cache options and commands" --menu "\n Current cache size: $db_size\n\n" 21 60 12) local options=("-" "OPTIONS for gathering and caching") if [[ "$cache_screenshots" -eq 1 ]]; then options+=(1 "Cache screenshots (Enabled)") else options+=(1 "Cache screenshots (Disabled)") fi if [[ "$cache_covers" -eq 1 ]]; then options+=(2 "Cache covers (Enabled)") else options+=(2 "Cache covers (Disabled)") fi if [[ "$cache_wheels" -eq 1 ]]; then options+=(3 "Cache wheels (Enabled)") else options+=(3 "Cache wheels (Disabled)") fi if [[ "$cache_marquees" -eq 1 ]]; then options+=(4 "Cache marquees (Enabled)") else options+=(4 "Cache marquees (Disabled)") fi if [[ "$only_missing" -eq 1 ]]; then options+=(5 "Scrape only missing (Enabled)") else options+=(5 "Scrape only missing (Disabled)") fi if [[ "$force_refresh" -eq 0 ]]; then options+=(6 "Force cache refresh (Disabled)") else options+=(6 "Force cache refresh (Enabled)") fi options+=("-" "PURGE cache commands") options+=(V "Vacuum chosen platform") options+=(S "Purge chosen platform") options+=(P "Purge all platforms(!)") local choice=$("${cmd[@]}" "${options[@]}" 2>&1 > /dev/tty) if [[ -n "$choice" ]]; then local default="$choice" case "$choice" in 1) cache_screenshots="$((cache_screenshots ^ 1))" iniSet "cache_screenshots" "$cache_screenshots" ;; 2) cache_covers="$((cache_covers ^ 1))" iniSet "cache_covers" "$cache_covers" ;; 3) cache_wheels="$((cache_wheels ^ 1))" iniSet "cache_wheels" "$cache_wheels" ;; 4) cache_marquees="$((cache_marquees ^ 1))" iniSet "cache_marquees" "$cache_marquees" ;; 5) only_missing="$((only_missing ^ 1))" iniSet "only_missing" "$only_missing" ;; 6) force_refresh="$((force_refresh ^ 1))" iniSet "force_refresh" "$force_refresh" ;; V) _purge_platform_skyscraper "vacuum" ;; S) _purge_platform_skyscraper ;; P) dialog --clear --defaultno --colors --yesno "\Z1\ZbAre you sure ?\Zn\nThis will \Zb\ZuERASE\Zn all locally cached scraped resources" 8 60 2>&1 >/dev/tty if [[ $? == 0 ]]; then _purge_skyscraper fi ;; HELP*) # Retain choice default="${choice/HELP /}" if [[ ! -z "${help_strings_cache[${default}]}" ]]; then dialog --colors --no-collapse --ok-label "Close" --msgbox "${help_strings_cache[${default}]}" 22 65 >&1 fi esac else break fi done } function _gui_generate_skyscraper() { declare -A help_strings_gen iniConfig " = " '"' "$configdir/all/skyscraper.cfg" eval $(_load_config_skyscraper) help_strings_gen=( [1]="Game name format used in the EmulationStation game list. Available options:\n\n\ZbSource name\Zn: use the name returned by the scraper\n\ZbFilename\Zn: use the filename of the ROM as game name\n\nSkyscraper option: \Zb--flags forcefilename\Z0" [2]="Game name option to remove/keep the text found between '()' and '[]' in the ROMs filename.\n\nSkyscraper option: \Zb--flags nobrackets\Zn" [3]="Choose to save the generated 'gamelist.xml' and media in the ROMs folder. Supported options:\n\n\ZbEnabled\Zn saves the 'gamelist.xml' in the ROMs folder and the media in the 'media' sub-folder.\n\n\ZbDisabled\Zn saves the 'gamelist.xml' in \Zu\$HOME/.emulationstation/gamelists/\Zn and the media in \Zu\$HOME/.emulationstation/downloaded_media\Zn.\n\n\Zb\ZrNOTE\Zn: changing this option will not automatically copy the 'gamelist.xml' file and the media to the new location or remove the ones in the old location. You must do this manually.\n\nSkyscraper parameters: \Zb-g \Zn / \Zb-o \Zn" ) while true; do local cmd=(dialog --backtitle "$__backtitle" --help-button --colors --no-collapse --default-item "$default" --ok-label "Ok" --cancel-label "Back" --title "Game list generation options" --menu "\n\n" 13 60 5) local -a options if [[ "$rom_name" -eq 0 ]]; then options=(1 "ROM Names (Source name)") else options=(1 "ROM Names (Filename)") fi if [[ "$remove_brackets" -eq 1 ]]; then options+=(2 "Remove bracket info (Enabled)") else options+=(2 "Remove bracket info (Disabled)") fi if [[ "$use_rom_folder" -eq 1 ]]; then options+=(3 "Use ROM folders for game list & media (Enabled)") else options+=(3 "Use ROM folders for game list & media (Disabled)") fi local choice=$("${cmd[@]}" "${options[@]}" 2>&1 > /dev/tty) if [[ -n "$choice" ]]; then local default="$choice" case "$choice" in 1) rom_name="$((rom_name ^ 1))" iniSet "rom_name" "$rom_name" ;; 2) remove_brackets="$((remove_brackets ^ 1))" iniSet "remove_brackets" "$remove_brackets" ;; 3) use_rom_folder="$((use_rom_folder ^ 1))" iniSet "use_rom_folder" "$use_rom_folder" ;; HELP*) # Retain choice default="${choice/HELP /}" if [[ ! -z "${help_strings_gen[${default}]}" ]]; then dialog --colors --no-collapse --ok-label "Close" --msgbox "${help_strings_gen[${default}]}" 22 65 >&1 fi esac else break fi done } ================================================ FILE: scriptmodules/supplementary/snesdev/001-wiringpi-static.diff ================================================ diff --git a/wiringPi/Makefile b/wiringPi/Makefile index 88fc48e..ee5dc9f 100644 --- a/wiringPi/Makefile +++ b/wiringPi/Makefile @@ -78,6 +78,10 @@ $(DYNAMIC): $(OBJ) $Q echo "[Link (Dynamic)]" $Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) $(OBJ) $(LIBS) +$(STATIC): $(OBJ) + $Q echo "[Link (Static)]" + $Q $(AR) -rcs $(STATIC) $(OBJ) + .c.o: $Q echo [Compile] $< $Q $(CC) -c $(CFLAGS) $< -o $@ @@ -86,7 +90,7 @@ $(DYNAMIC): $(OBJ) .PHONY: clean clean: $Q echo "[Clean]" - $Q rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.* + $Q rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.* $(STATIC) .PHONY: tags tags: $(SRC) ================================================ FILE: scriptmodules/supplementary/snesdev.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="snesdev" rp_module_desc="SNESDev (Driver for the RetroPie GPIO-Adapter)" rp_module_section="driver" rp_module_repo="git https://github.com/MonsterJoysticks/SNESDev-RPi-Wiring-Pi.git master" rp_module_flags="noinstclean !all rpi" # install the latest version of WiringPi function _wiringpi_snesdev() { pushd "$md_build" gitPullOrClone wiringpi https://github.com/WiringPi/WiringPi.git cd wiringpi applyPatch "$md_data/001-wiringpi-static.diff" make -C wiringPi libwiringPi.a popd } function depends_snesdev() { getDepends libconfuse-dev } function sources_snesdev() { gitPullOrClone } function build_snesdev() { local wiringpi_version wiringpi_version="$(dpkg-query -f='${Version} ${Status}' -W wiringpi 2>/dev/null | grep installed | cut -f1 -d' ')" CFLAGS+=" -Wno-incompatible-pointer-types" if [[ -z "$wiringpi_version" ]] || compareVersions "$wiringpi_version" lt 3.14; then # when there's no WiringPi installed or there's an old version, build a static version and use it printMsgs console "Using locally built WiringPi library" _wiringpi_snesdev make LDFLAGS=" -L"$md_build/wiringpi/wiringPi"" CFLAGS="$CFLAGS -I"$md_build/wiringpi/wiringPi"" else make fi md_ret_require="$md_build/src/SNESDev" } function install_snesdev() { md_ret_files=( "src/SNESDev" "README.md" "supplementary/snesdev.cfg" ) } function configure_snesdev() { if [[ "$md_mode" == "install" ]]; then install -m 0755 "$md_inst/snesdev.cfg" "/etc/snesdev.cfg" # remove old drivers and service [[ -f "/usr/local/bin/SNESDev" ]] && rm -f "/usr/local/bin/SNESDev" update-rc.d SNESDev remove rm -f /etc/init.d/SNESDev fi } function _systemd_install_snesdev() { cat > /etc/systemd/system/snesdev.service << _EOF_ [Unit] Description=Userspace SNES GPIO Driver [Service] ExecStart=$md_inst/SNESDev [Install] WantedBy=multi-user.target _EOF_ systemctl daemon-reload systemctl -q enable snesdev.service } function _systemd_uninstall_snesdev() { if systemctl -q is-enabled snesdev.service 2>/dev/null; then systemctl stop snesdev.service systemctl -q disable snesdev.service fi [[ -f "/etc/systemd/system/snesdev.service" ]] && rm "/etc/systemd/system/snesdev.service" } # start SNESDev on boot and configure RetroArch input settings function enable_at_start_snesdev() { local mode="$1" iniConfig "=" "" "/etc/snesdev.cfg" clear printHeading "Enabling SNESDev on boot." case "$mode" in 1) iniSet "button_enabled" "0" iniSet "gamepad1_enabled" "1" iniSet "gamepad2_enabled" "1" _systemd_install_snesdev ;; 2) iniSet "button_enabled" "1" iniSet "gamepad1_enabled" "0" iniSet "gamepad2_enabled" "0" _systemd_install_snesdev ;; 3) iniSet "button_enabled" "1" iniSet "gamepad1_enabled" "1" iniSet "gamepad2_enabled" "1" _systemd_install_snesdev ;; *) echo "[enable_at_start_snesdev] I do not understand what is going on here." ;; esac } function set_adapter_version_snesdev() { local ver="$1" iniConfig "=" "" "/etc/snesdev.cfg" if [[ "$ver" -eq 1 ]]; then iniSet "adapter_version" "1x" else iniSet "adapter_version" "2x" fi } function remove_snesdev() { _systemd_uninstall_snesdev # remove old versions if found [[ -f "/usr/local/bin/SNESDev" ]] && rm -f "/usr/local/bin/SNESDev" } function gui_snesdev() { local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option." 22 86 16) local options=( 1 "Enable SNESDev on boot and SNESDev keyboard mapping (polling pads and button)" 2 "Enable SNESDev on boot and SNESDev keyboard mapping (polling only pads)" 3 "Enable SNESDev on boot and SNESDev keyboard mapping (polling only button)" 4 "Switch to adapter version 1.X" 5 "Switch to adapter version 2.X" D "Disable SNESDev on boot and SNESDev keyboard mapping" ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) enable_at_start_snesdev 3 printMsgs "dialog" "Enabled SNESDev on boot (polling pads and button)." ;; 2) enable_at_start_snesdev 1 printMsgs "dialog" "Enabled SNESDev on boot (polling only pads)." ;; 3) enable_at_start_snesdev 2 printMsgs "dialog" "Enabled SNESDev on boot (polling only button)." ;; 4) set_adapter_version_snesdev 1 printMsgs "dialog" "Switched to adapter version 1.X." ;; 5) set_adapter_version_snesdev 2 printMsgs "dialog" "Switched to adapter version 2.X." ;; D) _systemd_uninstall_snesdev printMsgs "dialog" "Disabled SNESDev on boot." ;; esac fi } ================================================ FILE: scriptmodules/supplementary/splashscreen/05-splash.sh ================================================ PID_FILE=/dev/shm/rp-splashscreen.pid if [ "`tty`" = "/dev/tty1" ] && [ -z "$DISPLAY" ] && [ -f "$PID_FILE" ]; then PID=`cat $PID_FILE` if ps -p $PID >/dev/null; then kill $PID >/dev/null 2>&1 fi rm $PID_FILE fi ================================================ FILE: scriptmodules/supplementary/splashscreen/asplashscreen.sh ================================================ #!/bin/sh ROOTDIR="" DATADIR="" REGEX_VIDEO="" REGEX_IMAGE="" CMD="vlc --intf dummy --quiet --no-video-title-show --play-and-exit" CMD_OPTS="" # VLC doesn't detect the connected HDMI port, defaulting to output on the 1st port # do the detection ourselves and pass the HDMI port as a parameter case "$CMD_OPTS" in *mmal*) HDMI_PORT="$(tvservice -l | grep -o -P -m1 "HDMI \K(.*)")" [ -n "$HDMI_PORT" ] && CMD_OPTS="$CMD_OPTS --mmal-display hdmi-$(($HDMI_PORT+1))" ;; esac # Load user settings . /opt/retropie/configs/all/splashscreen.cfg do_start () { local config="/etc/splashscreen.list" local line local re="$REGEX_VIDEO\|$REGEX_IMAGE" local cmd="$CMD $CMD_OPTS" case "$RANDOMIZE" in retropie) line="$(find "$ROOTDIR/supplementary/splashscreen" -type f | grep "$re" | shuf -n1)" ;; custom) line="$(find "$DATADIR/splashscreens" -type f | grep "$re" | shuf -n1)" ;; all) line="$(find "$ROOTDIR/supplementary/splashscreen" "$DATADIR/splashscreens" -type f | grep "$re" | shuf -n1)" ;; list) line="$(cat "$config" | shuf -n1)" ;; esac if [ "$RANDOMIZE" = "disabled" ]; then local count=$(wc -l <"$config") else local count=1 fi [ $count -eq 0 ] && count=1 [ $count -gt 12 ] && count=12 # Default duration is 12 seconds, check if configured otherwise [ -z "$DURATION" ] && DURATION=12 local delay=$((DURATION/count)) cmd="$cmd --image-duration $delay" local pid if [ "$RANDOMIZE" = "disabled" ]; then tr "\n" "\0" <"$config" | xargs -0 $cmd & 2>/dev/null # get cmd pid (child of xargs) pid=`pgrep -P $!` else $cmd "$line" & 2>/dev/null pid=$! fi echo "$pid" >/dev/shm/rp-splashscreen.pid exit 0 } case "$1" in start|"") do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; status) exit 0 ;; *) echo "Usage: asplashscreen [start|stop]" >&2 exit 3 ;; esac ================================================ FILE: scriptmodules/supplementary/splashscreen/rp-vlc ================================================ Package: vlc* Pin: origin archive.raspberrypi.org Pin-Priority: 1001 Package: libvlc* Pin: origin archive.raspberrypi.org Pin-Priority: 1001 ================================================ FILE: scriptmodules/supplementary/splashscreen.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="splashscreen" rp_module_desc="Configure Splashscreen" rp_module_section="main" rp_module_repo="git https://github.com/RetroPie/retropie-splashscreens.git master" rp_module_flags="noinstclean !all rpi !osmc !xbian" function _update_hook_splashscreen() { # make sure splashscreen is always up to date if updating just RetroPie-Setup if rp_isInstalled "$md_id"; then install_bin_splashscreen configure_splashscreen fi } function _image_exts_splashscreen() { echo '\.bmp\|\.jpg\|\.jpeg\|\.gif\|\.png\|\.ppm\|\.tiff\|\.webp' } function _video_exts_splashscreen() { echo '\.avi\|\.mov\|\.mp4\|\.mkv\|\.3gp\|\.mpg\|\.mp3\|\.wav\|\.m4a\|\.aac\|\.ogg\|\.flac' } function depends_splashscreen() { # pin archive.raspberrypi.org version of VLC on buster as updated "security" vanilla version doesn't have mmal output if [[ "$__os_debian_ver" -lt 11 ]]; then cp "$md_data/rp-vlc" /etc/apt/preferences.d/ # try and install vlc to force downgrade aptInstall --allow-downgrades vlc else getDepends vlc fi } function install_bin_splashscreen() { cat > "/etc/systemd/system/asplashscreen.service" << _EOF_ [Unit] Description=Show custom splashscreen DefaultDependencies=no After=console-setup.service Wants=console-setup.service ConditionPathExists=$md_inst/asplashscreen.sh [Service] Type=oneshot User=$__user ExecStart=$md_inst/asplashscreen.sh RemainAfterExit=yes [Install] WantedBy=sysinit.target _EOF_ gitPullOrClone "$md_inst" cp "$md_data/asplashscreen.sh" "$md_inst" iniConfig "=" '"' "$md_inst/asplashscreen.sh" if [[ "$__os_debian_ver" -le 10 ]]; then # set vlc mmal layer for Raspberry Pi OS 10 (Buster) or below. iniSet "CMD_OPTS" " --mmal-layer 10001" # remove 05-splash.sh if present due to previous splashscreen module installing this on rpi4 on Buster rm -f /etc/profile.d/05-splash.sh else # install script to kill splashscreen before running autostart scripts when using kms cp "$md_data/05-splash.sh" /etc/profile.d/ fi iniSet "ROOTDIR" "$rootdir" iniSet "DATADIR" "$datadir" iniSet "REGEX_IMAGE" "$(_image_exts_splashscreen)" iniSet "REGEX_VIDEO" "$(_video_exts_splashscreen)" if [[ ! -f "$configdir/all/$md_id.cfg" ]]; then iniConfig "=" '"' "$configdir/all/$md_id.cfg" iniSet "RANDOMIZE" "disabled" fi chown "$__user":"$__group" "$configdir/all/$md_id.cfg" mkUserDir "$datadir/splashscreens" echo "Place your own splashscreens in here." >"$datadir/splashscreens/README.txt" chown "$__user":"$__group" "$datadir/splashscreens/README.txt" } function enable_plymouth_splashscreen() { local config="/boot/cmdline.txt" if [[ -f "$config" ]]; then sed -i "s/ *plymouth.enable=0//" "$config" fi } function disable_plymouth_splashscreen() { local config="/boot/cmdline.txt" if [[ -f "$config" ]] && ! grep -q "plymouth.enable" "$config"; then sed -i '1 s/ *$/ plymouth.enable=0/' "$config" fi } function default_splashscreen() { echo "$md_inst/retropie-default.png" >/etc/splashscreen.list } function enable_splashscreen() { systemctl enable asplashscreen } function disable_splashscreen() { systemctl disable asplashscreen } function configure_splashscreen() { [[ "$md_mode" == "remove" ]] && return disable_plymouth_splashscreen enable_splashscreen [[ ! -f /etc/splashscreen.list ]] && default_splashscreen } function remove_splashscreen() { enable_plymouth_splashscreen disable_splashscreen rm -f /etc/splashscreen.list /etc/systemd/system/asplashscreen.service rm -f /etc/apt/preferences.d/rp-vlc rm -f /etc/profile.d/05-splash.sh systemctl daemon-reload } function choose_path_splashscreen() { local options=( 1 "RetroPie splashscreens" 2 "Own/Extra splashscreens (from $datadir/splashscreens)" ) local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option." 22 86 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ "$choice" -eq 1 ]] && echo "$md_inst" [[ "$choice" -eq 2 ]] && echo "$datadir/splashscreens" } function set_append_splashscreen() { local mode="$1" [[ -z "$mode" ]] && mode="set" local path local file while true; do path="$(choose_path_splashscreen)" [[ -z "$path" ]] && break file=$(choose_splashscreen "$path") if [[ -n "$file" ]]; then if [[ "$mode" == "set" ]]; then echo "$file" >/etc/splashscreen.list printMsgs "dialog" "Splashscreen set to '$file'" break fi if [[ "$mode" == "append" ]]; then echo "$file" >>/etc/splashscreen.list printMsgs "dialog" "Splashscreen '$file' appended to /etc/splashscreen.list" fi fi done } function choose_splashscreen() { local path="$1" local type="$2" local regex [[ "$type" == "image" ]] && regex=$(_image_exts_splashscreen) [[ "$type" == "video" ]] && regex=$(_video_exts_splashscreen) local options=() local i=0 while read splashdir; do splashdir=${splashdir/$path\//} if echo "$splashdir" | grep -q "$regex"; then options+=("$i" "$splashdir") ((i++)) fi done < <(find "$path" -type f ! -regex ".*/\..*" ! -regex ".*LICENSE" ! -regex ".*README.*" ! -regex ".*\.sh" ! -regex ".*\.pkg" | sort) if [[ "${#options[@]}" -eq 0 ]]; then printMsgs "dialog" "There are no splashscreens installed in $path" return fi local cmd=(dialog --backtitle "$__backtitle" --menu "Choose splashscreen." 22 76 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -n "$choice" ]] && echo "$path/${options[choice*2+1]}" } function randomize_splashscreen() { options=( 0 "Disable splashscreen randomizer" 1 "Randomize RetroPie splashscreens" 2 "Randomize own splashscreens (from $datadir/splashscreens)" 3 "Randomize all splashscreens" 4 "Randomize /etc/splashscreen.list" ) local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option." 22 86 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) iniConfig "=" '"' "$configdir/all/$md_id.cfg" chown "$__user":"$__group" "$configdir/all/$md_id.cfg" case "$choice" in 0) iniSet "RANDOMIZE" "disabled" printMsgs "dialog" "Splashscreen randomizer disabled." ;; 1) iniSet "RANDOMIZE" "retropie" printMsgs "dialog" "Splashscreen randomizer enabled in directory $rootdir/supplementary/$md_id" ;; 2) iniSet "RANDOMIZE" "custom" printMsgs "dialog" "Splashscreen randomizer enabled in directory $datadir/splashscreens" ;; 3) iniSet "RANDOMIZE" "all" printMsgs "dialog" "Splashscreen randomizer enabled for both splashscreen directories." ;; 4) iniSet "RANDOMIZE" "list" printMsgs "dialog" "Splashscreen randomizer enabled for entries in /etc/splashscreen.list" ;; esac } function preview_splashscreen() { local options=( 1 "View single splashscreen" 2 "View slideshow of all splashscreens" 3 "Play video splash" ) local path local file local splash_cmd="sudo -u $__user XDG_RUNTIME_DIR=/run/user/$SUDO_UID vlc --intf dummy --quiet --play-and-exit --image-duration 6" while true; do local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option." 22 86 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && break path="$(choose_path_splashscreen)" [[ -z "$path" ]] && break while true; do case "$choice" in 1) file=$(choose_splashscreen "$path" "image") [[ -z "$file" ]] && break $splash_cmd "$file" ;; 2) file=$(mktemp) find "$path" -type f ! -regex ".*/\..*" ! -regex ".*LICENSE" ! -regex ".*README.*" ! -regex ".*\.sh" | sort > "$file" if [[ -s "$file" ]]; then tr "\n" "\0" <"$file" | xargs -0 $splash_cmd else printMsgs "dialog" "There are no splashscreens installed in $path" fi rm -f "$file" break ;; 3) file=$(choose_splashscreen "$path" "video") [[ -z "$file" ]] && break $splash_cmd "$file" ;; esac done done } function download_extra_splashscreen() { gitPullOrClone "$datadir/splashscreens/retropie-extra" https://github.com/HerbFargus/retropie-splashscreens-extra chown -R "$__user":"$__group" "$datadir/splashscreens/retropie-extra" } function gui_splashscreen() { local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option." 22 86 16) while true; do local enabled=0 [[ -n "$(find "/etc/systemd/system/"*".wants" -type l -name "asplashscreen.service")" ]] && enabled=1 local options=(1 "Choose splashscreen") if [[ "$enabled" -eq 1 ]]; then options+=(2 "Show splashscreen on boot (currently: Enabled)") iniConfig "=" '"' "$configdir/all/$md_id.cfg" iniGet "RANDOMIZE" options+=(3 "Randomizer options (currently: ${ini_value^})") else options+=(2 "Show splashscreen on boot (currently: Disabled)") fi options+=( 4 "Use default splashscreen" 5 "Manually edit splashscreen list" 6 "Append splashscreen to list (for multiple entries)" 7 "Preview splashscreens" 8 "Update RetroPie splashscreens" 9 "Download RetroPie-Extra splashscreens" ) iniConfig "=" '"' "$configdir/all/$md_id.cfg" iniGet "DURATION" # default splashscreen duration is 12 seconds local duration=${ini_value:-12} options+=( A "Configure image splashscreen duration ($duration sec)" ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) set_append_splashscreen set ;; 2) if [[ "$enabled" -eq 1 ]]; then disable_splashscreen printMsgs "dialog" "Disabled splashscreen on boot." else [[ ! -f /etc/splashscreen.list ]] && rp_callModule splashscreen default enable_splashscreen printMsgs "dialog" "Enabled splashscreen on boot." fi ;; 3) randomize_splashscreen ;; 4) iniSet "RANDOMIZE" "disabled" default_splashscreen enable_splashscreen printMsgs "dialog" "Splashscreen set to RetroPie default." ;; 5) editFile /etc/splashscreen.list ;; 6) set_append_splashscreen append ;; 7) preview_splashscreen ;; 8) rp_callModule splashscreen install ;; 9) rp_callModule splashscreen download_extra printMsgs "dialog" "The RetroPie-Extra splashscreens have been downloaded to $datadir/splashscreens/retropie-extra" ;; A) duration=$(dialog --title "Splashscreen duration" --clear --rangebox "Configure how many seconds the splashscreen is active" 0 60 5 100 $duration 2>&1 >/dev/tty) if [[ -n "$duration" ]]; then iniSet "DURATION" "${duration//[^[:digit:]]/}" fi ;; esac else break fi done } ================================================ FILE: scriptmodules/supplementary/steamcontroller.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="steamcontroller" rp_module_desc="User-mode driver for Steam Controller" rp_module_help="Steam Controller Driver from https://github.com/C0rn3j/sc-controller" rp_module_licence="GPL2 https://raw.githubusercontent.com/C0rn3j/sc-controller/python3/LICENSE" rp_module_repo="git https://github.com/C0rn3j/sc-controller.git v0.5.4" rp_module_section="driver" function _update_hook_steamcontroller() { # remove the start command from the previous scriptmodule version if rp_isInstalled "$md_id"; then sed -i "/bin\/sc-.*.py/d" /etc/rc.local fi } function depends_steamcontroller() { getDepends python3-virtualenv python3-dev python3-setuptools } function sources_steamcontroller() { gitPullOrClone } function install_steamcontroller() { # build the driver in a virtualenv created in $md_inst virtualenv -p python3 "$md_inst" source "$md_inst/bin/activate" pip3 install libusb1 evdev ioctl_opt pip3 install "sccontroller @ file://$md_build" deactivate # copy the default controller profiles md_ret_files=("default_profiles") } function enable_steamcontroller() { local profile="$1" [[ -z "$profile" ]] && profile="XBox Controller" disable_steamcontroller cat > /etc/systemd/system/sc-controller.service << _EOF_ [Unit] Description=Userspace Steamcontroller driver [Service] ExecStart="$md_inst/bin/scc-daemon" "$md_inst/default_profiles/$profile.sccprofile" debug ExecStop="$md_inst/bin/scc-daemon" stop [Install] WantedBy=multi-user.target _EOF_ systemctl daemon-reload systemctl -q enable sc-controller.service systemctl start sc-controller.service printMsgs "dialog" "Steamcontroller enabled and started with profile:\n\n$profile" } function disable_steamcontroller() { # remove start commands from /etc/rc.local [[ -f "/etc/rc.local" ]] && sed -i "/bin\/scc-daemon.*start/d" /etc/rc.local if systemctl -q is-enabled sc-controller.service 2>/dev/null; then systemctl stop sc-controller.service systemctl -q disable sc-controller.service fi } function remove_steamcontroller() { disable_steamcontroller rm -f /etc/udev/rules.d/99-steam-controller.rules if [[ -f "/etc/systemd/system/sc-controller.service" ]]; then rm -f "/etc/systemd/system/sc-controller.service" systemctl daemon-reload fi } function configure_steamcontroller() { cat >/etc/udev/rules.d/99-steam-controller.rules <<_EOF_ # Steam controller keyboard/mouse mode SUBSYSTEM=="usb", ATTRS{idVendor}=="28de", GROUP="input", MODE="0660" # Valve HID devices over bluetooth hidraw KERNEL=="hidraw*", KERNELS=="*28de:*", MODE="0660", GROUP="input", TAG+="uaccess" # Steam controller gamepad mode KERNEL=="uinput", MODE="0660", GROUP="input", OPTIONS+="static_node=uinput" _EOF_ } function gui_steamcontroller() { local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option." 22 86 16) local options=( 1 "Enable Steamcontroller (Xbox controller mode)" 2 "Enable Steamcontroller (Desktop mouse/keyboard mode)" 3 "Disable Steamcontroller" ) while true; do local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) enable_steamcontroller "XBox Controller" ;; 2) enable_steamcontroller "Desktop" ;; 3) disable_steamcontroller printMsgs "dialog" "Steamcontroller service has been disabled" ;; esac else break fi done } ================================================ FILE: scriptmodules/supplementary/usbromservice/01_retropie_copyroms ================================================ #!/bin/bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # ## config / defaults user="USER" group="GROUP" home="$(eval echo ~$user)" rootdir="/opt/retropie" retropie_path="$home/RetroPie" usb_path="$UM_MOUNTPOINT/retropie" usb_path_from_rp="$usb_path/configs/from_retropie" usb_path_to_rp="$usb_path/configs/to_retropie" declare -A path_mapping # mapping from usb_path_to_rp/* to retropie location path_mapping["configs"]="$rootdir/configs" ## internals hook_name=${0##*/} ## functions function log() { logger -p user.$1 -t usbmount-"$hook_name"-[$$] -- "$2" } function log_cmd() { local ret local error error="$("$@" 2>&1 >/dev/null)" ret=$? [[ "$ret" -ne 0 ]] && log err "$* - returned $ret - $error" } ## some sanity checking if [[ -z "$UM_MOUNTPOINT" ]]; then log err "UM_MOUNTPOINT not set!" exit 0 fi if [[ ! -d "$UM_MOUNTPOINT" ]]; then log err "UM_MOUNTPOINT is not a directory" exit 0 fi # make sure we have something to sync from if [[ ! -d "$usb_path" ]]; then exit 0 fi # make folders for syncing mkdir -p "$usb_path/"{roms,BIOS} "$usb_path_from_rp" "$usb_path_to_rp" # mirror romdir structure to external drive log info "Attempting to create directory structure for ROMS in '$usb_path/roms' ..." # fetch list of romdirs from current installation and mirror onto external drive find "$retropie_path/roms" -mindepth 1 -maxdepth 1 -type d -printf "$usb_path/roms/%f\n" | xargs mkdir -p 2>/dev/null || true # copy ROMs/BIOS from USB stick to local SD card for dir in roms BIOS; do log info "Syncing $dir ..." log_cmd rsync -rtu --exclude '._*' --max-delete=-1 "$usb_path/$dir" "$retropie_path/" chown -R "$user":"$group" "$retropie_path/$dir" done log info "Syncing configs ..." # copy configs to usb for to in "${!path_mapping[@]}"; do from=${path_mapping[$to]} log_cmd rsync -rtu --exclude '._*' --max-delete=-1 "$from/" "$usb_path_from_rp/$to/" done # copy configs from usb for from in $(find "$usb_path_to_rp/" -mindepth 1 -maxdepth 1); do # basename from_bn=${from##*/} to=${path_mapping[$from_bn]} if [[ -n "$to" ]]; then log_cmd rsync -rtu --exclude '._*' --max-delete=-1 "$from/" "$to/" chown -R "$user":"$group" "$to" fi done # unmount USB stick umount "$UM_MOUNTPOINT" ================================================ FILE: scriptmodules/supplementary/usbromservice/10_retropie_mount ================================================ #!/bin/bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # ## config / defaults user="USER" home="$(eval echo ~$user)" retropie_path="$home/RetroPie" usb_path="$UM_MOUNTPOINT/retropie-mount" ## internals hook_name=${0##*/} ## functions function log() { logger -p user.$1 -t usbmount-"$hook_name"-[$$] -- "$2" } function log_cmd() { local ret local error error="$("$@" 2>&1 >/dev/null)" ret=$? [[ "$ret" -ne 0 ]] && log err "$* - returned $ret - $error" } ## some sanity checking if [[ -z "$UM_MOUNTPOINT" ]]; then log err "UM_MOUNTPOINT not set!" exit 0 fi if [[ ! -d "$UM_MOUNTPOINT" ]]; then log err "UM_MOUNTPOINT is not a directory" exit 0 fi # check for a retropie-mount folder if [[ ! -d "$usb_path" ]]; then exit 0 fi if [[ -z "$(ls -A "$usb_path")" ]]; then log info "Copying existing $retropie_path to $usb_path ..." log_cmd rsync -rtu "$retropie_path/" "$usb_path/" fi log info "Mounting $usb_path over $retropie_path ..." log_cmd mount -o bind "$usb_path" "$retropie_path" ================================================ FILE: scriptmodules/supplementary/usbromservice.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="usbromservice" rp_module_desc="USB ROM Service" rp_module_section="opt" function _get_ver_usbromservice() { echo 0.0.24 } function _update_hook_usbromservice() { ! rp_isInstalled "$md_id" && return [[ ! -f "$md_inst/disabled" ]] && install_scripts_usbromservice } function depends_usbromservice() { local depends=(rsync ntfs-3g exfat-fuse) if ! hasPackage usbmount $(_get_ver_usbromservice); then depends+=(debhelper devscripts pmount lockfile-progs) getDepends "${depends[@]}" gitPullOrClone "$md_build/usbmount" https://github.com/RetroPie/usbmount.git systemd cd "$md_build/usbmount" dpkg-buildpackage dpkg -i ../usbmount_*_all.deb rm -f ../usbmount_* fi } function install_bin_usbromservice() { [[ ! -f "$md_inst/disabled" ]] && install_scripts_usbromservice touch "$md_inst/installed" } function install_scripts_usbromservice() { # copy our mount.d scripts over local file local dest for file in "$md_data/"*; do dest="/etc/usbmount/mount.d/${file##*/}" sed -e "s/USER/$__user/g" -e "s/GROUP/$__group/g" "$file" >"$dest" chmod +x "$dest" done } function enable_usbromservice() { rm -f "$md_inst/disabled" install_scripts_usbromservice } function disable_usbromservice() { local file for file in "$md_data/"*; do file="/etc/usbmount/mount.d/${file##*/}" rm -f "$file" done [[ -d "$md_inst" ]] && touch "$md_inst/disabled" } function remove_usbromservice() { disable_usbromservice apt-get remove -y usbmount } function configure_usbromservice() { [[ "$md_mode" == "remove" ]] && return iniConfig "=" '"' /etc/usbmount/usbmount.conf local fs for fs in ntfs exfat; do iniGet "FILESYSTEMS" if [[ "$ini_value" != *$fs* ]]; then iniSet "FILESYSTEMS" "$ini_value $fs" fi done # set our mount options (usbmount has sync by default which we don't want) iniSet "MOUNTOPTIONS" "nodev,noexec,noatime" # set per filesystem mount options local options="uid=$(id -u $__user),gid=$(id -g $__user)" local fs_options local fs for fs in vfat hfsplus ntfs exfat; do fs_options+=("-fstype=${fs},${options}") done iniSet "FS_MOUNTOPTIONS" "${fs_options[*]}" } function gui_usbromservice() { local cmd local options local choice while true; do cmd=(dialog --backtitle "$__backtitle" --menu "Choose from an option below." 22 86 16) options=( 1 "Enable USB ROM Service scripts" 2 "Disable USB ROM Service scripts" ) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) rp_callModule "$md_id" depends rp_callModule "$md_id" enable printMsgs "dialog" "Enabled $md_desc" ;; 2) rp_callModule "$md_id" disable printMsgs "dialog" "Disabled $md_desc" ;; esac else break fi done } ================================================ FILE: scriptmodules/supplementary/virtualgamepad.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="virtualgamepad" rp_module_desc="Virtual Gamepad for Smartphone" rp_module_licence="MIT https://raw.githubusercontent.com/miroof/node-virtual-gamepads/master/LICENSE" rp_module_repo="git https://github.com/miroof/node-virtual-gamepads.git master" rp_module_section="exp" rp_module_flags="noinstclean nobin" function depends_virtualgamepad() { getDepends nodejs npm } function remove_virtualgamepad() { pm2 stop main pm2 delete main rm -f /etc/apt/sources.list.d/nodesource.list } function sources_virtualgamepad() { gitPullOrClone "$md_inst" chown -R "$__user":"$__group" "$md_inst" } function install_virtualgamepad() { npm install pm2 -g --unsafe-perm cd "$md_inst" sudo -u "$__user" npm install sudo -u "$__user" npm install ref } function configure_virtualgamepad() { [[ "$md_mode" == "remove" ]] && return pm2 start main.js pm2 startup pm2 save } ================================================ FILE: scriptmodules/supplementary/wifi.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="wifi" rp_module_desc="Configure WiFi" rp_module_section="config" rp_module_flags="!x11" function _get_interface_wifi() { local iface # look for the first wireless interface present for iface in /sys/class/net/*; do if [[ -d "$iface/wireless" ]]; then echo "$(basename $iface)" return 0 fi done return 1 } function _get_mgmt_tool_wifi() { # get the WiFi connection manager if systemctl -q is-active NetworkManager.service; then echo "nm" else echo "wpasupplicant" fi } function _set_interface_wifi() { local iface="$1" local state="$2" if [[ "$state" == "up" ]]; then if ! ifup $iface; then ip link set $iface up fi elif [[ "$state" == "down" ]]; then if ! ifdown $iface; then ip link set $iface down fi fi } function remove_nm_wifi() { local iface="$1" # delete the NM connection named RetroPie-WiFi nmcli connection delete RetroPie-WiFi _set_interface_wifi $iface down 2>/dev/null } function remove_wpasupplicant_wifi() { local iface="$1" sed -i '/RETROPIE CONFIG START/,/RETROPIE CONFIG END/d' "/etc/wpa_supplicant/wpa_supplicant.conf" _set_interface_wifi $iface down 2>/dev/null } function list_wifi() { local line local essid local type local iface="$1" while read line; do [[ "$line" =~ ^Cell && -n "$essid" ]] && echo -e "$essid\n$type" [[ "$line" =~ ^ESSID ]] && essid=$(echo "$line" | cut -d\" -f2) [[ "$line" == "Encryption key:off" ]] && type="open" [[ "$line" == "Encryption key:on" ]] && type="wep" [[ "$line" =~ ^IE:.*WPA ]] && type="wpa" done < <(iwlist $iface scan | grep -o "Cell .*\|ESSID:\".*\"\|IE: .*WPA\|Encryption key:.*") echo -e "$essid\n$type" } function connect_wifi() { local iface local mgmt_tool="wpasupplicant" iface="$(_get_interface_wifi)" if [[ -z "$iface" ]]; then printMsgs "dialog" "No wireless interfaces detected" return 1 fi mgmt_tool="$(_get_mgmt_tool_wifi)" local essids=() local essid local types=() local type local options=() i=0 _set_interface_wifi $iface up 2>/dev/null dialog --infobox "\nScanning for WiFi networks..." 5 40 > /dev/tty sleep 1 while read essid; read type; do essids+=("$essid") types+=("$type") options+=("$i" "$essid") ((i++)) done < <(list_wifi $iface) options+=("H" "Hidden ESSID") local cmd=(dialog --backtitle "$__backtitle" --menu "Please choose the WiFi network you would like to connect to" 22 76 16) choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && return local hidden=0 if [[ "$choice" == "H" ]]; then essid=$(inputBox "ESSID" "" 4) [[ -z "$essid" ]] && return cmd=(dialog --backtitle "$__backtitle" --nocancel --menu "Please choose the WiFi type" 12 40 6) options=( wpa "WPA/WPA2" wep "WEP" open "Open" ) type=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) hidden=1 else essid=${essids[choice]} type=${types[choice]} fi if [[ "$type" == "wpa" || "$type" == "wep" ]]; then local key="" local key_min if [[ "$type" == "wpa" ]]; then key_min=8 else key_min=5 fi cmd=(inputBox "WiFi key/password" "" $key_min) local key_ok=0 while [[ $key_ok -eq 0 ]]; do key=$("${cmd[@]}") || return key_ok=1 done fi create_${mgmt_tool}_config_wifi "$type" "$essid" "$key" "$iface" gui_connect_wifi "$iface" } function create_nm_config_wifi() { local type="$1" local essid="$2" local key="$3" local dev="$4" local con="RetroPie-WiFi" remove_nm_wifi nmcli connection add type wifi ifname "$dev" ssid "$essid" con-name "$con" autoconnect yes # configure security for the connection case $type in wpa) nmcli connection modify "$con" \ wifi-sec.key-mgmt wpa-psk \ wifi-sec.psk-flags 0 \ wifi-sec.psk "$key" ;; wep) nmcli connection modify "$con" \ wifi-sec.key-mgmt none \ wifi-sec.wep-key-flags 0 \ wifi-sec.wep-key-type 2 \ wifi-sec.wep-key0 "$key" ;; open) ;; esac [[ $hidden -eq 1 ]] && nmcli connection modify "$con" wifi.hidden yes } function create_wpasupplicant_config_wifi() { local type="$1" local essid="$2" local key="$3" local dev="$4" local wpa_config wpa_config+="\tssid=\"$essid\"\n" case $type in wpa) wpa_config+="\tpsk=\"$key\"\n" ;; wep) wpa_config+="\tkey_mgmt=NONE\n" wpa_config+="\twep_tx_keyidx=0\n" wpa_config+="\twep_key0=$key\n" ;; open) wpa_config+="\tkey_mgmt=NONE\n" ;; esac [[ $hidden -eq 1 ]] && wpa_config+="\tscan_ssid=1\n" remove_wpasupplicant_wifi wpa_config=$(echo -e "$wpa_config") cat >> "/etc/wpa_supplicant/wpa_supplicant.conf" <<_EOF_ # RETROPIE CONFIG START network={ $wpa_config } # RETROPIE CONFIG END _EOF_ } function gui_connect_wifi() { local iface="$1" local mgmt_tool mgmt_tool="$(_get_mgmt_tool_wifi)" _set_interface_wifi $iface down 2>/dev/null _set_interface_wifi $iface up 2>/dev/null if [[ "$mgmt_tool" == "wpasupplicant" ]]; then # BEGIN workaround for dhcpcd trigger failure on Raspbian stretch systemctl restart dhcpcd &>/dev/null # END workaround fi if [[ "$mgmt_tool" == "nm" ]]; then nmcli -w 0 connection up RetroPie-WiFi fi dialog --backtitle "$__backtitle" --infobox "\nConnecting ..." 5 40 >/dev/tty local id="" i=0 while [[ -z "$id" && $i -lt 30 ]]; do sleep 1 id=$(iwgetid -r) ((i++)) done if [[ -z "$id" ]]; then printMsgs "dialog" "Unable to connect to network $essid" _set_interface_wifi $iface down 2>/dev/null fi } function _check_country_wifi() { local country country="$(raspi-config nonint get_wifi_country)" if [[ -z "$country" ]]; then if dialog --defaultno --yesno "You don't currently have your WiFi country set.\n\nOn a Raspberry Pi 3B+ and later your WiFi will be disabled until the country is set. You can do this via raspi-config which is available from the RetroPie menu in Emulation Station. Once in raspi-config you can set your country via menu 5 (Localisation Options)\n\nDo you want me to launch raspi-config for you now ?" 22 76 2>&1 >/dev/tty; then raspi-config fi fi } function gui_wifi() { isPlatform "rpi" && _check_country_wifi local default local iface local mgmt_tool iface="$(_get_interface_wifi)" mgmt_tool="$(_get_mgmt_tool_wifi)" while true; do local ip_current="$(getIPAddress)" local ip_wlan="$(getIPAddress $iface)" local cmd=(dialog --backtitle "$__backtitle" --colors --cancel-label "Exit" --item-help --help-button --default-item "$default" --title "Configure WiFi" --menu "Current IP: \Zb${ip_current:-(unknown)}\ZB\nWireless IP: \Zb${ip_wlan:-(unknown)}\ZB\nWireless ESSID: \Zb$(iwgetid -r || echo "none")\ZB" 22 76 16) local options=( 1 "Connect to WiFi network" "1 Connect to your WiFi network" 2 "Disconnect/Remove WiFi config" "2 Disconnect and remove any WiFi configuration" 3 "Import WiFi credentials from wifikeyfile.txt" "3 Will import the SSID (network name) and PSK (password) from the 'wifikeyfile.txt' file on the boot partition The file should contain two lines as follows\n\nssid = \"YOUR WIFI SSID\"\npsk = \"YOUR PASSWORD\"" ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ "${choice[@]:0:4}" == "HELP" ]]; then choice="${choice[@]:5}" default="${choice/%\ */}" choice="${choice#* }" printMsgs "dialog" "$choice" continue fi default="$choice" if [[ -n "$choice" ]]; then case "$choice" in 1) connect_wifi $iface ;; 2) dialog --defaultno --yesno "This will remove the WiFi configuration and stop the WiFi.\n\nAre you sure you want to continue ?" 12 60 2>&1 >/dev/tty [[ $? -ne 0 ]] && continue remove_${mgmt_tool}_wifi $iface ;; 3) # check in `/boot/` (pre-bookworm) and `/boot/firmware` (bookworm and later) for the file local file="/boot/wifikeyfile.txt" [[ ! -f "$file" ]] && file="/boot/firmware/wifikeyfile.txt" if [[ -f "$file" ]]; then iniConfig " = " "\"" "$file" iniGet "ssid" local ssid="$ini_value" iniGet "psk" local psk="$ini_value" create_${mgmt_tool}_config_wifi "wpa" "$ssid" "$psk" "$iface" gui_connect_wifi "$iface" else printMsgs "dialog" "File 'wifikeyfile.txt' not found on the boot partition!" fi ;; esac else break fi done } ================================================ FILE: scriptmodules/supplementary/xarcade2jstick.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="xarcade2jstick" rp_module_desc="Xarcade2Jstick" rp_module_licence="GPL3 https://raw.githubusercontent.com/petrockblog/Xarcade2Jstick/master/gpl3.txt" rp_module_repo="git https://github.com/petrockblog/Xarcade2Joystick.git master" rp_module_section="driver" rp_module_flags="noinstclean" function sources_xarcade2jstick() { gitPullOrClone "$md_inst" } function build_xarcade2jstick() { cd "$md_inst" make } function install_xarcade2jstick() { cd "$md_inst" make install } function enable_xarcade2jstick() { cd "$md_inst" make installservice } function disable_xarcade2jstick() { cd "$md_inst" make uninstallservice } function remove_xarcade2jstick() { [[ -f /lib/systemd/system/xarcade2jstick.service ]] && disable_xarcade2jstick cd "$md_inst" make uninstall } function gui_xarcade2jstick() { local status local options=( 1 "Enable Xarcade2Jstick service." 2 "Disable Xarcade2Jstick service." ) while true; do status="Disabled" [[ -f /lib/systemd/system/xarcade2jstick.service ]] && status="Enabled" local cmd=(dialog --backtitle "$__backtitle" --menu "Service is currently: $status" 22 86 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) [[ -z "$choice" ]] && break case "$choice" in 1) enable_xarcade2jstick printMsgs "dialog" "Enabled Xarcade2Jstick." ;; 2) disable_xarcade2jstick printMsgs "dialog" "Disabled Xarcade2Jstick service." ;; esac done } ================================================ FILE: scriptmodules/supplementary/xboxdrv.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="xboxdrv" rp_module_desc="Xbox / Xbox 360 gamepad driver" rp_module_licence="GPL3 https://raw.githubusercontent.com/RetroPie/xboxdrv/stable/COPYING" rp_module_repo="git https://github.com/RetroPie/xboxdrv.git retropie-stable" rp_module_section="driver" function def_controllers_xboxdrv() { echo "2" } function def_deadzone_xboxdrv() { echo "4000" } function depends_xboxdrv() { getDepends libboost-dev libusb-1.0-0-dev libudev-dev libx11-dev scons pkg-config python3 x11proto-core-dev libdbus-glib-1-dev } function sources_xboxdrv() { gitPullOrClone } function build_xboxdrv() { python3 /usr/bin/scons } function install_xboxdrv() { make install PREFIX="$md_inst" } function enable_xboxdrv() { local controllers="$1" local deadzone="$2" [[ -z "$controllers" ]] && controllers="$(def_controllers_xboxdrv)" [[ -z "$deadzone" ]] && deadzone="$(def_deadzone_xboxdrv)" local config="\"$md_inst/bin/xboxdrv\" --daemon --detach --dbus disabled --detach-kernel-driver" local i for (( i=0; i<$controllers; i++)); do [[ $i -gt 0 ]] && config+=" --next-controller" config+=" --id $i --led $((i+2)) --deadzone $deadzone --silent --trigger-as-button" done # remove any previously start-up commands in /etc/rc.local [[ -f /etc/rc.local ]] && sed -i "/xboxdrv/d" /etc/rc.local cat > /etc/systemd/system/xboxdrv.service << _EOF_ [Unit] Description=Userspace Xbox gamepad driver and input remapper ConditionPathExists=$md_inst/bin/xboxdrv [Service] Type=forking PIDFile=/run/xboxdrv.pid ExecStart=$config --pid-file /run/xboxdrv.pid [Install] WantedBy=multi-user.target _EOF_ systemctl daemon-reload systemctl -q start xboxdrv systemctl enable xboxdrv printMsgs "dialog" "xboxdrv has been enabled and started" } function disable_xboxdrv() { [[ -f /etc/rc.local ]] && sed -i "/xboxdrv/d" /etc/rc.local systemctl -q is-enabled xboxdrv 2>/dev/null && systemctl disable xboxdrv systemctl -q is-active xboxdrv 2>/dev/null && systemctl stop xboxdrv printMsgs "dialog" "xboxdrv auto-start has been disabled" } function controllers_xboxdrv() { local controllers="$1" [[ -z "$controllers" ]] && controllers="$(def_controllers_xboxdrv)" local cmd=(dialog --backtitle "$__backtitle" --default-item "$controllers" --menu "Select the number of controllers to enable" 22 86 16) local options=( 1 "1 controller" 2 "2 controllers" 3 "3 controllers" 4 "4 controllers" ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then controllers="$choice" fi echo "$controllers" } function deadzone_xboxdrv() { local deadzone="$1" [[ -z "$deadzone" ]] && deadzone="$(def_deadzone_xboxdrv)" local zones=() local options=() local i local label local default for i in {0..12}; do zones[i]=$((i*500)) [[ ${zones[i]} -eq $deadzone ]] && default=$i label="0-${zones[i]}" [[ "$i" -eq 0 ]] && label="No Deadzone" options+=($i "$label") done local cmd=(dialog --backtitle "$__backtitle" --default-item "$default" --menu "Select range of your analog stick deadzone" 22 86 16) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then deadzone="${zones[$choice]}" fi echo "$deadzone" } function remove_xboxdrv() { disable_xboxdrv if [[ -f "/etc/systemd/system/xboxdrv.service" ]]; then rm -f "/etc/systemd/system/xboxdrv.service" systemctl daemon-reload fi } function gui_xboxdrv() { if [[ ! -f "$md_inst/bin/xboxdrv" ]]; then if [[ $__has_binaries -eq 1 ]]; then rp_callModule "$md_id" depends rp_callModule "$md_id" install_bin else rp_callModule "$md_id" fi fi local controllers="$(def_controllers_xboxdrv)" local deadzone="$(def_deadzone_xboxdrv)" local is_enabled="disabled" local operation="Enable" systemctl -q is-enabled xboxdrv && is_enabled="enabled" && operation="Disable" local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option." 22 86 16) while true; do local options=( 1 "$operation xboxdrv (currently: $is_enabled)" 2 "Set number of controllers to enable (currently $controllers)" 3 "Set analog stick deadzone (currently $deadzone)" ) local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) if [[ -n "$choice" ]]; then case "$choice" in 1) if [[ $is_enabled == "disabled" ]]; then enable_xboxdrv "$controllers" "$deadzone" else disable_xboxdrv fi ;; 2) controllers=$(controllers_xboxdrv $controllers) ;; 3) deadzone=$(deadzone_xboxdrv $deadzone) ;; esac else break fi done } ================================================ FILE: scriptmodules/supplementary/xpad/01_enable_leds_and_trigmapping.diff ================================================ --- a/xpad.c 2018-08-22 14:49:37.237360461 +0000 +++ b/xpad.c 2018-08-22 14:49:37.293357132 +0000 @@ -86,6 +86,8 @@ #define XPAD_PKT_LEN 64 +#define CONFIG_JOYSTICK_XPAD_LEDS 1 + /* * xbox d-pads should map to buttons, as is required for DDR pads * but we map them to axes when possible to simplify things @@ -1782,12 +1784,13 @@ if (dpad_to_buttons) xpad->mapping |= MAP_DPAD_TO_BUTTONS; - if (triggers_to_buttons) - xpad->mapping |= MAP_TRIGGERS_TO_BUTTONS; if (sticks_to_null) xpad->mapping |= MAP_STICKS_TO_NULL; } + if (triggers_to_buttons) + xpad->mapping |= MAP_TRIGGERS_TO_BUTTONS; + if (xpad->xtype == XTYPE_XBOXONE && intf->cur_altsetting->desc.bInterfaceNumber != 0) { /* ================================================ FILE: scriptmodules/supplementary/xpad/02_dkms_updates_folder.diff ================================================ diff --git a/dkms.conf b/dkms.conf index 58a1ac2..b56b148 100644 --- a/dkms.conf +++ b/dkms.conf @@ -2,6 +2,6 @@ PACKAGE_NAME="xpad" PACKAGE_VERSION="0.4" MAKE[0]="make KVERSION=$kernelver" CLEAN="make clean" -DEST_MODULE_LOCATION[0]="/extra" +DEST_MODULE_LOCATION[0]="/updates" BUILT_MODULE_NAME[0]="xpad" AUTOINSTALL="yes" ================================================ FILE: scriptmodules/supplementary/xpad/03_xpad_add_version.diff ================================================ diff --git a/xpad.c b/xpad.c index 43985dd..8ea2991 100644 @@ -2497,3 +2500,4 @@ module_usb_driver(xpad_driver); MODULE_AUTHOR("Marko Friedemann "); MODULE_DESCRIPTION("X-Box pad driver"); MODULE_LICENSE("GPL"); +MODULE_VERSION("0.4"); ================================================ FILE: scriptmodules/supplementary/xpad.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="xpad" rp_module_desc="Updated Xpad Linux Kernel driver" rp_module_help="This is the latest Xpad driver from https://github.com/paroj/xpad\n\nThe driver has been patched to allow the triggers to map to buttons for any controller and this has been enabled by default.\n\nThis fixes mapping the triggers in Emulation Station.\n\nIf you want the previous trigger behaviour please edit /etc/modprobe.d/xpad.conf and set triggers_to_buttons=0" rp_module_licence="GPL2 https://www.kernel.org/pub/linux/kernel/COPYING" rp_module_repo="git https://github.com/paroj/xpad.git master" rp_module_section="driver" rp_module_flags="noinstclean !mali" function _version_xpad() { echo "0.4" } function depends_xpad() { local depends=(dkms LINUX-HEADERS) getDepends "${depends[@]}" } function sources_xpad() { rm -rf "$md_inst" gitPullOrClone "$md_inst" cd "$md_inst" # LED support (as disabled currently in packaged RPI kernel) and allow forcing MAP_TRIGGERS_TO_BUTTONS applyPatch "$md_data/01_enable_leds_and_trigmapping.diff" # Tell 'dkms' to use the 'updates' kernel module folder to store the module applyPatch "$md_data/02_dkms_updates_folder.diff" # Force a module version, otherwise 'dkms' refuses to override the built-in module if ! grep -q MODULE_VERSION xpad.c; then applyPatch "$md_data/03_xpad_add_version.diff" fi } function build_xpad() { dkmsManager install xpad "$(_version_xpad)" } function remove_xpad() { dkmsManager remove xpad "$(_version_xpad)" } function configure_xpad() { [[ "$md_mode" == "remove" ]] && return dkmsManager reload xpad "$(_version_xpad)" } ================================================ FILE: scriptmodules/supplementary/xpadneo.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="xpadneo" rp_module_desc="Advanced Linux driver for Xbox One wireless gamepads" rp_module_licence="GPL3 https://raw.githubusercontent.com/atar-axis/xpadneo/master/LICENSE" rp_module_repo="git https://github.com/atar-axis/xpadneo.git :_version_xpadneo" rp_module_section="driver" rp_module_flags="nobin" function _version_xpadneo() { local build_version=v0.10 # buster and eariler get the v0.9.x version, due to v0.10 needing a newer Linux kernel [[ "$__os_debian_ver" -lt 11 ]] && build_version=v0.9.8 echo "$build_version" } function depends_xpadneo() { local depends=(dkms rsync LINUX-HEADERS) getDepends "${depends[@]}" } function sources_xpadneo() { gitPullOrClone rsync -a --delete "$md_build/hid-xpadneo/" "$md_inst/" cp "$md_build/VERSION" "$md_inst/" local version="$(_version_xpadneo)" sed "s/@DO_NOT_CHANGE@/$version/g" "$md_inst/dkms.conf.in" > "$md_inst/dkms.conf" } function build_xpadneo() { dkmsManager install hid-xpadneo "$(_version_xpadneo)" } function remove_xpadneo() { dkmsManager remove hid-xpadneo "$(_version_xpadneo)" } function configure_xpadneo() { if [[ "$md_mode" == "remove" ]]; then rm -f /etc/modprobe.d/xpadneo-rpie.conf return fi dkmsManager reload hid-xpadneo "$(_version_xpadneo)" # on v0.10 and later - disable shift mode key for the home/guide button local num_ver="$(_version_xpadneo | tr -d v)" if compareVersions "$num_ver" ge 0.10 && [[ ! -f "/etc/modprobe.d/xpadneo-rpie.conf" ]]; then echo "options hid-xpadneo disable_shift_mode=1" > /etc/modprobe.d/xpadneo-rpie.conf fi } ================================================ FILE: scriptmodules/system.sh ================================================ #!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # function setup_env() { __ERRMSGS=() __INFMSGS=() # if no apt-get we need to fail [[ -z "$(which apt-get)" ]] && fatalError "Unsupported OS - No apt-get command found" test_chroot get_platform get_os_version get_retropie_depends conf_memory_vars conf_binary_vars conf_build_vars if [[ -z "$__nodialog" ]]; then __nodialog=0 fi } function test_chroot() { # test if we are in a chroot if [[ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]]; then [[ -z "$QEMU_CPU" && -n "$__qemu_cpu" ]] && export QEMU_CPU=$__qemu_cpu __chroot=1 # detect the usage of systemd-nspawn elif [[ -n "$(systemd-detect-virt)" && "$(systemd-detect-virt)" == "systemd-nspawn" ]]; then __chroot=1 else __chroot=0 fi } function conf_memory_vars() { __memory_total_kb=$(awk '/^MemTotal:/{print $2}' /proc/meminfo) __memory_total=$(( __memory_total_kb / 1024 )) if grep -q "^MemAvailable:" /proc/meminfo; then __memory_avail_kb=$(awk '/^MemAvailable:/{print $2}' /proc/meminfo) else local mem_free=$(awk '/^MemFree:/{print $2}' /proc/meminfo) local mem_cached=$(awk '/^Cached:/{print $2}' /proc/meminfo) local mem_buffers=$(awk '/^Buffers:/{print $2}' /proc/meminfo) __memory_avail_kb=$((mem_free + mem_cached + mem_buffers)) fi __memory_avail=$(( __memory_avail_kb / 1024 )) } function conf_binary_vars() { [[ -z "$__has_binaries" ]] && __has_binaries=0 # set location of binary downloads __binary_host="files.retropie.org.uk" __binary_base_url="https://$__binary_host/binaries" __os_binaries="$__os_codename" # add -64 suffix for 64bit isPlatform "64bit" && __os_binaries+="-64" # add platform folder (eg. rpi4) __binary_path="$__os_binaries/$__platform" # add kms folder when building for kms drivers isPlatform "kms" && __binary_path+="/kms" __binary_url="$__binary_base_url/$__binary_path" __archive_url="https://files.retropie.org.uk/archives" # set the gpg key used by RetroPie __gpg_retropie_key="retropieproject@gmail.com" # if __gpg_signing_key is not set, set to __gpg_retropie_key [[ ! -v __gpg_signing_key ]] && __gpg_signing_key="$__gpg_retropie_key" # if the RetroPie public key is not installed, install it. if ! gpg --list-keys "$__gpg_retropie_key" &>/dev/null; then gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys DC9D77FF8208FFC51D8F50CCF1B030906A3B0D31 fi } function conf_build_vars() { __gcc_version=$(gcc -dumpversion) # extract only the major version # gcc -dumpversion on GCC >= 7 seems to provide the major version but the documentation # suggests this depends on how it's configured __gcc_version="${__gcc_version%%.*}" # calculate build concurrency based on cores and available memory __jobs=1 local unit=512 isPlatform "64bit" && unit=$(($unit + 256)) if [[ "$(nproc)" -gt 1 ]]; then local nproc="$(nproc)" # max one thread per unit (MB) of ram local max_jobs=$(($__memory_avail / $unit)) if [[ "$max_jobs" -gt 0 ]]; then if [[ "$max_jobs" -lt "$nproc" ]]; then __jobs="$max_jobs" else __jobs="$nproc" fi fi fi __default_makeflags="-j${__jobs}" # set our default gcc optimisation level if [[ -z "$__opt_flags" ]]; then __opt_flags="$__default_opt_flags" fi # set default cpu flags [[ -z "$__cpu_flags" ]] && __cpu_flags="$__default_cpu_flags" # if default cxxflags is empty, use our default cflags [[ -z "$__default_cxxflags" ]] && __default_cxxflags="$__default_cflags" # add our cpu and optimisation flags __default_cflags+=" $__cpu_flags $__opt_flags" __default_cxxflags+=" $__cpu_flags $__opt_flags" __default_asflags+=" $__cpu_flags" # if not overridden by user, configure our compiler flags [[ -z "$__cflags" ]] && __cflags="$__default_cflags" [[ -z "$__cxxflags" ]] && __cxxflags="$__default_cxxflags" [[ -z "$__asflags" ]] && __asflags="$__default_asflags" [[ -z "$__makeflags" ]] && __makeflags="$__default_makeflags" # workaround for GCC ABI incompatibility with threaded armv7+ C++ apps built # on Raspbian's armv6 userland https://github.com/raspberrypi/firmware/issues/491 if [[ "$__os_id" == "Raspbian" ]] && compareVersions $__gcc_version lt 5; then __cxxflags+=" -U__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2" fi # export our compiler flags so all child processes can see them export CFLAGS="$__cflags" export CXXFLAGS="$__cxxflags" export ASFLAGS="$__asflags" export MAKEFLAGS="$__makeflags" # if __use_ccache is set, then add ccache to PATH/MAKEFLAGS if [[ "$__use_ccache" -eq 1 ]]; then PATH="/usr/lib/ccache:$PATH" MAKEFLAGS+=" PATH=$PATH" fi } function get_os_version() { # make sure lsb_release is installed getDepends lsb-release # get os distributor id, description, release number and codename local os # armbian uses a minimal shell script replacement for lsb_release with basic # parameter parsing that requires the arguments split rather than using -sidrc mapfile -t os < <(lsb_release -s -i -d -r -c) __os_id="${os[0]}" __os_desc="${os[1]}" __os_release="${os[2]}" __os_codename="${os[3]}" local error="" case "$__os_id" in Raspbian|Debian|Bunsenlabs) # get major version (8 instead of 8.0 etc) __os_debian_ver="${__os_release%%.*}" # Debian unstable is not officially supported though if [[ "$__os_release" == "unstable" ]]; then __os_debian_ver=14 fi # we still allow Raspbian 8 (jessie) to work (We show an popup in the setup module) if [[ "$__os_debian_ver" -lt 8 ]]; then error="You need Raspbian/Debian Stretch or newer" fi # 64bit Raspberry Pi OS identifies as Debian, but functions (currently) as Raspbian # we will check package sources and set to Raspbian if isPlatform "aarch64" && apt-cache policy | grep -qE "archive.raspberrypi.(com|org)"; then __os_id="Raspbian" fi # set a platform flag for osmc if grep -q "ID=osmc" /etc/os-release; then __platform_flags+=(osmc) fi # and for xbian if grep -q "NAME=XBian" /etc/os-release; then __platform_flags+=(xbian) fi # if __has_binaries is not set, and we are on the Raspberry Pi, check if we support binaries if [[ -z "$__has_binaries" ]] && isPlatform "rpi"; then # we currently support 32bit binaries on Raspberry Pi OS 10 & 11 and both 32/64bit binaries on Raspberry Pi OS 12 if ([[ "$__os_debian_ver" -ge 10 && "$__os_debian_ver" -le 11 ]] && isPlatform "32bit") \ || [[ "$__os_debian_ver" -eq 12 ]]; then __has_binaries=1 fi fi ;; Devuan) if isPlatform "rpi"; then error="We do not support Devuan on the Raspberry Pi. We recommend you use Raspbian to run RetroPie." fi # devuan lsb-release version numbers don't match jessie case "$__os_codename" in jessie) __os_debian_ver="8" ;; ascii) __os_debian_ver="9" ;; beowolf) __os_debian_ver="10" ;; ceres) __os_debian_ver="11" ;; esac ;; LinuxMint|Linuxmint) if [[ "$__os_desc" != LMDE* ]]; then if compareVersions "$__os_release" lt 18; then error="You need Linux Mint 18 or newer" elif compareVersions "$__os_release" lt 19; then __os_ubuntu_ver="16.04" __os_debian_ver="8" elif compareVersions "$__os_release" lt 20; then __os_ubuntu_ver="18.04" __os_debian_ver="10" elif compareVersions "$__os_release" lt 21; then __os_ubuntu_ver="20.04" __os_debian_ver="10" elif compareVersions "$__os_release" lt 22; then __os_ubuntu_ver="22.04" __os_debian_ver="11" else __os_ubuntu_ver="24.04" __os_debian_ver="12" fi fi if [[ "$__os_desc" == LMDE* ]]; then if compareVersions "$__os_release" lt 4; then error="You need Linux Mint Debian Edition 4 or newer" elif compareVersions "$__os_release" lt 5; then __os_debian_ver="10" elif compareVersions "$__os_release" lt 6; then __os_debian_ver="11" else __os_debian_ver="12" fi fi ;; Ubuntu|[Nn]eon|Pop) if compareVersions "$__os_release" lt 16.04; then error="You need Ubuntu 16.04 or newer" # although ubuntu 16.04/16.10 report as being based on stretch it is before some # packages were changed - we map to version 8 to avoid issues (eg libpng-dev name) elif compareVersions "$__os_release" le 16.10; then __os_debian_ver="8" elif compareVersions "$__os_release" lt 18.04; then __os_debian_ver="9" elif compareVersions "$__os_release" lt 20.04; then __os_debian_ver="10" elif compareVersions "$__os_release" lt 22.10; then __os_debian_ver="11" else __os_debian_ver="12" fi __os_ubuntu_ver="$__os_release" ;; Zorin) if compareVersions "$__os_release" lt 14; then error="You need Zorin OS 14 or newer" elif compareVersions "$__os_release" lt 14; then __os_debian_ver="8" else __os_debian_ver="9" fi __os_ubuntu_ver="$__os_release" ;; Deepin) if compareVersions "$__os_release" lt 15.5; then error="You need Deepin OS 15.5 or newer" fi __os_debian_ver="9" ;; [eE]lementary) if compareVersions "$__os_release" lt 0.4; then error="You need Elementary OS 0.4 or newer" elif compareVersions "$__os_release" eq 0.4; then __os_ubuntu_ver="16.04" __os_debian_ver="8" else __os_ubuntu_ver="18.04" __os_debian_ver="10" fi ;; Kali) __os_debian_ver="12" ;; *) error="Unsupported OS" ;; esac [[ -n "$error" ]] && fatalError "$error\n\n$(lsb_release -idrc)" # check for Armbian, which can be built on Debian/Ubuntu if [[ -f /etc/armbian-release ]]; then __platform_flags+=("armbian") fi # configure Raspberry Pi graphics stack isPlatform "rpi" && get_rpi_video } function get_retropie_depends() { local depends=(git gpg subversion dialog curl gcc g++ build-essential unzip xmlstarlet python3-pyudev ca-certificates dirmngr) # on RaspiOS, install an extra package for X11 support on Pi5 if isPlatform "rpi5" && [[ "$__os_id" == "Raspbian" ]]; then depends+=(gldriver-test) fi [[ -n "$DISTCC_HOSTS" ]] && depends+=(distcc) [[ "$__use_ccache" -eq 1 ]] && depends+=(ccache) if ! getDepends "${depends[@]}"; then fatalError "Unable to install packages required by $0 - ${md_ret_errors[@]}" fi # make sure we don't have xserver-xorg-legacy installed as it breaks launching x11 apps from ES if ! isPlatform "x11" && hasPackage "xserver-xorg-legacy"; then aptRemove xserver-xorg-legacy fi } function get_rpi_video() { local pkgconfig="/opt/vc/lib/pkgconfig" if [[ -z "$__has_kms" ]]; then if [[ "$__chroot" -eq 1 ]]; then # in chroot, use kms by default for rpi4 or Debian 11 (bullseye) or newer if isPlatform "rpi4" || [[ "$__os_debian_ver" -ge 11 ]]; then __has_kms=1 fi else # detect driver via inserted module / platform driver setup [[ -d "/sys/module/vc4" ]] && __has_kms=1 fi fi if [[ "$__has_kms" -eq 1 ]]; then __platform_flags+=(mesa kms) if ! isPlatform "aarch64" && [[ -z "$__has_dispmanx" ]]; then if [[ "$__chroot" -eq 1 ]]; then # in a chroot default to fkms (supporting dispmanx) when debian is older than 11 (bullseye) [[ "$__os_debian_ver" -lt 11 ]] && __has_dispmanx=1 else # if running fkms driver, add dispmanx flag [[ "$(ls -A /sys/bus/platform/drivers/vc4_firmware_kms/*.firmwarekms 2>/dev/null)" ]] && __has_dispmanx=1 fi fi [[ "$__has_dispmanx" -eq 1 ]] && __platform_flags+=(dispmanx) else __platform_flags+=(videocore) if ! isPlatform "aarch64"; then __platform_flags+=(dispmanx) fi fi # delete legacy pkgconfig that conflicts with Mesa (may be installed via rpi-update) # see: https://github.com/raspberrypi/userland/pull/585 rm -rf $pkgconfig/{egl.pc,glesv2.pc,vg.pc} # set pkgconfig path for vendor libraries export PKG_CONFIG_PATH="$pkgconfig" } function get_rpi_model() { # calculated based on the information from https://github.com/AndrewFromMelbourne/raspberry_pi_revision # see also https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#raspberry-pi-revision-codes local rev="0x$(sed -n '/^Revision/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo)" # if bit 23 is not set, we are on a rpi1 (bit 23 means the revision is a bitfield) if [[ $((($rev >> 23) & 1)) -eq 0 ]]; then __platform="rpi1" else # if bit 23 is set, get the cpu from bits 12-15 local cpu=$((($rev >> 12) & 15)) case $cpu in 0) __platform="rpi1" ;; 1) __platform="rpi2" ;; 2) __platform="rpi3" ;; 3) __platform="rpi4" ;; 4) __platform="rpi5" ;; esac fi } function get_platform() { local architecture="$(uname --machine)" if [[ -z "$__platform" ]]; then case "$(sed -n '/^Hardware/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo)" in BCM*) # RPI kernels before 2023-11-24 print a 'Hardware: BCM2835' line get_rpi_model ;; *ODROIDC) __platform="odroid-c1" ;; *ODROID-C2) __platform="odroid-c2" ;; "Freescale i.MX6 Quad/DualLite (Device Tree)") __platform="imx6" ;; *ODROID-XU[34]) __platform="odroid-xu" ;; "Rockchip (Device Tree)") __platform="tinker" ;; Vero4K|Vero4KPlus) __platform="vero4k" ;; "Allwinner sun8i Family") __platform="armv7-mali" ;; *) # jetsons can be identified by device tree or soc0/family (depending on the L4T version used) # refer to the nv.sh script in the L4T DTS for a similar implementation if [[ -e "/proc/device-tree/compatible" ]]; then case "$(tr -d '\0' < /proc/device-tree/compatible)" in *raspberrypi*) get_rpi_model ;; *odroid-xu[3|4]*) __platform="odroid-xu" ;; *tegra186*) __platform="tegra-x2" ;; *tegra210*) __platform="tegra-x1" ;; *tegra194*) __platform="xavier" ;; *rockpro64*) __platform="rockpro64" ;; *imx6dl*) __platform="imx6" ;; *imx6q*) __platform="imx6" ;; *imx8mm*) __platform="imx8mm" ;; *rk3588*) __platform="rk3588" ;; esac elif [[ -e "/sys/devices/soc0/family" ]]; then case "$(tr -d '\0' < /sys/devices/soc0/family)" in *tegra30*) __platform="tegra-3" ;; *tegra114*) __platform="tegra-4" ;; *tegra124*) __platform="tegra-k1-32" ;; *tegra132*) __platform="tegra-k1-64" ;; *tegra210*) __platform="tegra-x1" ;; esac else __platform="$architecture" fi ;; esac fi # check if we wish to target kms for platform if [[ -z "$__has_kms" ]]; then iniConfig " = " '"' "$configdir/all/retropie.cfg" iniGet "force_kms" [[ "$ini_value" == 1 ]] && __has_kms=1 [[ "$ini_value" == 0 ]] && __has_kms=0 fi set_platform_defaults # if we have a function for the platform, call it, otherwise use the default "native" one. if fnExists "platform_${__platform}"; then platform_${__platform} else platform_native fi } function set_platform_defaults() { __default_opt_flags="-O2" # add platform name and 32bit/64bit to platform flags __platform_flags=("$__platform" "$(getconf LONG_BIT)bit") __platform_arch=$(uname -m) } function cpu_arm1176() { __default_cpu_flags="-mcpu=arm1176jzf-s -mfpu=vfp" __platform_flags+=(arm armv6) __qemu_cpu=arm1176 } function cpu_armv7() { local cpu="$1" if [[ -n "$cpu" ]]; then __default_cpu_flags="-mcpu=$cpu -mfpu=neon-vfpv4" else __default_cpu_flags="-march=armv7-a -mfpu=neon-vfpv4" cpu="cortex-a7" fi __platform_flags+=(arm armv7 neon) __qemu_cpu="$cpu" } function cpu_armv8() { local cpu="$1" __default_cpu_flags="-mcpu=$cpu" if isPlatform "32bit"; then __default_cpu_flags+=" -mfpu=neon-fp-armv8" __platform_flags+=(arm armv8 neon) else __platform_flags+=(aarch64) fi __qemu_cpu="$cpu" } function cpu_arm_state() { if isPlatform "32bit"; then __default_cpu_flags+=" -marm" fi } function platform_conf_glext() { # required for mali-fbdev headers to define GL functions __default_cflags="-DGL_GLEXT_PROTOTYPES" } function platform_rpi1() { cpu_arm1176 __platform_flags+=(rpi gles) } function platform_rpi2() { cpu_armv7 "cortex-a7" __platform_flags+=(rpi gles) } function platform_rockpro64() { cpu_armv8 "cortex-a53" __platform_flags+=(gles kms) } function platform_rpi3() { cpu_armv8 "cortex-a53" __platform_flags+=(rpi gles) } function platform_rpi4() { cpu_armv8 "cortex-a72" __platform_flags+=(rpi gles gles3 gles31) } function platform_rpi5() { cpu_armv8 "cortex-a76" __platform_flags+=(rpi gles gles3 gles31) } function platform_odroid-c1() { cpu_armv7 "cortex-a5" cpu_arm_state __platform_flags+=(mali gles) } function platform_odroid-c2() { cpu_armv8 "cortex-a72" cpu_arm_state __platform_flags+=(mali gles) } function platform_odroid-xu() { cpu_armv7 "cortex-a7" cpu_arm_state platform_conf_glext __platform_flags+=(mali gles) } function platform_tegra-x1() { cpu_armv8 "cortex-a57+crypto" __platform_flags+=(x11 gl vulkan) } function platform_tegra-x2() { cpu_armv8 "cortex-a57+crypto" __platform_flags+=(x11 gl vulkan) } function platform_xavier() { cpu_armv8 "native" __platform_flags+=(x11 gl vulkan) } function platform_tegra-3() { cpu_armv7 "cortex-a9" __platform_flags+=(x11 gles vulkan) } function platform_tegra-4() { cpu_armv7 "cortex-a15" __platform_flags+=(x11 gles vulkan) } function platform_tegra-k1-32() { cpu_armv7 "cortex-a15" __platform_flags+=(x11 gl vulkan) } function platform_tegra-k1-64() { cpu_armv8 "native" __platform_flags+=(x11 gl vulkan) } function platform_tinker() { cpu_armv7 "cortex-a17" cpu_arm_state platform_conf_glext __platform_flags+=(kms gles) } function platform_native() { __default_cpu_flags="-march=native" __platform_flags+=(gl vulkan) if [[ "$__has_kms" -eq 1 ]]; then __platform_flags+=(kms) else __platform_flags+=(x11) fi # add x86 platform flag for x86/x86_64 archictures. [[ "$__platform_arch" =~ (i386|i686|x86_64) ]] && __platform_flags+=(x86) } function platform_armv7-mali() { cpu_armv7 __platform_flags+=(mali gles) } function platform_imx6() { cpu_armv7 "cortex-a9" [[ -d /sys/class/drm/card0/device/driver/etnaviv ]] && __platform_flags+=(x11 gles mesa) } function platform_imx8mm() { cpu_armv8 "cortex-a53" __platform_flags+=(x11 gles) [[ -d /sys/class/drm/card0/device/driver/etnaviv ]] && __platform_flags+=(mesa) } function platform_rk3588() { cpu_armv8 "cortex-a76.cortex-a55" __platform_flags+=(x11 gles gles3 gles32) } function platform_vero4k() { cpu_armv7 "cortex-a7" __default_cflags="-I/opt/vero3/include -L/opt/vero3/lib" __platform_flags+=(mali gles) }