PDA

View Full Version : Development in DX Joystick Plugin



Ron
October 13th, 2002, 01:55 PM
The handle that goes to the SetTimer function
is the handle of the window that your
plugin creates. The window must exists all
the time,.. although hidden.

The handle can be null,.. but you still
need the message loop.

So there are 2 ways to go:

1. Hidden window
hwnd = hWidnow of window
nIDEvent = 45645 ( jut a number )
eElaps = time out in milliseconds
Timerproc = NULL

2. No window, only message loop
hwnd = NULL
nIDEVENT = NULL



Here is an example of the usage of a timer
in the case that there is no window.



#define WIN32_LEAN_AND_MEAN
#include <windows.h>
void CALLBACK TimerProc2(
HWND hwnd, // handle of window for timer messages
UINT uMsg, // WM_TIMER message
UINT idEvent, // timer identifier
DWORD dwTime // current system time
)
{
// Print the timer message
printf("timern");

// Make the message loop exit.
PostQuitMessage(0);
}


int main(int argc, char* argv[])
{
UINT t;
MSG AMessage;

// Start the timer
t=SetTimer(NULL,0,1000,TimerProc2);

// The messageloop
while (GetMessage(&AMessage, 0, 0, 0))
{
TranslateMessage(&AMessage);
DispatchMessage(&AMessage);
}

// Remove the timer
KillTimer(NULL,t);

return 0;
}



The second question when Girder exists what then ?

Easy girder calls :

__declspec(dllexport) void clean_up_device()

This function should destroy everthing that the plugin open and started. Also this function should destroy the configuration dialog (if opened)

After that girder unloads the dll so this
one should clean up everything.

And your icq has got a auth request from me.

-Ron




[Edited by RonB on 02-03-2001 at 11:11 AM GMT]

Ron
October 13th, 2002, 01:55 PM
BBF,

Sorry we got disconnected, but my network
connection died,.. still is dead :(

-Ron

Ron
October 13th, 2002, 01:55 PM
Ahhh the net is back up!!,

Just ICQ or Email me the plugin
and it will be hosted on my site!!

Thanks for the effort!

-Ron

Ron
October 13th, 2002, 01:55 PM
Its uploaded to the download page.

Thanks go to BBF_DT

Ron

Darmok
October 13th, 2002, 01:55 PM
Thank you Ron! The joystick plugin works well. The Intel Wireless gamepad has a button that switches it into mouse mode, which allows the D Pad to be used as a positioner. It also uses Button A as a left mouse click, Button B as a middle mouse click and Button C as a right mouse click. Buttons x and y are used for scroll wheel actions. But even in the mouse mode the Z, start and the two trigger buttons are still available as joystick commands. I can see this as being really handy, since the joystick is RF and the mouse function already works decently.
Anyway I had a couple of questions about the plugin. When I switch the gamepad out of mouse mode into gamepad mode, I tried setting the D-Pad (positioner) to do mouse control through girder. The problem I'm having is that if I hold the positioner up I want it to repeat the mouse up command for as long as I hold the positioner up. But it only seems to execute this command once. I don't have antirepeat on, and I'm guesing its how the joystick plugin sends the data.
Also I notice that the commands are at least 16 digits and actually run off the display windows. Most of my joystick codes are all zero's for all of these digits, making it hard to debug problems. Is there a way to change this? I only see zero's and one's in my codes. Are these in binary? If so would it be possible to change it to hex so it would fit on the screen? Functionally this should't change anything I doubt, exept having to relearn the commands.

Darmok
October 13th, 2002, 01:55 PM
I'd be interested in trying the plugin out with my new Intel Wireless gamepad. I didn't see the plugin on the download page though. Can you post it please?

BBF_DT
October 13th, 2002, 01:55 PM
Hi Ron,

This is't as hard as I thought, the progress is going nicely. I need some help though. As I said, I know little C... and void in C++.
I need to use the SetTimer() and attach it to the DLL handle (as if I knew what a handle is :) heheh, I know that every ?Thread? has one.), I used your keyboard plugin source as my base. What is the DLL handle in there? Sorry for asking such dumbass questions :( heheh
Also, if I try to close the program without pressing F9 I get an error because it doesn't release the joystick capture... wich function is called when u simply send a WM_COMMAND close to girder ?

Hmm... since it's not that difficult to program in C ( yeah right ) the next plugin I'll be doing is a software, wich will generate force feedback loaded from a .FFE file ... (all source stollen from their SDK) LOL :-)

tNx...
PS: do u have a perm net connection ? if u do plz pass me your UIN or something if possible. I really need help now.. but as I learn the stuff I'll stop bothering and contribute with many plugins for you...

BBF_DT
October 13th, 2002, 01:55 PM
Ron,

Well, I'll try to do that. I already had read that you didn't need a handle to attach the timer, but that didn't work. I'll either make that work or stop using the poll method to read the joystick. But I had problems earlier reading in event mode from the joy.

About ICQ I didn't receive any auth request :(. Send me and email with it :) Icq is veryyy bugggeedd hehe.

tNx a lot for helping

BBF_DT
October 13th, 2002, 01:55 PM
Ron,

Well, the plugin now works nicely. I just need to implement:
__declspec(dllexport) void learn_device(PCHAR old)
But I need more info on that function. It's not very clear on the API doc. I'll start guessing today but your help would speed it a lot. :)

tNx

BBF_DT
October 13th, 2002, 01:55 PM
Ron,

Well, what can I say. The plugin is done. From now on only comestic fixes shall be done. And feature requests by users. Even the learn_device() has been implemented. I wonder if you could host it in your webpage also :)

Hmm... what should I do next ... any requests ? I might do that software FFe plugins LOL ;)

BBF_DT
October 13th, 2002, 01:55 PM
Hi Darmok,

I'm aware of the repeating problem... I'm still tinking on how I shall solve that problem. It has been programmed to send commands only once. I did that because I poll it every 50 ms. If it made an action every 50 ms well, It wouln't be nice. I think that I'll program some different kind of code that is generated when you hold the stick somewhere. About the long code:
The first 32 digits are binary for the possible 32 buttons. I did that so you can use some buttons as alternates. Like, program a command to be used when you press 3 4 and 5 together.. generating a 00111000... code.... after those 32 digits there are 6 more for the sticks movement.. in the future there will be 8 to support POV also...

worldrave
October 13th, 2002, 01:55 PM
Would it be possible to use the analog sticks of a joystick to control something attached? Ie- I've asked Ron about this before a while back, here's an example I would love to use it for. Attaching one axis to mouse left/right, and attaching right analog stick to mouse up/down for use for realtime added effects for my DJ software i use for realtime effects change. That would be awesome. If not, cool. I figured maybe since it is a sort of directx plugin style, that could be possible.

Draugluin
December 19th, 2002, 08:48 PM
I would really find this to be very useful. Joytokey just isn't cutting it for my joystick hacking. If you have stopped development on this plugin, is the source available?

I couldn't find your joystick plugin on the download page.

Ron
December 19th, 2002, 10:05 PM
That is because this plugin is no longer available, sadly the original author lost the sourcecode and was not able to upgrade the plugin to Girder 3.2