News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

Deleting a save minimizes Simutrans

Started by Roboron, October 15, 2020, 08:01:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Roboron

This bug was originally reported on Steam

OS: Windows 10 (not reproducible on linux)
pakset: pak128.german (not all paksets have this funcionality)
Other settings: Full screen

Steps to reproduce:
1. Open the game in fullscreen
2. Delete an existing save
This action minimizes the game (but it shouldn't).

When not in fullscreen, it seems like Simutrans loses the focus for a brief moment.

prissi

#1
You can enable this by setting show_delete_buttons = 1 in simuconf.tab

The minimisation is done by "SHFileOperationW" I have no idea why, because the confirmation flag is set to zero. Seems like a bug in windows. Another reson not to enable this feature.

I add a hacky workaround for this by retopping the active window. It will cause an ugly flickker and may not even work on other situations.




Roboron

Thank you, this fix will be very appreciated by Steam users which rely on this for deleting gamesaves, when Cloud Save is enabled.

Roboron

Sorry, one more thing a user said:

Quotethx, have read your simutrans forum post and since windows vista the SHFileOperation is replaced by IFileOperation

Maybe this can help you improve the solution.

Ters

"Replace" is not really a thing in Windows. Hardly anything has ever been removed from Windows in the last thirty years. There are too many unmaintained applications that are too important for big customers that rely on them for Microsoft to remove them, if they want to keep those customers.

prissi

Windows doc:
QuoteIFileOperation can only be applied in a single-threaded apartment (STA) situation. It cannot be used for a multithreaded apartment (MTA) situation. For MTA, you still must use SHFileOperation.
Since Simutrans uses Muthithreading (albeit not for file operations) this is more save and will stay forever. The I... operation may just display the progress dialog. I too fail to see why there is a need to add an extra windows function for the same thing every ten years. Maybe the old programmers got to lazy to read the documentations from their previous generation and just reinvent it again to earn their money ..

Roboron

Quote from: prissi on October 22, 2020, 03:01:34 AMMaybe the old programmers got to lazy to read the documentations from their previous generation and just reinvent it again to earn their money ..

We are talking about Microsoft here, that's what they do for a living.

Ters

Quote from: prissi on October 22, 2020, 03:01:34 AM
Windows doc:Since Simutrans uses Muthithreading (albeit not for file operations) this is more save and will stay forever.

Just because Simutrans uses multiple threads does not mean that it is a multithreaded apartment.

Quote from: prissi on October 22, 2020, 03:01:34 AMI too fail to see why there is a need to add an extra windows function for the same thing every ten years.
There are usually some slight differences. There is also a possibility in this case that they are slowly making an alternative Windows API to the old Win32 API, so that they can establish a parallel platform without all the legacy.