Shared memory documentation
-
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
-
The supposed shared memory texture area is just full of zeroes, even after doing the stuff in the zip
(add the config file settings, set 512 512 in the ckpitart, enable normal mfd extractors )There is a shared memory area created named “FalconTexturesSharedMemoryArea” (of about 4 MB size), but it just contains zeros.
Apparently my viperpits account has disappeared in their site reset, sigh, last time I applied for membership it took 2 mths :).
Anyway if you can see some error in hwo i read shared memory please tell me:void doRgbExport(const char * name, const char * outputFile) {
const HANDLE handle = OpenFileMapping(FILE_MAP_READ, FALSE, name);
if (handle != NULL) {
const void * view = MapViewOfFile(handle, FILE_MAP_READ, 0, 0, 0);
if (view != NULL) {MEMORY_BASIC_INFORMATION info;
memset(&info, 0, sizeof(MEMORY_BASIC_INFORMATION));
VirtualQuery(view, &info, sizeof(MEMORY_BASIC_INFORMATION));printf(“Shared memory size of %s is %ld bytes\n”, name, info.RegionSize);
//memcpy(s_bmsTexArea, view, info.RegionSize);
int i;
for (i = 0; i < info.RegionSize; i++) {
unsigned int v = ((unsigned char *) view)_;
if (v != 0) {
printf(“There is data in %s\n”, name);
break;
}
}UnmapViewOfFile(view);
} else {
printf(“Unable to get view for %s\n”, name);
}
CloseHandle(handle);
} else {
printf(“Unable to get handle for %s\n”, name);
}
fflush(stdout);}
void display() {
printf(“\n\n”);
doRgbExport(“FalconSharedOsbMemoryArea”, “FalconSharedOsbMemoryArea.smem”);
doRgbExport(“FalconSharedMemoryArea”, “FalconSharedMemoryArea.smem”);
doRgbExport(“FalconSharedMemoryArea2”, “FalconSharedMemoryArea2.smem”);
doRgbExport(“FalconTexturesSharedMemoryArea”, “FalconTexturesSharedMemoryArea.rgb”);}
result:
Shared memory size of FalconSharedOsbMemoryArea is 4096 bytes
There is data in FalconSharedOsbMemoryArea
Shared memory size of FalconSharedMemoryArea is 4096 bytes
There is data in FalconSharedMemoryArea
Shared memory size of FalconSharedMemoryArea2 is 4096 bytes
There is data in FalconSharedMemoryArea2
Shared memory size of FalconTexturesSharedMemoryArea is 4198400 bytesFalconTexturesSharedMemoryArea only contain zeroes!
Update:
I know now, it will not work. That program simply just copies drawn pixels from one desktop to another :/. What I need is to be able to get the texture data without it being drawn in a separate window :/_ -
“FalconTexturesSharedMemoryArea” is as you say blank, its not until it is activated by adding a line to the FalconBMS.cfg
Set g-bExportRTTTextures 1
once started falcon begins to draw images to this area, and it is this! that drags the FPS down, Not the extractor program its self.
the size of this area and the size and position of the MFD’s, HUD, and some gauges
is set in the 3Dcockpit.dat file.some thing like this (This is from Falcon OF)
MED-extractor and also Jshepard’s program can take a copy from this area and show on another screen.
Lightning’s, Jshepard’s program and falcon BMS, all extract MFD’s in exactly the same way by copying images from this area.
Update:
I know now, it will not work. That program simply just copies drawn pixels from one desktop to another :/. What I need is to be able to get the texture data without it being drawn in a separate windowYes, it copy’s from one desktop to another 2D, and it also copy’s from the SharedMemoryArea to the desktop 3D.
Reboot……
-
Lightning’s, Jshepard’s program and falcon BMS, all extract MFD’s in exactly the same way by copying images from this area.
Actually that’s not completely correct…the built in display extraction uses a different approach. That is how, for some cards and drivers, the frame rate hit for using extraction is rather less than when you turn on the texture export capability. It’s not really material to your main point of course…just adding information.
-
Thanks for the correction Mark, (very interesting) but is it still not just copying images from the one place to the other, or is it more advanced than that, capturing data before it’s drawn ???… just what GiGurra is asking about.
-
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
When MFD-Extractor first started, it could only capture 2D images from a set of screen coordinate’s,
(then the next version) after manually turning on the “texture export” could capture 3D images from “again” another set of manually in-tested coordinate’s this time from the “SharedMemoryArea”,
latter, MFD-Extractor could automatically switch-on “texture export” and get the coordinate’s its-self from the 3Dcockpit.dat file.so by using MFD-Extractor to turn on the “texture export” was just a tidy way of doing it and again in Falcon BMS. turning on “texture export” can be done ether manually or by activating it with the built in extractor.