diff options
Diffstat (limited to 'src/yuzu_cmd/yuzu.cpp')
-rw-r--r-- | src/yuzu_cmd/yuzu.cpp | 65 |
1 files changed, 22 insertions, 43 deletions
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 4f00c804d..982c41785 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -17,6 +17,7 @@ #include "common/logging/filter.h" #include "common/logging/log.h" #include "common/microprofile.h" +#include "common/nvidia_flags.h" #include "common/scm_rev.h" #include "common/scope_exit.h" #include "common/string_util.h" @@ -25,7 +26,7 @@ #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" #include "core/settings.h" @@ -35,9 +36,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 @@ -64,7 +63,6 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; static void PrintHelp(const char* argv0) { std::cout << "Usage: " << argv0 << " [options] <filename>\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,12 +94,8 @@ int main(int argc, char** argv) { Config config; int option_index = 0; - bool use_gdbstub = Settings::values.use_gdbstub; - u32 gdb_port = static_cast<u32>(Settings::values.gdbstub_port); InitializeLogging(); - - char* endarg; #ifdef _WIN32 int argc_w; auto argv_w = CommandLineToArgvW(GetCommandLineW(), &argc_w); @@ -116,26 +110,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<char>(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..."); @@ -168,32 +153,27 @@ int main(int argc, char** argv) { MicroProfileOnThreadCreate("EmuThread"); SCOPE_EXIT({ MicroProfileShutdown(); }); + Common::ConfigureNvidiaEnvironmentFlags(); + if (filepath.empty()) { LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified"); return -1; } - // 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()}; + auto& system{Core::System::GetInstance()}; InputCommon::InputSubsystem input_subsystem; + // Apply the command line arguments + Settings::Apply(system); + std::unique_ptr<EmuWindow_SDL2> emu_window; switch (Settings::values.renderer_backend.GetValue()) { case Settings::RendererBackend::OpenGL: - emu_window = std::make_unique<EmuWindow_SDL2_GL>(system, fullscreen, &input_subsystem); + emu_window = std::make_unique<EmuWindow_SDL2_GL>(&input_subsystem, fullscreen); break; case Settings::RendererBackend::Vulkan: -#ifdef HAS_VULKAN - emu_window = std::make_unique<EmuWindow_SDL2_VK>(system, fullscreen, &input_subsystem); + emu_window = std::make_unique<EmuWindow_SDL2_VK>(&input_subsystem); break; -#else - LOG_CRITICAL(Frontend, "Vulkan backend has not been compiled!"); - return 1; -#endif } system.SetContentProvider(std::make_unique<FileSys::ContentProviderUnion>()); @@ -223,7 +203,7 @@ int main(int argc, char** argv) { const u16 loader_id = static_cast<u16>(Core::System::ResultStatus::ErrorLoader); const u16 error_id = static_cast<u16>(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<Loader::ResultStatus>(error_id)); @@ -235,16 +215,15 @@ int main(int argc, char** argv) { // Core is loaded, start the GPU (makes the GPU contexts current to this thread) system.GPU().Start(); - system.Renderer().Rasterizer().LoadDiskResources(); + system.Renderer().ReadRasterizer()->LoadDiskResources( + system.CurrentProcess()->GetTitleID(), false, + [](VideoCore::LoadCallbackStage, size_t value, size_t total) {}); - std::thread render_thread([&emu_window] { emu_window->Present(); }); - system.Run(); + void(system.Run()); while (emu_window->IsOpen()) { - std::this_thread::sleep_for(std::chrono::milliseconds(1)); + emu_window->WaitEvent(); } - system.Pause(); - render_thread.join(); - + void(system.Pause()); system.Shutdown(); detached_tasks.WaitForAllTasks(); |