aboutsummaryrefslogtreecommitdiff
path: root/src/qt_common/game_list/worker.cpp
diff options
context:
space:
mode:
authorAlex <78863999+Sssnowyyy@users.noreply.github.com>2026-10-31 10:54:52 -0400
committerGitHub <noreply@github.com>2026-10-31 15:54:52 +0100
commitee2d55ee497c9467c8df82515165a21eac13fff5 (patch)
treecf30cc700b791838380f6f3019d70ceae4250dd0 /src/qt_common/game_list/worker.cpp
parent01423a2470ee8a604218c1a6d5a0be6769624078 (diff)
boot Pokopia past audio init (Switch 2 heap limits, aud:u 1, stpl:u) (#77)
* game_list: don't free the worker while it is processing events OnPopulatingCompleted runs a nested event loop from inside GameListWorker::ProcessEvents. If the directory watcher fires there, the repopulate destroys the worker while ProcessEvents is still on the stack and the next lock hits a freed mutex. Stop the worker synchronously but free it with deleteLater, and stop ProcessEvents once it has been replaced. Assisted-by: Claude Opus 5.5 (code changes, debugging and commit message) * Fix Switch 2 heap limits and game list reloads during emulation - SetHeapSize rejected heaps of 8 GiB or more (Switch 1's MainMemorySizeMax), so Switch 2 titles that size their heap from the 12 GiB layout (Pokopia asks for 9.5 GiB) got ResultInvalidSize and aborted with 2001-0101. Allow up to the memory the active layout provides. - Grow the 39-bit heap region from 8 to 16 GiB so such a heap fits. - Skip watcher-driven game list reloads while a game runs: Repopulate calls CreateFactories, which replaces content providers the running game reads (segfault in ContentProviderUnion::GetEntry). Stopping emulation already repopulates the list. Assisted-by: Claude Opus 5.5 (code changes, debugging and commit message) * nx2: answer aud:u 1 with an IAudioOutManager nn::audio::OpenAudioOut gets its manager from aud:u command 1 and calls OpenAudioOut through slot 1 of the returned object. The auto stub returned no object, so Pokopia jumped through a null vtable 5 s into boot and never got past its first frame. Assisted-by: Claude Opus 5.5 (code changes, debugging and commit message) * nx2: add a stpl:u (stream play) stub with a user service nn::streamplay::detail::GetUserService opens a session with stpl:u 0 and attaches a system event to the handle command 300 returns. The generic missing-service stub returned no session, so Pokopia's first nn::streamplay call jumped through null right after audio setup. Assisted-by: Claude Opus 5.5 (code changes, debugging and commit message)
Diffstat (limited to 'src/qt_common/game_list/worker.cpp')
-rw-r--r--src/qt_common/game_list/worker.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/qt_common/game_list/worker.cpp b/src/qt_common/game_list/worker.cpp
index 14afe2f276..d18f84089a 100644
--- a/src/qt_common/game_list/worker.cpp
+++ b/src/qt_common/game_list/worker.cpp
@@ -313,12 +313,18 @@ GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs_,
GameListWorker::~GameListWorker() {
this->disconnect();
- stop_requested.store(true);
- processing_completed.Wait();
+ Stop();
+}
+
+void GameListWorker::Stop() {
+ if (!stop_requested.exchange(true)) {
+ processing_completed.Wait();
+ }
}
void GameListWorker::ProcessEvents(GameListModel* model) {
- while (true) {
+ // An event may spin a nested event loop that replaces this worker, in which case stop.
+ while (model->current_worker.get() == this) {
std::function<void(GameListModel*)> func;
{
// Lock queue to protect concurrent modification.