ACC Shared Memory (Rust)
A Rust library for reading Assetto Corsa Competizione (ACC) shared memory telemetry data. This is a port of the Python acc_shared_memory library with full feature parity and additional type safety.
Features
- Real-time telemetry: Read physics data at ~333Hz update rate
- Session information: Access graphics and timing data at ~60Hz
- Static data: Car and session configuration data
- Type-safe enums: All ACC status codes, flags, and types
- Zero-copy parsing: Efficient memory-mapped file access
- Windows support: Native Windows shared memory API integration
- Optional Serde: Serialize/deserialize support with feature flag
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
# Enable serde support (optional)
= { = "0.1.0", = ["serde"] }
Quick Start
use ;
Data Structure
The library provides three main data structures:
PhysicsMap (~333Hz)
High-frequency telemetry data including:
- Car dynamics (speed, forces, orientation)
- Driver inputs (throttle, brake, steering)
- Tyre data (pressures, temperatures, slip)
- Engine data (RPM, fuel, water temp)
- Suspension and brake information
GraphicsMap (~60Hz)
Session and timing information including:
- Lap times and sectors
- Session status and type
- Car positions and gaps
- Flags and penalties
- Weather conditions
StaticsMap (Session constants)
Static configuration data including:
- Car and track information
- Player details
- Session rules and aids
- Pit window settings
Examples
Basic Telemetry Reader
use ACCSharedMemory;
let mut acc = new?;
loop
Fuel Strategy Calculator
if let Some = acc.read_shared_memory?
Weather Monitoring
if let Some = acc.read_shared_memory?
Error Handling
The library provides comprehensive error handling:
match acc.read_shared_memory
Building
Requires Windows and the Windows SDK for shared memory access.
# Build the library
# Run examples
# Run tests
Compatibility
- Windows: Full support (primary platform)
- Linux/macOS: Not supported (ACC uses Windows-specific shared memory)
Performance
- Zero-copy memory access using memory-mapped files
- Efficient enum parsing with fallback handling
- Minimal allocations for string data
- ~1-2ms parsing time for complete data set
Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Based on the Python
acc_shared_memorylibrary - ACC shared memory documentation by Kunos Simulazioni
- Thanks to the ACC modding community for reverse engineering efforts