Results 1 to 2 of 2

Thread: Troubles with reading force effects files in delphi 7

  1. #1

    Troubles with reading force effects files in delphi 7

    Hello - im new to these boards ... and they have already helped me alot - but now i have encountered a problem i need help with.

    I have made two simple constant force effects with the FEdit from the Microsoft directx9 SDK (only one effect in each file). I have installed the newest (JEDI) headers.

    I wrap my effects in a wrapperclass :
    Code:
      TEffectWrapper = class
        FFilename   : String;
        pEffect     : IDIRECTINPUTEFFECT;
        pFileEffect : PDIFileEffect;
      public
        constructor Create(fname : String);
        destructor Destroy; override;
      end;
    
    constructor TEffectWrapper.Create(fname : string);
    begin
      inherited Create;
      FFilename := fname;
    end;
    
    destructor TEffectWrapper.Destroy;
    begin
      SAFE_RELEASE(pEffect);
      inherited Destroy;
    end;
    The Callback function is here (joyforce is the instance of the joystick)
    Code:
    function EnumEffectsInFileCallback(pDIFileEffect : DIFILEEFFECT; pContext : pointer) : LongBool; stdcall;
    var
      hr : HRESULT;
      EffectInstance : TEffectWrapper;
    begin
      EffectInstance := TEffectWrapper.Create(FileName);
      EffectInstance.pFileEffect := @pDIFileEffect;
    
      hr := JoyForce.g_pDevice.CreateEffect(EffectInstance.pFileEffect.GuidEffect, EffectInstance.pFileEffect.lpDiEffect, EffectInstance.pEffect, nil);
      if FAILED(hr) then
        JoyForce.ErrorCheck(hr);
    
      JoyForce.EffectList.AddObject(ForceName, EffectInstance);
      result := DIENUM_CONTINUE;
    end;
    But when i DEBUG in delphi EffectInstance.pFileEffect.lpDiEffect is nil.... ?? but the variable EffectInstance.pFileEffect.szFriendlyName contains alot of information ?

    And my local procedure for reading effects are here ....
    Code:
    procedure TJoyForce.LoadEffects;
    var
      hr : HRESULT;
    begin
    
      // first force im trying to read ....
      FileName   := 'C:\WidexSrc\DivaCompetion\terrain\LWC.ffe';
      hr := g_pDevice.EnumEffectsInFile(PAnsiChar(FileName), @EnumEffectsInFileCallback, nil, DIFEF_DEFAULT);
    
      if FAILED(hr) then
        ErrorCheck(hr);
    
      // second force im trying to read ....
    
      FileName := 'C:\WidexSrc\DivaCompetion\terrain\RWC.ffe';
      hr := g_pDevice.EnumEffectsInFile(PAnsiChar(FileName), @EnumEffectsInFileCallback, nil, DIFEF_MODIFYIFNEEDED);
      if FAILED(hr) then
        ErrorCheck(hr);
    end;
    and here is the situation: i read the files and enter the the callback function.

    At run time i have binded the joystick buttons the the different forces i have loaded, but when they are activated i get this error (not suprisingly since the effect isn't created probably):
    DIERR_INCOMPLETEEFFECT : The effect could not be downloaded because essential information is missing. For example, no axes have been associated with the effect, or no type-specific information has been supplied

    Anyone can help me ?

    And i creating the effect wrong with the device.createeffect ?

    Thx.

  2. #2

    Troubles with reading force effects files in delphi 7

    http://berry.cpe.mut.ac.th/~comclub/FF.exe
    download this file it contain my source and exe file for force feedback support
    sorry for my bad english
    www.SIAMTIP.COM

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
  •