LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Access shared memory in racing game

Hi,

 

I want to access shared memory in racing game "Assetto Corsa"

 

I know that Assetto Corsa share game data(speed,rpm, etc.) by shared memory section.

 

How to access this section by labview?

 

I can't see any shared memory dll file in Assetto Corsa install folder.

 

Regards.

0 Kudos
Message 1 of 6
(3,543 Views)

Most likely it’s shared through the Windows kernel functionality to create file mapped memory. Such can be accessed by calling Windows API functions such as OpenFileMapping() and friends. This page https://docs.microsoft.com/en-us/windows/win32/memory/creating-named-shared-memory explains the process and you can call these functions through the Call Library Node. There are some libraries out there where people did some work to create LabVIEW VIs to wrap these functions but they might require some review especially if you intend to use them in 64-bit LabVIEW.

You still need to know the name of the memory mapped file of course and the layout of the data in the memory area.

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 6
(3,491 Views)

You could try to compile this C# code or turn it into a .NET wrapper. Or study it and use the details in LabVIEW.

 

For instance, the mapped file names Rolf is refering to are in there:

physicsMMF = MemoryMappedFile.OpenExisting("Local\\acpmf_physics");
graphicsMMF = MemoryMappedFile.OpenExisting("Local\\acpmf_graphics");
staticInfoMMF = MemoryMappedFile.OpenExisting("Local\\acpmf_static");

 

The UDP interface might (or might not) be easier to set up (but maybe a bit slower).

0 Kudos
Message 3 of 6
(3,483 Views)

I am a novice in C# language and windows API . T.T

I try to install VisualStudio2010 and comfile C# code to dll file for accessing shared memory by labview.

But I can't not open DLL in labview. Function lists does not exist.

 

What can i do to solve the problem?

 

Thanks.

0 Kudos
Message 4 of 6
(3,451 Views)

I didn't know much about MMF so I searched and found the LabVIEW MMF library. Is this a clue to the library?

 

https://forums.ni.com/ni/attachments/ni/170/523777/1/BD_MMF.llb 

 

How can I read the value of a variable if I have the following information?

- Physics.cs

- public float SpeedKmh

 

Thanks for answer.

0 Kudos
Message 5 of 6
(3,432 Views)

You could use the library as a starting point. The API calls (32 bit!!!) are there. I'd be very suspicious about the globals that are used. If you have 64 bit LabVIEW, conversion, to support 32 and 64 bit, is required.

 

I would look into .NET memory mapped file myself. This isn't an entry level .NET library though.

 

This stuff isn't easy. All the pieces of the puzzle are there. Make an effort, post what you have and where you got stuck. We'll help.

 

EDIT (trying to be a bit more constructive): 

Start with opening a MMF. Does this work (e.g. no error)?

(optionally) Try the same with .NET. Does this work (e.g. no error)?

Try reading anything. Does this work? Does the data change?

Try to match the data to the documentation. Does this make sense?

See if there are memory leaks. Make sure references are closed when needed.

Etc.

 

I'm not going to install this game myself, and I doubt a anyone else will. So you can wait for someone to implement this for you, or give detailed help, but it might take a long (long) time. It might not happen at all.

0 Kudos
Message 6 of 6
(3,426 Views)