Advertisement
Guest User

Untitled

a guest
Mar 4th, 2020
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.50 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # This file is part of The RetroPie Project
  4. #
  5. # The RetroPie Project is the legal property of its developers, whose names are
  6. # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source.
  7. #
  8. # See the LICENSE.md file at the top-level directory of this distribution and
  9. # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md
  10. #
  11.  
  12. rp_module_id="reicast"
  13. rp_module_desc="Dreamcast emulator Reicast"
  14. 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"
  15. rp_module_licence="GPL2 https://raw.githubusercontent.com/reicast/reicast-emulator/master/LICENSE"
  16. rp_module_section="opt"
  17. rp_module_flags="!armv6 !mali"
  18.  
  19. function depends_reicast() {
  20. local depends=(libsdl2-dev python-dev python-pip alsa-oss python-setuptools libevdev-dev libasound2-dev libudev-dev)
  21. isPlatform "vero4k" && depends+=(vero3-userland-dev-osmc)
  22. isPlatform "mesa" && depends+=(libgles2-mesa-dev)
  23. getDepends "${depends[@]}"
  24. isPlatform "vero4k" && pip install wheel
  25. pip install evdev
  26. }
  27.  
  28. function sources_reicast() {
  29. ## gitPullOrClone "$md_build" https://github.com/reicast/reicast-emulator.git alpha 49046aecd9e87d6ba8c1508ad6222526842bbacd
  30. gitPullOrClone "$md_build" https://github.com/reicast/reicast-emulator.git stable
  31. ## applyPatch "$md_data/0001-enable-rpi4-sdl2-target.patch"
  32. ## applyPatch "$md_data/0002-enable-vsync.patch"
  33. ## applyPatch "$md_data/0003-fix-sdl2-sighandler-conflict.patch"
  34. }
  35.  
  36. function _params_reicast() {
  37. local platform
  38. local subplatform
  39. local params=()
  40.  
  41. # platform-specific params
  42. if isPlatform "rpi"; then
  43. # platform configuration
  44. if isPlatform "rpi4"; then
  45. platform="rpi4"
  46. elif isPlatform "rpi3"; then
  47. platform="rpi3"
  48. else
  49. platform="rpi2"
  50. fi
  51.  
  52. # subplatform configuration
  53. if isPlatform "rpi4"; then
  54. # we need to target SDL with GLES3 disabled for KMSDRM compatibility
  55. subplatform="-sdl"
  56. elif isPlatform "mesa"; then
  57. subplatform="-mesa"
  58. fi
  59.  
  60. params+=("platform=${platform}${subplatform}")
  61. else
  62. # generic flags
  63. isPlatform "x11" && params+=("USE_X11=1")
  64. isPlatform "kms" || isPlatform "gles" && params+=("USE_GLES=1")
  65. isPlatform "kms" || isPlatform "tinker" && params+=("USE_X11=" "HAS_SOFTREND=" "USE_SDL=1")
  66. fi
  67.  
  68. echo "${params[*]}"
  69. }
  70.  
  71. function build_reicast() {
  72. cd reicast/linux
  73. make $(_params_reicast) clean
  74. make $(_params_reicast)
  75.  
  76. md_ret_require="$md_build/reicast/linux/reicast.elf"
  77. }
  78.  
  79. function install_reicast() {
  80. cd reicast/linux
  81. make $(_params_reicast) PREFIX="$md_inst" install
  82.  
  83. md_ret_files=(
  84. 'LICENSE'
  85. 'README.md'
  86. )
  87. }
  88.  
  89. function configure_reicast() {
  90. local backend
  91. local backends=(alsa omx oss)
  92. local params=("%ROM%")
  93.  
  94. # KMS reqires Xorg context & X/Y res passed.
  95. if isPlatform "kms"; then
  96. params+=("%XRES%" "%YRES%")
  97. fi
  98.  
  99. # copy hotkey remapping start script
  100. cp "$md_data/reicast.sh" "$md_inst/bin/"
  101. chmod +x "$md_inst/bin/reicast.sh"
  102.  
  103. mkRomDir "dreamcast"
  104.  
  105. # move any old configs to the new location
  106. moveConfigDir "$home/.reicast" "$md_conf_root/dreamcast/"
  107.  
  108. # Create home VMU, cfg, and data folders. Copy dc_boot.bin and dc_flash.bin to the ~/.reicast/data/ folder.
  109. mkdir -p "$md_conf_root/dreamcast/"{data,mappings}
  110.  
  111. # symlink bios
  112. mkUserDir "$biosdir/dc"
  113. ln -sf "$biosdir/dc/"{dc_boot.bin,dc_flash.bin} "$md_conf_root/dreamcast/data"
  114.  
  115. # copy default mappings
  116. cp "$md_inst/share/reicast/mappings/"*.cfg "$md_conf_root/dreamcast/mappings/"
  117.  
  118. chown -R $user:$user "$md_conf_root/dreamcast"
  119.  
  120. cat > "$romdir/dreamcast/+Start Reicast.sh" << _EOF_
  121. #!/bin/bash
  122. $md_inst/bin/reicast.sh
  123. _EOF_
  124. chmod a+x "$romdir/dreamcast/+Start Reicast.sh"
  125. chown $user:$user "$romdir/dreamcast/+Start Reicast.sh"
  126.  
  127. # remove old systemManager.cdi symlink
  128. rm -f "$romdir/dreamcast/systemManager.cdi"
  129.  
  130. if [[ "$md_mode" == "install" ]]; then
  131. # possible audio backends: alsa, oss, omx
  132. if isPlatform "videocore"; then
  133. backends=(omx oss)
  134. else
  135. backends=(alsa)
  136. fi
  137. fi
  138.  
  139. # add system(s)
  140. for backend in "${backends[@]}"; do
  141. addEmulator 1 "${md_id}-audio-${backend}" "dreamcast" "$md_inst/bin/reicast.sh $backend ${params[*]}"
  142. done
  143. addSystem "dreamcast"
  144.  
  145. addAutoConf reicast_input 1
  146. }
  147.  
  148. function input_reicast() {
  149. local temp_file="$(mktemp)"
  150. cd "$md_inst/bin"
  151. ./reicast-joyconfig -f "$temp_file" >/dev/tty
  152. iniConfig " = " "" "$temp_file"
  153. iniGet "mapping_name"
  154. local mapping_file="$configdir/dreamcast/mappings/evdev_${ini_value//[:><?\"]/-}.cfg"
  155. mv "$temp_file" "$mapping_file"
  156. chown $user:$user "$mapping_file"
  157. }
  158.  
  159. function gui_reicast() {
  160. while true; do
  161. local options=(
  162. 1 "Configure input devices for Reicast"
  163. )
  164. local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option" 22 76 16)
  165. local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
  166. [[ -z "$choice" ]] && break
  167. case "$choice" in
  168. 1)
  169. clear
  170. input_reicast
  171. ;;
  172. esac
  173. done
  174. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement