mjrgh / PinballY

A table browser and launcher ("front end") for virtual pinball cabinets.
Other
47 stars 22 forks source link

VisualPinballX seems not to be closed clean #243

Closed mase76 closed 2 months ago

mase76 commented 2 months ago

Hi, I have the problem, that VisualPinballX seems not to be closed clean. VPinMame keeps running a few seconds more and does not store its settings. When I run VisualPinballX directly and close it with Alt+F4, VPinMame is closed directly and all settings are stored. I use the default system settings for VPX. My Cab runs on Windows7 64bit.

mjrgh commented 2 months ago

Check your Terminate By option for VPX and see if you have it set to Kill Process. If so, that would explain what you're seeing. Kill Process kills the process externally (like the name says), which doesn't give the game a chance to go through its normal exit procedures. Setting it to Close Window usually lets it close normally.

mase76 commented 2 months ago

No I left it to close as it was by default.

mjrgh commented 2 months ago

Hmm, it sounds like SOMEONE is killing the process before it has a chance to close normally. I don't think PinballY will do that unless you ask it to (by setting the Terminate By option to Kill Process), but maybe there's some outside case I'm not thinking of. You might try turning on the log options for Table Launch and Javascript, then go through a launch/exit sequence (one where you can verify that the game DIDN'T close correctly), and check the PinballY log to see what it says during the launch processing - look for anything that suggests that the game isn't closing normally.

Is there any chance you have any other software running that could be trying to terminate the VPX process?

VPinMame keeps running a few seconds more and does not store its settings.

Could you be more specific about what "VPInMame keeps running a few second more" means?

mase76 commented 2 months ago

No other software. When I close it via Alt+F4, everything works as it should. I wonder, why VPinMame is running a few seconds longer. I will have a look in the logs...

mase76 commented 2 months ago

I cannot see anything abnormal in the logfile. Here it is. I started PinballY, started the game and exited it again.

Montag, 16. September 2024, 22:43:02: Session started PinballY 1.1.0 (Beta 7), build 9973 (x64, 20240902-0159)

Checking for Javascript main script file C:\VPin\PinballY\scripts\main.js High score retrieval (init): VPinMAME NVRAM path is C:\VPin\VPinMAME\nvram High score retrieval (init): PinEMHi .ini file path is C:\VPin\PinballY\PINemHi\PINemHi.ini PinEMHi command line: "C:\VPin\PinballY\PINemHi\PINemHi.exe" -v High score retrieval (init): PinEMHi ini data loaded successfully High score retrieval (init): path for VP is C:\VPin\VPinMAME\nvram\ High score retrieval (init): path for FP is D:\Games\Future Pinball\fpRAM\ High score retrieval: getting high scores for Terminator 2 - Judgment Day NVRAM file search: determining NVRAM path for Terminator 2 - Judgment Day

Supports all Future Pinball-Games Top 10 Hiscores Supports 425 Visual Pinball-Games Supports 1240 Roms Compatible with Visual pinmame 3.0

        Written by Dna Disturber

PinEMHi command line: "C:\VPin\PinballY\PINemHi\PINemHi.exe" t2_l8.nv PinEMHi completed successfully; results:

GRAND CHAMPION AJA 150.000.000

TOP MARKSMEN 1) XAQ 90.000.000 2) DOC 70.000.000 3) JAS 50.000.000 4) JCS 30.000.000

NVRAM file search: determining NVRAM path for Terminator 2 - Judgment Day

  • Game is VP/VPX
  • Game has absolute NVRAM path; using path specified = C:\VPin\VPinMAME\nvram
  • Still no match; trying a fuzzy match on the friendly ROM names ++ Found a fuzzy match: t2_l8.nv ++ Found exactly one match - using it (t2_l8.nv)
  • NVRAM file t2_l8.nv exists

Table launch: Terminator 2 - Judgment Day, table file Terminator 2 - Judgment Day(Williams 1991)_Bigus(MOD)2.1, system Visual Pinball X

DOF: shutting down DOF client

TOP MARKSMEN 1) XAQ 90.000.000 2) DOC 70.000.000 3) JAS 50.000.000 4) JCS 30.000.000

NVRAM file search: determining NVRAM path for Terminator 2 - Judgment Day

  • Game is VP/VPX
  • Game has absolute NVRAM path; using path specified = C:\VPin\VPinMAME\nvram
  • Still no match; trying a fuzzy match on the friendly ROM names ++ Found a fuzzy match: t2_l8.nv ++ Found exactly one match - using it (t2_l8.nv)
  • NVRAM file t2_l8.nv exists

DOF: shutting down DOF client

Montag, 16. September 2024, 22:43:23: PinballY session ending

mjrgh commented 2 months ago

I wonder, why VPinMame is running a few seconds longer

I still don't exactly understand this part. Do you mean that some additional window is remaining on the screen longer, or some process in Task Manager is staying active longer, or .... ?

mjrgh commented 2 months ago

Also, could you be more precise about what "does not store its settings" means? How are you determining that? What settings is it not storing?

I can't really look into it unless I can reproduce it on my own machine, so I need to know the exact steps to get there.

mjrgh commented 2 months ago

One more question: if it sporadic/random, or 100% repeatable?

mase76 commented 2 months ago

It is 100% repeatable. All settings I make in the service menu, highscores, or remaining credits are not stored. Everything that goes into nvram. When I exit the game, I see the exiting table message on the playfield screen. But the VPinMame display and the sound stays a few seconds longer. When I press Alt+F4, the game and VPinMame stop simultanous and everything is stored as expected. The issue is similar to this one: https://github.com/vpinball/vpinball/issues/1897 I tried different tables, but tomorrow I will try some tables more.

mjrgh commented 2 months ago

Hmm... I wonder if it's timing out. PinballY will kill the process if it doesn't exit on its own within a few seconds after sending the Close commands. If you copy the command line that you find in the log into a CMD window and execute it manually, and then use Alt+F4 to exit from that session, do ANY of the windows stay open for more than a couple of seconds?

mase76 commented 2 months ago

I started the game with the command line. After that I cannot close the game via Alt+F4. There is no effect. But I can close it with Q. I tried exclusive Fullscreen, which is my default, and windowed mode. Both the same. So I think, PinballY does not close the game at all and terminates it after a few seconds. I am not at home to try, but there was a suggestion in vpforums, to set different exit keys in PBY and VPX.

mjrgh commented 2 months ago

Strange that it doesn't respond to Alt+F4, but that does seem like it would explain the unsaved changes problem. Maybe there's something in that game's scripts that's blocking the exit. If so I wonder if it might be better to try to get the author to just fix the script, rather than jury-rig some elaborate workaround with different keys or whatever, since that might just open up new problems with other games that would work properly with the normal exit procedures.

mase76 commented 2 months ago

The Alt+F4 issue is only with the GL version of VPX. The DX version closes. But the issue when launched via PBY is there with both versions. I am out of ideas.

mase76 commented 2 months ago

I changed the exit key in PBY to Q and now it works.

mjrgh commented 2 months ago

Great, glad you found a solution. I take it that your original setup was PBY Exit Game = Escape, and all default key settings in VPX, with Exit Game = Q?

mase76 commented 2 months ago

Yes, Q is default in VPX. I cannot set ESC there. Thx for your help.

mjrgh commented 2 months ago

I'm a bit surprised that changing the PinballY key to Q worked, because VPX treats Q and Escape as perfectly interchangeable unless you do one of two things: either change Exit Game to something other than Q, or check the VPX keys dialog checkbox for Disable Esc. So I'd think that changing PinballY from Esc to Q would have no effect at all since VPX ought to be treating Q and Esc exactly the same way - I mean, I just took a look at the VPX code, and it's literally line-for-line the same, with all of the conditions being essentially "If key == Esc or key == Q...".

So I still have no idea what was really going on causing the problem, but if it works, it works!