summaryrefslogtreecommitdiff
path: root/src/yuzu_cmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu_cmd')
-rw-r--r--src/yuzu_cmd/CMakeLists.txt2
-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.h2
-rw-r--r--src/yuzu_cmd/yuzu.cpp4
6 files changed, 85 insertions, 2 deletions
diff --git a/src/yuzu_cmd/CMakeLists.txt b/src/yuzu_cmd/CMakeLists.txt
index 7d8ca3d8a..774d026aa 100644
--- a/src/yuzu_cmd/CMakeLists.txt
+++ b/src/yuzu_cmd/CMakeLists.txt
@@ -22,6 +22,8 @@ add_executable(yuzu-cmd
22 emu_window/emu_window_sdl2.h 22 emu_window/emu_window_sdl2.h
23 emu_window/emu_window_sdl2_gl.cpp 23 emu_window/emu_window_sdl2_gl.cpp
24 emu_window/emu_window_sdl2_gl.h 24 emu_window/emu_window_sdl2_gl.h
25 emu_window/emu_window_sdl2_null.cpp
26 emu_window/emu_window_sdl2_null.h
25 emu_window/emu_window_sdl2_vk.cpp 27 emu_window/emu_window_sdl2_vk.cpp
26 emu_window/emu_window_sdl2_vk.h 28 emu_window/emu_window_sdl2_vk.h
27 yuzu.cpp 29 yuzu.cpp
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:
89 /// yuzu core instance 89 /// yuzu core instance
90 Core::System& system; 90 Core::System& system;
91}; 91};
92
93class 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 @@
1// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include <cstdlib>
5#include <memory>
6#include <string>
7
8#include <fmt/format.h>
9
10#include "common/logging/log.h"
11#include "common/scm_rev.h"
12#include "video_core/renderer_null/renderer_null.h"
13#include "yuzu_cmd/emu_window/emu_window_sdl2_null.h"
14
15#ifdef YUZU_USE_EXTERNAL_SDL2
16// Include this before SDL.h to prevent the external from including a dummy
17#define USING_GENERATED_CONFIG_H
18#include <SDL_config.h>
19#endif
20
21#include <SDL.h>
22
23EmuWindow_SDL2_Null::EmuWindow_SDL2_Null(InputCommon::InputSubsystem* input_subsystem_,
24 Core::System& system_, bool fullscreen)
25 : EmuWindow_SDL2{input_subsystem_, system_} {
26 const std::string window_title = fmt::format("yuzu {} | {}-{} (Vulkan)", Common::g_build_name,
27 Common::g_scm_branch, Common::g_scm_desc);
28 render_window =
29 SDL_CreateWindow(window_title.c_str(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
30 Layout::ScreenUndocked::Width, Layout::ScreenUndocked::Height,
31 SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
32
33 SetWindowIcon();
34
35 if (fullscreen) {
36 Fullscreen();
37 ShowCursor(false);
38 }
39
40 OnResize();
41 OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);
42 SDL_PumpEvents();
43 LOG_INFO(Frontend, "yuzu Version: {} | {}-{} (Null)", Common::g_build_name,
44 Common::g_scm_branch, Common::g_scm_desc);
45}
46
47EmuWindow_SDL2_Null::~EmuWindow_SDL2_Null() = default;
48
49std::unique_ptr<Core::Frontend::GraphicsContext> EmuWindow_SDL2_Null::CreateSharedContext() const {
50 return std::make_unique<DummyContext>();
51}
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 @@
1// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6#include <memory>
7
8#include "core/frontend/emu_window.h"
9#include "yuzu_cmd/emu_window/emu_window_sdl2.h"
10
11namespace Core {
12class System;
13}
14
15namespace InputCommon {
16class InputSubsystem;
17}
18
19class EmuWindow_SDL2_Null final : public EmuWindow_SDL2 {
20public:
21 explicit EmuWindow_SDL2_Null(InputCommon::InputSubsystem* input_subsystem_,
22 Core::System& system, bool fullscreen);
23 ~EmuWindow_SDL2_Null() override;
24
25 std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override;
26};
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:
24 24
25 std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override; 25 std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override;
26}; 26};
27
28class DummyContext : public Core::Frontend::GraphicsContext {};
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 @@
34#include "yuzu_cmd/config.h" 34#include "yuzu_cmd/config.h"
35#include "yuzu_cmd/emu_window/emu_window_sdl2.h" 35#include "yuzu_cmd/emu_window/emu_window_sdl2.h"
36#include "yuzu_cmd/emu_window/emu_window_sdl2_gl.h" 36#include "yuzu_cmd/emu_window/emu_window_sdl2_gl.h"
37#include "yuzu_cmd/emu_window/emu_window_sdl2_null.h"
37#include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h" 38#include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h"
38 39
39#ifdef _WIN32 40#ifdef _WIN32
@@ -317,6 +318,9 @@ int main(int argc, char** argv) {
317 case Settings::RendererBackend::Vulkan: 318 case Settings::RendererBackend::Vulkan:
318 emu_window = std::make_unique<EmuWindow_SDL2_VK>(&input_subsystem, system, fullscreen); 319 emu_window = std::make_unique<EmuWindow_SDL2_VK>(&input_subsystem, system, fullscreen);
319 break; 320 break;
321 case Settings::RendererBackend::Null:
322 emu_window = std::make_unique<EmuWindow_SDL2_Null>(&input_subsystem, system, fullscreen);
323 break;
320 } 324 }
321 325
322 system.SetContentProvider(std::make_unique<FileSys::ContentProviderUnion>()); 326 system.SetContentProvider(std::make_unique<FileSys::ContentProviderUnion>());