syd711 / vpin-studio

Competition, table, and player management for VPins.
MIT License
28 stars 2 forks source link

Support Controller Input for Pause Menu #130

Open Ltek opened 7 months ago

Ltek commented 7 months ago

Pause menu will not to show. Overlay menu shows properly, game is Pausing properly

**To Reproduce** Configure system as such (see 3 attached screenshots) A. VPX settings: 'P' mapped to Pause; no button assigned (stock configuration) B. Joy2Key maps 'Z' to a cabinet button C. VPS maps 'Z' to Pause Menu (screenshot attached) 1. Run Popper 2. Load Table 3. Press P : game pauses, no VPS menu shows 4. Press P again : game unpauses 5. Press Z : nothing happens **Screenshots** ![image](https://github.com/syd711/vpin-studio/assets/1626802/ab835cd1-811c-45e3-beef-19947c418bf1) ![image](https://github.com/syd711/vpin-studio/assets/1626802/4cbf29fc-0da5-4acc-801b-8e3a8d4582b6) ![image](https://github.com/syd711/vpin-studio/assets/1626802/e157f428-3592-447f-8f72-f89ec58cd0b2) [vpin-studio-server.log](https://github.com/syd711/vpin-studio/files/14106974/vpin-studio-server.log)
syd711 commented 7 months ago

A perfect report, thanks for this! I'll look into it.

syd711 commented 7 months ago

Can you verify that you have these 2x entries in the emulator setup?

image

They should be generated there automatically, but I got a similar issue recently where the entry was not there.

syd711 commented 7 months ago

I just verified this. The server log shows the message:

Skipped showing start menu: no game status found.

The game status is set through these curl calls. So once you add them, the pause menu should appear.

Ltek commented 7 months ago

I just verified this. The server log shows the message:

Skipped showing start menu: no game status found.

The game status is set through these curl calls. So once you add them, the pause menu should appear.

they are there...

image

syd711 commented 7 months ago

B. Joy2Key maps 'Z' to a cabinet button

This is the problem here: right now I only listen to native key events. So even if I read the "jobstick -> key" mapping from Popper I have to add additonal stuff to support joysticks. I already found libraries for this and keep you posted about the progress here.

Ltek commented 7 months ago

My understanding is all hardware drivers (real hardware keyboards, generic usb button converters, etc) and software converter apps (J2K, Popper, VPX, etc) convert commands to OS native Virtual-key codes, which are device-independent.

If VPS is listening for what the OS is getting (the virtual key code) then it will not matter what device or hardware sends the code. VPS will not know, or care so commands sent from J2K, popper, etc will all be heard by VPS. And the benefit is that any command can be heard by VPS and leveraged if so desired. VPX does this and so does Popper (Popper's UI on this is horrible - like most of Popper's UX)

syd711 commented 6 months ago

I did investigate and played around with some APIs a bit. With Java, the whole controller support is a bit tricky. There is a library available, but I wasn't able to achieve the expected results yet and the installation is tricky too. So this ticket may take a while longer.

Ltek commented 6 months ago

I dont know java, at all but found this...

https://www.educative.io/answers/how-to-listen-to-and-take-action-on-keyboard-strokes-in-java

https://stackoverflow.com/questions/2168968/can-java-see-activity-of-my-keyboard

https://stackoverflow.com/questions/22955770/how-to-find-key-listener-on-any-where-in-window

syd711 commented 6 months ago

I changed the title so that it matches the overall problem.

syd711 commented 6 months ago

If I can avoid it, I'd like to skip the controller support and would recommend to use tools like Joy2Key for this like you already do. I installed it and mapped key "Z" in the tool and in the Studio. The pause menu was working for me this way.

image

Ltek commented 6 months ago

I cant get VPS Pause menu or overlay to work - at all... I'm using the physical keyboard and tried multiple different key set in VPS settings.

I tried using Overlay and Pause Menu, and combining them using your check box.. the Pause menu button always pauses the table but -neither- show any menu. I also set it to show overlay on start... it does not.

I also tested with Exclusive Fullscreen on and off... same

Could you add a test button in VPS so we can test without running VPX?

btw, Z is usually mapped to nudge in VPX, I'd suggest not using that.

syd711 commented 6 months ago

I'll see if I can add a test button for the pause menu. The new version will support to distribute assets on Popper screen when pause is pressed, so a preview function certainly helps to see how the screens are set up.

syd711 commented 5 months ago

Ok, lets continue here. I added the test button for the pause menu. This should help with the setup. So the last status was that we have to figure out, why the shortcut is not working, right?

syd711 commented 4 months ago

I added the button debounce with 2.16.0, so I assume this issue as fixed. There have been issues with the preferences refresh in the patch I gavie you. These should be fixed with the release too.

Ltek commented 4 months ago

@syd711 Pause menu still not working... definitely need more delay, maybe even allow it to be a user definable delay.

Test today using Joy2Key (key mapper/reader I use to map Windows DirectInout buttons to Popper stuff like 'Play only'). When I press ']' (set for VPS Overlay), VPS is sending a keyboard 'P' command immediately.

syd711 commented 4 months ago

Mmh, damn I kept the delay hard-coded as it was in the test version I gave you (1 sec). I thought this fixed the issue. So it is still showing up and hiding again immediately? Sure, I can add a configurable flag for this. I just want to make sure before if this is really the issue. I'm suprised that it is now not working (again?).

Ltek commented 4 months ago

If it is coming on, its so fast its impossible to see. happy to let you remote in!

syd711 commented 4 months ago

I had another ticket where the workaround was to select some random key for the overlay (which was previously empty). There is a bug that empty values are not checked properly which results in unnessessary key events.

syd711 commented 4 months ago

If improved the key event handling and added the "debounce" option. If the menu still does not show, please attach the latest logs here again.

syd711 commented 4 months ago

Any updates? Otherwise I would like to close this ticket.

Ltek commented 4 months ago

I'll test today

syd711 commented 3 months ago

And once again a baby(?) step forward. 2.18.5 contains a button recorder that hopefully fixes your controller issues.

Ltek commented 3 months ago

no go... I tried mapping 3 different keys that I had never mapped before... including 'insert' since nothing uses that. The key grabber you put it sees all the codes just fine. But when a table is running (popper in the background) the Pause menu never comes up... with button press or directly using the keyboard. I have it set to 1s debounce.

log attached vpin-studio-ui.log vpin-studio-server.log

syd711 commented 3 months ago

This issue is currently blocked by https://github.com/syd711/vpin-studio/issues/245

syd711 commented 2 months ago

Blocking ticket has been fixed. You can try to use the VPX monitor which should now detect the game status and should not block the pause menu from opening.

Ltek commented 2 months ago

I'll test soon as next ver is released

Ltek commented 2 months ago

not ignoring this... just been working on Swamp Thing. Its almost done and I'll get back to testing VPS

syd711 commented 2 months ago

I'm also working on a re-implementation of the key binding. The newer version will have controller support. So in combination with the VPX monitor, I'm positive that it will work much better.

syd711 commented 1 month ago

So, we once again can continue here. The controller support is there, so we only need to figure out now, why the table start/end commands (curl commands) are not working for you. Or maybe they are now?

Ltek commented 1 month ago

I tested controller mapping, its not working for me... I tried mapping both with a cabinet button (mapped to ']'), and directly with the keyboard key itself ']'.

Maybe the easiest was if to have Studio detect when 'P' key is pressed it will show Pause Menu... and not try have Studio invoke Pause 'P' on the backend... 'P' pauses VPX for me without any hiccups even when Studio is running