MX Bikes Official Forum

Mods => Plugins => Topic started by: PiBoSo on April 21, 2014, 11:35:40 PM

Title: Output Plugins
Post by: PiBoSo on April 21, 2014, 11:35:40 PM

It is possible to write a DLL that receives data from the simulated bike in realtime.

Example source code can be downloaded at http://www.mx-bikes.com/?page=downloads

Please note that all function calls are blocking, so control should be returned to simulation as soon as possible to avoid framerate issues.

The DLL must be compiled for 64 bit.

The plugin must have the file extension renamed to DLO and it must be copied to the "plugins" directory in MX Bikes installation folder.

NOTE: a license is not needed to add plugins.
Title: Re: Output Plugins
Post by: PiBoSo on September 04, 2014, 12:05:27 AM

Plugins interface updated.
Title: Re: Output Plugins
Post by: PiBoSo on September 17, 2014, 02:50:01 PM

Example source code updated to add info about track centerline data.
Title: Re: Output Plugins
Post by: Ruubs on September 17, 2014, 07:37:33 PM
Thanks for this Piboso.

For some reason I can't download the input_int.c file though. When I click on the link on the downloads page I get an error that the page couldn't be found, and when I try to save it, it tells me that there isn't any file to save.
Title: Re: Output Plugins
Post by: PiBoSo on September 17, 2014, 08:55:49 PM
Quote from: Sandbiter on September 17, 2014, 07:37:33 PM
Thanks for this Piboso.

For some reason I can't download the input_int.c file though. When I click on the link on the downloads page I get an error that the page couldn't be found, and when I try to save it, it tells me that there isn't any file to save.

Input plugin example uploaded. Thank you for the report.
Title: Re: Output Plugins
Post by: PiBoSo on February 29, 2016, 07:18:16 PM

Example source code updated to the latest interface.
Title: Re: Output Plugins
Post by: PiBoSo on December 22, 2016, 09:37:29 AM

Example source code updated to the latest interface.
Title: Re: Output Plugins
Post by: PiBoSo on March 15, 2017, 11:00:01 PM

Example source code updated to the latest interface.
Title: Re: Output Plugins
Post by: HornetMaX on March 16, 2017, 07:39:20 PM
Hmmm ... GetModDataVersion() still returning 4 ?
Title: Re: Output Plugins
Post by: PiBoSo on March 16, 2017, 08:51:24 PM

Thank you for the report.
Updated again.
Title: Re: Output Plugins
Post by: Azazel on April 19, 2018, 08:23:49 AM
Hi everyone,

I need to know when the wheels are in the air.
I searched in the plugin, but i don't found this information.
Is it possible to add this on the next version?

Thanks
Title: Re: Output Plugins
Post by: PiBoSo on June 14, 2018, 10:12:27 PM
Quote from: Azazel on April 19, 2018, 08:23:49 AM
Hi everyone,

I need to know when the wheels are in the air.
I searched in the plugin, but i don't found this information.
Is it possible to add this on the next version?

Thanks

Example source code updated to the latest interface.
Title: Re: Output Plugins
Post by: PiBoSo on June 14, 2018, 10:30:50 PM

Please note that, starting with Beta8, output plugins must be compiled for 64 bit.
Title: Re: Output Plugins
Post by: HornetMaX on June 15, 2018, 01:28:01 AM
Just compiled my MaxHUD for MXB x64: took me 2 hours to wrestle with Visual Studio configurations and platforms  ::)  ::)  ::) but code compiled fine without any change (*) and it runs just fine. Woot !!

(*) Well, of curse I have a bunch of size_t --> int warnings, no biggie.
Title: Re: Output Plugins
Post by: PiBoSo on August 29, 2018, 01:59:44 PM

Example source code updated to the latest interface.
Title: Re: Output Plugins
Post by: HornetMaX on September 05, 2018, 09:36:36 AM
Quote from: PiBoSo on August 29, 2018, 01:59:44 PM

Example source code updated to the latest interface.
Minor: many fields (e.g. m_iSession, m_iSessionState, m_iReason)  lack the comment/descritpion in many race structures.
For some is no biggie, as the field is described elsewhere, others I just take them from GPB :)


Title: Re: Output Plugins
Post by: PiBoSo on September 05, 2018, 10:04:36 AM

Thank you for the report.
Title: Re: Output Plugins
Post by: HornetMaX on September 06, 2018, 01:06:50 AM
Another quirk I just noticed: in MXB m_iSessionNumLaps in SPluginsRaceSession_t dopesn't seem to be set, it's always zero.
Seems to work fine in GPB however.
Title: Re: Output Plugins
Post by: PiBoSo on September 08, 2018, 11:31:13 AM
Quote from: HornetMaX on September 06, 2018, 01:06:50 AM
Another quirk I just noticed: in MXB m_iSessionNumLaps in SPluginsRaceSession_t dopesn't seem to be set, it's always zero.
Seems to work fine in GPB however.

Thank you for the report.
The fix will be integrated in the next update.
Title: Re: Output Plugins
Post by: PiBoSo on September 09, 2018, 05:02:13 PM

Example source code updated to add more structure members descriptions.
Title: Re: Output Plugins
Post by: PiBoSo on February 15, 2019, 04:26:06 PM

Example source code updated with the latest structure members descriptions.
Title: Re: Output Plugins
Post by: PiBoSo on October 19, 2019, 06:15:42 PM

Example source code updated with the latest structure members descriptions, to add straight rhythm info.
Title: Re: Output Plugins
Post by: HornetMaX on January 13, 2020, 10:59:13 PM
One small request: could you document what exactly is in the argument _pRaceData of TrackCenterline ?

__declspec(dllexport) void TrackCenterline(int _iNumSegments,SPluginsTrackSegment_t *_pasSegment,void *_pRaceData)
My understanding is that you have some floats indicating the position along the centerline of the start/finish line, then the split points and the speed trap.

Is it correct to assume (as not documented) that:
Title: Re: Output Plugins
Post by: PiBoSo on January 14, 2020, 06:58:18 PM

The "_pRaceData" input is briefly documented in the TrackCenterline function comment:
"_pRaceData is a pointer to a float array with the longitudinal position of the start / finish line and splits."

There indeed are two split lines, with the only exception being GP Bikes with three.
Therefore, in the case of MX Bikes, "_pRaceData" is a pointer to an array of three float values.

Example source code updated to remove an incorrect reference to a "speed trap" line.
Title: Re: Output Plugins
Post by: Yirka63 on January 17, 2022, 12:25:48 PM
Hi,

I would like to gather output data (speed) and convert it to signal. It would be than used to make "force feedback" for my MXB simulator.

Is here anyone willing to help me write DLL so I can collect this speed data and send it to USB port and to Arduino? 
Title: Re: Output Plugins
Post by: PiBoSo on February 02, 2022, 02:42:31 PM
Example source code updated to the latest interface.

- Added the brakes pressure to SPluginsBikeData_t
- Added the holeshot line longitudinal position ( -1 if missing ) to the "_pRaceData" parameter of the TrackCenterline function
Title: Re: Output Plugins
Post by: TomasTheCreator on January 17, 2023, 01:41:27 PM
I´m using the plugin and it works flawlessly, but are there a way to read if the bike is in the air or not? @piboso
Title: Re: Output Plugins
Post by: PiBoSo on January 18, 2023, 01:29:36 PM
Quote from: TomasTheCreator on January 17, 2023, 01:41:27 PMI´m using the plugin and it works flawlessly, but are there a way to read if the bike is in the air or not? @piboso

At the moment there is no dedicated value to read.
A potential solution might be to check if both suspensions are completely extended.
Title: Re: Output Plugins
Post by: MxWayGamer on January 18, 2023, 05:40:07 PM
Is it possible to add a function to know if the player is in solo game or online ? And get the server port if it's online
Title: Re: Output Plugins
Post by: TomasTheCreator on January 19, 2023, 08:07:35 AM
Quote from: PiBoSo on January 18, 2023, 01:29:36 PM
Quote from: TomasTheCreator on January 17, 2023, 01:41:27 PMI´m using the plugin and it works flawlessly, but are there a way to read if the bike is in the air or not? @piboso

At the moment there is no dedicated value to read.
A potential solution might be to check if both suspensions are completely extended.

Aah I haven´t thought of that, but of course that should do the trick. Thank you for the answer  :D
Title: Re: Output Plugins
Post by: PiBoSo on December 22, 2023, 11:34:09 PM
Example source code updated to add a couple functions to control the replay / live riders and cameras selection.