Results 1 to 6 of 6

Thread: Shared Data returns wrong Data

  1. #1
    Kart Driver
    Join Date
    May 2015
    Posts
    12
    Platform
    PC

    Shared Data returns wrong Data

    Hi,

    I use the shared data to show some informations with my arduino.
    Some functions, like read the flagcolours, the carflags and the current gear works fine, but most of the other functions doesn't work, like fuil, rpm, etc.
    The returned data looks like this: -0104554351 or 1251215341

    I have this problem even with the example.

    I allready checked the pCars files.

  2. #2
    WMD Member MikeyTT's Avatar
    Join Date
    Jul 2012
    Location
    Crewe, UK
    Posts
    819
    Platform
    PC
    What's the programming language you are using to read the data from the API?

    If your data types are off in any way that's the likely cause of the odd looking data.
    Processor: Intel i7-4790 @ 3.6GHz Mainboard: Asus Maximus VI Memory: 32GB DDR3 Videocard: MSI 980ti Motherboard Sound/Headphones: Creative SB Z + M/B Sound for SimVibe / Onkyo 5.1 Surround + Astro A50 Headphones Monitors: 3 x Asus 27" VN279H PSU: OCZ ZX1250W Keyboard+Mouse: Corsair Gaming K70 RBG / Logitech G700 Mouse Gamepad/Wheel: Fanatec CSWv2 + BMW Rim, Fanatex CSPv2, Fanatec CS Shifter SQ v1.5 OS: Win7 Ult x64 Storage: 256GB SSD + 3TB HDD
    Resolution: 5040x1080@60Hz Texture Res: High Texture Filter: 4x V-Sync: No AA: MSAA4x FXAA & SMAA: Off Reflections: Low Vehicle Detail: Ultra World Detail: High Shadow Detail: Low Motion Blur: None
    My vrHive Telemetry and Dash App (PC/PS4/XB1) - Forum Page: http://forum.projectcarsgame.com/sho...nt-Server-more
    My vrHive Telemetry and Dash App (PC/PS4/XB1) - Web Site: www.vrhive.co.uk
    My YouTube Channel: http://www.youtube.com/user/TR7V8Mike?feature=mhee
    My Twitch Channel: http://www.twitch.tv/mikeytt

  3. #3
    Kart Driver
    Join Date
    May 2015
    Posts
    12
    Platform
    PC
    Oh sorry, i am using C++

    I don't know what you mean with data types off.

    I am reading this way:

    HANDLE fileHandle;
    do
    {
    fileHandle = OpenFileMapping( PAGE_READONLY, FALSE, MAP_OBJECT_NAME );
    printf( "Could not open file mapping object (%d).\nPlease start Project Cars", GetLastError() );
    system("cls");
    }while (fileHandle == NULL);

    // Get the data structure
    const SharedMemory* sharedData = (SharedMemory*)MapViewOfFile( fileHandle, PAGE_READONLY, 0, 0, sizeof(SharedMemory) );
    while (sharedData == NULL)
    {
    printf( "Could not map view of file (%d).\n", GetLastError() );

    CloseHandle( fileHandle );
    system("cls");
    }

    // Ensure we're sync'd to the correct data version
    if ( sharedData->mVersion != SHARED_MEMORY_VERSION )
    {
    printf( "Data version mismatch\n");
    system("cls");
    }

    printf( "RPM: (%d)\n", sharedData->mRpm);
    (I don't know whether it is correct, because this is not the whole script)
    Last edited by Paceman; 24-10-2015 at 15:42.

  4. #4
    Rookie
    Join Date
    May 2015
    Posts
    2
    Platform
    PC
    Change %d in the printf statement to %f, in short %d represents an int. mRpm in the SharedMemory struct is a float value.
    The following user likes this Post: Paceman


  5. #5
    WMD Member MikeyTT's Avatar
    Join Date
    Jul 2012
    Location
    Crewe, UK
    Posts
    819
    Platform
    PC
    Quote Originally Posted by Paceman View Post
    Oh sorry, i am using C++

    I don't know what you mean with data types off.
    By "off" I meant if you're data types don't 100% match what the API is producing. In the C# world there were some gotchas around the size of bools if I recall that would then make the data past this point look to be rubbish.

    I presume you are using, or are heavily referencing the test app that was produced by SMS (http://forum.projectcarsgame.com/sho...ake-my-own-app). In theory that should give you everything you need to get up and running in the C++ world.

    Can't help much more than that, sorry...
    Processor: Intel i7-4790 @ 3.6GHz Mainboard: Asus Maximus VI Memory: 32GB DDR3 Videocard: MSI 980ti Motherboard Sound/Headphones: Creative SB Z + M/B Sound for SimVibe / Onkyo 5.1 Surround + Astro A50 Headphones Monitors: 3 x Asus 27" VN279H PSU: OCZ ZX1250W Keyboard+Mouse: Corsair Gaming K70 RBG / Logitech G700 Mouse Gamepad/Wheel: Fanatec CSWv2 + BMW Rim, Fanatex CSPv2, Fanatec CS Shifter SQ v1.5 OS: Win7 Ult x64 Storage: 256GB SSD + 3TB HDD
    Resolution: 5040x1080@60Hz Texture Res: High Texture Filter: 4x V-Sync: No AA: MSAA4x FXAA & SMAA: Off Reflections: Low Vehicle Detail: Ultra World Detail: High Shadow Detail: Low Motion Blur: None
    My vrHive Telemetry and Dash App (PC/PS4/XB1) - Forum Page: http://forum.projectcarsgame.com/sho...nt-Server-more
    My vrHive Telemetry and Dash App (PC/PS4/XB1) - Web Site: www.vrhive.co.uk
    My YouTube Channel: http://www.youtube.com/user/TR7V8Mike?feature=mhee
    My Twitch Channel: http://www.twitch.tv/mikeytt
    The following user likes this Post: Paceman


  6. #6
    Kart Driver
    Join Date
    May 2015
    Posts
    12
    Platform
    PC
    Quote Originally Posted by LipstickL View Post
    Change %d in the printf statement to %f, in short %d represents an int. mRpm in the SharedMemory struct is a float value.
    Thx this was the solution.

    @MikeyTT Thx for your help

Similar Threads

  1. Replies: 50
    Last Post: 20-08-2015, 18:41
  2. Corrupted data!
    By DarC in forum PS4 - Technical Help & Support
    Replies: 3
    Last Post: 02-07-2015, 22:00
  3. Data on PS4.
    By mcbrew in forum Project CARS on Playstation 4
    Replies: 2
    Last Post: 10-06-2015, 08:23
  4. In Race Data
    By Misakimi82 in forum General Discussion
    Replies: 3
    Last Post: 13-05-2015, 10:34
  5. Wrong Profile data and NO profile folderon PC
    By doubledragoncc in forum PC - Technical Help & Support
    Replies: 2
    Last Post: 12-05-2015, 17:37

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •