Skip to content

SolusDev-sys/CppAccSharedMemory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Assetto Corsa Competizione Shared Memory Library

C++ implementation for reading Assetto Corsa Competizione (ACC) data via shared memory. Built according to the ACC Shared Memory v1.8.12 specification made by Fernando Barbarossa from KS Dev Team link to forum page.

Copyright 2026 Vladyslav Kolodii. All rights reserved.

Contents

Overview

This single-file C++ implementation provides access to ACC's shared memory interface, allowing external applications to read real-time telemetry data including:

  • Physics data (speed, RPM, tire temperatures, brake pressure, suspension travel, etc.)
  • Graphics data (lap times, position, fuel consumption, session info, flags, etc.)
  • Static data (car model, track name, player info, session configuration, etc.) Check ACCSharedMemoryDocumentationV1.8.12.pdf for more information

The implementation may also work with Assetto Corsa (AC), though this has not been verified.

Requirements

  • Windows operating system
  • Assetto Corsa Competizione running
  • C++ compiler with Windows API support (MSVC, MinGW, etc.)

Data Structures

The implementation defines three main structures:

SPageFilePhysics - Updated every graphics step, contains real-time physics telemetry for the player's car

SPageFileGraphic - Updated every graphics step, contains session and timing information

SPageFileStatic - Initialized at session start, contains constant session and car data

All structures are documented in ACCSharedMemoryDocumentationV1.8.12.pdf.

Usage Example

#include <iostream>
//etc.

int main()
{
    AccSharedMemory accMemory;

    std::cout << "Waiting for Assetto Corsa Competizione..." << std::endl;
    while (!accMemory.Connect())
    {
        std::cout << "ACC not detected. Retrying in 3 seconds..." <<std::endl;
        Sleep(3000);
    }
    std::cout << "Connected to ACC!" << std::endl;

    const SPageFilePhysics* physics = nullptr;
    const SPageFileGraphic* graphics = nullptr;
    const SPageFileStatic* staticData = nullptr;

    //Main Loop
    int lastpacketIdPhysics = -1;
    int lastpacketIdGraphics = -1;
    bool IsStaticDataRecived = false;
    while (true)
    {
        physics = accMemory.GetPhysics();
        graphics = accMemory.GetGraphics();

        if (!IsStaticDataRecived && graphics->status == ACC_LIVE)
        {
            staticData = accMemory.GetStatic();
            IsStaticDataRecived = true;
        }
        
        if (!physics || !graphics || !staticData)
        {
            std::cerr << "Lost connection to shared memory!" << std::endl;
            while (!accMemory.Connect())
            {
                std::cout << "Reconnecting in 3 seconds..." <<std::endl;
                Sleep(3000);
            }
            continue;
        }

        // Check if game is OFF
        if (graphics->status == ACC_OFF)
        {
            std::cout << "\r[OFF] ACC is not in a session. Waiting...";
            std::cout.flush();
            Sleep(500);
            continue;
        }
        
        // Check if game is paused
        if (graphics->status == ACC_PAUSE)
        {
            std::cout << "\r[PAUSED] Waiting for game to resume...";
            std::cout.flush();
            Sleep(500);
            continue;
        }

        // Check if game in replay
        if (graphics->status == ACC_REPLAY)
        {
            std::cout << "\r[REPLAY] Waiting for game to resume...";
            std::cout.flush();
            Sleep(500);
            continue;
        }

        //Static data
        std::wcout << L"Player: " << staticData->playerName << L" " 
                      << staticData->playerSurname << std::endl;
        std::wcout << L"Car: " << staticData->carModel << std::endl;
        std::wcout << L"Track: " << staticData->track << std::endl << std::endl;
        
        //Physics data
        if(physics->packetId != lastpacketIdPhysics)
        {
            lastpacketIdPhysics = physics->packetId;
            std::cout << "Gear: " << (physics->gear) - 1 << std::endl;
            std::cout << "Fuel: " << physics->fuel << std::endl;
            std::cout << "Wheel Pressure: ";
            for(float wheel:physics->wheelPressure)
            {
                std::cout << wheel << "; ";
            }
            std::cout << std::endl;
        }
        
        //Graphics data
        if(graphics->packetId != lastpacketIdGraphics)
        {
            lastpacketIdGraphics = graphics->packetId;
            std::cout << "TC: " << graphics->TC << std::endl;
        }
        Sleep(500);
    }

    accMemory.Disconnect();
    return 0;
}

Notes

  • Shared memory files are located at:
    • Local\acpmf_physics
    • Local\acpmf_graphics
    • Local\acpmf_static
  • All wheel-related arrays use the order: FL, FR, RL, RR (Front Left, Front Right, Rear Left, Rear Right)
  • Fields marked "NOT USED IN ACC" in the structures are not populated by ACC
  • Structure packing is set to 4-byte alignment (#pragma pack(push, 4))

About

Assetto Corsa Competizione Shared Memory reader written in C++

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages