Plugin info?

DimebagDK

Hi all...

I am working on an alternative to the "official" software for Leo Bodnar's Sli-devices, and I am starting to look at supporting rFactor 1&2.

This raises a couple of questions :

Does rFactor have some kind of "direct-access" API, like a memory-mapped file, or do I need to use a plugin for that?

If I need to use a plugin, is there already one freely available that I can use???
It would be an optimal solution, if a plugin that tried and tested, stable and fast, is already available... :)
I tried googling, but honestly there's just too much "crappy" information in the search results nowadays, so I got somewhat lost and didn't find an answer...

Regards
Lars
 
Ok, then... :D
I started writing my own plugin, but would like a little more documentation, which I can't seem to find...

A simple question that I haven't found a definate answer to, for example, is whether or not I'm guaranteed that VehicleInfo zero is always me???
:-D
 
No, you're not. You'll find a .mIsPlayer (or similar) value that is true when it's the player. Usually. I recall having some issues at the very start of the session when remote cars were involved but I can't remember the details...
 
Sorry, just found some of my code relating to that... keep in mind that UpdateScoring (and UpdateTelemetry) are being called when you're sitting at the monitor. I think I found I was getting incorrect info from .mIsPlayer when I wasn't in realtime - so I checked for that first via EnterRealtime() before doing the vehicle stuff. I still have a feeling the issue was at the start of a session though, before the player list was properly populated.
 
Ooooohhhh, I assumed the "IsPlayer" bit was just indicating if this car was controlled by a player, or the AI or something else?
 
Ok, then... :D
I started writing my own plugin, but would like a little more documentation, which I can't seem to find...

A simple question that I haven't found a definate answer to, for example, is whether or not I'm guaranteed that VehicleInfo zero is always me???
:-D

There isn't much documentation outside of the comments in the sample plugin and searching here on the forum. Lazza, me and a few others try to help out with anyone working on plugins though. It looks like Lazza already got you headed in the right direction.
 
Yeah, thanks guys!
I'm a little rusty in my C++ skills (haven't used it in 10 years or so), but I have a plugin running now.
Next up is getting data stuffed into a memory mapped file for my app to pick up... :)

Btw, I downloaded Visual Studio Express 2010 for this.
Is that free, or is that a 30 day trial???
...I can't seem to figure that out...
 
Speaking of VS. I upgraded to VS2012. Man what a performance improvement it made. The problem is the C++ compiler will not build dlls or exes that will run on XP. So if anyone else out there opens an old plugin project in VS2012, be sure to tell it not to upgrade to the new compiler or else your plugin will only run on Vista and above. It is a pain in the butt though because I have to have both 2010 and 2012 installed to be able to build stuff for XP.
 
Noel that is not true anymore (it was when VS2012 released). Microsoft released VS2012 Update 1 that includes Windows XP Targeting (you can build exes that run on WinXP but you still can't install VS2012 on WinXP).

See here for info on this matter:
http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx

Oh wow!!! Thanks for the heads up! I already have the update but never read the release notes so I didn't realize they changed this.

Edit: I just uninstalled VS2010 and then changed my target in VS2012 to v110_xp and recompiled my plugins and then tested them on XP and it works perfect. It is nice to not need to hold on to VS2010 anymore.
 
Last edited:
Ok, guys, I think I'm mentally handicapped or something... :)

I'm trying to figure out how to calculate a CurrentLapTime precisely, that updates more than twice per second (basically I need it every frame)

By taking the CurrentET from the scoringinfo, and subtracting the LapStartET from the telemetry gets me a good value, but this only updates twice per second.
I have no way of "synchronizing" the UpdateTelemetry and the UpdateScoring, so I can't just store a local copy of CurrentET and increment it with DeltaTimeET for every frame.
I may be over-thinking this, and simply not seeing the simple solution (I'm known to do this) :-D

/Lars
 
I don't think the telemetry data can do it immediately (there's no values you can subtract from each other to produce a current lap time).

However, you'll see the example code maintains a mET var within updateHardware, and you can do the same using the teleminfo.mDeltaTime to add the elapsed time of each updatetelem call together. I presume (haven't tested) the info.mLapNumber will update on the correct telemetry frame, so you can zero your counter when you see the lap count change and then keep that counter running for a quite accurate laptime. (most systems will keep rF1 telemetry running at 90Hz, and the actual laptime will change sometime during the delay before the updateTelemetry() you detect it, so I'd imagine your laptime figure will be somewhere within 1/90th of a second with some small potential error due to rounding - probably not significant for most laptime totals.)

You could then check the scoring info for the local car to check if it's in the pits, if you need to know that (so you'll have up to half a second delay before knowing, but I'd imagine that would be ok).

*Sorry, only half read your post... so you already know about adding the delta time, just use the lap counter as a cue to reset it
 
Thanks Lazza.

Turns out I'm not completely lost then... :)
I figured that way was about the way to go, but as I said, I have a tendency to overlook the obvious sometimes... :)
 
I know the feeling :)

For what it's worth rF2 provides .mElapsedTime, so the current lap time can be calculated directly...
 

Back
Top