Sign in to follow this  
Guest _ak

How to make a popup gauge available in any aircraft?

Recommended Posts

I would like to make a popup gauge (I'm sure there is a better term) which is available in any aircraft. Examples would be FSFlightMax and FSBrowser. I've downloaded the panel SDK and compiled the samples. They have a flight map gauge which is a popup, but it is only available if you tweak the panel.cfg for every airplane. How do I make it available in all the airplanes?

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

You can't. Every panel.cfg must be edited manually to enable your custom popup...

Share this post


Link to post
Share on other sites

any idea how those other addons I mentioned do it then? How does FSBrowser make itself available in every plane?

Share this post


Link to post
Share on other sites

I think the examples you quote are FS modules. They are .dll's that are placed in the Modules folder and are loaded by FS when it loads. Gauges are very specific. While they are also, strictly speaking, .dll's, they are loaded through the FS panel routine and are thus only available when a panel containing them is loaded.Doug

Share this post


Link to post
Share on other sites

Ah ok. So I guess my next question should be how do I make modules (as opposed to gauges)?There is no "modules" SDK, or did I just miss it?

Share this post


Link to post
Share on other sites

As far as I know (please correct me if I'm wrong), here is my point:As you said, there is no module SDK (unfortunately), and developing a module is much more complex than developing a gauge. In addition, the SDK provides all the necessary tools to access the FS variables, and it is not the same for the modules. Accessing FS variables from a module DLL is not that easy, except if you use FSUIPC.Eric

Share this post


Link to post
Share on other sites

>Eric, it's possible without FSUIPC :)But is it easy? :) I'm a software engineer, so perhaps you could just point me in the right direction?

Share this post


Link to post
Share on other sites

Download the FSUIPC SDK. All of the offsets are listed there, so it IS possible to access the sim without using FSUIPC itself.Search back in this forum about five months ago for a discussion and examples of how to fetch data from FS via the offsets.

Share this post


Link to post
Share on other sites

>>Eric, it's possible without FSUIPC :)>>But is it easy? :) I'm a software engineer, so perhaps you>could just point me in the right direction?Yes, it's easy.In Gauges.h you can see following structure:

/* This is the module's import table.	*/				GAUGESIMPORT	ImportTable =					{										{ 0x0000000F, (PPANELS)NULL },					{ 0x00000000, NULL }				};

When FS loads module (including gauge) and see{ 0x0000000F, (PPANELS)NULL } entry, it fills it with some addresses.You can insert such in your module and after this you will able use lookup_var and other FS routines.

Share this post


Link to post
Share on other sites

This is interesting, but it doesn't work for me. I am not an expert in Windows programming and DLL development, so I'm sure I missed something here...When I include "Gauges.h", it makes a conflict with my own code because of a redifinition of the "Linkage" variable. In my code, it is defined like this:extern DLLEXPORT MODULE_LINKAGE Linkage = { 0x00000000, module_init, module_deinit, 0, 0, 0x0900, NULL};and it is already defined in "Gauges.h" like this:typedef struct GAUGESLINKAGE{ FSLINKAGE PGAUGEHDR gauge_header_ptr[];} GAUGESLINKAGE, *PGAUGESLINKAGE, **PPGAUGESLINKAGE;EXTERN_C DECLSPEC_EXPORT GAUGESLINKAGE Linkage;How can I make it work?I am very interested in being able to use the "lookup_var" function in my module.Thanks for your help !!Eric

Share this post


Link to post
Share on other sites

Eric,This interested me quite a bit too. What I did...Pasted this block of code, from GAUGES.H, into my sourcecode.c file: /* This is the module's import table. */ GAUGESIMPORT ImportTable = { { 0x0000000F, (PPANELS)NULL }, { 0x00000000, NULL } }; /* This is the module's export table. */ GAUGESLINKAGE Linkage = { 0x000002d9, module_init, module_deinit, 0, 0, FS9LINK_VERSION, {0} };I then used GAUGES.H as the header file for the module.Seems to work OK! If you have other stuff in your header file, try just commenting out your definition of ImportTable and Linkage, rather than eliminating the file altogether.Doug

Share this post


Link to post
Share on other sites

I already tried this, but then FS9 pops up a windws on startup, saying a module can not be loaded and will be disabled. If I load it, FS9 simply crashes. This is why I think the Linkage definition I have in my code is important.Eric

Share this post


Link to post
Share on other sites

Then you did domething wrongActually there is no difference between gauge and module in FS.Both are dlls and have Linkage and ImportTable exports

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this