PDA

View Full Version : Force Feedback dll - Struggling a year now.



Grendelus
15-12-2006, 08:40 PM
Hiya everyone.

I am creating a game with a software called Game Maker. This software allows the communication with dlls, so I decided to add some force feedback support to my games by creating a dll with delphi.

For over a year now I've been searching, force feedback tutorials, undelphix, delphix, headers here headers there and nothing. However recently, I found a dll though for another software but I was able to wrap it for my game. However being commercial it through a message on load and a 5sec delay everytime the force was inited so I decided to buy it. I did, my money reached share-it, but 15 days after no dll was delivered to me. My emails bounced and never reached the publisher so it seems my mail. So I was apparently screwed and stuck with the trial dll. :(

So, I seek for your help. I need either a helpful and working delphi example or a compiled dll to call using external.
I also once encountered this thread, does anyone have the FF.exe (source and demo) Attapong mentions on this thread
http://www.pascalgamedevelopment.com/viewtopic.php?t=1515&sid=9fa8f51c71f10e9787e15b3a6427a0c9
? :roll:

It is a really old topic, but what the heck? Am I really that late?

Finally, I use Delphi 6 personal. DirectX 9.0c, WinXp Home and have a Thrustmaster force feedback gamepad.

JernejL
15-12-2006, 09:33 PM
i think delphix should work with force feedback...

Grendelus
20-12-2006, 07:44 PM
I have tried but with no result. :(

chronozphere
23-12-2006, 08:39 AM
Hi :)

I think the best way to do this is, to do it all yourself. :) I think you've already tried all other options.

Download Clooties DirectX headers and take a look at
this page (http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dx81_c/directx_cpp/Input/Using/ForceFeedback/ForceFeedback.asp). (Sorry, i couldnt find the DX9 version).
I think you'll also need some basic DirectInput tutorials to get started. These can be found here (http://www.gamedev.net/reference/list.asp?categoryid=24#152)

When you know how DirectInput basicly works, you should be able to initialize a joystick device. Then you can use that MSDN page (first link) to figure out how to use force feedback.

I know the code is all C++, but the API calls are similar in delphi, when using Clooties headers.

I know... it's a bit harder and it takes more time, but i think that in the end, it'll work. ;)

Good luck.

Grendelus
28-12-2006, 09:08 AM
I know the code is all C++, but the API calls are similar in delphi, when using Clooties headers.

Do you know where those headers are located?

chronozphere
28-12-2006, 11:13 AM
The headers are located here! (http://www.clootie.ru/delphi/download_dx92.html#Headers)

Unfortunatly.. there are no downloadable forcefeedback examples. :(

The headers contain all necessary functions and data-structures you need, to work with DirectX9.
Go to MSDN and gather all the info you need. :razz:

I haven't done anything related to force-feedback, but i'm planning to include it in my game-engine.
When i've implemented it, i could send you a some code. :)

WILL
28-12-2006, 02:00 PM
Just for clarification since I've never worked with it myself, is Forced Feedback exclusive to DirectInput?

savage
28-12-2006, 09:48 PM
Have you tried porting this demo - http://www.microsoft.com/msj/0298/force.aspx

chronozphere
29-12-2006, 08:18 AM
Just for clarification since I've never worked with it myself, is Forced Feedback exclusive to DirectInput?

I know DirectInput has force-feedback support and good documentation.
I think there must be some Mac OS/Linux API's which support ForceFeedback but i dont know any..
good question :)

But directInput would suffice because gamemaker-games use DirectX, thus they are windows-only. :)

Grendelus
31-12-2006, 09:25 AM
I haven't done anything related to force-feedback, but i'm planning to include it in my game-engine.
When i've implemented it, i could send you a some code.

Thanks. :)



Just for clarification since I've never worked with it myself, is Forced Feedback exclusive to DirectInput?

Yes, since it is a DirectX feature.

WILL
31-12-2006, 05:16 PM
Just for clarification since I've never worked with it myself, is Forced Feedback exclusive to DirectInput?

Yes, since it is a DirectX feature.

:? So no FFB on Linux I guess... I'll have to keep that in mind I guess.

Grendelus
02-01-2007, 11:37 AM
I believe there were headers for linux somewhere. FFB exists for linux, it just does not use directInput.

Man, I still can't believe how hard it is to implement Force Feedback into my game by making a dll with Delphi. If you search for C++ tutorials, you'll find anything but nothing for Delphi! That's obsurd.

WILL
02-01-2007, 03:48 PM
I use OpenGL and SDL for my games and I plan on porting to Linux/Mac OS X so DirectInput is out of the question for me.

Though I can see 1 or 2 games which would make FFB neat to add to. (With the option to turn it off of course as some may not like it.)

But if there is not a non-DirectX solution then I'll just have to forget about it. :P

Grendelus
04-01-2007, 01:24 PM
But if there is not a non-DirectX solution then I'll just have to forget about it.

:) Why?


I just figured out that joystick and gamepad force feedback handlings are different? :shock:

In DelphiX there is a Dinput component which has a list for importing .ffe (force feedback effect files). I tried to import a ffe which worked with the trial dll I used and threw out an invalid stream error! Is it because DelphiX FFB is meant only for Joysticks and not gamepads!? :shock: :shock:

WILL
04-01-2007, 03:03 PM
But if there is not a non-DirectX solution then I'll just have to forget about it.

:) Why?

Well...

I use OpenGL and SDL for my games and I plan on porting to Linux/Mac OS X so DirectInput is out of the question for me.
...I think that about sums it up. :P

As nice as FFB is (Joystick or gamepad, which in it's self is an interesting issue), I'd much prefer to make my game than spend all that time just making the gamepad/joystick vibrate. :? So unless it's readily available for me to use as a cross-platform library, I'll likely not be seeking it out.


But more on topic with your discussion; I think the main reason for Joystick and Gamepad FFB being so different is that with a joystick you can simulate flying a real plane or firing a gun where there is either mechanical forces or kickback based on the simulated device you are controlling. Where as with a gamepad, the simulation is somewhat lessened and you're focusing more on max control functioning than simulation.

So in short, my theory is that the two types of controllers have a different branch in function so different usage of FFB.

chronozphere
04-01-2007, 04:40 PM
In DelphiX there is a Dinput component which has a list for importing .ffe (force feedback effect files). I tried to import a ffe which worked with the trial dll I used and threw out an invalid stream error! Is it because DelphiX FFB is meant only for Joysticks and not gamepads!? Shocked Shocked

I doubt it... i own a speedlink gamepad and i can have tested it with delphix. As far as i can remember, it worked :? :)

Grendelus
07-01-2007, 12:30 PM
chronozphere do you happen to have an .ffe file that worked with DelphiX?

chronozphere
07-01-2007, 02:07 PM
The directX SDK contains a force feedback editor which works for me. :)

I couldn't get the Delphix condition example working but the Machinegun example DID work :lol:
The delphix-effect-editor did work but does not alway's work :? Don't know why.

Grendelus
07-01-2007, 06:29 PM
DelphiX editor does not work for me.

I can't find the fedit.exe in my sdk. Can you please upload a ffe file that works for you?

chronozphere
07-01-2007, 06:56 PM
Just tested... and it seems that all the FFE files that came with DelphiX worked :lol:

At the moment i dont have time to upload it.... you probably allready have the files that work for me (just the delphix sample FFE's). :)

This might be a local problem with your PC.
Does your gamepad work with other games/apps who have FFB?? please try to find that out.

If i'm ready to code the input-module for my engine.. i'll give you some FFB sources which work for me, if i can make it work. :razz:

Grendelus
09-01-2007, 02:14 PM
Okay thanks. :D

I have a Thrustmaster DT Rumble.

I have tested it with games like Silent Hill 2,3,4, Sonic Adventure DX and all epsxe games that support vibration and it works.

Grendelus
21-04-2007, 06:57 PM
People take a look at this:

http://www.savefile.com/files/661023

This is a freeware dll made in C++ which will allow for force feedback (source included) but I don't know how to use it.

Can anybody help and provide some info on its arguments and stuff?

chronozphere
21-04-2007, 09:43 PM
I have downloaded the files and the zip contains a DLL, some simple readme file and some C++ example files.

1 >>I suggest you download dependancy walker (http://www.dependencywalker.com/).
This will give you more info about the exported functions and the DLL dependancies.

2 >> Check out the C++ files and try to translate them to pascal.
Most likely, These will contain a lot of info on how to use the LIB.
I quickly looked at BB_DInput.cpp and i think it can be translated to pascal.

Ask more specific questions when you get stuck while translating.
(Translating code is not my specialty, so i dont think i can help you with that, but i'm sure others will :) )

Good luck ;)

Grendelus
22-04-2007, 04:55 PM
dang, the link doesn't work... :(

EDIT: I found it: http://dependencywalker.com/

M109uk
24-04-2007, 04:34 PM
Im not sure if it will help much, but i know of 2 projects that use force feedback in linux (the source is in C++), also i have heard that SDL has force feedback support.

the projects are:
VDrift: http://vdrift.net
and
VegaStrike http://vegastrike.sourceforge.net

WILL
24-04-2007, 06:19 PM
, also i have heard that SDL has force feedback support.

It does? Well... I guess I need to nudge Dom about that one. *ahem*--hint--*ahem* :D

gintasdx
18-02-2011, 09:44 PM
Hmm,if still somebody needs a Force Feedback library for Windows you can download XFFD (http://rabiuls.wordpress.com/2010/03/16/xffd-force-feedback-dll-1-0/)
Delphi and Visual Basic demos are includes plus tool to make Force Feedback (aka Vibration) effects.

I am sure this works with Lazarus too :)

seiferalmasy
11-08-2011, 08:00 AM
Hmm,if still somebody needs a Force Feedback library for Windows you can download XFFD (http://rabiuls.wordpress.com/2010/03/16/xffd-force-feedback-dll-1-0/)
Delphi and Visual Basic demos are includes plus tool to make Force Feedback (aka Vibration) effects.

I am sure this works with Lazarus too :)

Thank you very much. A looong time ago I looked into this but was met with people who would not give me a demo or example. tried to explain I am not good enough to translate C++ into pascal or even program it myself but they were an ass. Thank you!