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 --- Bug Reports --- Site News

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

  

Author Topic: PS1 G-Con as USB Mouse  (Read 8896 times)

0 Members and 1 Guest are viewing this topic.

sonik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:May 26, 2022, 09:47:56 pm
  • I want to build my own arcade controls!
PS1 G-Con as USB Mouse
« on: March 02, 2021, 09:19:17 am »
I'm trying to adapt a ps1 guncon to usb mouse using an arduino.
Already got some readings from the guncon and mapped it as a mouse. This could theoretically work on any machine with usb hid mouse support.
It's reporting error from time to time. Seems like it can not be read in the middle of a vsync (witch I don't have any control)
Any advice? I can't find much info on this and the drivers for windows are all closed source.

Update:
Project is now on github
https://github.com/sonik-br/GunconDuino
« Last Edit: April 14, 2021, 01:47:51 pm by sonik »

sonik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:May 26, 2022, 09:47:56 pm
  • I want to build my own arcade controls!
Re: PS1 G-Con as USB Mouse
« Reply #1 on: March 04, 2021, 08:10:05 am »
After some tweaks it's working very stable! :D
I will make a video later.
If anyone wants to make it just needs an arduino (I'm using a Leonardo) and a way to connect the gun to it (I'm an ps1 extension cord).
Tested on windows only. Should work in any OS as it's reporting as a usb hid mouse.

sonik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:May 26, 2022, 09:47:56 pm
  • I want to build my own arcade controls!
Re: PS1 G-Con as USB Mouse
« Reply #2 on: March 04, 2021, 10:19:00 am »
Testing on windows 10 at 240p


burn_654

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 152
  • Last login:April 06, 2022, 09:41:32 pm
  • I want to build my own arcade controls!
Re: PS1 G-Con as USB Mouse
« Reply #3 on: March 04, 2021, 11:52:13 am »
Very, very interested in following this! Especially your code on extracting the location from sync data.

I've been on and off over the last several years working on a concept to get (3rd party) Guncon2's working with crt's using the TopGun driver (I've nicknamed it TopGunCon in some old threads). I've more or less accomplished the goal but it's a spaghetti mess of code and hardware. In its last running form it used 555 circuits to delay the shot just slightly, pulse an input on a usb interface (I used an input on jpac but most any would work) to launch a full-screen screen 'flasher' app. This limited shots to be timed within a white screen flash from my app so all locations on the screen could be properly shot and allow off-screen reload. If I had to get my specific scheme out there now I'd definitely clean it up and implement as much as possible in an arduino. Having a solution with an open code-base could solve a lot of problems I was solving because of the specific behavior of the Topgun driver.

The flash becomes necessary even in games that have one, some (such as mame) only determine a *shot* or *miss* input after the controller logic has already happened - it plays dumb in that respect. If mame gets a left click (shot) it submits a left click to the mouse hardware coordinates. If it receives a right click it thinks it's offscreen. Thus, it's up to you to determine the on-screen/offscreen logic of the gun and send the appropriate left click/right click to the computer. At least that's the logic I followed. The flasher app my brother and I developed used the windows gamma ramp as a fullscreen *white* flash so it worked no matter resolution/fullscreen or windowed etc. It can map timed flashes to most hid devices (keyboard, mouse, gamepad). There are some minor issues with some colors not reaching all the way to white (windows protections because of the gamma ramp method), but overall it's been successful. It sounds like you may be able to use it with this, if it helps with your prototyping? I would be glad to provide it privately.

I'll be following this with great interest...I'm not sure on the vsync issue. But I would be glad to test/chat about this!

sonik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:May 26, 2022, 09:47:56 pm
  • I want to build my own arcade controls!
Re: PS1 G-Con as USB Mouse
« Reply #4 on: March 04, 2021, 12:16:44 pm »
I'm not touching video signal at all.
Just reading the guncon with an arduino and the amazing library PsxNewLib.

If you have a guncon1, a arduino and a way to connect the guncon to it, you could try it!
My code works but it needs some adjustments and a propper way to calibrate.
I still need to test it with games and see if it's required to flash the screen.

I have also a code to access a guncon2 via usb and move the mouse. Works on windows 10. It's not a "driver".
Works with guns that dont have the "rolling x" problem. It's possible to fix but I have not done it yet.

I can share everything if there's any interest.

burn_654

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 152
  • Last login:April 06, 2022, 09:41:32 pm
  • I want to build my own arcade controls!
Re: PS1 G-Con as USB Mouse
« Reply #5 on: March 10, 2021, 05:19:25 pm »
I'd say yeah, go for it!

I've loaded up with a few extra arduino pro micro's (same chip as leonardo), I can definitely order a psx extension to mess with this.

Given there's been so little love in crt light gun projects (and to suddenly see two very interesting projects just appear!) I'd say whatever you have is worth sharing for people to look at. :cheers:

sonik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:May 26, 2022, 09:47:56 pm
  • I want to build my own arcade controls!
Re: PS1 G-Con as USB Mouse
« Reply #6 on: March 10, 2021, 08:32:22 pm »
Cool!
I will release the code in the coming days.
But be warned that it still needs a lot of fine tuning to be usable. Also I got it working with oficial namcon guncon. Could not make it work with a "clone" guncon that I have.

If/when it works as it should I will definitely get this arduino shield:
https://www.pcbway.com/project/shareproject/PsxControllerShield_V1.html

sonik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:May 26, 2022, 09:47:56 pm
  • I want to build my own arcade controls!
Re: PS1 G-Con as USB Mouse
« Reply #7 on: March 13, 2021, 08:42:28 am »
I'd say yeah, go for it!

I've loaded up with a few extra arduino pro micro's (same chip as leonardo), I can definitely order a psx extension to mess with this.

Given there's been so little love in crt light gun projects (and to suddenly see two very interesting projects just appear!) I'd say whatever you have is worth sharing for people to look at. :cheers:

Project is now on github
https://github.com/sonik-br/GunconDuino
« Last Edit: April 14, 2021, 01:47:09 pm by sonik »

Marsupial

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 509
  • Last login:April 28, 2022, 09:39:48 pm
  • I am teh Mars!
Re: PS1 G-Con as USB Mouse
« Reply #8 on: April 29, 2021, 10:32:36 pm »
Would this work with other PS1 light gun?
You only mention having tried one guncon clone.


I got a nyko super cobra light gun and my arcade has a CRT vga screen... If there are chances this actually works I'd be willing to give it a test.


« Last Edit: April 30, 2021, 12:14:41 am by Marsupial »
-Mars

sonik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:May 26, 2022, 09:47:56 pm
  • I want to build my own arcade controls!
Re: PS1 G-Con as USB Mouse
« Reply #9 on: April 30, 2021, 09:35:42 pm »
I only have one guncone clone gun to test.
Can't say if it will work with others.
I will try to make it work again in the coming days. Will let you know if it works.
And I could not make it work with a vga monitor. only standard def crt tv.
For real vga support you should check GUN2CRT.

Marsupial

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 509
  • Last login:April 28, 2022, 09:39:48 pm
  • I am teh Mars!
Re: PS1 G-Con as USB Mouse
« Reply #10 on: April 30, 2021, 10:20:25 pm »
Thanks.
Not vga compatible is a bummer.

Keep us posted of the progress.
-Mars

manhunt

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 2
  • Last login:May 20, 2022, 07:01:19 am
  • I want to build my own arcade controls!
Re: PS1 G-Con as USB Mouse
« Reply #11 on: June 18, 2021, 02:34:45 pm »
Letís make a tutorial, the compilation is unsuccessful, the production code is unsuccessful, thank you

sonik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:May 26, 2022, 09:47:56 pm
  • I want to build my own arcade controls!
Re: PS1 G-Con as USB Mouse
« Reply #12 on: June 18, 2021, 04:04:29 pm »
I've sent a PM to you.
Need more details.

bandicoot

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 94
  • Last login:May 22, 2022, 01:23:10 pm
Re: PS1 G-Con as USB Mouse
« Reply #13 on: June 19, 2021, 08:46:45 am »
no problem for me to program it , it really work well ( i need to increase brightness of my CRT but this is the same with my Playstation :) )
In the future if we could turn G-CON45 to a GUNCON2 to make this work on PS2 too  :applaud:
Thankls for your work @sonik

sonik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:May 26, 2022, 09:47:56 pm
  • I want to build my own arcade controls!
Re: PS1 G-Con as USB Mouse
« Reply #14 on: June 19, 2021, 09:10:34 am »
no problem for me to program it , it really work well ( i need to increase brightness of my CRT but this is the same with my Playstation :) )
In the future if we could turn G-CON45 to a GUNCON2 to make this work on PS2 too  :applaud:
Thankls for your work @sonik

I'm glad it's been useful :)
I've added support to use it as a mouse or a joystick. Need to do some testings before I will update the source on github...
For PS2 output I will need some help. Have no idea how to do it. It's my first project arduino project and I also don't have good knowledge with electronics.
Would be great to have it output to PS2 and the original Xbox.

sonik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:May 26, 2022, 09:47:56 pm
  • I want to build my own arcade controls!
Re: PS1 G-Con as USB Mouse
« Reply #15 on: June 30, 2021, 06:16:49 pm »
Playstation accessories works with 3.3v.
Arduino is sending 5v on it's data pins. It can damage the guncon.

I'm doing some tests with a level shifter and also using the hardware SPI on the Leonardo.
I'm waiting for my arduino shield to arrive then will do more testings.

I advise to not use it with 3.3v.

BTW by using the correct voltage and the hardware SPI, seems like my thirdy party gun will work! This is great news!

Marsupial

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 509
  • Last login:April 28, 2022, 09:39:48 pm
  • I am teh Mars!
Re: PS1 G-Con as USB Mouse
« Reply #16 on: June 30, 2021, 07:14:12 pm »
There are several 3.3v arduino. Maybe change board model?
-Mars

sonik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:May 26, 2022, 09:47:56 pm
  • I want to build my own arcade controls!
Re: PS1 G-Con as USB Mouse
« Reply #17 on: June 30, 2021, 08:06:10 pm »
The 3.3v boards have half processor clock speed.
At least the ones I know.

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8897
  • Last login:Today at 05:59:46 am
  • Designated spam hunter
Re: PS1 G-Con as USB Mouse
« Reply #18 on: June 30, 2021, 09:16:05 pm »
The 3.3v boards have half processor clock speed.
At least the ones I know.
A 3.3v 32u4 AVR board running at 8MHz should be fast enough for an encoder firmware.   ;D
- Bruno used 3.3v from various consoles such as PS1, PS2, Wii, Wii U, NES Classic, GC (3.43v), and N64 to power the AVR board for the miniArcade 2.0 firmware. (see page 7 of the User Guide)


Scott
« Last Edit: June 30, 2021, 09:21:31 pm by PL1 »

sonik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:May 26, 2022, 09:47:56 pm
  • I want to build my own arcade controls!
Re: PS1 G-Con as USB Mouse
« Reply #19 on: June 30, 2021, 10:55:18 pm »
Cool!
It might work then if it can be used as a USB HID device.

For now I will keep using the Leonardo as it's the only arduino I have. And I'm waiting for the shield to arrive.


PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8897
  • Last login:Today at 05:59:46 am
  • Designated spam hunter
Re: PS1 G-Con as USB Mouse
« Reply #20 on: July 01, 2021, 07:37:31 am »
It might work then if it can be used as a USB HID device.

For now I will keep using the Leonardo as it's the only arduino I have. And I'm waiting for the shield to arrive.
Yes, you can define any of the 32u4 series boards as a USB HID device via the firmware, assuming you use the proper code.
- I can't help with the HID code, but baritonomarchetto might.

On second thought, a lightgun mouse needs a lot more processing power than a console encoder for buttons and A/D conversion for analog thumbsticks so 3.3v/8MHz might not be fast enough to avoid lag.   :dunno
- It can't hurt to try and many of the boards have a solder pad jumper to select 3.3v or 5v so if running the board at 3.3v/8MHz doesn't work, you can easily revert to 5v/16MHz.
- Of course, if the board does work well with 3.3v, you don't need the 3.3v<=>5v logic level converter chips to protect the gun.   ;D

If you want to make it compatible with more AVR boards like the commonly-available and very-inexpensive Pro Micro, you might want to only use pins/ports that are available on that board.
- Avoid the seven pins/ports listed at the bottom of this diagram.
- For example, the miniArcade 2.0  firmware uses port C7 (32u4 pin 32) for rotary joystick #2 (Rot. 2B) so you can't run two rotary sticks on a single Pro Micro.  :(




Scott

sonik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:May 26, 2022, 09:47:56 pm
  • I want to build my own arcade controls!
Re: PS1 G-Con as USB Mouse
« Reply #21 on: July 01, 2021, 08:04:42 am »
Pins are not a problem.
User can map the 4 PSX data pins to any 4 arduino I/O pins. Just need to update the sketch file with the pins numbers.

But I will start to interface the PSX controller using arduino's hardware SPI so it will need those dedicated pins.

sonik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:May 26, 2022, 09:47:56 pm
  • I want to build my own arcade controls!
Re: PS1 G-Con as USB Mouse
« Reply #22 on: August 10, 2021, 11:06:46 pm »
Project updated.
Now it uses the arduino's ICSP headers and proper 3.3v.

And it now can work in mouse or joystick mode.
I prefer to use joystick mode with Mame. And it's required to work on the Mister FPGA.
« Last Edit: August 11, 2021, 02:34:23 pm by sonik »