mupen64plus / mupen64plus-ui-python

A frontend for Mupen64Plus
http://m64py.sourceforge.net/
GNU General Public License v3.0
242 stars 66 forks source link

Trouble with XBox 360 Controller Configuration on Linux #205

Open Erotemic opened 2 years ago

Erotemic commented 2 years ago

Hi all, I'm a fairly experienced dev looking to play some Mario 64 (and the Peach's Fury romhack from Kaze), and I'm having a lot of trouble getting it to work with

  1. High quality graphics
  2. An xbox360 controller

I can get one, or the other, but I'm really looking to understand why I'm having issues with both. I've tried multiple ways of installing and running mupen64plus, but this frontend has been the easiest to use so far.

I'm not 100% sure that this is an issue for this repo, so please redirect me to the appropriate forum if this is off topic, but I think there is a reasonable chance that it's an issue here.

Versions

I'm on Ubuntu 22.04. I'm using pyenv to manage my python virtual environments.

CPython is 3.9.9 PyQt5 is 5.15.6 pysdl2 is 0.9.11

I cloned the latest master branch (f6a06ba901a063c94985d4b393c5b1af0c10c15c) from github.

I installed mupen64plus-ui-python via python setup.py build and then I ran pip install -e .. This puts the m64py executable into my PATH, and I run that.

What Works

Launching m64py works fine. I get:

M64Py - A frontend for Mupen64Plus version 0.2.5

Frontend: INFO: attached to library 'Mupen64Plus Core' version 2.5.0
Frontend: INFO: includes support for Dynamic Recompiler.
Frontend: INFO: includes support for MIPS r4300 Debugger.
Frontend: INFO: video extension enabled

For plugins, the Settings GUI reports:

I can load in the romhack and I get great graphics (something flatpak and retroarch did not seem to give).

image

For reference, the io.github.m64p.m64p flatpak works great with my 360 controller - so I know it's not an issue with my controller hardware - but it produces junk graphics (but that's not an issue with this repo):

image

The keyboard inputs work just fine. So my inputs are registered.

The output I get when loading this way is:

Core: Goodname: PEACHS FURY   64 (unknown rom)
Core: Name: PEACHS FURY   64    
Core: MD5: F8430D574FF9904E4ED94EFB3E368020
Core: CRC: 614DAD43 93171AD5
Core: Imagetype: .z64 (native)
Core: Rom size: 20505744 bytes (or 19 Mb or 152 Megabits)
Core: Version: 1444
Core: Manufacturer: Nintendo
Core: Country: USA
Frontend: INFO: using Video plugin: 'Mupen64Plus OpenGL Video Plugin by Rice' v2.5.0
Frontend: INFO: using Audio plugin: 'Mupen64Plus SDL Audio Plugin' v2.5.0
Input: 1 SDL joysticks were found.
Frontend: INFO: no cheat codes found for ROM image b'PEACHS FURY   64'
Input: No auto-config found for joystick named 'Xbox 360 Controller' in InputAutoConfig.ini
Input: N64 Controller #1: Forcing default keyboard configuration
Input: 1 controller(s) found, 1 plugged in and usable in the emulator
Input: Couldn't open rumble support for joystick #1
Input: Couldn't open rumble support for joystick #2
Input: Couldn't open rumble support for joystick #3
Input: Couldn't open rumble support for joystick #4
Input: Mupen64Plus SDL Input Plugin version 2.5.0 initialized.
Frontend: INFO: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.0
Frontend: INFO: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.0
Core: Selected state slot: 5
Video: SSE processing enabled.
Video: ROM (CRC 43ad4d61d51a1793-45) not found in INI file
Video: Initializing OpenGL Device Context.
Video: Using OpenGL: NVIDIA Corporation - NVIDIA GeForce RTX 3090/PCIe/SSE2 : 4.6.0 NVIDIA 470.129.06
Audio: Initializing SDL audio subsystem...
Input: Couldn't open rumble support for joystick #1
Input: Couldn't open rumble support for joystick #2
Input: Couldn't open rumble support for joystick #3
Input: Couldn't open rumble support for joystick #4
Core: Starting R4300 emulator: Dynamic Recompiler
Core: R4300: starting 64-bit dynamic recompiler at: 0x7f826a057fa0

What isn't working

What isn't working is my xbox 360 controller. Using the defaults the inputs don't seem to register.

Going into the Input Settings, I tried changing the "Device" from "Keyboard/Mouse" to "Joystick 0 (Xbox 360 Controller)", which is something that automatically exists, so there is at least some detection of it. However, going back to the game, the joystick inputs don't register, but keyboard inputs still work.

The message here (which is the same as the above) indicates that there is some issue:

Input: No auto-config found for joystick named 'Xbox 360 Controller' in InputAutoConfig.ini
Input: N64 Controller #1: Forcing default keyboard configuration
Input: 1 controller(s) found, 1 plugged in and usable in the emulator

Changing the config "Mode" to "Auto with named SDL device" has the same properties.

What is different is when I change "Device" to "Joystick 0 (Xbox 360 Controller)" and I change "Mode" to "Fully Manual". I'm able to go through each button and set it to its appropriate setting on the 360 controller (again verifying the 360 controller is working correctly). So I click the button next to "Up", press up on my dpad and it correctly changes to "hat (0 Up)". I go through this for each button and get the following:

image

I then close the plugin menu, and open the ROM.

I get the output:

 __  __                         __   _  _   ____  _            
|  \/  |_   _ _ __   ___ _ __  / /_ | || | |  _ \| |_   _ ___  
| |\/| | | | | '_ \ / _ \ '_ \| '_ \| || |_| |_) | | | | / __| 
| |  | | |_| | |_) |  __/ | | | (_) |__   _|  __/| | |_| \__ \ 
|_|  |_|\__,_| .__/ \___|_| |_|\___/   |_| |_|   |_|\__,_|___/ 
             |_|                                               

M64Py - A frontend for Mupen64Plus version 0.2.5

Frontend: INFO: attached to library 'Mupen64Plus Core' version 2.5.0
Frontend: INFO: includes support for Dynamic Recompiler.
Frontend: INFO: includes support for MIPS r4300 Debugger.
Frontend: INFO: video extension enabled
Input: No auto-config found for joystick named 'Xbox 360 Controller' in InputAutoConfig.ini
Core: Goodname: PEACHS FURY   64 (unknown rom)
Core: Name: PEACHS FURY   64    
Core: MD5: F8430D574FF9904E4ED94EFB3E368020
Core: CRC: 614DAD43 93171AD5
Core: Imagetype: .z64 (native)
Core: Rom size: 20505744 bytes (or 19 Mb or 152 Megabits)
Core: Version: 1444
Core: Manufacturer: Nintendo
Core: Country: USA
Frontend: INFO: using Video plugin: 'Mupen64Plus OpenGL Video Plugin by Rice' v2.5.0
Frontend: INFO: using Audio plugin: 'Mupen64Plus SDL Audio Plugin' v2.5.0
Input: 1 SDL joysticks were found.
Input: N64 Controller #1: Using manual config for SDL joystick 0
Input: 1 controller(s) found, 1 plugged in and usable in the emulator
Frontend: INFO: no cheat codes found for ROM image b'PEACHS FURY   64'
Input: Rumble activated on N64 joystick #1
Input: Couldn't open rumble support for joystick #2
Input: Couldn't open rumble support for joystick #3
Input: Couldn't open rumble support for joystick #4
Input: Mupen64Plus SDL Input Plugin version 2.5.0 initialized.
Frontend: INFO: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.0
Frontend: INFO: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.0
Core: Selected state slot: 5
Video: SSE processing enabled.
Video: ROM (CRC 43ad4d61d51a1793-45) not found in INI file
Video: Initializing OpenGL Device Context.
Video: Using OpenGL: NVIDIA Corporation - NVIDIA GeForce RTX 3090/PCIe/SSE2 : 4.6.0 NVIDIA 470.129.06
Audio: Initializing SDL audio subsystem...
Input: Rumble activated on N64 joystick #1
Input: Couldn't open rumble support for joystick #2
Input: Couldn't open rumble support for joystick #3
Input: Couldn't open rumble support for joystick #4
Core: Starting R4300 emulator: Dynamic Recompiler
Core: R4300: starting 64-bit dynamic recompiler at: 0x7fd72c657fa0

but then the very weird thing happens. It just hangs. I get a blank screen that says Mupen64Plus Started... but then nothing happens.

image

... and while writing this, I double clicked the previous screen to put it into full screen and got a stranger result:

image

No idea what is causing that. There is no additional output on stdout/stderr. Pressing Esc causes the GUI to go back to the open menu, so it's not a freeze. But I can't open a ROM again....

Ok, so more things I tried the fully manual configuration with the regular mario64 rom, and that worked. So it's it seems it is some issue with the romhack? I also loaded the romhack after loading mario64, and it the romhack worked with the controller input... so I guess I found a way to get what I wanted... but I have to first load regular mario, let it run for a little bit, and then run the romhack. That's certainly not an issue in this repo, but it is strange.

Note: I did have to map the Z button to "button (4)" which is the L button, which is fine, but a bit annoying. The right trigger kept registering itself as axis(2-), which caused mario to crouch on every frame as it seems to be constantly pressed? So there might be an issue with getting that mapping correct in this GUI.

Even though I half solved the issue while typing, I'm still going to submit this for my own reference, and that there might be an issue with auto-detecting the controller in this repo, but it seems a lot of the problems also have to do with the romhack itself.

gen2brain commented 2 years ago

Hi, for joystick auto-config you can try to add the joystick name that is reported to InputAutoCfg.ini, I guess somewhere here https://github.com/mupen64plus/mupen64plus-input-sdl/blob/master/data/InputAutoCfg.ini#L917. If auto-config works after that you can probably send the PR with your change.

For graphics, you can try the GLideN64 video plugin https://github.com/gonetz/GLideN64, I usually get the best performance/quality with that plugin.

Erotemic commented 2 years ago

@gen2brain brilliant, that maps the z button correctly as well. (Which maybe the fact that the UI registers it as axis(-2) instead of button(7) might be a bug in this repo? Or is that interface handled by the input-sdl plugin?)

Either way adding that to my /usr/share/games/mupen64plus/InputAutoCfg.ini fixes the issue.

And yes, the GLideN64 plugin does work well with my the mupen64plus that I installed via apt, but the plugin doesn't seem to come bundled with the flatpak I installed. Not sure how to install that with io.github.m64p.m64p from flathub, but its a bit moot for me at this point, because the version from apt plus this frontend is what I'm going with.