sonik-br / GunconUSB

Use Guncon 2 and 3 on Windows
GNU General Public License v2.0
25 stars 3 forks source link

W7 random disconnects on Guncon2 #2

Open psakhis opened 1 year ago

psakhis commented 1 year ago

Can you provide a guncon2 console with some logger?

I'm pretty sure some exception occurs in it.

sonik-br commented 1 year ago

Hi. GC2 stops responding. Happens with me too. It tend to happen more when I'm too close to the screen.

When it hangs, my app hangs too. Device need to be reconnected to usb port.

Program does not have any kind of log. Sorry.

psakhis commented 1 year ago

Seems something with vjoy comunication, with your app alone, works perfectly.

sonik-br commented 1 year ago

Vjoy? Can you elaborate more?

psakhis commented 1 year ago

Ofc.

  1. Installed your driver --> Ok
  2. Executed your app for start/stop and calibrate --> Ok. This reports any trigger o Axis fine --> Never see any disconnects here
  3. For show joystickID on emulators, i installed vjoy (here i think you are using wrapper to it). Now appears PID on vjoy when your app is started
  4. Random disconnects. I tried different vjoy versions from 2.04 to 2.1.9.1. So i think disconnects appears only when your app is using wrapper with vjoy.
sonik-br commented 1 year ago

Program might need to be build targeting a new vjoy version. But I can't work on this app anymore. Sorry.

I remember working on a new version with Tetherscript instead of vjoy... But Tetherscript has been discontinued. #3

psakhis commented 1 year ago

Thanks, no problem. I'll try to continue your work. Can i use your source code?

sonik-br commented 1 year ago

Sure! Feel free to use and make PRs if you change something.

I don't remember if Guncon2Console is working or not. But you should take a look into it.It's the "newer" version using Tetherscript to output.

Another possible solution would be to use an external hardware that outputs as usb HID and wont require any custom driver. Something like using a Pi Pico to read the guncon and output using the Pico's usb.

sirdankz commented 1 year ago

I was trying your program after installing the drivers. It works with all the buttons and trigger showing as working in the program . Only issue is even using gamepad mode it acts as a mouse and you can't do anything else. Should I need winusbnet? I had forgot to get that and haven't installed any libraries in windows 10. I've only done stuff like that in linux..

sonik-br commented 1 year ago

If buttons shows in app, then no need to install any other driver. Sorry but I don't remember if the gamepad mode was working at all. The winforms version of the app should use vjoy to simulate a joystick. The console version should use theterscript for both joystick and mouse.

psakhis commented 1 year ago

I'm doing a proof with python and libusb, i will test now with emulators

sirdankz commented 1 year ago

Sorry for being off topic in the issue comments.. also would like to add that I've tried mouse mode and it still doesn't click as a mouse. Maybe it's messing up because I do have quite a few controller remappers installed causing some conflicting to happen..

sirdankz commented 1 year ago

I'm doing a proof with python and libusb, i will test now with emulators

Let me know how it goes and can you please write a tutorial if it works ?

sonik-br commented 1 year ago

Doing it for windows? If linux, then there's already very good drivers out there for both the GC2 and GC3 :)

psakhis commented 1 year ago

Yes, for Windows. Python "daemon" receives inputs from GC2 and sends strokes to keyboard/mouse.

sirdankz commented 1 year ago

Yes, for Windows. Python "daemon" receives inputs from GC2 and sends strokes to keyboard/mouse.

How do we set this up? I have a windows outputting 15hz via crtemudriver and would love to try this out.

psakhis commented 1 year ago

I'm testing now. I share with you the solution. I don't want set dependencies, only pure python and seems works nice. I need try if mouse mode works without input lag on emulators.

sonik-br commented 1 year ago

I don't think it will be possible to use two guns at the same time this way. Also wont be possible to use it as a joystick I think?

sirdankz commented 1 year ago

I'm testing now. I share with you the solution. I don't want set dependencies, only pure python and seems works nice. I need try if mouse mode works without input lag on emulators.

Thank you . I really appreciate it

sirdankz commented 1 year ago

Doing it for windows? If linux, then there's already very good drivers out there for both the GC2 and GC3 :)

Yea for now I'm just using batocera os that runs off Linux. It has built in light gun support. I'm just figuring out how to install the custom resolutions now..

psakhis commented 1 year ago

I'm on groovyarcade and guncon driver works nice under linux and gamepad mode. My proof of concept on windows is finished; works incredible well as mouse mode. I just need write a calibration tool and will be done.

psakhis commented 1 year ago

I find a problem than not happens in driver kernel linux. For games on brightness is needed on frame, it's too slow reading values using a daemon. On nes works great but not on psx or saturn. Even applying shader on emulator on the next frame, daemon is too much slow (this not happens on linux); this happens on sonik-br implementation on c# and python as well.

EDIT: probably the solution is HID driver or implement reading device inside emulators

sonik-br commented 1 year ago

A real (kernel) driver would indeed be the ideal solution. I think using an external device like a Pico would also work.

psakhis commented 1 year ago

Daemon logs 16ms on reads (this is correct for 60hz gun sensor); but for some reason emulator vs daemon sync isn't ideal.

True, a real kernel driver is the way to go, but windows hid drivers are too complex for my knowledge.

psakhis commented 1 year ago

I solved speed issues, now is reading at 8~9 ms; i think is because after install your winusb driver w7 needs a reboot to work properly with usb or something. Now emulator works fine, just needs a calibration tool!

sirdankz commented 1 year ago

Doing it for windows? If linux, then there's already very good drivers out there for both the GC2 and GC3 :)

Sorry but what would you recommend for getting a 15khz signal out of linux?.Linux?.. I'm trying to use my guncon on Linux until this project for windows is complete..

sirdankz commented 1 year ago

I solved speed issues, now is reading at 8~9 ms; i think is because after install your winusb driver w7 needs a reboot to work properly with usb or something. Now emulator works fine, just needs a calibration tool!

Make a set up tutorial please !

psakhis commented 1 year ago

You can test it. https://github.com/psakhis/guncon2

It works, but it have 1 or 2 frames of input lag vs linux version.

EDIT: Now the reads are async like kernel driver on linux, no more lag.

sirdankz commented 1 year ago

You can test it. https://github.com/psakhis/guncon2

It works, but it have 1 or 2 frames of input lag vs linux version.

EDIT: Now the reads are async like kernel driver on linux, no more lag.

Does this mean I won't need linux to play guncon games now :o I'm about to test it out! Have you tried to use the guncon on a 31khz display or is it only for 15khz?

sonik-br commented 1 year ago

Unfortunately no one knows how to make it work at native 31k. Or if it's even possible...

sirdankz commented 1 year ago

Unfortunately no one knows how to make it work at native 31k. Or if it's even possible...

I read from misterfpga :if you use 100% black scanline effect you will effectively recreate a 240p 15kHz flicker rate on a 31kHz " using a zapper from the nes. Could this be applied in someway for guncons?

sonik-br commented 1 year ago

No. Zapper works in a different way.

psakhis commented 1 year ago

I included a nice feature (on linux driver as well) to calibrate gun on run-time pressing c-button and dpad directions for increase or decrease x min and max values. This solves my problems with some games