Glenn Weston Posted April 19, 2015 Report Posted April 19, 2015 Hello Pete, Hope you had a nice break. I have stumbled upon some issues surrounding the ipc.display and ipc.setowndisplay functions in the Lua libraries running under P3D. Here is a simple script that will replicate the issue every time. n = ipc.elapsedtime() function DISPLAY_TEST() ipc.setowndisplay("FSUIPC has been running for "..n.." milliSeconds", 2, 40, 95, 10 ) DISPLAY() end function DISPLAY() n = ipc.elapsedtime() ipc.display("The current FSUIPC Elapased Time = "..n) end event.timer(1000, "DISPLAY_TEST") I am Currently running: Windows 7 64Bit Prepar3d Academic 2.5.12945.0 Simconnect 2.5.0.0 FSUIPC 4.939k What happens is when this script runs, it displays on screen fine and the display gets updated perfectly. Then after about 25 Seconds P3D Hangs and crashes to a White see though screen with dialog that says: Lockheed Martin Prepar3d has stopped working. A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available. I have to hit the "Close Program" Button and I am back to the desktop. Here is my FSUIPC.LOG file: ********* FSUIPC4, Version 4.939k by Pete Dowson *********Reading options from "C:\Program Files (x86)\Lockheed Martin\Prepar3D v2\Modules\FSUIPC4.ini"Running inside Prepar3D v2 on Windows 7Module base=644A0000User Name="Glenn Weston"User Addr=""FSUIPC4 Key is providedWideFS7 Key is provided 31 System time = 20/04/2015 00:26:04 31 FLT UNC path = "\\SIM01\Users\Glenn\Documents\Prepar3D v2 Files\" 31 Trying C:\Program Files (x86)\Lockheed Martin\Prepar3D v2\Modules\SimConnectP3D2.dll 31 Found it: trying to connect 31 FS UNC path = "\\SIM01\Prepar3D v2\" 343 LogOptions=00000000 00000001 343 --- CONTROLS timer memory location obtained ok 343 --- SIM1 Frictions access gained 343 --- FS Controls Table located ok 343 --- Installed Mouse Macro hooks ok. 343 --- Wind smoothing fix is fully installed 343 SimConnect_Open succeeded: waiting to check version okay 343 Trying to use SimConnect Prepar3D 6396 Running in "Lockheed Martin® Prepar3D® v2", Version: 2.5.12945.0 (SimConnect: 2.5.0.0) 6396 Initialising SimConnect data requests now 6396 FSUIPC Menu entry added 6427 \\SIM01\Users\Glenn\Documents\Prepar3D v2 Files\YSRI Ready F18.fxml 6427 \\SIM01\Prepar3D v2\SimObjects\Airplanes\VRS_FA-18E\FA-18E-6.8_SE.air 21918 System time = 20/04/2015 00:26:26, Simulator time = 12:30:07 (02:30Z) 22090 Aircraft="VFA-105 "Gunslingers" CAG" 22901 Starting everything now ... 22917 LUA.0: beginning "C:\Program Files (x86)\Lockheed Martin\Prepar3D v2\Modules\ipcReady.lua" 23931 LUA.0: ended "C:\Program Files (x86)\Lockheed Martin\Prepar3D v2\Modules\ipcReady.lua" 24336 Advanced Weather Interface Enabled Here are the details from the App Crash log in Windows: Faulting application name: Prepar3D.exe, version: 2.5.12945.0, time stamp: 0x55145f5eFaulting module name: g2d.dll, version: 2.5.12945.0, time stamp: 0x55145f43Exception code: 0xc0000005Fault offset: 0x0006360eFaulting process id: 0x764Faulting application start time: 0x01d07aacc332ad21Faulting application path: C:\Program Files (x86)\Lockheed Martin\Prepar3D v2\Prepar3D.exeFaulting module path: C:\Program Files (x86)\Lockheed Martin\Prepar3D v2\g2d.dllReport Id: c2d74726-e6a0-11e4-9c1c-fcaa1469df7b I have developed a fairly complex set of Lua Script modules to Interface to the TacPack VRS F/A-18 In these modules I make use of the Display functions extensively to give the user Feedback to see that Assignments have been made correctly and that things are working as they should be, at which point they would then disable the displays to fly normally. The Problem seems to be very sensitive to using repeat calls to the ipc.setowndisplay function within the same script, however I have seen the same crash happen from multiple displays on screen at the same time which are only using the ipc.display function calls, but that does not seem to be as sensitive as when re-calling the ipc.setowndisplay function within the same script. By the way this works perfectly under FSX, so it could be an LM issue rather than an FSUIPC Lua Library issue. The Crash has been reported by many users on different hardware platforms running P3D (Same Version as me) and FSUIPC (Same version as me) so I don't think it is Video driver related. I understand that the Faulting Module g2d.dll is something to do with 2D Graphics within P3D and is nothing to do with FSUIPC. I can also say that this can be replicated with the default aircraft in P3D so it is nothing to do with VRS' Model. As you can see FSUIPC does not even get to Log the problem so it is a pretty fast and serious crash. Anyhow I just wondered if I could bring it to your attention and see if there is any possible fix or should this lay in the hands of LM. Regards Glenn.
Pete Dowson Posted April 20, 2015 Report Posted April 20, 2015 What happens is when this script runs, it displays on screen fine and the display gets updated perfectly. Then after about 25 Seconds P3D Hangs and crashes to a White see though screen with dialog that says: Lockheed Martin Prepar3d has stopped working. Yes, I can reproduce it here too. But it is okay in FSX and FSX-SE. Do you know if it happened in earlier versions of P3D? I wonder whether the problem is because you are creating too many windows and overflowing the table allowed for them. Maybe when I close them in P3D their table entry isn't cleared down? I know it says you can use the setowndisplay more than once in a plug-in, but that was intended to allow the occasional need to re-size it or move it. But the real purpose was to allow separate plug-ins to have their own separate window, not recreated one every second. Doing that may be messing something up somewhere. (Why would you want to do it in any case?) If I rewrite your test example as: function DISPLAY()n = ipc.elapsedtime()ipc.display("The current FSUIPC Elapased Time = "..n)endn = ipc.elapsedtime()ipc.setowndisplay("FSUIPC has been running for "..n.." milliSeconds", 2, 40, 95, 10 )DISPLAY()event.timer(1000, "DISPLAY") then it seems okay, so I'm pretty sure it's the call to to close and create a new display all the time which is the problem.Of course you don't get the flashing or the title changing with the above method, if that's what you really wanted. Maybe on L-M (only) I shall have to prevent the use of setowndisplay more than once or twice. Pete P.S. It might be worth reporting to L-M if it is a new problem. They may just say I'm abusing the functions I'm calling, though.
Glenn Weston Posted April 20, 2015 Author Report Posted April 20, 2015 I wrote that example to demonstrate the problem as it would replicate the issue 100%. I knew that it was never a problem in FSX because many users of my script have been running it for some time in FSX. Also I have noticed even if it is not once every second, even at a much much less rate, it still crashes eventually, so I do not think it anything to do with timing or how fast it is recalled. I have a couple of scripts, but not many, that will change the window title during the course of the script, that is how I tracked it down. What does bother me is I have seen several scripts running together displaying windows that can also cause the crash too, and all those scripts only call the Ipc.setowndisplay function once. I could not reliably reproduce the crash that way, it seemed to be more random and I wanted to demonstrate it to you with with something that could reproduce it all the time, so I feel there is also some issue with even the Ipc.display function. I will do some more experimenting and see if I can get it to happen just with the ipc.display function and let you know. I have only just started using P3D so I have not used my scripts on anything prior to 2.5 unfortunately. I have also noticed when running the sample script that I supplied there is a very quick flash of a display at the top left of the screen before the correctly positioned window is displayed, this seems to happen every time the Ipc.setowndisplay function is called. Take another look and you will see it but it is very quick, don't blink....but that might give some clues too. Regards Glenn.
Pete Dowson Posted April 20, 2015 Report Posted April 20, 2015 Also I have noticed even if it is not once every second, even at a much much less rate, it still crashes eventually, so I do not think it anything to do with timing or how fast it is recalled. Just count the number of times you create and destroy the Window. I'm sure it must be related to that -- but the problem it occurring deep in P3D code. I can't fix it myself. If it is a serious problem for users I would just remove the option for a plug-in's own separate Window for P3D. What does bother me is I have seen several scripts running together displaying windows that can also cause the crash too, and all those scripts only call the Ipc.setowndisplay function once. Right. Well, it seems that the L-M display facility I'm using (and bear in mind it was found in FSX by experimentation and hacking into the code, so I can't really complain to L-M) is not designed for use the way we could in FSX. Maybe it is a bug, maybe it is due to the way they are trying to reduce VAS usage. I have also noticed when running the sample script that I supplied there is a very quick flash of a display at the top left of the screen before the correctly positioned window is displayed, this seems to happen every time the Ipc.setowndisplay function is called. Take another look and you will see it but it is very quick, don't blink....but that might give some clues too No, I think that's just the window appearing in its usual default position before the set position operates. It doesn't happen here, but my development PC is rather overloaded with other windows already. And it may be more obvious in full screen mode. It would be good if someone with an older version of P3D could check to see if it is a recent change in P3D. I might be able to find one in my archives. When I get time. Pete
Glenn Weston Posted April 20, 2015 Author Report Posted April 20, 2015 No problem Pete, Thankyou for taking the time to look at it ... much appreciated. I will keep you posted if I discover anything else. I had this strange feeling it was going to come down to maybe an LM issue. In saying that is there a possibility that in the future FSUIPC could have some Alternate live display facility, even if it was in a window outside of P3D itself. Something similar along the lines of the Display Library for WideClient , that could be written for the P3D host machine or is that a massive task that would not be worth undertaking. Glenn.
Pete Dowson Posted April 20, 2015 Report Posted April 20, 2015 Something similar along the lines of the Display Library for WideClient , that could be written for the P3D host machine or is that a massive task that would not be worth undertaking. I never did that for FSX because it wouldn't work in ints full screen mode, but it might with P3D because its full screen mode is, I think, just a borderless windowed mode (?). However, it can of course be done with WideClient. You need to set the ClassInstance parameter to a non-zero value, otherwise it won't run next to FS. Pete
mcp5500 Posted October 4, 2015 Report Posted October 4, 2015 Hi Pete, I am having the exact same problem, I am creating a Linda Lua script that is a menu display for the G1000 PFD. The idea is not to use the mouse to select options in the G1000. I am creating a new window. If i use ipc.setdisplay() 25 times in P2D v2.5 it hangs. I found a work around where i create the display once and put the Title Display line at line 0 using the ipc.display("Display line \n1 \n2,,,). How can i tell if another application created a display so i can then rectreat it again? thanks for your help Creating the display and then calling the text to fill it from other functions. its not complete but here is what i am talking about. function G1000_PFD_Main_Display() -- G1000 PFD: Menu Window Open and Menu Item Toggle: Use On-Press ipc.display("") ipc.sleep(500) if G1_Window == 0 and Main_Panel == 1 then -- Call G1000 Main Window ipc.setowndisplay("G1000 PFD Main Key Select", 45, 25, 10, 10) G1000SK = 0 G1_Window = 1 G1000_Main_Keys_Menu() G1_Window = 1 elseif G1_Window == 1 and Main_Panel == 1 then -- Call G1000 Main Panel Key Selection Window G1000_Main_Keys_Menu() --elseif G1_Window == 0 and PFDL1_PANEL == 1 then -- Call PFD Key Main Window --ipc.setowndisplay("G1000 PFD PFD SoftKey Select", 45, 25, 10, 10) --PFDSK_L1 = 0 --PFDL1_SoftKey_Menu () elseif G1_Window == 1 and PFDL1_PANEL == 1 then PFDL1_SoftKey_Menu () elseif G1_Window == 1 and FDFRMT_PANEL == 1 then FD_FRMT_Menu () elseif G1_Window == 1 and Wnd_Panel == 1 then PFD_Wind_Menu () elseif G1_Window == 1 and PFDALT_Panel == 1 then PFDALT_UNIT_Menu() --elseif G1_Window == 0 and INSET_Panel == 1 then -- Call PFD Key Main Window --ipc.setowndisplay("G1000 PFD: INSET SoftKey Select", 45, 25, 10, 10) --INSETv = 0 --INSET_SoftKey_Menu () elseif G1_Window == 1 and INSET_Panel == 1 then INSET_SoftKey_Menu () end I would need to detect a change to set G1_Window back to a 0. thanks
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now