Shared memory documentation
-
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.
-
“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.
Yes, it copy’s from one desktop to another 2D, and it also copy’s from the SharedMemoryArea to the desktop 3D.
Reboot……
I’m sorry but the FalconTexturesSharedMemoryArea still just contains zeroes for me (the other areas I can read fine.)
Here is my falcon bms.cfg from the config folder : http://gigurra.se/falcon/falcon%20bms.cfg
and here is my 3dcockpit.dat : http://gigurra.se/falcon/3dckpit.datI’ve also tried editing the spelling to
set g_bExportRTTTextures 1
set g_nRTTExportBatchSize n (tried n = 1,2 and 5)I’ve also tried setting (for ALL F-16 3dcockpit files and the root one)
rttTarget 600 600 32;But still, FalconTexturesSharedMemoryArea = 00000…. (4 MB of zeros)
Lightning’s program’s MFDs don’t work for the new bms afaik (They are blank. Other data is read fine)
-
What is this “Yoda crazy shit” at the bottom of your .cfg file ?
-
Just a little info,
the rttTarget (in red) is the size of the SharedMemoryArea
the numbers (in red) are the positioning and size of the left and right MFD’s…… 225x225 pixels
// 3-d cockpit description
// N-pit
// Last change May 17 2007
// by Nanard// Boresight cross height
boresighty 0.75;// Shared render to texture target size. width height depth. depth needs to be 32 for texture alpha to work default is primary
rttTarget 512 512 16;// 3-d coords for Upper left. Upper Right and Lower Left // Rtt Top. Left. Right. Bottom. BlendMode. Alpha
// BlendModes are a = alpha blending. c = color blending. g = texture gouraud. t = texture. default = g
// example hud with 0.5 vertex alpha: hud 20.0 -2.0 0.0 20.0 2.0 0.0 20.0 -2.0 4.0 5 5 260 260 a 0.5;
// first number is toward you / away from you
// second number is left and right + number is right. - number is left
// third number is up / down - number is up. + number is down
// 0. 0 is in the middle of the screen (apprxomiately)hud 20063.0 -2750.0 -618.0 20063.0 2750.0 -618.0 20063.0 -2750.0 4902.0 0 0 280 280 c;
pfl 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 281 0 481 70 c;
ded 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 281 71 481 141 c;
rwr 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 482 0 600 118 c;
mfdleft 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 375 375 600 600 c;
mfdright 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 375 145 600 370 c;
hms 20.063 -4.000 -4.000 20.063 4.000 -4.000 20.063 -4.000 4.000 0 314 286 600 c;