summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.clang-format3
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/audio_core/CMakeLists.txt3
-rw-r--r--src/audio_core/renderer/command/command_buffer.cpp2
-rw-r--r--src/audio_core/renderer/command/mix/depop_prepare.cpp2
-rw-r--r--src/audio_core/renderer/effect/effect_info_base.h8
-rw-r--r--src/common/CMakeLists.txt3
-rw-r--r--src/common/alignment.h3
-rw-r--r--src/common/atomic_helpers.h5
-rw-r--r--src/common/detached_tasks.cpp5
-rw-r--r--src/common/detached_tasks.h5
-rw-r--r--src/common/error.cpp6
-rw-r--r--src/common/error.h6
-rw-r--r--src/common/fixed_point.h26
-rw-r--r--src/common/hash.h5
-rw-r--r--src/common/input.h5
-rw-r--r--src/common/logging/backend.cpp5
-rw-r--r--src/common/logging/backend.h5
-rw-r--r--src/common/logging/filter.cpp5
-rw-r--r--src/common/logging/filter.h5
-rw-r--r--src/common/logging/log.h5
-rw-r--r--src/common/logging/text_formatter.cpp5
-rw-r--r--src/common/logging/text_formatter.h5
-rw-r--r--src/common/microprofile.cpp5
-rw-r--r--src/common/microprofile.h5
-rw-r--r--src/common/microprofileui.h5
-rw-r--r--src/common/param_package.cpp5
-rw-r--r--src/common/param_package.h5
-rw-r--r--src/common/quaternion.h5
-rw-r--r--src/common/reader_writer_queue.h5
-rw-r--r--src/common/scm_rev.cpp.in5
-rw-r--r--src/common/scm_rev.h5
-rw-r--r--src/common/scope_exit.h5
-rw-r--r--src/common/telemetry.cpp5
-rw-r--r--src/common/telemetry.h5
-rw-r--r--src/common/threadsafe_queue.h2
-rw-r--r--src/common/uint128.h5
-rw-r--r--src/common/x64/native_clock.cpp2
-rw-r--r--src/common/x64/xbyak_abi.h5
-rw-r--r--src/common/x64/xbyak_util.h5
-rw-r--r--src/core/CMakeLists.txt6
-rw-r--r--src/core/arm/arm_interface.h5
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_cp15.cpp5
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_cp15.h5
-rw-r--r--src/core/core.cpp5
-rw-r--r--src/core/core.h5
-rw-r--r--src/core/core_timing.cpp151
-rw-r--r--src/core/core_timing.h25
-rw-r--r--src/core/file_sys/errors.h5
-rw-r--r--src/core/frontend/applets/software_keyboard.h2
-rw-r--r--src/core/frontend/emu_window.cpp5
-rw-r--r--src/core/frontend/emu_window.h5
-rw-r--r--src/core/hle/ipc.h5
-rw-r--r--src/core/hle/ipc_helpers.h5
-rw-r--r--src/core/hle/kernel/k_client_port.cpp5
-rw-r--r--src/core/hle/kernel/k_client_port.h5
-rw-r--r--src/core/hle/kernel/k_process.cpp5
-rw-r--r--src/core/hle/kernel/k_process.h5
-rw-r--r--src/core/hle/kernel/k_shared_memory.cpp5
-rw-r--r--src/core/hle/kernel/k_shared_memory.h5
-rw-r--r--src/core/hle/result.h5
-rw-r--r--src/core/hle/service/am/applets/applet_software_keyboard.cpp6
-rw-r--r--src/core/hle/service/hid/irs.cpp2
-rw-r--r--src/core/hle/service/hid/irs_ring_lifo.h47
-rw-r--r--src/core/hle/service/hid/irsensor/clustering_processor.cpp239
-rw-r--r--src/core/hle/service/hid/irsensor/clustering_processor.h38
-rw-r--r--src/core/hle/service/service.cpp7
-rw-r--r--src/core/loader/elf.cpp263
-rw-r--r--src/core/loader/elf.h36
-rw-r--r--src/core/loader/loader.cpp11
-rw-r--r--src/core/loader/loader.h1
-rw-r--r--src/core/memory.cpp5
-rw-r--r--src/core/memory.h5
-rw-r--r--src/core/perf_stats.cpp5
-rw-r--r--src/core/perf_stats.h5
-rw-r--r--src/core/telemetry_session.cpp5
-rw-r--r--src/core/telemetry_session.h5
-rw-r--r--src/input_common/CMakeLists.txt3
-rw-r--r--src/input_common/drivers/sdl_driver.cpp5
-rw-r--r--src/input_common/drivers/sdl_driver.h5
-rw-r--r--src/input_common/drivers/tas_input.cpp2
-rw-r--r--src/input_common/drivers/udp_client.cpp5
-rw-r--r--src/input_common/drivers/udp_client.h5
-rw-r--r--src/input_common/helpers/stick_from_buttons.cpp5
-rw-r--r--src/input_common/helpers/stick_from_buttons.h5
-rw-r--r--src/input_common/helpers/touch_from_buttons.cpp5
-rw-r--r--src/input_common/helpers/touch_from_buttons.h5
-rw-r--r--src/input_common/helpers/udp_protocol.cpp5
-rw-r--r--src/input_common/helpers/udp_protocol.h5
-rw-r--r--src/input_common/main.cpp5
-rw-r--r--src/input_common/main.h5
-rw-r--r--src/network/CMakeLists.txt3
-rw-r--r--src/shader_recompiler/CMakeLists.txt3
-rw-r--r--src/shader_recompiler/backend/spirv/spirv_emit_context.cpp5
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/logic_operation_three_input_lut3.py6
-rw-r--r--src/tests/CMakeLists.txt3
-rw-r--r--src/tests/common/bit_field.cpp5
-rw-r--r--src/tests/common/param_package.cpp5
-rw-r--r--src/tests/core/core_timing.cpp4
-rw-r--r--src/tests/tests.cpp5
-rw-r--r--src/video_core/CMakeLists.txt3
-rw-r--r--src/video_core/gpu_thread.cpp3
-rw-r--r--src/video_core/gpu_thread.h4
-rw-r--r--src/video_core/host_shaders/CMakeLists.txt3
-rw-r--r--src/video_core/host_shaders/StringShaderHeader.cmake3
-rw-r--r--src/video_core/host_shaders/source_shader.h.in3
-rw-r--r--src/video_core/host_shaders/vulkan_present_scaleforce_fp16.frag3
-rw-r--r--src/video_core/host_shaders/vulkan_present_scaleforce_fp32.frag3
-rw-r--r--src/video_core/renderer_base.cpp5
-rw-r--r--src/video_core/renderer_base.h5
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp5
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h5
-rw-r--r--src/video_core/renderer_opengl/gl_resource_manager.cpp5
-rw-r--r--src/video_core/renderer_opengl/gl_resource_manager.h5
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_util.cpp6
-rw-r--r--src/video_core/renderer_opengl/gl_shader_util.h5
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp5
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.h5
-rw-r--r--src/video_core/renderer_vulkan/maxwell_to_vk.cpp369
-rw-r--r--src/video_core/renderer_vulkan/maxwell_to_vk.h3
-rw-r--r--src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp2
-rw-r--r--src/video_core/renderer_vulkan/vk_pipeline_cache.cpp2
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp2
-rw-r--r--src/video_core/renderer_vulkan/vk_texture_cache.cpp12
-rw-r--r--src/video_core/surface.cpp5
-rw-r--r--src/video_core/surface.h5
-rw-r--r--src/video_core/video_core.cpp5
-rw-r--r--src/video_core/video_core.h5
-rw-r--r--src/video_core/vulkan_common/vulkan_device.cpp234
-rw-r--r--src/web_service/CMakeLists.txt3
-rw-r--r--src/web_service/telemetry_json.cpp5
-rw-r--r--src/web_service/telemetry_json.h5
-rw-r--r--src/web_service/verify_login.cpp5
-rw-r--r--src/web_service/verify_login.h5
-rw-r--r--src/web_service/web_backend.cpp5
-rw-r--r--src/web_service/web_backend.h5
-rw-r--r--src/yuzu/CMakeLists.txt3
-rw-r--r--src/yuzu/Info.plist6
-rw-r--r--src/yuzu/aboutdialog.ui2
-rw-r--r--src/yuzu/applets/qt_profile_select.cpp1
-rw-r--r--src/yuzu/applets/qt_software_keyboard.cpp37
-rw-r--r--src/yuzu/applets/qt_software_keyboard.h2
-rw-r--r--src/yuzu/applets/qt_software_keyboard.ui38
-rw-r--r--src/yuzu/bootmanager.cpp8
-rw-r--r--src/yuzu/bootmanager.h5
-rw-r--r--src/yuzu/compatdb.cpp5
-rw-r--r--src/yuzu/compatdb.h5
-rw-r--r--src/yuzu/configuration/config.cpp5
-rw-r--r--src/yuzu/configuration/config.h5
-rw-r--r--src/yuzu/configuration/configuration_shared.cpp5
-rw-r--r--src/yuzu/configuration/configuration_shared.h5
-rw-r--r--src/yuzu/configuration/configure_debug.cpp5
-rw-r--r--src/yuzu/configuration/configure_debug.h5
-rw-r--r--src/yuzu/configuration/configure_dialog.cpp5
-rw-r--r--src/yuzu/configuration/configure_dialog.h5
-rw-r--r--src/yuzu/configuration/configure_general.cpp5
-rw-r--r--src/yuzu/configuration/configure_general.h5
-rw-r--r--src/yuzu/configuration/configure_graphics.cpp5
-rw-r--r--src/yuzu/configuration/configure_graphics.h5
-rw-r--r--src/yuzu/configuration/configure_hotkeys.cpp5
-rw-r--r--src/yuzu/configuration/configure_hotkeys.h5
-rw-r--r--src/yuzu/configuration/configure_input.cpp5
-rw-r--r--src/yuzu/configuration/configure_input.h5
-rw-r--r--src/yuzu/configuration/configure_input_player.cpp5
-rw-r--r--src/yuzu/configuration/configure_input_player.h5
-rw-r--r--src/yuzu/configuration/configure_motion_touch.cpp5
-rw-r--r--src/yuzu/configuration/configure_motion_touch.h5
-rw-r--r--src/yuzu/configuration/configure_per_game_addons.cpp5
-rw-r--r--src/yuzu/configuration/configure_per_game_addons.h5
-rw-r--r--src/yuzu/configuration/configure_profile_manager.cpp5
-rw-r--r--src/yuzu/configuration/configure_profile_manager.h5
-rw-r--r--src/yuzu/configuration/configure_system.cpp5
-rw-r--r--src/yuzu/configuration/configure_system.h5
-rw-r--r--src/yuzu/configuration/configure_touch_from_button.cpp5
-rw-r--r--src/yuzu/configuration/configure_touch_from_button.h5
-rw-r--r--src/yuzu/configuration/configure_touch_widget.h5
-rw-r--r--src/yuzu/configuration/configure_touchscreen_advanced.cpp5
-rw-r--r--src/yuzu/configuration/configure_touchscreen_advanced.h5
-rw-r--r--src/yuzu/configuration/configure_ui.cpp5
-rw-r--r--src/yuzu/configuration/configure_ui.h5
-rw-r--r--src/yuzu/configuration/configure_web.cpp5
-rw-r--r--src/yuzu/configuration/configure_web.h5
-rw-r--r--src/yuzu/debugger/controller.cpp5
-rw-r--r--src/yuzu/debugger/controller.h5
-rw-r--r--src/yuzu/debugger/profiler.cpp5
-rw-r--r--src/yuzu/debugger/profiler.h5
-rw-r--r--src/yuzu/debugger/wait_tree.cpp5
-rw-r--r--src/yuzu/debugger/wait_tree.h5
-rw-r--r--src/yuzu/discord.h5
-rw-r--r--src/yuzu/discord_impl.cpp5
-rw-r--r--src/yuzu/discord_impl.h5
-rw-r--r--src/yuzu/game_list.cpp5
-rw-r--r--src/yuzu/game_list.h5
-rw-r--r--src/yuzu/game_list_p.h5
-rw-r--r--src/yuzu/hotkeys.cpp5
-rw-r--r--src/yuzu/hotkeys.h5
-rw-r--r--src/yuzu/loading_screen.cpp4
-rw-r--r--src/yuzu/main.cpp134
-rw-r--r--src/yuzu/main.h23
-rw-r--r--src/yuzu/uisettings.cpp5
-rw-r--r--src/yuzu/uisettings.h5
-rw-r--r--src/yuzu/util/sequence_dialog/sequence_dialog.cpp5
-rw-r--r--src/yuzu/util/sequence_dialog/sequence_dialog.h5
-rw-r--r--src/yuzu/util/util.cpp5
-rw-r--r--src/yuzu/util/util.h5
-rw-r--r--src/yuzu/yuzu.qrc5
-rw-r--r--src/yuzu/yuzu.rc3
-rw-r--r--src/yuzu_cmd/CMakeLists.txt3
-rw-r--r--src/yuzu_cmd/config.cpp5
-rw-r--r--src/yuzu_cmd/config.h5
-rw-r--r--src/yuzu_cmd/default_ini.h5
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2.cpp5
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2.h5
-rw-r--r--src/yuzu_cmd/yuzu.cpp5
-rw-r--r--src/yuzu_cmd/yuzu.rc3
216 files changed, 1377 insertions, 1227 deletions
diff --git a/src/.clang-format b/src/.clang-format
index 1c6b71b2e..f92771ec3 100644
--- a/src/.clang-format
+++ b/src/.clang-format
@@ -1,3 +1,6 @@
1# SPDX-FileCopyrightText: 2016 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2# SPDX-License-Identifier: GPL-2.0-or-later
3
1--- 4---
2Language: Cpp 5Language: Cpp
3# BasedOnStyle: LLVM 6# BasedOnStyle: LLVM
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9367f67c1..fc177fa52 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,3 +1,6 @@
1# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
1# Enable modules to include each other's files 4# Enable modules to include each other's files
2include_directories(.) 5include_directories(.)
3 6
diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt
index 2971c42a2..5fe1d5fa5 100644
--- a/src/audio_core/CMakeLists.txt
+++ b/src/audio_core/CMakeLists.txt
@@ -1,3 +1,6 @@
1# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
1add_library(audio_core STATIC 4add_library(audio_core STATIC
2 audio_core.cpp 5 audio_core.cpp
3 audio_core.h 6 audio_core.h
diff --git a/src/audio_core/renderer/command/command_buffer.cpp b/src/audio_core/renderer/command/command_buffer.cpp
index 40074cf14..2ef879ee1 100644
--- a/src/audio_core/renderer/command/command_buffer.cpp
+++ b/src/audio_core/renderer/command/command_buffer.cpp
@@ -339,7 +339,7 @@ void CommandBuffer::GenerateDepopPrepareCommand(const s32 node_id, const VoiceSt
339 cmd.previous_samples = memory_pool->Translate(CpuAddr(voice_state.previous_samples.data()), 339 cmd.previous_samples = memory_pool->Translate(CpuAddr(voice_state.previous_samples.data()),
340 MaxMixBuffers * sizeof(s32)); 340 MaxMixBuffers * sizeof(s32));
341 cmd.buffer_count = buffer_count; 341 cmd.buffer_count = buffer_count;
342 cmd.depop_buffer = memory_pool->Translate(CpuAddr(buffer.data()), buffer_count * sizeof(s32)); 342 cmd.depop_buffer = memory_pool->Translate(CpuAddr(buffer.data()), buffer.size_bytes());
343 343
344 GenerateEnd<DepopPrepareCommand>(cmd); 344 GenerateEnd<DepopPrepareCommand>(cmd);
345} 345}
diff --git a/src/audio_core/renderer/command/mix/depop_prepare.cpp b/src/audio_core/renderer/command/mix/depop_prepare.cpp
index 2ee076ef6..69bb78ccc 100644
--- a/src/audio_core/renderer/command/mix/depop_prepare.cpp
+++ b/src/audio_core/renderer/command/mix/depop_prepare.cpp
@@ -19,7 +19,7 @@ void DepopPrepareCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor
19 19
20void DepopPrepareCommand::Process(const ADSP::CommandListProcessor& processor) { 20void DepopPrepareCommand::Process(const ADSP::CommandListProcessor& processor) {
21 auto samples{reinterpret_cast<s32*>(previous_samples)}; 21 auto samples{reinterpret_cast<s32*>(previous_samples)};
22 auto buffer{std::span(reinterpret_cast<s32*>(depop_buffer), buffer_count)}; 22 auto buffer{reinterpret_cast<s32*>(depop_buffer)};
23 23
24 for (u32 i = 0; i < buffer_count; i++) { 24 for (u32 i = 0; i < buffer_count; i++) {
25 if (samples[i]) { 25 if (samples[i]) {
diff --git a/src/audio_core/renderer/effect/effect_info_base.h b/src/audio_core/renderer/effect/effect_info_base.h
index 43d0589cc..8c9583878 100644
--- a/src/audio_core/renderer/effect/effect_info_base.h
+++ b/src/audio_core/renderer/effect/effect_info_base.h
@@ -419,13 +419,13 @@ protected:
419 /// Workbuffers assigned to this effect 419 /// Workbuffers assigned to this effect
420 std::array<AddressInfo, 2> workbuffers{AddressInfo(CpuAddr(0), 0), AddressInfo(CpuAddr(0), 0)}; 420 std::array<AddressInfo, 2> workbuffers{AddressInfo(CpuAddr(0), 0), AddressInfo(CpuAddr(0), 0)};
421 /// Aux/Capture buffer info for reading 421 /// Aux/Capture buffer info for reading
422 CpuAddr send_buffer_info; 422 CpuAddr send_buffer_info{};
423 /// Aux/Capture buffer for reading 423 /// Aux/Capture buffer for reading
424 CpuAddr send_buffer; 424 CpuAddr send_buffer{};
425 /// Aux/Capture buffer info for writing 425 /// Aux/Capture buffer info for writing
426 CpuAddr return_buffer_info; 426 CpuAddr return_buffer_info{};
427 /// Aux/Capture buffer for writing 427 /// Aux/Capture buffer for writing
428 CpuAddr return_buffer; 428 CpuAddr return_buffer{};
429 /// Parameters of this effect 429 /// Parameters of this effect
430 std::array<u8, sizeof(InParameterVersion2)> parameter{}; 430 std::array<u8, sizeof(InParameterVersion2)> parameter{};
431 /// State of this effect used by the AudioRenderer across calls 431 /// State of this effect used by the AudioRenderer across calls
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 05fdfea82..a6dc31b53 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -1,3 +1,6 @@
1# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
1if (DEFINED ENV{AZURECIREPO}) 4if (DEFINED ENV{AZURECIREPO})
2 set(BUILD_REPOSITORY $ENV{AZURECIREPO}) 5 set(BUILD_REPOSITORY $ENV{AZURECIREPO})
3endif() 6endif()
diff --git a/src/common/alignment.h b/src/common/alignment.h
index 8570c7d3c..7e897334b 100644
--- a/src/common/alignment.h
+++ b/src/common/alignment.h
@@ -1,4 +1,5 @@
1// This file is under the public domain. 1// SPDX-FileCopyrightText: 2014 Jannik Vogel <email@jannikvogel.de>
2// SPDX-License-Identifier: CC0-1.0
2 3
3#pragma once 4#pragma once
4 5
diff --git a/src/common/atomic_helpers.h b/src/common/atomic_helpers.h
index 6d912b52e..bef5015c1 100644
--- a/src/common/atomic_helpers.h
+++ b/src/common/atomic_helpers.h
@@ -1,4 +1,7 @@
1// ©2013-2016 Cameron Desrochers. 1// SPDX-FileCopyrightText: 2013-2016 Cameron Desrochers
2// SPDX-FileCopyrightText: 2015 Jeff Preshing
3// SPDX-License-Identifier: BSD-2-Clause AND Zlib
4
2// Distributed under the simplified BSD license (see the license file that 5// Distributed under the simplified BSD license (see the license file that
3// should have come with this header). 6// should have come with this header).
4// Uses Jeff Preshing's semaphore implementation (under the terms of its 7// Uses Jeff Preshing's semaphore implementation (under the terms of its
diff --git a/src/common/detached_tasks.cpp b/src/common/detached_tasks.cpp
index ec31d0b88..da64848da 100644
--- a/src/common/detached_tasks.cpp
+++ b/src/common/detached_tasks.cpp
@@ -1,6 +1,5 @@
1// Copyright 2018 Citra Emulator Project 1// SPDX-FileCopyrightText: 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <thread> 4#include <thread>
6#include "common/assert.h" 5#include "common/assert.h"
diff --git a/src/common/detached_tasks.h b/src/common/detached_tasks.h
index 5dd8fc27b..416a2d7f3 100644
--- a/src/common/detached_tasks.h
+++ b/src/common/detached_tasks.h
@@ -1,6 +1,5 @@
1// Copyright 2018 Citra Emulator Project 1// SPDX-FileCopyrightText: 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/common/error.cpp b/src/common/error.cpp
index d4455e310..ddb03bd45 100644
--- a/src/common/error.cpp
+++ b/src/common/error.cpp
@@ -1,6 +1,6 @@
1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-FileCopyrightText: 2014 Citra Emulator Project
3// Refer to the license.txt file included. 3// SPDX-License-Identifier: GPL-2.0-or-later
4 4
5#include <cstddef> 5#include <cstddef>
6#ifdef _WIN32 6#ifdef _WIN32
diff --git a/src/common/error.h b/src/common/error.h
index e084d4b0f..62a3bd835 100644
--- a/src/common/error.h
+++ b/src/common/error.h
@@ -1,6 +1,6 @@
1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-FileCopyrightText: 2014 Citra Emulator Project
3// Refer to the license.txt file included. 3// SPDX-License-Identifier: GPL-2.0-or-later
4 4
5#pragma once 5#pragma once
6 6
diff --git a/src/common/fixed_point.h b/src/common/fixed_point.h
index 1d45e51b3..4a0f72cc9 100644
--- a/src/common/fixed_point.h
+++ b/src/common/fixed_point.h
@@ -1,28 +1,8 @@
1// SPDX-FileCopyrightText: 2015 Evan Teran
2// SPDX-License-Identifier: MIT
3
1// From: https://github.com/eteran/cpp-utilities/blob/master/fixed/include/cpp-utilities/fixed.h 4// From: https://github.com/eteran/cpp-utilities/blob/master/fixed/include/cpp-utilities/fixed.h
2// See also: http://stackoverflow.com/questions/79677/whats-the-best-way-to-do-fixed-point-math 5// See also: http://stackoverflow.com/questions/79677/whats-the-best-way-to-do-fixed-point-math
3/*
4 * The MIT License (MIT)
5 *
6 * Copyright (c) 2015 Evan Teran
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in all
16 * copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * SOFTWARE.
25 */
26 6
27#ifndef FIXED_H_ 7#ifndef FIXED_H_
28#define FIXED_H_ 8#define FIXED_H_
diff --git a/src/common/hash.h b/src/common/hash.h
index 298930702..b6f3e6d6f 100644
--- a/src/common/hash.h
+++ b/src/common/hash.h
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/common/input.h b/src/common/input.h
index 995c35d9d..213aa2384 100644
--- a/src/common/input.h
+++ b/src/common/input.h
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index b3793106d..8ce1c2fd1 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <atomic> 4#include <atomic>
6#include <chrono> 5#include <chrono>
diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h
index a0e80fe3c..12e5e2498 100644
--- a/src/common/logging/backend.h
+++ b/src/common/logging/backend.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp
index 6de9bacbf..a959acb74 100644
--- a/src/common/logging/filter.cpp
+++ b/src/common/logging/filter.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <algorithm> 4#include <algorithm>
6#include "common/logging/filter.h" 5#include "common/logging/filter.h"
diff --git a/src/common/logging/filter.h b/src/common/logging/filter.h
index 29419f051..54d172cc0 100644
--- a/src/common/logging/filter.h
+++ b/src/common/logging/filter.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/common/logging/log.h b/src/common/logging/log.h
index 0c80d01ee..c00c01a9e 100644
--- a/src/common/logging/log.h
+++ b/src/common/logging/log.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp
index b2cad58d8..09398ea64 100644
--- a/src/common/logging/text_formatter.cpp
+++ b/src/common/logging/text_formatter.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <array> 4#include <array>
6#include <cstdio> 5#include <cstdio>
diff --git a/src/common/logging/text_formatter.h b/src/common/logging/text_formatter.h
index 92c0bf0c5..0d0ec4370 100644
--- a/src/common/logging/text_formatter.h
+++ b/src/common/logging/text_formatter.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/common/microprofile.cpp b/src/common/microprofile.cpp
index ee25dd37f..e6657c82f 100644
--- a/src/common/microprofile.cpp
+++ b/src/common/microprofile.cpp
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5// Includes the MicroProfile implementation in this file for compilation 4// Includes the MicroProfile implementation in this file for compilation
6#define MICROPROFILE_IMPL 1 5#define MICROPROFILE_IMPL 1
diff --git a/src/common/microprofile.h b/src/common/microprofile.h
index 54e7f3cc4..91d14d5e1 100644
--- a/src/common/microprofile.h
+++ b/src/common/microprofile.h
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/common/microprofileui.h b/src/common/microprofileui.h
index 41abe6b75..39ed18ffa 100644
--- a/src/common/microprofileui.h
+++ b/src/common/microprofileui.h
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/common/param_package.cpp b/src/common/param_package.cpp
index 462502e34..629babb81 100644
--- a/src/common/param_package.cpp
+++ b/src/common/param_package.cpp
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <array> 4#include <array>
6#include <stdexcept> 5#include <stdexcept>
diff --git a/src/common/param_package.h b/src/common/param_package.h
index c13e45479..d7c13cb1f 100644
--- a/src/common/param_package.h
+++ b/src/common/param_package.h
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/common/quaternion.h b/src/common/quaternion.h
index 4d0871eb4..5bb5f2af0 100644
--- a/src/common/quaternion.h
+++ b/src/common/quaternion.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/common/reader_writer_queue.h b/src/common/reader_writer_queue.h
index 8d2c9408c..60c41a8cb 100644
--- a/src/common/reader_writer_queue.h
+++ b/src/common/reader_writer_queue.h
@@ -1,6 +1,5 @@
1// ©2013-2020 Cameron Desrochers. 1// SPDX-FileCopyrightText: 2013-2020 Cameron Desrochers
2// Distributed under the simplified BSD license (see the license file that 2// SPDX-License-Identifier: BSD-2-Clause
3// should have come with this header).
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/common/scm_rev.cpp.in b/src/common/scm_rev.cpp.in
index cc88994c6..f0c124d69 100644
--- a/src/common/scm_rev.cpp.in
+++ b/src/common/scm_rev.cpp.in
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include "common/scm_rev.h" 4#include "common/scm_rev.h"
6 5
diff --git a/src/common/scm_rev.h b/src/common/scm_rev.h
index 563015ec9..88404316a 100644
--- a/src/common/scm_rev.h
+++ b/src/common/scm_rev.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/common/scope_exit.h b/src/common/scope_exit.h
index 35dac3a8f..e9c789c88 100644
--- a/src/common/scope_exit.h
+++ b/src/common/scope_exit.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/common/telemetry.cpp b/src/common/telemetry.cpp
index 67261c55b..d26394359 100644
--- a/src/common/telemetry.cpp
+++ b/src/common/telemetry.cpp
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <algorithm> 4#include <algorithm>
6#include <cstring> 5#include <cstring>
diff --git a/src/common/telemetry.h b/src/common/telemetry.h
index f9a824a7d..ba633d5a5 100644
--- a/src/common/telemetry.h
+++ b/src/common/telemetry.h
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/common/threadsafe_queue.h b/src/common/threadsafe_queue.h
index f7ae9d8c2..053798e79 100644
--- a/src/common/threadsafe_queue.h
+++ b/src/common/threadsafe_queue.h
@@ -39,7 +39,7 @@ public:
39 template <typename Arg> 39 template <typename Arg>
40 void Push(Arg&& t) { 40 void Push(Arg&& t) {
41 // create the element, add it to the queue 41 // create the element, add it to the queue
42 write_ptr->current = std::forward<Arg>(t); 42 write_ptr->current = std::move(t);
43 // set the next pointer to a new element ptr 43 // set the next pointer to a new element ptr
44 // then advance the write pointer 44 // then advance the write pointer
45 ElementPtr* new_ptr = new ElementPtr(); 45 ElementPtr* new_ptr = new ElementPtr();
diff --git a/src/common/uint128.h b/src/common/uint128.h
index 199d0f55e..f890ffec2 100644
--- a/src/common/uint128.h
+++ b/src/common/uint128.h
@@ -31,17 +31,12 @@ namespace Common {
31 return _udiv128(r[1], r[0], d, &remainder); 31 return _udiv128(r[1], r[0], d, &remainder);
32#endif 32#endif
33#else 33#else
34#ifdef __SIZEOF_INT128__
35 const auto product = static_cast<unsigned __int128>(a) * static_cast<unsigned __int128>(b);
36 return static_cast<u64>(product / d);
37#else
38 const u64 diva = a / d; 34 const u64 diva = a / d;
39 const u64 moda = a % d; 35 const u64 moda = a % d;
40 const u64 divb = b / d; 36 const u64 divb = b / d;
41 const u64 modb = b % d; 37 const u64 modb = b % d;
42 return diva * b + moda * divb + moda * modb / d; 38 return diva * b + moda * divb + moda * modb / d;
43#endif 39#endif
44#endif
45} 40}
46 41
47// This function multiplies 2 u64 values and produces a u128 value; 42// This function multiplies 2 u64 values and produces a u128 value;
diff --git a/src/common/x64/native_clock.cpp b/src/common/x64/native_clock.cpp
index 6aaa8cdf9..8b08332ab 100644
--- a/src/common/x64/native_clock.cpp
+++ b/src/common/x64/native_clock.cpp
@@ -75,8 +75,8 @@ NativeClock::NativeClock(u64 emulated_cpu_frequency_, u64 emulated_clock_frequen
75} 75}
76 76
77u64 NativeClock::GetRTSC() { 77u64 NativeClock::GetRTSC() {
78 TimePoint current_time_point{};
79 TimePoint new_time_point{}; 78 TimePoint new_time_point{};
79 TimePoint current_time_point{};
80 80
81 current_time_point.pack = Common::AtomicLoad128(time_point.pack.data()); 81 current_time_point.pack = Common::AtomicLoad128(time_point.pack.data());
82 do { 82 do {
diff --git a/src/common/x64/xbyak_abi.h b/src/common/x64/xbyak_abi.h
index 87b3d63a4..67e6e63c8 100644
--- a/src/common/x64/xbyak_abi.h
+++ b/src/common/x64/xbyak_abi.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/common/x64/xbyak_util.h b/src/common/x64/xbyak_util.h
index 44d2558f1..250e5cddb 100644
--- a/src/common/x64/xbyak_util.h
+++ b/src/common/x64/xbyak_util.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index c1cc62a45..9dbe5bdca 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -1,3 +1,6 @@
1# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
1add_library(core STATIC 4add_library(core STATIC
2 announce_multiplayer_session.cpp 5 announce_multiplayer_session.cpp
3 announce_multiplayer_session.h 6 announce_multiplayer_session.h
@@ -448,6 +451,7 @@ add_library(core STATIC
448 hle/service/hid/hidbus.h 451 hle/service/hid/hidbus.h
449 hle/service/hid/irs.cpp 452 hle/service/hid/irs.cpp
450 hle/service/hid/irs.h 453 hle/service/hid/irs.h
454 hle/service/hid/irs_ring_lifo.h
451 hle/service/hid/ring_lifo.h 455 hle/service/hid/ring_lifo.h
452 hle/service/hid/xcd.cpp 456 hle/service/hid/xcd.cpp
453 hle/service/hid/xcd.h 457 hle/service/hid/xcd.h
@@ -723,8 +727,6 @@ add_library(core STATIC
723 internal_network/sockets.h 727 internal_network/sockets.h
724 loader/deconstructed_rom_directory.cpp 728 loader/deconstructed_rom_directory.cpp
725 loader/deconstructed_rom_directory.h 729 loader/deconstructed_rom_directory.h
726 loader/elf.cpp
727 loader/elf.h
728 loader/kip.cpp 730 loader/kip.cpp
729 loader/kip.h 731 loader/kip.h
730 loader/loader.cpp 732 loader/loader.cpp
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h
index c092db9ff..73f259525 100644
--- a/src/core/arm/arm_interface.h
+++ b/src/core/arm/arm_interface.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/core/arm/dynarmic/arm_dynarmic_cp15.cpp b/src/core/arm/dynarmic/arm_dynarmic_cp15.cpp
index 6aae79c48..e9123c13d 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_cp15.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic_cp15.cpp
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <fmt/format.h> 4#include <fmt/format.h>
6#include "common/logging/log.h" 5#include "common/logging/log.h"
diff --git a/src/core/arm/dynarmic/arm_dynarmic_cp15.h b/src/core/arm/dynarmic/arm_dynarmic_cp15.h
index f271b2070..5b2a51636 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_cp15.h
+++ b/src/core/arm/dynarmic/arm_dynarmic_cp15.h
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 95791a07f..ea32a4a8d 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <array> 4#include <array>
6#include <atomic> 5#include <atomic>
diff --git a/src/core/core.h b/src/core/core.h
index 13122dd61..0ce3b1d60 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 5425637f5..2dbb99c8b 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -6,9 +6,7 @@
6#include <string> 6#include <string>
7#include <tuple> 7#include <tuple>
8 8
9#include "common/logging/log.h"
10#include "common/microprofile.h" 9#include "common/microprofile.h"
11#include "common/thread.h"
12#include "core/core_timing.h" 10#include "core/core_timing.h"
13#include "core/core_timing_util.h" 11#include "core/core_timing_util.h"
14#include "core/hardware_properties.h" 12#include "core/hardware_properties.h"
@@ -44,10 +42,10 @@ CoreTiming::CoreTiming()
44 42
45CoreTiming::~CoreTiming() = default; 43CoreTiming::~CoreTiming() = default;
46 44
47void CoreTiming::ThreadEntry(CoreTiming& instance, size_t id) { 45void CoreTiming::ThreadEntry(CoreTiming& instance) {
48 const std::string name = "yuzu:HostTiming_" + std::to_string(id); 46 constexpr char name[] = "yuzu:HostTiming";
49 MicroProfileOnThreadCreate(name.c_str()); 47 MicroProfileOnThreadCreate(name);
50 Common::SetCurrentThreadName(name.c_str()); 48 Common::SetCurrentThreadName(name);
51 Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical); 49 Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical);
52 instance.on_thread_init(); 50 instance.on_thread_init();
53 instance.ThreadLoop(); 51 instance.ThreadLoop();
@@ -63,127 +61,100 @@ void CoreTiming::Initialize(std::function<void()>&& on_thread_init_) {
63 -> std::optional<std::chrono::nanoseconds> { return std::nullopt; }; 61 -> std::optional<std::chrono::nanoseconds> { return std::nullopt; };
64 ev_lost = CreateEvent("_lost_event", empty_timed_callback); 62 ev_lost = CreateEvent("_lost_event", empty_timed_callback);
65 if (is_multicore) { 63 if (is_multicore) {
66 worker_threads.emplace_back(ThreadEntry, std::ref(*this), 0); 64 timer_thread = std::make_unique<std::thread>(ThreadEntry, std::ref(*this));
67 } 65 }
68} 66}
69 67
70void CoreTiming::Shutdown() { 68void CoreTiming::Shutdown() {
71 is_paused = true; 69 paused = true;
72 shutting_down = true; 70 shutting_down = true;
73 std::atomic_thread_fence(std::memory_order_release); 71 pause_event.Set();
74 72 event.Set();
75 event_cv.notify_all(); 73 if (timer_thread) {
76 wait_pause_cv.notify_all(); 74 timer_thread->join();
77 for (auto& thread : worker_threads) {
78 thread.join();
79 } 75 }
80 worker_threads.clear();
81 pause_callbacks.clear(); 76 pause_callbacks.clear();
82 ClearPendingEvents(); 77 ClearPendingEvents();
78 timer_thread.reset();
83 has_started = false; 79 has_started = false;
84} 80}
85 81
86void CoreTiming::Pause(bool is_paused_) { 82void CoreTiming::Pause(bool is_paused) {
87 std::unique_lock main_lock(event_mutex); 83 paused = is_paused;
88 if (is_paused_ == paused_state.load(std::memory_order_relaxed)) { 84 pause_event.Set();
89 return;
90 }
91 if (is_multicore) {
92 is_paused = is_paused_;
93 event_cv.notify_all();
94 if (!is_paused_) {
95 wait_pause_cv.notify_all();
96 }
97 }
98 paused_state.store(is_paused_, std::memory_order_relaxed);
99 85
100 if (!is_paused_) { 86 if (!is_paused) {
101 pause_end_time = GetGlobalTimeNs().count(); 87 pause_end_time = GetGlobalTimeNs().count();
102 } 88 }
103 89
104 for (auto& cb : pause_callbacks) { 90 for (auto& cb : pause_callbacks) {
105 cb(is_paused_); 91 cb(is_paused);
106 } 92 }
107} 93}
108 94
109void CoreTiming::SyncPause(bool is_paused_) { 95void CoreTiming::SyncPause(bool is_paused) {
110 std::unique_lock main_lock(event_mutex); 96 if (is_paused == paused && paused_set == paused) {
111 if (is_paused_ == paused_state.load(std::memory_order_relaxed)) {
112 return; 97 return;
113 } 98 }
114 99
115 if (is_multicore) { 100 Pause(is_paused);
116 is_paused = is_paused_; 101 if (timer_thread) {
117 event_cv.notify_all(); 102 if (!is_paused) {
118 if (!is_paused_) { 103 pause_event.Set();
119 wait_pause_cv.notify_all();
120 }
121 }
122 paused_state.store(is_paused_, std::memory_order_relaxed);
123 if (is_multicore) {
124 if (is_paused_) {
125 wait_signal_cv.wait(main_lock, [this] { return pause_count == worker_threads.size(); });
126 } else {
127 wait_signal_cv.wait(main_lock, [this] { return pause_count == 0; });
128 } 104 }
105 event.Set();
106 while (paused_set != is_paused)
107 ;
129 } 108 }
130 109
131 if (!is_paused_) { 110 if (!is_paused) {
132 pause_end_time = GetGlobalTimeNs().count(); 111 pause_end_time = GetGlobalTimeNs().count();
133 } 112 }
134 113
135 for (auto& cb : pause_callbacks) { 114 for (auto& cb : pause_callbacks) {
136 cb(is_paused_); 115 cb(is_paused);
137 } 116 }
138} 117}
139 118
140bool CoreTiming::IsRunning() const { 119bool CoreTiming::IsRunning() const {
141 return !paused_state.load(std::memory_order_acquire); 120 return !paused_set;
142} 121}
143 122
144bool CoreTiming::HasPendingEvents() const { 123bool CoreTiming::HasPendingEvents() const {
145 std::unique_lock main_lock(event_mutex); 124 return !(wait_set && event_queue.empty());
146 return !event_queue.empty() || pending_events.load(std::memory_order_relaxed) != 0;
147} 125}
148 126
149void CoreTiming::ScheduleEvent(std::chrono::nanoseconds ns_into_future, 127void CoreTiming::ScheduleEvent(std::chrono::nanoseconds ns_into_future,
150 const std::shared_ptr<EventType>& event_type, 128 const std::shared_ptr<EventType>& event_type,
151 std::uintptr_t user_data, bool absolute_time) { 129 std::uintptr_t user_data, bool absolute_time) {
130 {
131 std::scoped_lock scope{basic_lock};
132 const auto next_time{absolute_time ? ns_into_future : GetGlobalTimeNs() + ns_into_future};
152 133
153 std::unique_lock main_lock(event_mutex); 134 event_queue.emplace_back(
154 const auto next_time{absolute_time ? ns_into_future : GetGlobalTimeNs() + ns_into_future}; 135 Event{next_time.count(), event_fifo_id++, user_data, event_type, 0});
155 136 std::push_heap(event_queue.begin(), event_queue.end(), std::greater<>());
156 event_queue.emplace_back(Event{next_time.count(), event_fifo_id++, user_data, event_type, 0});
157 pending_events.fetch_add(1, std::memory_order_relaxed);
158
159 std::push_heap(event_queue.begin(), event_queue.end(), std::greater<>());
160
161 if (is_multicore) {
162 event_cv.notify_one();
163 } 137 }
138
139 event.Set();
164} 140}
165 141
166void CoreTiming::ScheduleLoopingEvent(std::chrono::nanoseconds start_time, 142void CoreTiming::ScheduleLoopingEvent(std::chrono::nanoseconds start_time,
167 std::chrono::nanoseconds resched_time, 143 std::chrono::nanoseconds resched_time,
168 const std::shared_ptr<EventType>& event_type, 144 const std::shared_ptr<EventType>& event_type,
169 std::uintptr_t user_data, bool absolute_time) { 145 std::uintptr_t user_data, bool absolute_time) {
170 std::unique_lock main_lock(event_mutex); 146 std::scoped_lock scope{basic_lock};
171 const auto next_time{absolute_time ? start_time : GetGlobalTimeNs() + start_time}; 147 const auto next_time{absolute_time ? start_time : GetGlobalTimeNs() + start_time};
172 148
173 event_queue.emplace_back( 149 event_queue.emplace_back(
174 Event{next_time.count(), event_fifo_id++, user_data, event_type, resched_time.count()}); 150 Event{next_time.count(), event_fifo_id++, user_data, event_type, resched_time.count()});
175 pending_events.fetch_add(1, std::memory_order_relaxed);
176 151
177 std::push_heap(event_queue.begin(), event_queue.end(), std::greater<>()); 152 std::push_heap(event_queue.begin(), event_queue.end(), std::greater<>());
178
179 if (is_multicore) {
180 event_cv.notify_one();
181 }
182} 153}
183 154
184void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type, 155void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type,
185 std::uintptr_t user_data) { 156 std::uintptr_t user_data) {
186 std::unique_lock main_lock(event_mutex); 157 std::scoped_lock scope{basic_lock};
187 const auto itr = std::remove_if(event_queue.begin(), event_queue.end(), [&](const Event& e) { 158 const auto itr = std::remove_if(event_queue.begin(), event_queue.end(), [&](const Event& e) {
188 return e.type.lock().get() == event_type.get() && e.user_data == user_data; 159 return e.type.lock().get() == event_type.get() && e.user_data == user_data;
189 }); 160 });
@@ -192,7 +163,6 @@ void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type,
192 if (itr != event_queue.end()) { 163 if (itr != event_queue.end()) {
193 event_queue.erase(itr, event_queue.end()); 164 event_queue.erase(itr, event_queue.end());
194 std::make_heap(event_queue.begin(), event_queue.end(), std::greater<>()); 165 std::make_heap(event_queue.begin(), event_queue.end(), std::greater<>());
195 pending_events.fetch_sub(1, std::memory_order_relaxed);
196 } 166 }
197} 167}
198 168
@@ -232,12 +202,11 @@ u64 CoreTiming::GetClockTicks() const {
232} 202}
233 203
234void CoreTiming::ClearPendingEvents() { 204void CoreTiming::ClearPendingEvents() {
235 std::unique_lock main_lock(event_mutex);
236 event_queue.clear(); 205 event_queue.clear();
237} 206}
238 207
239void CoreTiming::RemoveEvent(const std::shared_ptr<EventType>& event_type) { 208void CoreTiming::RemoveEvent(const std::shared_ptr<EventType>& event_type) {
240 std::unique_lock main_lock(event_mutex); 209 std::scoped_lock lock{basic_lock};
241 210
242 const auto itr = std::remove_if(event_queue.begin(), event_queue.end(), [&](const Event& e) { 211 const auto itr = std::remove_if(event_queue.begin(), event_queue.end(), [&](const Event& e) {
243 return e.type.lock().get() == event_type.get(); 212 return e.type.lock().get() == event_type.get();
@@ -251,28 +220,27 @@ void CoreTiming::RemoveEvent(const std::shared_ptr<EventType>& event_type) {
251} 220}
252 221
253void CoreTiming::RegisterPauseCallback(PauseCallback&& callback) { 222void CoreTiming::RegisterPauseCallback(PauseCallback&& callback) {
254 std::unique_lock main_lock(event_mutex); 223 std::scoped_lock lock{basic_lock};
255 pause_callbacks.emplace_back(std::move(callback)); 224 pause_callbacks.emplace_back(std::move(callback));
256} 225}
257 226
258std::optional<s64> CoreTiming::Advance() { 227std::optional<s64> CoreTiming::Advance() {
228 std::scoped_lock lock{advance_lock, basic_lock};
259 global_timer = GetGlobalTimeNs().count(); 229 global_timer = GetGlobalTimeNs().count();
260 230
261 std::unique_lock main_lock(event_mutex);
262 while (!event_queue.empty() && event_queue.front().time <= global_timer) { 231 while (!event_queue.empty() && event_queue.front().time <= global_timer) {
263 Event evt = std::move(event_queue.front()); 232 Event evt = std::move(event_queue.front());
264 std::pop_heap(event_queue.begin(), event_queue.end(), std::greater<>()); 233 std::pop_heap(event_queue.begin(), event_queue.end(), std::greater<>());
265 event_queue.pop_back(); 234 event_queue.pop_back();
266 235
267 if (const auto event_type{evt.type.lock()}) { 236 if (const auto event_type{evt.type.lock()}) {
268 event_mutex.unlock(); 237 basic_lock.unlock();
269 238
270 const auto new_schedule_time{event_type->callback( 239 const auto new_schedule_time{event_type->callback(
271 evt.user_data, evt.time, 240 evt.user_data, evt.time,
272 std::chrono::nanoseconds{GetGlobalTimeNs().count() - evt.time})}; 241 std::chrono::nanoseconds{GetGlobalTimeNs().count() - evt.time})};
273 242
274 event_mutex.lock(); 243 basic_lock.lock();
275 pending_events.fetch_sub(1, std::memory_order_relaxed);
276 244
277 if (evt.reschedule_time != 0) { 245 if (evt.reschedule_time != 0) {
278 // If this event was scheduled into a pause, its time now is going to be way behind. 246 // If this event was scheduled into a pause, its time now is going to be way behind.
@@ -285,9 +253,9 @@ std::optional<s64> CoreTiming::Advance() {
285 const auto next_schedule_time{new_schedule_time.has_value() 253 const auto next_schedule_time{new_schedule_time.has_value()
286 ? new_schedule_time.value().count() 254 ? new_schedule_time.value().count()
287 : evt.reschedule_time}; 255 : evt.reschedule_time};
256
288 event_queue.emplace_back( 257 event_queue.emplace_back(
289 Event{next_time, event_fifo_id++, evt.user_data, evt.type, next_schedule_time}); 258 Event{next_time, event_fifo_id++, evt.user_data, evt.type, next_schedule_time});
290 pending_events.fetch_add(1, std::memory_order_relaxed);
291 std::push_heap(event_queue.begin(), event_queue.end(), std::greater<>()); 259 std::push_heap(event_queue.begin(), event_queue.end(), std::greater<>());
292 } 260 }
293 } 261 }
@@ -304,34 +272,27 @@ std::optional<s64> CoreTiming::Advance() {
304} 272}
305 273
306void CoreTiming::ThreadLoop() { 274void CoreTiming::ThreadLoop() {
307 const auto predicate = [this] { return !event_queue.empty() || is_paused; };
308 has_started = true; 275 has_started = true;
309 while (!shutting_down) { 276 while (!shutting_down) {
310 while (!is_paused && !shutting_down) { 277 while (!paused) {
278 paused_set = false;
311 const auto next_time = Advance(); 279 const auto next_time = Advance();
312 if (next_time) { 280 if (next_time) {
313 if (*next_time > 0) { 281 if (*next_time > 0) {
314 std::chrono::nanoseconds next_time_ns = std::chrono::nanoseconds(*next_time); 282 std::chrono::nanoseconds next_time_ns = std::chrono::nanoseconds(*next_time);
315 std::unique_lock main_lock(event_mutex); 283 event.WaitFor(next_time_ns);
316 event_cv.wait_for(main_lock, next_time_ns, predicate);
317 } 284 }
318 } else { 285 } else {
319 std::unique_lock main_lock(event_mutex); 286 wait_set = true;
320 event_cv.wait(main_lock, predicate); 287 event.Wait();
321 } 288 }
289 wait_set = false;
322 } 290 }
323 std::unique_lock main_lock(event_mutex); 291
324 pause_count++; 292 paused_set = true;
325 if (pause_count == worker_threads.size()) { 293 clock->Pause(true);
326 clock->Pause(true); 294 pause_event.Wait();
327 wait_signal_cv.notify_all(); 295 clock->Pause(false);
328 }
329 wait_pause_cv.wait(main_lock, [this] { return !is_paused || shutting_down; });
330 pause_count--;
331 if (pause_count == 0) {
332 clock->Pause(false);
333 wait_signal_cv.notify_all();
334 }
335 } 296 }
336} 297}
337 298
diff --git a/src/core/core_timing.h b/src/core/core_timing.h
index 09b6ed81a..6aa3ae923 100644
--- a/src/core/core_timing.h
+++ b/src/core/core_timing.h
@@ -5,7 +5,6 @@
5 5
6#include <atomic> 6#include <atomic>
7#include <chrono> 7#include <chrono>
8#include <condition_variable>
9#include <functional> 8#include <functional>
10#include <memory> 9#include <memory>
11#include <mutex> 10#include <mutex>
@@ -15,6 +14,7 @@
15#include <vector> 14#include <vector>
16 15
17#include "common/common_types.h" 16#include "common/common_types.h"
17#include "common/thread.h"
18#include "common/wall_clock.h" 18#include "common/wall_clock.h"
19 19
20namespace Core::Timing { 20namespace Core::Timing {
@@ -143,7 +143,7 @@ private:
143 /// Clear all pending events. This should ONLY be done on exit. 143 /// Clear all pending events. This should ONLY be done on exit.
144 void ClearPendingEvents(); 144 void ClearPendingEvents();
145 145
146 static void ThreadEntry(CoreTiming& instance, size_t id); 146 static void ThreadEntry(CoreTiming& instance);
147 void ThreadLoop(); 147 void ThreadLoop();
148 148
149 std::unique_ptr<Common::WallClock> clock; 149 std::unique_ptr<Common::WallClock> clock;
@@ -156,24 +156,21 @@ private:
156 // accomodated by the standard adaptor class. 156 // accomodated by the standard adaptor class.
157 std::vector<Event> event_queue; 157 std::vector<Event> event_queue;
158 u64 event_fifo_id = 0; 158 u64 event_fifo_id = 0;
159 std::atomic<size_t> pending_events{};
160 159
161 std::shared_ptr<EventType> ev_lost; 160 std::shared_ptr<EventType> ev_lost;
161 Common::Event event{};
162 Common::Event pause_event{};
163 std::mutex basic_lock;
164 std::mutex advance_lock;
165 std::unique_ptr<std::thread> timer_thread;
166 std::atomic<bool> paused{};
167 std::atomic<bool> paused_set{};
168 std::atomic<bool> wait_set{};
169 std::atomic<bool> shutting_down{};
162 std::atomic<bool> has_started{}; 170 std::atomic<bool> has_started{};
163 std::function<void()> on_thread_init{}; 171 std::function<void()> on_thread_init{};
164 172
165 std::vector<std::thread> worker_threads;
166
167 std::condition_variable event_cv;
168 std::condition_variable wait_pause_cv;
169 std::condition_variable wait_signal_cv;
170 mutable std::mutex event_mutex;
171
172 std::atomic<bool> paused_state{};
173 bool is_paused{};
174 bool shutting_down{};
175 bool is_multicore{}; 173 bool is_multicore{};
176 size_t pause_count{};
177 s64 pause_end_time{}; 174 s64 pause_end_time{};
178 175
179 /// Cycle timing 176 /// Cycle timing
diff --git a/src/core/file_sys/errors.h b/src/core/file_sys/errors.h
index ff15b3e23..7cee0c7df 100644
--- a/src/core/file_sys/errors.h
+++ b/src/core/file_sys/errors.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/core/frontend/applets/software_keyboard.h b/src/core/frontend/applets/software_keyboard.h
index a405e3c94..094d1e713 100644
--- a/src/core/frontend/applets/software_keyboard.h
+++ b/src/core/frontend/applets/software_keyboard.h
@@ -17,6 +17,8 @@ struct KeyboardInitializeParameters {
17 std::u16string sub_text; 17 std::u16string sub_text;
18 std::u16string guide_text; 18 std::u16string guide_text;
19 std::u16string initial_text; 19 std::u16string initial_text;
20 char16_t left_optional_symbol_key;
21 char16_t right_optional_symbol_key;
20 u32 max_text_length; 22 u32 max_text_length;
21 u32 min_text_length; 23 u32 min_text_length;
22 s32 initial_cursor_position; 24 s32 initial_cursor_position;
diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp
index 57c6ffc43..1be2dccb0 100644
--- a/src/core/frontend/emu_window.cpp
+++ b/src/core/frontend/emu_window.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <mutex> 4#include <mutex>
6#include "core/frontend/emu_window.h" 5#include "core/frontend/emu_window.h"
diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.h
index b3bffecb2..ac1906d5e 100644
--- a/src/core/frontend/emu_window.h
+++ b/src/core/frontend/emu_window.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/core/hle/ipc.h b/src/core/hle/ipc.h
index 602e12606..416da15ec 100644
--- a/src/core/hle/ipc.h
+++ b/src/core/hle/ipc.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h
index 004bb2005..d631c0357 100644
--- a/src/core/hle/ipc_helpers.h
+++ b/src/core/hle/ipc_helpers.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/core/hle/kernel/k_client_port.cpp b/src/core/hle/kernel/k_client_port.cpp
index d63e77d15..3cb22ff4d 100644
--- a/src/core/hle/kernel/k_client_port.cpp
+++ b/src/core/hle/kernel/k_client_port.cpp
@@ -1,6 +1,5 @@
1// Copyright 2021 Citra Emulator Project 1// SPDX-FileCopyrightText: 2021 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include "common/scope_exit.h" 4#include "common/scope_exit.h"
6#include "core/hle/kernel/hle_ipc.h" 5#include "core/hle/kernel/hle_ipc.h"
diff --git a/src/core/hle/kernel/k_client_port.h b/src/core/hle/kernel/k_client_port.h
index ef8583efc..e17eff28f 100644
--- a/src/core/hle/kernel/k_client_port.h
+++ b/src/core/hle/kernel/k_client_port.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp
index b662788b3..d3e99665f 100644
--- a/src/core/hle/kernel/k_process.cpp
+++ b/src/core/hle/kernel/k_process.cpp
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <algorithm> 4#include <algorithm>
6#include <bitset> 5#include <bitset>
diff --git a/src/core/hle/kernel/k_process.h b/src/core/hle/kernel/k_process.h
index 5e3e22ad8..d56d73bab 100644
--- a/src/core/hle/kernel/k_process.h
+++ b/src/core/hle/kernel/k_process.h
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/core/hle/kernel/k_shared_memory.cpp b/src/core/hle/kernel/k_shared_memory.cpp
index b77735736..8ff1545b6 100644
--- a/src/core/hle/kernel/k_shared_memory.cpp
+++ b/src/core/hle/kernel/k_shared_memory.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include "common/assert.h" 4#include "common/assert.h"
6#include "core/core.h" 5#include "core/core.h"
diff --git a/src/core/hle/kernel/k_shared_memory.h b/src/core/hle/kernel/k_shared_memory.h
index 2c1db0e70..34cb98456 100644
--- a/src/core/hle/kernel/k_shared_memory.h
+++ b/src/core/hle/kernel/k_shared_memory.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/core/hle/result.h b/src/core/hle/result.h
index aa9e5b89d..4de44cd06 100644
--- a/src/core/hle/result.h
+++ b/src/core/hle/result.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/core/hle/service/am/applets/applet_software_keyboard.cpp b/src/core/hle/service/am/applets/applet_software_keyboard.cpp
index faa092957..c18236045 100644
--- a/src/core/hle/service/am/applets/applet_software_keyboard.cpp
+++ b/src/core/hle/service/am/applets/applet_software_keyboard.cpp
@@ -536,6 +536,8 @@ void SoftwareKeyboard::InitializeFrontendNormalKeyboard() {
536 .sub_text{std::move(sub_text)}, 536 .sub_text{std::move(sub_text)},
537 .guide_text{std::move(guide_text)}, 537 .guide_text{std::move(guide_text)},
538 .initial_text{initial_text}, 538 .initial_text{initial_text},
539 .left_optional_symbol_key{swkbd_config_common.left_optional_symbol_key},
540 .right_optional_symbol_key{swkbd_config_common.right_optional_symbol_key},
539 .max_text_length{max_text_length}, 541 .max_text_length{max_text_length},
540 .min_text_length{min_text_length}, 542 .min_text_length{min_text_length},
541 .initial_cursor_position{initial_cursor_position}, 543 .initial_cursor_position{initial_cursor_position},
@@ -591,6 +593,8 @@ void SoftwareKeyboard::InitializeFrontendInlineKeyboardOld() {
591 .sub_text{}, 593 .sub_text{},
592 .guide_text{}, 594 .guide_text{},
593 .initial_text{current_text}, 595 .initial_text{current_text},
596 .left_optional_symbol_key{appear_arg.left_optional_symbol_key},
597 .right_optional_symbol_key{appear_arg.right_optional_symbol_key},
594 .max_text_length{max_text_length}, 598 .max_text_length{max_text_length},
595 .min_text_length{min_text_length}, 599 .min_text_length{min_text_length},
596 .initial_cursor_position{initial_cursor_position}, 600 .initial_cursor_position{initial_cursor_position},
@@ -632,6 +636,8 @@ void SoftwareKeyboard::InitializeFrontendInlineKeyboardNew() {
632 .sub_text{}, 636 .sub_text{},
633 .guide_text{}, 637 .guide_text{},
634 .initial_text{current_text}, 638 .initial_text{current_text},
639 .left_optional_symbol_key{appear_arg.left_optional_symbol_key},
640 .right_optional_symbol_key{appear_arg.right_optional_symbol_key},
635 .max_text_length{max_text_length}, 641 .max_text_length{max_text_length},
636 .min_text_length{min_text_length}, 642 .min_text_length{min_text_length},
637 .initial_cursor_position{initial_cursor_position}, 643 .initial_cursor_position{initial_cursor_position},
diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp
index d5107e41f..c4b44cbf9 100644
--- a/src/core/hle/service/hid/irs.cpp
+++ b/src/core/hle/service/hid/irs.cpp
@@ -166,7 +166,7 @@ void IRS::RunClusteringProcessor(Kernel::HLERequestContext& ctx) {
166 166
167 if (result.IsSuccess()) { 167 if (result.IsSuccess()) {
168 auto& device = GetIrCameraSharedMemoryDeviceEntry(parameters.camera_handle); 168 auto& device = GetIrCameraSharedMemoryDeviceEntry(parameters.camera_handle);
169 MakeProcessor<ClusteringProcessor>(parameters.camera_handle, device); 169 MakeProcessorWithCoreContext<ClusteringProcessor>(parameters.camera_handle, device);
170 auto& image_transfer_processor = 170 auto& image_transfer_processor =
171 GetProcessor<ClusteringProcessor>(parameters.camera_handle); 171 GetProcessor<ClusteringProcessor>(parameters.camera_handle);
172 image_transfer_processor.SetConfig(parameters.processor_config); 172 image_transfer_processor.SetConfig(parameters.processor_config);
diff --git a/src/core/hle/service/hid/irs_ring_lifo.h b/src/core/hle/service/hid/irs_ring_lifo.h
new file mode 100644
index 000000000..255d1d296
--- /dev/null
+++ b/src/core/hle/service/hid/irs_ring_lifo.h
@@ -0,0 +1,47 @@
1// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#pragma once
5
6#include <array>
7
8#include "common/common_types.h"
9
10namespace Service::IRS {
11
12template <typename State, std::size_t max_buffer_size>
13struct Lifo {
14 s64 sampling_number{};
15 s64 buffer_count{};
16 std::array<State, max_buffer_size> entries{};
17
18 const State& ReadCurrentEntry() const {
19 return entries[GetBufferTail()];
20 }
21
22 const State& ReadPreviousEntry() const {
23 return entries[GetPreviousEntryIndex()];
24 }
25
26 s64 GetBufferTail() const {
27 return sampling_number % max_buffer_size;
28 }
29
30 std::size_t GetPreviousEntryIndex() const {
31 return static_cast<size_t>((GetBufferTail() + max_buffer_size - 1) % max_buffer_size);
32 }
33
34 std::size_t GetNextEntryIndex() const {
35 return static_cast<size_t>((GetBufferTail() + 1) % max_buffer_size);
36 }
37
38 void WriteNextEntry(const State& new_state) {
39 if (buffer_count < static_cast<s64>(max_buffer_size)) {
40 buffer_count++;
41 }
42 sampling_number++;
43 entries[GetBufferTail()] = new_state;
44 }
45};
46
47} // namespace Service::IRS
diff --git a/src/core/hle/service/hid/irsensor/clustering_processor.cpp b/src/core/hle/service/hid/irsensor/clustering_processor.cpp
index 6479af212..e2f4ae876 100644
--- a/src/core/hle/service/hid/irsensor/clustering_processor.cpp
+++ b/src/core/hle/service/hid/irsensor/clustering_processor.cpp
@@ -1,34 +1,265 @@
1// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-3.0-or-later 2// SPDX-License-Identifier: GPL-3.0-or-later
3 3
4#include <queue>
5
6#include "core/hid/emulated_controller.h"
7#include "core/hid/hid_core.h"
4#include "core/hle/service/hid/irsensor/clustering_processor.h" 8#include "core/hle/service/hid/irsensor/clustering_processor.h"
5 9
6namespace Service::IRS { 10namespace Service::IRS {
7ClusteringProcessor::ClusteringProcessor(Core::IrSensor::DeviceFormat& device_format) 11ClusteringProcessor::ClusteringProcessor(Core::HID::HIDCore& hid_core_,
8 : device(device_format) { 12 Core::IrSensor::DeviceFormat& device_format,
13 std::size_t npad_index)
14 : device{device_format} {
15 npad_device = hid_core_.GetEmulatedControllerByIndex(npad_index);
16
9 device.mode = Core::IrSensor::IrSensorMode::ClusteringProcessor; 17 device.mode = Core::IrSensor::IrSensorMode::ClusteringProcessor;
10 device.camera_status = Core::IrSensor::IrCameraStatus::Unconnected; 18 device.camera_status = Core::IrSensor::IrCameraStatus::Unconnected;
11 device.camera_internal_status = Core::IrSensor::IrCameraInternalStatus::Stopped; 19 device.camera_internal_status = Core::IrSensor::IrCameraInternalStatus::Stopped;
20 SetDefaultConfig();
21
22 shared_memory = std::construct_at(
23 reinterpret_cast<ClusteringSharedMemory*>(&device_format.state.processor_raw_data));
24
25 Core::HID::ControllerUpdateCallback engine_callback{
26 .on_change = [this](Core::HID::ControllerTriggerType type) { OnControllerUpdate(type); },
27 .is_npad_service = true,
28 };
29 callback_key = npad_device->SetCallback(engine_callback);
12} 30}
13 31
14ClusteringProcessor::~ClusteringProcessor() = default; 32ClusteringProcessor::~ClusteringProcessor() {
33 npad_device->DeleteCallback(callback_key);
34};
15 35
16void ClusteringProcessor::StartProcessor() {} 36void ClusteringProcessor::StartProcessor() {
37 device.camera_status = Core::IrSensor::IrCameraStatus::Available;
38 device.camera_internal_status = Core::IrSensor::IrCameraInternalStatus::Ready;
39}
17 40
18void ClusteringProcessor::SuspendProcessor() {} 41void ClusteringProcessor::SuspendProcessor() {}
19 42
20void ClusteringProcessor::StopProcessor() {} 43void ClusteringProcessor::StopProcessor() {}
21 44
45void ClusteringProcessor::OnControllerUpdate(Core::HID::ControllerTriggerType type) {
46 if (type != Core::HID::ControllerTriggerType::IrSensor) {
47 return;
48 }
49
50 next_state = {};
51 const auto camera_data = npad_device->GetCamera();
52 auto filtered_image = camera_data.data;
53
54 RemoveLowIntensityData(filtered_image);
55
56 const auto window_start_x = static_cast<std::size_t>(current_config.window_of_interest.x);
57 const auto window_start_y = static_cast<std::size_t>(current_config.window_of_interest.y);
58 const auto window_end_x =
59 window_start_x + static_cast<std::size_t>(current_config.window_of_interest.width);
60 const auto window_end_y =
61 window_start_y + static_cast<std::size_t>(current_config.window_of_interest.height);
62
63 for (std::size_t y = window_start_y; y < window_end_y; y++) {
64 for (std::size_t x = window_start_x; x < window_end_x; x++) {
65 u8 pixel = GetPixel(filtered_image, x, y);
66 if (pixel == 0) {
67 continue;
68 }
69 const auto cluster = GetClusterProperties(filtered_image, x, y);
70 if (cluster.pixel_count > current_config.pixel_count_max) {
71 continue;
72 }
73 if (cluster.pixel_count < current_config.pixel_count_min) {
74 continue;
75 }
76 // Cluster object limit reached
77 if (next_state.object_count >= next_state.data.size()) {
78 continue;
79 }
80 next_state.data[next_state.object_count] = cluster;
81 next_state.object_count++;
82 }
83 }
84
85 next_state.sampling_number = camera_data.sample;
86 next_state.timestamp = next_state.timestamp + 131;
87 next_state.ambient_noise_level = Core::IrSensor::CameraAmbientNoiseLevel::Low;
88 shared_memory->clustering_lifo.WriteNextEntry(next_state);
89
90 if (!IsProcessorActive()) {
91 StartProcessor();
92 }
93}
94
95void ClusteringProcessor::RemoveLowIntensityData(std::vector<u8>& data) {
96 for (u8& pixel : data) {
97 if (pixel < current_config.pixel_count_min) {
98 pixel = 0;
99 }
100 }
101}
102
103ClusteringProcessor::ClusteringData ClusteringProcessor::GetClusterProperties(std::vector<u8>& data,
104 std::size_t x,
105 std::size_t y) {
106 using DataPoint = Common::Point<std::size_t>;
107 std::queue<DataPoint> search_points{};
108 ClusteringData current_cluster = GetPixelProperties(data, x, y);
109 SetPixel(data, x, y, 0);
110 search_points.emplace<DataPoint>({x, y});
111
112 while (!search_points.empty()) {
113 const auto point = search_points.front();
114 search_points.pop();
115
116 // Avoid negative numbers
117 if (point.x == 0 || point.y == 0) {
118 continue;
119 }
120
121 std::array<DataPoint, 4> new_points{
122 DataPoint{point.x - 1, point.y},
123 {point.x, point.y - 1},
124 {point.x + 1, point.y},
125 {point.x, point.y + 1},
126 };
127
128 for (const auto new_point : new_points) {
129 if (new_point.x >= width) {
130 continue;
131 }
132 if (new_point.y >= height) {
133 continue;
134 }
135 if (GetPixel(data, new_point.x, new_point.y) < current_config.object_intensity_min) {
136 continue;
137 }
138 const ClusteringData cluster = GetPixelProperties(data, new_point.x, new_point.y);
139 current_cluster = MergeCluster(current_cluster, cluster);
140 SetPixel(data, new_point.x, new_point.y, 0);
141 search_points.emplace<DataPoint>({new_point.x, new_point.y});
142 }
143 }
144
145 return current_cluster;
146}
147
148ClusteringProcessor::ClusteringData ClusteringProcessor::GetPixelProperties(
149 const std::vector<u8>& data, std::size_t x, std::size_t y) const {
150 return {
151 .average_intensity = GetPixel(data, x, y) / 255.0f,
152 .centroid =
153 {
154 .x = static_cast<f32>(x),
155 .y = static_cast<f32>(y),
156
157 },
158 .pixel_count = 1,
159 .bound =
160 {
161 .x = static_cast<s16>(x),
162 .y = static_cast<s16>(y),
163 .width = 1,
164 .height = 1,
165 },
166 };
167}
168
169ClusteringProcessor::ClusteringData ClusteringProcessor::MergeCluster(
170 const ClusteringData a, const ClusteringData b) const {
171 const f32 a_pixel_count = static_cast<f32>(a.pixel_count);
172 const f32 b_pixel_count = static_cast<f32>(b.pixel_count);
173 const f32 pixel_count = a_pixel_count + b_pixel_count;
174 const f32 average_intensity =
175 (a.average_intensity * a_pixel_count + b.average_intensity * b_pixel_count) / pixel_count;
176 const Core::IrSensor::IrsCentroid centroid = {
177 .x = (a.centroid.x * a_pixel_count + b.centroid.x * b_pixel_count) / pixel_count,
178 .y = (a.centroid.y * a_pixel_count + b.centroid.y * b_pixel_count) / pixel_count,
179 };
180 s16 bound_start_x = a.bound.x < b.bound.x ? a.bound.x : b.bound.x;
181 s16 bound_start_y = a.bound.y < b.bound.y ? a.bound.y : b.bound.y;
182 s16 a_bound_end_x = a.bound.x + a.bound.width;
183 s16 a_bound_end_y = a.bound.y + a.bound.height;
184 s16 b_bound_end_x = b.bound.x + b.bound.width;
185 s16 b_bound_end_y = b.bound.y + b.bound.height;
186
187 const Core::IrSensor::IrsRect bound = {
188 .x = bound_start_x,
189 .y = bound_start_y,
190 .width = a_bound_end_x > b_bound_end_x ? static_cast<s16>(a_bound_end_x - bound_start_x)
191 : static_cast<s16>(b_bound_end_x - bound_start_x),
192 .height = a_bound_end_y > b_bound_end_y ? static_cast<s16>(a_bound_end_y - bound_start_y)
193 : static_cast<s16>(b_bound_end_y - bound_start_y),
194 };
195
196 return {
197 .average_intensity = average_intensity,
198 .centroid = centroid,
199 .pixel_count = static_cast<u32>(pixel_count),
200 .bound = bound,
201 };
202}
203
204u8 ClusteringProcessor::GetPixel(const std::vector<u8>& data, std::size_t x, std::size_t y) const {
205 if ((y * width) + x > data.size()) {
206 return 0;
207 }
208 return data[(y * width) + x];
209}
210
211void ClusteringProcessor::SetPixel(std::vector<u8>& data, std::size_t x, std::size_t y, u8 value) {
212 if ((y * width) + x > data.size()) {
213 return;
214 }
215 data[(y * width) + x] = value;
216}
217
218void ClusteringProcessor::SetDefaultConfig() {
219 using namespace std::literals::chrono_literals;
220 current_config.camera_config.exposure_time = std::chrono::microseconds(200ms).count();
221 current_config.camera_config.gain = 2;
222 current_config.camera_config.is_negative_used = false;
223 current_config.camera_config.light_target = Core::IrSensor::CameraLightTarget::BrightLeds;
224 current_config.window_of_interest = {
225 .x = 0,
226 .y = 0,
227 .width = width,
228 .height = height,
229 };
230 current_config.pixel_count_min = 3;
231 current_config.pixel_count_max = static_cast<u32>(GetDataSize(format));
232 current_config.is_external_light_filter_enabled = true;
233 current_config.object_intensity_min = 150;
234
235 npad_device->SetCameraFormat(format);
236}
237
22void ClusteringProcessor::SetConfig(Core::IrSensor::PackedClusteringProcessorConfig config) { 238void ClusteringProcessor::SetConfig(Core::IrSensor::PackedClusteringProcessorConfig config) {
23 current_config.camera_config.exposure_time = config.camera_config.exposure_time; 239 current_config.camera_config.exposure_time = config.camera_config.exposure_time;
24 current_config.camera_config.gain = config.camera_config.gain; 240 current_config.camera_config.gain = config.camera_config.gain;
25 current_config.camera_config.is_negative_used = config.camera_config.is_negative_used; 241 current_config.camera_config.is_negative_used = config.camera_config.is_negative_used;
26 current_config.camera_config.light_target = 242 current_config.camera_config.light_target =
27 static_cast<Core::IrSensor::CameraLightTarget>(config.camera_config.light_target); 243 static_cast<Core::IrSensor::CameraLightTarget>(config.camera_config.light_target);
244 current_config.window_of_interest = config.window_of_interest;
28 current_config.pixel_count_min = config.pixel_count_min; 245 current_config.pixel_count_min = config.pixel_count_min;
29 current_config.pixel_count_max = config.pixel_count_max; 246 current_config.pixel_count_max = config.pixel_count_max;
30 current_config.is_external_light_filter_enabled = config.is_external_light_filter_enabled; 247 current_config.is_external_light_filter_enabled = config.is_external_light_filter_enabled;
31 current_config.object_intensity_min = config.object_intensity_min; 248 current_config.object_intensity_min = config.object_intensity_min;
249
250 LOG_INFO(Service_IRS,
251 "Processor config, exposure_time={}, gain={}, is_negative_used={}, "
252 "light_target={}, window_of_interest=({}, {}, {}, {}), pixel_count_min={}, "
253 "pixel_count_max={}, is_external_light_filter_enabled={}, object_intensity_min={}",
254 current_config.camera_config.exposure_time, current_config.camera_config.gain,
255 current_config.camera_config.is_negative_used,
256 current_config.camera_config.light_target, current_config.window_of_interest.x,
257 current_config.window_of_interest.y, current_config.window_of_interest.width,
258 current_config.window_of_interest.height, current_config.pixel_count_min,
259 current_config.pixel_count_max, current_config.is_external_light_filter_enabled,
260 current_config.object_intensity_min);
261
262 npad_device->SetCameraFormat(format);
32} 263}
33 264
34} // namespace Service::IRS 265} // namespace Service::IRS
diff --git a/src/core/hle/service/hid/irsensor/clustering_processor.h b/src/core/hle/service/hid/irsensor/clustering_processor.h
index 6e2ba8846..dc01a8ea7 100644
--- a/src/core/hle/service/hid/irsensor/clustering_processor.h
+++ b/src/core/hle/service/hid/irsensor/clustering_processor.h
@@ -5,12 +5,19 @@
5 5
6#include "common/common_types.h" 6#include "common/common_types.h"
7#include "core/hid/irs_types.h" 7#include "core/hid/irs_types.h"
8#include "core/hle/service/hid/irs_ring_lifo.h"
8#include "core/hle/service/hid/irsensor/processor_base.h" 9#include "core/hle/service/hid/irsensor/processor_base.h"
9 10
11namespace Core::HID {
12class EmulatedController;
13} // namespace Core::HID
14
10namespace Service::IRS { 15namespace Service::IRS {
11class ClusteringProcessor final : public ProcessorBase { 16class ClusteringProcessor final : public ProcessorBase {
12public: 17public:
13 explicit ClusteringProcessor(Core::IrSensor::DeviceFormat& device_format); 18 explicit ClusteringProcessor(Core::HID::HIDCore& hid_core_,
19 Core::IrSensor::DeviceFormat& device_format,
20 std::size_t npad_index);
14 ~ClusteringProcessor() override; 21 ~ClusteringProcessor() override;
15 22
16 // Called when the processor is initialized 23 // Called when the processor is initialized
@@ -26,6 +33,10 @@ public:
26 void SetConfig(Core::IrSensor::PackedClusteringProcessorConfig config); 33 void SetConfig(Core::IrSensor::PackedClusteringProcessorConfig config);
27 34
28private: 35private:
36 static constexpr auto format = Core::IrSensor::ImageTransferProcessorFormat::Size320x240;
37 static constexpr std::size_t width = 320;
38 static constexpr std::size_t height = 240;
39
29 // This is nn::irsensor::ClusteringProcessorConfig 40 // This is nn::irsensor::ClusteringProcessorConfig
30 struct ClusteringProcessorConfig { 41 struct ClusteringProcessorConfig {
31 Core::IrSensor::CameraConfig camera_config; 42 Core::IrSensor::CameraConfig camera_config;
@@ -68,7 +79,32 @@ private:
68 static_assert(sizeof(ClusteringProcessorState) == 0x198, 79 static_assert(sizeof(ClusteringProcessorState) == 0x198,
69 "ClusteringProcessorState is an invalid size"); 80 "ClusteringProcessorState is an invalid size");
70 81
82 struct ClusteringSharedMemory {
83 Service::IRS::Lifo<ClusteringProcessorState, 6> clustering_lifo;
84 static_assert(sizeof(clustering_lifo) == 0x9A0, "clustering_lifo is an invalid size");
85 INSERT_PADDING_WORDS(0x11F);
86 };
87 static_assert(sizeof(ClusteringSharedMemory) == 0xE20,
88 "ClusteringSharedMemory is an invalid size");
89
90 void OnControllerUpdate(Core::HID::ControllerTriggerType type);
91 void RemoveLowIntensityData(std::vector<u8>& data);
92 ClusteringData GetClusterProperties(std::vector<u8>& data, std::size_t x, std::size_t y);
93 ClusteringData GetPixelProperties(const std::vector<u8>& data, std::size_t x,
94 std::size_t y) const;
95 ClusteringData MergeCluster(const ClusteringData a, const ClusteringData b) const;
96 u8 GetPixel(const std::vector<u8>& data, std::size_t x, std::size_t y) const;
97 void SetPixel(std::vector<u8>& data, std::size_t x, std::size_t y, u8 value);
98
99 // Sets config parameters of the camera
100 void SetDefaultConfig();
101
102 ClusteringSharedMemory* shared_memory = nullptr;
103 ClusteringProcessorState next_state{};
104
71 ClusteringProcessorConfig current_config{}; 105 ClusteringProcessorConfig current_config{};
72 Core::IrSensor::DeviceFormat& device; 106 Core::IrSensor::DeviceFormat& device;
107 Core::HID::EmulatedController* npad_device;
108 int callback_key{};
73}; 109};
74} // namespace Service::IRS 110} // namespace Service::IRS
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index c64291e7f..dadaf897f 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -194,13 +194,16 @@ Result ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session,
194 Kernel::HLERequestContext& ctx) { 194 Kernel::HLERequestContext& ctx) {
195 const auto guard = LockService(); 195 const auto guard = LockService();
196 196
197 Result result = ResultSuccess;
198
197 switch (ctx.GetCommandType()) { 199 switch (ctx.GetCommandType()) {
198 case IPC::CommandType::Close: 200 case IPC::CommandType::Close:
199 case IPC::CommandType::TIPC_Close: { 201 case IPC::CommandType::TIPC_Close: {
200 session.Close(); 202 session.Close();
201 IPC::ResponseBuilder rb{ctx, 2}; 203 IPC::ResponseBuilder rb{ctx, 2};
202 rb.Push(ResultSuccess); 204 rb.Push(ResultSuccess);
203 return IPC::ERR_REMOTE_PROCESS_DEAD; 205 result = IPC::ERR_REMOTE_PROCESS_DEAD;
206 break;
204 } 207 }
205 case IPC::CommandType::ControlWithContext: 208 case IPC::CommandType::ControlWithContext:
206 case IPC::CommandType::Control: { 209 case IPC::CommandType::Control: {
@@ -227,7 +230,7 @@ Result ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session,
227 ctx.WriteToOutgoingCommandBuffer(ctx.GetThread()); 230 ctx.WriteToOutgoingCommandBuffer(ctx.GetThread());
228 } 231 }
229 232
230 return ResultSuccess; 233 return result;
231} 234}
232 235
233/// Initialize Services 236/// Initialize Services
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp
deleted file mode 100644
index dfb10c34f..000000000
--- a/src/core/loader/elf.cpp
+++ /dev/null
@@ -1,263 +0,0 @@
1// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
2// SPDX-FileCopyrightText: 2014 Citra Emulator Project
3// SPDX-License-Identifier: GPL-2.0-or-later
4
5#include <cstring>
6#include <memory>
7#include "common/common_funcs.h"
8#include "common/common_types.h"
9#include "common/elf.h"
10#include "common/logging/log.h"
11#include "core/hle/kernel/code_set.h"
12#include "core/hle/kernel/k_page_table.h"
13#include "core/hle/kernel/k_process.h"
14#include "core/loader/elf.h"
15#include "core/memory.h"
16
17using namespace Common::ELF;
18
19////////////////////////////////////////////////////////////////////////////////////////////////////
20// ElfReader class
21
22typedef int SectionID;
23
24class ElfReader {
25private:
26 char* base;
27 u32* base32;
28
29 Elf32_Ehdr* header;
30 Elf32_Phdr* segments;
31 Elf32_Shdr* sections;
32
33 u32* sectionAddrs;
34 bool relocate;
35 VAddr entryPoint;
36
37public:
38 explicit ElfReader(void* ptr);
39
40 u32 Read32(int off) const {
41 return base32[off >> 2];
42 }
43
44 // Quick accessors
45 u16 GetType() const {
46 return header->e_type;
47 }
48 u16 GetMachine() const {
49 return header->e_machine;
50 }
51 VAddr GetEntryPoint() const {
52 return entryPoint;
53 }
54 u32 GetFlags() const {
55 return (u32)(header->e_flags);
56 }
57 Kernel::CodeSet LoadInto(VAddr vaddr);
58
59 int GetNumSegments() const {
60 return (int)(header->e_phnum);
61 }
62 int GetNumSections() const {
63 return (int)(header->e_shnum);
64 }
65 const u8* GetPtr(int offset) const {
66 return (u8*)base + offset;
67 }
68 const char* GetSectionName(int section) const;
69 const u8* GetSectionDataPtr(int section) const {
70 if (section < 0 || section >= header->e_shnum)
71 return nullptr;
72 if (sections[section].sh_type != ElfShtNobits)
73 return GetPtr(sections[section].sh_offset);
74 else
75 return nullptr;
76 }
77 bool IsCodeSection(int section) const {
78 return sections[section].sh_type == ElfShtProgBits;
79 }
80 const u8* GetSegmentPtr(int segment) {
81 return GetPtr(segments[segment].p_offset);
82 }
83 u32 GetSectionAddr(SectionID section) const {
84 return sectionAddrs[section];
85 }
86 unsigned int GetSectionSize(SectionID section) const {
87 return sections[section].sh_size;
88 }
89 SectionID GetSectionByName(const char* name, int firstSection = 0) const; //-1 for not found
90
91 bool DidRelocate() const {
92 return relocate;
93 }
94};
95
96ElfReader::ElfReader(void* ptr) {
97 base = (char*)ptr;
98 base32 = (u32*)ptr;
99 header = (Elf32_Ehdr*)ptr;
100
101 segments = (Elf32_Phdr*)(base + header->e_phoff);
102 sections = (Elf32_Shdr*)(base + header->e_shoff);
103
104 entryPoint = header->e_entry;
105}
106
107const char* ElfReader::GetSectionName(int section) const {
108 if (sections[section].sh_type == ElfShtNull)
109 return nullptr;
110
111 int name_offset = sections[section].sh_name;
112 const char* ptr = reinterpret_cast<const char*>(GetSectionDataPtr(header->e_shstrndx));
113
114 if (ptr)
115 return ptr + name_offset;
116
117 return nullptr;
118}
119
120Kernel::CodeSet ElfReader::LoadInto(VAddr vaddr) {
121 LOG_DEBUG(Loader, "String section: {}", header->e_shstrndx);
122
123 // Should we relocate?
124 relocate = (header->e_type != ElfTypeExec);
125
126 if (relocate) {
127 LOG_DEBUG(Loader, "Relocatable module");
128 entryPoint += vaddr;
129 } else {
130 LOG_DEBUG(Loader, "Prerelocated executable");
131 }
132 LOG_DEBUG(Loader, "{} segments:", header->e_phnum);
133
134 // First pass : Get the bits into RAM
135 const VAddr base_addr = relocate ? vaddr : 0;
136
137 u64 total_image_size = 0;
138 for (unsigned int i = 0; i < header->e_phnum; ++i) {
139 const Elf32_Phdr* p = &segments[i];
140 if (p->p_type == ElfPtLoad) {
141 total_image_size += (p->p_memsz + 0xFFF) & ~0xFFF;
142 }
143 }
144
145 Kernel::PhysicalMemory program_image(total_image_size);
146 std::size_t current_image_position = 0;
147
148 Kernel::CodeSet codeset;
149
150 for (unsigned int i = 0; i < header->e_phnum; ++i) {
151 const Elf32_Phdr* p = &segments[i];
152 LOG_DEBUG(Loader, "Type: {} Vaddr: {:08X} Filesz: {:08X} Memsz: {:08X} ", p->p_type,
153 p->p_vaddr, p->p_filesz, p->p_memsz);
154
155 if (p->p_type == ElfPtLoad) {
156 Kernel::CodeSet::Segment* codeset_segment;
157 u32 permission_flags = p->p_flags & (ElfPfRead | ElfPfWrite | ElfPfExec);
158 if (permission_flags == (ElfPfRead | ElfPfExec)) {
159 codeset_segment = &codeset.CodeSegment();
160 } else if (permission_flags == (ElfPfRead)) {
161 codeset_segment = &codeset.RODataSegment();
162 } else if (permission_flags == (ElfPfRead | ElfPfWrite)) {
163 codeset_segment = &codeset.DataSegment();
164 } else {
165 LOG_ERROR(Loader, "Unexpected ELF PT_LOAD segment id {} with flags {:X}", i,
166 p->p_flags);
167 continue;
168 }
169
170 if (codeset_segment->size != 0) {
171 LOG_ERROR(Loader,
172 "ELF has more than one segment of the same type. Skipping extra "
173 "segment (id {})",
174 i);
175 continue;
176 }
177
178 const VAddr segment_addr = base_addr + p->p_vaddr;
179 const u32 aligned_size = (p->p_memsz + 0xFFF) & ~0xFFF;
180
181 codeset_segment->offset = current_image_position;
182 codeset_segment->addr = segment_addr;
183 codeset_segment->size = aligned_size;
184
185 std::memcpy(program_image.data() + current_image_position, GetSegmentPtr(i),
186 p->p_filesz);
187 current_image_position += aligned_size;
188 }
189 }
190
191 codeset.entrypoint = base_addr + header->e_entry;
192 codeset.memory = std::move(program_image);
193
194 LOG_DEBUG(Loader, "Done loading.");
195
196 return codeset;
197}
198
199SectionID ElfReader::GetSectionByName(const char* name, int firstSection) const {
200 for (int i = firstSection; i < header->e_shnum; i++) {
201 const char* secname = GetSectionName(i);
202
203 if (secname != nullptr && strcmp(name, secname) == 0)
204 return i;
205 }
206 return -1;
207}
208
209////////////////////////////////////////////////////////////////////////////////////////////////////
210// Loader namespace
211
212namespace Loader {
213
214AppLoader_ELF::AppLoader_ELF(FileSys::VirtualFile file_) : AppLoader(std::move(file_)) {}
215
216FileType AppLoader_ELF::IdentifyType(const FileSys::VirtualFile& elf_file) {
217 static constexpr u16 ELF_MACHINE_ARM{0x28};
218
219 u32 magic = 0;
220 if (4 != elf_file->ReadObject(&magic)) {
221 return FileType::Error;
222 }
223
224 u16 machine = 0;
225 if (2 != elf_file->ReadObject(&machine, 18)) {
226 return FileType::Error;
227 }
228
229 if (Common::MakeMagic('\x7f', 'E', 'L', 'F') == magic && ELF_MACHINE_ARM == machine) {
230 return FileType::ELF;
231 }
232
233 return FileType::Error;
234}
235
236AppLoader_ELF::LoadResult AppLoader_ELF::Load(Kernel::KProcess& process,
237 [[maybe_unused]] Core::System& system) {
238 if (is_loaded) {
239 return {ResultStatus::ErrorAlreadyLoaded, {}};
240 }
241
242 std::vector<u8> buffer = file->ReadAllBytes();
243 if (buffer.size() != file->GetSize()) {
244 return {ResultStatus::ErrorIncorrectELFFileSize, {}};
245 }
246
247 const VAddr base_address = process.PageTable().GetCodeRegionStart();
248 ElfReader elf_reader(&buffer[0]);
249 Kernel::CodeSet codeset = elf_reader.LoadInto(base_address);
250 const VAddr entry_point = codeset.entrypoint;
251
252 // Setup the process code layout
253 if (process.LoadFromMetadata(FileSys::ProgramMetadata::GetDefault(), buffer.size()).IsError()) {
254 return {ResultStatus::ErrorNotInitialized, {}};
255 }
256
257 process.LoadModule(std::move(codeset), entry_point);
258
259 is_loaded = true;
260 return {ResultStatus::Success, LoadParameters{48, Core::Memory::DEFAULT_STACK_SIZE}};
261}
262
263} // namespace Loader
diff --git a/src/core/loader/elf.h b/src/core/loader/elf.h
deleted file mode 100644
index acd33dc3d..000000000
--- a/src/core/loader/elf.h
+++ /dev/null
@@ -1,36 +0,0 @@
1// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
2// SPDX-FileCopyrightText: 2014 Citra Emulator Project
3// SPDX-License-Identifier: GPL-2.0-or-later
4
5#pragma once
6
7#include "core/loader/loader.h"
8
9namespace Core {
10class System;
11}
12
13namespace Loader {
14
15/// Loads an ELF/AXF file
16class AppLoader_ELF final : public AppLoader {
17public:
18 explicit AppLoader_ELF(FileSys::VirtualFile file);
19
20 /**
21 * Identifies whether or not the given file is an ELF file.
22 *
23 * @param elf_file The file to identify.
24 *
25 * @return FileType::ELF, or FileType::Error if the file is not an ELF file.
26 */
27 static FileType IdentifyType(const FileSys::VirtualFile& elf_file);
28
29 FileType GetFileType() const override {
30 return IdentifyType(file);
31 }
32
33 LoadResult Load(Kernel::KProcess& process, Core::System& system) override;
34};
35
36} // namespace Loader
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp
index 994ee891f..104d16efa 100644
--- a/src/core/loader/loader.cpp
+++ b/src/core/loader/loader.cpp
@@ -12,7 +12,6 @@
12#include "core/core.h" 12#include "core/core.h"
13#include "core/hle/kernel/k_process.h" 13#include "core/hle/kernel/k_process.h"
14#include "core/loader/deconstructed_rom_directory.h" 14#include "core/loader/deconstructed_rom_directory.h"
15#include "core/loader/elf.h"
16#include "core/loader/kip.h" 15#include "core/loader/kip.h"
17#include "core/loader/nax.h" 16#include "core/loader/nax.h"
18#include "core/loader/nca.h" 17#include "core/loader/nca.h"
@@ -39,8 +38,6 @@ std::optional<FileType> IdentifyFileLoader(FileSys::VirtualFile file) {
39FileType IdentifyFile(FileSys::VirtualFile file) { 38FileType IdentifyFile(FileSys::VirtualFile file) {
40 if (const auto romdir_type = IdentifyFileLoader<AppLoader_DeconstructedRomDirectory>(file)) { 39 if (const auto romdir_type = IdentifyFileLoader<AppLoader_DeconstructedRomDirectory>(file)) {
41 return *romdir_type; 40 return *romdir_type;
42 } else if (const auto elf_type = IdentifyFileLoader<AppLoader_ELF>(file)) {
43 return *elf_type;
44 } else if (const auto nso_type = IdentifyFileLoader<AppLoader_NSO>(file)) { 41 } else if (const auto nso_type = IdentifyFileLoader<AppLoader_NSO>(file)) {
45 return *nso_type; 42 return *nso_type;
46 } else if (const auto nro_type = IdentifyFileLoader<AppLoader_NRO>(file)) { 43 } else if (const auto nro_type = IdentifyFileLoader<AppLoader_NRO>(file)) {
@@ -69,8 +66,6 @@ FileType GuessFromFilename(const std::string& name) {
69 const std::string extension = 66 const std::string extension =
70 Common::ToLower(std::string(Common::FS::GetExtensionFromFilename(name))); 67 Common::ToLower(std::string(Common::FS::GetExtensionFromFilename(name)));
71 68
72 if (extension == "elf")
73 return FileType::ELF;
74 if (extension == "nro") 69 if (extension == "nro")
75 return FileType::NRO; 70 return FileType::NRO;
76 if (extension == "nso") 71 if (extension == "nso")
@@ -89,8 +84,6 @@ FileType GuessFromFilename(const std::string& name) {
89 84
90std::string GetFileTypeString(FileType type) { 85std::string GetFileTypeString(FileType type) {
91 switch (type) { 86 switch (type) {
92 case FileType::ELF:
93 return "ELF";
94 case FileType::NRO: 87 case FileType::NRO:
95 return "NRO"; 88 return "NRO";
96 case FileType::NSO: 89 case FileType::NSO:
@@ -208,10 +201,6 @@ static std::unique_ptr<AppLoader> GetFileLoader(Core::System& system, FileSys::V
208 FileType type, u64 program_id, 201 FileType type, u64 program_id,
209 std::size_t program_index) { 202 std::size_t program_index) {
210 switch (type) { 203 switch (type) {
211 // Standard ELF file format.
212 case FileType::ELF:
213 return std::make_unique<AppLoader_ELF>(std::move(file));
214
215 // NX NSO file format. 204 // NX NSO file format.
216 case FileType::NSO: 205 case FileType::NSO:
217 return std::make_unique<AppLoader_NSO>(std::move(file)); 206 return std::make_unique<AppLoader_NSO>(std::move(file));
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h
index 7bf4faaf1..7b43f70ed 100644
--- a/src/core/loader/loader.h
+++ b/src/core/loader/loader.h
@@ -34,7 +34,6 @@ namespace Loader {
34enum class FileType { 34enum class FileType {
35 Error, 35 Error,
36 Unknown, 36 Unknown,
37 ELF,
38 NSO, 37 NSO,
39 NRO, 38 NRO,
40 NCA, 39 NCA,
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index 635449fce..1b44280b5 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <algorithm> 4#include <algorithm>
6#include <cstring> 5#include <cstring>
diff --git a/src/core/memory.h b/src/core/memory.h
index 780c45385..2a21fbcfd 100644
--- a/src/core/memory.h
+++ b/src/core/memory.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp
index 6ef459b7a..f09c176f8 100644
--- a/src/core/perf_stats.cpp
+++ b/src/core/perf_stats.cpp
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <algorithm> 4#include <algorithm>
6#include <chrono> 5#include <chrono>
diff --git a/src/core/perf_stats.h b/src/core/perf_stats.h
index 816202588..dd6becc02 100644
--- a/src/core/perf_stats.h
+++ b/src/core/perf_stats.h
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp
index 654db0b52..abcf6eb11 100644
--- a/src/core/telemetry_session.cpp
+++ b/src/core/telemetry_session.cpp
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <array> 4#include <array>
6 5
diff --git a/src/core/telemetry_session.h b/src/core/telemetry_session.h
index 6f3d45bea..887dc98f3 100644
--- a/src/core/telemetry_session.h
+++ b/src/core/telemetry_session.h
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt
index 90dd629c6..4b91b88ce 100644
--- a/src/input_common/CMakeLists.txt
+++ b/src/input_common/CMakeLists.txt
@@ -1,3 +1,6 @@
1# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
1add_library(input_common STATIC 4add_library(input_common STATIC
2 drivers/camera.cpp 5 drivers/camera.cpp
3 drivers/camera.h 6 drivers/camera.h
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp
index 00474ac77..de388ec4c 100644
--- a/src/input_common/drivers/sdl_driver.cpp
+++ b/src/input_common/drivers/sdl_driver.cpp
@@ -1,6 +1,5 @@
1// Copyright 2018 Citra Emulator Project 1// SPDX-FileCopyrightText: 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include "common/logging/log.h" 4#include "common/logging/log.h"
6#include "common/math_util.h" 5#include "common/math_util.h"
diff --git a/src/input_common/drivers/sdl_driver.h b/src/input_common/drivers/sdl_driver.h
index 7dc7a93c7..fc3a44572 100644
--- a/src/input_common/drivers/sdl_driver.h
+++ b/src/input_common/drivers/sdl_driver.h
@@ -1,6 +1,5 @@
1// Copyright 2018 Citra Emulator Project 1// SPDX-FileCopyrightText: 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/input_common/drivers/tas_input.cpp b/src/input_common/drivers/tas_input.cpp
index 66dbefe00..21c6ed405 100644
--- a/src/input_common/drivers/tas_input.cpp
+++ b/src/input_common/drivers/tas_input.cpp
@@ -1,5 +1,5 @@
1// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later. 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include <cstring> 4#include <cstring>
5#include <fmt/format.h> 5#include <fmt/format.h>
diff --git a/src/input_common/drivers/udp_client.cpp b/src/input_common/drivers/udp_client.cpp
index 825262a07..808b21069 100644
--- a/src/input_common/drivers/udp_client.cpp
+++ b/src/input_common/drivers/udp_client.cpp
@@ -1,6 +1,5 @@
1// Copyright 2018 Citra Emulator Project 1// SPDX-FileCopyrightText: 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <random> 4#include <random>
6#include <boost/asio.hpp> 5#include <boost/asio.hpp>
diff --git a/src/input_common/drivers/udp_client.h b/src/input_common/drivers/udp_client.h
index dece2a45b..cea9f579a 100644
--- a/src/input_common/drivers/udp_client.h
+++ b/src/input_common/drivers/udp_client.h
@@ -1,6 +1,5 @@
1// Copyright 2018 Citra Emulator Project 1// SPDX-FileCopyrightText: 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/input_common/helpers/stick_from_buttons.cpp b/src/input_common/helpers/stick_from_buttons.cpp
index 31e6f62ab..536d413a5 100644
--- a/src/input_common/helpers/stick_from_buttons.cpp
+++ b/src/input_common/helpers/stick_from_buttons.cpp
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <chrono> 4#include <chrono>
6#include <cmath> 5#include <cmath>
diff --git a/src/input_common/helpers/stick_from_buttons.h b/src/input_common/helpers/stick_from_buttons.h
index 437ace4f7..e8d865743 100644
--- a/src/input_common/helpers/stick_from_buttons.h
+++ b/src/input_common/helpers/stick_from_buttons.h
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/input_common/helpers/touch_from_buttons.cpp b/src/input_common/helpers/touch_from_buttons.cpp
index f1b57d03a..da4a3dca5 100644
--- a/src/input_common/helpers/touch_from_buttons.cpp
+++ b/src/input_common/helpers/touch_from_buttons.cpp
@@ -1,6 +1,5 @@
1// Copyright 2020 Citra Emulator Project 1// SPDX-FileCopyrightText: 2020 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <algorithm> 4#include <algorithm>
6#include "common/settings.h" 5#include "common/settings.h"
diff --git a/src/input_common/helpers/touch_from_buttons.h b/src/input_common/helpers/touch_from_buttons.h
index 628f18215..c6cb3ab3c 100644
--- a/src/input_common/helpers/touch_from_buttons.h
+++ b/src/input_common/helpers/touch_from_buttons.h
@@ -1,6 +1,5 @@
1// Copyright 2020 Citra Emulator Project 1// SPDX-FileCopyrightText: 2020 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/input_common/helpers/udp_protocol.cpp b/src/input_common/helpers/udp_protocol.cpp
index cdeab7e11..994380d21 100644
--- a/src/input_common/helpers/udp_protocol.cpp
+++ b/src/input_common/helpers/udp_protocol.cpp
@@ -1,6 +1,5 @@
1// Copyright 2018 Citra Emulator Project 1// SPDX-FileCopyrightText: 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <cstddef> 4#include <cstddef>
6#include <cstring> 5#include <cstring>
diff --git a/src/input_common/helpers/udp_protocol.h b/src/input_common/helpers/udp_protocol.h
index 889693e73..d9643ffe0 100644
--- a/src/input_common/helpers/udp_protocol.h
+++ b/src/input_common/helpers/udp_protocol.h
@@ -1,6 +1,5 @@
1// Copyright 2018 Citra Emulator Project 1// SPDX-FileCopyrightText: 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp
index ca1cb9542..75a57b9fc 100644
--- a/src/input_common/main.cpp
+++ b/src/input_common/main.cpp
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <memory> 4#include <memory>
6#include "common/input.h" 5#include "common/input.h"
diff --git a/src/input_common/main.h b/src/input_common/main.h
index b756bb5c6..9a969e747 100644
--- a/src/input_common/main.h
+++ b/src/input_common/main.h
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt
index 382a69e2f..312f79b68 100644
--- a/src/network/CMakeLists.txt
+++ b/src/network/CMakeLists.txt
@@ -1,3 +1,6 @@
1# SPDX-FileCopyrightText: 2022 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-3.0-or-later
3
1add_library(network STATIC 4add_library(network STATIC
2 network.cpp 5 network.cpp
3 network.h 6 network.h
diff --git a/src/shader_recompiler/CMakeLists.txt b/src/shader_recompiler/CMakeLists.txt
index ae1dbe619..af8e51fe8 100644
--- a/src/shader_recompiler/CMakeLists.txt
+++ b/src/shader_recompiler/CMakeLists.txt
@@ -1,3 +1,6 @@
1# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
1add_library(shader_recompiler STATIC 4add_library(shader_recompiler STATIC
2 backend/bindings.h 5 backend/bindings.h
3 backend/glasm/emit_glasm.cpp 6 backend/glasm/emit_glasm.cpp
diff --git a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp
index d4a49ea99..98dd9035a 100644
--- a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp
+++ b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp
@@ -1306,7 +1306,7 @@ void EmitContext::DefineInputs(const IR::Program& program) {
1306 subgroup_mask_gt = DefineInput(*this, U32[4], false, spv::BuiltIn::SubgroupGtMaskKHR); 1306 subgroup_mask_gt = DefineInput(*this, U32[4], false, spv::BuiltIn::SubgroupGtMaskKHR);
1307 subgroup_mask_ge = DefineInput(*this, U32[4], false, spv::BuiltIn::SubgroupGeMaskKHR); 1307 subgroup_mask_ge = DefineInput(*this, U32[4], false, spv::BuiltIn::SubgroupGeMaskKHR);
1308 } 1308 }
1309 if (info.uses_subgroup_invocation_id || info.uses_subgroup_shuffles || 1309 if (info.uses_fswzadd || info.uses_subgroup_invocation_id || info.uses_subgroup_shuffles ||
1310 (profile.warp_size_potentially_larger_than_guest && 1310 (profile.warp_size_potentially_larger_than_guest &&
1311 (info.uses_subgroup_vote || info.uses_subgroup_mask))) { 1311 (info.uses_subgroup_vote || info.uses_subgroup_mask))) {
1312 subgroup_local_invocation_id = 1312 subgroup_local_invocation_id =
@@ -1411,7 +1411,8 @@ void EmitContext::DefineInputs(const IR::Program& program) {
1411void EmitContext::DefineOutputs(const IR::Program& program) { 1411void EmitContext::DefineOutputs(const IR::Program& program) {
1412 const Info& info{program.info}; 1412 const Info& info{program.info};
1413 const std::optional<u32> invocations{program.invocations}; 1413 const std::optional<u32> invocations{program.invocations};
1414 if (info.stores.AnyComponent(IR::Attribute::PositionX) || stage == Stage::VertexB) { 1414 if (runtime_info.convert_depth_mode || info.stores.AnyComponent(IR::Attribute::PositionX) ||
1415 stage == Stage::VertexB) {
1415 output_position = DefineOutput(*this, F32[4], invocations, spv::BuiltIn::Position); 1416 output_position = DefineOutput(*this, F32[4], invocations, spv::BuiltIn::Position);
1416 } 1417 }
1417 if (info.stores[IR::Attribute::PointSize] || runtime_info.fixed_state_point_size) { 1418 if (info.stores[IR::Attribute::PointSize] || runtime_info.fixed_state_point_size) {
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/logic_operation_three_input_lut3.py b/src/shader_recompiler/frontend/maxwell/translate/impl/logic_operation_three_input_lut3.py
index 8f547c266..e66d50d61 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/logic_operation_three_input_lut3.py
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/logic_operation_three_input_lut3.py
@@ -1,7 +1,5 @@
1# Copyright © 2022 degasus <markus@selfnet.de> 1# SPDX-FileCopyrightText: 2022 degasus <markus@selfnet.de>
2# This work is free. You can redistribute it and/or modify it under the 2# SPDX-License-Identifier: WTFPL
3# terms of the Do What The Fuck You Want To Public License, Version 2,
4# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
5 3
6from itertools import product 4from itertools import product
7 5
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index fbbcf673a..43ad2c7ff 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -1,3 +1,6 @@
1# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
1add_executable(tests 4add_executable(tests
2 common/bit_field.cpp 5 common/bit_field.cpp
3 common/cityhash.cpp 6 common/cityhash.cpp
diff --git a/src/tests/common/bit_field.cpp b/src/tests/common/bit_field.cpp
index 182638000..0071ae52e 100644
--- a/src/tests/common/bit_field.cpp
+++ b/src/tests/common/bit_field.cpp
@@ -1,6 +1,5 @@
1// Copyright 2019 Citra Emulator Project 1// SPDX-FileCopyrightText: 2019 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <array> 4#include <array>
6#include <cstring> 5#include <cstring>
diff --git a/src/tests/common/param_package.cpp b/src/tests/common/param_package.cpp
index e31ca3544..d036cc83a 100644
--- a/src/tests/common/param_package.cpp
+++ b/src/tests/common/param_package.cpp
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <catch2/catch.hpp> 4#include <catch2/catch.hpp>
6#include <math.h> 5#include <math.h>
diff --git a/src/tests/core/core_timing.cpp b/src/tests/core/core_timing.cpp
index 894975e6f..7c432a63c 100644
--- a/src/tests/core/core_timing.cpp
+++ b/src/tests/core/core_timing.cpp
@@ -8,7 +8,6 @@
8#include <chrono> 8#include <chrono>
9#include <cstdlib> 9#include <cstdlib>
10#include <memory> 10#include <memory>
11#include <mutex>
12#include <optional> 11#include <optional>
13#include <string> 12#include <string>
14 13
@@ -23,15 +22,14 @@ std::array<s64, 5> delays{};
23 22
24std::bitset<CB_IDS.size()> callbacks_ran_flags; 23std::bitset<CB_IDS.size()> callbacks_ran_flags;
25u64 expected_callback = 0; 24u64 expected_callback = 0;
26std::mutex control_mutex;
27 25
28template <unsigned int IDX> 26template <unsigned int IDX>
29std::optional<std::chrono::nanoseconds> HostCallbackTemplate(std::uintptr_t user_data, s64 time, 27std::optional<std::chrono::nanoseconds> HostCallbackTemplate(std::uintptr_t user_data, s64 time,
30 std::chrono::nanoseconds ns_late) { 28 std::chrono::nanoseconds ns_late) {
31 std::unique_lock<std::mutex> lk(control_mutex);
32 static_assert(IDX < CB_IDS.size(), "IDX out of range"); 29 static_assert(IDX < CB_IDS.size(), "IDX out of range");
33 callbacks_ran_flags.set(IDX); 30 callbacks_ran_flags.set(IDX);
34 REQUIRE(CB_IDS[IDX] == user_data); 31 REQUIRE(CB_IDS[IDX] == user_data);
32 REQUIRE(CB_IDS[IDX] == CB_IDS[calls_order[expected_callback]]);
35 delays[IDX] = ns_late.count(); 33 delays[IDX] = ns_late.count();
36 ++expected_callback; 34 ++expected_callback;
37 return std::nullopt; 35 return std::nullopt;
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp
index 275b430d9..3f905c05c 100644
--- a/src/tests/tests.cpp
+++ b/src/tests/tests.cpp
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#define CATCH_CONFIG_MAIN 4#define CATCH_CONFIG_MAIN
6#include <catch2/catch.hpp> 5#include <catch2/catch.hpp>
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt
index 14de7bc89..5b3808351 100644
--- a/src/video_core/CMakeLists.txt
+++ b/src/video_core/CMakeLists.txt
@@ -1,3 +1,6 @@
1# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
1add_subdirectory(host_shaders) 4add_subdirectory(host_shaders)
2 5
3if(LIBVA_FOUND) 6if(LIBVA_FOUND)
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp
index b0ce9f000..d43f7175a 100644
--- a/src/video_core/gpu_thread.cpp
+++ b/src/video_core/gpu_thread.cpp
@@ -31,8 +31,7 @@ static void RunThread(std::stop_token stop_token, Core::System& system,
31 VideoCore::RasterizerInterface* const rasterizer = renderer.ReadRasterizer(); 31 VideoCore::RasterizerInterface* const rasterizer = renderer.ReadRasterizer();
32 32
33 while (!stop_token.stop_requested()) { 33 while (!stop_token.stop_requested()) {
34 CommandDataContainer next; 34 CommandDataContainer next = state.queue.PopWait(stop_token);
35 state.queue.Pop(next, stop_token);
36 if (stop_token.stop_requested()) { 35 if (stop_token.stop_requested()) {
37 break; 36 break;
38 } 37 }
diff --git a/src/video_core/gpu_thread.h b/src/video_core/gpu_thread.h
index be0ac2214..2f8210cb9 100644
--- a/src/video_core/gpu_thread.h
+++ b/src/video_core/gpu_thread.h
@@ -10,7 +10,7 @@
10#include <thread> 10#include <thread>
11#include <variant> 11#include <variant>
12 12
13#include "common/bounded_threadsafe_queue.h" 13#include "common/threadsafe_queue.h"
14#include "video_core/framebuffer_config.h" 14#include "video_core/framebuffer_config.h"
15 15
16namespace Tegra { 16namespace Tegra {
@@ -96,7 +96,7 @@ struct CommandDataContainer {
96 96
97/// Struct used to synchronize the GPU thread 97/// Struct used to synchronize the GPU thread
98struct SynchState final { 98struct SynchState final {
99 using CommandQueue = Common::MPSCQueue<CommandDataContainer>; 99 using CommandQueue = Common::MPSCQueue<CommandDataContainer, true>;
100 std::mutex write_lock; 100 std::mutex write_lock;
101 CommandQueue queue; 101 CommandQueue queue;
102 u64 last_fence{}; 102 u64 last_fence{};
diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt
index 190fc6aea..2149ab93e 100644
--- a/src/video_core/host_shaders/CMakeLists.txt
+++ b/src/video_core/host_shaders/CMakeLists.txt
@@ -1,3 +1,6 @@
1# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
1set(FIDELITYFX_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/externals/FidelityFX-FSR/ffx-fsr) 4set(FIDELITYFX_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/externals/FidelityFX-FSR/ffx-fsr)
2 5
3set(GLSL_INCLUDES 6set(GLSL_INCLUDES
diff --git a/src/video_core/host_shaders/StringShaderHeader.cmake b/src/video_core/host_shaders/StringShaderHeader.cmake
index 1b4bc6103..9f7525535 100644
--- a/src/video_core/host_shaders/StringShaderHeader.cmake
+++ b/src/video_core/host_shaders/StringShaderHeader.cmake
@@ -1,3 +1,6 @@
1# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
1set(SOURCE_FILE ${CMAKE_ARGV3}) 4set(SOURCE_FILE ${CMAKE_ARGV3})
2set(HEADER_FILE ${CMAKE_ARGV4}) 5set(HEADER_FILE ${CMAKE_ARGV4})
3set(INPUT_FILE ${CMAKE_ARGV5}) 6set(INPUT_FILE ${CMAKE_ARGV5})
diff --git a/src/video_core/host_shaders/source_shader.h.in b/src/video_core/host_shaders/source_shader.h.in
index 929dec39b..f189ee06b 100644
--- a/src/video_core/host_shaders/source_shader.h.in
+++ b/src/video_core/host_shaders/source_shader.h.in
@@ -1,3 +1,6 @@
1// SPDX-FileCopyrightText: 2020 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
1#pragma once 4#pragma once
2 5
3#include <string_view> 6#include <string_view>
diff --git a/src/video_core/host_shaders/vulkan_present_scaleforce_fp16.frag b/src/video_core/host_shaders/vulkan_present_scaleforce_fp16.frag
index 924c03060..3dc9c0df5 100644
--- a/src/video_core/host_shaders/vulkan_present_scaleforce_fp16.frag
+++ b/src/video_core/host_shaders/vulkan_present_scaleforce_fp16.frag
@@ -1,3 +1,6 @@
1// SPDX-FileCopyrightText: 2021 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
1#version 460 4#version 460
2 5
3#extension GL_GOOGLE_include_directive : enable 6#extension GL_GOOGLE_include_directive : enable
diff --git a/src/video_core/host_shaders/vulkan_present_scaleforce_fp32.frag b/src/video_core/host_shaders/vulkan_present_scaleforce_fp32.frag
index a594b83ca..77ed07552 100644
--- a/src/video_core/host_shaders/vulkan_present_scaleforce_fp32.frag
+++ b/src/video_core/host_shaders/vulkan_present_scaleforce_fp32.frag
@@ -1,3 +1,6 @@
1// SPDX-FileCopyrightText: 2021 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
1#version 460 4#version 460
2 5
3#extension GL_GOOGLE_include_directive : enable 6#extension GL_GOOGLE_include_directive : enable
diff --git a/src/video_core/renderer_base.cpp b/src/video_core/renderer_base.cpp
index 9756a81d6..45791aa75 100644
--- a/src/video_core/renderer_base.cpp
+++ b/src/video_core/renderer_base.cpp
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include "common/logging/log.h" 4#include "common/logging/log.h"
6#include "core/frontend/emu_window.h" 5#include "core/frontend/emu_window.h"
diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h
index 30d19b178..8d20cbece 100644
--- a/src/video_core/renderer_base.h
+++ b/src/video_core/renderer_base.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 159b71161..a0d048b0b 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <algorithm> 4#include <algorithm>
6#include <array> 5#include <array>
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index c79461d59..31a16fcba 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/video_core/renderer_opengl/gl_resource_manager.cpp b/src/video_core/renderer_opengl/gl_resource_manager.cpp
index f6839a657..3a664fdec 100644
--- a/src/video_core/renderer_opengl/gl_resource_manager.cpp
+++ b/src/video_core/renderer_opengl/gl_resource_manager.cpp
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <string_view> 4#include <string_view>
6#include <glad/glad.h> 5#include <glad/glad.h>
diff --git a/src/video_core/renderer_opengl/gl_resource_manager.h b/src/video_core/renderer_opengl/gl_resource_manager.h
index 84e07f8bd..bc05ba4bd 100644
--- a/src/video_core/renderer_opengl/gl_resource_manager.h
+++ b/src/video_core/renderer_opengl/gl_resource_manager.h
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index 07d4b7cf0..1ad56d9e7 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -299,7 +299,7 @@ void ShaderCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading,
299 state.has_loaded = true; 299 state.has_loaded = true;
300 lock.unlock(); 300 lock.unlock();
301 301
302 workers->WaitForRequests(); 302 workers->WaitForRequests(stop_loading);
303 if (!use_asynchronous_shaders) { 303 if (!use_asynchronous_shaders) {
304 workers.reset(); 304 workers.reset();
305 } 305 }
diff --git a/src/video_core/renderer_opengl/gl_shader_util.cpp b/src/video_core/renderer_opengl/gl_shader_util.cpp
index 129966e72..a0d9d10ef 100644
--- a/src/video_core/renderer_opengl/gl_shader_util.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_util.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <string_view> 4#include <string_view>
6#include <vector> 5#include <vector>
@@ -18,6 +17,7 @@ static OGLProgram LinkSeparableProgram(GLuint shader) {
18 glProgramParameteri(program.handle, GL_PROGRAM_SEPARABLE, GL_TRUE); 17 glProgramParameteri(program.handle, GL_PROGRAM_SEPARABLE, GL_TRUE);
19 glAttachShader(program.handle, shader); 18 glAttachShader(program.handle, shader);
20 glLinkProgram(program.handle); 19 glLinkProgram(program.handle);
20 glDetachShader(program.handle, shader);
21 if (!Settings::values.renderer_debug) { 21 if (!Settings::values.renderer_debug) {
22 return program; 22 return program;
23 } 23 }
diff --git a/src/video_core/renderer_opengl/gl_shader_util.h b/src/video_core/renderer_opengl/gl_shader_util.h
index a64ef37dc..43ebcdeba 100644
--- a/src/video_core/renderer_opengl/gl_shader_util.h
+++ b/src/video_core/renderer_opengl/gl_shader_util.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 9a9243544..01028cee0 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <algorithm> 4#include <algorithm>
6#include <cstddef> 5#include <cstddef>
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h
index ae9558a33..1a32e739d 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.h
+++ b/src/video_core/renderer_opengl/renderer_opengl.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp
index 689164a6a..7d1431b6d 100644
--- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp
+++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp
@@ -317,195 +317,204 @@ VkPrimitiveTopology PrimitiveTopology([[maybe_unused]] const Device& device,
317 } 317 }
318} 318}
319 319
320VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttribute::Size size) { 320VkFormat VertexFormat(const Device& device, Maxwell::VertexAttribute::Type type,
321 switch (type) { 321 Maxwell::VertexAttribute::Size size) {
322 case Maxwell::VertexAttribute::Type::UnsignedNorm: 322 const VkFormat format{([&]() {
323 switch (size) { 323 switch (type) {
324 case Maxwell::VertexAttribute::Size::Size_8: 324 case Maxwell::VertexAttribute::Type::UnsignedNorm:
325 return VK_FORMAT_R8_UNORM; 325 switch (size) {
326 case Maxwell::VertexAttribute::Size::Size_8_8: 326 case Maxwell::VertexAttribute::Size::Size_8:
327 return VK_FORMAT_R8G8_UNORM; 327 return VK_FORMAT_R8_UNORM;
328 case Maxwell::VertexAttribute::Size::Size_8_8_8: 328 case Maxwell::VertexAttribute::Size::Size_8_8:
329 return VK_FORMAT_R8G8B8_UNORM; 329 return VK_FORMAT_R8G8_UNORM;
330 case Maxwell::VertexAttribute::Size::Size_8_8_8_8: 330 case Maxwell::VertexAttribute::Size::Size_8_8_8:
331 return VK_FORMAT_R8G8B8A8_UNORM; 331 return VK_FORMAT_R8G8B8_UNORM;
332 case Maxwell::VertexAttribute::Size::Size_16: 332 case Maxwell::VertexAttribute::Size::Size_8_8_8_8:
333 return VK_FORMAT_R16_UNORM; 333 return VK_FORMAT_R8G8B8A8_UNORM;
334 case Maxwell::VertexAttribute::Size::Size_16_16: 334 case Maxwell::VertexAttribute::Size::Size_16:
335 return VK_FORMAT_R16G16_UNORM; 335 return VK_FORMAT_R16_UNORM;
336 case Maxwell::VertexAttribute::Size::Size_16_16_16: 336 case Maxwell::VertexAttribute::Size::Size_16_16:
337 return VK_FORMAT_R16G16B16_UNORM; 337 return VK_FORMAT_R16G16_UNORM;
338 case Maxwell::VertexAttribute::Size::Size_16_16_16_16: 338 case Maxwell::VertexAttribute::Size::Size_16_16_16:
339 return VK_FORMAT_R16G16B16A16_UNORM; 339 return VK_FORMAT_R16G16B16_UNORM;
340 case Maxwell::VertexAttribute::Size::Size_10_10_10_2: 340 case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
341 return VK_FORMAT_A2B10G10R10_UNORM_PACK32; 341 return VK_FORMAT_R16G16B16A16_UNORM;
342 default: 342 case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
343 return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
344 default:
345 break;
346 }
343 break; 347 break;
344 } 348 case Maxwell::VertexAttribute::Type::SignedNorm:
345 break; 349 switch (size) {
346 case Maxwell::VertexAttribute::Type::SignedNorm: 350 case Maxwell::VertexAttribute::Size::Size_8:
347 switch (size) { 351 return VK_FORMAT_R8_SNORM;
348 case Maxwell::VertexAttribute::Size::Size_8: 352 case Maxwell::VertexAttribute::Size::Size_8_8:
349 return VK_FORMAT_R8_SNORM; 353 return VK_FORMAT_R8G8_SNORM;
350 case Maxwell::VertexAttribute::Size::Size_8_8: 354 case Maxwell::VertexAttribute::Size::Size_8_8_8:
351 return VK_FORMAT_R8G8_SNORM; 355 return VK_FORMAT_R8G8B8_SNORM;
352 case Maxwell::VertexAttribute::Size::Size_8_8_8: 356 case Maxwell::VertexAttribute::Size::Size_8_8_8_8:
353 return VK_FORMAT_R8G8B8_SNORM; 357 return VK_FORMAT_R8G8B8A8_SNORM;
354 case Maxwell::VertexAttribute::Size::Size_8_8_8_8: 358 case Maxwell::VertexAttribute::Size::Size_16:
355 return VK_FORMAT_R8G8B8A8_SNORM; 359 return VK_FORMAT_R16_SNORM;
356 case Maxwell::VertexAttribute::Size::Size_16: 360 case Maxwell::VertexAttribute::Size::Size_16_16:
357 return VK_FORMAT_R16_SNORM; 361 return VK_FORMAT_R16G16_SNORM;
358 case Maxwell::VertexAttribute::Size::Size_16_16: 362 case Maxwell::VertexAttribute::Size::Size_16_16_16:
359 return VK_FORMAT_R16G16_SNORM; 363 return VK_FORMAT_R16G16B16_SNORM;
360 case Maxwell::VertexAttribute::Size::Size_16_16_16: 364 case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
361 return VK_FORMAT_R16G16B16_SNORM; 365 return VK_FORMAT_R16G16B16A16_SNORM;
362 case Maxwell::VertexAttribute::Size::Size_16_16_16_16: 366 case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
363 return VK_FORMAT_R16G16B16A16_SNORM; 367 return VK_FORMAT_A2B10G10R10_SNORM_PACK32;
364 case Maxwell::VertexAttribute::Size::Size_10_10_10_2: 368 default:
365 return VK_FORMAT_A2B10G10R10_SNORM_PACK32; 369 break;
366 default: 370 }
367 break; 371 break;
368 } 372 case Maxwell::VertexAttribute::Type::UnsignedScaled:
369 break; 373 switch (size) {
370 case Maxwell::VertexAttribute::Type::UnsignedScaled: 374 case Maxwell::VertexAttribute::Size::Size_8:
371 switch (size) { 375 return VK_FORMAT_R8_USCALED;
372 case Maxwell::VertexAttribute::Size::Size_8: 376 case Maxwell::VertexAttribute::Size::Size_8_8:
373 return VK_FORMAT_R8_USCALED; 377 return VK_FORMAT_R8G8_USCALED;
374 case Maxwell::VertexAttribute::Size::Size_8_8: 378 case Maxwell::VertexAttribute::Size::Size_8_8_8:
375 return VK_FORMAT_R8G8_USCALED; 379 return VK_FORMAT_R8G8B8_USCALED;
376 case Maxwell::VertexAttribute::Size::Size_8_8_8: 380 case Maxwell::VertexAttribute::Size::Size_8_8_8_8:
377 return VK_FORMAT_R8G8B8_USCALED; 381 return VK_FORMAT_R8G8B8A8_USCALED;
378 case Maxwell::VertexAttribute::Size::Size_8_8_8_8: 382 case Maxwell::VertexAttribute::Size::Size_16:
379 return VK_FORMAT_R8G8B8A8_USCALED; 383 return VK_FORMAT_R16_USCALED;
380 case Maxwell::VertexAttribute::Size::Size_16: 384 case Maxwell::VertexAttribute::Size::Size_16_16:
381 return VK_FORMAT_R16_USCALED; 385 return VK_FORMAT_R16G16_USCALED;
382 case Maxwell::VertexAttribute::Size::Size_16_16: 386 case Maxwell::VertexAttribute::Size::Size_16_16_16:
383 return VK_FORMAT_R16G16_USCALED; 387 return VK_FORMAT_R16G16B16_USCALED;
384 case Maxwell::VertexAttribute::Size::Size_16_16_16: 388 case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
385 return VK_FORMAT_R16G16B16_USCALED; 389 return VK_FORMAT_R16G16B16A16_USCALED;
386 case Maxwell::VertexAttribute::Size::Size_16_16_16_16: 390 case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
387 return VK_FORMAT_R16G16B16A16_USCALED; 391 return VK_FORMAT_A2B10G10R10_USCALED_PACK32;
388 case Maxwell::VertexAttribute::Size::Size_10_10_10_2: 392 default:
389 return VK_FORMAT_A2B10G10R10_USCALED_PACK32; 393 break;
390 default: 394 }
391 break; 395 break;
392 } 396 case Maxwell::VertexAttribute::Type::SignedScaled:
393 break; 397 switch (size) {
394 case Maxwell::VertexAttribute::Type::SignedScaled: 398 case Maxwell::VertexAttribute::Size::Size_8:
395 switch (size) { 399 return VK_FORMAT_R8_SSCALED;
396 case Maxwell::VertexAttribute::Size::Size_8: 400 case Maxwell::VertexAttribute::Size::Size_8_8:
397 return VK_FORMAT_R8_SSCALED; 401 return VK_FORMAT_R8G8_SSCALED;
398 case Maxwell::VertexAttribute::Size::Size_8_8: 402 case Maxwell::VertexAttribute::Size::Size_8_8_8:
399 return VK_FORMAT_R8G8_SSCALED; 403 return VK_FORMAT_R8G8B8_SSCALED;
400 case Maxwell::VertexAttribute::Size::Size_8_8_8: 404 case Maxwell::VertexAttribute::Size::Size_8_8_8_8:
401 return VK_FORMAT_R8G8B8_SSCALED; 405 return VK_FORMAT_R8G8B8A8_SSCALED;
402 case Maxwell::VertexAttribute::Size::Size_8_8_8_8: 406 case Maxwell::VertexAttribute::Size::Size_16:
403 return VK_FORMAT_R8G8B8A8_SSCALED; 407 return VK_FORMAT_R16_SSCALED;
404 case Maxwell::VertexAttribute::Size::Size_16: 408 case Maxwell::VertexAttribute::Size::Size_16_16:
405 return VK_FORMAT_R16_SSCALED; 409 return VK_FORMAT_R16G16_SSCALED;
406 case Maxwell::VertexAttribute::Size::Size_16_16: 410 case Maxwell::VertexAttribute::Size::Size_16_16_16:
407 return VK_FORMAT_R16G16_SSCALED; 411 return VK_FORMAT_R16G16B16_SSCALED;
408 case Maxwell::VertexAttribute::Size::Size_16_16_16: 412 case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
409 return VK_FORMAT_R16G16B16_SSCALED; 413 return VK_FORMAT_R16G16B16A16_SSCALED;
410 case Maxwell::VertexAttribute::Size::Size_16_16_16_16: 414 case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
411 return VK_FORMAT_R16G16B16A16_SSCALED; 415 return VK_FORMAT_A2B10G10R10_SSCALED_PACK32;
412 case Maxwell::VertexAttribute::Size::Size_10_10_10_2: 416 default:
413 return VK_FORMAT_A2B10G10R10_SSCALED_PACK32; 417 break;
414 default: 418 }
415 break; 419 break;
416 } 420 case Maxwell::VertexAttribute::Type::UnsignedInt:
417 break; 421 switch (size) {
418 case Maxwell::VertexAttribute::Type::UnsignedInt: 422 case Maxwell::VertexAttribute::Size::Size_8:
419 switch (size) { 423 return VK_FORMAT_R8_UINT;
420 case Maxwell::VertexAttribute::Size::Size_8: 424 case Maxwell::VertexAttribute::Size::Size_8_8:
421 return VK_FORMAT_R8_UINT; 425 return VK_FORMAT_R8G8_UINT;
422 case Maxwell::VertexAttribute::Size::Size_8_8: 426 case Maxwell::VertexAttribute::Size::Size_8_8_8:
423 return VK_FORMAT_R8G8_UINT; 427 return VK_FORMAT_R8G8B8_UINT;
424 case Maxwell::VertexAttribute::Size::Size_8_8_8: 428 case Maxwell::VertexAttribute::Size::Size_8_8_8_8:
425 return VK_FORMAT_R8G8B8_UINT; 429 return VK_FORMAT_R8G8B8A8_UINT;
426 case Maxwell::VertexAttribute::Size::Size_8_8_8_8: 430 case Maxwell::VertexAttribute::Size::Size_16:
427 return VK_FORMAT_R8G8B8A8_UINT; 431 return VK_FORMAT_R16_UINT;
428 case Maxwell::VertexAttribute::Size::Size_16: 432 case Maxwell::VertexAttribute::Size::Size_16_16:
429 return VK_FORMAT_R16_UINT; 433 return VK_FORMAT_R16G16_UINT;
430 case Maxwell::VertexAttribute::Size::Size_16_16: 434 case Maxwell::VertexAttribute::Size::Size_16_16_16:
431 return VK_FORMAT_R16G16_UINT; 435 return VK_FORMAT_R16G16B16_UINT;
432 case Maxwell::VertexAttribute::Size::Size_16_16_16: 436 case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
433 return VK_FORMAT_R16G16B16_UINT; 437 return VK_FORMAT_R16G16B16A16_UINT;
434 case Maxwell::VertexAttribute::Size::Size_16_16_16_16: 438 case Maxwell::VertexAttribute::Size::Size_32:
435 return VK_FORMAT_R16G16B16A16_UINT; 439 return VK_FORMAT_R32_UINT;
436 case Maxwell::VertexAttribute::Size::Size_32: 440 case Maxwell::VertexAttribute::Size::Size_32_32:
437 return VK_FORMAT_R32_UINT; 441 return VK_FORMAT_R32G32_UINT;
438 case Maxwell::VertexAttribute::Size::Size_32_32: 442 case Maxwell::VertexAttribute::Size::Size_32_32_32:
439 return VK_FORMAT_R32G32_UINT; 443 return VK_FORMAT_R32G32B32_UINT;
440 case Maxwell::VertexAttribute::Size::Size_32_32_32: 444 case Maxwell::VertexAttribute::Size::Size_32_32_32_32:
441 return VK_FORMAT_R32G32B32_UINT; 445 return VK_FORMAT_R32G32B32A32_UINT;
442 case Maxwell::VertexAttribute::Size::Size_32_32_32_32: 446 case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
443 return VK_FORMAT_R32G32B32A32_UINT; 447 return VK_FORMAT_A2B10G10R10_UINT_PACK32;
444 case Maxwell::VertexAttribute::Size::Size_10_10_10_2: 448 default:
445 return VK_FORMAT_A2B10G10R10_UINT_PACK32; 449 break;
446 default: 450 }
447 break; 451 break;
448 } 452 case Maxwell::VertexAttribute::Type::SignedInt:
449 break; 453 switch (size) {
450 case Maxwell::VertexAttribute::Type::SignedInt: 454 case Maxwell::VertexAttribute::Size::Size_8:
451 switch (size) { 455 return VK_FORMAT_R8_SINT;
452 case Maxwell::VertexAttribute::Size::Size_8: 456 case Maxwell::VertexAttribute::Size::Size_8_8:
453 return VK_FORMAT_R8_SINT; 457 return VK_FORMAT_R8G8_SINT;
454 case Maxwell::VertexAttribute::Size::Size_8_8: 458 case Maxwell::VertexAttribute::Size::Size_8_8_8:
455 return VK_FORMAT_R8G8_SINT; 459 return VK_FORMAT_R8G8B8_SINT;
456 case Maxwell::VertexAttribute::Size::Size_8_8_8: 460 case Maxwell::VertexAttribute::Size::Size_8_8_8_8:
457 return VK_FORMAT_R8G8B8_SINT; 461 return VK_FORMAT_R8G8B8A8_SINT;
458 case Maxwell::VertexAttribute::Size::Size_8_8_8_8: 462 case Maxwell::VertexAttribute::Size::Size_16:
459 return VK_FORMAT_R8G8B8A8_SINT; 463 return VK_FORMAT_R16_SINT;
460 case Maxwell::VertexAttribute::Size::Size_16: 464 case Maxwell::VertexAttribute::Size::Size_16_16:
461 return VK_FORMAT_R16_SINT; 465 return VK_FORMAT_R16G16_SINT;
462 case Maxwell::VertexAttribute::Size::Size_16_16: 466 case Maxwell::VertexAttribute::Size::Size_16_16_16:
463 return VK_FORMAT_R16G16_SINT; 467 return VK_FORMAT_R16G16B16_SINT;
464 case Maxwell::VertexAttribute::Size::Size_16_16_16: 468 case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
465 return VK_FORMAT_R16G16B16_SINT; 469 return VK_FORMAT_R16G16B16A16_SINT;
466 case Maxwell::VertexAttribute::Size::Size_16_16_16_16: 470 case Maxwell::VertexAttribute::Size::Size_32:
467 return VK_FORMAT_R16G16B16A16_SINT; 471 return VK_FORMAT_R32_SINT;
468 case Maxwell::VertexAttribute::Size::Size_32: 472 case Maxwell::VertexAttribute::Size::Size_32_32:
469 return VK_FORMAT_R32_SINT; 473 return VK_FORMAT_R32G32_SINT;
470 case Maxwell::VertexAttribute::Size::Size_32_32: 474 case Maxwell::VertexAttribute::Size::Size_32_32_32:
471 return VK_FORMAT_R32G32_SINT; 475 return VK_FORMAT_R32G32B32_SINT;
472 case Maxwell::VertexAttribute::Size::Size_32_32_32: 476 case Maxwell::VertexAttribute::Size::Size_32_32_32_32:
473 return VK_FORMAT_R32G32B32_SINT; 477 return VK_FORMAT_R32G32B32A32_SINT;
474 case Maxwell::VertexAttribute::Size::Size_32_32_32_32: 478 case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
475 return VK_FORMAT_R32G32B32A32_SINT; 479 return VK_FORMAT_A2B10G10R10_SINT_PACK32;
476 case Maxwell::VertexAttribute::Size::Size_10_10_10_2: 480 default:
477 return VK_FORMAT_A2B10G10R10_SINT_PACK32; 481 break;
478 default: 482 }
479 break; 483 break;
480 } 484 case Maxwell::VertexAttribute::Type::Float:
481 break; 485 switch (size) {
482 case Maxwell::VertexAttribute::Type::Float: 486 case Maxwell::VertexAttribute::Size::Size_16:
483 switch (size) { 487 return VK_FORMAT_R16_SFLOAT;
484 case Maxwell::VertexAttribute::Size::Size_16: 488 case Maxwell::VertexAttribute::Size::Size_16_16:
485 return VK_FORMAT_R16_SFLOAT; 489 return VK_FORMAT_R16G16_SFLOAT;
486 case Maxwell::VertexAttribute::Size::Size_16_16: 490 case Maxwell::VertexAttribute::Size::Size_16_16_16:
487 return VK_FORMAT_R16G16_SFLOAT; 491 return VK_FORMAT_R16G16B16_SFLOAT;
488 case Maxwell::VertexAttribute::Size::Size_16_16_16: 492 case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
489 return VK_FORMAT_R16G16B16_SFLOAT; 493 return VK_FORMAT_R16G16B16A16_SFLOAT;
490 case Maxwell::VertexAttribute::Size::Size_16_16_16_16: 494 case Maxwell::VertexAttribute::Size::Size_32:
491 return VK_FORMAT_R16G16B16A16_SFLOAT; 495 return VK_FORMAT_R32_SFLOAT;
492 case Maxwell::VertexAttribute::Size::Size_32: 496 case Maxwell::VertexAttribute::Size::Size_32_32:
493 return VK_FORMAT_R32_SFLOAT; 497 return VK_FORMAT_R32G32_SFLOAT;
494 case Maxwell::VertexAttribute::Size::Size_32_32: 498 case Maxwell::VertexAttribute::Size::Size_32_32_32:
495 return VK_FORMAT_R32G32_SFLOAT; 499 return VK_FORMAT_R32G32B32_SFLOAT;
496 case Maxwell::VertexAttribute::Size::Size_32_32_32: 500 case Maxwell::VertexAttribute::Size::Size_32_32_32_32:
497 return VK_FORMAT_R32G32B32_SFLOAT; 501 return VK_FORMAT_R32G32B32A32_SFLOAT;
498 case Maxwell::VertexAttribute::Size::Size_32_32_32_32: 502 case Maxwell::VertexAttribute::Size::Size_11_11_10:
499 return VK_FORMAT_R32G32B32A32_SFLOAT; 503 return VK_FORMAT_B10G11R11_UFLOAT_PACK32;
500 case Maxwell::VertexAttribute::Size::Size_11_11_10: 504 default:
501 return VK_FORMAT_B10G11R11_UFLOAT_PACK32; 505 break;
502 default: 506 }
503 break; 507 break;
504 } 508 }
505 break; 509 return VK_FORMAT_UNDEFINED;
510 })()};
511
512 if (format == VK_FORMAT_UNDEFINED) {
513 UNIMPLEMENTED_MSG("Unimplemented vertex format of type={} and size={}", type, size);
506 } 514 }
507 UNIMPLEMENTED_MSG("Unimplemented vertex format of type={} and size={}", type, size); 515
508 return {}; 516 return device.GetSupportedFormat(format, VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT,
517 FormatType::Buffer);
509} 518}
510 519
511VkCompareOp ComparisonOp(Maxwell::ComparisonOp comparison) { 520VkCompareOp ComparisonOp(Maxwell::ComparisonOp comparison) {
diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.h b/src/video_core/renderer_vulkan/maxwell_to_vk.h
index 9edd6af6a..356d46292 100644
--- a/src/video_core/renderer_vulkan/maxwell_to_vk.h
+++ b/src/video_core/renderer_vulkan/maxwell_to_vk.h
@@ -48,7 +48,8 @@ VkShaderStageFlagBits ShaderStage(Shader::Stage stage);
48 48
49VkPrimitiveTopology PrimitiveTopology(const Device& device, Maxwell::PrimitiveTopology topology); 49VkPrimitiveTopology PrimitiveTopology(const Device& device, Maxwell::PrimitiveTopology topology);
50 50
51VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttribute::Size size); 51VkFormat VertexFormat(const Device& device, Maxwell::VertexAttribute::Type type,
52 Maxwell::VertexAttribute::Size size);
52 53
53VkCompareOp ComparisonOp(Maxwell::ComparisonOp comparison); 54VkCompareOp ComparisonOp(Maxwell::ComparisonOp comparison);
54 55
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
index 682f05335..5aca8f038 100644
--- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
+++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
@@ -559,7 +559,7 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
559 vertex_attributes.push_back({ 559 vertex_attributes.push_back({
560 .location = static_cast<u32>(index), 560 .location = static_cast<u32>(index),
561 .binding = attribute.buffer, 561 .binding = attribute.buffer,
562 .format = MaxwellToVK::VertexFormat(attribute.Type(), attribute.Size()), 562 .format = MaxwellToVK::VertexFormat(device, attribute.Type(), attribute.Size()),
563 .offset = attribute.offset, 563 .offset = attribute.offset,
564 }); 564 });
565 } 565 }
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
index 09e035799..43cc94fab 100644
--- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
@@ -452,7 +452,7 @@ void PipelineCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading
452 state.has_loaded = true; 452 state.has_loaded = true;
453 lock.unlock(); 453 lock.unlock();
454 454
455 workers.WaitForRequests(); 455 workers.WaitForRequests(stop_loading);
456 456
457 if (state.statistics) { 457 if (state.statistics) {
458 state.statistics->Report(); 458 state.statistics->Report();
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 10f9fe7fe..16e46d3e5 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -939,7 +939,7 @@ void RasterizerVulkan::UpdateVertexInput(Tegra::Engines::Maxwell3D::Regs& regs)
939 .pNext = nullptr, 939 .pNext = nullptr,
940 .location = static_cast<u32>(index), 940 .location = static_cast<u32>(index),
941 .binding = binding, 941 .binding = binding,
942 .format = MaxwellToVK::VertexFormat(attribute.type, attribute.size), 942 .format = MaxwellToVK::VertexFormat(device, attribute.type, attribute.size),
943 .offset = attribute.offset, 943 .offset = attribute.offset,
944 }); 944 });
945 } 945 }
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
index ba6d81420..16463a892 100644
--- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
@@ -1618,6 +1618,9 @@ ImageView::ImageView(TextureCacheRuntime&, const VideoCommon::NullImageViewParam
1618ImageView::~ImageView() = default; 1618ImageView::~ImageView() = default;
1619 1619
1620VkImageView ImageView::DepthView() { 1620VkImageView ImageView::DepthView() {
1621 if (!image_handle) {
1622 return VK_NULL_HANDLE;
1623 }
1621 if (depth_view) { 1624 if (depth_view) {
1622 return *depth_view; 1625 return *depth_view;
1623 } 1626 }
@@ -1627,6 +1630,9 @@ VkImageView ImageView::DepthView() {
1627} 1630}
1628 1631
1629VkImageView ImageView::StencilView() { 1632VkImageView ImageView::StencilView() {
1633 if (!image_handle) {
1634 return VK_NULL_HANDLE;
1635 }
1630 if (stencil_view) { 1636 if (stencil_view) {
1631 return *stencil_view; 1637 return *stencil_view;
1632 } 1638 }
@@ -1636,6 +1642,9 @@ VkImageView ImageView::StencilView() {
1636} 1642}
1637 1643
1638VkImageView ImageView::ColorView() { 1644VkImageView ImageView::ColorView() {
1645 if (!image_handle) {
1646 return VK_NULL_HANDLE;
1647 }
1639 if (color_view) { 1648 if (color_view) {
1640 return *color_view; 1649 return *color_view;
1641 } 1650 }
@@ -1645,6 +1654,9 @@ VkImageView ImageView::ColorView() {
1645 1654
1646VkImageView ImageView::StorageView(Shader::TextureType texture_type, 1655VkImageView ImageView::StorageView(Shader::TextureType texture_type,
1647 Shader::ImageFormat image_format) { 1656 Shader::ImageFormat image_format) {
1657 if (!image_handle) {
1658 return VK_NULL_HANDLE;
1659 }
1648 if (image_format == Shader::ImageFormat::Typeless) { 1660 if (image_format == Shader::ImageFormat::Typeless) {
1649 return Handle(texture_type); 1661 return Handle(texture_type);
1650 } 1662 }
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp
index eecd0deff..079d5f028 100644
--- a/src/video_core/surface.cpp
+++ b/src/video_core/surface.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include "common/common_types.h" 4#include "common/common_types.h"
6#include "common/math_util.h" 5#include "common/math_util.h"
diff --git a/src/video_core/surface.h b/src/video_core/surface.h
index 0175432ff..16273f185 100644
--- a/src/video_core/surface.h
+++ b/src/video_core/surface.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp
index 2f2594585..04ac4af11 100644
--- a/src/video_core/video_core.cpp
+++ b/src/video_core/video_core.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <memory> 4#include <memory>
6 5
diff --git a/src/video_core/video_core.h b/src/video_core/video_core.h
index 084df641f..f8e2444f3 100644
--- a/src/video_core/video_core.h
+++ b/src/video_core/video_core.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp
index 743ac09f6..ddecfca13 100644
--- a/src/video_core/vulkan_common/vulkan_device.cpp
+++ b/src/video_core/vulkan_common/vulkan_device.cpp
@@ -50,6 +50,21 @@ constexpr std::array R4G4_UNORM_PACK8{
50 VK_FORMAT_UNDEFINED, 50 VK_FORMAT_UNDEFINED,
51}; 51};
52 52
53constexpr std::array R16G16B16_SFLOAT{
54 VK_FORMAT_R16G16B16A16_SFLOAT,
55 VK_FORMAT_UNDEFINED,
56};
57
58constexpr std::array R16G16B16_SSCALED{
59 VK_FORMAT_R16G16B16A16_SSCALED,
60 VK_FORMAT_UNDEFINED,
61};
62
63constexpr std::array R8G8B8_SSCALED{
64 VK_FORMAT_R8G8B8A8_SSCALED,
65 VK_FORMAT_UNDEFINED,
66};
67
53} // namespace Alternatives 68} // namespace Alternatives
54 69
55enum class NvidiaArchitecture { 70enum class NvidiaArchitecture {
@@ -102,6 +117,12 @@ constexpr const VkFormat* GetFormatAlternatives(VkFormat format) {
102 return Alternatives::B5G6R5_UNORM_PACK16.data(); 117 return Alternatives::B5G6R5_UNORM_PACK16.data();
103 case VK_FORMAT_R4G4_UNORM_PACK8: 118 case VK_FORMAT_R4G4_UNORM_PACK8:
104 return Alternatives::R4G4_UNORM_PACK8.data(); 119 return Alternatives::R4G4_UNORM_PACK8.data();
120 case VK_FORMAT_R16G16B16_SFLOAT:
121 return Alternatives::R16G16B16_SFLOAT.data();
122 case VK_FORMAT_R16G16B16_SSCALED:
123 return Alternatives::R16G16B16_SSCALED.data();
124 case VK_FORMAT_R8G8B8_SSCALED:
125 return Alternatives::R8G8B8_SSCALED.data();
105 default: 126 default:
106 return nullptr; 127 return nullptr;
107 } 128 }
@@ -122,109 +143,142 @@ VkFormatFeatureFlags GetFormatFeatures(VkFormatProperties properties, FormatType
122 143
123std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(vk::PhysicalDevice physical) { 144std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(vk::PhysicalDevice physical) {
124 static constexpr std::array formats{ 145 static constexpr std::array formats{
125 VK_FORMAT_A8B8G8R8_UNORM_PACK32, 146 VK_FORMAT_A1R5G5B5_UNORM_PACK16,
126 VK_FORMAT_A8B8G8R8_UINT_PACK32, 147 VK_FORMAT_A2B10G10R10_SINT_PACK32,
127 VK_FORMAT_A8B8G8R8_SNORM_PACK32, 148 VK_FORMAT_A2B10G10R10_SNORM_PACK32,
149 VK_FORMAT_A2B10G10R10_SSCALED_PACK32,
150 VK_FORMAT_A2B10G10R10_UINT_PACK32,
151 VK_FORMAT_A2B10G10R10_UNORM_PACK32,
152 VK_FORMAT_A2B10G10R10_USCALED_PACK32,
128 VK_FORMAT_A8B8G8R8_SINT_PACK32, 153 VK_FORMAT_A8B8G8R8_SINT_PACK32,
154 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
129 VK_FORMAT_A8B8G8R8_SRGB_PACK32, 155 VK_FORMAT_A8B8G8R8_SRGB_PACK32,
130 VK_FORMAT_R5G6B5_UNORM_PACK16, 156 VK_FORMAT_A8B8G8R8_UINT_PACK32,
131 VK_FORMAT_B5G6R5_UNORM_PACK16, 157 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
132 VK_FORMAT_R5G5B5A1_UNORM_PACK16, 158 VK_FORMAT_ASTC_10x10_SRGB_BLOCK,
159 VK_FORMAT_ASTC_10x10_UNORM_BLOCK,
160 VK_FORMAT_ASTC_10x5_SRGB_BLOCK,
161 VK_FORMAT_ASTC_10x5_UNORM_BLOCK,
162 VK_FORMAT_ASTC_10x6_SRGB_BLOCK,
163 VK_FORMAT_ASTC_10x6_UNORM_BLOCK,
164 VK_FORMAT_ASTC_10x8_SRGB_BLOCK,
165 VK_FORMAT_ASTC_10x8_UNORM_BLOCK,
166 VK_FORMAT_ASTC_12x10_SRGB_BLOCK,
167 VK_FORMAT_ASTC_12x10_UNORM_BLOCK,
168 VK_FORMAT_ASTC_12x12_SRGB_BLOCK,
169 VK_FORMAT_ASTC_12x12_UNORM_BLOCK,
170 VK_FORMAT_ASTC_4x4_SRGB_BLOCK,
171 VK_FORMAT_ASTC_4x4_UNORM_BLOCK,
172 VK_FORMAT_ASTC_5x4_SRGB_BLOCK,
173 VK_FORMAT_ASTC_5x4_UNORM_BLOCK,
174 VK_FORMAT_ASTC_5x5_SRGB_BLOCK,
175 VK_FORMAT_ASTC_5x5_UNORM_BLOCK,
176 VK_FORMAT_ASTC_6x5_SRGB_BLOCK,
177 VK_FORMAT_ASTC_6x5_UNORM_BLOCK,
178 VK_FORMAT_ASTC_6x6_SRGB_BLOCK,
179 VK_FORMAT_ASTC_6x6_UNORM_BLOCK,
180 VK_FORMAT_ASTC_8x5_SRGB_BLOCK,
181 VK_FORMAT_ASTC_8x5_UNORM_BLOCK,
182 VK_FORMAT_ASTC_8x6_SRGB_BLOCK,
183 VK_FORMAT_ASTC_8x6_UNORM_BLOCK,
184 VK_FORMAT_ASTC_8x8_SRGB_BLOCK,
185 VK_FORMAT_ASTC_8x8_UNORM_BLOCK,
186 VK_FORMAT_B10G11R11_UFLOAT_PACK32,
187 VK_FORMAT_B4G4R4A4_UNORM_PACK16,
133 VK_FORMAT_B5G5R5A1_UNORM_PACK16, 188 VK_FORMAT_B5G5R5A1_UNORM_PACK16,
134 VK_FORMAT_A2B10G10R10_UNORM_PACK32, 189 VK_FORMAT_B5G6R5_UNORM_PACK16,
135 VK_FORMAT_A2B10G10R10_UINT_PACK32, 190 VK_FORMAT_B8G8R8A8_SRGB,
136 VK_FORMAT_A1R5G5B5_UNORM_PACK16, 191 VK_FORMAT_B8G8R8A8_UNORM,
137 VK_FORMAT_R32G32B32A32_SFLOAT, 192 VK_FORMAT_BC1_RGBA_SRGB_BLOCK,
138 VK_FORMAT_R32G32B32A32_SINT, 193 VK_FORMAT_BC1_RGBA_UNORM_BLOCK,
139 VK_FORMAT_R32G32B32A32_UINT, 194 VK_FORMAT_BC2_SRGB_BLOCK,
140 VK_FORMAT_R32G32_SFLOAT, 195 VK_FORMAT_BC2_UNORM_BLOCK,
141 VK_FORMAT_R32G32_SINT, 196 VK_FORMAT_BC3_SRGB_BLOCK,
142 VK_FORMAT_R32G32_UINT, 197 VK_FORMAT_BC3_UNORM_BLOCK,
198 VK_FORMAT_BC4_SNORM_BLOCK,
199 VK_FORMAT_BC4_UNORM_BLOCK,
200 VK_FORMAT_BC5_SNORM_BLOCK,
201 VK_FORMAT_BC5_UNORM_BLOCK,
202 VK_FORMAT_BC6H_SFLOAT_BLOCK,
203 VK_FORMAT_BC6H_UFLOAT_BLOCK,
204 VK_FORMAT_BC7_SRGB_BLOCK,
205 VK_FORMAT_BC7_UNORM_BLOCK,
206 VK_FORMAT_D16_UNORM,
207 VK_FORMAT_D16_UNORM_S8_UINT,
208 VK_FORMAT_D24_UNORM_S8_UINT,
209 VK_FORMAT_D32_SFLOAT,
210 VK_FORMAT_D32_SFLOAT_S8_UINT,
211 VK_FORMAT_E5B9G9R9_UFLOAT_PACK32,
212 VK_FORMAT_R16G16B16A16_SFLOAT,
143 VK_FORMAT_R16G16B16A16_SINT, 213 VK_FORMAT_R16G16B16A16_SINT,
144 VK_FORMAT_R16G16B16A16_UINT,
145 VK_FORMAT_R16G16B16A16_SNORM, 214 VK_FORMAT_R16G16B16A16_SNORM,
215 VK_FORMAT_R16G16B16A16_SSCALED,
216 VK_FORMAT_R16G16B16A16_UINT,
146 VK_FORMAT_R16G16B16A16_UNORM, 217 VK_FORMAT_R16G16B16A16_UNORM,
147 VK_FORMAT_R16G16_UNORM, 218 VK_FORMAT_R16G16B16A16_USCALED,
148 VK_FORMAT_R16G16_SNORM, 219 VK_FORMAT_R16G16B16_SFLOAT,
220 VK_FORMAT_R16G16B16_SINT,
221 VK_FORMAT_R16G16B16_SNORM,
222 VK_FORMAT_R16G16B16_SSCALED,
223 VK_FORMAT_R16G16B16_UINT,
224 VK_FORMAT_R16G16B16_UNORM,
225 VK_FORMAT_R16G16B16_USCALED,
149 VK_FORMAT_R16G16_SFLOAT, 226 VK_FORMAT_R16G16_SFLOAT,
150 VK_FORMAT_R16G16_UINT,
151 VK_FORMAT_R16G16_SINT, 227 VK_FORMAT_R16G16_SINT,
152 VK_FORMAT_R16_UNORM, 228 VK_FORMAT_R16G16_SNORM,
229 VK_FORMAT_R16G16_SSCALED,
230 VK_FORMAT_R16G16_UINT,
231 VK_FORMAT_R16G16_UNORM,
232 VK_FORMAT_R16G16_USCALED,
233 VK_FORMAT_R16_SFLOAT,
234 VK_FORMAT_R16_SINT,
153 VK_FORMAT_R16_SNORM, 235 VK_FORMAT_R16_SNORM,
236 VK_FORMAT_R16_SSCALED,
154 VK_FORMAT_R16_UINT, 237 VK_FORMAT_R16_UINT,
238 VK_FORMAT_R16_UNORM,
239 VK_FORMAT_R16_USCALED,
240 VK_FORMAT_R32G32B32A32_SFLOAT,
241 VK_FORMAT_R32G32B32A32_SINT,
242 VK_FORMAT_R32G32B32A32_UINT,
243 VK_FORMAT_R32G32B32_SFLOAT,
244 VK_FORMAT_R32G32B32_SINT,
245 VK_FORMAT_R32G32B32_UINT,
246 VK_FORMAT_R32G32_SFLOAT,
247 VK_FORMAT_R32G32_SINT,
248 VK_FORMAT_R32G32_UINT,
249 VK_FORMAT_R32_SFLOAT,
250 VK_FORMAT_R32_SINT,
251 VK_FORMAT_R32_UINT,
252 VK_FORMAT_R4G4B4A4_UNORM_PACK16,
253 VK_FORMAT_R4G4_UNORM_PACK8,
254 VK_FORMAT_R5G5B5A1_UNORM_PACK16,
255 VK_FORMAT_R5G6B5_UNORM_PACK16,
256 VK_FORMAT_R8G8B8A8_SINT,
257 VK_FORMAT_R8G8B8A8_SNORM,
155 VK_FORMAT_R8G8B8A8_SRGB, 258 VK_FORMAT_R8G8B8A8_SRGB,
156 VK_FORMAT_R8G8_UNORM, 259 VK_FORMAT_R8G8B8A8_SSCALED,
157 VK_FORMAT_R8G8_SNORM, 260 VK_FORMAT_R8G8B8A8_UINT,
261 VK_FORMAT_R8G8B8A8_UNORM,
262 VK_FORMAT_R8G8B8A8_USCALED,
263 VK_FORMAT_R8G8B8_SINT,
264 VK_FORMAT_R8G8B8_SNORM,
265 VK_FORMAT_R8G8B8_SSCALED,
266 VK_FORMAT_R8G8B8_UINT,
267 VK_FORMAT_R8G8B8_UNORM,
268 VK_FORMAT_R8G8B8_USCALED,
158 VK_FORMAT_R8G8_SINT, 269 VK_FORMAT_R8G8_SINT,
270 VK_FORMAT_R8G8_SNORM,
271 VK_FORMAT_R8G8_SSCALED,
159 VK_FORMAT_R8G8_UINT, 272 VK_FORMAT_R8G8_UINT,
160 VK_FORMAT_R8_UNORM, 273 VK_FORMAT_R8G8_UNORM,
161 VK_FORMAT_R8_SNORM, 274 VK_FORMAT_R8G8_USCALED,
162 VK_FORMAT_R8_SINT, 275 VK_FORMAT_R8_SINT,
276 VK_FORMAT_R8_SNORM,
277 VK_FORMAT_R8_SSCALED,
163 VK_FORMAT_R8_UINT, 278 VK_FORMAT_R8_UINT,
164 VK_FORMAT_B10G11R11_UFLOAT_PACK32, 279 VK_FORMAT_R8_UNORM,
165 VK_FORMAT_R32_SFLOAT, 280 VK_FORMAT_R8_USCALED,
166 VK_FORMAT_R32_UINT,
167 VK_FORMAT_R32_SINT,
168 VK_FORMAT_R16_SFLOAT,
169 VK_FORMAT_R16G16B16A16_SFLOAT,
170 VK_FORMAT_B8G8R8A8_UNORM,
171 VK_FORMAT_B8G8R8A8_SRGB,
172 VK_FORMAT_R4G4_UNORM_PACK8,
173 VK_FORMAT_R4G4B4A4_UNORM_PACK16,
174 VK_FORMAT_B4G4R4A4_UNORM_PACK16,
175 VK_FORMAT_D32_SFLOAT,
176 VK_FORMAT_D16_UNORM,
177 VK_FORMAT_S8_UINT, 281 VK_FORMAT_S8_UINT,
178 VK_FORMAT_D16_UNORM_S8_UINT,
179 VK_FORMAT_D24_UNORM_S8_UINT,
180 VK_FORMAT_D32_SFLOAT_S8_UINT,
181 VK_FORMAT_BC1_RGBA_UNORM_BLOCK,
182 VK_FORMAT_BC2_UNORM_BLOCK,
183 VK_FORMAT_BC3_UNORM_BLOCK,
184 VK_FORMAT_BC4_UNORM_BLOCK,
185 VK_FORMAT_BC4_SNORM_BLOCK,
186 VK_FORMAT_BC5_UNORM_BLOCK,
187 VK_FORMAT_BC5_SNORM_BLOCK,
188 VK_FORMAT_BC7_UNORM_BLOCK,
189 VK_FORMAT_BC6H_UFLOAT_BLOCK,
190 VK_FORMAT_BC6H_SFLOAT_BLOCK,
191 VK_FORMAT_BC1_RGBA_SRGB_BLOCK,
192 VK_FORMAT_BC2_SRGB_BLOCK,
193 VK_FORMAT_BC3_SRGB_BLOCK,
194 VK_FORMAT_BC7_SRGB_BLOCK,
195 VK_FORMAT_ASTC_4x4_UNORM_BLOCK,
196 VK_FORMAT_ASTC_4x4_SRGB_BLOCK,
197 VK_FORMAT_ASTC_5x4_UNORM_BLOCK,
198 VK_FORMAT_ASTC_5x4_SRGB_BLOCK,
199 VK_FORMAT_ASTC_5x5_UNORM_BLOCK,
200 VK_FORMAT_ASTC_5x5_SRGB_BLOCK,
201 VK_FORMAT_ASTC_6x5_UNORM_BLOCK,
202 VK_FORMAT_ASTC_6x5_SRGB_BLOCK,
203 VK_FORMAT_ASTC_6x6_UNORM_BLOCK,
204 VK_FORMAT_ASTC_6x6_SRGB_BLOCK,
205 VK_FORMAT_ASTC_8x5_UNORM_BLOCK,
206 VK_FORMAT_ASTC_8x5_SRGB_BLOCK,
207 VK_FORMAT_ASTC_8x6_UNORM_BLOCK,
208 VK_FORMAT_ASTC_8x6_SRGB_BLOCK,
209 VK_FORMAT_ASTC_8x8_UNORM_BLOCK,
210 VK_FORMAT_ASTC_8x8_SRGB_BLOCK,
211 VK_FORMAT_ASTC_10x5_UNORM_BLOCK,
212 VK_FORMAT_ASTC_10x5_SRGB_BLOCK,
213 VK_FORMAT_ASTC_10x6_UNORM_BLOCK,
214 VK_FORMAT_ASTC_10x6_SRGB_BLOCK,
215 VK_FORMAT_ASTC_10x8_UNORM_BLOCK,
216 VK_FORMAT_ASTC_10x8_SRGB_BLOCK,
217 VK_FORMAT_ASTC_10x10_UNORM_BLOCK,
218 VK_FORMAT_ASTC_10x10_SRGB_BLOCK,
219 VK_FORMAT_ASTC_12x10_UNORM_BLOCK,
220 VK_FORMAT_ASTC_12x10_SRGB_BLOCK,
221 VK_FORMAT_ASTC_12x12_UNORM_BLOCK,
222 VK_FORMAT_ASTC_12x12_SRGB_BLOCK,
223 VK_FORMAT_ASTC_8x6_UNORM_BLOCK,
224 VK_FORMAT_ASTC_8x6_SRGB_BLOCK,
225 VK_FORMAT_ASTC_6x5_UNORM_BLOCK,
226 VK_FORMAT_ASTC_6x5_SRGB_BLOCK,
227 VK_FORMAT_E5B9G9R9_UFLOAT_PACK32,
228 }; 282 };
229 std::unordered_map<VkFormat, VkFormatProperties> format_properties; 283 std::unordered_map<VkFormat, VkFormatProperties> format_properties;
230 for (const auto format : formats) { 284 for (const auto format : formats) {
@@ -739,9 +793,9 @@ VkFormat Device::GetSupportedFormat(VkFormat wanted_format, VkFormatFeatureFlags
739 if (!IsFormatSupported(alternative, wanted_usage, format_type)) { 793 if (!IsFormatSupported(alternative, wanted_usage, format_type)) {
740 continue; 794 continue;
741 } 795 }
742 LOG_WARNING(Render_Vulkan, 796 LOG_DEBUG(Render_Vulkan,
743 "Emulating format={} with alternative format={} with usage={} and type={}", 797 "Emulating format={} with alternative format={} with usage={} and type={}",
744 wanted_format, alternative, wanted_usage, format_type); 798 wanted_format, alternative, wanted_usage, format_type);
745 return alternative; 799 return alternative;
746 } 800 }
747 801
diff --git a/src/web_service/CMakeLists.txt b/src/web_service/CMakeLists.txt
index 753fb6e7a..3f75d97d1 100644
--- a/src/web_service/CMakeLists.txt
+++ b/src/web_service/CMakeLists.txt
@@ -1,3 +1,6 @@
1# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
1add_library(web_service STATIC 4add_library(web_service STATIC
2 announce_room_json.cpp 5 announce_room_json.cpp
3 announce_room_json.h 6 announce_room_json.h
diff --git a/src/web_service/telemetry_json.cpp b/src/web_service/telemetry_json.cpp
index 46faddb61..51c792004 100644
--- a/src/web_service/telemetry_json.cpp
+++ b/src/web_service/telemetry_json.cpp
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <nlohmann/json.hpp> 4#include <nlohmann/json.hpp>
6#include "common/detached_tasks.h" 5#include "common/detached_tasks.h"
diff --git a/src/web_service/telemetry_json.h b/src/web_service/telemetry_json.h
index df51e00f8..504002c04 100644
--- a/src/web_service/telemetry_json.h
+++ b/src/web_service/telemetry_json.h
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/web_service/verify_login.cpp b/src/web_service/verify_login.cpp
index ceb55ca6b..050080278 100644
--- a/src/web_service/verify_login.cpp
+++ b/src/web_service/verify_login.cpp
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <nlohmann/json.hpp> 4#include <nlohmann/json.hpp>
6#include "web_service/verify_login.h" 5#include "web_service/verify_login.h"
diff --git a/src/web_service/verify_login.h b/src/web_service/verify_login.h
index 821b345d7..8d0adce74 100644
--- a/src/web_service/verify_login.h
+++ b/src/web_service/verify_login.h
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/web_service/web_backend.cpp b/src/web_service/web_backend.cpp
index dce9772fe..378804c08 100644
--- a/src/web_service/web_backend.cpp
+++ b/src/web_service/web_backend.cpp
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <array> 4#include <array>
6#include <mutex> 5#include <mutex>
diff --git a/src/web_service/web_backend.h b/src/web_service/web_backend.h
index 81f58583c..11b5f558c 100644
--- a/src/web_service/web_backend.h
+++ b/src/web_service/web_backend.h
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index 66873143e..f6b389ede 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -1,3 +1,6 @@
1# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
1set(CMAKE_AUTOMOC ON) 4set(CMAKE_AUTOMOC ON)
2set(CMAKE_AUTORCC ON) 5set(CMAKE_AUTORCC ON)
3set(CMAKE_AUTOUIC ON) 6set(CMAKE_AUTOUIC ON)
diff --git a/src/yuzu/Info.plist b/src/yuzu/Info.plist
index 5f1c95d54..0eb377926 100644
--- a/src/yuzu/Info.plist
+++ b/src/yuzu/Info.plist
@@ -1,4 +1,10 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2
3<!--
4SPDX-FileCopyrightText: 2015 Pierre de La Morinerie <kemenaran@gmail.com>
5SPDX-License-Identifier: GPL-2.0-or-later
6-->
7
2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 8<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3<plist version="1.0"> 9<plist version="1.0">
4<dict> 10<dict>
diff --git a/src/yuzu/aboutdialog.ui b/src/yuzu/aboutdialog.ui
index 1dd7b74bf..c4ffb293e 100644
--- a/src/yuzu/aboutdialog.ui
+++ b/src/yuzu/aboutdialog.ui
@@ -127,7 +127,7 @@ p, li { white-space: pre-wrap; }
127 <item> 127 <item>
128 <widget class="QLabel" name="labelLinks"> 128 <widget class="QLabel" name="labelLinks">
129 <property name="text"> 129 <property name="text">
130 <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://yuzu-emu.org/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#039be5;&quot;&gt;Website&lt;/span&gt;&lt;/a&gt; | &lt;a href=&quot;https://github.com/yuzu-emu&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#039be5;&quot;&gt;Source Code&lt;/span&gt;&lt;/a&gt; | &lt;a href=&quot;https://github.com/yuzu-emu/yuzu/graphs/contributors&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#039be5;&quot;&gt;Contributors&lt;/span&gt;&lt;/a&gt; | &lt;a href=&quot;https://github.com/yuzu-emu/yuzu/blob/master/license.txt&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#039be5;&quot;&gt;License&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> 130 <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://yuzu-emu.org/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#039be5;&quot;&gt;Website&lt;/span&gt;&lt;/a&gt; | &lt;a href=&quot;https://github.com/yuzu-emu&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#039be5;&quot;&gt;Source Code&lt;/span&gt;&lt;/a&gt; | &lt;a href=&quot;https://github.com/yuzu-emu/yuzu/graphs/contributors&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#039be5;&quot;&gt;Contributors&lt;/span&gt;&lt;/a&gt; | &lt;a href=&quot;https://github.com/yuzu-emu/yuzu/blob/master/LICENSE.txt&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#039be5;&quot;&gt;License&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
131 </property> 131 </property>
132 <property name="openExternalLinks"> 132 <property name="openExternalLinks">
133 <bool>true</bool> 133 <bool>true</bool>
diff --git a/src/yuzu/applets/qt_profile_select.cpp b/src/yuzu/applets/qt_profile_select.cpp
index 826c6c224..c8bcfb223 100644
--- a/src/yuzu/applets/qt_profile_select.cpp
+++ b/src/yuzu/applets/qt_profile_select.cpp
@@ -100,6 +100,7 @@ QtProfileSelectionDialog::QtProfileSelectionDialog(Core::HID::HIDCore& hid_core,
100 } 100 }
101 QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, key, Qt::NoModifier); 101 QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, key, Qt::NoModifier);
102 QCoreApplication::postEvent(tree_view, event); 102 QCoreApplication::postEvent(tree_view, event);
103 SelectUser(tree_view->currentIndex());
103 }); 104 });
104 105
105 const auto& profiles = profile_manager->GetAllUsers(); 106 const auto& profiles = profile_manager->GetAllUsers();
diff --git a/src/yuzu/applets/qt_software_keyboard.cpp b/src/yuzu/applets/qt_software_keyboard.cpp
index e8b217d90..e60506197 100644
--- a/src/yuzu/applets/qt_software_keyboard.cpp
+++ b/src/yuzu/applets/qt_software_keyboard.cpp
@@ -213,9 +213,9 @@ QtSoftwareKeyboardDialog::QtSoftwareKeyboardDialog(
213 ui->button_ok_num, 213 ui->button_ok_num,
214 }, 214 },
215 { 215 {
216 nullptr, 216 ui->button_left_optional_num,
217 ui->button_0_num, 217 ui->button_0_num,
218 nullptr, 218 ui->button_right_optional_num,
219 ui->button_ok_num, 219 ui->button_ok_num,
220 }, 220 },
221 }}; 221 }};
@@ -330,7 +330,9 @@ QtSoftwareKeyboardDialog::QtSoftwareKeyboardDialog(
330 ui->button_7_num, 330 ui->button_7_num,
331 ui->button_8_num, 331 ui->button_8_num,
332 ui->button_9_num, 332 ui->button_9_num,
333 ui->button_left_optional_num,
333 ui->button_0_num, 334 ui->button_0_num,
335 ui->button_right_optional_num,
334 }; 336 };
335 337
336 SetupMouseHover(); 338 SetupMouseHover();
@@ -342,6 +344,9 @@ QtSoftwareKeyboardDialog::QtSoftwareKeyboardDialog(
342 ui->label_header->setText(QString::fromStdU16String(initialize_parameters.header_text)); 344 ui->label_header->setText(QString::fromStdU16String(initialize_parameters.header_text));
343 ui->label_sub->setText(QString::fromStdU16String(initialize_parameters.sub_text)); 345 ui->label_sub->setText(QString::fromStdU16String(initialize_parameters.sub_text));
344 346
347 ui->button_left_optional_num->setText(QChar{initialize_parameters.left_optional_symbol_key});
348 ui->button_right_optional_num->setText(QChar{initialize_parameters.right_optional_symbol_key});
349
345 current_text = initialize_parameters.initial_text; 350 current_text = initialize_parameters.initial_text;
346 cursor_position = initialize_parameters.initial_cursor_position; 351 cursor_position = initialize_parameters.initial_cursor_position;
347 352
@@ -932,6 +937,15 @@ void QtSoftwareKeyboardDialog::DisableKeyboardButtons() {
932 button->setEnabled(true); 937 button->setEnabled(true);
933 } 938 }
934 } 939 }
940
941 const auto enable_left_optional = initialize_parameters.left_optional_symbol_key != '\0';
942 const auto enable_right_optional = initialize_parameters.right_optional_symbol_key != '\0';
943
944 ui->button_left_optional_num->setEnabled(enable_left_optional);
945 ui->button_left_optional_num->setVisible(enable_left_optional);
946
947 ui->button_right_optional_num->setEnabled(enable_right_optional);
948 ui->button_right_optional_num->setVisible(enable_right_optional);
935 break; 949 break;
936 } 950 }
937 } 951 }
@@ -1019,7 +1033,10 @@ bool QtSoftwareKeyboardDialog::ValidateInputText(const QString& input_text) {
1019 } 1033 }
1020 1034
1021 if (bottom_osk_index == BottomOSKIndex::NumberPad && 1035 if (bottom_osk_index == BottomOSKIndex::NumberPad &&
1022 std::any_of(input_text.begin(), input_text.end(), [](QChar c) { return !c.isDigit(); })) { 1036 std::any_of(input_text.begin(), input_text.end(), [this](QChar c) {
1037 return !c.isDigit() && c != QChar{initialize_parameters.left_optional_symbol_key} &&
1038 c != QChar{initialize_parameters.right_optional_symbol_key};
1039 })) {
1023 return false; 1040 return false;
1024 } 1041 }
1025 1042
@@ -1384,6 +1401,10 @@ void QtSoftwareKeyboardDialog::MoveButtonDirection(Direction direction) {
1384 } 1401 }
1385 }; 1402 };
1386 1403
1404 // Store the initial row and column.
1405 const auto initial_row = row;
1406 const auto initial_column = column;
1407
1387 switch (bottom_osk_index) { 1408 switch (bottom_osk_index) {
1388 case BottomOSKIndex::LowerCase: 1409 case BottomOSKIndex::LowerCase:
1389 case BottomOSKIndex::UpperCase: { 1410 case BottomOSKIndex::UpperCase: {
@@ -1394,6 +1415,11 @@ void QtSoftwareKeyboardDialog::MoveButtonDirection(Direction direction) {
1394 auto* curr_button = keyboard_buttons[index][row][column]; 1415 auto* curr_button = keyboard_buttons[index][row][column];
1395 1416
1396 while (!curr_button || !curr_button->isEnabled() || curr_button == prev_button) { 1417 while (!curr_button || !curr_button->isEnabled() || curr_button == prev_button) {
1418 // If we returned back to where we started from, break the loop.
1419 if (row == initial_row && column == initial_column) {
1420 break;
1421 }
1422
1397 move_direction(NUM_ROWS_NORMAL, NUM_COLUMNS_NORMAL); 1423 move_direction(NUM_ROWS_NORMAL, NUM_COLUMNS_NORMAL);
1398 curr_button = keyboard_buttons[index][row][column]; 1424 curr_button = keyboard_buttons[index][row][column];
1399 } 1425 }
@@ -1408,6 +1434,11 @@ void QtSoftwareKeyboardDialog::MoveButtonDirection(Direction direction) {
1408 auto* curr_button = numberpad_buttons[row][column]; 1434 auto* curr_button = numberpad_buttons[row][column];
1409 1435
1410 while (!curr_button || !curr_button->isEnabled() || curr_button == prev_button) { 1436 while (!curr_button || !curr_button->isEnabled() || curr_button == prev_button) {
1437 // If we returned back to where we started from, break the loop.
1438 if (row == initial_row && column == initial_column) {
1439 break;
1440 }
1441
1411 move_direction(NUM_ROWS_NUMPAD, NUM_COLUMNS_NUMPAD); 1442 move_direction(NUM_ROWS_NUMPAD, NUM_COLUMNS_NUMPAD);
1412 curr_button = numberpad_buttons[row][column]; 1443 curr_button = numberpad_buttons[row][column];
1413 } 1444 }
diff --git a/src/yuzu/applets/qt_software_keyboard.h b/src/yuzu/applets/qt_software_keyboard.h
index 1c489fbb6..35d4ee2ef 100644
--- a/src/yuzu/applets/qt_software_keyboard.h
+++ b/src/yuzu/applets/qt_software_keyboard.h
@@ -211,7 +211,7 @@ private:
211 std::array<std::array<QPushButton*, NUM_COLUMNS_NUMPAD>, NUM_ROWS_NUMPAD> numberpad_buttons; 211 std::array<std::array<QPushButton*, NUM_COLUMNS_NUMPAD>, NUM_ROWS_NUMPAD> numberpad_buttons;
212 212
213 // Contains a set of all buttons used in keyboard_buttons and numberpad_buttons. 213 // Contains a set of all buttons used in keyboard_buttons and numberpad_buttons.
214 std::array<QPushButton*, 110> all_buttons; 214 std::array<QPushButton*, 112> all_buttons;
215 215
216 std::size_t row{0}; 216 std::size_t row{0};
217 std::size_t column{0}; 217 std::size_t column{0};
diff --git a/src/yuzu/applets/qt_software_keyboard.ui b/src/yuzu/applets/qt_software_keyboard.ui
index b0a1fcde9..9661cb260 100644
--- a/src/yuzu/applets/qt_software_keyboard.ui
+++ b/src/yuzu/applets/qt_software_keyboard.ui
@@ -3298,6 +3298,24 @@ p, li { white-space: pre-wrap; }
3298 </property> 3298 </property>
3299 </widget> 3299 </widget>
3300 </item> 3300 </item>
3301 <item row="4" column="2">
3302 <widget class="QPushButton" name="button_left_optional_num">
3303 <property name="sizePolicy">
3304 <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
3305 <horstretch>1</horstretch>
3306 <verstretch>1</verstretch>
3307 </sizepolicy>
3308 </property>
3309 <property name="font">
3310 <font>
3311 <pointsize>28</pointsize>
3312 </font>
3313 </property>
3314 <property name="text">
3315 <string notr="true"></string>
3316 </property>
3317 </widget>
3318 </item>
3301 <item row="4" column="3"> 3319 <item row="4" column="3">
3302 <widget class="QPushButton" name="button_0_num"> 3320 <widget class="QPushButton" name="button_0_num">
3303 <property name="sizePolicy"> 3321 <property name="sizePolicy">
@@ -3316,6 +3334,24 @@ p, li { white-space: pre-wrap; }
3316 </property> 3334 </property>
3317 </widget> 3335 </widget>
3318 </item> 3336 </item>
3337 <item row="4" column="4">
3338 <widget class="QPushButton" name="button_right_optional_num">
3339 <property name="sizePolicy">
3340 <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
3341 <horstretch>1</horstretch>
3342 <verstretch>1</verstretch>
3343 </sizepolicy>
3344 </property>
3345 <property name="font">
3346 <font>
3347 <pointsize>28</pointsize>
3348 </font>
3349 </property>
3350 <property name="text">
3351 <string notr="true"></string>
3352 </property>
3353 </widget>
3354 </item>
3319 <item row="1" column="4"> 3355 <item row="1" column="4">
3320 <widget class="QPushButton" name="button_3_num"> 3356 <widget class="QPushButton" name="button_3_num">
3321 <property name="sizePolicy"> 3357 <property name="sizePolicy">
@@ -3494,7 +3530,9 @@ p, li { white-space: pre-wrap; }
3494 <tabstop>button_7_num</tabstop> 3530 <tabstop>button_7_num</tabstop>
3495 <tabstop>button_8_num</tabstop> 3531 <tabstop>button_8_num</tabstop>
3496 <tabstop>button_9_num</tabstop> 3532 <tabstop>button_9_num</tabstop>
3533 <tabstop>button_left_optional_num</tabstop>
3497 <tabstop>button_0_num</tabstop> 3534 <tabstop>button_0_num</tabstop>
3535 <tabstop>button_right_optional_num</tabstop>
3498 </tabstops> 3536 </tabstops>
3499 <resources> 3537 <resources>
3500 <include location="../../../dist/icons/overlay/overlay.qrc"/> 3538 <include location="../../../dist/icons/overlay/overlay.qrc"/>
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 0ee3820a2..ef3bdfb1a 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <glad/glad.h> 4#include <glad/glad.h>
6 5
@@ -805,6 +804,7 @@ void GRenderWindow::TouchEndEvent() {
805} 804}
806 805
807void GRenderWindow::InitializeCamera() { 806void GRenderWindow::InitializeCamera() {
807 constexpr auto camera_update_ms = std::chrono::milliseconds{50}; // (50ms, 20Hz)
808 if (!Settings::values.enable_ir_sensor) { 808 if (!Settings::values.enable_ir_sensor) {
809 return; 809 return;
810 } 810 }
@@ -838,7 +838,7 @@ void GRenderWindow::InitializeCamera() {
838 camera_timer = std::make_unique<QTimer>(); 838 camera_timer = std::make_unique<QTimer>();
839 connect(camera_timer.get(), &QTimer::timeout, [this] { RequestCameraCapture(); }); 839 connect(camera_timer.get(), &QTimer::timeout, [this] { RequestCameraCapture(); });
840 // This timer should be dependent of camera resolution 5ms for every 100 pixels 840 // This timer should be dependent of camera resolution 5ms for every 100 pixels
841 camera_timer->start(100); 841 camera_timer->start(camera_update_ms);
842} 842}
843 843
844void GRenderWindow::FinalizeCamera() { 844void GRenderWindow::FinalizeCamera() {
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h
index b4781e697..c45ebf1a2 100644
--- a/src/yuzu/bootmanager.h
+++ b/src/yuzu/bootmanager.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/compatdb.cpp b/src/yuzu/compatdb.cpp
index 2442bb3c3..f46fff340 100644
--- a/src/yuzu/compatdb.cpp
+++ b/src/yuzu/compatdb.cpp
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <QButtonGroup> 4#include <QButtonGroup>
6#include <QMessageBox> 5#include <QMessageBox>
diff --git a/src/yuzu/compatdb.h b/src/yuzu/compatdb.h
index e2b2522bd..3252fc47a 100644
--- a/src/yuzu/compatdb.h
+++ b/src/yuzu/compatdb.h
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 3b22102a8..58f1239bf 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <array> 4#include <array>
6#include <QKeySequence> 5#include <QKeySequence>
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h
index 937b2d95b..486ceea94 100644
--- a/src/yuzu/configuration/config.h
+++ b/src/yuzu/configuration/config.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp
index dd4959417..97fb664bf 100644
--- a/src/yuzu/configuration/configuration_shared.cpp
+++ b/src/yuzu/configuration/configuration_shared.cpp
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <QCheckBox> 4#include <QCheckBox>
6#include <QObject> 5#include <QObject>
diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h
index 56800b6ff..e597dcdb5 100644
--- a/src/yuzu/configuration/configuration_shared.h
+++ b/src/yuzu/configuration/configuration_shared.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp
index 84808f678..e16d127a8 100644
--- a/src/yuzu/configuration/configure_debug.cpp
+++ b/src/yuzu/configuration/configure_debug.cpp
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <QDesktopServices> 4#include <QDesktopServices>
6#include <QUrl> 5#include <QUrl>
diff --git a/src/yuzu/configuration/configure_debug.h b/src/yuzu/configuration/configure_debug.h
index 73f71c9e3..64d68ab8f 100644
--- a/src/yuzu/configuration/configure_debug.h
+++ b/src/yuzu/configuration/configure_debug.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp
index 92ef4467b..4301313cf 100644
--- a/src/yuzu/configuration/configure_dialog.cpp
+++ b/src/yuzu/configuration/configure_dialog.cpp
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <memory> 4#include <memory>
6#include "common/logging/log.h" 5#include "common/logging/log.h"
diff --git a/src/yuzu/configuration/configure_dialog.h b/src/yuzu/configuration/configure_dialog.h
index cec1610ad..1f724834a 100644
--- a/src/yuzu/configuration/configure_dialog.h
+++ b/src/yuzu/configuration/configure_dialog.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp
index 2a446205b..7ade01ba6 100644
--- a/src/yuzu/configuration/configure_general.cpp
+++ b/src/yuzu/configuration/configure_general.cpp
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <functional> 4#include <functional>
6#include <utility> 5#include <utility>
diff --git a/src/yuzu/configuration/configure_general.h b/src/yuzu/configuration/configure_general.h
index b6f3bb5ed..a090c1a3f 100644
--- a/src/yuzu/configuration/configure_general.h
+++ b/src/yuzu/configuration/configure_general.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp
index 6b33c4535..87e5d0f48 100644
--- a/src/yuzu/configuration/configure_graphics.cpp
+++ b/src/yuzu/configuration/configure_graphics.cpp
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5// Include this early to include Vulkan headers how we want to 4// Include this early to include Vulkan headers how we want to
6#include "video_core/vulkan_common/vulkan_wrapper.h" 5#include "video_core/vulkan_common/vulkan_wrapper.h"
diff --git a/src/yuzu/configuration/configure_graphics.h b/src/yuzu/configuration/configure_graphics.h
index 1b101c940..70034eb1b 100644
--- a/src/yuzu/configuration/configure_graphics.h
+++ b/src/yuzu/configuration/configure_graphics.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configure_hotkeys.cpp b/src/yuzu/configuration/configure_hotkeys.cpp
index edf0893c4..daa77a8f8 100644
--- a/src/yuzu/configuration/configure_hotkeys.cpp
+++ b/src/yuzu/configuration/configure_hotkeys.cpp
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <QMenu> 4#include <QMenu>
6#include <QMessageBox> 5#include <QMessageBox>
diff --git a/src/yuzu/configuration/configure_hotkeys.h b/src/yuzu/configuration/configure_hotkeys.h
index f943ec538..b45ecb185 100644
--- a/src/yuzu/configuration/configure_hotkeys.h
+++ b/src/yuzu/configuration/configure_hotkeys.h
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp
index f1b061b13..16fba3deb 100644
--- a/src/yuzu/configuration/configure_input.cpp
+++ b/src/yuzu/configuration/configure_input.cpp
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <memory> 4#include <memory>
6#include <thread> 5#include <thread>
diff --git a/src/yuzu/configuration/configure_input.h b/src/yuzu/configuration/configure_input.h
index 4cafa3dab..c89189c36 100644
--- a/src/yuzu/configuration/configure_input.h
+++ b/src/yuzu/configuration/configure_input.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp
index f3be9a374..00bee85b2 100644
--- a/src/yuzu/configuration/configure_input_player.cpp
+++ b/src/yuzu/configuration/configure_input_player.cpp
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <algorithm> 4#include <algorithm>
6#include <memory> 5#include <memory>
diff --git a/src/yuzu/configuration/configure_input_player.h b/src/yuzu/configuration/configure_input_player.h
index 47df6b3d3..79434fdd8 100644
--- a/src/yuzu/configuration/configure_input_player.h
+++ b/src/yuzu/configuration/configure_input_player.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configure_motion_touch.cpp b/src/yuzu/configuration/configure_motion_touch.cpp
index c313b0919..d1b870c72 100644
--- a/src/yuzu/configuration/configure_motion_touch.cpp
+++ b/src/yuzu/configuration/configure_motion_touch.cpp
@@ -1,6 +1,5 @@
1// Copyright 2018 Citra Emulator Project 1// SPDX-FileCopyrightText: 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <sstream> 4#include <sstream>
6 5
diff --git a/src/yuzu/configuration/configure_motion_touch.h b/src/yuzu/configuration/configure_motion_touch.h
index 91d1ae671..7dcc9318e 100644
--- a/src/yuzu/configuration/configure_motion_touch.h
+++ b/src/yuzu/configuration/configure_motion_touch.h
@@ -1,6 +1,5 @@
1// Copyright 2018 Citra Emulator Project 1// SPDX-FileCopyrightText: 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configure_per_game_addons.cpp b/src/yuzu/configuration/configure_per_game_addons.cpp
index 4906997ab..674a75a62 100644
--- a/src/yuzu/configuration/configure_per_game_addons.cpp
+++ b/src/yuzu/configuration/configure_per_game_addons.cpp
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <algorithm> 4#include <algorithm>
6#include <memory> 5#include <memory>
diff --git a/src/yuzu/configuration/configure_per_game_addons.h b/src/yuzu/configuration/configure_per_game_addons.h
index 14690fba8..53db405c1 100644
--- a/src/yuzu/configuration/configure_per_game_addons.h
+++ b/src/yuzu/configuration/configure_per_game_addons.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configure_profile_manager.cpp b/src/yuzu/configuration/configure_profile_manager.cpp
index 5442fe328..5c0217ba8 100644
--- a/src/yuzu/configuration/configure_profile_manager.cpp
+++ b/src/yuzu/configuration/configure_profile_manager.cpp
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <algorithm> 4#include <algorithm>
6#include <QFileDialog> 5#include <QFileDialog>
diff --git a/src/yuzu/configuration/configure_profile_manager.h b/src/yuzu/configuration/configure_profile_manager.h
index 575cb89d5..fe9033779 100644
--- a/src/yuzu/configuration/configure_profile_manager.h
+++ b/src/yuzu/configuration/configure_profile_manager.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp
index ecebb0fb7..bc9d9d77a 100644
--- a/src/yuzu/configuration/configure_system.cpp
+++ b/src/yuzu/configuration/configure_system.cpp
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <chrono> 4#include <chrono>
6#include <optional> 5#include <optional>
diff --git a/src/yuzu/configuration/configure_system.h b/src/yuzu/configuration/configure_system.h
index 5a1633192..8f02880a7 100644
--- a/src/yuzu/configuration/configure_system.h
+++ b/src/yuzu/configuration/configure_system.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configure_touch_from_button.cpp b/src/yuzu/configuration/configure_touch_from_button.cpp
index 06cc452c3..18e2eba69 100644
--- a/src/yuzu/configuration/configure_touch_from_button.cpp
+++ b/src/yuzu/configuration/configure_touch_from_button.cpp
@@ -1,6 +1,5 @@
1// Copyright 2020 Citra Emulator Project 1// SPDX-FileCopyrightText: 2020 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <QInputDialog> 4#include <QInputDialog>
6#include <QKeyEvent> 5#include <QKeyEvent>
diff --git a/src/yuzu/configuration/configure_touch_from_button.h b/src/yuzu/configuration/configure_touch_from_button.h
index b8c55db66..5a1416d00 100644
--- a/src/yuzu/configuration/configure_touch_from_button.h
+++ b/src/yuzu/configuration/configure_touch_from_button.h
@@ -1,6 +1,5 @@
1// Copyright 2020 Citra Emulator Project 1// SPDX-FileCopyrightText: 2020 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configure_touch_widget.h b/src/yuzu/configuration/configure_touch_widget.h
index 347b46583..49f533afe 100644
--- a/src/yuzu/configuration/configure_touch_widget.h
+++ b/src/yuzu/configuration/configure_touch_widget.h
@@ -1,6 +1,5 @@
1// Copyright 2020 Citra Emulator Project 1// SPDX-FileCopyrightText: 2020 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configure_touchscreen_advanced.cpp b/src/yuzu/configuration/configure_touchscreen_advanced.cpp
index 29c86c7bc..5a03e48df 100644
--- a/src/yuzu/configuration/configure_touchscreen_advanced.cpp
+++ b/src/yuzu/configuration/configure_touchscreen_advanced.cpp
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <memory> 4#include <memory>
6#include "ui_configure_touchscreen_advanced.h" 5#include "ui_configure_touchscreen_advanced.h"
diff --git a/src/yuzu/configuration/configure_touchscreen_advanced.h b/src/yuzu/configuration/configure_touchscreen_advanced.h
index 72061492c..034dc0d46 100644
--- a/src/yuzu/configuration/configure_touchscreen_advanced.h
+++ b/src/yuzu/configuration/configure_touchscreen_advanced.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp
index d3a60cdd1..2e98ede8e 100644
--- a/src/yuzu/configuration/configure_ui.cpp
+++ b/src/yuzu/configuration/configure_ui.cpp
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <array> 4#include <array>
6#include <utility> 5#include <utility>
diff --git a/src/yuzu/configuration/configure_ui.h b/src/yuzu/configuration/configure_ui.h
index 48b6e6d82..95af8370e 100644
--- a/src/yuzu/configuration/configure_ui.h
+++ b/src/yuzu/configuration/configure_ui.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/configuration/configure_web.cpp b/src/yuzu/configuration/configure_web.cpp
index ff4bf44f4..d668c992b 100644
--- a/src/yuzu/configuration/configure_web.cpp
+++ b/src/yuzu/configuration/configure_web.cpp
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <QIcon> 4#include <QIcon>
6#include <QMessageBox> 5#include <QMessageBox>
diff --git a/src/yuzu/configuration/configure_web.h b/src/yuzu/configuration/configure_web.h
index 041b51149..03feb55f8 100644
--- a/src/yuzu/configuration/configure_web.h
+++ b/src/yuzu/configuration/configure_web.h
@@ -1,6 +1,5 @@
1// Copyright 2017 Citra Emulator Project 1// SPDX-FileCopyrightText: 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/debugger/controller.cpp b/src/yuzu/debugger/controller.cpp
index 6b834c42e..e4bf16a04 100644
--- a/src/yuzu/debugger/controller.cpp
+++ b/src/yuzu/debugger/controller.cpp
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <QAction> 4#include <QAction>
6#include <QLayout> 5#include <QLayout>
diff --git a/src/yuzu/debugger/controller.h b/src/yuzu/debugger/controller.h
index 52cea3326..9651dfaa9 100644
--- a/src/yuzu/debugger/controller.h
+++ b/src/yuzu/debugger/controller.h
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/debugger/profiler.cpp b/src/yuzu/debugger/profiler.cpp
index 33110685a..d3e2d3c12 100644
--- a/src/yuzu/debugger/profiler.cpp
+++ b/src/yuzu/debugger/profiler.cpp
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <QAction> 4#include <QAction>
6#include <QLayout> 5#include <QLayout>
diff --git a/src/yuzu/debugger/profiler.h b/src/yuzu/debugger/profiler.h
index 8e69fdb06..4c8ccd3c2 100644
--- a/src/yuzu/debugger/profiler.h
+++ b/src/yuzu/debugger/profiler.h
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/debugger/wait_tree.cpp b/src/yuzu/debugger/wait_tree.cpp
index 0ea31cd33..7f7c5fc42 100644
--- a/src/yuzu/debugger/wait_tree.cpp
+++ b/src/yuzu/debugger/wait_tree.cpp
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <array> 4#include <array>
6#include <fmt/format.h> 5#include <fmt/format.h>
diff --git a/src/yuzu/debugger/wait_tree.h b/src/yuzu/debugger/wait_tree.h
index f21b9f467..7e528b592 100644
--- a/src/yuzu/debugger/wait_tree.h
+++ b/src/yuzu/debugger/wait_tree.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/discord.h b/src/yuzu/discord.h
index a867cc4d6..e08784498 100644
--- a/src/yuzu/discord.h
+++ b/src/yuzu/discord.h
@@ -1,6 +1,5 @@
1// Copyright 2018 Citra Emulator Project 1// SPDX-FileCopyrightText: 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/discord_impl.cpp b/src/yuzu/discord_impl.cpp
index 66f928af6..c351e9b83 100644
--- a/src/yuzu/discord_impl.cpp
+++ b/src/yuzu/discord_impl.cpp
@@ -1,6 +1,5 @@
1// Copyright 2018 Citra Emulator Project 1// SPDX-FileCopyrightText: 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <chrono> 4#include <chrono>
6#include <string> 5#include <string>
diff --git a/src/yuzu/discord_impl.h b/src/yuzu/discord_impl.h
index 03ad42681..84710b9c6 100644
--- a/src/yuzu/discord_impl.h
+++ b/src/yuzu/discord_impl.h
@@ -1,6 +1,5 @@
1// Copyright 2018 Citra Emulator Project 1// SPDX-FileCopyrightText: 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index 5bcf582bf..041e6ac11 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <regex> 4#include <regex>
6#include <QApplication> 5#include <QApplication>
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index 9605985cc..f783283c9 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h
index cd7d63536..e7667cf60 100644
--- a/src/yuzu/game_list_p.h
+++ b/src/yuzu/game_list_p.h
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/hotkeys.cpp b/src/yuzu/hotkeys.cpp
index d59aa5d18..13723f6e5 100644
--- a/src/yuzu/hotkeys.cpp
+++ b/src/yuzu/hotkeys.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <sstream> 4#include <sstream>
6#include <QShortcut> 5#include <QShortcut>
diff --git a/src/yuzu/hotkeys.h b/src/yuzu/hotkeys.h
index 57a7c7da5..dc5b7f628 100644
--- a/src/yuzu/hotkeys.h
+++ b/src/yuzu/hotkeys.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/loading_screen.cpp b/src/yuzu/loading_screen.cpp
index e273744fd..e263a07a7 100644
--- a/src/yuzu/loading_screen.cpp
+++ b/src/yuzu/loading_screen.cpp
@@ -147,6 +147,10 @@ void LoadingScreen::OnLoadProgress(VideoCore::LoadCallbackStage stage, std::size
147 ui->progress_bar->setMaximum(static_cast<int>(total)); 147 ui->progress_bar->setMaximum(static_cast<int>(total));
148 previous_total = total; 148 previous_total = total;
149 } 149 }
150 // Reset the progress bar ranges if compilation is done
151 if (stage == VideoCore::LoadCallbackStage::Complete) {
152 ui->progress_bar->setRange(0, 0);
153 }
150 154
151 QString estimate; 155 QString estimate;
152 // If theres a drastic slowdown in the rate, then display an estimate 156 // If theres a drastic slowdown in the rate, then display an estimate
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index e56fcabff..dc7b343d9 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <cinttypes> 4#include <cinttypes>
6#include <clocale> 5#include <clocale>
@@ -9,6 +8,10 @@
9#ifdef __APPLE__ 8#ifdef __APPLE__
10#include <unistd.h> // for chdir 9#include <unistd.h> // for chdir
11#endif 10#endif
11#ifdef __linux__
12#include <csignal>
13#include <sys/socket.h>
14#endif
12 15
13// VFS includes must be before glad as they will conflict with Windows file api, which uses defines. 16// VFS includes must be before glad as they will conflict with Windows file api, which uses defines.
14#include "applets/qt_controller.h" 17#include "applets/qt_controller.h"
@@ -260,6 +263,10 @@ GMainWindow::GMainWindow(bool has_broken_vulkan)
260 config{std::make_unique<Config>(*system)}, 263 config{std::make_unique<Config>(*system)},
261 vfs{std::make_shared<FileSys::RealVfsFilesystem>()}, 264 vfs{std::make_shared<FileSys::RealVfsFilesystem>()},
262 provider{std::make_unique<FileSys::ManualContentProvider>()} { 265 provider{std::make_unique<FileSys::ManualContentProvider>()} {
266#ifdef __linux__
267 SetupSigInterrupts();
268#endif
269
263 Common::Log::Initialize(); 270 Common::Log::Initialize();
264 LoadTranslation(); 271 LoadTranslation();
265 272
@@ -379,6 +386,8 @@ GMainWindow::GMainWindow(bool has_broken_vulkan)
379 SDL_EnableScreenSaver(); 386 SDL_EnableScreenSaver();
380#endif 387#endif
381 388
389 SetupPrepareForSleep();
390
382 Common::Log::Start(); 391 Common::Log::Start();
383 392
384 QStringList args = QApplication::arguments(); 393 QStringList args = QApplication::arguments();
@@ -463,7 +472,13 @@ GMainWindow::~GMainWindow() {
463 if (render_window->parent() == nullptr) { 472 if (render_window->parent() == nullptr) {
464 delete render_window; 473 delete render_window;
465 } 474 }
475
466 system->GetRoomNetwork().Shutdown(); 476 system->GetRoomNetwork().Shutdown();
477
478#ifdef __linux__
479 ::close(sig_interrupt_fds[0]);
480 ::close(sig_interrupt_fds[1]);
481#endif
467} 482}
468 483
469void GMainWindow::RegisterMetaTypes() { 484void GMainWindow::RegisterMetaTypes() {
@@ -1061,12 +1076,26 @@ void GMainWindow::InitializeHotkeys() {
1061 [] { Settings::values.audio_muted = !Settings::values.audio_muted; }); 1076 [] { Settings::values.audio_muted = !Settings::values.audio_muted; });
1062 connect_shortcut(QStringLiteral("Audio Volume Down"), [] { 1077 connect_shortcut(QStringLiteral("Audio Volume Down"), [] {
1063 const auto current_volume = static_cast<int>(Settings::values.volume.GetValue()); 1078 const auto current_volume = static_cast<int>(Settings::values.volume.GetValue());
1064 const auto new_volume = std::max(current_volume - 5, 0); 1079 int step = 5;
1080 if (current_volume <= 30) {
1081 step = 2;
1082 }
1083 if (current_volume <= 6) {
1084 step = 1;
1085 }
1086 const auto new_volume = std::max(current_volume - step, 0);
1065 Settings::values.volume.SetValue(static_cast<u8>(new_volume)); 1087 Settings::values.volume.SetValue(static_cast<u8>(new_volume));
1066 }); 1088 });
1067 connect_shortcut(QStringLiteral("Audio Volume Up"), [] { 1089 connect_shortcut(QStringLiteral("Audio Volume Up"), [] {
1068 const auto current_volume = static_cast<int>(Settings::values.volume.GetValue()); 1090 const auto current_volume = static_cast<int>(Settings::values.volume.GetValue());
1069 const auto new_volume = std::min(current_volume + 5, 100); 1091 int step = 5;
1092 if (current_volume < 30) {
1093 step = 2;
1094 }
1095 if (current_volume < 6) {
1096 step = 1;
1097 }
1098 const auto new_volume = std::min(current_volume + step, 100);
1070 Settings::values.volume.SetValue(static_cast<u8>(new_volume)); 1099 Settings::values.volume.SetValue(static_cast<u8>(new_volume));
1071 }); 1100 });
1072 connect_shortcut(QStringLiteral("Toggle Framerate Limit"), [] { 1101 connect_shortcut(QStringLiteral("Toggle Framerate Limit"), [] {
@@ -1314,6 +1343,43 @@ void GMainWindow::OnDisplayTitleBars(bool show) {
1314 } 1343 }
1315} 1344}
1316 1345
1346void GMainWindow::SetupPrepareForSleep() {
1347#ifdef __linux__
1348 auto bus = QDBusConnection::systemBus();
1349 if (bus.isConnected()) {
1350 const bool success = bus.connect(
1351 QStringLiteral("org.freedesktop.login1"), QStringLiteral("/org/freedesktop/login1"),
1352 QStringLiteral("org.freedesktop.login1.Manager"), QStringLiteral("PrepareForSleep"),
1353 QStringLiteral("b"), this, SLOT(OnPrepareForSleep(bool)));
1354
1355 if (!success) {
1356 LOG_WARNING(Frontend, "Couldn't register PrepareForSleep signal");
1357 }
1358 } else {
1359 LOG_WARNING(Frontend, "QDBusConnection system bus is not connected");
1360 }
1361#endif // __linux__
1362}
1363
1364void GMainWindow::OnPrepareForSleep(bool prepare_sleep) {
1365 if (emu_thread == nullptr) {
1366 return;
1367 }
1368
1369 if (prepare_sleep) {
1370 if (emu_thread->IsRunning()) {
1371 auto_paused = true;
1372 OnPauseGame();
1373 }
1374 } else {
1375 if (!emu_thread->IsRunning() && auto_paused) {
1376 auto_paused = false;
1377 RequestGameResume();
1378 OnStartGame();
1379 }
1380 }
1381}
1382
1317#ifdef __linux__ 1383#ifdef __linux__
1318static std::optional<QDBusObjectPath> HoldWakeLockLinux(u32 window_id = 0) { 1384static std::optional<QDBusObjectPath> HoldWakeLockLinux(u32 window_id = 0) {
1319 if (!QDBusConnection::sessionBus().isConnected()) { 1385 if (!QDBusConnection::sessionBus().isConnected()) {
@@ -1353,6 +1419,52 @@ static void ReleaseWakeLockLinux(QDBusObjectPath lock) {
1353 QString::fromLatin1("org.freedesktop.portal.Request")); 1419 QString::fromLatin1("org.freedesktop.portal.Request"));
1354 unlocker.call(QString::fromLatin1("Close")); 1420 unlocker.call(QString::fromLatin1("Close"));
1355} 1421}
1422
1423std::array<int, 3> GMainWindow::sig_interrupt_fds{0, 0, 0};
1424
1425void GMainWindow::SetupSigInterrupts() {
1426 if (sig_interrupt_fds[2] == 1) {
1427 return;
1428 }
1429 socketpair(AF_UNIX, SOCK_STREAM, 0, sig_interrupt_fds.data());
1430 sig_interrupt_fds[2] = 1;
1431
1432 struct sigaction sa;
1433 sa.sa_handler = &GMainWindow::HandleSigInterrupt;
1434 sigemptyset(&sa.sa_mask);
1435 sa.sa_flags = SA_RESETHAND;
1436 sigaction(SIGINT, &sa, nullptr);
1437 sigaction(SIGTERM, &sa, nullptr);
1438
1439 sig_interrupt_notifier = new QSocketNotifier(sig_interrupt_fds[1], QSocketNotifier::Read, this);
1440 connect(sig_interrupt_notifier, &QSocketNotifier::activated, this,
1441 &GMainWindow::OnSigInterruptNotifierActivated);
1442 connect(this, &GMainWindow::SigInterrupt, this, &GMainWindow::close);
1443}
1444
1445void GMainWindow::HandleSigInterrupt(int sig) {
1446 if (sig == SIGINT) {
1447 exit(1);
1448 }
1449
1450 // Calling into Qt directly from a signal handler is not safe,
1451 // so wake up a QSocketNotifier with this hacky write call instead.
1452 char a = 1;
1453 int ret = write(sig_interrupt_fds[0], &a, sizeof(a));
1454 (void)ret;
1455}
1456
1457void GMainWindow::OnSigInterruptNotifierActivated() {
1458 sig_interrupt_notifier->setEnabled(false);
1459
1460 char a;
1461 int ret = read(sig_interrupt_fds[1], &a, sizeof(a));
1462 (void)ret;
1463
1464 sig_interrupt_notifier->setEnabled(true);
1465
1466 emit SigInterrupt();
1467}
1356#endif // __linux__ 1468#endif // __linux__
1357 1469
1358void GMainWindow::PreventOSSleep() { 1470void GMainWindow::PreventOSSleep() {
@@ -1476,17 +1588,18 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
1476 return true; 1588 return true;
1477} 1589}
1478 1590
1479void GMainWindow::SelectAndSetCurrentUser() { 1591bool GMainWindow::SelectAndSetCurrentUser() {
1480 QtProfileSelectionDialog dialog(system->HIDCore(), this); 1592 QtProfileSelectionDialog dialog(system->HIDCore(), this);
1481 dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | 1593 dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
1482 Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); 1594 Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
1483 dialog.setWindowModality(Qt::WindowModal); 1595 dialog.setWindowModality(Qt::WindowModal);
1484 1596
1485 if (dialog.exec() == QDialog::Rejected) { 1597 if (dialog.exec() == QDialog::Rejected) {
1486 return; 1598 return false;
1487 } 1599 }
1488 1600
1489 Settings::values.current_user = dialog.GetIndex(); 1601 Settings::values.current_user = dialog.GetIndex();
1602 return true;
1490} 1603}
1491 1604
1492void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t program_index, 1605void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t program_index,
@@ -1520,11 +1633,14 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1520 Settings::LogSettings(); 1633 Settings::LogSettings();
1521 1634
1522 if (UISettings::values.select_user_on_boot) { 1635 if (UISettings::values.select_user_on_boot) {
1523 SelectAndSetCurrentUser(); 1636 if (SelectAndSetCurrentUser() == false) {
1637 return;
1638 }
1524 } 1639 }
1525 1640
1526 if (!LoadROM(filename, program_id, program_index)) 1641 if (!LoadROM(filename, program_id, program_index)) {
1527 return; 1642 return;
1643 }
1528 1644
1529 system->SetShuttingDown(false); 1645 system->SetShuttingDown(false);
1530 1646
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 8d5c1398f..e13b38b24 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
@@ -164,6 +163,8 @@ signals:
164 void WebBrowserExtractOfflineRomFS(); 163 void WebBrowserExtractOfflineRomFS();
165 void WebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason, std::string last_url); 164 void WebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason, std::string last_url);
166 165
166 void SigInterrupt();
167
167public slots: 168public slots:
168 void OnLoadComplete(); 169 void OnLoadComplete();
169 void OnExecuteProgram(std::size_t program_index); 170 void OnExecuteProgram(std::size_t program_index);
@@ -203,7 +204,7 @@ private:
203 void ConnectMenuEvents(); 204 void ConnectMenuEvents();
204 void UpdateMenuState(); 205 void UpdateMenuState();
205 206
206 MultiplayerState* multiplayer_state = nullptr; 207 void SetupPrepareForSleep();
207 208
208 void PreventOSSleep(); 209 void PreventOSSleep();
209 void AllowOSSleep(); 210 void AllowOSSleep();
@@ -217,7 +218,7 @@ private:
217 void SetDiscordEnabled(bool state); 218 void SetDiscordEnabled(bool state);
218 void LoadAmiibo(const QString& filename); 219 void LoadAmiibo(const QString& filename);
219 220
220 void SelectAndSetCurrentUser(); 221 bool SelectAndSetCurrentUser();
221 222
222 /** 223 /**
223 * Stores the filename in the recently loaded files list. 224 * Stores the filename in the recently loaded files list.
@@ -252,12 +253,19 @@ private:
252 void RequestGameResume(); 253 void RequestGameResume();
253 void closeEvent(QCloseEvent* event) override; 254 void closeEvent(QCloseEvent* event) override;
254 255
256#ifdef __linux__
257 void SetupSigInterrupts();
258 static void HandleSigInterrupt(int);
259 void OnSigInterruptNotifierActivated();
260#endif
261
255private slots: 262private slots:
256 void OnStartGame(); 263 void OnStartGame();
257 void OnRestartGame(); 264 void OnRestartGame();
258 void OnPauseGame(); 265 void OnPauseGame();
259 void OnPauseContinueGame(); 266 void OnPauseContinueGame();
260 void OnStopGame(); 267 void OnStopGame();
268 void OnPrepareForSleep(bool prepare_sleep);
261 void OnMenuReportCompatibility(); 269 void OnMenuReportCompatibility();
262 void OnOpenModsPage(); 270 void OnOpenModsPage();
263 void OnOpenQuickstartGuide(); 271 void OnOpenQuickstartGuide();
@@ -348,6 +356,8 @@ private:
348 std::unique_ptr<DiscordRPC::DiscordInterface> discord_rpc; 356 std::unique_ptr<DiscordRPC::DiscordInterface> discord_rpc;
349 std::shared_ptr<InputCommon::InputSubsystem> input_subsystem; 357 std::shared_ptr<InputCommon::InputSubsystem> input_subsystem;
350 358
359 MultiplayerState* multiplayer_state = nullptr;
360
351 GRenderWindow* render_window; 361 GRenderWindow* render_window;
352 GameList* game_list; 362 GameList* game_list;
353 LoadingScreen* loading_screen; 363 LoadingScreen* loading_screen;
@@ -420,6 +430,9 @@ private:
420 bool is_tas_recording_dialog_active{}; 430 bool is_tas_recording_dialog_active{};
421 431
422#ifdef __linux__ 432#ifdef __linux__
433 QSocketNotifier* sig_interrupt_notifier;
434 static std::array<int, 3> sig_interrupt_fds;
435
423 QDBusObjectPath wake_lock{}; 436 QDBusObjectPath wake_lock{};
424#endif 437#endif
425 438
diff --git a/src/yuzu/uisettings.cpp b/src/yuzu/uisettings.cpp
index f683b80f7..2c1b547fb 100644
--- a/src/yuzu/uisettings.cpp
+++ b/src/yuzu/uisettings.cpp
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include "yuzu/uisettings.h" 4#include "yuzu/uisettings.h"
6 5
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h
index 6cd4d6cb2..25d1bf1e6 100644
--- a/src/yuzu/uisettings.h
+++ b/src/yuzu/uisettings.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/util/sequence_dialog/sequence_dialog.cpp b/src/yuzu/util/sequence_dialog/sequence_dialog.cpp
index bb5f74ec4..4b10fa517 100644
--- a/src/yuzu/util/sequence_dialog/sequence_dialog.cpp
+++ b/src/yuzu/util/sequence_dialog/sequence_dialog.cpp
@@ -1,6 +1,5 @@
1// Copyright 2018 Citra Emulator Project 1// SPDX-FileCopyrightText: 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <QDialogButtonBox> 4#include <QDialogButtonBox>
6#include <QKeySequenceEdit> 5#include <QKeySequenceEdit>
diff --git a/src/yuzu/util/sequence_dialog/sequence_dialog.h b/src/yuzu/util/sequence_dialog/sequence_dialog.h
index 969c77740..85e146d40 100644
--- a/src/yuzu/util/sequence_dialog/sequence_dialog.h
+++ b/src/yuzu/util/sequence_dialog/sequence_dialog.h
@@ -1,6 +1,5 @@
1// Copyright 2018 Citra Emulator Project 1// SPDX-FileCopyrightText: 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/util/util.cpp b/src/yuzu/util/util.cpp
index ef31bc2d2..5c3e4589e 100644
--- a/src/yuzu/util/util.cpp
+++ b/src/yuzu/util/util.cpp
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <array> 4#include <array>
6#include <cmath> 5#include <cmath>
diff --git a/src/yuzu/util/util.h b/src/yuzu/util/util.h
index e6790f260..39dd2d895 100644
--- a/src/yuzu/util/util.h
+++ b/src/yuzu/util/util.h
@@ -1,6 +1,5 @@
1// Copyright 2015 Citra Emulator Project 1// SPDX-FileCopyrightText: 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu/yuzu.qrc b/src/yuzu/yuzu.qrc
index 5733cac98..855df05fd 100644
--- a/src/yuzu/yuzu.qrc
+++ b/src/yuzu/yuzu.qrc
@@ -1,3 +1,8 @@
1<!--
2SPDX-FileCopyrightText: 2021 yuzu Emulator Project
3SPDX-License-Identifier: GPL-2.0-or-later
4-->
5
1<RCC> 6<RCC>
2 <qresource prefix="/img"> 7 <qresource prefix="/img">
3 <file alias="yuzu.ico">../../dist/yuzu.ico</file> 8 <file alias="yuzu.ico">../../dist/yuzu.ico</file>
diff --git a/src/yuzu/yuzu.rc b/src/yuzu/yuzu.rc
index 4a3645a71..1fc74d065 100644
--- a/src/yuzu/yuzu.rc
+++ b/src/yuzu/yuzu.rc
@@ -1,3 +1,6 @@
1// SPDX-FileCopyrightText: 2018 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
1#include "winresrc.h" 4#include "winresrc.h"
2///////////////////////////////////////////////////////////////////////////// 5/////////////////////////////////////////////////////////////////////////////
3// 6//
diff --git a/src/yuzu_cmd/CMakeLists.txt b/src/yuzu_cmd/CMakeLists.txt
index c8901f2df..7d8ca3d8a 100644
--- a/src/yuzu_cmd/CMakeLists.txt
+++ b/src/yuzu_cmd/CMakeLists.txt
@@ -1,3 +1,6 @@
1# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
1set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) 4set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
2 5
3# Credits to Samantas5855 and others for this function. 6# Credits to Samantas5855 and others for this function.
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp
index ad7f9d239..bd0fb75f8 100644
--- a/src/yuzu_cmd/config.cpp
+++ b/src/yuzu_cmd/config.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <memory> 4#include <memory>
6#include <optional> 5#include <optional>
diff --git a/src/yuzu_cmd/config.h b/src/yuzu_cmd/config.h
index 32c03075f..021438b17 100644
--- a/src/yuzu_cmd/config.h
+++ b/src/yuzu_cmd/config.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h
index d9a2a460c..1168cf136 100644
--- a/src/yuzu_cmd/default_ini.h
+++ b/src/yuzu_cmd/default_ini.h
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
index 8e38724db..4ac72c2f6 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <SDL.h> 4#include <SDL.h>
6 5
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.h b/src/yuzu_cmd/emu_window/emu_window_sdl2.h
index 58b885465..90bb0b415 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2.h
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.h
@@ -1,6 +1,5 @@
1// Copyright 2016 Citra Emulator Project 1// SPDX-FileCopyrightText: 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index e10d3f5b4..003890c07 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// SPDX-FileCopyrightText: 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <chrono> 4#include <chrono>
6#include <iostream> 5#include <iostream>
diff --git a/src/yuzu_cmd/yuzu.rc b/src/yuzu_cmd/yuzu.rc
index 0cde75e2f..e230cf680 100644
--- a/src/yuzu_cmd/yuzu.rc
+++ b/src/yuzu_cmd/yuzu.rc
@@ -1,3 +1,6 @@
1// SPDX-FileCopyrightText: 2018 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
1#include "winresrc.h" 4#include "winresrc.h"
2///////////////////////////////////////////////////////////////////////////// 5/////////////////////////////////////////////////////////////////////////////
3// 6//