@@ -229,6 +229,7 @@ function build_mupen64plus() {
229229}
230230
231231function 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
333- # RPI main/GLideN64 settings
343+ iniConfig " = " " " " $config "
344+ # RPI main 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}
0 commit comments