• 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.

C to XML

That is precisely correct. You might note that I've used the symbol # as a flag to indicate that the number following is the number of elements I need in the dynamic array. I've found that some characters do not work well as custom flags (such as the ! character). :coffee:
Code:
        if (iInit == 0 && pgauge && pgauge->parameters)
            {
            ZeroMemory( scratch, MAX_PATH*sizeof(char) );
            strcpy_s(scratch, MAX_PATH, pgauge->parameters);
            comma = strrchr(scratch,'#'); // file path separate from number of sounds by the last # in the string
            if (NULL == comma) //comma not found, use default number of sounds
                {
                iMaxSounds = MAX_SOUNDS;
                }
            else
                {
                *comma = 0;
                iMaxSounds = atoi(comma+1);
                if (iMaxSounds <=0 || iMaxSounds > 1000 ) iMaxSounds = MAX_SOUNDS;  //check for reasonable limits on number of sounds
                }

// stripped for brevity

            iInit = 1;
            }
 
Last edited:
some characters do not work well as custom flags (such as the ! character)
Maybe the exclamation point is not digested well by the panel.cfg parser because that is the character used as separator between the gauge file and the gauge object?
I wouldn't use also the comma and the '=' characters...I mean I'd stay away from any character used in the gaugeXX=blabla syntax...
What is nice is that all these details are extremely well UNdocumented! :)
 
I wouldn't use also the comma and the '=' characters...I mean I'd stay away from any character used in the gaugeXX=blabla syntax...
What is nice is that all these details are extremely well UNdocumented! :)
Note that my variable name of "comma" indicates that I was in fact trying to use a comma as a separator. That obviously didn't work and I was just too lazy to change the variable name to "poundsign"... :laughing:

Documents? Who needs 'em! Real programmers use EDLIN anyway! :duck:
 
variable name of "comma" indicates that I was in fact trying to use a comma as a separator.
So, assuming also the equal sign is "forbidden" then you were able to catch, in just one try, two of them out of three! That's 66%! :blackcat::)
EDLIN? :yikes: I hated it probably as much as I hate VI...
 
Sirs,
a small update on the topic: Thanks to the great help I received here, and some of my own time, I can now report that I was able to implement not only a gauge bridging CIVA SDK values to XML L:Vars, but also to develop one MSU and one CDU gauge which are identical, not only from the graphical point of view (quite easy since I used the very same BMPs the equivalent C++ gauge is using), but are also functionally. In fact you can hardly distinguish between the native C++ one from the "bridged" XML copy. There are very tiny differences in the way strings are rendered and I'm still fighting a bit with the transparency of few bitmaps which still have some "see through" pixels despite having been converted to 8 bit format and having set Transparent="No", but I think that I just need to waste few additional hours to correct these few last cosmetic details.
I'd have liked to show a couple of images but I have nowhere to upload them so you'll have to trust me ;)

One additional note is about performances. It is hardly believable, at least for me, that there is almost no lag between the native C++ gauges and the bridged XML ones. Once again I'd love to show a small video but, at least at the moment, I'm not able to upload it to any supported site so, again, you'll have to trust what I'm saying!

All the XML code I developed will be released within next CIVA package, as an example (it's VERY probably badly written, highly inefficient....but it works! :)), FREE as usual and by definition, and so, if any of you do care about seeing what has been achieved, you'll have a chance to try it yourself! Also if you would like to see it NOW, it would be my pleasure to provide you what's needed to run it (no, I'm not fooling you trying to get beta testers LOL).

So, to end this "endless" forum thread, I'd like to thank all members who helped me, Tom/taguilo "in primis", but also Heretic, WarpD, Vololiberista, n4gix, doug and all constructive contributors!

Thank You/Grazie for your priceless help!!!!
 
Marco,

Congratulations! Finally I was right when I told you that you'd write XML scripts sooner than you'd expect:stirthepo

Hope to see your work soon.

Tom
 
Argh, I'm stuck! :(

In an XML gauge, is there a way to execute a script or a macro when the gauge is executed?

Something similar to inserting some code under the PANEL_SERVICE_CONNECT_TO_WINDOW case of a main gauge callback routine (in a C/C++ gauge)?

Thanks!
 
Here is a method I use to execute a set of 'events' on first load of an XML "gauge" script. Note that it is simply run once based on the (L:T50_Init,bool) variable's condition. Also note that if the aircraft is reloaded, then this script will of course be run again since the variable is reinitialized to a FALSE state:

Code:
<GaugeName="T-50 Logic"Version="1.0">
  <Update Hidden="Yes">
    (L:T50_Init,bool) 0 ==
    if{
    2 (>L:FuelEngSelect, enum)
    (A:FUEL TANK SELECTOR:1,enum) 0 == if{ 0 (>L:FuelSelect, enum) }
    (A:FUEL TANK SELECTOR:1,enum) 3 == if{ 1 (>L:FuelSelect, enum) }
    (A:FUEL TANK SELECTOR:1,enum) 9 == if{ 2 (>L:FuelSelect, enum) }
    (A:FUEL TANK SELECTOR:1,enum) 2 == if{ 3 (>L:FuelSelect, enum) }
    46 (>L:RadioTuning, enum)
    34 (>L:RadioPower, enum)
    2 (>L:RadioSwitchBox, enum)
    1 (>L:T50_Init,bool)
    }
  </Update>
</Gauge>
 
Sirs,
a small update on the topic: Thanks to the great help I received here, and some of my own time, I can now report that I was able to implement not only a gauge bridging CIVA SDK values to XML L:Vars, but also to develop one MSU and one CDU gauge which are identical, not only from the graphical point of view (quite easy since I used the very same BMPs the equivalent C++ gauge is using), but are also functionally. In fact you can hardly distinguish between the native C++ one from the "bridged" XML copy. There are very tiny differences in the way strings are rendered and I'm still fighting a bit with the transparency of few bitmaps which still have some "see through" pixels despite having been converted to 8 bit format and having set Transparent="No", but I think that I just need to waste few additional hours to correct these few last cosmetic details.
I'd have liked to show a couple of images but I have nowhere to upload them so you'll have to trust me ;)

One additional note is about performances. It is hardly believable, at least for me, that there is almost no lag between the native C++ gauges and the bridged XML ones. Once again I'd love to show a small video but, at least at the moment, I'm not able to upload it to any supported site so, again, you'll have to trust what I'm saying!

All the XML code I developed will be released within next CIVA package, as an example (it's VERY probably badly written, highly inefficient....but it works! :)), FREE as usual and by definition, and so, if any of you do care about seeing what has been achieved, you'll have a chance to try it yourself! Also if you would like to see it NOW, it would be my pleasure to provide you what's needed to run it (no, I'm not fooling you trying to get beta testers LOL).

So, to end this "endless" forum thread, I'd like to thank all members who helped me, Tom/taguilo "in primis", but also Heretic, WarpD, Vololiberista, n4gix, doug and all constructive contributors!

Thank You/Grazie for your priceless help!!!!

I'd like to test it in the Super VC10. Have you done the ADEU units as well?
 
Hello Vololiberista,
Have you done the ADEU units as well?
No, not yet at least, and here is why: I think the ADEU cannot be done "as is" because it is not possible to pass a (possibly long) string (the shown filename) from C++ to XML.
So the only possible way would be for the XML gauge ITSELF to look for .AWC/.ADC files, parse them, and then send wp/dme coordinates to the C++ code through XML. I could possibly expose variables to set/define a waypoint or a DME station (lat, long), this would be simple.

But the question is: Can an XML gauge do a FindFirstFile/FindNextFile on a folder, let user select a filename, then read it and parse it?
I fear the answer is no....

EDIT: Solution would be to stick to provided ADEU(s) in the 2D panel...

Marco
 
XMLTools has a few handy utilities for read/write from/to file and string handling.
 
Marco,
But the question is: Can an XML gauge do a FindFirstFile/FindNextFile on a folder, let user select a filename, then read it and parse it?
I fear the answer is no....

Although it would be possible to use LOGGER class from XMLToos to read the file(s) and parse the data, I believe it won't be necessary for the 3D ADEU unit placed in VC. This one only needs to accept user inputs for previous/next file, read and cancel, passing proper LVars to a "hidden" C++ ADEU gauge in VC, which would be doing the tough work -selecting/loading the file and interpreting the data.
The only issue to solve is how to display file names on the 3D, modeldef.xml as this file doesn't suppor Custom (C: ) vars like those from XMLVars class. Perhaps would be necessary to let the C++ VC's ADEU be not so hidden and have a display area that could be mapped to a VCockpit section.

EDIT: Solution would be to stick to provided ADEU(s) in the 2D panel...

Yep...2D panels can still render the original ADEU gauge.

Tom
 
Haaaaa-hahahaha! Good one!
(Rule #5 in MSFS development: There are NEVER any volunteers.)
Heretic, LOL, I'm NOT looking for developers working for me and providing me "free gauges". In the next CIVA package I'll add the C<->XML bridging gauges and documentation about supported vars, I'm NOT going to provide ready-made XML gauges (except the two I developed for fun included as [badly written] examples). I'm doing this to let others integrate CIVA in VCs, if they want/like, of course. Nothing less, nothing more.
So those willing to have, for example, within a VC, a 3D ADEU, will have to develop it by themselves. Finding one (call it a volunteer, call it someone interested, call it as you want) NOW would've made me available (as a volunteer, so rule #5 is false :p and BTW which are the other 4 rules?) to provide him the required interface to make it possible.
But again, please, do not even think I'm trying to steal time/work from others because I'm not such kind of person.
 
This one only needs to accept user inputs for previous/next file, read and cancel, passing proper LVars to a "hidden" C++ ADEU gauge in VC, which would be doing the tough work -selecting/loading the file and interpreting the data.
The only issue to solve is how to display file names on the 3D, modeldef.xml
Exactly. It is possible to implement "goto next file", "goto prev. file", the problem is forwarding the name of the file...
Perhaps would be necessary to let the C++ VC's ADEU be not so hidden and have a display area that could be mapped to a VCockpit section
My knowledge is zero in this area so I can only guess that this is a work to be done by who is modeling/building the VC. If a C++ gauge including only a transparent rectangle containing the "rendered" filename string could be useful I can do that!
EDIT: Would such gauge be then also able to intercept mouse clicks for prev/next?
 
Correct me if I'm wrong but, when using 24 bit BMPs in gauges, I found transparency cannot be DISabled in XML, while in C/C++ it is sufficient to avoid specifying "IMAGE_USE_TRANSPARENCY". Is this true or was I unable to disable transparency in XML?

BTW I solved the problem by developing a small program which scans a 24bit BMP and convert any 0,0,0 pixel to 2,2,2 so it's no longer a problem for me but still I'd like to understand if such limitation exists or it's me being unable to disable transparency.

Thank you!
 
My knowledge is zero in this area so I can only guess that this is a work to be done by who is modeling/building the VC

That's correct.

If a C++ gauge including only a transparent rectangle containing the "rendered" filename string could be useful I can do that!

Is the idea. If you could post an image of a real aircraft showing an ADEU unit on its panel, I could give you an example on how to design the interface.

Tom

EDIT: Regarding XML transparency, I guess the <Image> property "Transparent=No" should work...
 
Back
Top