From bcaadac22ca8a7320a46644e8199ef333edce8e9 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 18 Nov 2020 02:06:42 -0500 Subject: core: Make use of [[nodiscard]] with the System class Given this is a central class, we should flag cases where the return value of some functions not being used is likely a bug. --- src/yuzu_cmd/yuzu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/yuzu_cmd/yuzu.cpp') diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 3a76c785f..14a23c71b 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -240,11 +240,11 @@ int main(int argc, char** argv) { system.CurrentProcess()->GetTitleID(), false, [](VideoCore::LoadCallbackStage, size_t value, size_t total) {}); - system.Run(); + void(system.Run()); while (emu_window->IsOpen()) { std::this_thread::sleep_for(std::chrono::milliseconds(1)); } - system.Pause(); + void(system.Pause()); system.Shutdown(); detached_tasks.WaitForAllTasks(); -- cgit v1.2.3 From 994f4977810749c0b597e7a7531a02d907967a68 Mon Sep 17 00:00:00 2001 From: comex Date: Sun, 22 Nov 2020 16:05:18 -0500 Subject: Overhaul EmuWindow::PollEvents to fix yuzu-cmd calling SDL_PollEvents off main thread EmuWindow::PollEvents was called from the GPU thread (or the CPU thread in sync-GPU mode) when swapping buffers. It had three implementations: - In GRenderWindow, it didn't actually poll events, just set a flag and emit a signal to indicate that a frame was displayed. - In EmuWindow_SDL2_Hide, it did nothing. - In EmuWindow_SDL2, it did call SDL_PollEvents, but this is wrong because SDL_PollEvents is supposed to be called on the thread that set up video - in this case, the main thread, which was sleeping in a busyloop (regardless of whether sync-GPU was enabled). On macOS this causes a crash. To fix this: - Rename EmuWindow::PollEvents to OnFrameDisplayed, and give it a default implementation that does nothing. - In EmuWindow_SDL2, do not override OnFrameDisplayed, but instead have the main thread call SDL_WaitEvent in a loop. --- src/yuzu_cmd/yuzu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/yuzu_cmd/yuzu.cpp') diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 3a76c785f..3c675ecb8 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -242,7 +242,7 @@ int main(int argc, char** argv) { system.Run(); while (emu_window->IsOpen()) { - std::this_thread::sleep_for(std::chrono::milliseconds(1)); + emu_window->WaitEvent(); } system.Pause(); system.Shutdown(); -- cgit v1.2.3 From 5bc4eabe36b7ef4dcd5ad8db1e944705655be432 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 27 Nov 2020 10:50:48 -0500 Subject: core: Eliminate remaining usages of the global system instance Removes all remaining usages of the global system instance. After this, migration can begin to migrate to being constructed and managed entirely by the various frontends. --- src/yuzu_cmd/yuzu.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/yuzu_cmd/yuzu.cpp') diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index ba6e89249..c2efe1ee6 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -25,7 +25,6 @@ #include "core/crypto/key_manager.h" #include "core/file_sys/registered_cache.h" #include "core/file_sys/vfs_real.h" -#include "core/gdbstub/gdbstub.h" #include "core/hle/kernel/process.h" #include "core/hle/service/filesystem/filesystem.h" #include "core/loader/loader.h" @@ -174,13 +173,13 @@ int main(int argc, char** argv) { return -1; } + auto& system{Core::System::GetInstance()}; + InputCommon::InputSubsystem input_subsystem; + // Apply the command line arguments Settings::values.gdbstub_port = gdb_port; Settings::values.use_gdbstub = use_gdbstub; - Settings::Apply(); - - Core::System& system{Core::System::GetInstance()}; - InputCommon::InputSubsystem input_subsystem; + Settings::Apply(system); std::unique_ptr emu_window; switch (Settings::values.renderer_backend.GetValue()) { -- cgit v1.2.3 From 10b0ab792681b27664030d53d8e1ff610d0010cf Mon Sep 17 00:00:00 2001 From: FearlessTobi Date: Sat, 19 Dec 2020 19:19:42 +0100 Subject: yuzu: Remove gdbstub configuration The gdbstub itself was removed with https://github.com/yuzu-emu/yuzu/pull/5028. This PR just removes the remaining gdb configuration code from the emulator and the UI. --- src/yuzu_cmd/yuzu.cpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'src/yuzu_cmd/yuzu.cpp') diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index c2efe1ee6..1ebc04af5 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -64,7 +64,6 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; static void PrintHelp(const char* argv0) { std::cout << "Usage: " << argv0 << " [options] \n" - "-g, --gdbport=NUMBER Enable gdb stub on port NUMBER\n" "-f, --fullscreen Start in fullscreen mode\n" "-h, --help Display this help and exit\n" "-v, --version Output version information and exit\n" @@ -96,8 +95,6 @@ int main(int argc, char** argv) { Config config; int option_index = 0; - bool use_gdbstub = Settings::values.use_gdbstub; - u32 gdb_port = static_cast(Settings::values.gdbstub_port); InitializeLogging(); @@ -116,26 +113,17 @@ int main(int argc, char** argv) { bool fullscreen = false; static struct option long_options[] = { - {"gdbport", required_argument, 0, 'g'}, {"fullscreen", no_argument, 0, 'f'}, - {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'v'}, - {"program", optional_argument, 0, 'p'}, {0, 0, 0, 0}, + {"fullscreen", no_argument, 0, 'f'}, + {"help", no_argument, 0, 'h'}, + {"version", no_argument, 0, 'v'}, + {"program", optional_argument, 0, 'p'}, + {0, 0, 0, 0}, }; while (optind < argc) { int arg = getopt_long(argc, argv, "g:fhvp::", long_options, &option_index); if (arg != -1) { switch (static_cast(arg)) { - case 'g': - errno = 0; - gdb_port = strtoul(optarg, &endarg, 0); - use_gdbstub = true; - if (endarg == optarg) - errno = EINVAL; - if (errno != 0) { - perror("--gdbport"); - exit(1); - } - break; case 'f': fullscreen = true; LOG_INFO(Frontend, "Starting in fullscreen mode..."); @@ -177,8 +165,6 @@ int main(int argc, char** argv) { InputCommon::InputSubsystem input_subsystem; // Apply the command line arguments - Settings::values.gdbstub_port = gdb_port; - Settings::values.use_gdbstub = use_gdbstub; Settings::Apply(system); std::unique_ptr emu_window; -- cgit v1.2.3 From 1b9e08ab7821815a7c2023e16c575b24d37049ba Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Thu, 24 Dec 2020 20:22:07 -0300 Subject: cmake: Always enable Vulkan Removes the unnecesary burden of maintaining separate #ifdef paths and allows us sharing generic Vulkan code across APIs. --- src/yuzu_cmd/yuzu.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/yuzu_cmd/yuzu.cpp') diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 1ebc04af5..2497c71ae 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -35,9 +35,7 @@ #include "yuzu_cmd/config.h" #include "yuzu_cmd/emu_window/emu_window_sdl2.h" #include "yuzu_cmd/emu_window/emu_window_sdl2_gl.h" -#ifdef HAS_VULKAN #include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h" -#endif #ifdef _WIN32 // windows.h needs to be included before shellapi.h @@ -173,13 +171,8 @@ int main(int argc, char** argv) { emu_window = std::make_unique(&input_subsystem, fullscreen); break; case Settings::RendererBackend::Vulkan: -#ifdef HAS_VULKAN emu_window = std::make_unique(&input_subsystem); break; -#else - LOG_CRITICAL(Frontend, "Vulkan backend has not been compiled!"); - return 1; -#endif } system.SetContentProvider(std::make_unique()); -- cgit v1.2.3 From a745d87971b2c9795e1b2c587bfe30b849b522fa Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sat, 2 Jan 2021 09:00:05 -0500 Subject: general: Fix various spelling errors --- src/yuzu_cmd/yuzu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/yuzu_cmd/yuzu.cpp') diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 2497c71ae..39e0d35aa 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -202,7 +202,7 @@ int main(int argc, char** argv) { const u16 loader_id = static_cast(Core::System::ResultStatus::ErrorLoader); const u16 error_id = static_cast(load_result) - loader_id; LOG_CRITICAL(Frontend, - "While attempting to load the ROM requested, an error occured. Please " + "While attempting to load the ROM requested, an error occurred. Please " "refer to the yuzu wiki for more information or the yuzu discord for " "additional help.\n\nError Code: {:04X}-{:04X}\nError Description: {}", loader_id, error_id, static_cast(error_id)); -- cgit v1.2.3 From e07540264dbda32c98c330fddf0fa5ec3393bd3d Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sun, 10 Jan 2021 01:10:36 -0500 Subject: yuzu_cmd: Silence unreferenced local variable warning --- src/yuzu_cmd/yuzu.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/yuzu_cmd/yuzu.cpp') diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 39e0d35aa..4faf62ede 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -95,8 +95,6 @@ int main(int argc, char** argv) { int option_index = 0; InitializeLogging(); - - char* endarg; #ifdef _WIN32 int argc_w; auto argv_w = CommandLineToArgvW(GetCommandLineW(), &argc_w); -- cgit v1.2.3