@@ -133,37 +133,25 @@ function remap() {
133
133
}
134
134
135
135
function setAudio() {
136
- if [[ " $( sed -n ' /^Hardware/s/^.*: \(.*\)/\1/p ' < /proc/cpuinfo ) " == * BCM * ] ]; then
137
- # If a raspberry pi is used try to set the right output and use audio omx if possible
138
- local audio_device= $( amixer )
139
- if [[ " $audio_device " == * PCM * ]] ; then
140
- # use audio omx if we use rpi internal audio device
136
+ if tr -d ' \0 ' < /proc/device-tree/compatible | grep -Eq raspberrypi,[0-4 ]; then
137
+ # If a Raspberry Pi is used, try to set the right output and use audio OMX if possible
138
+ # check for the presence of the non-KMS audio driver
139
+ if aplay -l | grep -qm1 " bcm2835 HDMI " ; then
140
+ # use audio OMX when the RPI has enabled the internal audio cards
141
141
AUDIO_PLUGIN=" mupen64plus-audio-omx"
142
142
iniConfig " = " " \" " " $config "
143
143
# create section if necessary
144
144
if ! grep -q " \[Audio-OMX\]" " $config " ; then
145
145
echo " [Audio-OMX]" >> " $config "
146
146
echo " Version = 1" >> " $config "
147
147
fi
148
- # read output configuration
149
- local audio_port=$( amixer cget numid=3)
150
- # set output port
151
- if [[ " $audio_port " == * " : values=0" * ]]; then
152
- # echo "auto configuration"
153
- # try to find the best solution
154
- local video_device=$( tvservice -s)
155
- if [[ " $video_device " == * HDMI* ]]; then
156
- iniSet " OUTPUT_PORT" " 1"
157
- else
158
- iniSet " OUTPUT_PORT" " 0"
159
- fi
160
- elif [[ " $audio_port " == * " : values=1" * ]]; then
161
- # echo "audio jack"
162
- iniSet " OUTPUT_PORT" " 0"
163
- else
164
- # echo "hdmi"
148
+ # try to find which audio card is default by looking at the mixer's volume control name
149
+ if amixer -Ddefault cget numid=1 | grep -qm1 HDMI; then
165
150
iniSet " OUTPUT_PORT" " 1"
166
151
fi
152
+ if amixer -Ddefault cget numid=1 | grep -qm1 Headphones; then
153
+ iniSet " OUTPUT_PORT" " 0"
154
+ fi
167
155
fi
168
156
fi
169
157
}
@@ -172,7 +160,7 @@ function testCompatibility() {
172
160
# fallback for glesn64 and rice plugin
173
161
# some roms lead to a black screen of death
174
162
local game
175
-
163
+
176
164
# these games need RSP-LLE
177
165
local blacklist=(
178
166
naboo
@@ -434,14 +422,13 @@ getAutoConf mupen64plus_audio && setAudio
434
422
getAutoConf mupen64plus_compatibility_check && testCompatibility
435
423
getAutoConf mupen64plus_texture_packs && useTexturePacks
436
424
437
- if [[ " $( sed -n ' /^Hardware/s/^.*: \(.*\)/\1/p ' < /proc/cpuinfo ) " == BCM * ] ]; then
425
+ if tr -d ' \0 ' < /proc/device-tree/compatible | grep -Eq raspberrypi,[0-4 ]; then
438
426
WINDOW_MODE=" --windowed $RES "
439
427
SDL_VIDEO_RPI_SCALE_MODE=1
440
- # If a raspberry pi is used lower resolution to 320x240 and enable SDL dispmanx scaling mode 1
441
- elif [[ -e /opt/vero3/lib/libMali.so ]]; then
428
+ # If a Raspberry Pi (<5) device is used, lower resolution to 320x240 and enable SDL dispmanx scaling mode 1
429
+ fi
430
+ if [[ -e /opt/vero3/lib/libMali.so ]]; then
442
431
SDL_AUDIODRIVER=alsa
443
- else
444
- SDL_AUDIODRIVER=pulse
445
432
fi
446
433
447
434
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 "
0 commit comments