Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Set49Mode utility for GPWiz49 on Raspberry Pi  (Read 5045 times)

0 Members and 1 Guest are viewing this topic.

mahuti

  • Wiki Master
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 2757
  • Last login:March 02, 2022, 09:51:19 pm
  • I dare anything! I am Skeletor!
Set49Mode utility for GPWiz49 on Raspberry Pi
« on: July 06, 2020, 02:01:00 am »
https://github.com/mahuti/set49mode

I made a utility to use GroovyGameGear's GPWiz49 with a 49-way stick on a raspberry pi.

Please read the readme, as there are a few things to point out that I make clear in the doc

1. The GPWiz49 encoder requires a HID quirk to be registered or it's useless as a joystick (by default the deadzone in the joystick's center will have a non-zero value until the hid quirk is added)

2. You'll need to add a UDEV rule if you don't want to run the script as root

3. Please note, this was mostly based on the work of RGBCommander, Mark Alston and others.

Once installed, it can be called like so to run 4-way diagonals.
Code: [Select]
set49mode 5
Or to run 49-way
Code: [Select]
set49mode 1
Or to do 8-way
Code: [Select]
set49mode 3
All of the modes are noted in the Readme.

I haven't written any utility to automatically pick the joystick mode however, so you'll need to pass a value through runcommand or via some other method to make use of this utility. Mark Alston wrote a Perl script that does dynamically set the mode, but I haven't tried it. I suspect it won't work on Retropie though, since it tries reload USBHID which the Pi complains about. I also wrote a version of this app in Python, so, if anyone wants the source for that let me know and I'll put it up on github.
« Last Edit: July 06, 2020, 12:19:01 pm by mahuti »
Raspberry Pi, AttractMode, and Skeletor enthusiast.

beernut

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 49
  • Last login:December 10, 2023, 07:13:46 pm
Re: Set49Mode utility for GPWiz49 on Raspberry Pi
« Reply #1 on: July 07, 2020, 09:40:19 pm »
You could easily modify my perl script to wrap your program and get the desired effect.

Just remove the code here:
Code: [Select]
# Try to set all the joysticks.
# Don't know of any games where the joysticks are set differently.
#
#0x0007 Joystick 1
#0x0008 Joystick 2
#0x0009 Joystick 3
#0x000a Joystick 4 - I think, I am guessing on this one.
# Add all the joysticks you have to the array below.

my @joysticks = (0x0007, 0x0008, 0x0009, 0x000a);
foreach (@joysticks) {
    my $gpwiz = gpwiz49->new($_);
    if ($gpwiz ne -1) {
$gpwiz->set_mode($modes{$gpwizmode},$jstype);
    }
}
system("/sbin/modprobe -r usbhid");
system("/sbin/modprobe usbhid");

with a simple line
Code: [Select]
set49mode $modes{$gpwizmode}
And also remove the unnecessary line (if you are using your code):
Code: [Select]
use gpwiz49;
At the top.

Then you can use your code but use the rest of my scripts to automate all the choosing of modes.

However, it looks like your code only handles one joystick/gpwiz49.  It would be trivial to extend it to multiple by just adding the other product id's. 

Mark Alston

mahuti

  • Wiki Master
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 2757
  • Last login:March 02, 2022, 09:51:19 pm
  • I dare anything! I am Skeletor!
Re: Set49Mode utility for GPWiz49 on Raspberry Pi
« Reply #2 on: July 08, 2020, 01:02:23 am »
Code: [Select]
However, it looks like your code only handles one joystick/gpwiz49.  It would be trivial to extend it to multiple by just adding the other product id's. 
Hah hah. Oh yeah, it'll get there in time. Thank you for the suggestions, I'll be looking into all of it.
Raspberry Pi, AttractMode, and Skeletor enthusiast.

beernut

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 49
  • Last login:December 10, 2023, 07:13:46 pm
Re: Set49Mode utility for GPWiz49 on Raspberry Pi
« Reply #3 on: July 08, 2020, 09:28:21 pm »
How are your 49ways working out btw?  I'd recommend picking up some spares as I have had two boards fail where they the joystick would only register one direction.  Serious pain in the ass.  Fortunately swapping out the board is fairly easy and spare sticks are not too expensive right now on ebay.  I imagine as they are all NOS that will change over time though.

Apparently it is the logic chip that fails so no easy fix sadly.

mahuti

  • Wiki Master
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 2757
  • Last login:March 02, 2022, 09:51:19 pm
  • I dare anything! I am Skeletor!
Re: Set49Mode utility for GPWiz49 on Raspberry Pi
« Reply #4 on: July 08, 2020, 10:22:20 pm »
I have one happs and one williams. Both work fine still. But they've sat dormant for MANY years, so that probably helps. I haven't used either since probably about 2010.

FYI, I managed to get the GPWiz40 + Roto-X working on the Pi as well today. I'm fine tuning the Rotary speed stuff right now... trying to find a good default speed, but it's nearly there. The joystick needs a hid quirk, but after that it's fine.
Raspberry Pi, AttractMode, and Skeletor enthusiast.

mahuti

  • Wiki Master
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 2757
  • Last login:March 02, 2022, 09:51:19 pm
  • I dare anything! I am Skeletor!
Re: Set49Mode utility for GPWiz49 on Raspberry Pi
« Reply #5 on: October 06, 2020, 02:37:39 pm »
By the way, the work I was doing on this has been incorporated into LEDSpicer

https://github.com/meduzapat/LEDSpicer

LEDSpicer supports multiple players
Raspberry Pi, AttractMode, and Skeletor enthusiast.