Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi to all,

I have the annoying problem that one of my add-ons deletes the GPS flightplan loaded into FSX default GPS after landing by sending an appropriate termination command to FSUIPC as soon as the gear touches down (according to the author).  Unfortunately many of my other add-ons rely heaviliy on that flight plan and therefore cease working as soon as the landing gear touches down, but, of course, I need them until  the end of the flight sim session. The author is working on a solution but meanwhile I need a workaround. So that's the reason for my rather peculiar question: is there a way to make FSUIPC to ignore the command of flight plan deletion it gets from a code to which the user of the program has no access? Maybe FSUIPC could subsitute the flight plan by another (identical one) as soon as the other is deleted? Or maybe the executing program can be tricked into thinking that the flight plan was deleted by sending an appropriate command back? Any help appreciated.

 

Best regards

draci

Posted
2 hours ago, draci said:

I have the annoying problem that one of my add-ons deletes the GPS flightplan loaded into FSX default GPS after landing by sending an appropriate termination command to FSUIPC as soon as the gear touches down (according to the author).  Unfortunately many of my other add-ons rely heaviliy on that flight plan and therefore cease working as soon as the landing gear touches down, but, of course, I need them until  the end of the flight sim session. The author is working on a solution but meanwhile I need a workaround. So that's the reason for my rather peculiar question: is there a way to make FSUIPC to ignore the command of flight plan deletion it gets from a code to which the user of the program has no access?

I assume you are talkng about EFB2?

How is it "deleting it" via FSUIPC? 

Do you mean deleting the actual file? Or simply removing it from use in the Sim?

If the latter, then I can only think it is telling the Sim to load a plan and not giving its name. I don't know if that removes the plan from the sim.

You could try logging in FSUIPC to see exactly what it does (Log IPC writes), but you will probably get a very large log. The offset to get the Sim to load a plan is:

 

0x0130    The current flight Plan path & file name (in UNC format if WideFS is in use).

This is a 256 byte area, but the actio is triggered by the one byte at 0x0130. Writes to offsets can be intercepted by Lua plug-ins then either dealt with or sent on.  This is by the library function event.intercept. You would need to check what istring s being sent to 0x0130, and just forward it on (i.e. do the write yourself via ipc.writeSTR) if it is a proper plan name which you want loading.

If it's the file being deleted then that must be happening directly, not via FSUIPC.

Pete

 

 

Posted

Thank you Pete, of course, your guess is right, it's EFB2 I guess the file is simply removed from use, so I will try to investigate the log file, thank you for pointing me in the right direction, I will report back.

draci

Posted
2 hours ago, draci said:

Thank you Pete, of course, your guess is right, it's EFB2 I guess the file is simply removed from use, so I will try to investigate the log file, thank you for pointing me in the right direction, I will report back.

I've just looked at the EFB2 forum. According to the EFB2 author's reply about this, it is removing the plan from the GPS only. It is not deleting the actual .PLN file. So the interception method I suggested above should work fine.

Pete

 

Posted

Sorry to bother you once again, but I don't have much experience when it comes to lua programming and I'm not at my FS Computer right now. Can you please quickly confirm that the following code does what I'm trying to achieve:


function flightplan(offset,value)
if value ~= "xxx" then ipc.writeSTR(offset,value) end
end

event.intercept(0x0130,"STR","flightplan")

 

where I replace XXX by the value which I can get from the FSUIPC logfile that EFB2 tries to write to the offset position 0x0130. The idea is to simply block the flightplan being deleted by EFB2 but still allow other add-ons to set any flightplan (and also the user via FSX menu).

I appreciate your help.

Best regards

draci

 

Posted

Nearly. You need the length parameter with type "STR", thus:

event.intercept(0x0130,"STR",256,"flightplan")

But then. in 

if value ~= "xxx" ...

you might be comparing all 256 chaaracters, not just the string till the end. I don't know how he is removing the plan from the GPS, but if it is by writing a null string, then it would be safer to test just the first character for zero, thus:

if string.byte(value, 1) ~= 0 then  ipc.writeSTR(offset,value) end

But please do first use the Log at the end of the flight BEFORE EFB removes the plan to see what it actually writes. I'm not sure how SimConnect handles null strings. Maybe he writes a bad filename and that does the trick. If so get back to me and we'll work out the next step.

Pete

 

Posted

Hi Pete,

 

log checked, lua.script tested successfully, it's in fact simply a null string being written. Thanks for your help and every thing you've done and are still doing for the community, we all owe you a lot.

 

draci

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.