lanylow / genshin-utility

Utility tool for Genshin Impact and Honkai: Star Rail.
GNU General Public License v3.0
114 stars 13 forks source link

Fps unlocker/limiter doesn't work when out of focus #44

Open AnotherManOfCulture opened 11 months ago

AnotherManOfCulture commented 11 months ago

I've noticed that every time I press alt+tab in a few seconds the GPU starts consuming 100%, when I return to the game I notice that it was at 250+ fps and then it quickly goes back to the established limit.

This always happens when I use the utility, it's easily reproducible and I haven't found any way around it, even with vsync enabled the fps number still gets out of control in the background.

lanylow commented 11 months ago

Please try this and let me know if it works. It should limit your fps to 30 to limit resource usage when unfocused. library.zip

AnotherManOfCulture commented 11 months ago

Worked perfectly, thanks.

AnotherManOfCulture commented 10 months ago

I wondered if I should open a new issue, but I think it makes sense to reopen this one.

The implemented background frame limiter has a bug, sometimes it locks the game at 30fps even though the window is active. I see this happen when a dialog "cutscene" occurs, but the easiest way to reproduce this is at the new event.

Go to the event to shoot the Hilichurls, select any level and press alt+tab while the loading screen takes place. When you return to the game, it will be locked at 30 fps, only returning to normal when you leave the event and return to the open world.

Edit: I just noticed that the limiter doesn't work during certain types of "cutscene", when you press alt+tab in these scenes the fps goes up in the background again using the entire GPU, this happened in the dialog scenes also of the event mission, which involves the new character Chevreuse. I'll try to explain as best I can, but I'm referring to scenes where there's a zoom and a bit more expression on the characters' faces, where there are those changes in camera angle as the scene progresses, in which the limiter simply isn't working.

lanylow commented 10 months ago

Hello, I am not sure which event to go to, but there's one solution I could think of. Please let me know if it works. library.zip

AnotherManOfCulture commented 10 months ago

It didn't work, neither for the event nor for the cutscenes.

I'm referring to this event

Just go here

And talk to this NPC

You'll get to this screen, so just do as I said before, try starting the level, press alt+tab during the loading screen and it will lock at 30fps.

This event has a main mission, full of dialog, that dialog that has a dark transition before it starts, which is where you know it's going to be a cutscene, it's at that moment that the limiter simply stops working in background until the scene is over.

lanylow commented 10 months ago

In that case I'm afraid it's an issue with the Unity engine. I don't think I can come up with any other solution to this.

AnotherManOfCulture commented 10 months ago

The nvidia driver limiter doesn't work either, but the riva tuner seems to be able to keep the fps at the value I want even in the background, but I don't know if that helps at all and it's not the solution I'd like, after all it only solves half the problem.

Edit: Wouldn't there be a way to disable/separate the fps unlock function? In particular, I use it more for the FOV change, if the fps "module" were removed/disabled I imagine that these inconsistencies in the fps would stop occurring, right?