akorb / SteamShutdown

Automatic shutdown after Steam download(s) has finished.
MIT License
362 stars 28 forks source link

Doesn't close the PC after the update list is finished #41

Closed caveman1996 closed 2 years ago

caveman1996 commented 3 years ago

I've been using this app for some times without a problem until now. I don't know when it began to do this but now the app doesn't close the PC when all the download has been done. Even the app knows that there is no download left to as it doesn't list any of it.

The only thing I've tried so far is to run the app with elevated privileges without any success.

What can I do? Thanks

akorb commented 3 years ago

Thanks for the report. Does this problem occur for each download or just sometimes?

Does it also happen with this version of SteamShutdown https://github.com/akorb/SteamShutdown/releases/tag/v2.3.4 ?

Mr-nUUb commented 3 years ago

Hello! It won't shutdown my PC, too. It looks like the download states are never refreshed, even after cleaning the download history all titles stay in the SteamShutdown menu. I use version 2.3.8.

EDIT: all donwloads went to a secondary library, could that be the issue?

caveman1996 commented 3 years ago

Sorry for the late answer. The version you've proposed doesn't work too. As @Mr-nUUb said, the download states stay the same, even after everything is downloaded correctly in Steam. I have multiple directory on different drive for my games. If I can I'll take a look at the code to see if I can help!

akorb commented 3 years ago

I'd appreciate if you could find a fix for this. I won't have time to dig into this for roughly two weeks. But some thoughts:

Idea 1: Events are detected correctly but processed incorrectly. Then this function would need to get changed: https://github.com/akorb/SteamShutdown/blob/85ad54606f208008b1bce898279e36b2514b2d7f/SteamShutdown/Steam_Events.cs#L41 Maybe the return in line 65 or line 69 is always hit.

Idea 2: The FileSystemWatcher does not detect changes in the acf files. Maybe Steam changed how it modifies the acf files, so maybe instead of deleting and creating a new file it modifies the existing file now (completely made up example). I tried to fix it with this commit ( https://github.com/akorb/SteamShutdown/commit/f0d5b6716271079accbd21db63e3b45a5cfc8606 ) but seems like it didn't fix the problem.

akorb commented 3 years ago

SteamShutdown.zip Can you please try this version and tell me if some message boxes were shown in a whole Download -> Shutdown cycle?

Mr-nUUb commented 3 years ago

Here's what I've got. image image

akorb commented 3 years ago

Thanks! And the PC is not shut down, right?

Mr-nUUb commented 3 years ago

Argh! I forgot one. image So I get a notification about pending shutdown, then I get this box. Shutdown is not performed.

Mr-nUUb commented 3 years ago

Well, shutdown is indeed performed when I click OK. I thought this was a test...

akorb commented 3 years ago

Oh, sorry, yes, the shutdown is still performed to check if the way the program shuts down the PC actually works, what seems to be the case. Therefore, I created a version which does not shut down the PC but only shows the message box. SteamShutdown.zip

Does the shutdown always work now or was it a lucky hit?

Mr-nUUb commented 3 years ago

Yesterday it worked on first try, today with the same exe file: 0/3 successful shutdowns. There's no sotification about a pending shutdown, no messagebox, no real shutdown.

akorb commented 3 years ago

Thanks! So it seems to be about idea 2 of my previous post https://github.com/akorb/SteamShutdown/issues/41#issuecomment-903335155

Am I correct in assuming that the games were still listed by SteamShutdown after the downloads were complete?

Mr-nUUb commented 3 years ago

Yes, they were still listed.

akorb commented 3 years ago

Unfortuantely, I'm still not able to reproduce it on my machine. Can you please try this version? SteamShutdown.zip

I added a potential fix, and also another message box which might show up when it doesn't work.

TacoRaptor67 commented 3 years ago

I'm having the same issue, and the one you posted two days ago sadly didn't work either :( just tried it. Even after clearing the game from my downloads, it still shows up in the menu of SteamShutdown.

akorb commented 3 years ago

@TacoRaptor67 Thanks for your feedback!

I have a new theory why it does not work. Can you please execute the following version? SteamShutdown.zip

It will create a debugging.txt file on your desktop. Please share this file after the problem reappeared and let me know which game was still listed as downloading

CrysoK commented 3 years ago

It did nothing. The game was updated but did not disappear from SteamShutdown nor was the debugging.txt file created. Game: game After completing the update: after download It was the only game to update on Steam and the only one listed on SteamShutdown.

TacoRaptor67 commented 3 years ago

@TacoRaptor67 Thanks for your feedback!

I have a new theory why it does not work. Can you please execute the following version? SteamShutdown.zip

It will create a debugging.txt file on your desktop. Please share this file after the problem reappeared and let me know which game was still listed as downloading

Now this one worked for me, and successfully shutdown my PC after downloading a game (Beat Saber). Only thing is, it worked when the download had already started. As in I started the install, then launched the program, and I was able to click Beat Saber. I tried downloading a different game (Gang Beasts) while the program was running, and it wouldn't even show up in SteamShutdown's menu. So this debug is from the success on Beat Saber, but there wasn't one made when Gang Beasts downloaded (I'm assuming since it didn't detect it as downloading). debugging.txt

akorb commented 3 years ago

This problem seems to not occur always. Because between the last two versions I only added some logging and didn't change anything else. SteamShutdown.zip This versions shows a message box at start which displays the detected game library paths. Could you please check if they are valid and if all are detected? I also added a potential (but unlikely) fix. It's very hard because I can't reproduce it, sorry about that

Edit: I suspect that is has to do with where Steam is installed or where the game libraries are. Could you please share your installation path of steam and its game library paths? Maybe we can find the pattern which triggers the error and then, I might be able to reproduce it.

Edit 2: Did you reinstall Steam recently (within a few months)?

Edit 3: Are you on Windows 10?

CrysoK commented 3 years ago

The same as before (and with the same game). It was updated but did not disappear from SteamShutdown nor was the debugging.txt file created.

Message box at start: D:\Archivos de programa\Steam\SteamApps E:\Archivos de programa\Steam\SteamApps

Actual paths: D:\Archivos de programa\Steam\steamapps E:\Archivos de programa\Steam\steamapps (updated game is here) Steam: D:\Archivos de programa\Steam

I didn't reinstall Steam recently

OS: Windows 10 20H2

Edit: I'm installing another game on D to see if anything changes.

akorb commented 3 years ago

Thanks! If you check these folders in your Windows Explorer, these folders contain *.acf files, is this right?

CrysoK commented 3 years ago

Thanks! If you check these folders in your Windows Explorer, these folders contain *.acf files, is this right?

Yes, both contain *.acf files and only the one on D contains libraryfolders.vdf.

And the other game just downloaded, nothing changed.

akorb commented 3 years ago

SteamShutdown.zip I use FileSystemWatcher objects do detect file changes. Maybe they are destroyed for some reason. This version shows a message box with the text "Disposed" if this happens.

How long do your downloads run when you test? When I test, I choose small games which download takes only a few seconds. Maybe it has to do with longer downloads.

CrysoK commented 3 years ago

I updated another game (it took about 5 min). The "Disposed" message was not shown. Downloads range from minutes to hours, it depends a lot on the size because my connection is quite slow.

akorb commented 3 years ago

Does this problem also occur when you download a game from scratch, or only when you update a game?

CrysoK commented 3 years ago

Does this problem also occur when you download a game from scratch, or only when you update a game?

In both. The game I talked about here and at the end of this was not installed before.

I also checked the .acf files and the flag does change to 4.

akorb commented 3 years ago

SteamShutdown.zip

In this version I added way more logging to debugging.txt on the Desktop. Hopefully, we can track it down with this.