Author Topic: Trying to understand how plugin works  (Read 200 times)

Gurchur

  • Newbie
  • *
  • Posts: 4
    • View Profile
Trying to understand how plugin works
« on: July 12, 2018, 07:03:37 PM »
Hi everyone!! I am new in the forum and a new user of GPB.

I am doing a simulator of 3 axis but before knowing that GPB exists I only has in mind to create the analog signals from the encoders and sensors and make a bypass thow a joystick to control MotoGP. Now that I played GPB, the new potencial is huge and I woul like to get the data from the simulator to a program to control the motors.

The problem is that I do not understand well how comunicate with the .dll I created using the GPB_example.c

This is what I have done for the moment:

    1) I just created the .dll using labview CVI (is very similar to visual studio) using the GPB_example.c and creating a new .h with all the function names (but removing the "_declspec(dllexport)" .With both files I could create the .dll, copy it in the PlugIn folder of GPB and renamed as .DLO.
       When I go to the track the game suddenlly exit then I expect I am missing something (or all!! :).

       Regarding the custom program I need to do to get the data,  do I just make calls to the functions of the .dll or how I do that??, I really do not understand it, if anyone has any example of a program communicating continueslly with the GPB in .C and getting for example the spped of the bike would be a huge help and I believe I could start.

Many thanks for your help!!!





speedfr

  • Sr. Member
  • ****
  • Posts: 327
  • Partir, c'est pourrir un pneu !
    • View Profile
Re: Trying to understand how plugin works
« Reply #1 on: July 12, 2018, 09:26:04 PM »
Hello,

this kind of question is either for h106frp (who did the exact same process for catching FFB) and/or HornetMax who is the author of MaxHUD (overlay ingame) and MaxTM (telemetry).

Keep up  !!
Missing Gp500 (Microprose)

Testing EDTracker Pro on YT

i7-4790K/16Go/GTX1070/1440p/Full WC

Gurchur

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Trying to understand how plugin works
« Reply #2 on: July 13, 2018, 06:50:25 AM »
Many thanks Speedfr, I hope they (the master programmers  8) 8))  read the post and guide me a little  ;D


HornetMaX

  • Hero Member
  • *****
  • Posts: 5864
    • View Profile
Re: Trying to understand how plugin works
« Reply #3 on: July 13, 2018, 09:33:07 AM »
Why are you removing the "_declspec(dllexport)" ? Without that I'm not sure the .dll will be correctly built.

I'm not familiar with the compiler you are using, it may have a different syntax to declare the function to export, but you'll have to do this one way or the other.
I use Visual Studio.

Also, assuming you want to send GPB output values (e.g. bike lean and pitch) to your external device, I'd probably think about using the proxy approach (proxy.dlo writes to a memory area and your external program can read from that from outside GPB, not from "inside" as with an output plugin).

Maybe h106frp can be of more help on this.

h106frp

  • Hero Member
  • *****
  • Posts: 1802
    • View Profile
Re: Trying to understand how plugin works
« Reply #4 on: July 13, 2018, 09:57:49 AM »
I built my interface using the Proxy dlo.
The compiled proxy.dlo (I used codeblocks C for this) returns a handle to the shared memory area that you have created and I then used Visual Studio C++ to read from the shared memory space and manipulate the values before I sent them to my device

HornetMaX

  • Hero Member
  • *****
  • Posts: 5864
    • View Profile
Re: Trying to understand how plugin works
« Reply #5 on: July 13, 2018, 10:03:52 AM »
I built my interface using the Proxy dlo.
The compiled proxy.dlo (I used codeblocks C for this) returns a handle to the shared memory area that you have created and I then used Visual Studio C++ to read from the shared memory space and manipulate the values before I sent them to my device
Curiosity: why do you need to compile proxy.dlo ? It comes with GPB no ?

Gurchur

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Trying to understand how plugin works
« Reply #6 on: July 13, 2018, 11:47:11 AM »
Many thanks!!! for your answers.

I will use the proxy example as I did not know that in the other way was internal. I will try this afternoon checking the handle to the memory area. I will feedback you very soon.

Again +1000!!  ;D ;D

HornetMaX

  • Hero Member
  • *****
  • Posts: 5864
    • View Profile
Re: Trying to understand how plugin works
« Reply #7 on: July 13, 2018, 11:48:35 AM »
Last comment: if your device needs to send signals to GPB, you may have to look at an input plugin too.

h106frp

  • Hero Member
  • *****
  • Posts: 1802
    • View Profile
Re: Trying to understand how plugin works
« Reply #8 on: July 13, 2018, 01:27:17 PM »
I built my interface using the Proxy dlo.
The compiled proxy.dlo (I used codeblocks C for this) returns a handle to the shared memory area that you have created and I then used Visual Studio C++ to read from the shared memory space and manipulate the values before I sent them to my device
Curiosity: why do you need to compile proxy.dlo ? It comes with GPB no ?

I guess I just wanted to be sure my data structures would agree and was not completely sure if the demo code was a direct example of the current proxy.dlo

It did not take long to do anyway.

HornetMaX

  • Hero Member
  • *****
  • Posts: 5864
    • View Profile
Re: Trying to understand how plugin works
« Reply #9 on: July 13, 2018, 01:34:29 PM »
I guess I just wanted to be sure my data structures would agree and was not completely sure if the demo code was a direct example of the current proxy.dlo
Had this doubt too but Pib confirmed the .dlo comes from the source code he publishes.
But why the different compiler ?


Gurchur

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Trying to understand how plugin works
« Reply #10 on: July 13, 2018, 04:02:40 PM »
I am trying to create the proxi dll but  "direct.h"  file is missing, do you know from where I can get it?

Many thanks!!

HornetMaX

  • Hero Member
  • *****
  • Posts: 5864
    • View Profile
Re: Trying to understand how plugin works
« Reply #11 on: July 13, 2018, 05:07:36 PM »
I am trying to create the proxi dll but  "direct.h"  file is missing, do you know from where I can get it?

Many thanks!!
It's a windows/microsoft file. If your compiler does not provide it, it may use a different header for the very same functions. Google around.

h106frp

  • Hero Member
  • *****
  • Posts: 1802
    • View Profile
Re: Trying to understand how plugin works
« Reply #12 on: July 13, 2018, 08:11:50 PM »
I guess I just wanted to be sure my data structures would agree and was not completely sure if the demo code was a direct example of the current proxy.dlo
Had this doubt too but Pib confirmed the .dlo comes from the source code he publishes.
But why the different compiler ?

It was just very easy to build it in codeblocks  :)