Next Generation Emulation banner

(Input plugin) nuvee psx controller

128K views 265 replies 26 participants last post by  Yardley 
#1 · (Edited)
A win32 ps1 / ps2 controller plugin that provides basic lightweight emulation
- Dual PSX Mouse (PS1)
- Dual PSX Guncon (PS1)

- Dual G-Con 45 (PS2)
- Dual Guncon 2 (PS2)
- Dual Mouse (PS2)
- Single keyboard (PS2)


Devices:
- Dual mice (USB + Serial)
- Dual PC lightgun
- Single keyboard
- WiiMote (DirectInput)



For use with win32 emulators like
- PCSX-reloaded (cmdline = lightgun build only)

- PCSX-reloaded (any)
- PCSX2 (any = pad plugin)

- PCSX2-svn (usb plugin)
- PCSX2-usb (usb plugin)



News:
- 10-21-11 Other misc stuff
- 10-21-11 Upgrade RES2 to working (latest PCSX2 SVN)
- 10-21-11 Create Resident Evil Survivor 2 Guncon2 profile
- 10-21-11 Fix more stuff (USB mouse poll rate, USB keyboard poll, misc emulation)
- 10-21-11 Fix lots of stuff (alt-tab focus, snap cursor, PC lightgun + mouse, other regressions)
- 10-21-11 Support joystick devices (PPJoy or else)
- 10-13-11 Add DirectInput (WiiMote)
- 10-13-11 (PS2) Improve game profile list
- 10-13-11 (PS2) Improve device reset speed (Gunfighter 2 timeout)
- 10-13-11 (PS2) Fix device connection order (not both at same time)
- 10-13-11 (PS2) Improve lightgun swap feature
- 10-13-11 (PS1) Improve Rescue Shot no flash
- 09-25-11 Add cmdline features to PCSXr-lightgun (gameshark_load, spu_plugin, gpu_plugin, cdr_plugin)
- 09-25-11 Add PEC cheats for gun flash removal
- 09-25-11 Add default profiles reset option in GUI
- 09-25-11 Fix Moorhuhn hacks for PC lightguns
- 09-25-11 Add Policenauts Guncon conversion
- 09-02-11 Add PS1 Justifier conversion patches
- 08-21-11 Add mouse, keyboard usb emulation
- 08-19-11 Add C button to keyboard map
- 08-19-11 Fix lightgun swapping
- 08-19-11 Add profile: Endgame
- 08-19-11 Add hotplugging usb devices, hotswapping devices
- 08-18-11 Add profiles: Starsky & Hutch, Gunfighter 2
- 08-18-11 Add profiles: Dead Aim, Dino Stalker, Gunvari Collection
- 08-18-11 Add keyboard d-pad, extra guncon2 buttons, latch guncon2 near VBlank times (fixes trigger)
- 08-17-11 Added PS2 game profiles
- 08-17-11 Added PS2 Guncon 2 support (PCSX2)
- 08-15-11 Added USB OHCI support
- 08-07-11 Added several PS2 G-Con 45 profiles
- 08-07-11 Added PS2 G-Con 45 support (PCSX2)
- 08-07-11 Made nuvee emu-independent (RawInput changes)
- 08-07-11 Added Moorhuhn 2/3 profiles, fixed Moorhuhn X profile (delete old profiles.ini)
- 07-24-11 Release 1
- 07-24-11 Rewrote Guncon engine, game presets, default file, lots of fixes (huge thanks killervin, paubi)
- 07-05-11 Lots of fixes to PC lightgun support (thanks killervin, paubi)
- 07-01-11 True dual mouse support, fix lightgun trigger holding bug
- 06-30-11 RawInput API by Jake Stookey, True dual lightgun support (custom pcsx-r emu only), GUI sensitivity
- 06-29-11 Guncon - hide cursor, allow 0.000001 sensitivity (edit via ini)
- 05-28-11 Guncon calibration / offscreen shots
- 05-26-11 Add basic guncon support
- 05-25-11 Add basic mouse 43,45,46,47,4c / fix 2x mouse errors / fix mouse1 unplugged error
- 05-25-11 Mouse support (directinput)


MIRROR:
http://www.sendspace.com/file/6jeze3
http://forums.pcsx2.net/Thread-Nuve...ting-lightguns-by-Shalma?pid=194278#pid194278
 
See less See more
#2 · (Edited)
Now added Guncon support


@dev note
The guncon coordinates sent to psx is not 1-1 mapped with the gpu screen (flat surface)

Using the calibration screens for
- Elemental Gearbolt (precise shots)
- Gunfighter - Jesse James (real-time gun cursor)


sample:
Code:
// re-center to screen middle
screen_x -= (256 / 2);
screen_y -= (240 / 2);

// pretty close
screen_x = ( screen_x * 133 ) / 100;
screen_y = ( screen_y * 108 ) / 100;

screen_x += (256 / 2);
screen_y += (240 / 2);
That does remarkably well and the shots line up nicely in fullscreen (off by 2-3 pixels at most).
- May add this fix to ePSXe_shark



edit:
No guncon offscreen reloading yet.
 
#3 · (Edited)
Plugin seems more useful for dev research than game players. But it works great so far with pcsxr.
- Guncon games are very playable now. Moreso than ePSXe_shark atm.


Auto-calibration feature now added.
- Turns out that each game handles the gun data somewhat differently
(center position, screen scaling factors)
- Using some presets per game gets the gun cursor to shoot very nicely (as opposed to being 2-6 pixels off)


Code:
// center
(*analog_x) = ( 512 / 2 );
(*analog_y) = ( 256 / 2 );


// guncon -> screen (new version from above)
screen_x = ( screen_x * 512 ) / 384;
screen_y = ( screen_y * 256 ) / 240;

sample data
Time Crisis = 512/2, 256/2 + (512 / (384-22))
Gunfighter = 512/2, 256/2 + (512 / 384)
Elemental Gearbolt = 512/2 - 4, 256/2 + 4 --- (512 / 384) - 1, (256 / 240) - 1



(new!) Next problem solved is offscreen shooting
- Time Crisis uses this. Guncon x = 0. Does not react to y = 0. Or x = 511.
- So x=0, y=0 is the best data to return for this feature
- It's changed so that you can shoot at all 4 screen edges to trigger a bad shot


Justifier seems more interesting. Not working.
- Sends 42 - 00 - [00] near VBlank start
- Then sends 42 - 00 - [10] near VBlank start (next frame)
- Repeat loop

Our guess is that it latches the x-pos on [00]. Then y-pos on [10] roughly 1 VBlank later.
- No other polling used (once per frame), so no IOBit strobing like SNES
- Lethal Enforcers calibration only detects offscreen shots (nothing new yet)
 
#5 ·
hi, i have found this plugin very interesting and have tested it with an lcd topgun,which works very similar to aimtrak, and have found that if you put sensibility to 1, crosshair is a bit too fast, but it is very near to work ok.
I think that if you can make possible to down sensibility to 0,1 or so, it will work with aimtrak and lcd topgun.
another option that would be interesting for lightgun users is to hide the crosshair. there are video plugins that lets you to do it smaller but no to eliminate it.
and finally, does nuvee use rawinput to use two lightguns at the same time?
i think theres no psx emulator that offers this possibility and would be great.

I think this plugin is amazing so lets you play games like gunfighter, ghostbuster... that no emu was able to emulate with lightgun and also the work for best presicion for time crisis, and it would be nice to work with pc lightguns

i'm not programmer so i don't know if it is difficult to do all this but i give this information as pc lightgun user and think this plugin is the nearest to lightgun perfect emulation
ah and justifier emulation is not done by no emulator i know
 
#7 ·
Thanks for all the feedback. Didn't know about Ghostbusters. Point Blank 3 Guncon only works with nuvee also. :D


New version up
- You can now hide the Guncon crosshairs

- To use a sensitivity lower than 1.0, config plugin first. Exit emulator. Go to plugins/nuvee_psx_guncon1.ini and edit the value manually. Restart emulator and play.
(currently a hack, don't know how to do this properly in GUI)



and finally, does nuvee use rawinput to use two lightguns at the same time?
Unfortunately, I only know how to do lightgun emulation via the mouse movements. Which DirectInput only allows 1 mouse (I think).

You can trick some games to use 2 guns though (same mouse controls both guns so kinda awkward). Or 2 'mice' as in Lethal Enforcers.
http://forums.ngemu.com/misc-psx-discussion/142809-lethal-enforcers-i-ii-controller-hack.html

It's tricky but sometimes it works. But not 2 independent lightguns like a real console. Just a mouse + gamepad (untested) or mouse + keyboard (tested) for 2P shooter.



If there's someone who knows lots more about win32 HID, they'll need to step in and program 2 lightguns. Open-source though!
 
#8 ·
Sorry, didn't know what 'RawInput' API was.
Multiple mice in Windows XP using rawmouse


Just tried it and it sees... -both- connected mice! Registers 3 mice
1 = global win32 mouse
2 = usb mouse #1
3 = serial mouse #2


The thought of playing PSX Lethal Enforcers with 2x players + 2x mice is really tempting. A fair contest.


This'll get a high priority. Will work on it sometime this week.
- Code looks simple to use. Hopefully simple to add into the plugin.
- If I have to, I'll release my own hacked pcsx-reloaded emu to make this work.
 
#10 ·
Did some short 2P play with Point Blank - recognizes both Guncon mice separately. Wicked. :)
- And fixed GUI to accept 0.00001 sensitivity (no ini file editing needed).


There's another catch this time: you must use the included emu (pcsx-reloaded custom hack).
- When you configure the Guncon plugin, hit 'Acquire' for both devices
- Follow the instructions to attach both lightguns / mouse to each Guncon (only need to do this 1 time)


Thanks to your efforts, dual lightgun looks like it works. RawInput API can already handle both ActLabs and newer lightgun models (presumably).
- There's no (true) dual mouse support yet. Will find some other time to add in for Project Horned Owl 2P coop.
- And until someone cracks the Justifier, that's not doable yet. :(



To emu authors:
Code:
typedef void (CALLBACK* PADhandleHID)(LPARAM);


		case WM_INPUT: 
			PAD1_handleHID( lParam );
			PAD2_handleHID( lParam );
			return TRUE;
 
#12 ·
Fix for lightgun trigger / button holding (quitting Point Blank game for example)

Also added true dual mouse support (some 2P coop games).

====================================
====================================

Sorry, don't want to maintain another PCSX-r fork. Gets tiring with the constant updates.
- And bug complaints


And being former PCSX-r devs, we don't want to openly compete with them.

- Someone who wants to maintain an independent PCSX-r with HID lightgun support shouldn't have a hard time (just the WM_INPUT + PADhandleHID plugin calls). Nearly basic stuff.

- Don't think the official devs would go for adding our version of win32 HID support (could be wrong though). Justifier interface is unsolved so that'd be a turnoff.



And wanna make some cursor for higher resolutions with color options.
That'd be a GPU plugin problem - they handle the cursor icon + colors.

Don't know how they do it either. ^^
 
#13 · (Edited)
I see. Thanks. Thats why the cursors different for different gpu plugins.

Tested with gun.

Real mouse - guncon setting -> works
EMS Topgun II - guncon setting -> doesnt work here. The gun recognized by the plugin, and in the game register shots, but cursor dont move.
2 EMS Topgun II - 2 guncon setting -> Both gun recognised via plugin. 2 crosshair displayed but doesn't work. Guns shots registered by the plugin.

The cursor at most jammed in the middle of the vertical line and dont move.

Tried with the hacked PCSXR, regular, WiXP32 and Win7 64. I dont know whats wrong with my setup.
 
#14 ·
iep shalma, i have seen all work you have done, it's all very isnteresting, raw input works, and i see two crosshairs separately in the screen. thanks too for the option to disable the crosshair.
I have been testing it and it doesnt recognize the buttons for me.
in judge dread for example, it recognize the buttons in the menus but not in the game. In the other games i tested for 2 players, doesnt work none.
In gunfighter, the A button, which you have to hold pressed to rise, like in time crisis, the button is pressed and released instantanely

another problem i found is that which the lightgun (lcd topgun) the crosshair lines with the gun aiming at +-0,7 sensibility, but dont seem to work in the left side of the screen
Although your plugin isnt usable for now, i think its a great work and somethink that no one has done at the moment.
I have been reading about the way the lightguns reports coordinates, and seem that is not the same way the mouse do. i have found coordinates can be reported as relative or absolute, but dont understand very good the difference.
many thanks for the plugin
psd. I have all lightgun games for psx,including jap and if you want me for testing, i would be very pleased
 
#15 · (Edited)
There's 1 debug option both of you can try out:
src/___jstookey-arcade-rawinput/raw_mouse_test.exe


That tells you what's connected and response in real-time. If you can describe each gun and how it behaves, that'll give us a clue on what to do next.


Using a usb mouse, this is for #1
- X/Y = moves around (relative reporting) until stops. Sometimes value reports +2, -1 when idle.

- Buttons = left / right / middle. Registers button clicks (down, up) except when off-screen. Button stays down.

- Relative mode = 0
- Virtual desktop = 0


I think Judge Dredd is bugged with pcsx-reloaded (old history iirc). Have to try out a Guncon mouse sometime again.
- If you could test out a Guncon mouse and it works, that'd be useful too


edit:
Gunfighter works with mouse. Must be button holding problem then with lightgun.
(07-01-11 build released today - got date wrong)

Please test the app with button holding also.


edit2:
Question - fullscreen or windowed?


edit3:
Question - did lightgun cursor move around before the HID dual lightgun build?


edit4:
We'll do some MAME research about EMS / LCD Topgun just in case.
 
#16 ·
Six mouse in your test program:

Mouse 0 - always moving, Lightgun: 1, Buttons: 100
Mouse 1 - My Lightgun 1, Lightgun: 1, Buttons: 000
Mouse 2 - My Mouse, Lightgun: 0, Buttons: 100
Mouse 3 - My Lightgun 2, Lightgun:1, Buttons: 000
Mouse 4 - ?, Lightgun: 0, Buttons: 000
Mouse 5 - ?, Lightgun: 0, Buttons: 000

Virtual desktop, multimonitor: all zeroed

Should we make some version tracking? And I need the older build because always overwritten :S
 
#17 ·
Thanks. So you're using absolute coordinates.

Does absolute refer to your screen resolution?
(This may be a small calibration problem - try shooting around the screen and see where the coordinates go)

When you fire offscreen, what coordinates do you get?
- Time Crisis does this for difficulty selection


Some more docs, just like Paubi suspected about Lightguns:
MAMEWorld Forums - MAME Testers Forum - Another Mouse/Gun issue
The Troubleshooter - History


Funny enough, DirectX converts to relative mouse coordinates. (huh)


Don't like to archive much anymore. Management gets me confused between versions (strange excuse).



Archive for testing:
DirectX nuvee
Download nuvee_psx_controller.7z from Sendspace.com - send big files the easy way
 
#19 ·
WIP build
Download ___release.7z from Sendspace.com - send big files the easy way


Based on your feedbacks, some changes
- Re-configure your devices again (edit fullscreen resolution for PC lightguns = absolute screen coordinates)

This should center the gun and reduce cursor positioning problems.
(screen coordinates -> guncon system)


We'll see how many problems remain afterwards.
- paubi's 2P detection?
- offscreen shots?
- cursor aligning?
- do pal guncon games work?
- ..?
 
#20 · (Edited)
I downloaded the last file and tested it.

Adjusted the resolution: 800x600 in both gpu and nuvee
Mouse 100% ok.
Lightgun: now the cursor is in the top left corner (0:0 I think),
when I move the gun the cursor jump to the lower right corner (this isn't senisityvity problem in my hole opinion, I tried to adjust sensitivity from 100 to 1, stay the exactly same).

I wouldn't know why the screen format interesting. On the gun aspect, these EMS Topguns works with sensor bars, so don't see the real screen just the 4 corner (IR leds).

Source code for a lightgun game:

http://www.mediafire.com/?bsiy5oo04y98les

I dont know if this is useful or not.
 
#21 ·
LCDGunGame exe
Download LCDGunGame.7z from Sendspace.com - send big files the easy way
(it looks to work only with EMS guns)


When I don't know what I'm doing, I've got to decide whether it's worth investing our time (me+H). Probably why I'm so dissatisfied with emulation.

Not being able to personally test / get #s on what an 'absolute' gun coordinate is getting bothersome. Enough to not wanting to complete (abandon) lightgun simulation beyond a mouse.


Aside from unraveling about my own typical grumpy unlikable nature, Hopkat suggests we install a debug logging driver into nuvee. Testers wave the gun around all over, we log the coordinates and then guess what to do next.

We may have to do individual calibration this way also if values differ between guns.


That code says EMS uses
//Gun X:0xA0~0x2A0
//Gun Y:0x20~0xE0

Don't like the idea of offscreen shooting at edges. But have no choice for Justifiers later.


Debug dll tester
Download nuvee_psx_controller.7z from Sendspace.com - send big files the easy way

- Generates debug.txt log in pcsx folder
- Start game, wave gun past all screen edges, send data
 
#23 ·
There are games and emus like mame or all pc games that works throught the troubleshooter, that works with actlabs, topgun, and aimtrak, as i hve read. but this game you send, needs the driver of the topgun i suppose as it as made by the same company. so i think its better to see how do it mame or the troubleshooter.
i have been testing psx games with two mice and have problems with elementl gearbold, point blnk 1 2 3, elemental gerbolt, and mighty hits special, all others seems to work ok with mice.
tomorrow i will post a complete list of psx games ( there are pair jap that are very unknown)
is it possible the speed of emulation decreases wen you use rawimput?
in the last plugin crosshair dont move with lightguns, i tried modifing the sensibility but nothing.
I remind troubleshooter lets you play with epsxe 1.60, but only 1p, they said was an emulator limitation. but with this emu it was necessary to put the resolution of emu like the screen as you did in the last.
dont know if that will help

psd. i own 2 lcd topgun2 but wsnt ble to run tht game from ems. dont know why.
 
#24 · (Edited)
New test build
Download bin.7z from Sendspace.com - send big files the easy way


Going to try fixing the basic problem - 1P lightgun calibration
- new PCSX-r build (true latest SVN)
- new nuvee dll instructions


Absolute data means 16-bit unsigned values from 0-65535
- 0 / 65535 = offscreen (assumption)
- 1-65534 = raw values

- Clip value to top-left device corner
- Convert that to 512-256 guncon system
- Rely on 'special game config calibration' settings for Time Crisis, etc.


Please re-acquire devices
- New instructions to make sure PCSX-r window receives input correctly
- Replaced screen res values with edge calibration data (use acquire first!)
- Tweak edges if needed


If this works, 2P lightgun should behave the same.
If this continues to fail, it's time to leave emulation.


ref: John Goodman movie about Babe Ruth
(unaccurate quoths from memory)

JG: "Honey! I love baseball!" (speaking of retirement)
Wife: "But baseball doesn't love you."




edit:
And please verify that:
pcsxr-controllers dialog
- (first controller) = nuvee plugin
- (second controller) = nuvee plugin


@Paubi:
Don't know why 2P Point Blank 1 (NTSC-U) works okay here - 2x guncon (mouse emulation).

Please run raw_mouse_test.exe app and verify both mouse / lightguns are connected properly.



Raw input does run slower. SVN build should give a nice speedup again.

Not sure I'm willing to go bug fixing pcsx-reloaded though.
- Last experience fixing Judge Dredd went poorly (3-4 month attempt)

And ePSXe 1.7.0 + pSX 1.0+ run them fine. :sigh:
 
#25 · (Edited)
Just done a quick test because there is night here:

Working in Time Crisis with one gun. The aiming/precision is very satisfying.
Was a quick test, just reacquired the gun, not touch calibration datas, and missed-mistaked the edge calibration but the gun works ok! Offscreen shot was ok to make the game "Easy" mode.

Working Point Blank with 2 gun. Tomorrow I will check edge calibration in the second acquiring step. (OFF: But we alredy get edge calibration with the Topgun driver, but not needed when the hardware gun calibrtaion O.K. OFF)

So, may be baseball love you.

Thanks!

Ps.: found very buggy games. Time Crisis Project Titan register every shot as missed, epsxe works. Resident Evil Survivor cant register any shot. Of course it's not your fault, but actually only Time Crisis and Point Blank what we should test it.
 
#26 · (Edited)
Thanks for mentioning. Hopkat re-added some of the Guncon commands - 45/46/47/4c
Download bin.7z from Sendspace.com - send big files the easy way


This will fix RE:S (PAL-only = guncon) + Time Crisis - PT
- Note that there is a separate dll folder for just PB3/Gunfighter/Ghostbusters


Why? nuvee takes advantage of a weak spot in these 3 games. Unfortunately, an official licensed Namco gun returns specific data. Basically a lightgun lockout protection method.

And we don't know what these values are.



edit:
I'm told RE:S (PAL) is still buggy. Maybe fix tomorrow.


edit2:
Fix for RE:S (PAL). Uses 4d cmd also. ^^
Download bin.7z from Sendspace.com - send big files the easy way

Just using dummy data to please these games.
 
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top