mupen64plus / mupen64plus-core

Core module of the Mupen64Plus project
1.28k stars 257 forks source link

[Feature Request] Automated Changing between rumble and controller pak #896

Open Papermanzero opened 3 years ago

Papermanzero commented 3 years ago

Based on this documentation and that documentation about the N64 protocol, I was thinking how to automate the rumble and controller pak switching. So the user has not go into menus and change the pak manuelly via the menues.

In general the N64 sends the controller command 0x00 to look for the state of the controller. So a state machine to rotate through the paks needs to be written.

  1. After the N64 sends 0x00 to the controller
  2. The controller should respond with 0x01 which is either the controller pak or rumble pak.
  3. Then the N64 sends control bytes to the controller address 0x8000 (0xFEs)
  4. The N64 reads the respond (0x80) then the N64 knows it is a rumble pak.
    • Here either the game continues with the rumble pak (sends command to 0xC000) -> Rumble can be used
    • If the console does not send a command to 0xC000 -> The rumble pak was not requested by the game
    • Then the N64 sends again the control byte to the controller address 0x8000
  5. The N64 reads now the respond 0x00 from address 0x8000 then the N64 knows it is a controller pak
  6. The controller pak is now detected and can be used.
  7. If the N64 sends again 0x00 to the controller, the state machine begins from step 1.

This feature can be implemented in mupen64plus as Auto Switching (Rumble/Controller Pak) So the user should never manually go to the menue again.

Already mentioned this feature in Mupen64Plus-NX: https://github.com/libretro/mupen64plus-libretro-nx/issues/375

loganmc10 commented 3 years ago

I'm fairly certain this is already supported. I just can't remember what hotkeys are preconfigured to do it.

Jj0YzL5nvJ commented 3 years ago
Mempak switch = "key(44)"
Rumblepak switch = "key(46)"

Even so, the games that support hot swapping paks are counted with the fingers of one hand (Perfect Dark and... who knows). Exchanging controller paks with different pages structure usually ends in 3rd party data corruption...

Papermanzero commented 3 years ago

I am not talking about hot swapping. Which is indeed supported. I am talking about an implementation without going into menus or to hotswap. Everything is done on emulator side.

Jj0YzL5nvJ commented 3 years ago

Mempak switch demonstration, I don't see any menu... At the moment I don't have any good PC at my disposal, I can upload a video later.

key(44) == ,

Papermanzero commented 3 years ago

in every case the user has to open the options of the emulator (menu of the emulator) or to use a key on the keyboard to manually change between rumble and controller pak. This approach is to get rid of that, because the emulator detects when to insert which pak. So the user has to do nothing anymore

Jj0YzL5nvJ commented 3 years ago

Mempak switch part 2... I ran into some technical issues, it's not possible to auto-configure a controller if the same device is already shared with another. This is especially disastrous at first run initialization. Mupen64Plus only saves Controller Pak 1 to disk, all the others are discarded at the end of the emulation. That or they all share the exact same file name... The emulator doesn't re-read the controller pak from disk when reconnecting it (locked ramdisk?).

@Papermanzero, I'm pretty sure that said feature is beyond the scope of this project. That kind of thing is usually implemented by hacks or scripts on the frontend. And I don't think it works smoothly (micro stuttering) without game hacks for every game.

Papermanzero commented 3 years ago

The benefit of an emulator is to accomplish things which are beyond the capabilities of the console. There are many many examples which shows that. Near’s famous MSU implementation, PGXP from icatbuttler, automated disc change for gamecube (which is by the way very similar), higher framerates etc.

Some of those things would also be possible with hacks. But the elegant way is to provide the feature in emulators to keep games untouched.

Nobody says it must be implemented today, but maybe there is someone who is interested in a automated pak change as well and tries to develop a state machine which would improve the usability a lot.

Papermanzero commented 3 years ago

In summary 101 games are using both: The controller pak and the rumble pak. Here is a list which I created now:

All-Star Baseball '99 All-Star Baseball 2000 All-Star Baseball 2001 Armorines: Project S.W.A.R.M. Army Men: Sarge's Heroes Army Men: Sarge's Heroes 2 Asteroids Hyper 64 Automobili Lamborghini Battlezone: Rise of the Black Dogs Beetle Adventure Racing Big Mountain 2000 Blues Brothers 2000 Buck Bumble Bust-A-Move '99 California Speed Carmageddon 64 Chameleon Twist 2 Daikatana Deadly Arts Diddy Kong Racing Duke Nukem 64 Excitebike 64 Extreme-G Fighters Destiny Fighter Destiny 2 Fighting Force 64 Flying Dragon Forsaken 64 Gauntlet Legends Gex 3: Deep Cover Gecko Goemon's Great Adventure Hot Wheels Turbo Racing Hybrid Heaven Hydro Thunder Iggy's Reckin' Balls International Superstar Soccer 2000 International Track & Field 2000 Jeremy McGrath Supercross 2000 Knockout Kings 2000 Lego Racers Madden '99 Madden 2000 Madden 2001 Madden 2002 Madden 64 Mia Hamm Soccer 64 Micro Machines 64 Turbo Mike Piazza's Strike Zone Milo's Astro Lanes Monaco Grand Prix Mortal Kombat 4 Mortal Kombat Mythologies: Sub-Zero Nascar '99 Nascar 2000 NBA In the Zone '98 NBA In the Zone '99 NBA In the Zone 2000 NBA Jam 2000 NBA Live '99 NBA Live 2000 NFL Blitz NFL Blitz 2000 NFL Blitz 2001 NFL Blitz Special Edition NHL '99 NHL Blades of Steel '99 Nightmare Creatures Nuclear Strike 64 Off Road Challenge Perfect Dark Polaris Snocross Rally Challenge 2000 Rampage 2: Universal Tour Razor Freestyle Scooter Ready 2 Rumble Boxing Ready 2 Rumble Boxing Round 2 Re-Volt Road Rash 64 Roadsters Robotron 64 Snowboard Kids South Park Rally South Park Stunt Racer 64 Supercross 2000 Tarzan Tony Hawk's Pro Skater Tony Hawk's Pro Skater 2 Tony Hawk's Pro Skater 3 Top Gear Rally Top Gear Rally 2 Toy Story 2 Triple Play 2000 Turok 2: Seeds of Evil Turok 3: Shadow of Oblivion Turok: Rage Wars Twisted Edge Extreme Snowboarding WCW Mayhem WCW Nitro Wipeout 64 World Driver Championship