aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgivethesourceplox <272928635+givethesourceplox@users.noreply.github.com>2026-10-30 09:54:54 -0300
committergivethesourceplox <272928635+givethesourceplox@users.noreply.github.com>2026-10-30 09:54:54 -0300
commit9e4e58c8e54add0e9909de8a9cba2444d8314ee7 (patch)
tree1ddcdd9126a59e0dbf1e59688c49fb28a5c5db8b
parent6e7edd7462325ee18a0db6fdc29ff7698ac108cc (diff)
yuzu_cmd: raise the open file limit on macOS and Linux
Loose RomFS folders keep thousands of files open through the VFS cache. macOS shells default to 256, so title 1 stopped loading at "Too many open files". Raise it to 8192 like the Qt frontend and like the Windows path here already does. Assisted-by: Claude (Anthropic)
-rw-r--r--src/yuzu_cmd/yuzu.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index 3d9f50d4e5..70fd9090e3 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -4,6 +4,7 @@
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+#include <algorithm>
#include <atomic>
#include <iterator>
#include <fstream>
@@ -56,6 +57,10 @@
#include "yuzu_cmd/emu_window/emu_window_sdl3_vk.h"
#include "yuzu_cmd/nx2_sampler.h"
+#if defined(__unix__) || defined(__APPLE__)
+#include <sys/resource.h>
+#endif
+
#ifdef _WIN32
// windows.h needs to be included before shellapi.h
#include <windows.h>
@@ -262,6 +267,12 @@ extern "C" SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) {
// Raise the CRT's open-file limit like the Qt frontend: loose RomFS folders keep thousands of
// files open through the VFS cache.
_setmaxstdio(8192);
+#elif defined(__unix__) || defined(__APPLE__)
+ // Same for the open file limit (macOS shells default to 256).
+ if (struct rlimit rl; getrlimit(RLIMIT_NOFILE, &rl) == 0) {
+ rl.rlim_cur = std::min<rlim_t>(8192, rl.rlim_max);
+ setrlimit(RLIMIT_NOFILE, &rl);
+ }
#endif
Common::Log::Initialize();