Results 1 to 3 of 3

Thread: Should a forcefeedback effect play on creation?

  1. #1

    Should a forcefeedback effect play on creation?

    Hi,

    I'm struggling with FF for my XFX gamepad. It works but it's buggy. I'm using XP, Delphi 2006 and the latest October 2006 DX headers.

    Here's my effect creation code:

    [pascal] procedure CreateForceFeedbackEffect;
    var
    I:IDirectInputEffect;
    EIEFFECT;
    F:array[0..0] of DICONSTANTFORCE;
    A:array[0..0] of dword;
    D:array[0..0] of longint;
    H:HResult;
    begin
    F[0].lMagnitude:=5000;
    A[0]:=DIJOFS_X;
    D[0]:=0;
    ZeroMemory(@E,sizeof(E));
    with E do
    begin
    dwSize:=sizeof(DIEFFECT);
    dwFlags:=DIEFF_CARTESIAN or DIEFF_OBJECTOFFSETS;
    dwDuration:=INFINITE;
    dwSamplePeriod:=0;
    dwGain:=DI_FFNOMINALMAX;
    dwTriggerButton:=DIEB_NOTRIGGER;
    dwTriggerRepeatInterval:=0;
    cAxes:=3;
    rgdwAxes:=@A;
    rglDirection:=@D;
    lpEnvelope:=nil;
    cbTypeSpecificParams:=sizeof(F);
    lpvTypeSpecificParams:=@F;
    dwStartDelay:=0;
    end;
    if BlahBlah.CreateEffect(GUID_ConstantForce,@E,I,nil) =DI_OK then blah etc.[/pascal]


    The pad rumbles for 1 second when CreateEffect is processed. There are no error messages anywhere in my code (all results are checked). I'm sure it's not normal for it to play after creation. Any ideas?

    After creation I can use the Start command to start the infinite effect but Stop does nothing (even though it returns DI_OK). I have to use SendForceFeedbackCommand (DISFFC_STOPALL) to stop the rumble. Are these problems linked?

    Thanks for any advice - I pulling out what little hair I have!!!

  2. #2
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Should a forcefeedback effect play on creation?

    Hi mrpascal, welcome to PGD!

    I'm sorry, but I've no experience with Force Feedback myself, but I'm sure that there are a few here that may have worked with it previously. I'd like to ask you to let us know about your progress with it as it's not a topic that has not been covered too much here in the past.

    Also, I've edited your post to use our own unique Pascal code highlighting tags, please take advantage of these wonderful tags as it makes reading your code so much nicer than straight HTML.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  3. #3

    Should a forcefeedback effect play on creation?

    Hi Will,

    Thanks for formatting my code - it's much more readable now! I shall do that in the future as you suggest.

    As I mentioned I have found it really hard finding any info on FF in Delphi. There is quite a lot of C out there and I've been converting it but I may be making errors with pointers etc. I'm also confused by how FF is treated with a gamepad. I'm assuming FF was designed for a joystick to push the stick against the users pressure but how does it work in a gamepad? There are no directions or axis involved, just two motors which rumble with varying intensities. I'm hacking my way through using experiments but I'd love to find some real information on it.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •