Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: jerryjanis on September 11, 2003, 05:02:24 am

Title: Windows XP and Rawinput - Multiple mice
Post by: jerryjanis on September 11, 2003, 05:02:24 am
It sounds like several of us are starting to approach the territory of getting multiple mice to work in Windows XP with rawmouse.  I created a little respositry, and I'm hoping to gather any information that I can so that one day multiple mice in Mame might actually be a reality.

Check it out:

http://jstookey.com/arcade/rawmouse/

Please let me know if you have any information to share!

I think that the most immediate need is to get the raw input libraries working with MinGW/GCC.  If anybody knows anything please speak up!  Whoever got the direct x stuff working with MinGW would probably have all the answers.  By the way, the rawinput include header is less than 400 lines of code...  There wouldn't be very much to bring into MinGW if it's possible.
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: jerryjanis on September 11, 2003, 05:10:44 am
Ooh ooh!  I went looking through the MinGW directories and found a little tutorial on how to convert libraries!!!  Check out \MinGW\lib\src\directx.html.

That lead me to this site:
http://jrfonseca.dyndns.org/projects/gnu-win32/software/reimp/

Is it bedtime yet?
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: jerryjanis on September 11, 2003, 06:45:49 am
I was able to get my HelloRawInput program to compile with MinGW and the program actually worked.  However, my more involved program compiled ok, but when I run the executable it blows up partway through.  Also, with the changes I made changing the library & commenting stuff out of it, MAME fails to compile when it gets to the Windows specific stuff.  It seems like a really good start, though.  Man it sure got my hopes up for a little while there!

Here's what I did:

1) I looked in the MS Platform SDK header file, "winuser.h" to see if I could figure out which library file it applied to.  I saw a constant towards the top with "user32" in the name, so I figured user32.lib was what I needed to convert.

2) I ran "reimp user32.lib" on the library file (it's a program in the mingw-utils package) and reimp created libuser32.a for me.

3) I put that file in the MinGW\lib directory with the other .a files.

4) I moved "winuser.h" from the MS Platform SDK's include directory to MinGW's include directory.

5) My first attempt compiling HelloRawInput failed, because of errors in the header file.  I think that there were 5 errors in all.  To "fix" the errors, I commented out the lines produced the error.  One of the lines I commented out was "#include <tvout.h>" because I didn't want to be bothered finding that header/lib and converting them.   So there's probably a cleaner solution.  Next time, I would probably try looking at the current MinGW "winuser.h" file and use that to tweak the Platform SDK one.

I hope there aren't a lot of interdependencies that could get broken by changing the library...
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: Lilwolf on September 11, 2003, 09:05:29 am
Before spending too much time getting the headers over into mingw

Has anyone tested it in a microsofts vc++?  I would hate to see the time spent to get everything going...  And find that it still sends all output to the !@# system mouse only.  Or not work the way you are hoping.

I do have a question.  Will this solution work in win98?  Or will this be a XP only solution?

And as a last part... I'm SO glad I write in Java.  It doesn't need .h files at all.. I can ask any object at runtime what methods I'm allowed to call.  Its VERY nice!  If I have access... I have access.  I don't have to guess what the interface is.
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: PacManFan on September 11, 2003, 10:25:36 am
Before spending too much time getting the headers over into mingw

Has anyone tested it in a microsofts vc++?  I would hate to see the time spent to get everything going...  And find that it still sends all output to the !@# system mouse only.  Or not work the way you are hoping.

I do have a question.  Will this solution work in win98?  Or will this be a XP only solution?

And as a last part... I'm SO glad I write in Java.  It doesn't need .h files at all.. I can ask any object at runtime what methods I'm allowed to call.  Its VERY nice!  If I have access... I have access.  I don't have to guess what the interface is.

RawMouse / RawInput can separate the input very cleanly, Unfortunately , this is going to be an XP-only solution. I worked on a project several months ago using rawinput and XP to produce a program that displayed 2 independant mice cursors on the screen at the same time. It was written in MSVC 6.0. I'm going to dig up the code tonight and send it to u_rebel and whoever else wants to see it.
 In the meantime, I'll check out he link above and see if I can get something compiling /working.
-PMF
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: PacManFan on September 11, 2003, 11:11:22 am
I found another link to a group using RawInput at the University of Calgary in Canada. Here's the link http://www.cpsc.ucalgary.ca/grouplab/projects/Single_Display.html (http://www.cpsc.ucalgary.ca/grouplab/projects/Single_Display.html)
hope this helps.
-PMF
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: PacManFan on September 11, 2003, 11:16:31 am
Here's a link to the main download page with a dll control and a bunch of code examples. try it out.
http://www.cpsc.ucalgary.ca/grouplab/software/SDGT/Download.html (http://www.cpsc.ucalgary.ca/grouplab/software/SDGT/Download.html)
-PMF
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: Jakobud on September 11, 2003, 03:49:46 pm
Here is a site for some little game some guy is making.  Anyways, its a multiplayer game using mice and apparently he has at least looked into using the rawinputs.  

http://www.tomkorp.com/clones/news.html

Check the April 21, 2003 news post.  He says that he is putting multiple mice on hold, but that was several months ago.  He might be worth contacting.
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: PacManFan on September 11, 2003, 04:05:42 pm
I just gave jerry a new demo program showing how to use dual mice under XP. It displays XY coords for both mice on the screen. Hopefully he'll post it soon on his site.

-PMF
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: jerryjanis on September 11, 2003, 04:45:18 pm
Yup, get PacManFan's code here:

http://jstookey.com/arcade/rawmouse/hellorawinput2.zip
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: u_rebelscum on September 11, 2003, 08:06:38 pm
Awesome, looking promising.  :D

Thanks for putting the info on-line, Jake.  I'll d/l the code tonight and take a look at them.  
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: Howard_Casto on September 11, 2003, 08:45:43 pm
Now for the bad news.... The mame devs are extremely reluctant to put os specific code in the mame source.  So rebel can use it but it might not ever make it into an official build.  :(
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: jerryjanis on September 11, 2003, 10:01:48 pm
Now for the bad news.... The mame devs are extremely reluctant to put os specific code in the mame source.  So rebel can use it but it might not ever make it into an official build.  :(
You're right, but I'm ok with it.  I think that this is a good project because rawmouse info is really tough to come by.  Other multi-mouse projects might want to know how to rawinput and this could help them out.  Mame is just a really good excuse.

By the way, I updated the web page again:

1)  I modified PacManFan's program from a Visual C++ project to a .C file that can compile with MinGW.
2)  I added the replacement library and header files needed to compile it with MinGW/GCC.

http://jstookey.com/arcade/rawmouse/
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: Howard_Casto on September 11, 2003, 11:02:21 pm
On an odd but somewhat related note.  I was looking into adding mouse axis to the ctrlr files and found that in inputprt.h a mouseX and mouseY is already defined but only for mess?!?  

Rebel since your our resident input expert could you maybe explain this one to me?  I'm afraid to use the existing code for fear that it's so mess-specific that'll screw stuff up.  
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: jakejake28 on September 11, 2003, 11:04:21 pm
if only microsoft could see us now :P
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: jerryjanis on September 12, 2003, 12:23:52 am
I made another update to the site.  I made one small change to the new MinGW "winuser.h" include file and my next Mame compilation succeeded.   I played a Atari Soccer and saved a snapshot.

As far as I can tell, we now have a common build environment for rawmouse and the standard Mame code, so hopefully we can smurf them together into a version of Mame that can handle multiple mice in Mame!
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: u_rebelscum on September 12, 2003, 08:33:48 am
On an odd but somewhat related note.  I was looking into adding mouse axis to the ctrlr files and found that in inputprt.h a mouseX and mouseY is already defined but only for mess?!?  

Rebel since your our resident input expert could you maybe explain this one to me?  I'm afraid to use the existing code for fear that it's so mess-specific that'll screw stuff up.  

Don't worry about the mess mouseY stuff.  It is the equiv to a "IPT_TRACKBALL_Y" input.  IE, you map a key to the (emulated/simulated) trackballY, and you map a key to the (emu/simu) MouseY.  

What you want to do is map a physical mouse to (emu/simu) trackball, right?  This would probably involve adding MOUSECODE_1_LEFT, MOUSECODE_1_RIGHT, ect; much like JOYCODE_1_LEFT, etc (look @ input_keywords[] in src/inputport.c, and joy_trans_table[] in src/windows/input.c)

FWIW, I've heard AdvanceMame lets you remap the mouse from the command line; you might want to look at it.  I tried skimming it once, but didn't spend enough time to find and understand how AMame was doing it (compared to the hack-ish way MameAnalog+ does it).
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: Jakobud on September 12, 2003, 04:16:34 pm
Now for the bad news.... The mame devs are extremely reluctant to put os specific code in the mame source.  So rebel can use it but it might not ever make it into an official build.  :(

I didnt know this.  Aren't there things in Mame regarding DirectX that help improve the graphics and speed?
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: Howard_Casto on September 12, 2003, 04:49:00 pm
Well yes BUT it took 3 years to convince enough mame devs that it was necessary to put in.
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: jerryjanis on September 12, 2003, 07:37:48 pm
I shouldn't say anything because I have a couple of days worth of  sleeping and code cleaning before I have anything that's worth showing off, but I just played Atari Soccer with 4 USB mice in Windows XP.  Yeehaw!
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: PacManFan on September 12, 2003, 11:42:56 pm
Jerry, you DA MAN !

Good going with the RawInput Code! I'd like to see how you incorporated it in Mame.

I started my own RawInput work in Mame32, it's still not quite working right.

-PMF
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: Jakobud on September 13, 2003, 02:48:28 am
Rock on!  This is great.  Good work guys.  This is a huge hurdle that has been overcome.  
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: jerryjanis on September 13, 2003, 03:54:30 am
Thanks, guys...  And thanks a lot PacManFan for that Rawmouse stuff you sent me - it was really helpful.

I'd like to see how you incorporated it in Mame.
I updated the rawmouse page with my Mame: Analog+ source code.  I crammed most of the rawmouse stuff into separate .c and .h files to make rawmouse easy  to manage.  It's not ready for prime time or anything, but there's not much to it so it should be really easy to follow.
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: zero-one on September 13, 2003, 10:02:58 am
This is super news! I'm so thrilled to here that soon I won't be forced to use win98SE in my furture mame cab if want to use multiple mice. Keep up the great work guys!
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: u_rebelscum on September 14, 2003, 06:32:04 pm
I shouldn't say anything because I have a couple of days worth of  sleeping and code cleaning before I have anything that's worth showing off, but I just played Atari Soccer with 4 USB mice in Windows XP.  Yeehaw!

Great!  Mind if I try to include the code in Analog+?  (I guess I'll need to do two separate compiles?)


Also, could anyone with a XP/98 dual boot compare game speed and input response of the rawinput code vs the analog+ directInput code?  My friend's computer (with XP) hardware kicks my computer's (with winME) hardware, so I can't compare.
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: jerryjanis on September 14, 2003, 07:08:14 pm
Great!  Mind if I try to include the code in Analog+?  (I guess I'll need to do two separate compiles?)

Yes I do mind...  I've been working night and day trying to make the code fit as nicely as possible into Mame Analog+, and I need some more time.  

Cool, I wasn't sure if you'd want to be responsible for maintaining code that you can't test/* <jake> */conveniently.

As far as separate compiles are concerned, that shouldn't be necessary as long as I add something in that prevents the user from executing any raw input code with older windows versions.  However, you might still want to do separate builds if you don't want to keep your regular Analog+ build environment the same as the Mame one.
/*</jake> */
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: u_rebelscum on September 15, 2003, 04:52:02 am
Great!  Mind if I try to include the code in Analog+?  (I guess I'll need to do two separate compiles?)

Yes I do mind...  I've been working night and day trying to make the code fit as nicely as possible into Mame Analog+, and I need some more time.  

I'm in not in any hurry if you're still working on it: any work you do is less for me. ;) ;D

Also, I'm currently trying to fix some fairly minor bugs in Analog+ before I'll look at actually adding your rawinput code.  And I have no problem waiting a release or seven before adding it.

If you run into any questions, of course, I'm here. :)

Quote
Cool, I wasn't sure if you'd want to be responsible for maintaining code that you can't test/* <jake> */conveniently.

Testing would be a great excuse to go over to my friend and ask if I could use his computer, especially if I bring my dual trackball CP over with me and ask him to help in the "testing".  :D

Seriously, I've said I won't upgrade to winXP until it had multiple mouse support; looks like I know what I'll get myself within 6 months, since the major reason stopping me looks like it has been removed (the other stopping reason is $$$, of course).  So I should be able to test at home soon-ish.

And Analog+ is begging for the winXP multi-trackball support; any "responsiblity" I take in including your code I'd consider minor compaired to the work you are doing making it work.

Plus I do get to blame credit you as the author of the code. ;)

Quote
As far as separate compiles are concerned, that shouldn't be necessary as long as I add something in that prevents the user from executing any raw input code with older windows versions.  However, you might still want to do separate builds if you don't want to keep your regular Analog+ build environment the same as the Mame one.
/*</jake> */

Oh, ya ... shucks; forgot about the editted header & new lib. :-\  I don't want to make it any harder for other people compiling their own analog+ variant than I have to, again.  (like back in the dx8 days)  Hmm...[still thinking]


And in case I didn't say it before, thank you!
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: SirPoonga on September 15, 2003, 05:13:44 am
two different builds would be tough.


So, this raw data is an XP only thing?  Would it work in any other version?
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: jerryjanis on September 15, 2003, 05:17:13 am
two different builds would be tough.


So, this raw data is an XP only thing?  Would it work in any other version?

I think it's supposed to be good for Windows XP and later.  Windows 2003 Server or whatever I think should also work fine.

I just got MinGW to compile some code that detects what version of windows the user's got...  It worked great on XP but Windows 98 doesn't support the calls...  Tell me - what's the point of version detection if it will only run on the latest version?  Ugh.

What the heck are you guys still doing up?  Or do you wake up this early?
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: u_rebelscum on September 15, 2003, 05:34:08 am
I just got MinGW to compile some code that detects what version of windows the user's got...  It worked great on XP but Windows 98 doesn't support the calls...  Tell me - what's the point of version detection if it will only run on the latest version?  Ugh.

LOL, grrrr, LOL >:(

Quote
What the heck are you guys still doing up?  Or do you wake up this early?

It's only 2:20 here.  Should have been asleep an hour and a half ago, opps.
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: SirPoonga on September 15, 2003, 05:42:49 am
What the heck are you guys still doing up?  Or do you wake up this early?

When you are unemployed you don't need sleep :)
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: u_rebelscum on September 15, 2003, 05:50:40 am
What the heck are you guys still doing up?  Or do you wake up this early?

When you are unemployed you don't need sleep :)

Don't you mean :( ? ;)
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: jerryjanis on September 15, 2003, 05:54:07 am
When you are unemployed you don't need sleep :)
Which leaves you with plenty of time to uhhh....  Look for jobs  ;) and work on stupid Mame crap.

(http://66.78.4.165/~jstookey/images/zzz.gif)
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: SirPoonga on September 15, 2003, 05:57:42 am
ACtually, working on controls.dat right now  :-*
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: Jakobud on September 15, 2003, 01:24:26 pm
Have you guys been in contact with the Mame dev's on this rawinput stuff? They might actually want it in the offical build of Mame for 0.75... I'd email them and let them know what you guys have been able to do.
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: GamingGreg on September 15, 2003, 01:41:23 pm
two different builds would be tough.

Would it be possible to use some branching based on the OS it detects at runtime, so that you'd only need only one Windows build?   If it detects WinXP, then use the raw input stuff, else use the DirectInput stuff.  Would that be the best approach?
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: _Iz- on September 15, 2003, 02:15:46 pm
for simplicity, it could also be a commandline switch...
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: GamingGreg on September 15, 2003, 03:06:07 pm
for simplicity, it could also be a commandline switch...

That's probably the best option, as it would allow you to use DirectInput in WinXP if you don't need the raw input stuff.
Title: Re:Windows XP and Rawinput - Multiple mice
Post by: jerryjanis on September 15, 2003, 05:05:28 pm
two different builds would be tough.
Would it be possible to use some branching based on the OS it detects at runtime, so that you'd only need only one Windows build?   If it detects WinXP, then use the raw input stuff, else use the DirectInput stuff.  Would that be the best approach?

I hope so.  I'm looking into it.  My first attempt didn't work, so I put it off to the side for now.  Currently, there's a command line switch.  Thanks for the ideas.