News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Getting my joystick working under Direct Input

Started by hamper, December 01, 2013, 10:00:30 AM

Previous topic - Next topic

dedndave

oh boy - i see the MultiMedia library also supports joystick input
much simpler to learn   :P

still, i am interested in both methods

dedndave

a simple MultiMedia console test program to see if any joysticks are connected

results on my machine, XP SP3
Joystick #0: Not Connected
Joystick #1: Not Connected
Joystick #2: Not Connected
Joystick #3: Not Connected
Joystick #4: Not Connected
Joystick #5: Not Connected
Joystick #6: Not Connected
Joystick #7: Not Connected
Joystick #8: Not Connected
Joystick #9: Not Connected
Joystick #10: Not Connected
Joystick #11: Not Connected
Joystick #12: Not Connected
Joystick #13: Not Connected
Joystick #14: Not Connected
Joystick #15: Not Connected

GoneFishing

Bravo , Dave  :t
MM Input API is much better than DirectX to start with .
Some info on Using Joysticks

dedndave

i can't imagine 16 people crowded in front of one computer to play a game - lol

GoneFishing


sinsi

Quote from: dedndave on December 03, 2013, 01:27:55 PM
i can't imagine 16 people crowded in front of one computer to play a game - lol
I did a job for a flight sim nut, he had 4 different controllers plugged in - pedals, throttles, stick and another one (don't know what for) and used the keyboard.
Four monitor setup - left, front-left, front-right and right. Wanted a couple behind but the video cards max out at 4.
The best thing? He has a friend bring his 4 controllers and fly pilot-copilot.

FORTRANS

Hi,

   Well, well, well.  Dug out my joystick.  Ran your program, nothing
found.  Went to Control Panel, Gaming Options, and ran the install
option.  Then your program paused a while, and found it.  Kudos I
suppose.  Anyway, here is the output from the console.

■ Pentium II class CPU detected.
■ XMS version 2.00 detected.
■ DPMI version 0.90 detected.

Searching ZIP: NOJOY1.ZIP
  Inflating: NoJoy.exe
  Inflating: NoJoy.asm

F:\TEMP>nojoy
Joystick #0: Not Connected
Joystick #1: Not Connected
Joystick #2: Not Connected
Joystick #3: Not Connected
Joystick #4: Not Connected
Joystick #5: Not Connected
Joystick #6: Not Connected
Joystick #7: Not Connected
Joystick #8: Not Connected
Joystick #9: Not Connected
Joystick #10: Not Connected
Joystick #11: Not Connected
Joystick #12: Not Connected
Joystick #13: Not Connected
Joystick #14: Not Connected
Joystick #15: Not Connected

Press any key to continue ...

F:\TEMP>nojoy
Joystick #0: Connected
Joystick #1: Not Connected
Joystick #2: Not Connected
Joystick #3: Not Connected
Joystick #4: Not Connected
Joystick #5: Not Connected
Joystick #6: Not Connected
Joystick #7: Not Connected
Joystick #8: Not Connected
Joystick #9: Not Connected
Joystick #10: Not Connected
Joystick #11: Not Connected
Joystick #12: Not Connected
Joystick #13: Not Connected
Joystick #14: Not Connected
Joystick #15: Not Connected

Press any key to continue ...


   Hm, wonder how long it's been sitting around?  It was never
attached to this computer to my knowledge.

HTH,

Steve N.

Edit:

P.S.

   I just noticed an On/Off switch on the joystick.  And it works.
When in the off position, the joystick is not seen.

Cheers,

SRN

dedndave

thanks Steve - now that i know it works, i'll try a GUI app that uses it

dedndave

i used to play with games a little - mostly in the 80's
flight simulators were fun for a while
and - i am into flying - "aced" ground school and have some hours behind the stick, even
but - sims get old fast - lol

i played Dig-Dug (Digger) and Asteroids more
and i was better with the keyboard "yoke" than the joystick

back in the day, a friend of mine had an atari
he and i used to get together and play Archon II
joystick was the only way to fly for that game

hamper

I like the odd session on a flight sim, but there's nothing like the real thing ... I'm a member of a gliding club, and fly gliders now and then. You should give it a whiz sometime. It's the most fun you can have with your clothes on. And not as expensive!

But, back to the point, it looks like I'm going to have to grapple with the beast if I'm going to get my joystick working in my own program, so I may as well get started.

Thanks for all the information, tips and links everyone. Looks like I'm going to be busy for a month or so :icon_confused:

Right, let's get started "Chapter 1 - A simple introduction to using COM in assembly language programs".

dedndave


hamper

Wow! Yes, it picks it up as joystick 0.

So presumably (I haven't tried it yet), I could simply read the axes positions using ji.wXpos, ji.wYpos and ji.wZpos?
And also, presumably, I've been stumbling around looking into all the COM stuff when the answer was already there in the winmm functions? Is that right?

I can't believe it's that simple. Seemed like a horrendous chore using the COM approach.
Know any link that documents the various joystick functions in winmm?

EDIT: Silly me, it's all documented on Microsoft's site.

dedndave

it is documented
and - simpler than COM, probably

however, Multi-Media isn't always simple, either - lol
nothing ever is

if your program can work by reading the position asynchronously, then that may be the easy way
at the moment, i am reading through the documentation
i was trying to write a message-driven app

problem is - no josytick to test with
it looks a little complicated, because of the capture function
it does not work the same as mouse capture
tomorrow, i may have a little program for you and Steve to test for me
i want to see how a window is notified of capture change

i may have to dig out my sidewinder and see if i can hook it up

hamper

I'll work on it as well.
Have to log off for a bit now.
Later

hamper

Haven't got around to writing myself a little test program yet, in order to check the various reported axes values, POV hat positions and general button use etc. -- still working my way through putting notes together on all the various winmm.lib functions and all the different structures they use etc.

But I've noticed a few things that may be issues with the structures (in windows.inc)...

JOYCAPSA structure
   MASM32 has the elements wxmin...wperiodmax inclusive (9 elements) as word types, but Microsoft has them as UINT (dword) types.

JOYINFO structure
   MASM32 has all the elements as word types, but Microsoft has them all as dword types.

JOYINFOEX structure
   The dwpov element can take a value of -1 (indicating centred), so really it shoud be an sdword type, not a dword (but no big deal).