Skip to content

Commit 62116b2

Browse files
committed
mupen64plus - GlideN64 config version and default config logic changes
Add missing "local source" in install_mupen64plus Set configVersion from GLideN64_config_version.ini in $md_conf_root/n64/mupen64plus.cfg as well as mupen64plus.cfg.rp-dist Add defaults and values handled by startup script for Video-GLideN64 and Video-Rice to default mupen64plus.cfg and re-order logic. Remove logic in mupen64plus.sh startup script to set configVersion and only change values if they are present in the config (Rather than checking for a section and then adding it) Fixes RetroPie#3654 and closes RetroPie#3688
1 parent 56772c4 commit 62116b2

File tree

2 files changed

+78
-66
lines changed

2 files changed

+78
-66
lines changed

scriptmodules/emulators/mupen64plus.sh

+54-29
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ function build_mupen64plus() {
229229
}
230230

231231
function install_mupen64plus() {
232+
local source
232233
for source in *; do
233234
if [[ -f "$source/projects/unix/Makefile" ]]; then
234235
# 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
@@ -316,11 +317,20 @@ function configure_mupen64plus() {
316317
local config="$md_conf_root/n64/mupen64plus.cfg"
317318
local cmd="$md_inst/bin/mupen64plus --configdir $md_conf_root/n64 --datadir $md_conf_root/n64"
318319

320+
# extract the previously saved GLideN64 config version
321+
local gliden64_ver=$(<"$md_inst/share/mupen64plus/GLideN64_config_version.ini")
322+
319323
# if the user has an existing mupen64plus config we back it up, generate a new configuration
320324
# copy that to rp-dist and put the original config back again. We then make any ini changes
321325
# on the rp-dist file. This preserves any user configs from modification and allows us to have
322326
# a default config for reference
323327
if [[ -f "$config" ]]; then
328+
# make sure we always update configVersion for GLideN64 in the existing config
329+
if grep -q "configVersion" "$config"; then
330+
iniConfig " = " "" "$config"
331+
iniSet "configVersion" "$gliden64_ver"
332+
fi
333+
324334
mv "$config" "$config.user"
325335
su "$user" -c "$cmd"
326336
mv "$config" "$config.rp-dist"
@@ -330,29 +340,35 @@ function configure_mupen64plus() {
330340
su "$user" -c "$cmd"
331341
fi
332342

343+
iniConfig " = " "" "$config"
333344
# RPI main/GLideN64 settings
334345
if isPlatform "rpi"; then
335-
iniConfig " = " "" "$config"
336346
# VSync is mandatory for good performance on KMS
337347
if isPlatform "kms"; then
338348
if ! grep -q "\[Video-General\]" "$config"; then
339349
echo "[Video-General]" >> "$config"
340350
fi
341351
iniSet "VerticalSync" "True"
342352
fi
343-
# Create GlideN64 section in .cfg
344-
if ! grep -q "\[Video-GLideN64\]" "$config"; then
345-
echo "[Video-GLideN64]" >> "$config"
346-
fi
347-
# Settings version. Don't touch it.
348-
iniSet "configVersion" "29"
353+
fi
354+
355+
# Create GlideN64 section in .cfg
356+
if ! grep -q "\[Video-GLideN64\]" "$config"; then
357+
echo "[Video-GLideN64]" >> "$config"
358+
fi
359+
# Settings version
360+
iniSet "configVersion" "$gliden64_ver"
361+
# Use native res
362+
iniSet "UseNativeResolutionFactor" "1"
363+
# Enable legacy blending
364+
iniSet "EnableLegacyBlending" "True"
365+
# Use high resolution texture packs if available.
366+
iniSet "txHiresEnable" "True"
367+
368+
if isPlatform "rpi"; then
349369
# Bilinear filtering mode (0=N64 3point, 1=standard)
350370
iniSet "bilinearMode" "1"
351371
iniSet "EnableFBEmulation" "True"
352-
# Use native res
353-
iniSet "UseNativeResolutionFactor" "1"
354-
# Enable legacy blending
355-
iniSet "EnableLegacyBlending" "True"
356372
# Enable Threaded GL calls
357373
iniSet "ThreadedVideo" "True"
358374
# Swap frame buffers On buffer update (most performant)
@@ -361,32 +377,41 @@ function configure_mupen64plus() {
361377
iniSet "EnableHybridFilter" "False"
362378
# Use fast but less accurate shaders. Can help with low-end GPUs.
363379
iniSet "EnableInaccurateTextureCoordinates" "True"
380+
fi
364381

365-
if isPlatform "videocore"; then
366-
# Disable gles2n64 autores feature and use dispmanx upscaling
367-
iniConfig "=" "" "$md_conf_root/n64/gles2n64.conf"
368-
iniSet "auto resolution" "0"
382+
# Create Video-Rice section in .cfg
383+
if ! grep -q "\[Video-Rice\]" "$config"; then
384+
echo "[Video-Rice]" >> "$config"
385+
fi
386+
iniSet "LoadHiResTextures" "True"
369387

388+
if isPlatform "rpi" && isPlatform "mesa"; then
389+
# Fix flickering and black screen issues with rice video plugin
390+
iniSet "ScreenUpdateSetting" "7"
391+
fi
392+
393+
# gles2n64.conf
394+
if isPlatform "videocore"; then
395+
# Disable gles2n64 autores feature and use dispmanx upscaling
396+
iniConfig "=" "" "$md_conf_root/n64/gles2n64.conf"
397+
iniSet "auto resolution" "0"
398+
fi
399+
400+
addAutoConf mupen64plus_audio 0
401+
addAutoConf mupen64plus_compatibility_check 0
402+
addAutoConf mupen64plus_hotkeys 1
403+
addAutoConf mupen64plus_texture_packs 1
404+
405+
# force autoconf.ini values for rpi
406+
if isPlatform "rpi"; then
407+
if isPlatform "videocore"; then
370408
setAutoConf mupen64plus_audio 1
371409
setAutoConf mupen64plus_compatibility_check 1
372-
elif isPlatform "mesa"; then
373-
# Create Video-Rice section in .cfg
374-
if ! grep -q "\[Video-Rice\]" "$config"; then
375-
echo "[Video-Rice]" >> "$config"
376-
fi
377-
# Fix flickering and black screen issues with rice video plugin
378-
iniSet "ScreenUpdateSetting" "7"
379-
410+
else
380411
setAutoConf mupen64plus_audio 0
381412
setAutoConf mupen64plus_compatibility_check 0
382413
fi
383-
else
384-
addAutoConf mupen64plus_audio 0
385-
addAutoConf mupen64plus_compatibility_check 0
386414
fi
387415

388-
addAutoConf mupen64plus_hotkeys 1
389-
addAutoConf mupen64plus_texture_packs 1
390-
391416
chown -R $user:$user "$md_conf_root/n64"
392417
}

scriptmodules/emulators/mupen64plus/mupen64plus.sh

+24-37
Original file line numberDiff line numberDiff line change
@@ -245,32 +245,27 @@ function testCompatibility() {
245245

246246
case "$VIDEO_PLUGIN" in
247247
"mupen64plus-video-GLideN64")
248-
if ! grep -q "\[Video-GLideN64\]" "$config"; then
249-
echo "[Video-GLideN64]" >> "$config"
250-
fi
251248
iniConfig " = " "" "$config"
252-
# Settings version. Don't touch it.
253-
local config_version="20"
254-
if [[ -f "$configdir/n64/GLideN64_config_version.ini" ]]; then
255-
config_version=$(<"$configdir/n64/GLideN64_config_version.ini")
249+
if grep -q "UseNativeResolutionFactor" "$config"; then
250+
# Set native resolution factor of 1
251+
iniSet "UseNativeResolutionFactor" "1"
252+
for game in "${GLideN64NativeResolution_blacklist[@]}"; do
253+
if [[ "${ROM,,}" == *"$game"* ]]; then
254+
iniSet "UseNativeResolutionFactor" "0"
255+
break
256+
fi
257+
done
258+
fi
259+
if grep -q "EnableLegacyBlending" "$config"; then
260+
# Disable LegacyBlending if necessary
261+
iniSet "EnableLegacyBlending" "True"
262+
for game in "${GLideN64LegacyBlending_blacklist[@]}"; do
263+
if [[ "${ROM,,}" == *"$game"* ]]; then
264+
iniSet "EnableLegacyBlending" "False"
265+
break
266+
fi
267+
done
256268
fi
257-
iniSet "configVersion" "$config_version"
258-
# Set native resolution factor of 1
259-
iniSet "UseNativeResolutionFactor" "1"
260-
for game in "${GLideN64NativeResolution_blacklist[@]}"; do
261-
if [[ "${ROM,,}" == *"$game"* ]]; then
262-
iniSet "UseNativeResolutionFactor" "0"
263-
break
264-
fi
265-
done
266-
# Disable LegacyBlending if necessary
267-
iniSet "EnableLegacyBlending" "True"
268-
for game in "${GLideN64LegacyBlending_blacklist[@]}"; do
269-
if [[ "${ROM,,}" == *"$game"* ]]; then
270-
iniSet "EnableLegacyBlending" "False"
271-
break
272-
fi
273-
done
274269
for game in "${gliden64_blacklist[@]}"; do
275270
if [[ "${ROM,,}" == *"$game"* ]]; then
276271
VIDEO_PLUGIN="mupen64plus-video-rice"
@@ -302,24 +297,16 @@ function testCompatibility() {
302297
}
303298

304299
function useTexturePacks() {
305-
# video-GLideN64
306-
if ! grep -q "\[Video-GLideN64\]" "$config"; then
307-
echo "[Video-GLideN64]" >> "$config"
308-
fi
309300
iniConfig " = " "" "$config"
310-
# Settings version. Don't touch it.
311-
local config_version="17"
312-
if [[ -f "$configdir/n64/GLideN64_config_version.ini" ]]; then
313-
config_version=$(<"$configdir/n64/GLideN64_config_version.ini")
301+
# video-GLideN64
302+
if grep -q "txHiresEnable" "$config"; then
303+
iniSet "txHiresEnable" "True"
314304
fi
315-
iniSet "configVersion" "$config_version"
316-
iniSet "txHiresEnable" "True"
317305

318306
# video-rice
319-
if ! grep -q "\[Video-Rice\]" "$config"; then
320-
echo "[Video-Rice]" >> "$config"
307+
if grep -q "LoadHiResTextures" "$config"; then
308+
iniSet "LoadHiResTextures" "True"
321309
fi
322-
iniSet "LoadHiResTextures" "True"
323310
}
324311

325312
function autoset() {

0 commit comments

Comments
 (0)