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 (car dynamics, driver inputs, tyres, engine, suspension, brakes, etc.)
- GraphicsMap (~60Hz): Session and timing information (lap times, session status, car positions, flags, weather, etc.)
- StaticsMap (Session constants): Static configuration data (car/track info, player details, session rules, pit window, etc.)
See the linked documentation files above for a full list of fields and their descriptions.
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