We don't have bezels, so we don't need custom viewports etc.

This commit is contained in:
fewtarius 2022-03-26 21:49:16 -04:00
parent 7dd85fadc2
commit 3afb6df1ee
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A
2 changed files with 1 additions and 174 deletions

View file

@ -126,10 +126,6 @@ crt_switch_timings = ""
crt_video_refresh_rate = "60.000000"
current_resolution_id = "0"
cursor_directory = "~/.config/retroarch/database/cursors"
custom_viewport_height = "1152"
custom_viewport_width = "1536"
custom_viewport_x = "192"
custom_viewport_y = "0"
desktop_menu_enable = "true"
discord_allow = "false"
discord_app_id = "475456035851599874"
@ -304,7 +300,7 @@ input_overlay_aspect_adjust_landscape = "0.000000"
input_overlay_aspect_adjust_portrait = "0.000000"
input_overlay_auto_rotate = "false"
input_overlay_auto_scale = "false"
input_overlay_enable = "true"
input_overlay_enable = "false"
input_overlay_enable_autopreferred = "true"
input_overlay_hide_in_menu = "true"
input_overlay_hide_when_gamepad_connected = "false"

View file

@ -26,7 +26,6 @@ SOURCERACONF="/usr/config/retroarch/retroarch.cfg"
RACONF="/storage/.config/retroarch/retroarch.cfg"
RAAPPENDCONF="/tmp/raappend.cfg"
RACORECONF="/storage/.config/retroarch/retroarch-core-options.cfg"
TMP_BEZEL="/tmp/351elec-bezel.cfg"
SNAPSHOTS="/storage/roms/savestates"
PLATFORM=${1,,}
ROM="${2##*/}"
@ -573,174 +572,6 @@ fi
fi
done
##
## Bezels / Decorations
##
# List of possible Bezel Folders
BEZELDIR=(/tmp/overlays/bezels /storage/roms/bezels)
# Define the resolutions of the differen systems (0:x 1:y 2:width 3:height) as seen in Scaling -> Aspect Ration -> Custom
# RG351P/M=480x320
# RG351V=640x480
if [ "${EE_DEVICE}" == "RG351P" ]; then
declare -A SystemViewport=(
['standard']="1 1 479 319"
['gb']="80 16 320 288"
['gbc']="80 16 320 288"
['supervision']="80 0 320 320"
['gamegear']="80 16 320 288"
['pokemini']="96 64 288 192"
['ngp']="80 8 320 304"
['ngpc']="80 8 320 304"
['wonderswan']="16 16 448 288"
['wonderswancolor']="16 16 448 288"
)
elif [ "${EE_DEVICE}" == "RG552" ]; then
declare -A SystemViewport=(
['standard']="1 1 1920 1152"
['gb']="320 0 1280 1152"
['gbc']="320 0 1280 1152"
['supervision']="400 16 1120 1120"
['gamegear']="320 0 1280 1152"
['pokemini']="96 0 1728 1152"
['ngp']="400 44 1120 1064"
['ngpc']="400 44 1120 1064"
['wonderswan']="64 0 1792 1152"
['wonderswancolor']="64 0 1792 1152"
)
else #Must be the V or MP then
declare -A SystemViewport=(
['standard']="1 1 639 479"
['gb']="80 24 480 432"
['gbc']="80 24 480 432"
['supervision']="80 0 480 480"
['gamegear']="80 24 480 432"
['pokemini']="128 112 384 256"
['ngp']="80 12 480 456"
['ngpc']="80 12 480 456"
['wonderswan']="96 96 448 288"
['wonderswancolor']="96 96 448 288"
)
fi
# Get configuration from system.cfg and set to retroarch.cfg
BEZEL=$(get_setting 'bezel' ${PLATFORM} "${ROM}")
if [[ -z "${BEZEL}" ]]; then
BEZEL=default
fi
log "bezel: ${BEZEL} platform: ${PLATFORM} rom: ${ROM}"
if [ "${BEZEL}" != "false" ] && [ "${BEZEL}" != "none" ] && [ "${BEZEL}" != "0" ] && [ ${SystemViewport[${PLATFORM}]+_} ]; then
# set path
for p in ${BEZELDIR[@]}; do
if [ -d "${p}"/"${BEZEL}" ]; then
path="${p}"/"${BEZEL}"
fi
done
BEZEL_SYSTEM=$(get_setting 'bezel.system.override' ${PLATFORM} "${ROM}")
if [[ -z "${BEZEL_SYSTEM}" || "${BEZEL_SYSTEM}" == "AUTO" ]]; then
BEZEL_SYSTEM=${PLATFORM}
fi
BEZEL_SYSTEM_PNG=${path}/systems/${BEZEL_SYSTEM}.png
log "Bezel system png: ${BEZEL_SYSTEM_PNG}"
GAME_BEZEL_OVERRIDE=$(get_setting 'bezel.game.override' ${PLATFORM} "${ROM}")
log "Game bezel override: ${GAME_BEZEL_OVERRIDE}"
if [[ -z "${GAME_BEZEL_OVERRIDE}" || "${GAME_BEZEL_OVERRIDE}" == "AUTO" ]]; then
log "No game specific override found. Looking for games"
# is there a $ROM.cfg?
# excatctly the same / just the name / default
# Random bezels have to match $ROM./d+.cfg
romdir="${path}/systems/${BEZEL_SYSTEM}/games"
pushd "${romdir}" &> /dev/null
for romname in "${ROM%.*}" "${ROM%% (*}" "default"; do
log "Looking at: ${romdir}/${romname}"
# Somehow the regex of the busybox find does not know about "+" WTF?
pattern=".*${romname}"\\.[0-9][0-9]*\\.cfg
readarray -t filelist < <(find "${romdir}" -regex "${pattern}" -exec basename "{}" \;)
log "file list: ${filelist}"
count=${#filelist[*]}
if [ ${count} -gt 0 ]; then
ran=$(($RANDOM%${count}))
game_cfg="${romdir}/${filelist[${ran}]}"
log "Using random config: ${game_cfg}"
break
elif [ -f "${romdir}/${romname}".cfg ]; then
game_cfg="${romdir}/${romname}".cfg
log "Using rom config: ${game_cfg}"
break
fi
done
popd &> /dev/null
else
game_cfg=${path}/systems/${BEZEL_SYSTEM}/games/${GAME_BEZEL_OVERRIDE}.cfg
fi
if [[ -f "${game_cfg}" ]]; then
log "game config file exists: ${game_cfg}"
contents=$(cat "${game_cfg}" | awk '{$1=$1};1') #awk strips off leading/trailing whitespace
BEZEL_SYSTEM_PNG=${path}/systems/${BEZEL_SYSTEM}/games/${contents}
fi
log "bezel png: ${BEZEL_SYSTEM_PNG}"
if [[ -f "${BEZEL_SYSTEM_PNG}" ]]; then
# create the temporary bezel for retroarch
echo "overlays = 1" > ${TMP_BEZEL}
echo "overlay0_full_screen = true" >> ${TMP_BEZEL}
echo "overlay0_normalized = true" >> ${TMP_BEZEL}
echo "overlay0_overlay = \"${BEZEL_SYSTEM_PNG}\"" >> ${TMP_BEZEL}
count=0
if [[ -d "${path}/systems/${BEZEL_SYSTEM}/overlays/" ]]; then
for overlay_png in $(ls -1 ${path}/systems/${BEZEL_SYSTEM}/overlays/*.png) ; do
overlay_name="${overlay_png%.*}"
overlay_name="$(basename ${overlay_name})"
overlay_setting=$(get_setting "bezel.overlay.${overlay_name}" ${PLATFORM} "${ROM}")
if [[ "${overlay_setting}" == "0" ]];then
continue
fi
log "Adding overlay. name: ${overlay_name} overlay setting: ${overlay_setting} png: ${overlay_png}"
echo "overlay0_desc${count}_overlay = \"${overlay_png}\"" >> ${TMP_BEZEL}
echo "overlay0_desc${count} = \"nul,0.5,0.5,rect,0.5,0.5\"" >> ${TMP_BEZEL}
count=$(expr $count + 1)
done
fi
echo "overlay0_descs = ${count}" >> ${TMP_BEZEL}
bezelcfg="${TMP_BEZEL}"
fi
fi
if [[ -n "${bezelcfg}" ]]; then
log "using bezel"
# configure bezel
echo 'input_overlay_enable = "true"' >> ${RAAPPENDCONF}
echo "input_overlay = \"${bezelcfg}\"" >> ${RAAPPENDCONF}
echo 'input_overlay_hide_in_menu = "true"' >> ${RAAPPENDCONF}
echo 'input_overlay_opacity = "1.000000"' >> ${RAAPPENDCONF}
echo 'input_overlay_show_inputs = "2"' >> ${RAAPPENDCONF}
# delete / set scaling and aspect ratio:
sed -i "/video_scale_integer/d" ${RAAPPENDCONF}
sed -i "/aspect_ratio_index/d" ${RAAPPENDCONF}
echo 'video_scale_integer = "false"' >> ${RAAPPENDCONF}
echo 'aspect_ratio_index = "23"' >> ${RAAPPENDCONF}
# configure custom scaling
# needs some grouping to reflect the hack systems as well (i. e. gb=gb, gbh, gbc and gbch)
declare -a resolution=(${SystemViewport[${PLATFORM}]})
echo "custom_viewport_x = \"${resolution[0]}\"" >> ${RAAPPENDCONF}
echo "custom_viewport_y = \"${resolution[1]}\"" >> ${RAAPPENDCONF}
echo "custom_viewport_width = \"${resolution[2]}\"" >> ${RAAPPENDCONF}
echo "custom_viewport_height = \"${resolution[3]}\"" >> ${RAAPPENDCONF}
else
log "not using bezel"
# disable decorations
echo 'input_overlay_enable = "false"' >> ${RAAPPENDCONF}
# set standard resolution for custom scaling
declare -a resolution=(${SystemViewport["standard"]})
echo "custom_viewport_x = \"${resolution[0]}\"" >> ${RAAPPENDCONF}
echo "custom_viewport_y = \"${resolution[1]}\"" >> ${RAAPPENDCONF}
echo "custom_viewport_width = \"${resolution[2]}\"" >> ${RAAPPENDCONF}
echo "custom_viewport_height = \"${resolution[3]}\"" >> ${RAAPPENDCONF}
fi
##
## Clean Exit
##