Greetings. I am Legacy Importer tool developer and apparently reached the point where I need some help. Working on gauges conversion now, get some result but its really far away from the finish line.
As you know, 2D gauges does not work in legacy cockpits (because of bug probably and maybe will be fixed some day, but who knows). I see some mentions that XML gauge format still supported by engine, but I have decided to avoid it (we know that devs does not care about legacy stuff so it can be broken with any future update) and move to native gauges format - HTML.
I've started 2D gauges experiments about 2 weeks ago. For some reason, VCockpit method did not work for me. Maybe it's another legacy bug, or I did something wrong, tell me if you made it work. But VPainting did work - it is not supposed to be used for needles control, but it does use JS and have access to all sim variables, so good enough for my goal.
So I moved on and made HTML/CSS generator. That was easy part actually. Most problematic is JS code generator - complicated animation, FSX and MSFS sim variables differences, and especially expressions parsing - these things makes me dizzy.
Animation itself quite tricky, on top of that FSX and FS9 has has different XML formats. Currently only rotate/shift elements processed, but that enough for initial testing.
Linking variables not so simple task as it should be. If I use transformation solution like this one:
at least 50% of variables will be not read properly.
So I had to build a table of known variables which works fine but will take a lot of time until it will be completed:
Any thoughts how to make it more flexible, or maybe full list of available variables exists?
Last one is postfix expression parsing. Simple arithmetics like +-/* is not a problem. Expression with single argument (sin abs if-else) a bit complicated, 2-3 - haven't even tried to make it work so converter returns 0 in this case and gauge does not work.This Expression Operators table really helps.
So, this method looks promising even if doesn't work in 80% of cases =) I will continue on it and hope to reach at least 50% success level. You can test it in latest Legacy Importer version, any imported plane can be loaded - it's not required to use any other program functions like CFG split or AIR import. If some/all of gauges does not appear you may check JS files first - if at least single error happen, whole panel will be black out.
As you know, 2D gauges does not work in legacy cockpits (because of bug probably and maybe will be fixed some day, but who knows). I see some mentions that XML gauge format still supported by engine, but I have decided to avoid it (we know that devs does not care about legacy stuff so it can be broken with any future update) and move to native gauges format - HTML.
I've started 2D gauges experiments about 2 weeks ago. For some reason, VCockpit method did not work for me. Maybe it's another legacy bug, or I did something wrong, tell me if you made it work. But VPainting did work - it is not supposed to be used for needles control, but it does use JS and have access to all sim variables, so good enough for my goal.
So I moved on and made HTML/CSS generator. That was easy part actually. Most problematic is JS code generator - complicated animation, FSX and MSFS sim variables differences, and especially expressions parsing - these things makes me dizzy.
Animation itself quite tricky, on top of that FSX and FS9 has has different XML formats. Currently only rotate/shift elements processed, but that enough for initial testing.
Linking variables not so simple task as it should be. If I use transformation solution like this one:
(A:Wiskey compass indication degrees,degrees) -> SimVar.GetSimVarValue("Wiskey compass indication degrees", "degrees")
at least 50% of variables will be not read properly.
So I had to build a table of known variables which works fine but will take a lot of time until it will be completed:
Code:
case string hn when hn.Equals("(A:Delta Heading Rate,rpm)", StringComparison.InvariantCultureIgnoreCase):
return "parseFloat(-SimVar.GetSimVarValue(\"TURN INDICATOR RATE\", \"degree per second\")) * 60 / 360";
case string hn when hn.Equals("(A:Variometer rate,knots)", StringComparison.InvariantCultureIgnoreCase):
return "parseFloat(SimVar.GetSimVarValue(\"AIRCRAFT WIND Y\", \"knots\"))"; // TODO: fix rate
case string hn when hn.Equals("(A:Wiskey compass indication degrees,degrees)", StringComparison.InvariantCultureIgnoreCase):
return "parseFloat(SimVar.GetSimVarValue(\"PLANE HEADING DEGREES MAGNETIC\", \"degrees\"))";
Last one is postfix expression parsing. Simple arithmetics like +-/* is not a problem. Expression with single argument (sin abs if-else) a bit complicated, 2-3 - haven't even tried to make it work so converter returns 0 in this case and gauge does not work.This Expression Operators table really helps.
So, this method looks promising even if doesn't work in 80% of cases =) I will continue on it and hope to reach at least 50% success level. You can test it in latest Legacy Importer version, any imported plane can be loaded - it's not required to use any other program functions like CFG split or AIR import. If some/all of gauges does not appear you may check JS files first - if at least single error happen, whole panel will be black out.
Attachments
Last edited: