1. Version 0.1.6 of Assetto Corsa EVO is now live with additional content! See the full changelog in the News and Announcements section. The team is continuing to focus on additional fixes and improvements. Thank you for your participation in the Early Access Program.
  2. If you experience an issue while starting up AC EVO make sure your Steam installation folder and the user/Documents/ACE folder are set as exceptions in your Antivirus software and Windows protection and/or Firewall settings. Delete the user/Documents/ACE folder and try again. Check for OneDrive redirecting or blocking access to the ACE folder in your user's Documents folder.
  3. Thank you for participating in the Early Access programme! If you experience an issue, please open a new thread in the appropriate AC EVO subforum and please make sure you ALWAYS attach the log.txt file from the user/Documents/ACE/ folder in your report. If you experience a crash, please make sure to zip and attach the whole "crashdumps" folder from the same location.

DOCS ACC Shared Memory Documentation

Discussion in 'ACC Blog' started by Fernando Barbarossa, Aug 28, 2019.

  1. Doug Duthie

    Doug Duthie Hardcore Simmer

    Very quick overview - that sample is in C++ (not C#). C++ has access to physical memory so SPageFilePhysics* pf is a pointer to the shared memory region meaning you can use it directly. C# doesn't have direct access to memory so you have to jump through a few hoops to access the memory as an unmanaged resource and copy to a structure that C# can use (this is what I do). Generally though, the paradigm is you read a stream of bytes from memory, then map a structure over that - you've just got to ensure all your data types match otherwise your structure won't match correctly (ints and floats are straightforward but for strings/arrays, you need to marshal these into managed types), Unless you are really interested in doing this in C#, I won't share a sample here as my code is very verbose and would probably just confuse you further.

    printData is just dumping out the data to the console. More interesting to you is accessing the data itself. ie pf->abs ...pf is the pointer to your region containing the physics shared memory file. -> says get the member pointed to by the pointer. So pf->abs says get the field abs in the physics structure

    If you are programming in Rust, you might as well do everything in that. I know nothing about Rust but a quick google shows there are examples on reading Memory Mapped Files (which is what shared memory really is) with Rust. Your challenge will be to ensure that the field types in your structure in Rust
     
    Last edited: May 12, 2024
    Pasta21 likes this.
  2. Pasta21

    Pasta21 Rookie

    thank you for clarifying! seems like your message got cut out at the end?
    anyway I will get straight to researching with this newfound knowledge! :) and see if I can figure it out in rust!
    I will report back if I need further help!
     
  3. Pasta21

    Pasta21 Rookie

    I think I got it!! its not perfect but I think I'm able to print out the data to the CMD! I'm so excited! :D
    Thank you sooo much Doug!
     
  4. Pasta21

    Pasta21 Rookie

    there are some values that are of type "wchar_t" in the shared memory's structs "SPageFileGraphic" and Static.. how big are the "wchar_t" in memory? I seem to indeed have some problem with them when converting the shared file to Rust. I have tried to make them ex: " currentTime: [u16;15] " and then in my main converting them into Rust Strings with "let current_time = Strings::from_utf16(&graphic.currentTime).unwrap()" just so I can print it out into the terminal. and it seems like currentTime (which is the first wchar_t that I can see in the SharedMemoryFile) is aligned and seem to display properly. but everything after that point seems to be miss-aligned. and if i give currentTime say 14 or 16 instead of 15, it seems to shift the values a little after that point. So my conclusion is that I do indeed have the wrong size!
    I first tried u8 as rust uses UTF-8 and not UTF-16, but then current_time looked like ex:"00:01:" or something along those lines. aka its to short. and with u16 instead I do see ex:"00:01:087" so it must be closer to the correct size! but still not perfect as everything after do miss-align.. if I look at lastTime just after currentTime it will show up as "35791:23:647". where as I assume it should show up as "--:--:---" just like currentTime does when not in a session. after a lap around a track however lastTime shows up correctly with the right time as in game. so it seems to miss-align just a smidge. I have seen somewhere that people tend to add a zero at the end of a u16 because "something something, C has an extra number something" or... something. I have no idea. If anyone has any ideas what I can try I'd be happy to know!
    (hope my question is coherent enough)
    Edit: the misalignment gets worse the further down I go, and "int/i32" just show "0" or some crazy number like "1124921" etc.
     
    Last edited: May 15, 2024
  5. Doug Duthie

    Doug Duthie Hardcore Simmer

    The size of a wchar_t is (probably) 16 bits, ie 2 bytes (it is implementation dependent - https://en.wikipedia.org/wiki/Wide_character#:~:text=Size of a wide character,-Early adoption of&text=NET and Java.,) type of 16-bits.)

    The thing about a zero on the end...C/C++ define a string as an array of characters terminated by a null character (ie ASCII 0). ie the string "0123456789" is 11 bytes long (not 10) as it has a terminating '\0' character. This isn't really the case here as they are an array of bytes - if the string fills the array, there is no terminating null.

    Now to your issue. Bearing in mind I know nothing about Rust. I assume your function call above is trying to copy from a UTF_16 string rather than stream a UTF16 byte array. If there isn't a built in function for this, look for something that iterates through the byte array and convert each utf16 character one at a time and stream into your string.

    In C# it is a bit easier as you can just use marshalling directives to announce the unmanaged types ..eg

    Code:
        [Serializable]
        [StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode)]
        public struct ACCsPageFileGraphic 
        {
            // TODO More fields to add
            public int packetId;
            public ACC_STATUS status;
            public ACC_SHM_SESSION_TYPE session;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 15)]
            public string currentTime;
    
     
    Last edited: May 15, 2024
    Pasta21 likes this.
  6. Pasta21

    Pasta21 Rookie

    thanks again! I figured out what was going on. I just had some bugs in my code pretty much! and I also checked the example provided in this thread and compared my data to it, and it also gives "35791:23:647" for lastTime, so it was apparently correct! and the other values I just missed it was a wchar_t type and wondered why it looked so odd printing it out lmao. also seems like "String::from_utf16()" works just fine for displaying! :D

    I think its just some of the values just confuse me, and maybe some values only work in a multiplayer session/ race session and not practice session, like "isInPit" as an example.
    that one was always on zero for me, but seems to be that in the example file as well. so maybe I got it all working as intended after all! o_O:)
    only thing I see diverging atm is "distanceTraveled" where I get 2 extra digits, so there is probably some differences here and there, but as long as it works as intended I am happy :p
     
    Doug Duthie likes this.
  7. Nobkins

    Nobkins Rookie

    Is it possible to get contact information from the ACC dedicated server? Trying to log car / car, car / object info if possible.
     
  8. Rolz

    Rolz Alien

    no... this is why on all the big events they have a spare car in the pits running the 3rd party monitoring software to present to the broadcast team... god I hope they return all that back to the server side in AC Evo like AC had it.
     
  9. Fred 3

    Fred 3 Rookie

    Please tell me how to determine in SPageFileGraphic, that there was an exit from the border of the track in the race, there is isValidLap in qualifying, but it does not work in the race.
     
  10. Doug Duthie

    Doug Duthie Hardcore Simmer

    I made a note that the valid valid in SHM wasn't reliable and seemed to be transient (I could be wrong here). I just use the isValidForBest/isValid flag from the UDP interface
     
    Fred 3 likes this.
  11. TheBigO

    TheBigO Racer

    Yes, I am also using the flag from the UDP interface and OR the value from SHM interface. This way it always works.
     
  12. Comme

    Comme Rookie

    Hi, I tried to have info.physics.abs During session to see when the abs is activated but I have a fix value which don't change ( Assetto Corsa 1 ). But it's work in ACC with 0 or 1 like a boolean. Any idea to make work it in AC1 ?
     

    Attached Files:

    Last edited: Oct 8, 2024
  13. Hi everyone.
    I have a problem.
    IsRunning is always FALSE but I tested AirTemp from Physics memory file: if I pause it’s set to 0, if I play is ALWAYS 0.0078, even if I manually change the temperature. Why?
     
  14. EDIT: this is the kind of data I receive.

    2024-12-26 23:27:23 - INFO: PacketId: 276827
    2024-12-26 23:27:23 - INFO: Gas: 0
    2024-12-26 23:27:23 - INFO: Brake: 0
    2024-12-26 23:27:23 - INFO: Fuel: 62
    2024-12-26 23:27:23 - INFO: Gear: 1
    2024-12-26 23:27:23 - INFO: Rpms: 0
    2024-12-26 23:27:23 - INFO: SteerAngle: 0
    2024-12-26 23:27:23 - INFO: SpeedKmh: 0,0016787507
    2024-12-26 23:27:23 - INFO: VelocitySystem.Single[]
    2024-12-26 23:27:23 - INFO: AccGSystem.Single[]
    2024-12-26 23:27:23 - INFO: WheelSlipSystem.Single[]
    2024-12-26 23:27:23 - INFO: WheelPressureSystem.Single[]
    2024-12-26 23:27:23 - INFO: WheelAngularSpeedSystem.Single[]
    2024-12-26 23:27:23 - INFO: TyreCoreTempSystem.Single[]
    2024-12-26 23:27:23 - INFO: SuspensionTravelSystem.Single[]
    2024-12-26 23:27:23 - INFO: TC: 0
    2024-12-26 23:27:23 - INFO: Heading: 0
    2024-12-26 23:27:23 - INFO: Pitch: 0
    2024-12-26 23:27:23 - INFO: Roll: 0
    2024-12-26 23:27:23 - INFO: CarDamageSystem.Single[]
    2024-12-26 23:27:23 - INFO: PitLimiterOn: 0
    2024-12-26 23:27:23 - INFO: Abs: 0
    2024-12-26 23:27:23 - INFO: AutoShifterOn: 0
    2024-12-26 23:27:23 - INFO: AirTemp: 0,007846846
    2024-12-26 23:27:23 - INFO: RoadTemp: 0,007815491
    2024-12-26 23:27:23 - INFO: LocalAngularVelocitySystem.Single[]
    2024-12-26 23:27:23 - INFO: FinalFF: 0
    2024-12-26 23:27:23 - INFO: BrakeTempSystem.Single[]
    2024-12-26 23:27:23 - INFO: Clutch: 0
    2024-12-26 23:27:23 - INFO: IsAIControlled: 0
    2024-12-26 23:27:23 - INFO: TyreContactPointAssettoCorsaSharedMemory.Coordinates[]
    2024-12-26 23:27:23 - INFO: TyreContactNormalAssettoCorsaSharedMemory.Coordinates[]
    2024-12-26 23:27:23 - INFO: TyreContactHeadingAssettoCorsaSharedMemory.Coordinates[]
    2024-12-26 23:27:23 - INFO: BrakeBias: 0
    2024-12-26 23:27:23 - INFO: LocalVelocitySystem.Single[]
    2024-12-26 23:27:23 - INFO: WaterTemp: 0
    2024-12-26 23:27:23 - INFO: BreakPressureSystem.Single[]
    2024-12-26 23:27:23 - INFO: FrontBreakCompound: 0
    2024-12-26 23:27:23 - INFO: RearBreakCompount: 0
    2024-12-26 23:27:23 - INFO: PadLifeSystem.Single[]
    2024-12-26 23:27:23 - INFO: DiscLifeSystem.Single[]
    2024-12-26 23:27:23 - INFO: IgnitionOn: 1119672841
    2024-12-26 23:27:23 - INFO: StarterEngineOn: 1113010043
    2024-12-26 23:27:23 - INFO: IsEngineRunning: -1080942868
    2024-12-26 23:27:23 - INFO: KerbVibration: 92,74025
    2024-12-26 23:27:23 - INFO: SlipVibrations: 0,018890174
    2024-12-26 23:27:23 - INFO: GBibrations: 0,99981856
    2024-12-26 23:27:23 - INFO: ABSVibrations: -0,0024457548

    For me, all values are awkardly wrong.
    AirTemp: 0,007846846??
    RoadTemp: 0,007815491??????
    StarterEngineOn: 1113010043????????????????

    Why can't the SM just expose normal values? In the docs there are no measurements units or istructions to help converting those values!
     
  15. Doug Duthie

    Doug Duthie Hardcore Simmer

    It sounds like you have an variable alignment problem. I've just dumped the values (using ACC Results Companion) and they all look fine. Car not moving so speed zero. EngineStarter / isEngineRunning cycle as the engine starts
    [​IMG]
     
  16. Pasta21

    Pasta21 Rookie

    I was about to say that too, I think you might have a miss-alignment. I think I had a similar issue because the shared example on this thread apparently missed a few variables that are in the pdf also posted here. so I filled those in and it solved my issue! so I recommend using the pdf, and see if you might skipped something, or used the wrong variable type somewhere :) btw if it says "int" its an i32, and the floats are f32. if it says int/float name[4] it means there are 4 of each. so you could do an array [i32;4] or you could make each individual values like "wheelSlip_FL, wheelSlip_FR" all as separate values, as long as they all use up 32bit each pretty much I guess.. I use Rust as my language so I specify to rust that I am aligning my shared file structs to C type alignment. but as it seems to work fine for the above parts, id assume its rather that a value is missed, or is the wrong size which causes the other half to align wrong!
     
  17. Pasta21

    Pasta21 Rookie

    I think I use that value and it works in both sims. could it be that the car you loaded in AC1 didnt have ABS? cause then it dosent trigger at all, else there might be some other issue. cause it should be the same. odd that it shows up as a constant never changing floating value like that though. mine is also a boolean though even though the game says its an float
     
  18. Pacemaker

    Pacemaker Rookie

    Hi all,

    is the documentation linked on page 1 the most recent shared memory version? I'm still on v1.8, but as ACC moved on, I was wondering, if there is some newer shared memory documentation?
     
  19. Pasta21

    Pasta21 Rookie

    this is the place! I don't think its been updated since. Don't think there are any new values been added anyway so that is the the full list of values. I'm pretty sure about that at least :)
     
  20. Pacemaker

    Pacemaker Rookie

    Thanks so much. Just digged through the latest state and found all the new telemetry stuff, I was not aware about. Wanted to give the absVibrations a test run, but it simply shows 0 all the time. Anything I am doing wrong? Maybe I'm missing the correct map length (816 Bytes as of my calculation?!).

    Edit: also things like tyreTemp are simply showing values, that are not matching (ie. the airTemp in this case). Neither do tcInAction nor absInAction work (yeah, I tested it with cars having those features and also checked the setups to have them enabled).
     
Similar Threads
Forum Title Date
ACC Physics Differentiate AC and ACC Shared Memory With Different Naming. Jan 3, 2024
ACC Troubleshooting ACC Shared Memory: AC version still reports 1.7 Apr 19, 2023
ACC Troubleshooting ACC Shared Memory Example Apr 23, 2020
Programming Language - Apps - GUI Themes Shared Memory or UDP Reference for ACC ? Sep 13, 2018
ACC Troubleshooting ACC won't launch Yesterday at 9:45 PM
ACC General Discussions 'Modding' ACC with UUU for improved visuals Saturday at 7:36 AM
ACC General Discussions ACC Server(s) down? Apr 3, 2025
AC EVO General Discussions ACC Steering wheel transfer Mar 29, 2025
ACC PS4/PS5/XB1/XBX/S General Discussions PC ACC No Arms and Wheel Mar 15, 2025
AC EVO General Discussions acc evo Feb 27, 2025
ACC PS4/PS5/XB1/XBX/S General Discussions ACC QUESTION Feb 22, 2025
AC EVO User Interface Bring back keyboard settings as in ACC Feb 7, 2025
ACC PS4/PS5/XB1/XBX/S General Discussions Use the PS5 controller's motion sensor for ACC steering Feb 5, 2025
AC EVO Gameplay Slow AI cornering, hyper-fast AI acceleration (Giulia at Imola) Feb 4, 2025
AC EVO General Discussions The cars seem smaller than ACC Jan 29, 2025

Share This Page

  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