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: Lightgun flasher over groovymame in fullscreen  (Read 7375 times)

0 Members and 1 Guest are viewing this topic.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Lightgun flasher over groovymame in fullscreen
« on: August 22, 2022, 03:20:06 pm »
Hi!
I wanted to do a flasher for crt lightguns using ahk.
A method to do this would be creating a white gui that shows for some ms. This works in windowed or false fullscreen, but not in real fullscreen games.
So I found another way that seems to work in fullscreen games:

Code: [Select]
#Include lib/Gdip_All.ahk ; https://autohotkey.com/board/topic/29449-gdi-standard-library-145-by-tic/
;OnExit, Exit

x := 0, y := 0, w := A_ScreenWidth, h := A_ScreenHeight    ; Dimensions of rectangle
color := 0x55ffffff                      ; Transparency (FF = solid) + RGB (black in this case = 000000)


Gui, Flashing: -Caption +E0x80000 +E0x20 +LastFound +AlwaysOnTop +ToolWindow ; Layered window
Gui, Flashing: Show, NA
hwnd1 := WinExist() ; The created window's handle
Gui, Flashing: Hide

pToken := Gdip_Startup()
hbm    := CreateDIBSection(w, h)  ; The GDI bitmap
hdc    := CreateCompatibleDC()                         ; Device context compatible with screen
obm    := SelectObject(hdc, hbm)                       ; Select bitmap into device context
G      := Gdip_GraphicsFromHDC(hdc)                    ; Get pointer to graphics of bitmap

hBrush := Gdip_BrushCreateSolid(color) ; For the fill
Gdip_FillRectangle(G, hBrush, x, y, w, h)
UpdateLayeredWindow(hwnd1, hdc, 0, 0, w, h)

; Clean up the paint
Gdip_DeleteBrush(hBrush)
SelectObject(hdc, obm), DeleteObject(hbm), DeleteDC(hdc), Gdip_DeleteGraphics(G)
Return

~LButton::
Gui, Flashing: Show, NA
Sleep, 60
Gui, Flashing: Hide
return

F12::
ExitApp

And this works for the fullscreen games I tried but groovymame:
In a pc with a Flat screen without crt emudriver, if I launch a game fullscreen with normal mame, the flashing is shown over the game. No mathers if opengl or d3d, it works.
In my arcade pc with crt and groovymame, I launch a game, switchres works and set it to its resolution, but the flashing won't show over the game.

Any idea why? do anyone  know how to achieve it?

Calamity

  • Moderator
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 7414
  • Last login:April 10, 2024, 02:02:31 pm
  • Quote me with care
Re: Lightgun flasher over groovymame in fullscreen
« Reply #1 on: August 25, 2022, 02:55:10 pm »
I'm surprised that the flash works at all on baseline MAME. Fullscreen exclusive is just that: exclusive, only the app that owns Direct3D can draw. But anyway, my knowledge could be obsolete on this too.
Important note: posts reporting GM issues without a log will be IGNORED.
Steps to create a log:
 - From command line, run: groovymame.exe -v romname >romname.txt
 - Attach resulting romname.txt file to your post, instead of pasting it.

CRT Emudriver, VMMaker & Arcade OSD downloads, documentation and discussion:  Eiusdemmodi

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #2 on: August 25, 2022, 03:24:18 pm »
Yes, i think a LUA plugin seems more compatible, no need for external programs, less latency, ...

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #3 on: August 27, 2022, 12:57:46 pm »
I'm surprised that the flash works at all on baseline MAME. Fullscreen exclusive is just that: exclusive, only the app that owns Direct3D can draw. But anyway, my knowledge could be obsolete on this too.
Yes, me too. My first tought was to use screen brightness, so it should work with any game. But I can't find any function in ahk that let me increase it over the windows maximum, as I need the screen to be near total white for a moment.
Yes, i think a LUA plugin seems more compatible, no need for external programs, less latency, ...
I don't know about this. Should it work only on mame?

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #4 on: September 11, 2022, 12:32:00 pm »

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #5 on: September 12, 2022, 03:02:39 am »
Thnaks Psakhis!
I tired, but I never used plugins in Mame and don't know how to use it.
Placed gunlight folder in plugins folder, activated Gunlight plugin in Plugins menu...
whats next? 

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #6 on: September 12, 2022, 04:54:43 am »
Ah sorry, i explain.

1. Create folder "gunlight" inside plugins directory
2. Edit plugin.ini and add "gunlight 1" for activate it
3. When mame is running, on UI menu -> plugins you can set
4. Input -> This is 1P player button for fire 
    Gun button -> This is your gun button, you need to quit from 1P input settings, this is a overloard config
    Brightness gain -> Level of brightness to add when gun button is pressed
    Brightness frames -> Brightness is applied when gun button is pressed (default=1), but you can add more frames of brightness
« Last Edit: September 12, 2022, 04:57:35 am by psakhis »

Rion

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 69
  • Last login:Yesterday at 11:07:28 am
  • 240p, 480i
Re: Lightgun flasher over groovymame in fullscreen
« Reply #7 on: September 12, 2022, 11:59:26 am »
I have been testing and using this for some weeks now. The new update for brightness control really makes a difference.
Looking forward to contrast and gamma controls 👍

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #8 on: September 12, 2022, 12:37:31 pm »
Plugin updated with contrast and gamma adjustment.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #9 on: September 12, 2022, 01:01:42 pm »
Thanks Psakhis, this is very nice. I could test it a little on my crt:
Overall it works perfect. No missing shots.
I was looking your  code but couldn't figure out: do you raise brighness and then the button press instantly? without any delay between them?
Though, I'm experiencing two problems:
1. "Brightness frames" is appied on release, but I think it would be better on press, as games like time crisis, pointblank... doesn't need the flashing while the whole button press, and so it would be far less noticeable.
2. I have not tested this with two guns (absolute mice, rawinput), but I tested a little more in my normal pc with a mouse, and when mapped two flashers, they seens to conflict as one of them does nothing and the other sets the new brightness but won't return to normal level.
2b. What would happen if a flasher button is press while another is flashing? I couldn't test this because of the problem described above, but I think It should not add brightness level, but reinitialize the timer.


Rion

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 69
  • Last login:Yesterday at 11:07:28 am
  • 240p, 480i
Re: Lightgun flasher over groovymame in fullscreen
« Reply #10 on: September 12, 2022, 01:52:51 pm »
Thanks Psakhis, this is very nice. I could test it a little on my crt:
Overall it works perfect. No missing shots.
I was looking your  code but couldn't figure out: do you raise brighness and then the button press instantly? without any delay between them?
Though, I'm experiencing two problems:
1. "Brightness frames" is appied on release, but I think it would be better on press, as games like time crisis, pointblank... doesn't need the flashing while the whole button press, and so it would be far less noticeable.
2. I have not tested this with two guns (absolute mice, rawinput), but I tested a little more in my normal pc with a mouse, and when mapped two flashers, they seens to conflict as one of them does nothing and the other sets the new brightness but won't return to normal level.
2b. What would happen if a flasher button is press while another is flashing? I couldn't test this because of the problem described above, but I think It should not add brightness level, but reinitialize the timer.

All of these are very good points. 👍
There is always room for improvements.
Thanks Psakhis for the update to gamma and contrast 👍

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #11 on: September 12, 2022, 04:24:16 pm »
1. "Brightness frames" is appied on release, but I think it would be better on press, as games like time crisis, pointblank... doesn't need the flashing while the whole button press, and so it would be far less noticeable.
2. I have not tested this with two guns (absolute mice, rawinput), but I tested a little more in my normal pc with a mouse, and when mapped two flashers, they seens to conflict as one of them does nothing and the other sets the new brightness but won't return to normal level.
2b. What would happen if a flasher button is press while another is flashing? I couldn't test this because of the problem described above, but I think It should not add brightness level, but reinitialize the timer.

By default gain is applied only on frames where button is pressed; for apply gain on release, you need to set frames > 1.

Interesting behaviour of two guns, i hadn't even considered it, i think about it!

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #12 on: September 13, 2022, 07:20:28 am »
Quote
By default gain is applied only on frames where button is pressed; for apply gain on release, you need to set frames > 1.
Yes, I understand that.
What I mean is this way the flashing is very annoying. Bear in mind there are games where you do rapid fire, or in 2p games, many shots are fired.
I think it would be better that you can set an fixed amound of brighten frames from the press, and before this, return to default brightness, regardless if button is still pressed or released
I have been messing with your code to change this myself but I can't. Any advice to achieve it? so I can test and tell if it works?
Thanks
« Last Edit: September 13, 2022, 07:24:39 am by phasermaniac »

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #13 on: September 13, 2022, 07:40:24 am »
For example, if you set 32 frames, will be more than 25 frames with gain applied after button is pressed regardless if button is released.

The "counter" of this frames is set to 0 when button is pressed, i understand you want a fixed number of frames regardless button is pressed or released?

This is posible and easy to add to plugin.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #14 on: September 13, 2022, 07:48:51 am »
yes thats it.
I tired but I don't understand the whole code.

Rion

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 69
  • Last login:Yesterday at 11:07:28 am
  • 240p, 480i
Re: Lightgun flasher over groovymame in fullscreen
« Reply #15 on: September 13, 2022, 08:32:16 am »
For example, if you set 32 frames, will be more than 25 frames with gain applied after button is pressed regardless if button is released.

The "counter" of this frames is set to 0 when button is pressed, i understand you want a fixed number of frames regardless button is pressed or released?

This is posible and easy to add to plugin.

Yeah that's a great idea.
Perfect for games like Operation Wolf, Terminal 2, Alien 3 etcetera.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #16 on: September 13, 2022, 01:03:26 pm »
So, this way I get the short flash effect I talked about:
Code: [Select]

local function process_button(button)
local pressed = input:seq_pressed(button.key)
if pressed then          
if num_frames < button.off_frames then              
        gunlight_frames = 1
        gunlight_brightness_gain = button.brightness_gain
gunlight_contrast_gain = button.contrast_gain
gunlight_gamma_gain = button.gamma_gain
        end
return 1
else
        if num_frames < button.off_frames and (init_user_set.brightness < gunlight_user_set.brightness or
                                               init_user_set.contrast < gunlight_user_set.contrast or
                                               init_user_set.gamma < gunlight_user_set.gamma) then              
        gunlight_frames = 1
        gunlight_brightness_gain = button.brightness_gain
        gunlight_contrast_gain = button.contrast_gain
        gunlight_gamma_gain = button.gamma_gain
        else
        gunlight_frames = 0
        num_frames = 0
        end
button.counter = 0
return 0
end
end
Try it, it would show the flashing the shorter possible. You would have to mess with "frames to apply gain" that would vary depending on the game. (>2 and set the minimum that let fire shots in dark places)

On another hand I tested deeper to set 2 flasher buttons, and no way. I tried in the crt arcade with 2 guns but you can also test with two buttons of mouse, same buggy results, test yourself.

Finally, are you sure contrast and gamma does something? I mean they lighten light and medium colors, but not dark, which is what we need. Maybe an "inverted gamma" would be the less noticeable thing that would work, I mean lighten only dark colors. But anyway, for me brightness_gain works nice

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #17 on: September 13, 2022, 01:47:42 pm »
Now:
When "frames to apply gain" = 1 --> Apply gain when button is pressed on frame, normally are 3 or 4 frames.
Every number X > 1 is applying gain on the next x-1 frames when button is released

Your approach:
When "fixed frames to apply gain" = 1 --> Apply gain only if pushed button in the frame (no difference of actual solution)
Every number X > 1  --> Apply gain on the frame and next X frames. Considerations here:
    - If frame has button pushed -> i understand always is needed apply gain
    - If frame has button released -> which frame counter do you consider? I assume the first one, the last one is the actual solution.

Probably for 2 players is needed 2 buttons configuration on plugin...


phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #18 on: September 13, 2022, 02:40:32 pm »
I don't understand your explanation, what I wanted to do is:
Press button -> apply X frames of gain. No matter when you release the button.

Quote
Probably for 2 players is needed 2 buttons configuration on plugin...
Ok can it be done? Or some clue to make it work?
It seems to be contemplated, you can add two different buttons in menu, it detects gun1 and gun2 buttons independently...
In the ini.lua code these loops seems to handle this, true?
for i, button in ipairs(buttons) do...
for i, state in pairs(button_states) do...
the problem might be there, or am I wrong?

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #19 on: September 13, 2022, 03:55:39 pm »
I don't understand your explanation, what I wanted to do is:
Press button -> apply X frames of gain. No matter when you release the button.
It's just then plugin does. I think the problem is only on multi button setup, this needs rewrite of some parts for be treated in a common way..

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #20 on: September 14, 2022, 02:30:58 pm »
Updated plugin simplifying code, i think multi gun/button is resolved.


phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #21 on: September 14, 2022, 05:02:48 pm »
Yes, tested with lbutton and rbutton of mouse and now seems to work. Very nice!
But I return to the press/release topic, let's see if we can comunicate properly, because I think we were missunderstanding. Maybe my engrish:

Now, for me, it works this way:
When I press the button "gain" applies until I release the button. If I set "frames to apply gain", it seems to apply them once I release the button.
I think this is the best for games that uses a machine gun, with constant fire (beast busters, operation wolf, etc). Those games used actually analog joysticks, not crt guns. Those would benefit with a gain on the whole button press, but there's no need of any extra gain frame on release.

What I think it would be the best for crt guns:
When I press the button gain applies just "frames to apply gain", disable gain even if the button is still pressed. No matter when you release the button.
This I think would be the best for actual crt gun games like Time crisis, Point Blank, Lethal enforcers.... As they plays as a normal gun, only one bullet fires and you don't need to bright the screen the whole button press.
Maybe the user will have to investigate how many gain frames each game needs to work properly.
This way, the flashing is gonna be the shorter possible, and so the less anoying to the eyes. Bear in mind there are games you have to do rapid fire, or in 2p games, lots of shots per minute are fired.

So what would I do?
I think the best would be:
0 "frames to apply gain": apply gain until release (for machine gun games)
X "frames to apply gain": apply gain X frames from the beggining of the press

Thanks

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #22 on: September 15, 2022, 03:10:36 am »
Now, for me, it works this way:
When I press the button "gain" applies until I release the button. If I set "frames to apply gain", it seems to apply them once I release the button.
I think this is the best for games that uses a machine gun, with constant fire (beast busters, operation wolf, etc). Those games used actually analog joysticks, not crt guns. Those would benefit with a gain on the whole button press, but there's no need of any extra gain frame on release.
Exactly that's it, i always test plugin with opwolf.

What I think it would be the best for crt guns:
When I press the button gain applies just "frames to apply gain", disable gain even if the button is still pressed. No matter when you release the button.
This I think would be the best for actual crt gun games like Time crisis, Point Blank, Lethal enforcers.... As they plays as a normal gun, only one bullet fires and you don't need to bright the screen the whole button press.
Maybe the user will have to investigate how many gain frames each game needs to work properly.
This way, the flashing is gonna be the shorter possible, and so the less anoying to the eyes. Bear in mind there are games you have to do rapid fire, or in 2p games, lots of shots per minute are fired.
Ok i finally got it. Isn't necessary refresh gain frames while button is pressed, only when isn't gain applied and is detected a new cycle of pressed button.

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #23 on: September 15, 2022, 01:31:24 pm »
Updated plugin with new method "Fixed frames".

I hope I have succeeded this time.

EDIT: if you exit with gain applied it will affect brightness settings of mame. I need to check if i can avoid this.
« Last Edit: September 15, 2022, 01:43:35 pm by psakhis »

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #24 on: September 15, 2022, 02:08:02 pm »
Yes, that's the concept.
The only drawback I see is that now, if you use "gain method=fixed frames", you press one gunlight button while the other is still pressed it doesn't flash, and it should.
This is working perfect in "gain method=until release"

Thanks.

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #25 on: September 15, 2022, 03:12:31 pm »
You are right! It's code issue!

EDIT: fixed
« Last Edit: September 16, 2022, 09:43:13 am by psakhis »

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #26 on: September 16, 2022, 02:58:49 pm »
thanks!
Yesterday I tested two games:
Time crisis: perfect with 0,3 brightness and 2 fixed frames
Carnevil: Couldn't make it work, erased the 1P input settings for trigger, and even with 1 brightness and 10 fixed frames, shots won't place in dark zones.
My guess is maybe some games needs a custom delay between the begin of the flash and the faked button press, but I'm not sure
I will test moregames this weekend.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #27 on: November 01, 2022, 08:44:03 am »
Hi psakhis.
I can say Time Crisis and lots of games works perfect with this.
I have been testing Carnevil a bit more, and I as I said in the first testing I can't make it work properly. Have you tested it?
Would it be possible to add an option to delay the button press? I mean, on trigger press: Apply gain - wait X frames - send PX Fire
thanks

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #28 on: November 01, 2022, 04:10:22 pm »
Hi @phasermaniac,

I uploaded a new version with this feature, waiting for your feedback.

You can set any number of frames (input lag frames)

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #29 on: November 01, 2022, 06:43:45 pm »
Thanks! So fast
It works. I tested Carnevil and Zombieraid.
The only problem its that when you use this option, 2 shoots are fired. It seems that the brightness has no effect for the first but the second gets correctly positioned on dark areas

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #30 on: November 02, 2022, 03:49:27 am »
Do you disabled the same button on input settings?

Here i tested with operation wolf and only have 1 fire.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #31 on: November 02, 2022, 06:41:53 am »
Yes I did.
Strange, i'll retest layer. Tested it yesterday and noticed it in The two games I tested this option.

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #32 on: November 02, 2022, 07:30:57 am »
A test can be set a lot of frames for see how many fires are sent.

For example, when i set 32 it's more obvious

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #33 on: November 02, 2022, 01:46:49 pm »
Tested in another pc:
You have reason in Operation wolf ther is no problem.
But in Carnevil and Zombieraid I keep having the two shots problem. If I set a lot of frames as you said they seem to be fired at once

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #34 on: November 02, 2022, 03:31:51 pm »
Ok, here too with Zombie Raid.

I'll check it.

EDIT: I think now it's fixed.
« Last Edit: November 02, 2022, 04:20:19 pm by psakhis »

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #35 on: November 03, 2022, 02:05:45 pm »
Yes, working nice on my side. Tested yesterday and its amazing, thanks!
0 missing shots, and the flashing is far less noticealbe than the external option I used before.

But now I notice have lost a feature I had with my old external flasher method: Offscreen shoot send reload button.
Would it be possible to make an option to send reload button if the shot is offscreen (0,0 coords)?
So games that originally used a button to reload (like Carnevil or Zombieraid) could reload aiming offscreen
Now I know this is maybe complicated as involve reading coords in a specific moment.

Mame already have the opposite feature: "offscreen_reload" that overrides reload button with a shoot in 0,0.
Thanks anyway, for this amazing plugin

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #36 on: November 03, 2022, 03:22:33 pm »
I believe Mame works as original machine if you disable offscreen_reload.

If game reloads with shot on (0,0) it's how it works. I'm not an expert of lightgun games...

EDIT: I updated plugin for Alien 3. This game renders on other screen of lua object.
« Last Edit: November 03, 2022, 05:00:48 pm by psakhis »

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #37 on: November 04, 2022, 05:35:50 am »
Im not an expert either, Mame work right with most games that originally reloaded with an offscreen shot, but not all of them (loked ' loaded, Invasion...)
Also there are some games that originally couldn't reload with an offscreen shot, but with a pump mechanism (Carnevil, Zombieraid...). This was cool with the original shotguns with pump action, but playing with standard guns, reloading with a button is not fun, would be better offscreen reload.
That's why I ask to add this feature to your plugin. But I don't know how to do this in lua
I suppose that once the flashing is launched, just before inserting the pXtrigger, you would have to read coords and if they are 0,0, send pXreload instead of pXtrigger

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #38 on: November 04, 2022, 08:33:28 am »
I'll ask to mame developers if i can read lightgun coords with lua classes.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #39 on: November 04, 2022, 01:49:44 pm »
thanks for trying!

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #40 on: November 06, 2022, 04:53:51 am »
Are you in Windows or GroovyArcade?

I need to know how mame is detecting gun, like a mouse?

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #41 on: November 06, 2022, 10:53:40 am »
Groovymame (x64) windows 10
Guns detected like absolute coords mice (rawinput)

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #42 on: November 07, 2022, 02:38:25 am »
Are you using Guncon2? Can you attach a game.cfg example of gunlight plugin?

With lua i'm reading absolute mice position and relative positions, but i'm not sure if gun it's the same value.

In my case, when i plug Guncon2 on W10 it didn't recognized usb.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #43 on: November 07, 2022, 09:53:35 am »
Im using guncon 45 with ems dual shooter 2 converter
Namco Guncon 2 has "rolling x" problem
Third party ps2 guns works
In any case you need a driver. I use topgun 2 x64 drivers, I remember installing it in win10 a little triky, you have to enable unsigned drivers.

zombraid.cfg
Code: [Select]
[{
    "port":":P1",
    "brightness_gain":0.4,
    "mask":16,
    "off_frames":1,
    "gamma_gain":0,
    "key":"GUNCODE_1_BUTTON1",
    "lag":4,
    "contrast_gain":0,
    "method":"first",
    "type":"P1_BUTTON1"
  },{
    "port":":P2",
    "brightness_gain":0.4,
    "mask":16,
    "off_frames":1,
    "gamma_gain":0,
    "key":"GUNCODE_3_BUTTON1",
    "lag":4,
    "contrast_gain":0,
    "method":"first",
    "type":"P1_BUTTON1"
  }]

ptblank.cfg
Code: [Select]
[{
    "type":"P1_BUTTON1",
    "method":"first",
    "contrast_gain":0,
    "port":":P1",
    "brightness_gain":0.4,
    "lag":0,
    "key":"GUNCODE_1_BUTTON1",
    "gamma_gain":0,
    "mask":16,
    "off_frames":2
  },{
    "type":"P1_BUTTON1",
    "method":"first",
    "contrast_gain":0,
    "port":":P2",
    "brightness_gain":0.4,
    "lag":0,
    "key":"GUNCODE_3_BUTTON1",
    "gamma_gain":0,
    "mask":16,
    "off_frames":2
  }]

In nuvee plugin ( used for psx and ps2 lightgun emulation) it shows these edges values: 1-65534. Not sure if it can help you in some way.
« Last Edit: November 07, 2022, 01:53:38 pm by phasermaniac »

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #44 on: November 07, 2022, 02:22:49 pm »
Ok thank you.
I will write a verbose version of plugin to know what coords will be detected.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #45 on: November 09, 2022, 06:04:08 pm »
Eager to test this
I've been testing some games, and I can say it works perfect. My crt guns works 100% with this. No miss shots.
The only game that I can't make work is alien3, I'll test better. Not specially interested on this one as it was a mounted machinegun game that never will work right with crt guns.
On my side, the button lag option is mandatory in a lot of games.
In some days I'll share my config files.

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #46 on: November 10, 2022, 12:59:56 pm »
Hi @phasermaniac

I need some test on your machine before implements reload on 0,0

1) Replace init.lua.txt for init.lua on plugin dir (backup the good one)
2) Test some game with -v commnad, for example: mame -v opwolf
3) When you shoot on 0,0 what print do you see, and when shoot on screen, the same too

Thx!

EDIT: For Alien3 you need download the latest version of plugin because main renderer isn't "screen" on LUA object.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #47 on: November 10, 2022, 01:56:45 pm »
okay so it seems I get relative (mouse) and absolute(guncode):

onscreen shoot:
MOUSE X292
MOUSE Y99
guncode x 34404
guncode y -11198
GUNCODE Y seems to be always negative in my testing

offscreen shoot:
MOUSE X333
MOUSE Y122
guncode x -65536
guncode y -65536
MOUSE X and MOUSE Y shows the last onscreen position. GUNCODE X and Y always shows -65536

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #48 on: November 10, 2022, 02:05:30 pm »
Interesting!!

So i can add an option that with this values (-65536,-65536) you can remap reload input button from the game.

I add one option for drivers like your (guncode) and other one for users with drivers like a mouse.

It's a simple code.

Thx very much.

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #49 on: November 12, 2022, 03:53:41 am »
@phasermaniac

You can try new feature.

guncode_offset added when you map a button; this only applies when shoots out off screen.

So, you need to map the same button with this new option with "no" for normal shoots, and with "yes" for reload.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #50 on: November 12, 2022, 06:01:10 am »
thanks! I'll try this evening.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #51 on: November 12, 2022, 04:40:42 pm »
Works but it has a problem: when I shoot a dark zone it shoots and reloads
I think you are reading the coordinates before the flash is applied.
I mean for this its mandatory to read the coordinates after the flash, the closer possible to the button injection

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #52 on: November 12, 2022, 04:55:23 pm »
Ohhh, you are right; i'm reading coords before than that.

I think the solution

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #53 on: November 13, 2022, 04:47:11 am »
I write a new version that reads coords after gains.

I hope this is the good one

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #54 on: November 13, 2022, 05:53:22 am »
And again, yes it works but...
only with gain until release.
When set gain fixed frames it shoot and reloads (unless i set a huge fixed frames number and I release the button fast).
I bet the reason is the lengh of the button press must be inside the gain time, else when flash is over and you still have the button pressed it sends reload button.
So solution to this might be force end of the button press just before the end of flashing when using gain fixed frames.

Anyways thanks very much for your work, Never had my crt guns working so reliably
« Last Edit: November 13, 2022, 06:01:42 am by phasermaniac »

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #55 on: November 13, 2022, 06:12:08 am »
On another hand I see the "gain until release" a little useless. I mean, you always want to keep the flasher the shorter possible because its annoying and it doesn't let you see the game itself.
Yesterday I was playing Operation wolf, Space gun and mechanized attack, which are machine gun mounted games, and I think for these, instead of gain until release, would be perfect a "autofire" option, I mean:
Create a loop whenever the button is pressed that launches the fixed frames gain each x frames.

Just an idea

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #56 on: November 13, 2022, 02:17:51 pm »
Are you tried different configs with some button lag for reload?

Now guncode_offset plugin works as:
 - On the frame when button is detected, if this is a offset button, isn't setting any value for it (pressed or not)
 - If button lag is added, all the frames before the lag are set to 0 (non pressed)
 - Gain or not is applied with fixed frames or until release methods (no changes here)
 - At the end of the frame, if this is a offset button and all the lag is over, plugin reads coords(x,y) for set pressed or not, if reads -65536 is considered pressed
 



phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #57 on: November 13, 2022, 03:30:53 pm »
Yes I tried different configs to be sure.
In fact I create two "gunlight buttons", one for PX Trigger and the other for P1 Reload, both with the same "gun button", one with offset yes and the other no. And tested adding lag, but same problem.
The problem is the frames after the flash I think should be set to 0 (non pressed).
The rest I think it's ok

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #58 on: November 13, 2022, 04:01:09 pm »
The problem is the frames after the flash I think should be set to 0 (non pressed).
Do you think this only for reload button (offset mapped button) or for everything?

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #59 on: November 13, 2022, 04:22:39 pm »
Code: [Select]
if button.method == "first" then
if not gain_applied then
if button.counter == 1 then
num_frames_gain = button.off_frames
else
return 0
end
end
end
seems to do thee trick, gonna test.
Now that you have developed more code, I begin to understand it, but there are things I still miss.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #60 on: November 13, 2022, 04:28:06 pm »
Quote
Do you think this only for reload button (offset mapped button) or for everything?
I think for everything, theorically the only moment crt gun need the button press is inside the flashing time.
However, if you test Spacegun for example, used mounted machine guns, but surprisingly it has its own flashing, so maybe its guns were not ad sticks or analog joys but actual crt guns attached to the cab. It has autofire, which let you mantain the button pressed to fire repeatedly, and launches a flashing periodically.

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #61 on: November 13, 2022, 04:52:18 pm »
I can add this feature:
- Only apply button with gain (yes/no)

This is a very easy change on plugin.

What do you think?


phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #62 on: November 13, 2022, 05:56:14 pm »
I think it should work, theorically.
My modification does not work as I wanted, but has some effect:
In zombie raid, which needs  fixed frames and 4frames of button lag, if I shoot a dark zone and keep the button pressed, it should only shoot, but:
-With the code you udated this morning: it shoots and reloads, and reloads too everytime I pass my aiming though a dark zone.
-With my modification: It shots and reloads, but only once, no matter if i pass through a dark zone
« Last Edit: November 13, 2022, 05:59:39 pm by phasermaniac »

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #63 on: November 14, 2022, 02:58:50 pm »
New feature added.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #64 on: November 14, 2022, 07:21:09 pm »
Tested a bit with mixed results, Ill retest tomorrow
Thanks.
By the way, would it be possible to export this to other emulators?
For example, model2 emu supports lua scripts as I see, and has good gun games.
Retroarch, Im not a big fan but you would cover naomi, psx, saturn, genesis, snes, mastersysten, nes...

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #65 on: November 15, 2022, 02:01:19 pm »
Mmmm, testing with Zombieraid, it works perfect for p1, but not for p2 (on dark zones it shoots and release)
Also it doesn't seem to work if no lag is applied, although for the moment I have not tested any game that needs "Guncode offscreen" with no "frames to apply button".

On another hand, I find the plugin a little confusing to use, and I think it will for other users. What do you think about

Simplifying:
- Guncode off-screen: Instead of "yes" why not input here the input deseired? this way you wouldn't have to create another gunlight button.
- Frames to apply gain: I would change to "flash length" and add a -1 value to be "until release" so you can eliminate "Gain method"
- Only with gain: I would change that for "Input lenght", to give the freedom to set a frame number, or -1 to be "until release", so it would have the same logic that "flash length"

Renaming and reordering, I think this would be easier to understand:
Action                      P1 Fire
Offscreen Action   P1 Reload
Input              Gun Button 1
Input Length                    3
Input Delay                      2
Flash Length                    4
Flash Brightness            0,5
Flash Contrast                  0
Flash Gamma                   0

Also I think, that would be good to keep the same names in the mame menu and in the config game files in "gunlight" directory.
Another thing I feel weird is that when you update your gunlight config, the order of variables change in the config file. Would be nice to be always the same order, as if you want to modify or compare some files it can be very confusing.

Sorry to be this long. All this are ideas which I think would help in the ease of use.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #66 on: November 16, 2022, 05:50:42 pm »
Ok, tested a little more and I think what is the problem with p2:
For offscreen reload p2 is looking at p1 coords, so if you are pointing p1 at screen, p2 shoots ok, else p2 shoots ans reloads at once.

Rion

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 69
  • Last login:Yesterday at 11:07:28 am
  • 240p, 480i
Re: Lightgun flasher over groovymame in fullscreen
« Reply #67 on: November 19, 2022, 09:06:04 pm »
Mmmm, testing with Zombieraid, it works perfect for p1, but not for p2 (on dark zones it shoots and release)
Also it doesn't seem to work if no lag is applied, although for the moment I have not tested any game that needs "Guncode offscreen" with no "frames to apply button".

On another hand, I find the plugin a little confusing to use, and I think it will for other users. What do you think about

Simplifying:
- Guncode off-screen: Instead of "yes" why not input here the input deseired? this way you wouldn't have to create another gunlight button.
- Frames to apply gain: I would change to "flash length" and add a -1 value to be "until release" so you can eliminate "Gain method"
- Only with gain: I would change that for "Input lenght", to give the freedom to set a frame number, or -1 to be "until release", so it would have the same logic that "flash length"

Renaming and reordering, I think this would be easier to understand:
Action                      P1 Fire
Offscreen Action   P1 Reload
Input              Gun Button 1
Input Length                    3
Input Delay                      2
Flash Length                    4
Flash Brightness            0,5
Flash Contrast                  0
Flash Gamma                   0

Also I think, that would be good to keep the same names in the mame menu and in the config game files in "gunlight" directory.
Another thing I feel weird is that when you update your gunlight config, the order of variables change in the config file. Would be nice to be always the same order, as if you want to modify or compare some files it can be very confusing.

Sorry to be this long. All this are ideas which I think would help in the ease of use.

I second the renaming and reordering. Good idea  :)

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #68 on: December 03, 2022, 03:07:02 pm »
Hi! I have been trying to solve the offsceen reload problem, something like:
      
Code: [Select]
if port == 1
        local guncode_xaxis = manager.machine.input:code_from_token("GUNCODE_1_XAXIS")
local guncode_yaxis = manager.machine.input:code_from_token("GUNCODE_1_YAXIS")
end
if port == 2
        local guncode_xaxis = manager.machine.input:code_from_token("GUNCODE_2_XAXIS")
local guncode_yaxis = manager.machine.input:code_from_token("GUNCODE_2_YAXIS")
end
or better
Code: [Select]
local guncode_xaxis = manager.machine.input:code_from_token("GUNCODE_"port"_XAXIS")
local guncode_yaxis = manager.machine.input:code_from_token("GUNCODE_"port"_YAXIS")
but I don't know how to use the variable port and whats its actual value, any advise? thanks

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #69 on: December 04, 2022, 11:42:17 am »
I need to do some refactor to detect p2 buttons

I will do it on the next days.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #70 on: December 04, 2022, 01:59:41 pm »
Thanks I thought it would be easy, but I'm pretty lost with your code.

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #71 on: December 06, 2022, 04:08:21 am »
I fixed P2 offset. For refactor options i need some more time.

Just the condition you looking for is manager.machine.ioport.ports[button.port]:field(button.mask).player


phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #72 on: December 08, 2022, 01:29:35 pm »
It works, but...
-Bear in mind that the guns may not be necessarily GUNCODE_1 and GUNCODE_2 it depends on the order Windows detects "mice". So in my system my guns are 1 and 3, because I have a trackball too. I think you can get the guncode from the "key" value GUNCODE_X_BUTTON1, so you make sure that guncode of key and coords of offscreen action is from the same device.
-I made an "stress test" in Zombie Raid, that is a very dark game:
I create 2 "gunlight buttons" for the same "key": one with GUNCODE "guncode_offset" "yes " and the other "no" to get the offscreen reload, some shoots do't register. It doesn't seem to happen if I delete the  "guncode_offset" "yes " gunlight buttons.
I don't understand why this happens
Thanks
« Last Edit: December 08, 2022, 01:31:06 pm by phasermaniac »

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #73 on: December 11, 2022, 02:01:58 pm »
Yeah, i think 2 bindings problem is a reminiscence of autofire plugin code, i had seen it when clean a bit.

I'll just rewrite and clean up the plugin with your tips about renaming and reordering.


phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #74 on: December 14, 2022, 05:00:22 pm »
Nice, thankks!

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #75 on: December 19, 2022, 03:06:25 pm »
@phasermaniac, you can test new version but backup your plugin first  ;)
Changes
 - Saves files have options ordered in the same way always
 - Refactor menu
    - Added offset action (isn't needed 2 entries for offset now)
    - Offset guncode axis detection by key (not player)
    - In this version i deleted Input length, i think isn't necessary anymore. You need set up amount of flash length >= Input delay
    - Flash length with -1 value is "until release"



phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #76 on: December 20, 2022, 03:25:49 pm »
Amazing, I'll test tomorrow, thanks

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #77 on: December 20, 2022, 06:01:21 pm »
Finally I could test a bit.
It looks much better and easier to understand, don't you?
The only thing I can't get working is the offscreen reload: with input lenght -1, it works. But with a fixed length, it shoots and reload. If you have the button pressed when the flashing ends, it shoots another time, and if the area is dark, it reloads.
Another thing i found is that if you set an offscreen action, later you can't delete it on the menu.

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #78 on: December 21, 2022, 05:41:21 am »
Finally I could test a bit.
It looks much better and easier to understand, don't you?
The only thing I can't get working is the offscreen reload: with input lenght -1, it works. But with a fixed length, it shoots and reload. If you have the button pressed when the flashing ends, it shoots another time, and if the area is dark, it reloads.
Another thing i found is that if you set an offscreen action, later you can't delete it on the menu.
Yeah, it's better now.
I had forgotten apply only buttons with gain on frame. Can you test now?

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #79 on: December 22, 2022, 01:13:42 pm »
It works. But this seems to introduce this bug already commented:
When you shoot p1 and p2 at the same time, one of them is won't shoot.
Actually, I don't know if it worked before the last change.

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #80 on: December 22, 2022, 02:05:23 pm »
This issue only happens with 2 players?

So i understand 1 gun isn't shooting? Which game are you testing for 2 players?

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #81 on: December 22, 2022, 03:15:31 pm »
Correct, that's it.
I'm testing with Zombie Raid.
I think it only happens if using offscreen action.
I suppose If you shot while the other gun flash is active it doesn't shoot

psakhis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 453
  • Last login:Today at 05:22:43 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #82 on: December 22, 2022, 05:59:18 pm »
I changed a little flash length, refreshing counter frames when some button is pressed.

I'm not sure if will be fix the problem, but i see some frames without gain on 2p just simulating 2 shootings with keyboard.

phasermaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:January 24, 2024, 05:40:47 am
  • I want to build my own arcade controls!
Re: Lightgun flasher over groovymame in fullscreen
« Reply #83 on: December 25, 2022, 01:06:29 pm »
I have to test it a little more, but it seems to work right. Thanks!