[DOC] Shared Memory Reference

Discussion in 'Apps' started by assettocorsamods, Jul 28, 2014.

Thread Status:
Not open for further replies.
  1. assettocorsamods

    assettocorsamods Administrator Staff Member

    Joined:
    May 30, 2014
    Messages:
    737
    Likes Received:
    112
    This follows official communication, shared memory reference, useful when planning to develop new AC apps.

    Fields in BLUE - represent the updated structure, according to latest evolutions.
    ***Last update on 25/04/2016***


    SHARED MEMORY STRUCTS

    #pragma once

    typedef int AC_STATUS;

    #define AC_OFF 0
    #define AC_REPLAY 1
    #define AC_LIVE 2
    #define AC_PAUSE 3

    typedef int AC_SESSION_TYPE;

    #define AC_UNKNOWN -1
    #define AC_PRACTICE 0
    #define AC_QUALIFY 1
    #define AC_RACE 2
    #define AC_HOTLAP 3
    #define AC_TIME_ATTACK 4
    #define AC_DRIFT 5
    #define AC_DRAG 6

    typedef int AC_FLAG_TYPE;

    #define AC_NO_FLAG 0
    #define AC_BLUE_FLAG 1
    #define AC_YELLOW_FLAG 2
    #define AC_BLACK_FLAG 3
    #define AC_WHITE_FLAG 4
    #define AC_CHECKERED_FLAG 5
    #define AC_PENALTY_FLAG 6


    #pragma pack(push)
    #pragma pack(4)

    struct SPageFilePhysics
    {
    int packetId = 0;
    float gas = 0;
    float brake = 0;
    float fuel = 0;
    int gear = 0;
    int rpms = 0;
    float steerAngle = 0;
    float speedKmh = 0;
    float velocity[3];
    float accG[3];
    float wheelSlip[4];
    float wheelLoad[4];
    float wheelsPressure[4];
    float wheelAngularSpeed[4];
    float tyreWear[4];
    float tyreDirtyLevel[4];
    float tyreCoreTemperature[4];
    float camberRAD[4];
    float suspensionTravel[4];
    float drs = 0;
    float tc = 0;
    float heading = 0;
    float pitch = 0;
    float roll = 0;
    float cgHeight;
    float carDamage[5];
    int numberOfTyresOut = 0;
    int pitLimiterOn = 0;
    float abs = 0;
    float kersCharge = 0;
    float kersInput = 0;
    int autoShifterOn = 0;
    float rideHeight[2];
    float turboBoost = 0;
    float ballast = 0;
    float airDensity = 0;

    };


    struct SPageFileGraphic
    {
    int packetId = 0;
    AC_STATUS status = AC_OFF;
    AC_SESSION_TYPE session = AC_PRACTICE;
    wchar_t currentTime[15];
    wchar_t lastTime[15];
    wchar_t bestTime[15];
    wchar_t split[15];
    int completedLaps = 0;
    int position = 0;
    int iCurrentTime = 0;
    int iLastTime = 0;
    int iBestTime = 0;
    float sessionTimeLeft = 0;
    float distanceTraveled = 0;
    int isInPit = 0;
    int currentSectorIndex = 0;
    int lastSectorTime = 0;
    int numberOfLaps = 0;
    wchar_t tyreCompound[33];

    float replayTimeMultiplier = 0;
    float normalizedCarPosition = 0;
    float carCoordinates[3];
    float penaltyTime = 0;
    AC_FLAG_TYPE flag = AC_NO_FLAG;
    int idealLineOn = 0;
    int isInPitLane = 0;

    float surfaceGrip = 0;

    };


    struct SPageFileStatic
    {
    wchar_t smVersion[15];
    wchar_t acVersion[15];
    // session static info
    int numberOfSessions = 0;
    int numCars = 0;
    wchar_t carModel[33];
    wchar_t track[33];
    wchar_t playerName[33];
    wchar_t playerSurname[33];
    wchar_t playerNick[33];

    int sectorCount = 0;

    // car static info
    float maxTorque = 0;
    float maxPower = 0;
    int maxRpm = 0;
    float maxFuel = 0;
    float suspensionMaxTravel[4];
    float tyreRadius[4];
    float maxTurboBoost = 0;

    float airTemp = 0;
    float roadTemp = 0;
    bool penaltiesEnabled = false;

    float aidFuelRate = 0;
    float aidTireRate = 0;
    float aidMechanicalDamage = 0;
    bool aidAllowTyreBlankets = false;
    float aidStability = 0;
    bool aidAutoClutch = false;
    bool aidAutoBlip = false;

    };

    #pragma pack(pop)


    SHARED MEMORY NAMES

    physics : acpmf_physics
    graphics : acpmf_graphics
    static : acpmf_static

    ***
    SHARED MEMORY EXAMPLE in attachment
     

    Attached Files:

    Last edited by a moderator: Apr 25, 2016
  2. assettocorsamods

    assettocorsamods Administrator Staff Member

    Joined:
    May 30, 2014
    Messages:
    737
    Likes Received:
    112
    Updated Shared Memory Reference and attached example to reflect changes since initial post.
     
  3. luchian

    luchian Administrator Staff Member Pilot RLR

    Joined:
    Jun 3, 2014
    Messages:
    2,876
    Likes Received:
    1,375
    Updated Shared Memory Reference and attached example, to reflect changes in AC 1.5+.
     
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice