RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Mupen64plus Deleting Input Preferences

    Scheduled Pinned Locked Moved Help and Support
    mupen64pluscontrollerjoystick
    7 Posts 3 Posters 2.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mediamogulM
      mediamogul Global Moderator
      last edited by mediamogul

      Mupen64plus recently began writing over input preferences for Exit as well as Load and Save State. I've tried remapping in Emulation Station, as well as adding the preferences back manually, but each time the settings are overwritten on launch.

      RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

      1 Reply Last reply Reply Quote 0
      • suprjamiS
        suprjami
        last edited by

        It's always done this for me.

        The wiki mentions this is the expected behaviour with mupen64plus_hotkeys enabled.

        https://github.com/RetroPie/RetroPie-Setup/wiki/Nintendo-64

        mediamogulM 1 Reply Last reply Reply Quote 0
        • mediamogulM
          mediamogul Global Moderator @suprjami
          last edited by

          @suprjami

          This is a bit different and I really should have used the word deleted rather than overwritten. The wiki entry makes reference to the fact that the default settings or user preferences will be overwritten with what is produced by Emulation Station if mupen64plus_hotkeys is enabled. My problem is that every time Mupen64plus is launched, the settings are being deleted outright and not being replaced with anything.

          RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

          BuZzB 1 Reply Last reply Reply Quote 0
          • BuZzB
            BuZz administrators @mediamogul
            last edited by

            @mediamogul They are set on launch depending what controllers are connected. There is an ini switch to disable, but not in front of computer currently.

            To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

            mediamogulM 1 Reply Last reply Reply Quote 0
            • mediamogulM
              mediamogul Global Moderator @BuZz
              last edited by

              @BuZz

              Is it possible that it's trying to pull controller information at launch, but is coming up empty? Where does it pull the controller info from to begin with?

              RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

              1 Reply Last reply Reply Quote 0
              • mediamogulM
                mediamogul Global Moderator
                last edited by

                OK, I'm getting closer here. Apparently the automatic controller settings for Mupen64plus are set with /home/pi/RetroPie-Setup/scriptmodules/emulators/mupen64plus/mupen64plus.sh. It calls out to the RetroArch controller information created by Emulation Station at /opt/configs/all/retroarch-joypads/. I believe the excerpt below encompasses the whole process, but I'm no programmer:

                # arg 1: hotkey name, arg 2: device number, arg 3: retroarch auto config file
                function getBind() {
                    local key="$1"
                    local m64p_hotkey="J$2"
                    local file="$3"
                
                    iniConfig " = " "" "$file"
                
                    # search hotkey enable button
                    local hotkey
                    local input_type
                    local i=0
                    for hotkey in input_enable_hotkey "$key"; do
                        for input_type in "_btn" "_axis"; do
                            iniGet "${hotkey}${input_type}"
                            ini_value="${ini_value// /}"
                            if [[ -n "$ini_value" ]]; then
                                ini_value="${ini_value//\"/}"
                                case "$input_type" in
                                    _axis)
                                        m64p_hotkey+="A${ini_value:1}${ini_value:0:1}"
                                    ;;
                                    _btn)
                                        # if ini_value contains "h" it should be a hat device
                                        if [[ "$ini_value" == *h* ]]; then
                                            local dir="${ini_value:2}"
                                            ini_value="${ini_value:1}"
                                            case $dir in
                                                up)
                                                    dir="1"
                                                    ;;
                                                right)
                                                    dir="2"
                                                    ;;
                                                down)
                                                    dir="4"
                                                    ;;
                                                left)
                                                    dir="8"
                                                    ;;
                                            esac
                                            m64p_hotkey+="H${ini_value}V${dir}"
                                        else
                                            [[ "$atebitdo_hack" -eq 1 && "$ini_value" -ge 11 ]] && ((ini_value-=11))
                                            m64p_hotkey+="B${ini_value}"
                                        fi
                                    ;;
                                esac
                            fi
                        done
                        [[ "$i" -eq 0 ]] && m64p_hotkey+="/"
                        ((i++))
                    done
                    echo "$m64p_hotkey"
                }
                
                function remap() {
                    local device
                    local devices
                    local device_num
                
                    # get lists of all present js device numbers and device names
                    # get device count
                    while read -r device; do
                        device_num="${device##*/js}"
                        devices[$device_num]=$(</sys/class/input/js${device_num}/device/name)
                    done < <(find /dev/input -name "js*")
                
                    # read retroarch auto config file and use config
                    # for mupen64plus.cfg
                    local file
                    local bind
                    local hotkeys_rp=( "input_exit_emulator" "input_load_state" "input_save_state" )
                    local hotkeys_m64p=( "Joy Mapping Stop" "Joy Mapping Load State" "Joy Mapping Save State" )
                    local i
                    local j
                
                    iniConfig " = " "" "$config"
                    if ! grep -q "\[CoreEvents\]" "$config"; then
                        echo "[CoreEvents]" >> "$config"
                        echo "Version = 1" >> "$config"
                    fi
                
                    local atebitdo_hack
                    for i in {0..2}; do
                        bind=""
                        for device_num in "${!devices[@]}"; do
                            # get name of retroarch auto config file
                            file=$(grep --exclude=*.bak -rl "$configdir/all/retroarch-joypads/" -e "\"${devices[$device_num]}\"")
                            atebitdo_hack=0
                            [[ "$file" == *8Bitdo* ]] && getAutoConf "8bitdo_hack" && atebitdo_hack=1
                            if [[ -f "$file" ]]; then
                                if [[ -n "$bind" && "$bind" != *, ]]; then
                                    bind+=","
                                fi
                                bind+=$(getBind "${hotkeys_rp[$i]}" "${device_num}" "$file")
                            fi
                        done
                        # write hotkey to mupen64plus.cfg
                        iniConfig " = " "\"" "$config"
                        iniSet "${hotkeys_m64p[$i]}" "$bind"
                    done
                }
                

                This problem now begins to makes sense because I recently added two hotkeys to the RetroArch auto config about a week ago. However, after having now reverted the config file to it's original state, the problem still persists. It's like the script calls out to the RetroArch auto config file on launch, gets confused and returns nothing, which results in a blank entry. What possible requirement is not being met?

                RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                1 Reply Last reply Reply Quote 0
                • mediamogulM
                  mediamogul Global Moderator
                  last edited by

                  Apparently it was a problem with the .bak file for my controller located at /opt/configs/all/retroarch-joypads/. Deleting it solved the whole situation. I noticed that the script module is configured to ignore it, but I thought it might not be for some reason and sure enough it paid off. A new .bak has even been created and is not throwing Mupen64plus off, so I assume it was a fluke of some kind.

                  RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post

                  Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                  Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.