Archived

This topic is now archived and is closed to further replies.

Guest _ak

fs9gps in C/C++ gauges

Recommended Posts

I have searched for a while and found several code piecesFor example PCSTRINGZ str;execute_calculator_code("(C:fs9gps:FlightPlanTitle,string)",NULL,NULL,&str);But it always return "0." string in both FS9 and FSX, also tryed several other variabled and got zeroes all the times. FLight plan was loaded of course.What I need is a reliable way to extract flight plan from GPS. In FS9 I use pGaugeCallback with GPS variables IDs in gpsprop.h file that was posted here long ago. Works well in FS9 but doesn't work in FSX, pGaugeCallback->GetPropertyValue(FS9GPS_FlightPlanWaypointsNumber, &wptCount) always returns zero.There is also the old way: GPS_INFO* gpsinfo = NULL; MODULE_VAR var; initialize_var_by_name (&var, GPS_INFO_PANEL_VARIABLE_NAME); gpsinfo = (GPS_INFO*)var.var_ptr;But it also gives NULL pointer sometimes.Can anyone help to deal with it?

Share this post


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

I have exactly the same trouble as in this topic http://forums.avsim.net/dcboard.php?az=sho...36864&mode=fullI tryed to make some simple XML gauge that should copy some values from C:fs9gps to L: variables, which I can read in C code.And I've got into trouble with strings copyingI can display a string by code%((@c:FlightPlanDepartureAirportIdent,string))%!s!But when I try to copy this value (@c:FlightPlanDepartureAirportIdent,string) (> L:FlightPlanDepartureAirportIdent,string)L:FlightPlanDepartureAirportIdent only get "0." value!Something simpler like 'test' (> L:TestVar,string) doesn't work either

Share this post


Link to post
Share on other sites

LVars don't support string assignments ie if you something like this:'test' (>L:MyVar,string) the content of L:MyVar will be 0.Only CustomVars (C: type) support strings, providing you enable string properties on your custom C++ DLL.Tom

Share this post


Link to post
Share on other sites

thank you for the answerIt seems chr and ord symbol by symbol is the only way :(

Share this post


Link to post
Share on other sites

FS9 had gps_export.dll in the Modules folder. FSX has no Modules folder, having moved all .dll files to the root FSX folder.Either copy/paste a copy of gps_export.dll to your root FSX folder, or create a Modules folder, place a copy of gps_export.dll there, then edit your dll.xml file to define and load it.

Share this post


Link to post
Share on other sites

It has nothing to do with gps_export.dllActually the old way works fine when you load a saved flight but doesn't when you create a new one.Managed to complete my job with callback interfaces in C++, had completely forgotten about ConvertStringToProperty call. FS9 and FSX have different IDs for variables and that's why it refused to work with FS9 hardcoded values in gpsprop.hStill have some issues, but minimal required functionality works well ;)

Share this post


Link to post
Share on other sites