The International Simutrans Forum

 

Author Topic: Deleting a save minimizes Simutrans  (Read 736 times)

0 Members and 1 Guest are viewing this topic.

Offline Roboron

  • Devotee
  • *
  • Posts: 329
    • Las Galácticas Aventuras de Komoyo Diga
  • Languages: ES, EN
Deleting a save minimizes Simutrans
« on: October 15, 2020, 08:01:32 PM »
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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10822
  • Languages: De,EN,JP
Re: Deleting a save minimizes Simutrans
« Reply #1 on: October 16, 2020, 12:18:21 AM »
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.



« Last Edit: October 16, 2020, 12:50:41 AM by prissi »

Offline Roboron

  • Devotee
  • *
  • Posts: 329
    • Las Galácticas Aventuras de Komoyo Diga
  • Languages: ES, EN
Re: Deleting a save minimizes Simutrans
« Reply #2 on: October 17, 2020, 09:19:51 PM »
Thank you, this fix will be very appreciated by Steam users which rely on this for deleting gamesaves, when Cloud Save is enabled.

Offline Roboron

  • Devotee
  • *
  • Posts: 329
    • Las Galácticas Aventuras de Komoyo Diga
  • Languages: ES, EN
Re: Deleting a save minimizes Simutrans
« Reply #3 on: October 18, 2020, 09:23:09 AM »
Sorry, one more thing a user said:

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

Maybe this can help you improve the solution.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5695
  • Languages: EN, NO
Re: Deleting a save minimizes Simutrans
« Reply #4 on: October 21, 2020, 05:53:02 PM »
"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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10822
  • Languages: De,EN,JP
Re: Deleting a save minimizes Simutrans
« Reply #5 on: October 22, 2020, 03:01:34 AM »
Windows doc:
Quote
IFileOperation 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 ..

Offline Roboron

  • Devotee
  • *
  • Posts: 329
    • Las Galácticas Aventuras de Komoyo Diga
  • Languages: ES, EN
Re: Deleting a save minimizes Simutrans
« Reply #6 on: October 22, 2020, 09:30:59 AM »
Maybe 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.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5695
  • Languages: EN, NO
Re: Deleting a save minimizes Simutrans
« Reply #7 on: October 27, 2020, 07:12:32 PM »
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.

I 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.