(Input plugin) nuvee psx controller

Discussion in 'PSX Plugin Questions & Troubleshooting' started by shalma, May 25, 2011.

  1. shalma

    shalma Discontinued Emu Author

    Messages:
    1,192
    Likes Received:
    0
    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
    Last edited: Oct 21, 2011
  2. NGEmu.com Advertisement

  3. shalma

    shalma Discontinued Emu Author

    Messages:
    1,192
    Likes Received:
    0
    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.
    Last edited: May 26, 2011
  4. shalma

    shalma Discontinued Emu Author

    Messages:
    1,192
    Likes Received:
    0
    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)
    Last edited: May 28, 2011
  5. Killervin

    Killervin New Member

    Messages:
    51
    Likes Received:
    0
    Very interesting. Hope it will be the best plugin for dual lightgun games. Thanks!!
  6. paubi

    paubi New Member

    Messages:
    38
    Likes Received:
    0
    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. Killervin

    Killervin New Member

    Messages:
    51
    Likes Received:
    0
    I already own dual EMS's so if need for testing it's ok to me :)
  8. shalma

    shalma Discontinued Emu Author

    Messages:
    1,192
    Likes Received:
    0
    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)



    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!
  9. shalma

    shalma Discontinued Emu Author

    Messages:
    1,192
    Likes Received:
    0
    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. Killervin

    Killervin New Member

    Messages:
    51
    Likes Received:
    0
    That's great.

    Point Blank is also interesting for 2 players, thats my opinion.

    Anything happen, it will be better than ever before. There was no good solution for play those games with nice graphic and precise targeting like this. We are waiting for your next release.
  11. shalma

    shalma Discontinued Emu Author

    Messages:
    1,192
    Likes Received:
    0
    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. Killervin

    Killervin New Member

    Messages:
    51
    Likes Received:
    0
    Thanks man.

    What about PCSXlightgunR fork? I make some design If accepted...
    And wanna make some cursor for higher resolutions with color options.
    Last edited: Jul 1, 2011
  13. shalma

    shalma Discontinued Emu Author

    Messages:
    1,192
    Likes Received:
    0
    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.



    That'd be a GPU plugin problem - they handle the cursor icon + colors.

    Don't know how they do it either. ^^
  14. Killervin

    Killervin New Member

    Messages:
    51
    Likes Received:
    0
    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.
    Last edited: Jul 1, 2011
  15. paubi

    paubi New Member

    Messages:
    38
    Likes Received:
    0
    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
  16. shalma

    shalma Discontinued Emu Author

    Messages:
    1,192
    Likes Received:
    0
    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.
    Last edited: Jul 1, 2011
  17. Killervin

    Killervin New Member

    Messages:
    51
    Likes Received:
    0
    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
  18. shalma

    shalma Discontinued Emu Author

    Messages:
    1,192
    Likes Received:
    0
    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. Killervin

    Killervin New Member

    Messages:
    51
    Likes Received:
    0
    Ok I will check it tomorrow. There is night here :)
  20. shalma

    shalma Discontinued Emu Author

    Messages:
    1,192
    Likes Received:
    0
    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?
    - ..?
  21. Killervin

    Killervin New Member

    Messages:
    51
    Likes Received:
    0
    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.
    Last edited: Jul 1, 2011

Share This Page