How to get live data from Race07?

Hi all.

I've been googling for several days now, but come up with practically nothing.
sad.gif


I am currently working on a piece of software for Leo Bodnar's Sli-devices (to replace the "official" one) and trying to get support for Race07-series.
I am able to get live telemetry data (like Rpm, speed, and all that) but I cannot for the life of me, figure out how to get trackname, carname or other "session" related info.
The only "solution" I've come up with, is to monitor <Documents>\SimBin\ for filechanges, and then assume that the first changed plr-file is the current players plr-file (to get the trackname) and watching for changes to tempgarage.svm for getting the carname. I am doing this AFTER I confirm that Race07 is doing it's memory mapped file for the telemetry, so I'm thinking this approach is pretty bulletproof, but it just doesn't seem to be the "right" way of doing things...
sad.gif


Does anyone know if/how this info can be retrieved in a better way???
Please?
Pretty, pretty please?

/Lars
 
Oh, ok, I haven't got an email... or maybe gmail is acting up... :)

Anyways, I know practically nothing about pointer-gymnastics in VB, let alone Mem-mapped-files...
I am certain there are tons of examples out there, that you would understand better than me... :)
I posted the structure above, that describes what is in the shared memory that Race07 makes.

The name of the mem-map-file is "$race$" (without the quotes) as far as I rememer (the same structure is used for gtr2 if you're interested; for Gtr2 the name is "$gtr2$" as far as I remember)

Let me know if you still need some help...

Hi Lars,
I think you can help me a little here. I can now read the $Race$ file but only get some numbers witch I can't compare to Race 07. I used VB.net 2010 for it. Can you program in C# or C++ ?
Btw: my email is : henrik@nuhme.dk if you have some hints.
 
Oh, ok, I haven't got an email... or maybe gmail is acting up... :)

Anyways, I know practically nothing about pointer-gymnastics in VB, let alone Mem-mapped-files...
I am certain there are tons of examples out there, that you would understand better than me... :)
I posted the structure above, that describes what is in the shared memory that Race07 makes.

The name of the mem-map-file is "$race$" (without the quotes) as far as I rememer (the same structure is used for gtr2 if you're interested; for Gtr2 the name is "$gtr2$" as far as I remember)

Let me know if you still need some help...

Thank you very much Lars.
I send the mail to the email address you posted. Hmm... computers have their own life :)
The name of the MMF is just what I need. Thank's a lot.

Hi Lars, now I get some data from the MMF, but it's only a bunch of numbers and I don't know it's the correct data. Should their be text also or only numbers ? Are you able to program in C# ? Did you make an interface to collect data from Race 07 ? If yes is it possible to have the source code to learn from ?
 
Ok, C++ coming up :

First declare this struct somewhere :

Code:
struct racedata{
float userInput[ 6 ]; // This structure allows for a number of parameters to be
// passed from the user to the exteral application via control input
// in the game. The ISIInputType enum describes which element of this
// array corresponds to which in-game control. Note that this data
// is floating point, and can be configured in the game to be driven
// by an analog input device (joystick). The user may also map the
// control to a keyboard key, or a digital controller button. This
// means that the value may be anywhere between 0.0 and 1.0. Also note
// that these values will not be debounced; if the user
// maps the "External Signal Up" control to a key on the keyboard,
// the coresponding value in this array will remain 1.0 for as long
// as the user holds the key down.
 
float rpm; // Engine speed, Radians Per Second.
float maxEngineRPS; // For use with an "analog" rpm display.
float fuelPressure; // KPa
float fuel; // Current liters of fuel in the tank(s).
float fuelCapacityLiters; // Maximum capacity of fuel tank(s).
float engineWaterTemp; //
float engineOilTemp; //
float engineOilPressure; //
 
float carSpeed; // meters per second
long numberOfLaps; // # of laps in race, or -1 if player is not in
// race mode (player is in practice or test mode).
 
long completedLaps; // How many laps the player has completed. If this
// value is 6, the player is on his 7th lap. -1 = n/a
 
float lapTimeBest; // Seconds. -1.0 = none
float lapTimePrevious; // Seconds. -1.0 = none
float lapTimeCurrent; // Seconds. -1.0 = none
long position; // Current position. 1 = first place.
long numCars; // Number of cars (including the player) in the race.
long gear; // -2 = no data available, -1 = reverse, 0 = neutral,
// 1 = first gear... (valid range -1 to 7).
 
//float tireTemp[ TIRE_LOC_MAX ][ TREAD_LOC_MAX ]; // Temperature of three points
float tirefrontleft[3]; //tire values from [0]=left to [2]=right
float tirefrontright[3]; //tire values from [0]=left to [2]=right
float tirerearleft[3]; //tire values from [0]=left to [2]=right
float tirerearright[3]; //tire values from [0]=left to [2]=right
// across the tread of each tire.
long numPenalties; // Number of penalties pending for the player.
 
float carCGLoc[3]; // Physical location of car's Center of Gravity in world space, X,Y,Z... Y=up.
//float carOri[ ORI_MAXIMUM ]; // Pitch, Yaw, Roll. Electronic compass, perhaps?
float pitch;
float yaw;
float roll;
//float localAcceleration[3]; // Acceleration in three axes (X, Y, Z) of car body (divide by
// 9.81 to get G-force). From car center, +X=left, +Y=up, +Z=back.
float lateral; //Force left-right
float vertical; //force up-down
float longitudinal; //force faster, slower
};

Next make sure you have a variable of this struct-type (let's call it Foo, for the sake of the example).
All you have to do is this :

memcpy(Foo, YourMemMapFile, sizeof(racedata));

You have to do this everytime you need the data refreshed.

...but then you will have data readily available, like
Foo.carspeed
etc...

The way I've done it, is a little bit different.
I have made myself a "map" of the data in that mem-file, where I have a list of names and their offset into that mem-file, and whenever I want data I look it up directly in the mem-file.
This is by no means smarter, faster or better than the above (not worse either) but it just fits my apps logic better...

Hope this helps... :)

/Lars
 
Hi Lars,
Thank you again. I am realy glad for your help. Now I have (I think) just a small problem left to finally succeed. I am getting an error message from C++

1 error C2664: 'memcpy' : cannot convert parameter 1 from 'main::racedata' to 'void *' c:\users\henrik\documents\visual studio 2010\projects\c++\mmf3lars\mmf3lars\mmf3lars.cpp 79 1 MMF3Lars

2 IntelliSense: no suitable conversion function from "racedata" to "void *" exists c:\users\henrik\documents\visual studio 2010\projects\c++\mmf3lars\mmf3lars\mmf3lars.cpp 79 9 MMF3Lars

My code:
Code:
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <conio.h>
 
using namespace std;
void main()
{
 
    struct racedata{
 
        float userInput[ 6 ]; // This structure allows for a number of parameters to be
        // passed from the user to the exteral application via control input
        // in the game. The ISIInputType enum describes which element of this
        // array corresponds to which in-game control. Note that this data
        // is floating point, and can be configured in the game to be driven
        // by an analog input device (joystick). The user may also map the
        // control to a keyboard key, or a digital controller button. This
        // means that the value may be anywhere between 0.0 and 1.0. Also note
        // that these values will not be debounced; if the user
        // maps the "External Signal Up" control to a key on the keyboard,
        // the coresponding value in this array will remain 1.0 for as long
        // as the user holds the key down.
 
        float rpm; // Engine speed, Radians Per Second.
        float maxEngineRPS; // For use with an "analog" rpm displ
------- ====== -----
 
    struct racedata Race07Data;
 
    memcpy(Race07Data, "$Race$", sizeof(racedata));
 
    //Race07Data.gear = 2;
    //Race07Data.fuel = 1;
    cout << Race07Data.fuel << endl;
    cout << Race07Data.gear << endl;
    _getch();
    //return 0;
 
Hi Everyone,
I know that this thread is pretty old, but I really need some help...
I am writing a program to get telemetry info from Simbin games. I'm reading data from MMF ($Race$ and $gtr2$), but I'm only able to get data using the structure posted by Lars. I need to get scoring and standing drivers info, similar to Real Time Telemetry tool.
Did you guys manage to get this kind of data?

Thanks a lot.
 
Last edited:
Rather ancient topic and it might not be of much help, but I reckon since I got the original data structure from here, I should share how to quickly get R07's shared memory using .NET:

Code:
Imports System.IO.MemoryMappedFiles

Public Class Something

    Private Function GetCurrentData() As R07Mmf
        Dim myMmf As MemoryMappedFile = MemoryMappedFile.OpenExisting("$Race$")
        Dim myAcc As MemoryMappedViewAccessor = myMmf.CreateViewAccessor()

        Dim myResult As R07Mmf
        myAcc.Read(Of R07Mmf)(0, myResult)

        myAcc.Dispose()
        myMmf.Dispose()

        Return myResult
    End Function

    Private Structure R07Mmf
        Public userInput1 As Single
        Public userInput2 As Single
        Public userInput3 As Single
        Public userInput4 As Single
        Public userInput5 As Single
        Public userInput6 As Single
        Public rpm As Single
        Public maxEngineRPS As Single
        Public fuelPressure As Single
        Public fuel As Single
        Public fuelCapacityLiters As Single
        Public engineWaterTemp As Single
        Public engineOilTemp As Single
        Public engineOilPressure As Single
        Public carSpeed As Single
        Public numberOfLaps As Integer
        Public completedLaps As Integer
        Public lapTimeBest As Single
        Public lapTimePrevious As Single
        Public lapTimeCurrent As Single
        Public position As Integer
        Public numCars As Integer
        Public gear As Integer
        Public tirefrontleft1 As Single
        Public tirefrontleft2 As Single
        Public tirefrontleft3 As Single
        Public tirefrontright1 As Single
        Public tirefrontright2 As Single
        Public tirefrontright3 As Single
        Public tirerearleft1 As Single
        Public tirerearleft2 As Single
        Public tirerearleft3 As Single
        Public tirerearright1 As Single
        Public tirerearright2 As Single
        Public tirerearright3 As Single
        Public numPenalties As Integer
        Public carCGLocX As Single
        Public carCGLocY As Single
        Public carCGLocZ As Single
        Public pitch As Single
        Public yaw As Single
        Public roll As Single
        Public lateral As Single
        Public vertical As Single
        Public longitudinal As Single
    End Structure
 

Latest News

Are you buying car setups?

  • Yes

  • No


Results are only viewable after voting.
Back
Top