mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-26 00:05:58 +03:00
[GH-ISSUE #882] [Linux] Once game starts, main UI stops responding #251
Labels
No labels
Bloodborne
bug
contributor wanted
documentation
enhancement
frontend
good first issue
help wanted
linux
pull-request
question
release
verification progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/shadPS4#251
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kavika13 on GitHub (Sep 12, 2024).
Original GitHub issue: https://github.com/shadps4-emu/shadPS4/issues/882
Once you launch the game, you can no longer interact with the main window. It stops painting. You can move it around, but that's it. If I hit the close button, it doesn't respond, and KDE asks if I want to terminate the app after a few seconds.
This makes it a little annoying to close the emulator, but it also makes it impossible right now to use the cheats feature.
Other people in discord seemed to have the same problem. This happens both if I build from source or if I run a recent AppImage from Actions (usually of someone else's fork or in a branch, because of problems with
new PthreadInternalunder Linux - but the problem still occurs exactly the same way, whether I apply that patch or not).@kavika13 commented on GitHub (Sep 20, 2024):
I poked around in the code a bit, and I believe this is due to the QT event loop and SDL event loop both being written so they block their thread in a loop, and both want to run on the main thread.
I think this could be fixed by pulling the SDL event dispatch code outside the loop, and making it callable directly from the QT app. The QT app could dispatch events to it and be happy, and the command line executable could have a loop and dispatch to that function and also be happy.
@rtwair commented on GitHub (Nov 22, 2024):
Same issue here... I wonder if there is a hack we can do in the meantime to pause the main game thread to ensure the UI is responsive and that SDL events are still processed properly without locking the UI thread? Eager to test out cheats.
@rtwair commented on GitHub (Dec 2, 2024):
@Hermiten, I’d classify this as a bug rather than an enhancement because certain functionalities, like cheats, can’t be utilized since the UI is unresponsive while the game is running
@C0rn3j commented on GitHub (Dec 19, 2024):
@kavika13 are you sure it's just freezing for you and not crashing a thread and hanging?
If it's dumping it would be a dupe of https://github.com/shadps4-emu/shadPS4/issues/1720 - which is newer, but it has a stack trace.
Could also now be dumping for you too if it was previously freezing, on the current codebase.
@morten71 commented on GitHub (Dec 20, 2024):
I'm having this problem too: The Qt app becomes unresponsive, the moment I start a game. I don't see a dump/crash until I close the game window.
I obviously don't understand much of what is going on, so I may be getting this completely wrong, but looking at the code I don't understand how it could behave otherwise:
The QT code at qt_gui/main_window.cpp:586 calls emulator.Run(path) which never returns. Because at src/emulator.cpp:277 the emulator enters the SDL event loop that never exits, until the emulation stops (when the game window is closed).
This seems to be the same conclusion kavika13 came to earlier.
Closing the game window I do get a crash, when the emulator.Run function exits the SDL event loop and ends up calling std::exit(0) without ever returning control to QT.
On the console I just end up getting:
And I haven't figured out how to get it running with gdb. When I try, I just get a completely different crash a lot earlier, while the game is starting, and the back trace is useless, with all ??? instead of function names, even though the executable does seem to contain debugging symbols (probably something simple I'm doing wrong, but like I said I don't understand much :D)
I'm attaching my shad_log.txt file
shad_log.txt
@ngoquang2708 commented on GitHub (Dec 20, 2024):
Try this https://github.com/shadps4-emu/shadPS4/pull/1829.
@morten71 commented on GitHub (Dec 20, 2024):
This fixes the problem. The QT app does not become unresponsive now. And I can get to the cheats list, and when I enable a cheat, I get
[Loader] <Info> memory_patcher.cpp:PatchMemory:398: Applied patch: Infinite Health, Offset: 38684034551, Value: C787F8000000FFFFFF7F90in the terminal.
The only thing now, is that when I try to close the game window, everything freezes. The game window does not close, and the game sound keeps playing. The SDL event loop does exit, and the UpdatePlayTime function gets called. I'm guessing the std::exit(0) call doesn't play well with running in a thread maybe?
But the QT app freezing problem is definitely solved by this :D
@kavika13 commented on GitHub (Dec 22, 2024):
The fix in PR #1829 solves the problem as initially stated in my original report. I can use cheats and the window is responsive.
There may need to be additional fixes for stuff like handling close events properly, but I think those already don't work super well, and I don't think PR #1829 makes that any worse. That statement could stand to be verified. But if it's accurate, I think it could be a separate ticket and PR to address those, even though I did mention them in my OP.