Shared memory documentation
-
Hello again everyone. This time I’m here to do something else except reporting possible bugs!
I am in the process of assembling a full f16 pit to enjoy bms to the max, and part of that means I will need to program my stuff accessing sim data through shared memory.
1. So I’m looking for a link to where I can find the specifications on the BMS shared memory API so I can access those variables. I just need API specs, that’s enough :).
2. I know there is a built in mfd exporter tool, however I would very much like to copy these buffers out manually so I can integrate them into my own software, possibly send them around to some slave machine. Is there any way to access the underlying framebuffers for the mfds? If this is answered in (1) , I’m happy :D.
(#2 is mostly because I am sort of a no-input-lag crazy gamer/simmer who absolutely wants vsync to be off, and I have issues/trouble turning it off with windowed mode, some other issues as well, but let’s not get into that.)
Thanks, this is going to be woohoo ^^.
-
Are you sure you need to program your own extractor? There are already a couple of very nice tools reading out the shared memory…
There are no specs on it. In the “.\Docs\Other Documentation” folder you should find a C header file (Flight Data.h) containing inline documentation which should help you. For all other inquires I’d probably go to viperpits.org where the real cockpit gurus hang out
The (legacy) “BMS 2.0 Technical Reference Binary.doc” document in the “.\Docs\Falcon 4 Legacy Manuals\5 - BMS 2” folder also has some notes on the shared memory.
-
Are you sure you need to program your own extractor? There are already a couple of very nice tools reading out the shared memory…
There are no specs on it. In the “.\Docs\Other Documentation” folder you should find a C header file (Flight Data.h) containing inline documentation which should help you. For all other inquires I’d probably go to viperpits.org where the real cockpit gurus hang out
The (legacy) “BMS 2.0 Technical Reference Binary.doc” document in the “.\Docs\Falcon 4 Legacy Manuals\5 - BMS 2” folder also has some notes on the shared memory.
Oh ok, well that C header should help a lot. Following http://msdn.microsoft.com/en-us/library/aa366551.aspx I’ll also need to figure out what filemapping name is used by bms. Should be in someplace there or maybe someone at viperpits knows.
Well…already existing apps? How open would these be…Ill try over @ viper pits but I’d need them to be able to give me basically a header + lib or just source code so I can get the data I need. I’m planning to wrap this in JNI and load from a java process.
Possibly if they have an app which provives a udp or tcp stream that could also work.
-
The names are at the very end of the .h
"FalconSharedOsbMemoryArea" "FalconSharedMemoryArea" "FalconSharedMemoryArea2"
-
The names are at the very end of the .h
"FalconSharedOsbMemoryArea" "FalconSharedMemoryArea" "FalconSharedMemoryArea2"
oooooh :).
I didn’t realize those were the names. Thank you. -
Yeah, I would second Retro’s post – you want to find the viperpits crew and learn from their experiences.
I would advise against trying to do #2 yourself. Just use the existing MFDE program (home for that is at viperpits). It’s non-trivial to accomplish the same thing unless you are quite expert at coding, and no real value that I can see to repeat what Lightning has already done. As far as the built in MFD export – no, there isn’t a reasonable way to get at the buffers for that (which has to do with the DX pipeline and hardware limitations really).
The shared memory header should be more or less self-documenting. If it doesn’t look that way to you then I would again advise you to skip trying to do your own reader – no offense or anything, but if that header content doesn’t tell you enough then you are likely not going to succeed in what you want to do anyway so better to leverage one of the existing readers.
-
Yeah, I would second Retro’s post – you want to find the viperpits crew and learn from their experiences.
I would advise against trying to do #2 yourself. Just use the existing MFDE program (home for that is at viperpits). It’s non-trivial to accomplish the same thing unless you are quite expert at coding, and no real value that I can see to repeat what Lightning has already done. As far as the built in MFD export – no, there isn’t a reasonable way to get at the buffers for that (which has to do with the DX pipeline and hardware limitations really).
The shared memory header should be more or less self-documenting. If it doesn’t look that way to you then I would again advise you to skip trying to do your own reader – no offense or anything, but if that header content doesn’t tell you enough then you are likely not going to succeed in what you want to do anyway so better to leverage one of the existing readers.
The header is just fine for getting everything except the mfd textures thank you :). More than enough. I’m just curious, the existing MFDE software uses dll injection then to grab these textures after theyre rendered? Something similar was done with LoFc2 with the A10As TV display. I’m more of an OpenGL guy (since we use mostly OpenGL SC at work) but I’ve messed around a little with coding a simple MFD in Direct3D before.
My idea is sort of to gather all the pit stuff into 1 sw, kind of like I did with my controllers. Previously I wrote a software for profiling hotas/rudders etc, so I don’t have to use different sw for diff manufacturers. This will come in handy now especially with bms. I plan on using it for creating keyboard mappings for my pit also. Preferably I’d like an api like DCS/FC’s lua for sending input commands instead of mapping to keystrokes (as if you happen to flip too many switches ie in a dogfight, you might be holding down shift/ctrl modifiers when you don’t intend to ^^) - The alternative is to use DX mappings though for bms which should work fine.
Anyway back to the issue at hand. If the MFDE uses dll injection then I don’t know how to do my own at the moment. Well I can probably inject my own d3d9 dll but the question is then how on earth would I find the correct texture/buffer to copy stuff out of :P. If I had some way of identifying the texture though, now that would make things not so difficult anymore.
-
You want DX burron mappings – those work already without collisions or ambiguity and given that, there seems little margin in building something duplicative of that like a LUA interface.
I’m not totally sure I know what you mean by dll injection, and I’m not the expert on Lightnings MFDE code but my understanding is that he’s proxying the DX calls and in so doing capturing the draw operations to make a parallel rendering of the desired end result. Viperpits is the place to ask more about this sort of thing really.
-
You want DX burron mappings – those work already without collisions or ambiguity and given that, there seems little margin in building something duplicative of that like a LUA interface.
I’m not totally sure I know what you mean by dll injection, and I’m not the expert on Lightnings MFDE code but my understanding is that he’s proxying the DX calls and in so doing capturing the draw operations to make a parallel rendering of the desired end result. Viperpits is the place to ask more about this sort of thing really.
Ah yes that is most probably done by replacing (proxying, sometimes called dll injection) the default dlls. Else he would need bms source code access. Regardless, good to know and that also means I’ll need to go talk to him. Thank you :).
EDIT: I got all the stuff working :). Required much less effort than I expected. If anyone wants some sample code, here is my test
#include <iostream>#include <windows.h>#include "Flight Data.h" using namespace std; int main() { const HANDLE hMapFile = OpenFileMapping(FILE_MAP_READ, FALSE, "FalconSharedOsbMemoryArea"); if (hMapFile != NULL) { const OSBData * data = (OSBData *) MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, sizeof(OSBData)); if (data != NULL) { while (true) { cout << endl << data->leftMFD[2].line1; Sleep(1000); } UnmapViewOfFile(data); } else { cout << "Could not map view of file"; } CloseHandle(hMapFile); } else { cout << "Could not open file mapping object"; } return 0; }</windows.h></iostream>
-
Guys, what about movement, I’m working in a 3d 360 scale, But I really don’t know which of those parameters I must to read from in order to get the movement from BMS. Do you have any info about it?
Thanks
ET
-
Possibly if they have an app which provives a udp or tcp stream that could also work.
There is an app made by JShepherd, small program you install in windows, first activate something in Falcon to create images in the SharedMemoryArea then the app will capture and then send by WI-fi over to your android phone, (or whatever ?)
this actually works very well, I’ve tested Gauges, 2D and 3D MFD’s, most of my testing was with Falcon OF but it does work with BMS (I had problems with my install in win7 but in the end I did get 3d MFD extraction).
You need to contact JShepherd, over at viperpits (Big problem! viperpits is down at the moment)
I have the app here at home, tell me how to post and you can try yourself.
Gauges
2D Extraction
3D Extraction
@Quote:
PS UDP Falcon Server for Android 2.2 (v0.8)(Beta)
This application extracts the flight data from Open Falcon, Falcon AF and Falcon
BMS simulators acting like a server and send this data to an android mobile device running the client application PS Gauges trough the TCP/UDP net protocol.PS UDP Falcon supports 5 clients connected at the same time so you can use five different android devices. Three of them are used for flight data, one for the left MFD, one for the right MFD and one for the HUD.
PS Gauges client application needs Android 2.2
Reboot.
-
Hey reboot r u nuts???
Please please get - give much more info on that… this is a must… most of us have some device or even a android tablet now is less expensive than a 8" vga touch screen…
I already bought 2 tablets looking for an app like that for mfd (buttons and view)… and waiting for Lightnings extractor… -
Here’s the app,
install the .exe on the computer
install the .apk on the android.
http://dl.dropbox.com/u/5918219/Stephen/PSUdpV08.rar
Remember all credit go’s to JShepherd.
Reboot.
PS: I’ll try and put together some kind of install guide, if anyone’s interested.
-
Yes please do so…
Thank you.
Wow hell it works… No adjustments at all buttons work… some are fubared but no major prob… what I would need help is that I can’t see the pic inside the LMFD and RMFD… should I do something special?
Just a heads up every time u enable or adjust a displayed instrument u have to re connect from the client than it works…
-
WoW thx for this its awesome!
Cheers,
:drink:
-
Settings like this should give you a 2d image of your desktop (you don’t have to start falcon to see this).
when using BMS, we don’t need 2D MFD’s so don’t do anything with the coordinates,
This 2D image is just a test to see if its working correct.
PS: If anyone needs help, you must say exactly what you can get working and what you cannot!
Reboot
-
In BMS just activate MFD extraction and set the MFD size to something like 250x250 pixels,
then its just a mater of pressing the correct hot-key,In MFD-E and falcon OF, lightning made hot-keys complicated so once set to the correct view (2D or 3D) it wasn’t easy to hit the hot-key by mistake,
Falcon BMS only uses 3D so once set to 3D it shouldn’t be necessary to change anymore.
@Quote:
HOW TO CHANGE MFD`s VIEWS
To change from one view to another, PS Udp reads the keyboard and see if the following keys have been pressed on the default configuration:
**- “2” for 2D view.
- “5” for view FOV.
- “4” for 3D view.**
You can modify the scan codes in the PSUdp.ini file but they have to be DirectInput key scan codes in decimal format.
In Falcon BMS this is not applicable as it uses only 3Dview.
-
Adjust to what? Bigger? Smaller? Mine is a 7" so probably increase it.
-
I’ve edited my last post, if you cannot see this 2D image then you cannot get to see anything in 3D,
please post back.
Reboot.
-
There is an app made by JShepherd, small program you install in windows, first activate something in Falcon to create images in the SharedMemoryArea then the app will capture and then send by WI-fi over to your android phone, (or whatever ?)
this actually works very well, I’ve tested Gauges, 2D and 3D MFD’s, most of my testing was with Falcon OF but it does work with BMS (I had problems with my install in win7 but in the end I did get 3d MFD extraction).
You need to contact JShepherd, over at viperpits (Big problem! viperpits is down at the moment)
I have the app here at home, tell me how to post and you can try yourself.
…Reboot.
Ok, SO I am pretty well versed in C/C++ and Java, and read shared memory from other apps AND BMS frequently, but:
I thought f4bms did NOT export mfds in shared memory (and that you had to use the built in extractor).
If someone can tell me what the name of the shared memory areas that contain the bms mfd textures PLEASE let me know !!!,
also I’ll need to know how to activate them. The actual coding of a program that can read the areas = piece of cake ;).Stuff like format (RGB+bpp, RGBA+bpp) etc would also be goot to know, but I can figure those out myself by seing the data worst case).
I will investigate this zip you posted, if it contains something I can use.
Update: After reading the help.txt in the zip it seems like you still have to enable the built in extractor for bms…hmm…which defeats my purpose…But I will see what happens anyway for fun