• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

VS2013 question

Messages
3
Hi guys, I have a couple of questions, maybe someone will be able to help. :)


I'm trying to start a gauge project from scratch on Visual Studio 2013 but I'm running into a problem getting the SDK style file structure to work.
I'm trying to create a multiguage project with a radio unit as the first subgauge. Following the SDK's sample structure I have the following files:

GaugeTest.rc
GaugeTest.h

GaugeTest.cpp:

Code:
#include "inc\fsxgauges_sp2.h"
#include "GaugeTest.h"

#include <stdio.h>
#include <cwchar>  
#include <math.h>

#define     _CRT_SECURE_NO_DEPRECATE
#define     _CRT_SECURE_NO_WARNINGS

#define  GAUGE_NAME  "Radio"
#define  GAUGEHDR_VAR_NAME  gaugehdr_radio
#define  GAUGE_W        100

#include "Radio.cpp"

GAUGE_TABLE_BEGIN()
   GAUGE_TABLE_ENTRY(&gaugehdr_radio)
GAUGE_TABLE_END()

and at the beginning of Radio.cpp I have:
Code:
char radio_gauge_name[]     = GAUGE_NAME;
extern PELEMENT_HEADER     radio_list;
extern MOUSERECT       radio_mouse_rect[];

GAUGE_HEADER_FS700(GAUGE_W, radio_gauge_name, &radio_list, radio_mouse_rect, 0, 0, 0, 0);

(etc...)

The problem is that in Radio.cpp all #define identifiers from fsxgauges_sp2.h and GaugeTest.h show as undefined, but the same structure on the SDK samples works. I thought the line #include "Radio.cpp" would make Radio.cpp "see" fsxgauges_sp2.h and GaugeTest.h. Maybe I'm missing some configuration settings?


Second questions:


Does anybody have the GDI+ code sample from http://msdn.microsoft.com/en-us/library/dd262188.aspx or know where can I download it? The link on the page says that "The Archive Gallery has been retired."

Thanks!
 
Hello SkyBaron,

make sure that the files are actually in the correct position, especially if you do actually have "fsxgauges_sp2.h" and it is in "inc" folder relative to a defined path.
Also don't cross-reference .cpp files within each other, this will lead to linker errors.
 
Tried this 8 years ago and always got lost. Bill can you post some good benefits C++ can do that XML can't do? I am watching this thread to see if a good tutorial or info is posted that might convince me to give it another try!
 
Tried this 8 years ago and always got lost. Bill can you post some good benefits C++ can do that XML can't do? I am watching this thread to see if a good tutorial or info is posted that might convince me to give it another try!

I went through the same troubles as you did, had lots of mega errors when I first dived into FS Development C++ (without prior experience). I would strongly encourage you to retry as C++ is way more powerful (and sometimes simpler - not all the time) than XML. The GDI+ Template is the best place you can start from btw, do not use the FSX SDK examples.
 
The inc directory was working fine, the problem was the #include "radio.cpp" part. I said was because I found the solution. I'll post it here in case somebody else( a beginner like myself) has the same problem. I had to go under the file Properties page and select "File Type" as "Does not participate in build." Doing this for every subgauges made them work like in the SDK's structure.
 
Ah, you could have simply not listed the radio.cpp in the Solution Explorer's window. Instead, simply right-click on the radio.cpp to open the file for editing.

But yes, if you do have it listed in the SE window, you do need to exclude it from the build, otherwise the silly thing will try to be #included twice!
 
Tried this 8 years ago and always got lost. Bill can you post some good benefits C++ can do that XML can't do? I am watching this thread to see if a good tutorial or info is posted that might convince me to give it another try!
The one major benefit is that if you have a lot of "glass" to create, many times the gauges will run faster and with less load on the sim.

Search FS Developer for a series of posts made by Virtuali in which he provided some excellent tips and tricks for C++/GDI+ gauge coding.
 
What did you mean by a lot of glass? And i am glad to hear that XML can do everything as i know it too well to jump into C++
 
Ed is quite correct. There are some things that XML simply cannot do at all, much less even "sort of"... :scratchch
 
Oh "a lot of glass" was just saying "glass gauges". Thanks!
I knew that xml can't do everything that C++ can do. So i asked Bill to post the difference to make sure on this question and he said C++ is much faster and i assumed there was no difference in what you can write.:scratchch

I have another question! I knew that my aircraft were mostly shared cockpit friendly. And according to Joe captain of the beta team and pilot says they are 100% fully shareable and he said that 99.9% of other aircraft are not fully shareable. So does XML have an advantage over C++ or other formats for shareable cockpits?:scratchch Or what makes my aircraft fully shareable and others not?
 
2 things. If the XML is done mostly using A vars only then there will be no problems. But the moment you start adding very advanced custom systems, especially where lots of L vars are being set every gauge cycle, the ">L:" causes a shared cockpit flooding that results in synchronization being lost.

Advanced systems in C++ however require a special external shared cockpit system. Not easy to code. However you can control what gets synchronized and what doesn't and you can also keep data transfers to a minimum by only sharing data when something changes. Overall....C++ is vastly superior in every way if you want full on realism in everything.
 
So does XML have an advantage over C++ or other formats for shareable cockpits?:scratchch

Actually is the other way. With C++ you can write custom switches code and make it shared using special functions that are not available in plain XML -yet .

Or what makes my aircraft fully shareable and others not?

Probably your switches/knobs/buttons are being commanded using FS standard events and A:Variables. If you program in XML (or C++ without shared_process functions) all of your switches/knobs/buttons operated via L:Vars switches won't be shared with the other aircraft, as none of custom user vars (L:, C:, G) are transmitted. A panel cycle of each one of the aircraft is processed individually and independent of the other.

Tom
 
2 things. the ">L:" causes a shared cockpit flooding that results in synchronization being lost.

Actually there is no interchange of custom user vars (L,C,G) between shared cockpit participants. Not even when the process is loaded. Any flood occurrence won't be produced by a panel synchronization, because there is none ;).

Tom
 
Tom, actually there is an interchange of L vars in XML IF the writing to the L var takes place in an xml gauge (eg 5 (>L:myvar, enum). Setting the L var inside the modeldef doesn't work if I recall correct. Setting it from a C gauge using set_named_variable_value also has no interchange. But within a XML gauge it does. I know this because John Cagle asked me to help solve the problems they were having with shared cockpit in the F-14X. Initially when they didn't have much going on it was fine but the more they added the more funny things started to happen in shared cockpit until they had to drop support for it. This was also encountered in the early days of the Milviz F-15E.
 
Tom, actually there is an interchange of L vars in XML IF the writing to the L var takes place in an xml gauge (eg 5 (>L:myvar, enum). Setting the L var inside the modeldef doesn't work if I recall correct. Setting it from a C gauge using set_named_variable_value also has no interchange. But within a XML gauge it does. I know this because John Cagle asked me to help solve the problems they were having with shared cockpit in the F-14X. Initially when they didn't have much going on it was fine but the more they added the more funny things started to happen in shared cockpit until they had to drop support for it. This was also encountered in the early days of the Milviz F-15E.

I guess it seems to be an interchange because both aircraft are running the same code. But in XML, if you code a switch to move via an LVar exclusively, switching one side won't make any reaction to the other.

Would be long and tedious to explain how shared cockpit works (at least the basics that I've tested and know), but I can summarize saying that, for example, if you rename a C172 aircraft to appear exactly the same as a B737 and use the 737 as the master, when you load the flight, appart from a funny "aircraft panels/gauges don't match, etc" or alike message, you'll get a nice view in your C172 flying at 35,000 ft and Mach 0.8 :cool:

In C++ set_named_variable of course has no interchange, you need a special process_shared function for this. Guys at P3D has gone one step beyond FSX and provided a couple of Panels functions:
- set_named_variable_value_sync
- set_named_variable_sync_enabled
that I haven't tested yet but could make life easier for shared cockpit coders.

I don't know what the problems of F-14X were, is it coded partially or entirely in XML?

Tom
 
Last edited:
I guess it seems to be an interchange because both aircraft are running the same code. But in XML, if you code a switch to move via an LVar exclusively, switching one side won't make any reaction to the other.

...
I don't know what the problems of F-14X were, is it coded partially or entirely in XML?

Tom

Uh...the point of a shared cockpit aircraft is that the gauges match along with the code. And when they do, the shared cockpit system will try to synchronize things when a var is written to. FSX is fussy in this respect in that it wants identical gauges through the whole system. Even to the custom userdata member of the gauge header if Im not wrong. In my attempts to have automatic serialization/deserialization using the GAUGE_HEADER_FS1000 system as described on the ACES blog, I ran into the problem because the pointer to the gauge object stored in the userdata member (as done in the ESP GDI+ example) didn't match on my computer with the one on the guy who was testing with me. I was forced to do my serialization/deserialization with the process_shared_event_out function but I abandoned this as too troublesome. Plan to use a totally custom networking system like the Leonardo Maddog and MJC Q400.

Mostly XML. John Cagle did use C++ for the ACLS and flight control system and other advanced stuff that XML couldn't do.
 
Last edited:
Back
Top