I tested gizmo’s script and it worked. just for reference this is the code that was added with it under the core events section in mupen64plus.cfg
# Joystick event string for stopping the emulator
Joy Mapping Stop = "J0B7/B6"
# Joystick event string for switching between fullscreen/windowed modes
Joy Mapping Fullscreen = ""
# Joystick event string for saving the emulator state
Joy Mapping Save State = "J0B5/B6"
# Joystick event string for loading the emulator state
Joy Mapping Load State = "J0B4/B6"