Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mupen64plus - GlideN64 config version and default config logic changes #3696

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
85 changes: 55 additions & 30 deletions scriptmodules/emulators/mupen64plus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ function build_mupen64plus() {
}

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

# extract the previously saved GLideN64 config version
local gliden64_ver=$(<"$md_inst/share/mupen64plus/GLideN64_config_version.ini")

# if the user has an existing mupen64plus config we back it up, generate a new configuration
# copy that to rp-dist and put the original config back again. We then make any ini changes
# on the rp-dist file. This preserves any user configs from modification and allows us to have
# a default config for reference
if [[ -f "$config" ]]; then
# make sure we always update configVersion for GLideN64 in the existing config
if grep -q "configVersion" "$config"; then
iniConfig " = " "" "$config"
iniSet "configVersion" "$gliden64_ver"
fi

mv "$config" "$config.user"
su "$user" -c "$cmd"
mv "$config" "$config.rp-dist"
Expand All @@ -330,29 +340,35 @@ function configure_mupen64plus() {
su "$user" -c "$cmd"
fi

# RPI main/GLideN64 settings
iniConfig " = " "" "$config"
# RPI main settings
if isPlatform "rpi"; then
iniConfig " = " "" "$config"
# VSync is mandatory for good performance on KMS
if isPlatform "kms"; then
if ! grep -q "\[Video-General\]" "$config"; then
echo "[Video-General]" >> "$config"
fi
iniSet "VerticalSync" "True"
fi
# Create GlideN64 section in .cfg
if ! grep -q "\[Video-GLideN64\]" "$config"; then
echo "[Video-GLideN64]" >> "$config"
fi
# Settings version. Don't touch it.
iniSet "configVersion" "29"
fi

# Create GlideN64 section in .cfg
if ! grep -q "\[Video-GLideN64\]" "$config"; then
echo "[Video-GLideN64]" >> "$config"
fi
# Settings version
iniSet "configVersion" "$gliden64_ver"
# Use native res
iniSet "UseNativeResolutionFactor" "1"
# Enable legacy blending
iniSet "EnableLegacyBlending" "True"
Copy link
Member

@gizmo98 gizmo98 Mar 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this line or disable EnableLegacyBlending by default. EnableLegacyBlending helps to get some extra fps on slow devices but it can cause visual problems. If "mupen64plus_compatibility_check" autoconf is set it will be enabled anyway.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the previous commit EnableLegacyBlending was only true for rpi: https://github.com/RetroPie/RetroPie-Setup/blob/master/scriptmodules/emulators/mupen64plus.sh#L334-L355

I think that's right as all (current) pis are fighting for performance in GLideN64, and the blacklist will disable it for known problem games. I am not sure why it (and some other settings) been taken out of that block - perhaps unintentional @joolswills ? :)

however you do raise an issue with the launch script, which seems to always enable, and the disable it if the game is in the blacklist. IMO that's wrong - it should just disable when necessary rather than ignore the cfg setting. i.e. remove this line: https://github.com/RetroPie/RetroPie-Setup/blob/master/scriptmodules/emulators/mupen64plus/mupen64plus.sh#L267

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dankcushions it just resets to best „rpi“ default setting for performance before it checks blacklist. Autoset function could be the better location. If you want to preserve user settings you need to read, store and restore it after m64p closes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change it. I got the wrong default (probably confused due to the compatibility check code). I wanted to make sure we always have the keys that are to be used by the launch script which is why I added them outside (and to make sure we had the sections)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's a little unwieldy! #2960 simplifies this some ;) it adds the headers if they don't exist.

# Use high resolution texture packs if available.
iniSet "txHiresEnable" "True"

if isPlatform "rpi"; then
# Bilinear filtering mode (0=N64 3point, 1=standard)
iniSet "bilinearMode" "1"
iniSet "EnableFBEmulation" "True"
# Use native res
iniSet "UseNativeResolutionFactor" "1"
# Enable legacy blending
iniSet "EnableLegacyBlending" "True"
# Enable Threaded GL calls
iniSet "ThreadedVideo" "True"
# Swap frame buffers On buffer update (most performant)
Expand All @@ -361,32 +377,41 @@ function configure_mupen64plus() {
iniSet "EnableHybridFilter" "False"
# Use fast but less accurate shaders. Can help with low-end GPUs.
iniSet "EnableInaccurateTextureCoordinates" "True"
fi

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

if isPlatform "rpi" && isPlatform "mesa"; then
# Fix flickering and black screen issues with rice video plugin
iniSet "ScreenUpdateSetting" "7"
fi

# gles2n64.conf
if isPlatform "videocore"; then
# Disable gles2n64 autores feature and use dispmanx upscaling
iniConfig "=" "" "$md_conf_root/n64/gles2n64.conf"
iniSet "auto resolution" "0"
fi

addAutoConf mupen64plus_audio 0
addAutoConf mupen64plus_compatibility_check 0
addAutoConf mupen64plus_hotkeys 1
addAutoConf mupen64plus_texture_packs 1

# force autoconf.ini values for rpi
if isPlatform "rpi"; then
if isPlatform "videocore"; then
setAutoConf mupen64plus_audio 1
setAutoConf mupen64plus_compatibility_check 1
elif isPlatform "mesa"; then
# Create Video-Rice section in .cfg
if ! grep -q "\[Video-Rice\]" "$config"; then
echo "[Video-Rice]" >> "$config"
fi
# Fix flickering and black screen issues with rice video plugin
iniSet "ScreenUpdateSetting" "7"

else
setAutoConf mupen64plus_audio 0
setAutoConf mupen64plus_compatibility_check 0
fi
else
addAutoConf mupen64plus_audio 0
addAutoConf mupen64plus_compatibility_check 0
fi

addAutoConf mupen64plus_hotkeys 1
addAutoConf mupen64plus_texture_packs 1

chown -R $user:$user "$md_conf_root/n64"
}
61 changes: 24 additions & 37 deletions scriptmodules/emulators/mupen64plus/mupen64plus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -245,32 +245,27 @@ function testCompatibility() {

case "$VIDEO_PLUGIN" in
"mupen64plus-video-GLideN64")
if ! grep -q "\[Video-GLideN64\]" "$config"; then
echo "[Video-GLideN64]" >> "$config"
fi
iniConfig " = " "" "$config"
# Settings version. Don't touch it.
local config_version="20"
if [[ -f "$configdir/n64/GLideN64_config_version.ini" ]]; then
config_version=$(<"$configdir/n64/GLideN64_config_version.ini")
if grep -q "UseNativeResolutionFactor" "$config"; then
# Set native resolution factor of 1
iniSet "UseNativeResolutionFactor" "1"
for game in "${GLideN64NativeResolution_blacklist[@]}"; do
if [[ "${ROM,,}" == *"$game"* ]]; then
iniSet "UseNativeResolutionFactor" "0"
break
fi
done
fi
if grep -q "EnableLegacyBlending" "$config"; then
# Disable LegacyBlending if necessary
iniSet "EnableLegacyBlending" "True"
for game in "${GLideN64LegacyBlending_blacklist[@]}"; do
if [[ "${ROM,,}" == *"$game"* ]]; then
iniSet "EnableLegacyBlending" "False"
break
fi
done
fi
iniSet "configVersion" "$config_version"
# Set native resolution factor of 1
iniSet "UseNativeResolutionFactor" "1"
for game in "${GLideN64NativeResolution_blacklist[@]}"; do
if [[ "${ROM,,}" == *"$game"* ]]; then
iniSet "UseNativeResolutionFactor" "0"
break
fi
done
# Disable LegacyBlending if necessary
iniSet "EnableLegacyBlending" "True"
for game in "${GLideN64LegacyBlending_blacklist[@]}"; do
if [[ "${ROM,,}" == *"$game"* ]]; then
iniSet "EnableLegacyBlending" "False"
break
fi
done
for game in "${gliden64_blacklist[@]}"; do
if [[ "${ROM,,}" == *"$game"* ]]; then
VIDEO_PLUGIN="mupen64plus-video-rice"
Expand Down Expand Up @@ -302,24 +297,16 @@ function testCompatibility() {
}

function useTexturePacks() {
# video-GLideN64
if ! grep -q "\[Video-GLideN64\]" "$config"; then
echo "[Video-GLideN64]" >> "$config"
fi
iniConfig " = " "" "$config"
# Settings version. Don't touch it.
local config_version="17"
if [[ -f "$configdir/n64/GLideN64_config_version.ini" ]]; then
config_version=$(<"$configdir/n64/GLideN64_config_version.ini")
# video-GLideN64
if grep -q "txHiresEnable" "$config"; then
iniSet "txHiresEnable" "True"
fi
iniSet "configVersion" "$config_version"
iniSet "txHiresEnable" "True"

# video-rice
if ! grep -q "\[Video-Rice\]" "$config"; then
echo "[Video-Rice]" >> "$config"
if grep -q "LoadHiResTextures" "$config"; then
iniSet "LoadHiResTextures" "True"
fi
iniSet "LoadHiResTextures" "True"
}

function autoset() {
Expand Down