summaryrefslogtreecommitdiffstats
path: root/src/yuzu_cmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu_cmd')
-rw-r--r--src/yuzu_cmd/CMakeLists.txt18
-rw-r--r--src/yuzu_cmd/config.cpp2
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2.h2
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2_null.cpp51
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2_null.h26
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp33
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h2
-rw-r--r--src/yuzu_cmd/precompiled_headers.h6
-rw-r--r--src/yuzu_cmd/yuzu.cpp4
9 files changed, 115 insertions, 29 deletions
diff --git a/src/yuzu_cmd/CMakeLists.txt b/src/yuzu_cmd/CMakeLists.txt
index 7d8ca3d8a..19b1d258c 100644
--- a/src/yuzu_cmd/CMakeLists.txt
+++ b/src/yuzu_cmd/CMakeLists.txt
@@ -22,8 +22,11 @@ add_executable(yuzu-cmd
emu_window/emu_window_sdl2.h
emu_window/emu_window_sdl2_gl.cpp
emu_window/emu_window_sdl2_gl.h
+ emu_window/emu_window_sdl2_null.cpp
+ emu_window/emu_window_sdl2_null.h
emu_window/emu_window_sdl2_vk.cpp
emu_window/emu_window_sdl2_vk.h
+ precompiled_headers.h
yuzu.cpp
yuzu.rc
)
@@ -31,20 +34,21 @@ add_executable(yuzu-cmd
create_target_directory_groups(yuzu-cmd)
target_link_libraries(yuzu-cmd PRIVATE common core input_common)
-target_link_libraries(yuzu-cmd PRIVATE inih glad)
+target_link_libraries(yuzu-cmd PRIVATE inih::INIReader glad)
if (MSVC)
target_link_libraries(yuzu-cmd PRIVATE getopt)
endif()
-target_link_libraries(yuzu-cmd PRIVATE ${PLATFORM_LIBRARIES} SDL2 Threads::Threads)
+target_link_libraries(yuzu-cmd PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
create_resource("../../dist/yuzu.bmp" "yuzu_cmd/yuzu_icon.h" "yuzu_icon")
target_include_directories(yuzu-cmd PRIVATE ${RESOURCES_DIR})
-target_include_directories(yuzu-cmd PRIVATE ../../externals/Vulkan-Headers/include)
+target_link_libraries(yuzu-cmd PRIVATE Vulkan::Headers)
if (YUZU_USE_EXTERNAL_SDL2)
- target_compile_definitions(yuzu-cmd PRIVATE -DYUZU_USE_EXTERNAL_SDL2)
- target_include_directories(yuzu-cmd PRIVATE ${PROJECT_BINARY_DIR}/externals/SDL/include)
+ target_link_libraries(yuzu-cmd PRIVATE SDL2-static)
+else()
+ target_link_libraries(yuzu-cmd PRIVATE SDL2)
endif()
if(UNIX AND NOT APPLE)
@@ -55,3 +59,7 @@ if (MSVC)
include(CopyYuzuSDLDeps)
copy_yuzu_SDL_deps(yuzu-cmd)
endif()
+
+if (YUZU_USE_PRECOMPILED_HEADERS)
+ target_precompile_headers(yuzu-cmd PRIVATE precompiled_headers.h)
+endif()
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp
index 59f9c8e09..2c78e776c 100644
--- a/src/yuzu_cmd/config.cpp
+++ b/src/yuzu_cmd/config.cpp
@@ -15,7 +15,7 @@
#pragma clang diagnostic pop
#endif
-#include <inih/cpp/INIReader.h>
+#include <INIReader.h>
#include "common/fs/file.h"
#include "common/fs/fs.h"
#include "common/fs/path_util.h"
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.h b/src/yuzu_cmd/emu_window/emu_window_sdl2.h
index 90bb0b415..25c23e2a5 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2.h
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.h
@@ -89,3 +89,5 @@ protected:
/// yuzu core instance
Core::System& system;
};
+
+class DummyContext : public Core::Frontend::GraphicsContext {};
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_null.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_null.cpp
new file mode 100644
index 000000000..259192f3c
--- /dev/null
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_null.cpp
@@ -0,0 +1,51 @@
+// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <cstdlib>
+#include <memory>
+#include <string>
+
+#include <fmt/format.h>
+
+#include "common/logging/log.h"
+#include "common/scm_rev.h"
+#include "video_core/renderer_null/renderer_null.h"
+#include "yuzu_cmd/emu_window/emu_window_sdl2_null.h"
+
+#ifdef YUZU_USE_EXTERNAL_SDL2
+// Include this before SDL.h to prevent the external from including a dummy
+#define USING_GENERATED_CONFIG_H
+#include <SDL_config.h>
+#endif
+
+#include <SDL.h>
+
+EmuWindow_SDL2_Null::EmuWindow_SDL2_Null(InputCommon::InputSubsystem* input_subsystem_,
+ Core::System& system_, bool fullscreen)
+ : EmuWindow_SDL2{input_subsystem_, system_} {
+ const std::string window_title = fmt::format("yuzu {} | {}-{} (Vulkan)", Common::g_build_name,
+ Common::g_scm_branch, Common::g_scm_desc);
+ render_window =
+ SDL_CreateWindow(window_title.c_str(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
+ Layout::ScreenUndocked::Width, Layout::ScreenUndocked::Height,
+ SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
+
+ SetWindowIcon();
+
+ if (fullscreen) {
+ Fullscreen();
+ ShowCursor(false);
+ }
+
+ OnResize();
+ OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);
+ SDL_PumpEvents();
+ LOG_INFO(Frontend, "yuzu Version: {} | {}-{} (Null)", Common::g_build_name,
+ Common::g_scm_branch, Common::g_scm_desc);
+}
+
+EmuWindow_SDL2_Null::~EmuWindow_SDL2_Null() = default;
+
+std::unique_ptr<Core::Frontend::GraphicsContext> EmuWindow_SDL2_Null::CreateSharedContext() const {
+ return std::make_unique<DummyContext>();
+}
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_null.h b/src/yuzu_cmd/emu_window/emu_window_sdl2_null.h
new file mode 100644
index 000000000..35aee286d
--- /dev/null
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_null.h
@@ -0,0 +1,26 @@
+// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <memory>
+
+#include "core/frontend/emu_window.h"
+#include "yuzu_cmd/emu_window/emu_window_sdl2.h"
+
+namespace Core {
+class System;
+}
+
+namespace InputCommon {
+class InputSubsystem;
+}
+
+class EmuWindow_SDL2_Null final : public EmuWindow_SDL2 {
+public:
+ explicit EmuWindow_SDL2_Null(InputCommon::InputSubsystem* input_subsystem_,
+ Core::System& system, bool fullscreen);
+ ~EmuWindow_SDL2_Null() override;
+
+ std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override;
+};
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp
index 25948328c..9ed47d453 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp
@@ -12,12 +12,6 @@
#include "video_core/renderer_vulkan/renderer_vulkan.h"
#include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h"
-#ifdef YUZU_USE_EXTERNAL_SDL2
-// Include this before SDL.h to prevent the external from including a dummy
-#define USING_GENERATED_CONFIG_H
-#include <SDL_config.h>
-#endif
-
#include <SDL.h>
#include <SDL_syswm.h>
@@ -51,11 +45,6 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsyste
window_info.type = Core::Frontend::WindowSystemType::Windows;
window_info.render_surface = reinterpret_cast<void*>(wm.info.win.window);
break;
-#else
- case SDL_SYSWM_TYPE::SDL_SYSWM_WINDOWS:
- LOG_CRITICAL(Frontend, "Window manager subsystem Windows not compiled");
- std::exit(EXIT_FAILURE);
- break;
#endif
#ifdef SDL_VIDEO_DRIVER_X11
case SDL_SYSWM_TYPE::SDL_SYSWM_X11:
@@ -63,11 +52,6 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsyste
window_info.display_connection = wm.info.x11.display;
window_info.render_surface = reinterpret_cast<void*>(wm.info.x11.window);
break;
-#else
- case SDL_SYSWM_TYPE::SDL_SYSWM_X11:
- LOG_CRITICAL(Frontend, "Window manager subsystem X11 not compiled");
- std::exit(EXIT_FAILURE);
- break;
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND
case SDL_SYSWM_TYPE::SDL_SYSWM_WAYLAND:
@@ -75,14 +59,21 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsyste
window_info.display_connection = wm.info.wl.display;
window_info.render_surface = wm.info.wl.surface;
break;
-#else
- case SDL_SYSWM_TYPE::SDL_SYSWM_WAYLAND:
- LOG_CRITICAL(Frontend, "Window manager subsystem Wayland not compiled");
- std::exit(EXIT_FAILURE);
+#endif
+#ifdef SDL_VIDEO_DRIVER_COCOA
+ case SDL_SYSWM_TYPE::SDL_SYSWM_COCOA:
+ window_info.type = Core::Frontend::WindowSystemType::Cocoa;
+ window_info.render_surface = SDL_Metal_CreateView(render_window);
+ break;
+#endif
+#ifdef SDL_VIDEO_DRIVER_ANDROID
+ case SDL_SYSWM_TYPE::SDL_SYSWM_ANDROID:
+ window_info.type = Core::Frontend::WindowSystemType::Android;
+ window_info.render_surface = reinterpret_cast<void*>(wm.info.android.window);
break;
#endif
default:
- LOG_CRITICAL(Frontend, "Window manager subsystem not implemented");
+ LOG_CRITICAL(Frontend, "Window manager subsystem {} not implemented", wm.subsystem);
std::exit(EXIT_FAILURE);
break;
}
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h
index e39ad754d..9467d164a 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h
@@ -24,5 +24,3 @@ public:
std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override;
};
-
-class DummyContext : public Core::Frontend::GraphicsContext {};
diff --git a/src/yuzu_cmd/precompiled_headers.h b/src/yuzu_cmd/precompiled_headers.h
new file mode 100644
index 000000000..aabae730b
--- /dev/null
+++ b/src/yuzu_cmd/precompiled_headers.h
@@ -0,0 +1,6 @@
+// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "common/common_precompiled_headers.h"
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index dfe5a30ea..a80649703 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -34,6 +34,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"
+#include "yuzu_cmd/emu_window/emu_window_sdl2_null.h"
#include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h"
#ifdef _WIN32
@@ -317,6 +318,9 @@ int main(int argc, char** argv) {
case Settings::RendererBackend::Vulkan:
emu_window = std::make_unique<EmuWindow_SDL2_VK>(&input_subsystem, system, fullscreen);
break;
+ case Settings::RendererBackend::Null:
+ emu_window = std::make_unique<EmuWindow_SDL2_Null>(&input_subsystem, system, fullscreen);
+ break;
}
system.SetContentProvider(std::make_unique<FileSys::ContentProviderUnion>());