diff options
Diffstat (limited to 'src/yuzu_cmd/yuzu.cpp')
| -rw-r--r-- | src/yuzu_cmd/yuzu.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 512b060a7..3a76c785f 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp | |||
| @@ -23,12 +23,15 @@ | |||
| 23 | #include "common/telemetry.h" | 23 | #include "common/telemetry.h" |
| 24 | #include "core/core.h" | 24 | #include "core/core.h" |
| 25 | #include "core/crypto/key_manager.h" | 25 | #include "core/crypto/key_manager.h" |
| 26 | #include "core/file_sys/registered_cache.h" | ||
| 26 | #include "core/file_sys/vfs_real.h" | 27 | #include "core/file_sys/vfs_real.h" |
| 27 | #include "core/gdbstub/gdbstub.h" | 28 | #include "core/gdbstub/gdbstub.h" |
| 29 | #include "core/hle/kernel/process.h" | ||
| 28 | #include "core/hle/service/filesystem/filesystem.h" | 30 | #include "core/hle/service/filesystem/filesystem.h" |
| 29 | #include "core/loader/loader.h" | 31 | #include "core/loader/loader.h" |
| 30 | #include "core/settings.h" | 32 | #include "core/settings.h" |
| 31 | #include "core/telemetry_session.h" | 33 | #include "core/telemetry_session.h" |
| 34 | #include "input_common/main.h" | ||
| 32 | #include "video_core/renderer_base.h" | 35 | #include "video_core/renderer_base.h" |
| 33 | #include "yuzu_cmd/config.h" | 36 | #include "yuzu_cmd/config.h" |
| 34 | #include "yuzu_cmd/emu_window/emu_window_sdl2.h" | 37 | #include "yuzu_cmd/emu_window/emu_window_sdl2.h" |
| @@ -37,8 +40,6 @@ | |||
| 37 | #include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h" | 40 | #include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h" |
| 38 | #endif | 41 | #endif |
| 39 | 42 | ||
| 40 | #include "core/file_sys/registered_cache.h" | ||
| 41 | |||
| 42 | #ifdef _WIN32 | 43 | #ifdef _WIN32 |
| 43 | // windows.h needs to be included before shellapi.h | 44 | // windows.h needs to be included before shellapi.h |
| 44 | #include <windows.h> | 45 | #include <windows.h> |
| @@ -82,8 +83,8 @@ static void InitializeLogging() { | |||
| 82 | 83 | ||
| 83 | Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>()); | 84 | Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>()); |
| 84 | 85 | ||
| 85 | const std::string& log_dir = FileUtil::GetUserPath(FileUtil::UserPath::LogDir); | 86 | const std::string& log_dir = Common::FS::GetUserPath(Common::FS::UserPath::LogDir); |
| 86 | FileUtil::CreateFullPath(log_dir); | 87 | Common::FS::CreateFullPath(log_dir); |
| 87 | Log::AddBackend(std::make_unique<Log::FileBackend>(log_dir + LOG_FILE)); | 88 | Log::AddBackend(std::make_unique<Log::FileBackend>(log_dir + LOG_FILE)); |
| 88 | #ifdef _WIN32 | 89 | #ifdef _WIN32 |
| 89 | Log::AddBackend(std::make_unique<Log::DebuggerBackend>()); | 90 | Log::AddBackend(std::make_unique<Log::DebuggerBackend>()); |
| @@ -179,15 +180,16 @@ int main(int argc, char** argv) { | |||
| 179 | Settings::Apply(); | 180 | Settings::Apply(); |
| 180 | 181 | ||
| 181 | Core::System& system{Core::System::GetInstance()}; | 182 | Core::System& system{Core::System::GetInstance()}; |
| 183 | InputCommon::InputSubsystem input_subsystem; | ||
| 182 | 184 | ||
| 183 | std::unique_ptr<EmuWindow_SDL2> emu_window; | 185 | std::unique_ptr<EmuWindow_SDL2> emu_window; |
| 184 | switch (Settings::values.renderer_backend.GetValue()) { | 186 | switch (Settings::values.renderer_backend.GetValue()) { |
| 185 | case Settings::RendererBackend::OpenGL: | 187 | case Settings::RendererBackend::OpenGL: |
| 186 | emu_window = std::make_unique<EmuWindow_SDL2_GL>(system, fullscreen); | 188 | emu_window = std::make_unique<EmuWindow_SDL2_GL>(&input_subsystem, fullscreen); |
| 187 | break; | 189 | break; |
| 188 | case Settings::RendererBackend::Vulkan: | 190 | case Settings::RendererBackend::Vulkan: |
| 189 | #ifdef HAS_VULKAN | 191 | #ifdef HAS_VULKAN |
| 190 | emu_window = std::make_unique<EmuWindow_SDL2_VK>(system, fullscreen); | 192 | emu_window = std::make_unique<EmuWindow_SDL2_VK>(&input_subsystem); |
| 191 | break; | 193 | break; |
| 192 | #else | 194 | #else |
| 193 | LOG_CRITICAL(Frontend, "Vulkan backend has not been compiled!"); | 195 | LOG_CRITICAL(Frontend, "Vulkan backend has not been compiled!"); |
| @@ -229,21 +231,20 @@ int main(int argc, char** argv) { | |||
| 229 | } | 231 | } |
| 230 | } | 232 | } |
| 231 | 233 | ||
| 232 | system.TelemetrySession().AddField(Telemetry::FieldType::App, "Frontend", "SDL"); | 234 | system.TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend", "SDL"); |
| 233 | 235 | ||
| 234 | // Core is loaded, start the GPU (makes the GPU contexts current to this thread) | 236 | // Core is loaded, start the GPU (makes the GPU contexts current to this thread) |
| 235 | system.GPU().Start(); | 237 | system.GPU().Start(); |
| 236 | 238 | ||
| 237 | system.Renderer().Rasterizer().LoadDiskResources(); | 239 | system.Renderer().Rasterizer().LoadDiskResources( |
| 240 | system.CurrentProcess()->GetTitleID(), false, | ||
| 241 | [](VideoCore::LoadCallbackStage, size_t value, size_t total) {}); | ||
| 238 | 242 | ||
| 239 | std::thread render_thread([&emu_window] { emu_window->Present(); }); | ||
| 240 | system.Run(); | 243 | system.Run(); |
| 241 | while (emu_window->IsOpen()) { | 244 | while (emu_window->IsOpen()) { |
| 242 | std::this_thread::sleep_for(std::chrono::milliseconds(1)); | 245 | std::this_thread::sleep_for(std::chrono::milliseconds(1)); |
| 243 | } | 246 | } |
| 244 | system.Pause(); | 247 | system.Pause(); |
| 245 | render_thread.join(); | ||
| 246 | |||
| 247 | system.Shutdown(); | 248 | system.Shutdown(); |
| 248 | 249 | ||
| 249 | detached_tasks.WaitForAllTasks(); | 250 | detached_tasks.WaitForAllTasks(); |