diff options
Diffstat (limited to 'src')
85 files changed, 906 insertions, 667 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index d6714587c..43561d607 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp | |||
| @@ -192,6 +192,7 @@ void FileBackend::Write(const Entry& entry) { | |||
| 192 | SUB(Service, PCTL) \ | 192 | SUB(Service, PCTL) \ |
| 193 | SUB(Service, PCV) \ | 193 | SUB(Service, PCV) \ |
| 194 | SUB(Service, PREPO) \ | 194 | SUB(Service, PREPO) \ |
| 195 | SUB(Service, PSC) \ | ||
| 195 | SUB(Service, SET) \ | 196 | SUB(Service, SET) \ |
| 196 | SUB(Service, SM) \ | 197 | SUB(Service, SM) \ |
| 197 | SUB(Service, SPL) \ | 198 | SUB(Service, SPL) \ |
diff --git a/src/common/logging/log.h b/src/common/logging/log.h index e96d817f4..b5891fb15 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h | |||
| @@ -77,8 +77,9 @@ enum class Class : ClassType { | |||
| 77 | Service_NVDRV, ///< The NVDRV (Nvidia driver) service | 77 | Service_NVDRV, ///< The NVDRV (Nvidia driver) service |
| 78 | Service_PCIE, ///< The PCIe service | 78 | Service_PCIE, ///< The PCIe service |
| 79 | Service_PCTL, ///< The PCTL (Parental control) service | 79 | Service_PCTL, ///< The PCTL (Parental control) service |
| 80 | Service_PCV, ///< The PCV (Parental control) service | 80 | Service_PCV, ///< The PCV service |
| 81 | Service_PREPO, ///< The PREPO (Play report) service | 81 | Service_PREPO, ///< The PREPO (Play report) service |
| 82 | Service_PSC, ///< The PSC service | ||
| 82 | Service_SET, ///< The SET (Settings) service | 83 | Service_SET, ///< The SET (Settings) service |
| 83 | Service_SM, ///< The SM (Service manager) service | 84 | Service_SM, ///< The SM (Service manager) service |
| 84 | Service_SPL, ///< The SPL service | 85 | Service_SPL, ///< The SPL service |
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 3cc9160ca..d29f6a84f 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -67,6 +67,8 @@ add_library(core STATIC | |||
| 67 | hle/kernel/memory.h | 67 | hle/kernel/memory.h |
| 68 | hle/kernel/mutex.cpp | 68 | hle/kernel/mutex.cpp |
| 69 | hle/kernel/mutex.h | 69 | hle/kernel/mutex.h |
| 70 | hle/kernel/object.cpp | ||
| 71 | hle/kernel/object.h | ||
| 70 | hle/kernel/process.cpp | 72 | hle/kernel/process.cpp |
| 71 | hle/kernel/process.h | 73 | hle/kernel/process.h |
| 72 | hle/kernel/resource_limit.cpp | 74 | hle/kernel/resource_limit.cpp |
| @@ -261,6 +263,8 @@ add_library(core STATIC | |||
| 261 | hle/service/pm/pm.h | 263 | hle/service/pm/pm.h |
| 262 | hle/service/prepo/prepo.cpp | 264 | hle/service/prepo/prepo.cpp |
| 263 | hle/service/prepo/prepo.h | 265 | hle/service/prepo/prepo.h |
| 266 | hle/service/psc/psc.cpp | ||
| 267 | hle/service/psc/psc.h | ||
| 264 | hle/service/service.cpp | 268 | hle/service/service.cpp |
| 265 | hle/service/service.h | 269 | hle/service/service.h |
| 266 | hle/service/set/set.cpp | 270 | hle/service/set/set.cpp |
| @@ -309,10 +313,6 @@ add_library(core STATIC | |||
| 309 | hle/service/vi/vi_u.h | 313 | hle/service/vi/vi_u.h |
| 310 | hle/service/wlan/wlan.cpp | 314 | hle/service/wlan/wlan.cpp |
| 311 | hle/service/wlan/wlan.h | 315 | hle/service/wlan/wlan.h |
| 312 | hw/hw.cpp | ||
| 313 | hw/hw.h | ||
| 314 | hw/lcd.cpp | ||
| 315 | hw/lcd.h | ||
| 316 | loader/deconstructed_rom_directory.cpp | 316 | loader/deconstructed_rom_directory.cpp |
| 317 | loader/deconstructed_rom_directory.h | 317 | loader/deconstructed_rom_directory.h |
| 318 | loader/elf.cpp | 318 | loader/elf.cpp |
diff --git a/src/core/core.cpp b/src/core/core.cpp index b7f4b4532..54fc4170f 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -15,9 +15,7 @@ | |||
| 15 | #include "core/hle/service/service.h" | 15 | #include "core/hle/service/service.h" |
| 16 | #include "core/hle/service/sm/controller.h" | 16 | #include "core/hle/service/sm/controller.h" |
| 17 | #include "core/hle/service/sm/sm.h" | 17 | #include "core/hle/service/sm/sm.h" |
| 18 | #include "core/hw/hw.h" | ||
| 19 | #include "core/loader/loader.h" | 18 | #include "core/loader/loader.h" |
| 20 | #include "core/memory_setup.h" | ||
| 21 | #include "core/settings.h" | 19 | #include "core/settings.h" |
| 22 | #include "file_sys/vfs_real.h" | 20 | #include "file_sys/vfs_real.h" |
| 23 | #include "video_core/video_core.h" | 21 | #include "video_core/video_core.h" |
| @@ -86,7 +84,7 @@ System::ResultStatus System::SingleStep() { | |||
| 86 | return RunLoop(false); | 84 | return RunLoop(false); |
| 87 | } | 85 | } |
| 88 | 86 | ||
| 89 | System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& filepath) { | 87 | System::ResultStatus System::Load(EmuWindow& emu_window, const std::string& filepath) { |
| 90 | app_loader = Loader::GetLoader(std::make_shared<FileSys::RealVfsFile>(filepath)); | 88 | app_loader = Loader::GetLoader(std::make_shared<FileSys::RealVfsFile>(filepath)); |
| 91 | 89 | ||
| 92 | if (!app_loader) { | 90 | if (!app_loader) { |
| @@ -163,7 +161,7 @@ Cpu& System::CpuCore(size_t core_index) { | |||
| 163 | return *cpu_cores[core_index]; | 161 | return *cpu_cores[core_index]; |
| 164 | } | 162 | } |
| 165 | 163 | ||
| 166 | System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { | 164 | System::ResultStatus System::Init(EmuWindow& emu_window, u32 system_mode) { |
| 167 | LOG_DEBUG(HW_Memory, "initialized OK"); | 165 | LOG_DEBUG(HW_Memory, "initialized OK"); |
| 168 | 166 | ||
| 169 | CoreTiming::Init(); | 167 | CoreTiming::Init(); |
| @@ -180,7 +178,6 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { | |||
| 180 | telemetry_session = std::make_unique<Core::TelemetrySession>(); | 178 | telemetry_session = std::make_unique<Core::TelemetrySession>(); |
| 181 | service_manager = std::make_shared<Service::SM::ServiceManager>(); | 179 | service_manager = std::make_shared<Service::SM::ServiceManager>(); |
| 182 | 180 | ||
| 183 | HW::Init(); | ||
| 184 | Kernel::Init(system_mode); | 181 | Kernel::Init(system_mode); |
| 185 | Service::Init(service_manager); | 182 | Service::Init(service_manager); |
| 186 | GDBStub::Init(); | 183 | GDBStub::Init(); |
| @@ -224,7 +221,6 @@ void System::Shutdown() { | |||
| 224 | GDBStub::Shutdown(); | 221 | GDBStub::Shutdown(); |
| 225 | Service::Shutdown(); | 222 | Service::Shutdown(); |
| 226 | Kernel::Shutdown(); | 223 | Kernel::Shutdown(); |
| 227 | HW::Shutdown(); | ||
| 228 | service_manager.reset(); | 224 | service_manager.reset(); |
| 229 | telemetry_session.reset(); | 225 | telemetry_session.reset(); |
| 230 | gpu_core.reset(); | 226 | gpu_core.reset(); |
diff --git a/src/core/core.h b/src/core/core.h index c123fe401..f8b6644bb 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "core/arm/exclusive_monitor.h" | 12 | #include "core/arm/exclusive_monitor.h" |
| 13 | #include "core/core_cpu.h" | 13 | #include "core/core_cpu.h" |
| 14 | #include "core/hle/kernel/kernel.h" | 14 | #include "core/hle/kernel/object.h" |
| 15 | #include "core/hle/kernel/scheduler.h" | 15 | #include "core/hle/kernel/scheduler.h" |
| 16 | #include "core/loader/loader.h" | 16 | #include "core/loader/loader.h" |
| 17 | #include "core/memory.h" | 17 | #include "core/memory.h" |
| @@ -81,11 +81,12 @@ public: | |||
| 81 | 81 | ||
| 82 | /** | 82 | /** |
| 83 | * Load an executable application. | 83 | * Load an executable application. |
| 84 | * @param emu_window Pointer to the host-system window used for video output and keyboard input. | 84 | * @param emu_window Reference to the host-system window used for video output and keyboard |
| 85 | * input. | ||
| 85 | * @param filepath String path to the executable application to load on the host file system. | 86 | * @param filepath String path to the executable application to load on the host file system. |
| 86 | * @returns ResultStatus code, indicating if the operation succeeded. | 87 | * @returns ResultStatus code, indicating if the operation succeeded. |
| 87 | */ | 88 | */ |
| 88 | ResultStatus Load(EmuWindow* emu_window, const std::string& filepath); | 89 | ResultStatus Load(EmuWindow& emu_window, const std::string& filepath); |
| 89 | 90 | ||
| 90 | /** | 91 | /** |
| 91 | * Indicates if the emulated system is powered on (all subsystems initialized and able to run an | 92 | * Indicates if the emulated system is powered on (all subsystems initialized and able to run an |
| @@ -186,11 +187,12 @@ private: | |||
| 186 | 187 | ||
| 187 | /** | 188 | /** |
| 188 | * Initialize the emulated system. | 189 | * Initialize the emulated system. |
| 189 | * @param emu_window Pointer to the host-system window used for video output and keyboard input. | 190 | * @param emu_window Reference to the host-system window used for video output and keyboard |
| 191 | * input. | ||
| 190 | * @param system_mode The system mode. | 192 | * @param system_mode The system mode. |
| 191 | * @return ResultStatus code, indicating if the operation succeeded. | 193 | * @return ResultStatus code, indicating if the operation succeeded. |
| 192 | */ | 194 | */ |
| 193 | ResultStatus Init(EmuWindow* emu_window, u32 system_mode); | 195 | ResultStatus Init(EmuWindow& emu_window, u32 system_mode); |
| 194 | 196 | ||
| 195 | /// AppLoader used to load the current executing application | 197 | /// AppLoader used to load the current executing application |
| 196 | std::unique_ptr<Loader::AppLoader> app_loader; | 198 | std::unique_ptr<Loader::AppLoader> app_loader; |
diff --git a/src/core/core_cpu.cpp b/src/core/core_cpu.cpp index 54e15a701..46a522fcd 100644 --- a/src/core/core_cpu.cpp +++ b/src/core/core_cpu.cpp | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | #include "core/arm/unicorn/arm_unicorn.h" | 12 | #include "core/arm/unicorn/arm_unicorn.h" |
| 13 | #include "core/core_cpu.h" | 13 | #include "core/core_cpu.h" |
| 14 | #include "core/core_timing.h" | 14 | #include "core/core_timing.h" |
| 15 | #include "core/hle/kernel/kernel.h" | ||
| 16 | #include "core/hle/kernel/scheduler.h" | 15 | #include "core/hle/kernel/scheduler.h" |
| 17 | #include "core/hle/kernel/thread.h" | 16 | #include "core/hle/kernel/thread.h" |
| 18 | #include "core/settings.h" | 17 | #include "core/settings.h" |
diff --git a/src/core/file_sys/vfs_vector.cpp b/src/core/file_sys/vfs_vector.cpp index 4c6337e3a..fda603960 100644 --- a/src/core/file_sys/vfs_vector.cpp +++ b/src/core/file_sys/vfs_vector.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <utility> | ||
| 6 | #include "core/file_sys/vfs_vector.h" | 7 | #include "core/file_sys/vfs_vector.h" |
| 7 | 8 | ||
| 8 | namespace FileSys { | 9 | namespace FileSys { |
| @@ -31,16 +32,18 @@ bool VectorVfsDirectory::IsReadable() const { | |||
| 31 | std::string VectorVfsDirectory::GetName() const { | 32 | std::string VectorVfsDirectory::GetName() const { |
| 32 | return name; | 33 | return name; |
| 33 | } | 34 | } |
| 35 | |||
| 34 | std::shared_ptr<VfsDirectory> VectorVfsDirectory::GetParentDirectory() const { | 36 | std::shared_ptr<VfsDirectory> VectorVfsDirectory::GetParentDirectory() const { |
| 35 | return parent; | 37 | return parent; |
| 36 | } | 38 | } |
| 37 | 39 | ||
| 38 | template <typename T> | 40 | template <typename T> |
| 39 | static bool FindAndRemoveVectorElement(std::vector<T>& vec, std::string_view name) { | 41 | static bool FindAndRemoveVectorElement(std::vector<T>& vec, std::string_view name) { |
| 40 | auto iter = std::find_if(vec.begin(), vec.end(), [name](T e) { return e->GetName() == name; }); | 42 | const auto iter = |
| 43 | std::find_if(vec.begin(), vec.end(), [name](const T& e) { return e->GetName() == name; }); | ||
| 41 | if (iter == vec.end()) | 44 | if (iter == vec.end()) |
| 42 | return false; | 45 | return false; |
| 43 | auto old_size = vec.size(); | 46 | |
| 44 | vec.erase(iter); | 47 | vec.erase(iter); |
| 45 | return true; | 48 | return true; |
| 46 | } | 49 | } |
| @@ -77,7 +80,7 @@ void VectorVfsDirectory::AddDirectory(VirtualDir dir) { | |||
| 77 | bool VectorVfsDirectory::ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) { | 80 | bool VectorVfsDirectory::ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) { |
| 78 | if (!DeleteFile(file->GetName())) | 81 | if (!DeleteFile(file->GetName())) |
| 79 | return false; | 82 | return false; |
| 80 | dirs.emplace_back(dir); | 83 | dirs.emplace_back(std::move(dir)); |
| 81 | return true; | 84 | return true; |
| 82 | } | 85 | } |
| 83 | } // namespace FileSys | 86 | } // namespace FileSys |
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp index 5ca573652..75f6b8235 100644 --- a/src/core/gdbstub/gdbstub.cpp +++ b/src/core/gdbstub/gdbstub.cpp | |||
| @@ -37,7 +37,6 @@ | |||
| 37 | #include "core/core.h" | 37 | #include "core/core.h" |
| 38 | #include "core/core_cpu.h" | 38 | #include "core/core_cpu.h" |
| 39 | #include "core/gdbstub/gdbstub.h" | 39 | #include "core/gdbstub/gdbstub.h" |
| 40 | #include "core/hle/kernel/kernel.h" | ||
| 41 | #include "core/hle/kernel/scheduler.h" | 40 | #include "core/hle/kernel/scheduler.h" |
| 42 | #include "core/loader/loader.h" | 41 | #include "core/loader/loader.h" |
| 43 | #include "core/memory.h" | 42 | #include "core/memory.h" |
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index 7fb0da408..d3a734831 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h | |||
| @@ -5,15 +5,18 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <cstring> | ||
| 9 | #include <memory> | ||
| 8 | #include <tuple> | 10 | #include <tuple> |
| 9 | #include <type_traits> | 11 | #include <type_traits> |
| 10 | #include <utility> | 12 | #include <utility> |
| 13 | #include "common/assert.h" | ||
| 14 | #include "common/common_types.h" | ||
| 11 | #include "core/hle/ipc.h" | 15 | #include "core/hle/ipc.h" |
| 12 | #include "core/hle/kernel/client_port.h" | 16 | #include "core/hle/kernel/client_port.h" |
| 13 | #include "core/hle/kernel/client_session.h" | 17 | #include "core/hle/kernel/client_session.h" |
| 14 | #include "core/hle/kernel/handle_table.h" | ||
| 15 | #include "core/hle/kernel/hle_ipc.h" | 18 | #include "core/hle/kernel/hle_ipc.h" |
| 16 | #include "core/hle/kernel/kernel.h" | 19 | #include "core/hle/kernel/object.h" |
| 17 | #include "core/hle/kernel/server_port.h" | 20 | #include "core/hle/kernel/server_port.h" |
| 18 | 21 | ||
| 19 | namespace IPC { | 22 | namespace IPC { |
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index 6a10efab1..7a17ed162 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "core/core.h" | 10 | #include "core/core.h" |
| 11 | #include "core/hle/kernel/errors.h" | 11 | #include "core/hle/kernel/errors.h" |
| 12 | #include "core/hle/kernel/kernel.h" | 12 | #include "core/hle/kernel/object.h" |
| 13 | #include "core/hle/kernel/process.h" | 13 | #include "core/hle/kernel/process.h" |
| 14 | #include "core/hle/kernel/thread.h" | 14 | #include "core/hle/kernel/thread.h" |
| 15 | #include "core/hle/result.h" | 15 | #include "core/hle/result.h" |
diff --git a/src/core/hle/kernel/client_port.cpp b/src/core/hle/kernel/client_port.cpp index 2d6051e8b..7933c105c 100644 --- a/src/core/hle/kernel/client_port.cpp +++ b/src/core/hle/kernel/client_port.cpp | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include "core/hle/kernel/client_session.h" | 8 | #include "core/hle/kernel/client_session.h" |
| 9 | #include "core/hle/kernel/errors.h" | 9 | #include "core/hle/kernel/errors.h" |
| 10 | #include "core/hle/kernel/hle_ipc.h" | 10 | #include "core/hle/kernel/hle_ipc.h" |
| 11 | #include "core/hle/kernel/kernel.h" | 11 | #include "core/hle/kernel/object.h" |
| 12 | #include "core/hle/kernel/server_port.h" | 12 | #include "core/hle/kernel/server_port.h" |
| 13 | #include "core/hle/kernel/server_session.h" | 13 | #include "core/hle/kernel/server_session.h" |
| 14 | 14 | ||
diff --git a/src/core/hle/kernel/client_port.h b/src/core/hle/kernel/client_port.h index a829aeb6d..b42c94bde 100644 --- a/src/core/hle/kernel/client_port.h +++ b/src/core/hle/kernel/client_port.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include <string> | 7 | #include <string> |
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "core/hle/kernel/kernel.h" | 9 | #include "core/hle/kernel/object.h" |
| 10 | #include "core/hle/result.h" | 10 | #include "core/hle/result.h" |
| 11 | 11 | ||
| 12 | namespace Kernel { | 12 | namespace Kernel { |
diff --git a/src/core/hle/kernel/client_session.h b/src/core/hle/kernel/client_session.h index 2258f95bc..dabd93ed7 100644 --- a/src/core/hle/kernel/client_session.h +++ b/src/core/hle/kernel/client_session.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <string> | 8 | #include <string> |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "core/hle/kernel/kernel.h" | 10 | #include "core/hle/kernel/object.h" |
| 11 | #include "core/hle/result.h" | 11 | #include "core/hle/result.h" |
| 12 | 12 | ||
| 13 | namespace Kernel { | 13 | namespace Kernel { |
diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index 37e0766c3..5623c4b6a 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include "common/assert.h" | 6 | #include "common/assert.h" |
| 7 | #include "core/hle/kernel/event.h" | 7 | #include "core/hle/kernel/event.h" |
| 8 | #include "core/hle/kernel/kernel.h" | 8 | #include "core/hle/kernel/object.h" |
| 9 | #include "core/hle/kernel/thread.h" | 9 | #include "core/hle/kernel/thread.h" |
| 10 | 10 | ||
| 11 | namespace Kernel { | 11 | namespace Kernel { |
diff --git a/src/core/hle/kernel/event.h b/src/core/hle/kernel/event.h index e5c924a75..1c99911b2 100644 --- a/src/core/hle/kernel/event.h +++ b/src/core/hle/kernel/event.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "core/hle/kernel/kernel.h" | 8 | #include "core/hle/kernel/object.h" |
| 9 | #include "core/hle/kernel/wait_object.h" | 9 | #include "core/hle/kernel/wait_object.h" |
| 10 | 10 | ||
| 11 | namespace Kernel { | 11 | namespace Kernel { |
diff --git a/src/core/hle/kernel/handle_table.cpp b/src/core/hle/kernel/handle_table.cpp index 7dd67f80f..28e21428a 100644 --- a/src/core/hle/kernel/handle_table.cpp +++ b/src/core/hle/kernel/handle_table.cpp | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | #include "core/hle/kernel/errors.h" | 9 | #include "core/hle/kernel/errors.h" |
| 10 | #include "core/hle/kernel/handle_table.h" | 10 | #include "core/hle/kernel/handle_table.h" |
| 11 | #include "core/hle/kernel/kernel.h" | ||
| 12 | #include "core/hle/kernel/process.h" | 11 | #include "core/hle/kernel/process.h" |
| 13 | #include "core/hle/kernel/thread.h" | 12 | #include "core/hle/kernel/thread.h" |
| 14 | 13 | ||
diff --git a/src/core/hle/kernel/handle_table.h b/src/core/hle/kernel/handle_table.h index ba968c666..22ddda630 100644 --- a/src/core/hle/kernel/handle_table.h +++ b/src/core/hle/kernel/handle_table.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <cstddef> | 8 | #include <cstddef> |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "core/hle/kernel/kernel.h" | 10 | #include "core/hle/kernel/object.h" |
| 11 | #include "core/hle/result.h" | 11 | #include "core/hle/result.h" |
| 12 | 12 | ||
| 13 | namespace Kernel { | 13 | namespace Kernel { |
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 771d6d476..5dd1b68d7 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp | |||
| @@ -3,17 +3,21 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <array> | ||
| 7 | #include <sstream> | ||
| 6 | #include <utility> | 8 | #include <utility> |
| 7 | 9 | ||
| 8 | #include <boost/range/algorithm_ext/erase.hpp> | 10 | #include <boost/range/algorithm_ext/erase.hpp> |
| 11 | |||
| 9 | #include "common/assert.h" | 12 | #include "common/assert.h" |
| 10 | #include "common/common_funcs.h" | 13 | #include "common/common_funcs.h" |
| 11 | #include "common/common_types.h" | 14 | #include "common/common_types.h" |
| 15 | #include "common/logging/log.h" | ||
| 12 | #include "core/hle/ipc_helpers.h" | 16 | #include "core/hle/ipc_helpers.h" |
| 13 | #include "core/hle/kernel/event.h" | 17 | #include "core/hle/kernel/event.h" |
| 14 | #include "core/hle/kernel/handle_table.h" | 18 | #include "core/hle/kernel/handle_table.h" |
| 15 | #include "core/hle/kernel/hle_ipc.h" | 19 | #include "core/hle/kernel/hle_ipc.h" |
| 16 | #include "core/hle/kernel/kernel.h" | 20 | #include "core/hle/kernel/object.h" |
| 17 | #include "core/hle/kernel/process.h" | 21 | #include "core/hle/kernel/process.h" |
| 18 | #include "core/hle/kernel/server_session.h" | 22 | #include "core/hle/kernel/server_session.h" |
| 19 | #include "core/memory.h" | 23 | #include "core/memory.h" |
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index ee4abebf2..9ce52db24 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #include "common/common_types.h" | 13 | #include "common/common_types.h" |
| 14 | #include "common/swap.h" | 14 | #include "common/swap.h" |
| 15 | #include "core/hle/ipc.h" | 15 | #include "core/hle/ipc.h" |
| 16 | #include "core/hle/kernel/kernel.h" | 16 | #include "core/hle/kernel/object.h" |
| 17 | #include "core/hle/kernel/server_session.h" | 17 | #include "core/hle/kernel/server_session.h" |
| 18 | #include "core/hle/kernel/thread.h" | 18 | #include "core/hle/kernel/thread.h" |
| 19 | 19 | ||
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 402ae900f..2bc45d7db 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h | |||
| @@ -4,120 +4,10 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <cstddef> | ||
| 8 | #include <string> | ||
| 9 | #include <utility> | ||
| 10 | #include <boost/smart_ptr/intrusive_ptr.hpp> | ||
| 11 | #include "common/assert.h" | ||
| 12 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 13 | 8 | ||
| 14 | namespace Kernel { | 9 | namespace Kernel { |
| 15 | 10 | ||
| 16 | using Handle = u32; | ||
| 17 | |||
| 18 | enum class HandleType : u32 { | ||
| 19 | Unknown, | ||
| 20 | Event, | ||
| 21 | SharedMemory, | ||
| 22 | Thread, | ||
| 23 | Process, | ||
| 24 | AddressArbiter, | ||
| 25 | Timer, | ||
| 26 | ResourceLimit, | ||
| 27 | CodeSet, | ||
| 28 | ClientPort, | ||
| 29 | ServerPort, | ||
| 30 | ClientSession, | ||
| 31 | ServerSession, | ||
| 32 | }; | ||
| 33 | |||
| 34 | enum class ResetType { | ||
| 35 | OneShot, | ||
| 36 | Sticky, | ||
| 37 | Pulse, | ||
| 38 | }; | ||
| 39 | |||
| 40 | class Object : NonCopyable { | ||
| 41 | public: | ||
| 42 | virtual ~Object() {} | ||
| 43 | |||
| 44 | /// Returns a unique identifier for the object. For debugging purposes only. | ||
| 45 | unsigned int GetObjectId() const { | ||
| 46 | return object_id; | ||
| 47 | } | ||
| 48 | |||
| 49 | virtual std::string GetTypeName() const { | ||
| 50 | return "[BAD KERNEL OBJECT TYPE]"; | ||
| 51 | } | ||
| 52 | virtual std::string GetName() const { | ||
| 53 | return "[UNKNOWN KERNEL OBJECT]"; | ||
| 54 | } | ||
| 55 | virtual Kernel::HandleType GetHandleType() const = 0; | ||
| 56 | |||
| 57 | /** | ||
| 58 | * Check if a thread can wait on the object | ||
| 59 | * @return True if a thread can wait on the object, otherwise false | ||
| 60 | */ | ||
| 61 | bool IsWaitable() const { | ||
| 62 | switch (GetHandleType()) { | ||
| 63 | case HandleType::Event: | ||
| 64 | case HandleType::Thread: | ||
| 65 | case HandleType::Timer: | ||
| 66 | case HandleType::ServerPort: | ||
| 67 | case HandleType::ServerSession: | ||
| 68 | return true; | ||
| 69 | |||
| 70 | case HandleType::Unknown: | ||
| 71 | case HandleType::SharedMemory: | ||
| 72 | case HandleType::Process: | ||
| 73 | case HandleType::AddressArbiter: | ||
| 74 | case HandleType::ResourceLimit: | ||
| 75 | case HandleType::CodeSet: | ||
| 76 | case HandleType::ClientPort: | ||
| 77 | case HandleType::ClientSession: | ||
| 78 | return false; | ||
| 79 | } | ||
| 80 | |||
| 81 | UNREACHABLE(); | ||
| 82 | } | ||
| 83 | |||
| 84 | public: | ||
| 85 | static unsigned int next_object_id; | ||
| 86 | |||
| 87 | private: | ||
| 88 | friend void intrusive_ptr_add_ref(Object*); | ||
| 89 | friend void intrusive_ptr_release(Object*); | ||
| 90 | |||
| 91 | unsigned int ref_count = 0; | ||
| 92 | unsigned int object_id = next_object_id++; | ||
| 93 | }; | ||
| 94 | |||
| 95 | // Special functions used by boost::instrusive_ptr to do automatic ref-counting | ||
| 96 | inline void intrusive_ptr_add_ref(Object* object) { | ||
| 97 | ++object->ref_count; | ||
| 98 | } | ||
| 99 | |||
| 100 | inline void intrusive_ptr_release(Object* object) { | ||
| 101 | if (--object->ref_count == 0) { | ||
| 102 | delete object; | ||
| 103 | } | ||
| 104 | } | ||
| 105 | |||
| 106 | template <typename T> | ||
| 107 | using SharedPtr = boost::intrusive_ptr<T>; | ||
| 108 | |||
| 109 | /** | ||
| 110 | * Attempts to downcast the given Object pointer to a pointer to T. | ||
| 111 | * @return Derived pointer to the object, or `nullptr` if `object` isn't of type T. | ||
| 112 | */ | ||
| 113 | template <typename T> | ||
| 114 | inline SharedPtr<T> DynamicObjectCast(SharedPtr<Object> object) { | ||
| 115 | if (object != nullptr && object->GetHandleType() == T::HANDLE_TYPE) { | ||
| 116 | return boost::static_pointer_cast<T>(std::move(object)); | ||
| 117 | } | ||
| 118 | return nullptr; | ||
| 119 | } | ||
| 120 | |||
| 121 | /// Initialize the kernel with the specified system mode. | 11 | /// Initialize the kernel with the specified system mode. |
| 122 | void Init(u32 system_mode); | 12 | void Init(u32 system_mode); |
| 123 | 13 | ||
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 12b974c4b..cb7f58b35 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp | |||
| @@ -12,8 +12,8 @@ | |||
| 12 | #include "core/core.h" | 12 | #include "core/core.h" |
| 13 | #include "core/hle/kernel/errors.h" | 13 | #include "core/hle/kernel/errors.h" |
| 14 | #include "core/hle/kernel/handle_table.h" | 14 | #include "core/hle/kernel/handle_table.h" |
| 15 | #include "core/hle/kernel/kernel.h" | ||
| 16 | #include "core/hle/kernel/mutex.h" | 15 | #include "core/hle/kernel/mutex.h" |
| 16 | #include "core/hle/kernel/object.h" | ||
| 17 | #include "core/hle/kernel/thread.h" | 17 | #include "core/hle/kernel/thread.h" |
| 18 | #include "core/hle/result.h" | 18 | #include "core/hle/result.h" |
| 19 | 19 | ||
diff --git a/src/core/hle/kernel/mutex.h b/src/core/hle/kernel/mutex.h index febfde698..45268bbe9 100644 --- a/src/core/hle/kernel/mutex.h +++ b/src/core/hle/kernel/mutex.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "core/hle/kernel/kernel.h" | 8 | #include "core/hle/kernel/object.h" |
| 9 | 9 | ||
| 10 | union ResultCode; | 10 | union ResultCode; |
| 11 | 11 | ||
diff --git a/src/core/hle/kernel/object.cpp b/src/core/hle/kernel/object.cpp new file mode 100644 index 000000000..cdba272f5 --- /dev/null +++ b/src/core/hle/kernel/object.cpp | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | // Copyright 2018 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/assert.h" | ||
| 6 | #include "core/hle/kernel/object.h" | ||
| 7 | |||
| 8 | namespace Kernel { | ||
| 9 | |||
| 10 | Object::~Object() = default; | ||
| 11 | |||
| 12 | bool Object::IsWaitable() const { | ||
| 13 | switch (GetHandleType()) { | ||
| 14 | case HandleType::Event: | ||
| 15 | case HandleType::Thread: | ||
| 16 | case HandleType::Timer: | ||
| 17 | case HandleType::ServerPort: | ||
| 18 | case HandleType::ServerSession: | ||
| 19 | return true; | ||
| 20 | |||
| 21 | case HandleType::Unknown: | ||
| 22 | case HandleType::SharedMemory: | ||
| 23 | case HandleType::Process: | ||
| 24 | case HandleType::AddressArbiter: | ||
| 25 | case HandleType::ResourceLimit: | ||
| 26 | case HandleType::CodeSet: | ||
| 27 | case HandleType::ClientPort: | ||
| 28 | case HandleType::ClientSession: | ||
| 29 | return false; | ||
| 30 | } | ||
| 31 | |||
| 32 | UNREACHABLE(); | ||
| 33 | } | ||
| 34 | |||
| 35 | } // namespace Kernel | ||
diff --git a/src/core/hle/kernel/object.h b/src/core/hle/kernel/object.h new file mode 100644 index 000000000..83df68dfd --- /dev/null +++ b/src/core/hle/kernel/object.h | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | // Copyright 2018 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <string> | ||
| 8 | #include <utility> | ||
| 9 | |||
| 10 | #include <boost/smart_ptr/intrusive_ptr.hpp> | ||
| 11 | |||
| 12 | #include "common/common_types.h" | ||
| 13 | |||
| 14 | namespace Kernel { | ||
| 15 | |||
| 16 | using Handle = u32; | ||
| 17 | |||
| 18 | enum class HandleType : u32 { | ||
| 19 | Unknown, | ||
| 20 | Event, | ||
| 21 | SharedMemory, | ||
| 22 | Thread, | ||
| 23 | Process, | ||
| 24 | AddressArbiter, | ||
| 25 | Timer, | ||
| 26 | ResourceLimit, | ||
| 27 | CodeSet, | ||
| 28 | ClientPort, | ||
| 29 | ServerPort, | ||
| 30 | ClientSession, | ||
| 31 | ServerSession, | ||
| 32 | }; | ||
| 33 | |||
| 34 | enum class ResetType { | ||
| 35 | OneShot, | ||
| 36 | Sticky, | ||
| 37 | Pulse, | ||
| 38 | }; | ||
| 39 | |||
| 40 | class Object : NonCopyable { | ||
| 41 | public: | ||
| 42 | virtual ~Object(); | ||
| 43 | |||
| 44 | /// Returns a unique identifier for the object. For debugging purposes only. | ||
| 45 | unsigned int GetObjectId() const { | ||
| 46 | return object_id; | ||
| 47 | } | ||
| 48 | |||
| 49 | virtual std::string GetTypeName() const { | ||
| 50 | return "[BAD KERNEL OBJECT TYPE]"; | ||
| 51 | } | ||
| 52 | virtual std::string GetName() const { | ||
| 53 | return "[UNKNOWN KERNEL OBJECT]"; | ||
| 54 | } | ||
| 55 | virtual HandleType GetHandleType() const = 0; | ||
| 56 | |||
| 57 | /** | ||
| 58 | * Check if a thread can wait on the object | ||
| 59 | * @return True if a thread can wait on the object, otherwise false | ||
| 60 | */ | ||
| 61 | bool IsWaitable() const; | ||
| 62 | |||
| 63 | public: | ||
| 64 | static unsigned int next_object_id; | ||
| 65 | |||
| 66 | private: | ||
| 67 | friend void intrusive_ptr_add_ref(Object*); | ||
| 68 | friend void intrusive_ptr_release(Object*); | ||
| 69 | |||
| 70 | unsigned int ref_count = 0; | ||
| 71 | unsigned int object_id = next_object_id++; | ||
| 72 | }; | ||
| 73 | |||
| 74 | // Special functions used by boost::instrusive_ptr to do automatic ref-counting | ||
| 75 | inline void intrusive_ptr_add_ref(Object* object) { | ||
| 76 | ++object->ref_count; | ||
| 77 | } | ||
| 78 | |||
| 79 | inline void intrusive_ptr_release(Object* object) { | ||
| 80 | if (--object->ref_count == 0) { | ||
| 81 | delete object; | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 85 | template <typename T> | ||
| 86 | using SharedPtr = boost::intrusive_ptr<T>; | ||
| 87 | |||
| 88 | /** | ||
| 89 | * Attempts to downcast the given Object pointer to a pointer to T. | ||
| 90 | * @return Derived pointer to the object, or `nullptr` if `object` isn't of type T. | ||
| 91 | */ | ||
| 92 | template <typename T> | ||
| 93 | inline SharedPtr<T> DynamicObjectCast(SharedPtr<Object> object) { | ||
| 94 | if (object != nullptr && object->GetHandleType() == T::HANDLE_TYPE) { | ||
| 95 | return boost::static_pointer_cast<T>(std::move(object)); | ||
| 96 | } | ||
| 97 | return nullptr; | ||
| 98 | } | ||
| 99 | |||
| 100 | } // namespace Kernel | ||
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h index 68e77a4d1..1204026be 100644 --- a/src/core/hle/kernel/process.h +++ b/src/core/hle/kernel/process.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include <boost/container/static_vector.hpp> | 12 | #include <boost/container/static_vector.hpp> |
| 13 | #include "common/bit_field.h" | 13 | #include "common/bit_field.h" |
| 14 | #include "common/common_types.h" | 14 | #include "common/common_types.h" |
| 15 | #include "core/hle/kernel/kernel.h" | 15 | #include "core/hle/kernel/object.h" |
| 16 | #include "core/hle/kernel/thread.h" | 16 | #include "core/hle/kernel/thread.h" |
| 17 | #include "core/hle/kernel/vm_manager.h" | 17 | #include "core/hle/kernel/vm_manager.h" |
| 18 | 18 | ||
diff --git a/src/core/hle/kernel/resource_limit.h b/src/core/hle/kernel/resource_limit.h index cc689a27a..0fa141db3 100644 --- a/src/core/hle/kernel/resource_limit.h +++ b/src/core/hle/kernel/resource_limit.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "core/hle/kernel/kernel.h" | 8 | #include "core/hle/kernel/object.h" |
| 9 | 9 | ||
| 10 | namespace Kernel { | 10 | namespace Kernel { |
| 11 | 11 | ||
diff --git a/src/core/hle/kernel/scheduler.h b/src/core/hle/kernel/scheduler.h index cdc14808b..1a4ee8f36 100644 --- a/src/core/hle/kernel/scheduler.h +++ b/src/core/hle/kernel/scheduler.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <vector> | 8 | #include <vector> |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "common/thread_queue_list.h" | 10 | #include "common/thread_queue_list.h" |
| 11 | #include "core/hle/kernel/object.h" | ||
| 11 | #include "core/hle/kernel/thread.h" | 12 | #include "core/hle/kernel/thread.h" |
| 12 | 13 | ||
| 13 | class ARM_Interface; | 14 | class ARM_Interface; |
diff --git a/src/core/hle/kernel/server_port.cpp b/src/core/hle/kernel/server_port.cpp index 0b7061403..7b6211fd8 100644 --- a/src/core/hle/kernel/server_port.cpp +++ b/src/core/hle/kernel/server_port.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "common/assert.h" | 6 | #include "common/assert.h" |
| 7 | #include "core/hle/kernel/client_port.h" | 7 | #include "core/hle/kernel/client_port.h" |
| 8 | #include "core/hle/kernel/errors.h" | 8 | #include "core/hle/kernel/errors.h" |
| 9 | #include "core/hle/kernel/kernel.h" | 9 | #include "core/hle/kernel/object.h" |
| 10 | #include "core/hle/kernel/server_port.h" | 10 | #include "core/hle/kernel/server_port.h" |
| 11 | #include "core/hle/kernel/server_session.h" | 11 | #include "core/hle/kernel/server_session.h" |
| 12 | #include "core/hle/kernel/thread.h" | 12 | #include "core/hle/kernel/thread.h" |
diff --git a/src/core/hle/kernel/server_port.h b/src/core/hle/kernel/server_port.h index e6546687e..7f6d6b3eb 100644 --- a/src/core/hle/kernel/server_port.h +++ b/src/core/hle/kernel/server_port.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include <tuple> | 9 | #include <tuple> |
| 10 | #include <vector> | 10 | #include <vector> |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "core/hle/kernel/kernel.h" | 12 | #include "core/hle/kernel/object.h" |
| 13 | #include "core/hle/kernel/wait_object.h" | 13 | #include "core/hle/kernel/wait_object.h" |
| 14 | 14 | ||
| 15 | namespace Kernel { | 15 | namespace Kernel { |
diff --git a/src/core/hle/kernel/server_session.h b/src/core/hle/kernel/server_session.h index c7656cc49..2bce54fee 100644 --- a/src/core/hle/kernel/server_session.h +++ b/src/core/hle/kernel/server_session.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include <vector> | 9 | #include <vector> |
| 10 | 10 | ||
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "core/hle/kernel/kernel.h" | 12 | #include "core/hle/kernel/object.h" |
| 13 | #include "core/hle/kernel/wait_object.h" | 13 | #include "core/hle/kernel/wait_object.h" |
| 14 | #include "core/hle/result.h" | 14 | #include "core/hle/result.h" |
| 15 | 15 | ||
diff --git a/src/core/hle/kernel/session.h b/src/core/hle/kernel/session.h index e69b034a7..7a551f5e4 100644 --- a/src/core/hle/kernel/session.h +++ b/src/core/hle/kernel/session.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "core/hle/kernel/kernel.h" | 7 | #include "core/hle/kernel/object.h" |
| 8 | 8 | ||
| 9 | namespace Kernel { | 9 | namespace Kernel { |
| 10 | 10 | ||
diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h index 17b9cedc4..8a6f68529 100644 --- a/src/core/hle/kernel/shared_memory.h +++ b/src/core/hle/kernel/shared_memory.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include <vector> | 9 | #include <vector> |
| 10 | 10 | ||
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "core/hle/kernel/kernel.h" | 12 | #include "core/hle/kernel/object.h" |
| 13 | #include "core/hle/kernel/process.h" | 13 | #include "core/hle/kernel/process.h" |
| 14 | #include "core/hle/result.h" | 14 | #include "core/hle/result.h" |
| 15 | 15 | ||
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index d1cbbc1f2..5db2db687 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -267,7 +267,7 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) | |||
| 267 | LOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id, | 267 | LOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id, |
| 268 | info_sub_id, handle); | 268 | info_sub_id, handle); |
| 269 | 269 | ||
| 270 | auto& vm_manager = Core::CurrentProcess()->vm_manager; | 270 | const auto& vm_manager = Core::CurrentProcess()->vm_manager; |
| 271 | 271 | ||
| 272 | switch (static_cast<GetInfoType>(info_id)) { | 272 | switch (static_cast<GetInfoType>(info_id)) { |
| 273 | case GetInfoType::AllowedCpuIdBitmask: | 273 | case GetInfoType::AllowedCpuIdBitmask: |
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 93ea58a1e..cdb8120f2 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -20,8 +20,8 @@ | |||
| 20 | #include "core/core_timing_util.h" | 20 | #include "core/core_timing_util.h" |
| 21 | #include "core/hle/kernel/errors.h" | 21 | #include "core/hle/kernel/errors.h" |
| 22 | #include "core/hle/kernel/handle_table.h" | 22 | #include "core/hle/kernel/handle_table.h" |
| 23 | #include "core/hle/kernel/kernel.h" | ||
| 24 | #include "core/hle/kernel/memory.h" | 23 | #include "core/hle/kernel/memory.h" |
| 24 | #include "core/hle/kernel/object.h" | ||
| 25 | #include "core/hle/kernel/process.h" | 25 | #include "core/hle/kernel/process.h" |
| 26 | #include "core/hle/kernel/thread.h" | 26 | #include "core/hle/kernel/thread.h" |
| 27 | #include "core/hle/result.h" | 27 | #include "core/hle/result.h" |
| @@ -252,13 +252,14 @@ void Thread::ResumeFromWait() { | |||
| 252 | * slot: The index of the first free slot in the indicated page. | 252 | * slot: The index of the first free slot in the indicated page. |
| 253 | * alloc_needed: Whether there's a need to allocate a new TLS page (All pages are full). | 253 | * alloc_needed: Whether there's a need to allocate a new TLS page (All pages are full). |
| 254 | */ | 254 | */ |
| 255 | std::tuple<u32, u32, bool> GetFreeThreadLocalSlot(std::vector<std::bitset<8>>& tls_slots) { | 255 | static std::tuple<std::size_t, std::size_t, bool> GetFreeThreadLocalSlot( |
| 256 | const std::vector<std::bitset<8>>& tls_slots) { | ||
| 256 | // Iterate over all the allocated pages, and try to find one where not all slots are used. | 257 | // Iterate over all the allocated pages, and try to find one where not all slots are used. |
| 257 | for (unsigned page = 0; page < tls_slots.size(); ++page) { | 258 | for (std::size_t page = 0; page < tls_slots.size(); ++page) { |
| 258 | const auto& page_tls_slots = tls_slots[page]; | 259 | const auto& page_tls_slots = tls_slots[page]; |
| 259 | if (!page_tls_slots.all()) { | 260 | if (!page_tls_slots.all()) { |
| 260 | // We found a page with at least one free slot, find which slot it is | 261 | // We found a page with at least one free slot, find which slot it is |
| 261 | for (unsigned slot = 0; slot < page_tls_slots.size(); ++slot) { | 262 | for (std::size_t slot = 0; slot < page_tls_slots.size(); ++slot) { |
| 262 | if (!page_tls_slots.test(slot)) { | 263 | if (!page_tls_slots.test(slot)) { |
| 263 | return std::make_tuple(page, slot, false); | 264 | return std::make_tuple(page, slot, false); |
| 264 | } | 265 | } |
| @@ -333,11 +334,8 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point, | |||
| 333 | 334 | ||
| 334 | // Find the next available TLS index, and mark it as used | 335 | // Find the next available TLS index, and mark it as used |
| 335 | auto& tls_slots = owner_process->tls_slots; | 336 | auto& tls_slots = owner_process->tls_slots; |
| 336 | bool needs_allocation = true; | ||
| 337 | u32 available_page; // Which allocated page has free space | ||
| 338 | u32 available_slot; // Which slot within the page is free | ||
| 339 | 337 | ||
| 340 | std::tie(available_page, available_slot, needs_allocation) = GetFreeThreadLocalSlot(tls_slots); | 338 | auto [available_page, available_slot, needs_allocation] = GetFreeThreadLocalSlot(tls_slots); |
| 341 | 339 | ||
| 342 | if (needs_allocation) { | 340 | if (needs_allocation) { |
| 343 | // There are no already-allocated pages with free slots, lets allocate a new one. | 341 | // There are no already-allocated pages with free slots, lets allocate a new one. |
| @@ -359,7 +357,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point, | |||
| 359 | owner_process->linear_heap_used += Memory::PAGE_SIZE; | 357 | owner_process->linear_heap_used += Memory::PAGE_SIZE; |
| 360 | 358 | ||
| 361 | tls_slots.emplace_back(0); // The page is completely available at the start | 359 | tls_slots.emplace_back(0); // The page is completely available at the start |
| 362 | available_page = static_cast<u32>(tls_slots.size() - 1); | 360 | available_page = tls_slots.size() - 1; |
| 363 | available_slot = 0; // Use the first slot in the new page | 361 | available_slot = 0; // Use the first slot in the new page |
| 364 | 362 | ||
| 365 | auto& vm_manager = owner_process->vm_manager; | 363 | auto& vm_manager = owner_process->vm_manager; |
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 3a96db5f3..146955e13 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "core/arm/arm_interface.h" | 13 | #include "core/arm/arm_interface.h" |
| 14 | #include "core/hle/kernel/kernel.h" | 14 | #include "core/hle/kernel/object.h" |
| 15 | #include "core/hle/kernel/wait_object.h" | 15 | #include "core/hle/kernel/wait_object.h" |
| 16 | #include "core/hle/result.h" | 16 | #include "core/hle/result.h" |
| 17 | 17 | ||
diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp index 904a3d0a5..282360745 100644 --- a/src/core/hle/kernel/timer.cpp +++ b/src/core/hle/kernel/timer.cpp | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include "core/core_timing.h" | 8 | #include "core/core_timing.h" |
| 9 | #include "core/core_timing_util.h" | 9 | #include "core/core_timing_util.h" |
| 10 | #include "core/hle/kernel/handle_table.h" | 10 | #include "core/hle/kernel/handle_table.h" |
| 11 | #include "core/hle/kernel/kernel.h" | 11 | #include "core/hle/kernel/object.h" |
| 12 | #include "core/hle/kernel/thread.h" | 12 | #include "core/hle/kernel/thread.h" |
| 13 | #include "core/hle/kernel/timer.h" | 13 | #include "core/hle/kernel/timer.h" |
| 14 | 14 | ||
diff --git a/src/core/hle/kernel/timer.h b/src/core/hle/kernel/timer.h index c63f0ed90..4dddc67e0 100644 --- a/src/core/hle/kernel/timer.h +++ b/src/core/hle/kernel/timer.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "core/hle/kernel/kernel.h" | 8 | #include "core/hle/kernel/object.h" |
| 9 | #include "core/hle/kernel/wait_object.h" | 9 | #include "core/hle/kernel/wait_object.h" |
| 10 | 10 | ||
| 11 | namespace Kernel { | 11 | namespace Kernel { |
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp index 9d26fd781..479cacb62 100644 --- a/src/core/hle/kernel/vm_manager.cpp +++ b/src/core/hle/kernel/vm_manager.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | ||
| 5 | #include <iterator> | 6 | #include <iterator> |
| 6 | #include <utility> | 7 | #include <utility> |
| 7 | #include "common/assert.h" | 8 | #include "common/assert.h" |
| @@ -175,9 +176,9 @@ VMManager::VMAIter VMManager::Unmap(VMAIter vma_handle) { | |||
| 175 | 176 | ||
| 176 | ResultCode VMManager::UnmapRange(VAddr target, u64 size) { | 177 | ResultCode VMManager::UnmapRange(VAddr target, u64 size) { |
| 177 | CASCADE_RESULT(VMAIter vma, CarveVMARange(target, size)); | 178 | CASCADE_RESULT(VMAIter vma, CarveVMARange(target, size)); |
| 178 | VAddr target_end = target + size; | 179 | const VAddr target_end = target + size; |
| 179 | 180 | ||
| 180 | VMAIter end = vma_map.end(); | 181 | const VMAIter end = vma_map.end(); |
| 181 | // The comparison against the end of the range must be done using addresses since VMAs can be | 182 | // The comparison against the end of the range must be done using addresses since VMAs can be |
| 182 | // merged during this process, causing invalidation of the iterators. | 183 | // merged during this process, causing invalidation of the iterators. |
| 183 | while (vma != end && vma->second.base < target_end) { | 184 | while (vma != end && vma->second.base < target_end) { |
| @@ -207,9 +208,9 @@ VMManager::VMAHandle VMManager::Reprotect(VMAHandle vma_handle, VMAPermission ne | |||
| 207 | 208 | ||
| 208 | ResultCode VMManager::ReprotectRange(VAddr target, u64 size, VMAPermission new_perms) { | 209 | ResultCode VMManager::ReprotectRange(VAddr target, u64 size, VMAPermission new_perms) { |
| 209 | CASCADE_RESULT(VMAIter vma, CarveVMARange(target, size)); | 210 | CASCADE_RESULT(VMAIter vma, CarveVMARange(target, size)); |
| 210 | VAddr target_end = target + size; | 211 | const VAddr target_end = target + size; |
| 211 | 212 | ||
| 212 | VMAIter end = vma_map.end(); | 213 | const VMAIter end = vma_map.end(); |
| 213 | // The comparison against the end of the range must be done using addresses since VMAs can be | 214 | // The comparison against the end of the range must be done using addresses since VMAs can be |
| 214 | // merged during this process, causing invalidation of the iterators. | 215 | // merged during this process, causing invalidation of the iterators. |
| 215 | while (vma != end && vma->second.base < target_end) { | 216 | while (vma != end && vma->second.base < target_end) { |
| @@ -258,14 +259,14 @@ ResultVal<VMManager::VMAIter> VMManager::CarveVMA(VAddr base, u64 size) { | |||
| 258 | return ERR_INVALID_ADDRESS; | 259 | return ERR_INVALID_ADDRESS; |
| 259 | } | 260 | } |
| 260 | 261 | ||
| 261 | VirtualMemoryArea& vma = vma_handle->second; | 262 | const VirtualMemoryArea& vma = vma_handle->second; |
| 262 | if (vma.type != VMAType::Free) { | 263 | if (vma.type != VMAType::Free) { |
| 263 | // Region is already allocated | 264 | // Region is already allocated |
| 264 | return ERR_INVALID_ADDRESS_STATE; | 265 | return ERR_INVALID_ADDRESS_STATE; |
| 265 | } | 266 | } |
| 266 | 267 | ||
| 267 | u64 start_in_vma = base - vma.base; | 268 | const VAddr start_in_vma = base - vma.base; |
| 268 | u64 end_in_vma = start_in_vma + size; | 269 | const VAddr end_in_vma = start_in_vma + size; |
| 269 | 270 | ||
| 270 | if (end_in_vma > vma.size) { | 271 | if (end_in_vma > vma.size) { |
| 271 | // Requested allocation doesn't fit inside VMA | 272 | // Requested allocation doesn't fit inside VMA |
| @@ -288,17 +289,16 @@ ResultVal<VMManager::VMAIter> VMManager::CarveVMARange(VAddr target, u64 size) { | |||
| 288 | ASSERT_MSG((size & Memory::PAGE_MASK) == 0, "non-page aligned size: 0x{:016X}", size); | 289 | ASSERT_MSG((size & Memory::PAGE_MASK) == 0, "non-page aligned size: 0x{:016X}", size); |
| 289 | ASSERT_MSG((target & Memory::PAGE_MASK) == 0, "non-page aligned base: 0x{:016X}", target); | 290 | ASSERT_MSG((target & Memory::PAGE_MASK) == 0, "non-page aligned base: 0x{:016X}", target); |
| 290 | 291 | ||
| 291 | VAddr target_end = target + size; | 292 | const VAddr target_end = target + size; |
| 292 | ASSERT(target_end >= target); | 293 | ASSERT(target_end >= target); |
| 293 | ASSERT(target_end <= MAX_ADDRESS); | 294 | ASSERT(target_end <= MAX_ADDRESS); |
| 294 | ASSERT(size > 0); | 295 | ASSERT(size > 0); |
| 295 | 296 | ||
| 296 | VMAIter begin_vma = StripIterConstness(FindVMA(target)); | 297 | VMAIter begin_vma = StripIterConstness(FindVMA(target)); |
| 297 | VMAIter i_end = vma_map.lower_bound(target_end); | 298 | const VMAIter i_end = vma_map.lower_bound(target_end); |
| 298 | for (auto i = begin_vma; i != i_end; ++i) { | 299 | if (std::any_of(begin_vma, i_end, |
| 299 | if (i->second.type == VMAType::Free) { | 300 | [](const auto& entry) { return entry.second.type == VMAType::Free; })) { |
| 300 | return ERR_INVALID_ADDRESS_STATE; | 301 | return ERR_INVALID_ADDRESS_STATE; |
| 301 | } | ||
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | if (target != begin_vma->second.base) { | 304 | if (target != begin_vma->second.base) { |
| @@ -346,7 +346,7 @@ VMManager::VMAIter VMManager::SplitVMA(VMAIter vma_handle, u64 offset_in_vma) { | |||
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | VMManager::VMAIter VMManager::MergeAdjacent(VMAIter iter) { | 348 | VMManager::VMAIter VMManager::MergeAdjacent(VMAIter iter) { |
| 349 | VMAIter next_vma = std::next(iter); | 349 | const VMAIter next_vma = std::next(iter); |
| 350 | if (next_vma != vma_map.end() && iter->second.CanBeMergedWith(next_vma->second)) { | 350 | if (next_vma != vma_map.end() && iter->second.CanBeMergedWith(next_vma->second)) { |
| 351 | iter->second.size += next_vma->second.size; | 351 | iter->second.size += next_vma->second.size; |
| 352 | vma_map.erase(next_vma); | 352 | vma_map.erase(next_vma); |
| @@ -382,22 +382,22 @@ void VMManager::UpdatePageTableForVMA(const VirtualMemoryArea& vma) { | |||
| 382 | } | 382 | } |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | u64 VMManager::GetTotalMemoryUsage() { | 385 | u64 VMManager::GetTotalMemoryUsage() const { |
| 386 | LOG_WARNING(Kernel, "(STUBBED) called"); | 386 | LOG_WARNING(Kernel, "(STUBBED) called"); |
| 387 | return 0xF8000000; | 387 | return 0xF8000000; |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | u64 VMManager::GetTotalHeapUsage() { | 390 | u64 VMManager::GetTotalHeapUsage() const { |
| 391 | LOG_WARNING(Kernel, "(STUBBED) called"); | 391 | LOG_WARNING(Kernel, "(STUBBED) called"); |
| 392 | return 0x0; | 392 | return 0x0; |
| 393 | } | 393 | } |
| 394 | 394 | ||
| 395 | VAddr VMManager::GetAddressSpaceBaseAddr() { | 395 | VAddr VMManager::GetAddressSpaceBaseAddr() const { |
| 396 | LOG_WARNING(Kernel, "(STUBBED) called"); | 396 | LOG_WARNING(Kernel, "(STUBBED) called"); |
| 397 | return 0x8000000; | 397 | return 0x8000000; |
| 398 | } | 398 | } |
| 399 | 399 | ||
| 400 | u64 VMManager::GetAddressSpaceSize() { | 400 | u64 VMManager::GetAddressSpaceSize() const { |
| 401 | LOG_WARNING(Kernel, "(STUBBED) called"); | 401 | LOG_WARNING(Kernel, "(STUBBED) called"); |
| 402 | return MAX_ADDRESS; | 402 | return MAX_ADDRESS; |
| 403 | } | 403 | } |
diff --git a/src/core/hle/kernel/vm_manager.h b/src/core/hle/kernel/vm_manager.h index 38e4ebcd3..98bd04bea 100644 --- a/src/core/hle/kernel/vm_manager.h +++ b/src/core/hle/kernel/vm_manager.h | |||
| @@ -190,16 +190,16 @@ public: | |||
| 190 | void LogLayout() const; | 190 | void LogLayout() const; |
| 191 | 191 | ||
| 192 | /// Gets the total memory usage, used by svcGetInfo | 192 | /// Gets the total memory usage, used by svcGetInfo |
| 193 | u64 GetTotalMemoryUsage(); | 193 | u64 GetTotalMemoryUsage() const; |
| 194 | 194 | ||
| 195 | /// Gets the total heap usage, used by svcGetInfo | 195 | /// Gets the total heap usage, used by svcGetInfo |
| 196 | u64 GetTotalHeapUsage(); | 196 | u64 GetTotalHeapUsage() const; |
| 197 | 197 | ||
| 198 | /// Gets the total address space base address, used by svcGetInfo | 198 | /// Gets the total address space base address, used by svcGetInfo |
| 199 | VAddr GetAddressSpaceBaseAddr(); | 199 | VAddr GetAddressSpaceBaseAddr() const; |
| 200 | 200 | ||
| 201 | /// Gets the total address space address size, used by svcGetInfo | 201 | /// Gets the total address space address size, used by svcGetInfo |
| 202 | u64 GetAddressSpaceSize(); | 202 | u64 GetAddressSpaceSize() const; |
| 203 | 203 | ||
| 204 | /// Each VMManager has its own page table, which is set as the main one when the owning process | 204 | /// Each VMManager has its own page table, which is set as the main one when the owning process |
| 205 | /// is scheduled. | 205 | /// is scheduled. |
diff --git a/src/core/hle/kernel/wait_object.cpp b/src/core/hle/kernel/wait_object.cpp index 97394bca2..7681cdee7 100644 --- a/src/core/hle/kernel/wait_object.cpp +++ b/src/core/hle/kernel/wait_object.cpp | |||
| @@ -5,8 +5,7 @@ | |||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include "common/assert.h" | 6 | #include "common/assert.h" |
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | #include "core/hle/kernel/kernel.h" | 8 | #include "core/hle/kernel/object.h" |
| 9 | #include "core/hle/kernel/memory.h" | ||
| 10 | #include "core/hle/kernel/process.h" | 9 | #include "core/hle/kernel/process.h" |
| 11 | #include "core/hle/kernel/thread.h" | 10 | #include "core/hle/kernel/thread.h" |
| 12 | #include "core/hle/kernel/timer.h" | 11 | #include "core/hle/kernel/timer.h" |
diff --git a/src/core/hle/kernel/wait_object.h b/src/core/hle/kernel/wait_object.h index 78bfd8c6c..b5fbc647b 100644 --- a/src/core/hle/kernel/wait_object.h +++ b/src/core/hle/kernel/wait_object.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include <vector> | 7 | #include <vector> |
| 8 | #include <boost/smart_ptr/intrusive_ptr.hpp> | 8 | #include <boost/smart_ptr/intrusive_ptr.hpp> |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "core/hle/kernel/kernel.h" | 10 | #include "core/hle/kernel/object.h" |
| 11 | 11 | ||
| 12 | namespace Kernel { | 12 | namespace Kernel { |
| 13 | 13 | ||
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 89c703310..98017267c 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp | |||
| @@ -2,12 +2,459 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/hle/ipc_helpers.h" | ||
| 6 | #include "core/hle/kernel/hle_ipc.h" | ||
| 5 | #include "core/hle/service/ns/ns.h" | 7 | #include "core/hle/service/ns/ns.h" |
| 6 | #include "core/hle/service/ns/pl_u.h" | 8 | #include "core/hle/service/ns/pl_u.h" |
| 7 | 9 | ||
| 8 | namespace Service::NS { | 10 | namespace Service::NS { |
| 9 | 11 | ||
| 12 | class IAccountProxyInterface final : public ServiceFramework<IAccountProxyInterface> { | ||
| 13 | public: | ||
| 14 | explicit IAccountProxyInterface() : ServiceFramework{"IAccountProxyInterface"} { | ||
| 15 | // clang-format off | ||
| 16 | static const FunctionInfo functions[] = { | ||
| 17 | {0, nullptr, "CreateUserAccount"}, | ||
| 18 | }; | ||
| 19 | // clang-format on | ||
| 20 | |||
| 21 | RegisterHandlers(functions); | ||
| 22 | } | ||
| 23 | }; | ||
| 24 | |||
| 25 | class IApplicationManagerInterface final : public ServiceFramework<IApplicationManagerInterface> { | ||
| 26 | public: | ||
| 27 | explicit IApplicationManagerInterface() : ServiceFramework{"IApplicationManagerInterface"} { | ||
| 28 | // clang-format off | ||
| 29 | static const FunctionInfo functions[] = { | ||
| 30 | {0, nullptr, "ListApplicationRecord"}, | ||
| 31 | {1, nullptr, "GenerateApplicationRecordCount"}, | ||
| 32 | {2, nullptr, "GetApplicationRecordUpdateSystemEvent"}, | ||
| 33 | {3, nullptr, "GetApplicationViewDeprecated"}, | ||
| 34 | {4, nullptr, "DeleteApplicationEntity"}, | ||
| 35 | {5, nullptr, "DeleteApplicationCompletely"}, | ||
| 36 | {6, nullptr, "IsAnyApplicationEntityRedundant"}, | ||
| 37 | {7, nullptr, "DeleteRedundantApplicationEntity"}, | ||
| 38 | {8, nullptr, "IsApplicationEntityMovable"}, | ||
| 39 | {9, nullptr, "MoveApplicationEntity"}, | ||
| 40 | {11, nullptr, "CalculateApplicationOccupiedSize"}, | ||
| 41 | {16, nullptr, "PushApplicationRecord"}, | ||
| 42 | {17, nullptr, "ListApplicationRecordContentMeta"}, | ||
| 43 | {19, nullptr, "LaunchApplication"}, | ||
| 44 | {21, nullptr, "GetApplicationContentPath"}, | ||
| 45 | {22, nullptr, "TerminateApplication"}, | ||
| 46 | {23, nullptr, "ResolveApplicationContentPath"}, | ||
| 47 | {26, nullptr, "BeginInstallApplication"}, | ||
| 48 | {27, nullptr, "DeleteApplicationRecord"}, | ||
| 49 | {30, nullptr, "RequestApplicationUpdateInfo"}, | ||
| 50 | {32, nullptr, "CancelApplicationDownload"}, | ||
| 51 | {33, nullptr, "ResumeApplicationDownload"}, | ||
| 52 | {35, nullptr, "UpdateVersionList"}, | ||
| 53 | {36, nullptr, "PushLaunchVersion"}, | ||
| 54 | {37, nullptr, "ListRequiredVersion"}, | ||
| 55 | {38, nullptr, "CheckApplicationLaunchVersion"}, | ||
| 56 | {39, nullptr, "CheckApplicationLaunchRights"}, | ||
| 57 | {40, nullptr, "GetApplicationLogoData"}, | ||
| 58 | {41, nullptr, "CalculateApplicationDownloadRequiredSize"}, | ||
| 59 | {42, nullptr, "CleanupSdCard"}, | ||
| 60 | {43, nullptr, "CheckSdCardMountStatus"}, | ||
| 61 | {44, nullptr, "GetSdCardMountStatusChangedEvent"}, | ||
| 62 | {45, nullptr, "GetGameCardAttachmentEvent"}, | ||
| 63 | {46, nullptr, "GetGameCardAttachmentInfo"}, | ||
| 64 | {47, nullptr, "GetTotalSpaceSize"}, | ||
| 65 | {48, nullptr, "GetFreeSpaceSize"}, | ||
| 66 | {49, nullptr, "GetSdCardRemovedEvent"}, | ||
| 67 | {52, nullptr, "GetGameCardUpdateDetectionEvent"}, | ||
| 68 | {53, nullptr, "DisableApplicationAutoDelete"}, | ||
| 69 | {54, nullptr, "EnableApplicationAutoDelete"}, | ||
| 70 | {55, nullptr, "GetApplicationDesiredLanguage"}, | ||
| 71 | {56, nullptr, "SetApplicationTerminateResult"}, | ||
| 72 | {57, nullptr, "ClearApplicationTerminateResult"}, | ||
| 73 | {58, nullptr, "GetLastSdCardMountUnexpectedResult"}, | ||
| 74 | {59, nullptr, "ConvertApplicationLanguageToLanguageCode"}, | ||
| 75 | {60, nullptr, "ConvertLanguageCodeToApplicationLanguage"}, | ||
| 76 | {61, nullptr, "GetBackgroundDownloadStressTaskInfo"}, | ||
| 77 | {62, nullptr, "GetGameCardStopper"}, | ||
| 78 | {63, nullptr, "IsSystemProgramInstalled"}, | ||
| 79 | {64, nullptr, "StartApplyDeltaTask"}, | ||
| 80 | {65, nullptr, "GetRequestServerStopper"}, | ||
| 81 | {66, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"}, | ||
| 82 | {67, nullptr, "CancelApplicationApplyDelta"}, | ||
| 83 | {68, nullptr, "ResumeApplicationApplyDelta"}, | ||
| 84 | {69, nullptr, "CalculateApplicationApplyDeltaRequiredSize"}, | ||
| 85 | {70, nullptr, "ResumeAll"}, | ||
| 86 | {71, nullptr, "GetStorageSize"}, | ||
| 87 | {80, nullptr, "RequestDownloadApplication"}, | ||
| 88 | {81, nullptr, "RequestDownloadAddOnContent"}, | ||
| 89 | {82, nullptr, "DownloadApplication"}, | ||
| 90 | {83, nullptr, "CheckApplicationResumeRights"}, | ||
| 91 | {84, nullptr, "GetDynamicCommitEvent"}, | ||
| 92 | {85, nullptr, "RequestUpdateApplication2"}, | ||
| 93 | {86, nullptr, "EnableApplicationCrashReport"}, | ||
| 94 | {87, nullptr, "IsApplicationCrashReportEnabled"}, | ||
| 95 | {90, nullptr, "BoostSystemMemoryResourceLimit"}, | ||
| 96 | {100, nullptr, "ResetToFactorySettings"}, | ||
| 97 | {101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"}, | ||
| 98 | {102, nullptr, "ResetToFactorySettingsForRefurbishment"}, | ||
| 99 | {200, nullptr, "CalculateUserSaveDataStatistics"}, | ||
| 100 | {201, nullptr, "DeleteUserSaveDataAll"}, | ||
| 101 | {210, nullptr, "DeleteUserSystemSaveData"}, | ||
| 102 | {220, nullptr, "UnregisterNetworkServiceAccount"}, | ||
| 103 | {300, nullptr, "GetApplicationShellEvent"}, | ||
| 104 | {301, nullptr, "PopApplicationShellEventInfo"}, | ||
| 105 | {302, nullptr, "LaunchLibraryApplet"}, | ||
| 106 | {303, nullptr, "TerminateLibraryApplet"}, | ||
| 107 | {304, nullptr, "LaunchSystemApplet"}, | ||
| 108 | {305, nullptr, "TerminateSystemApplet"}, | ||
| 109 | {306, nullptr, "LaunchOverlayApplet"}, | ||
| 110 | {307, nullptr, "TerminateOverlayApplet"}, | ||
| 111 | {400, nullptr, "GetApplicationControlData"}, | ||
| 112 | {401, nullptr, "InvalidateAllApplicationControlCache"}, | ||
| 113 | {402, nullptr, "RequestDownloadApplicationControlData"}, | ||
| 114 | {403, nullptr, "GetMaxApplicationControlCacheCount"}, | ||
| 115 | {404, nullptr, "InvalidateApplicationControlCache"}, | ||
| 116 | {405, nullptr, "ListApplicationControlCacheEntryInfo"}, | ||
| 117 | {502, nullptr, "RequestCheckGameCardRegistration"}, | ||
| 118 | {503, nullptr, "RequestGameCardRegistrationGoldPoint"}, | ||
| 119 | {504, nullptr, "RequestRegisterGameCard"}, | ||
| 120 | {505, nullptr, "GetGameCardMountFailureEvent"}, | ||
| 121 | {506, nullptr, "IsGameCardInserted"}, | ||
| 122 | {507, nullptr, "EnsureGameCardAccess"}, | ||
| 123 | {508, nullptr, "GetLastGameCardMountFailureResult"}, | ||
| 124 | {509, nullptr, "ListApplicationIdOnGameCard"}, | ||
| 125 | {600, nullptr, "CountApplicationContentMeta"}, | ||
| 126 | {601, nullptr, "ListApplicationContentMetaStatus"}, | ||
| 127 | {602, nullptr, "ListAvailableAddOnContent"}, | ||
| 128 | {603, nullptr, "GetOwnedApplicationContentMetaStatus"}, | ||
| 129 | {604, nullptr, "RegisterContentsExternalKey"}, | ||
| 130 | {605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"}, | ||
| 131 | {606, nullptr, "GetContentMetaStorage"}, | ||
| 132 | {700, nullptr, "PushDownloadTaskList"}, | ||
| 133 | {701, nullptr, "ClearTaskStatusList"}, | ||
| 134 | {702, nullptr, "RequestDownloadTaskList"}, | ||
| 135 | {703, nullptr, "RequestEnsureDownloadTask"}, | ||
| 136 | {704, nullptr, "ListDownloadTaskStatus"}, | ||
| 137 | {705, nullptr, "RequestDownloadTaskListData"}, | ||
| 138 | {800, nullptr, "RequestVersionList"}, | ||
| 139 | {801, nullptr, "ListVersionList"}, | ||
| 140 | {802, nullptr, "RequestVersionListData"}, | ||
| 141 | {900, nullptr, "GetApplicationRecord"}, | ||
| 142 | {901, nullptr, "GetApplicationRecordProperty"}, | ||
| 143 | {902, nullptr, "EnableApplicationAutoUpdate"}, | ||
| 144 | {903, nullptr, "DisableApplicationAutoUpdate"}, | ||
| 145 | {904, nullptr, "TouchApplication"}, | ||
| 146 | {905, nullptr, "RequestApplicationUpdate"}, | ||
| 147 | {906, nullptr, "IsApplicationUpdateRequested"}, | ||
| 148 | {907, nullptr, "WithdrawApplicationUpdateRequest"}, | ||
| 149 | {908, nullptr, "ListApplicationRecordInstalledContentMeta"}, | ||
| 150 | {909, nullptr, "WithdrawCleanupAddOnContentsWithNoRightsRecommendation"}, | ||
| 151 | {1000, nullptr, "RequestVerifyApplicationDeprecated"}, | ||
| 152 | {1001, nullptr, "CorruptApplicationForDebug"}, | ||
| 153 | {1002, nullptr, "RequestVerifyAddOnContentsRights"}, | ||
| 154 | {1003, nullptr, "RequestVerifyApplication"}, | ||
| 155 | {1004, nullptr, "CorruptContentForDebug"}, | ||
| 156 | {1200, nullptr, "NeedsUpdateVulnerability"}, | ||
| 157 | {1300, nullptr, "IsAnyApplicationEntityInstalled"}, | ||
| 158 | {1301, nullptr, "DeleteApplicationContentEntities"}, | ||
| 159 | {1302, nullptr, "CleanupUnrecordedApplicationEntity"}, | ||
| 160 | {1303, nullptr, "CleanupAddOnContentsWithNoRights"}, | ||
| 161 | {1304, nullptr, "DeleteApplicationContentEntity"}, | ||
| 162 | {1305, nullptr, "TryDeleteRunningApplicationEntity"}, | ||
| 163 | {1306, nullptr, "TryDeleteRunningApplicationCompletely"}, | ||
| 164 | {1307, nullptr, "TryDeleteRunningApplicationContentEntities"}, | ||
| 165 | {1400, nullptr, "PrepareShutdown"}, | ||
| 166 | {1500, nullptr, "FormatSdCard"}, | ||
| 167 | {1501, nullptr, "NeedsSystemUpdateToFormatSdCard"}, | ||
| 168 | {1502, nullptr, "GetLastSdCardFormatUnexpectedResult"}, | ||
| 169 | {1504, nullptr, "InsertSdCard"}, | ||
| 170 | {1505, nullptr, "RemoveSdCard"}, | ||
| 171 | {1600, nullptr, "GetSystemSeedForPseudoDeviceId"}, | ||
| 172 | {1601, nullptr, "ResetSystemSeedForPseudoDeviceId"}, | ||
| 173 | {1700, nullptr, "ListApplicationDownloadingContentMeta"}, | ||
| 174 | {1701, nullptr, "GetApplicationView"}, | ||
| 175 | {1702, nullptr, "GetApplicationDownloadTaskStatus"}, | ||
| 176 | {1703, nullptr, "GetApplicationViewDownloadErrorContext"}, | ||
| 177 | {1800, nullptr, "IsNotificationSetupCompleted"}, | ||
| 178 | {1801, nullptr, "GetLastNotificationInfoCount"}, | ||
| 179 | {1802, nullptr, "ListLastNotificationInfo"}, | ||
| 180 | {1803, nullptr, "ListNotificationTask"}, | ||
| 181 | {1900, nullptr, "IsActiveAccount"}, | ||
| 182 | {1901, nullptr, "RequestDownloadApplicationPrepurchasedRights"}, | ||
| 183 | {1902, nullptr, "GetApplicationTicketInfo"}, | ||
| 184 | {2000, nullptr, "GetSystemDeliveryInfo"}, | ||
| 185 | {2001, nullptr, "SelectLatestSystemDeliveryInfo"}, | ||
| 186 | {2002, nullptr, "VerifyDeliveryProtocolVersion"}, | ||
| 187 | {2003, nullptr, "GetApplicationDeliveryInfo"}, | ||
| 188 | {2004, nullptr, "HasAllContentsToDeliver"}, | ||
| 189 | {2005, nullptr, "CompareApplicationDeliveryInfo"}, | ||
| 190 | {2006, nullptr, "CanDeliverApplication"}, | ||
| 191 | {2007, nullptr, "ListContentMetaKeyToDeliverApplication"}, | ||
| 192 | {2008, nullptr, "NeedsSystemUpdateToDeliverApplication"}, | ||
| 193 | {2009, nullptr, "EstimateRequiredSize"}, | ||
| 194 | {2010, nullptr, "RequestReceiveApplication"}, | ||
| 195 | {2011, nullptr, "CommitReceiveApplication"}, | ||
| 196 | {2012, nullptr, "GetReceiveApplicationProgress"}, | ||
| 197 | {2013, nullptr, "RequestSendApplication"}, | ||
| 198 | {2014, nullptr, "GetSendApplicationProgress"}, | ||
| 199 | {2015, nullptr, "CompareSystemDeliveryInfo"}, | ||
| 200 | {2016, nullptr, "ListNotCommittedContentMeta"}, | ||
| 201 | {2017, nullptr, "CreateDownloadTask"}, | ||
| 202 | }; | ||
| 203 | // clang-format on | ||
| 204 | |||
| 205 | RegisterHandlers(functions); | ||
| 206 | } | ||
| 207 | }; | ||
| 208 | |||
| 209 | class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> { | ||
| 210 | public: | ||
| 211 | explicit IApplicationVersionInterface() : ServiceFramework{"IApplicationVersionInterface"} { | ||
| 212 | // clang-format off | ||
| 213 | static const FunctionInfo functions[] = { | ||
| 214 | {0, nullptr, "GetLaunchRequiredVersion"}, | ||
| 215 | {1, nullptr, "UpgradeLaunchRequiredVersion"}, | ||
| 216 | {35, nullptr, "UpdateVersionList"}, | ||
| 217 | {36, nullptr, "PushLaunchVersion"}, | ||
| 218 | {37, nullptr, "ListRequiredVersion"}, | ||
| 219 | {800, nullptr, "RequestVersionList"}, | ||
| 220 | {801, nullptr, "ListVersionList"}, | ||
| 221 | {802, nullptr, "RequestVersionListData"}, | ||
| 222 | {1000, nullptr, "PerformAutoUpdate"}, | ||
| 223 | }; | ||
| 224 | // clang-format on | ||
| 225 | |||
| 226 | RegisterHandlers(functions); | ||
| 227 | } | ||
| 228 | }; | ||
| 229 | |||
| 230 | class IContentManagerInterface final : public ServiceFramework<IContentManagerInterface> { | ||
| 231 | public: | ||
| 232 | explicit IContentManagerInterface() : ServiceFramework{"IContentManagerInterface"} { | ||
| 233 | // clang-format off | ||
| 234 | static const FunctionInfo functions[] = { | ||
| 235 | {11, nullptr, "CalculateApplicationOccupiedSize"}, | ||
| 236 | {43, nullptr, "CheckSdCardMountStatus"}, | ||
| 237 | {47, nullptr, "GetTotalSpaceSize"}, | ||
| 238 | {48, nullptr, "GetFreeSpaceSize"}, | ||
| 239 | {600, nullptr, "CountApplicationContentMeta"}, | ||
| 240 | {601, nullptr, "ListApplicationContentMetaStatus"}, | ||
| 241 | {605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"}, | ||
| 242 | {607, nullptr, "IsAnyApplicationRunning"}, | ||
| 243 | }; | ||
| 244 | // clang-format on | ||
| 245 | |||
| 246 | RegisterHandlers(functions); | ||
| 247 | } | ||
| 248 | }; | ||
| 249 | |||
| 250 | class IDocumentInterface final : public ServiceFramework<IDocumentInterface> { | ||
| 251 | public: | ||
| 252 | explicit IDocumentInterface() : ServiceFramework{"IDocumentInterface"} { | ||
| 253 | // clang-format off | ||
| 254 | static const FunctionInfo functions[] = { | ||
| 255 | {21, nullptr, "GetApplicationContentPath"}, | ||
| 256 | {23, nullptr, "ResolveApplicationContentPath"}, | ||
| 257 | }; | ||
| 258 | // clang-format on | ||
| 259 | |||
| 260 | RegisterHandlers(functions); | ||
| 261 | } | ||
| 262 | }; | ||
| 263 | |||
| 264 | class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> { | ||
| 265 | public: | ||
| 266 | explicit IDownloadTaskInterface() : ServiceFramework{"IDownloadTaskInterface"} { | ||
| 267 | // clang-format off | ||
| 268 | static const FunctionInfo functions[] = { | ||
| 269 | {701, nullptr, "ClearTaskStatusList"}, | ||
| 270 | {702, nullptr, "RequestDownloadTaskList"}, | ||
| 271 | {703, nullptr, "RequestEnsureDownloadTask"}, | ||
| 272 | {704, nullptr, "ListDownloadTaskStatus"}, | ||
| 273 | {705, nullptr, "RequestDownloadTaskListData"}, | ||
| 274 | {706, nullptr, "TryCommitCurrentApplicationDownloadTask"}, | ||
| 275 | {707, nullptr, "EnableAutoCommit"}, | ||
| 276 | {708, nullptr, "DisableAutoCommit"}, | ||
| 277 | {709, nullptr, "TriggerDynamicCommitEvent"}, | ||
| 278 | }; | ||
| 279 | // clang-format on | ||
| 280 | |||
| 281 | RegisterHandlers(functions); | ||
| 282 | } | ||
| 283 | }; | ||
| 284 | |||
| 285 | class IECommerceInterface final : public ServiceFramework<IECommerceInterface> { | ||
| 286 | public: | ||
| 287 | explicit IECommerceInterface() : ServiceFramework{"IECommerceInterface"} { | ||
| 288 | // clang-format off | ||
| 289 | static const FunctionInfo functions[] = { | ||
| 290 | {0, nullptr, "RequestLinkDevice"}, | ||
| 291 | }; | ||
| 292 | // clang-format on | ||
| 293 | |||
| 294 | RegisterHandlers(functions); | ||
| 295 | } | ||
| 296 | }; | ||
| 297 | |||
| 298 | class IFactoryResetInterface final : public ServiceFramework<IFactoryResetInterface> { | ||
| 299 | public: | ||
| 300 | explicit IFactoryResetInterface() : ServiceFramework{"IFactoryResetInterface"} { | ||
| 301 | // clang-format off | ||
| 302 | static const FunctionInfo functions[] = { | ||
| 303 | {100, nullptr, "ResetToFactorySettings"}, | ||
| 304 | {101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"}, | ||
| 305 | {102, nullptr, "ResetToFactorySettingsForRefurbishment "}, | ||
| 306 | }; | ||
| 307 | // clang-format on | ||
| 308 | |||
| 309 | RegisterHandlers(functions); | ||
| 310 | } | ||
| 311 | }; | ||
| 312 | |||
| 313 | class NS final : public ServiceFramework<NS> { | ||
| 314 | public: | ||
| 315 | explicit NS(const char* name) : ServiceFramework{name} { | ||
| 316 | // clang-format off | ||
| 317 | static const FunctionInfo functions[] = { | ||
| 318 | {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"}, | ||
| 319 | {7993, &NS::PushInterface<IApplicationVersionInterface>, "GetApplicationVersionInterface"}, | ||
| 320 | {7994, &NS::PushInterface<IFactoryResetInterface>, "GetFactoryResetInterface"}, | ||
| 321 | {7995, &NS::PushInterface<IAccountProxyInterface>, "GetAccountProxyInterface"}, | ||
| 322 | {7996, &NS::PushInterface<IApplicationManagerInterface>, "GetApplicationManagerInterface"}, | ||
| 323 | {7997, &NS::PushInterface<IDownloadTaskInterface>, "GetDownloadTaskInterface"}, | ||
| 324 | {7998, &NS::PushInterface<IContentManagerInterface>, "GetContentManagementInterface"}, | ||
| 325 | {7999, &NS::PushInterface<IDocumentInterface>, "GetDocumentInterface"}, | ||
| 326 | }; | ||
| 327 | // clang-format on | ||
| 328 | |||
| 329 | RegisterHandlers(functions); | ||
| 330 | } | ||
| 331 | |||
| 332 | private: | ||
| 333 | template <typename T> | ||
| 334 | void PushInterface(Kernel::HLERequestContext& ctx) { | ||
| 335 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 336 | rb.Push(RESULT_SUCCESS); | ||
| 337 | rb.PushIpcInterface<T>(); | ||
| 338 | |||
| 339 | LOG_DEBUG(Service_NS, "called"); | ||
| 340 | } | ||
| 341 | }; | ||
| 342 | |||
| 343 | class NS_DEV final : public ServiceFramework<NS_DEV> { | ||
| 344 | public: | ||
| 345 | explicit NS_DEV() : ServiceFramework{"ns:dev"} { | ||
| 346 | // clang-format off | ||
| 347 | static const FunctionInfo functions[] = { | ||
| 348 | {0, nullptr, "LaunchProgram"}, | ||
| 349 | {1, nullptr, "TerminateProcess"}, | ||
| 350 | {2, nullptr, "TerminateProgram"}, | ||
| 351 | {3, nullptr, "GetShellEventHandle"}, | ||
| 352 | {4, nullptr, "GetShellEventInfo"}, | ||
| 353 | {5, nullptr, "TerminateApplication"}, | ||
| 354 | {6, nullptr, "PrepareLaunchProgramFromHost"}, | ||
| 355 | {7, nullptr, "LaunchApplication"}, | ||
| 356 | {8, nullptr, "LaunchApplicationWithStorageId"}, | ||
| 357 | }; | ||
| 358 | // clang-format on | ||
| 359 | |||
| 360 | RegisterHandlers(functions); | ||
| 361 | } | ||
| 362 | }; | ||
| 363 | |||
| 364 | class ISystemUpdateControl final : public ServiceFramework<ISystemUpdateControl> { | ||
| 365 | public: | ||
| 366 | explicit ISystemUpdateControl() : ServiceFramework{"ISystemUpdateControl"} { | ||
| 367 | // clang-format off | ||
| 368 | static const FunctionInfo functions[] = { | ||
| 369 | {0, nullptr, "HasDownloaded"}, | ||
| 370 | {1, nullptr, "RequestCheckLatestUpdate"}, | ||
| 371 | {2, nullptr, "RequestDownloadLatestUpdate"}, | ||
| 372 | {3, nullptr, "GetDownloadProgress"}, | ||
| 373 | {4, nullptr, "ApplyDownloadedUpdate"}, | ||
| 374 | {5, nullptr, "RequestPrepareCardUpdate"}, | ||
| 375 | {6, nullptr, "GetPrepareCardUpdateProgress"}, | ||
| 376 | {7, nullptr, "HasPreparedCardUpdate"}, | ||
| 377 | {8, nullptr, "ApplyCardUpdate"}, | ||
| 378 | {9, nullptr, "GetDownloadedEulaDataSize"}, | ||
| 379 | {10, nullptr, "GetDownloadedEulaData"}, | ||
| 380 | {11, nullptr, "SetupCardUpdate"}, | ||
| 381 | {12, nullptr, "GetPreparedCardUpdateEulaDataSize"}, | ||
| 382 | {13, nullptr, "GetPreparedCardUpdateEulaData"}, | ||
| 383 | {14, nullptr, "SetupCardUpdateViaSystemUpdater"}, | ||
| 384 | {15, nullptr, "HasReceived"}, | ||
| 385 | {16, nullptr, "RequestReceiveSystemUpdate"}, | ||
| 386 | {17, nullptr, "GetReceiveProgress"}, | ||
| 387 | {18, nullptr, "ApplyReceivedUpdate"}, | ||
| 388 | {19, nullptr, "GetReceivedEulaDataSize"}, | ||
| 389 | {20, nullptr, "GetReceivedEulaData"}, | ||
| 390 | {21, nullptr, "SetupToReceiveSystemUpdate"}, | ||
| 391 | }; | ||
| 392 | // clang-format on | ||
| 393 | |||
| 394 | RegisterHandlers(functions); | ||
| 395 | } | ||
| 396 | }; | ||
| 397 | |||
| 398 | class NS_SU final : public ServiceFramework<NS_SU> { | ||
| 399 | public: | ||
| 400 | explicit NS_SU() : ServiceFramework{"ns:su"} { | ||
| 401 | // clang-format off | ||
| 402 | static const FunctionInfo functions[] = { | ||
| 403 | {0, nullptr, "GetBackgroundNetworkUpdateState"}, | ||
| 404 | {1, &NS_SU::OpenSystemUpdateControl, "OpenSystemUpdateControl"}, | ||
| 405 | {2, nullptr, "NotifyExFatDriverRequired"}, | ||
| 406 | {3, nullptr, "ClearExFatDriverStatusForDebug"}, | ||
| 407 | {4, nullptr, "RequestBackgroundNetworkUpdate"}, | ||
| 408 | {5, nullptr, "NotifyBackgroundNetworkUpdate"}, | ||
| 409 | {6, nullptr, "NotifyExFatDriverDownloadedForDebug"}, | ||
| 410 | {9, nullptr, "GetSystemUpdateNotificationEventForContentDelivery"}, | ||
| 411 | {10, nullptr, "NotifySystemUpdateForContentDelivery"}, | ||
| 412 | {11, nullptr, "PrepareShutdown"}, | ||
| 413 | {16, nullptr, "DestroySystemUpdateTask"}, | ||
| 414 | {17, nullptr, "RequestSendSystemUpdate"}, | ||
| 415 | {18, nullptr, "GetSendSystemUpdateProgress"}, | ||
| 416 | }; | ||
| 417 | // clang-format on | ||
| 418 | |||
| 419 | RegisterHandlers(functions); | ||
| 420 | } | ||
| 421 | |||
| 422 | private: | ||
| 423 | void OpenSystemUpdateControl(Kernel::HLERequestContext& ctx) { | ||
| 424 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 425 | rb.Push(RESULT_SUCCESS); | ||
| 426 | rb.PushIpcInterface<ISystemUpdateControl>(); | ||
| 427 | |||
| 428 | LOG_DEBUG(Service_NS, "called"); | ||
| 429 | } | ||
| 430 | }; | ||
| 431 | |||
| 432 | class NS_VM final : public ServiceFramework<NS_VM> { | ||
| 433 | public: | ||
| 434 | explicit NS_VM() : ServiceFramework{"ns:vm"} { | ||
| 435 | // clang-format off | ||
| 436 | static const FunctionInfo functions[] = { | ||
| 437 | {1200, nullptr, "NeedsUpdateVulnerability"}, | ||
| 438 | {1201, nullptr, "UpdateSafeSystemVersionForDebug"}, | ||
| 439 | {1202, nullptr, "GetSafeSystemVersion"}, | ||
| 440 | }; | ||
| 441 | // clang-format on | ||
| 442 | |||
| 443 | RegisterHandlers(functions); | ||
| 444 | } | ||
| 445 | }; | ||
| 446 | |||
| 10 | void InstallInterfaces(SM::ServiceManager& service_manager) { | 447 | void InstallInterfaces(SM::ServiceManager& service_manager) { |
| 448 | std::make_shared<NS>("ns:am2")->InstallAsService(service_manager); | ||
| 449 | std::make_shared<NS>("ns:ec")->InstallAsService(service_manager); | ||
| 450 | std::make_shared<NS>("ns:rid")->InstallAsService(service_manager); | ||
| 451 | std::make_shared<NS>("ns:rt")->InstallAsService(service_manager); | ||
| 452 | std::make_shared<NS>("ns:web")->InstallAsService(service_manager); | ||
| 453 | |||
| 454 | std::make_shared<NS_DEV>()->InstallAsService(service_manager); | ||
| 455 | std::make_shared<NS_SU>()->InstallAsService(service_manager); | ||
| 456 | std::make_shared<NS_VM>()->InstallAsService(service_manager); | ||
| 457 | |||
| 11 | std::make_shared<PL_U>()->InstallAsService(service_manager); | 458 | std::make_shared<PL_U>()->InstallAsService(service_manager); |
| 12 | } | 459 | } |
| 13 | 460 | ||
diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp index 7132b18ad..adf180509 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.cpp +++ b/src/core/hle/service/nvflinger/buffer_queue.cpp | |||
| @@ -4,9 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | 6 | ||
| 7 | #include "common/alignment.h" | 7 | #include "common/assert.h" |
| 8 | #include "common/scope_exit.h" | 8 | #include "common/logging/log.h" |
| 9 | #include "core/core_timing.h" | ||
| 10 | #include "core/hle/service/nvflinger/buffer_queue.h" | 9 | #include "core/hle/service/nvflinger/buffer_queue.h" |
| 11 | 10 | ||
| 12 | namespace Service { | 11 | namespace Service { |
diff --git a/src/core/hle/service/psc/psc.cpp b/src/core/hle/service/psc/psc.cpp new file mode 100644 index 000000000..bbad870a2 --- /dev/null +++ b/src/core/hle/service/psc/psc.cpp | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <memory> | ||
| 6 | |||
| 7 | #include "common/logging/log.h" | ||
| 8 | #include "core/hle/ipc_helpers.h" | ||
| 9 | #include "core/hle/service/psc/psc.h" | ||
| 10 | #include "core/hle/service/service.h" | ||
| 11 | #include "core/hle/service/sm/sm.h" | ||
| 12 | |||
| 13 | namespace Service::PSC { | ||
| 14 | |||
| 15 | class PSC_C final : public ServiceFramework<PSC_C> { | ||
| 16 | public: | ||
| 17 | explicit PSC_C() : ServiceFramework{"psc:c"} { | ||
| 18 | // clang-format off | ||
| 19 | static const FunctionInfo functions[] = { | ||
| 20 | {0, nullptr, "Unknown1"}, | ||
| 21 | {1, nullptr, "Unknown2"}, | ||
| 22 | {2, nullptr, "Unknown3"}, | ||
| 23 | {3, nullptr, "Unknown4"}, | ||
| 24 | {4, nullptr, "Unknown5"}, | ||
| 25 | {5, nullptr, "Unknown6"}, | ||
| 26 | {6, nullptr, "Unknown7"}, | ||
| 27 | }; | ||
| 28 | // clang-format on | ||
| 29 | |||
| 30 | RegisterHandlers(functions); | ||
| 31 | } | ||
| 32 | }; | ||
| 33 | |||
| 34 | class IPmModule final : public ServiceFramework<IPmModule> { | ||
| 35 | public: | ||
| 36 | explicit IPmModule() : ServiceFramework{"IPmModule"} { | ||
| 37 | // clang-format off | ||
| 38 | static const FunctionInfo functions[] = { | ||
| 39 | {0, nullptr, "Initialize"}, | ||
| 40 | {1, nullptr, "GetRequest"}, | ||
| 41 | {2, nullptr, "Acknowledge"}, | ||
| 42 | {3, nullptr, "Unknown1"}, | ||
| 43 | }; | ||
| 44 | // clang-format on | ||
| 45 | |||
| 46 | RegisterHandlers(functions); | ||
| 47 | } | ||
| 48 | }; | ||
| 49 | |||
| 50 | class PSC_M final : public ServiceFramework<PSC_M> { | ||
| 51 | public: | ||
| 52 | explicit PSC_M() : ServiceFramework{"psc:m"} { | ||
| 53 | // clang-format off | ||
| 54 | static const FunctionInfo functions[] = { | ||
| 55 | {0, &PSC_M::GetPmModule, "GetPmModule"}, | ||
| 56 | }; | ||
| 57 | // clang-format on | ||
| 58 | |||
| 59 | RegisterHandlers(functions); | ||
| 60 | } | ||
| 61 | |||
| 62 | private: | ||
| 63 | void GetPmModule(Kernel::HLERequestContext& ctx) { | ||
| 64 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 65 | rb.Push(RESULT_SUCCESS); | ||
| 66 | rb.PushIpcInterface<IPmModule>(); | ||
| 67 | |||
| 68 | LOG_DEBUG(Service_PSC, "called"); | ||
| 69 | } | ||
| 70 | }; | ||
| 71 | |||
| 72 | void InstallInterfaces(SM::ServiceManager& sm) { | ||
| 73 | std::make_shared<PSC_C>()->InstallAsService(sm); | ||
| 74 | std::make_shared<PSC_M>()->InstallAsService(sm); | ||
| 75 | } | ||
| 76 | |||
| 77 | } // namespace Service::PSC | ||
diff --git a/src/core/hle/service/psc/psc.h b/src/core/hle/service/psc/psc.h new file mode 100644 index 000000000..5052eb02c --- /dev/null +++ b/src/core/hle/service/psc/psc.h | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | namespace Service::SM { | ||
| 8 | class ServiceManager; | ||
| 9 | } | ||
| 10 | |||
| 11 | namespace Service::PSC { | ||
| 12 | |||
| 13 | void InstallInterfaces(SM::ServiceManager& sm); | ||
| 14 | |||
| 15 | } // namespace Service::PSC | ||
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 828666e9b..025f0c696 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -52,6 +52,7 @@ | |||
| 52 | #include "core/hle/service/pcv/pcv.h" | 52 | #include "core/hle/service/pcv/pcv.h" |
| 53 | #include "core/hle/service/pm/pm.h" | 53 | #include "core/hle/service/pm/pm.h" |
| 54 | #include "core/hle/service/prepo/prepo.h" | 54 | #include "core/hle/service/prepo/prepo.h" |
| 55 | #include "core/hle/service/psc/psc.h" | ||
| 55 | #include "core/hle/service/service.h" | 56 | #include "core/hle/service/service.h" |
| 56 | #include "core/hle/service/set/settings.h" | 57 | #include "core/hle/service/set/settings.h" |
| 57 | #include "core/hle/service/sm/controller.h" | 58 | #include "core/hle/service/sm/controller.h" |
| @@ -238,6 +239,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) { | |||
| 238 | PCV::InstallInterfaces(*sm); | 239 | PCV::InstallInterfaces(*sm); |
| 239 | PlayReport::InstallInterfaces(*sm); | 240 | PlayReport::InstallInterfaces(*sm); |
| 240 | PM::InstallInterfaces(*sm); | 241 | PM::InstallInterfaces(*sm); |
| 242 | PSC::InstallInterfaces(*sm); | ||
| 241 | Set::InstallInterfaces(*sm); | 243 | Set::InstallInterfaces(*sm); |
| 242 | Sockets::InstallInterfaces(*sm); | 244 | Sockets::InstallInterfaces(*sm); |
| 243 | SPL::InstallInterfaces(*sm); | 245 | SPL::InstallInterfaces(*sm); |
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 180f22703..046c5e18d 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h | |||
| @@ -8,10 +8,9 @@ | |||
| 8 | #include <string> | 8 | #include <string> |
| 9 | #include <unordered_map> | 9 | #include <unordered_map> |
| 10 | #include <boost/container/flat_map.hpp> | 10 | #include <boost/container/flat_map.hpp> |
| 11 | #include "common/bit_field.h" | ||
| 12 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 13 | #include "core/hle/kernel/hle_ipc.h" | 12 | #include "core/hle/kernel/hle_ipc.h" |
| 14 | #include "core/hle/kernel/kernel.h" | 13 | #include "core/hle/kernel/object.h" |
| 15 | 14 | ||
| 16 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 15 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 17 | // Namespace Service | 16 | // Namespace Service |
diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h index e2a00e4f6..e8ea62f08 100644 --- a/src/core/hle/service/sm/sm.h +++ b/src/core/hle/service/sm/sm.h | |||
| @@ -4,9 +4,11 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | ||
| 7 | #include <string> | 8 | #include <string> |
| 8 | #include <unordered_map> | 9 | #include <unordered_map> |
| 9 | #include "core/hle/kernel/kernel.h" | 10 | |
| 11 | #include "core/hle/kernel/object.h" | ||
| 10 | #include "core/hle/result.h" | 12 | #include "core/hle/result.h" |
| 11 | #include "core/hle/service/service.h" | 13 | #include "core/hle/service/service.h" |
| 12 | 14 | ||
| @@ -19,6 +21,8 @@ class SessionRequestHandler; | |||
| 19 | 21 | ||
| 20 | namespace Service::SM { | 22 | namespace Service::SM { |
| 21 | 23 | ||
| 24 | class Controller; | ||
| 25 | |||
| 22 | /// Interface to "sm:" service | 26 | /// Interface to "sm:" service |
| 23 | class SM final : public ServiceFramework<SM> { | 27 | class SM final : public ServiceFramework<SM> { |
| 24 | public: | 28 | public: |
| @@ -32,8 +36,6 @@ private: | |||
| 32 | std::shared_ptr<ServiceManager> service_manager; | 36 | std::shared_ptr<ServiceManager> service_manager; |
| 33 | }; | 37 | }; |
| 34 | 38 | ||
| 35 | class Controller; | ||
| 36 | |||
| 37 | constexpr ResultCode ERR_SERVICE_NOT_REGISTERED(-1); | 39 | constexpr ResultCode ERR_SERVICE_NOT_REGISTERED(-1); |
| 38 | constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(-1); | 40 | constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(-1); |
| 39 | constexpr ResultCode ERR_INVALID_NAME_SIZE(-1); | 41 | constexpr ResultCode ERR_INVALID_NAME_SIZE(-1); |
diff --git a/src/core/hw/aes/ccm.cpp b/src/core/hw/aes/ccm.cpp deleted file mode 100644 index 1ee37aaa4..000000000 --- a/src/core/hw/aes/ccm.cpp +++ /dev/null | |||
| @@ -1,28 +0,0 @@ | |||
| 1 | // Copyright 2017 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <algorithm> | ||
| 6 | #include "common/alignment.h" | ||
| 7 | #include "common/assert.h" | ||
| 8 | #include "common/logging/log.h" | ||
| 9 | #include "core/hw/aes/ccm.h" | ||
| 10 | #include "core/hw/aes/key.h" | ||
| 11 | |||
| 12 | namespace HW { | ||
| 13 | namespace AES { | ||
| 14 | |||
| 15 | std::vector<u8> EncryptSignCCM(const std::vector<u8>& pdata, const CCMNonce& nonce, | ||
| 16 | size_t slot_id) { | ||
| 17 | UNIMPLEMENTED(); | ||
| 18 | return {}; | ||
| 19 | } | ||
| 20 | |||
| 21 | std::vector<u8> DecryptVerifyCCM(const std::vector<u8>& cipher, const CCMNonce& nonce, | ||
| 22 | size_t slot_id) { | ||
| 23 | UNIMPLEMENTED(); | ||
| 24 | return {}; | ||
| 25 | } | ||
| 26 | |||
| 27 | } // namespace AES | ||
| 28 | } // namespace HW | ||
diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp deleted file mode 100644 index 2f48068c1..000000000 --- a/src/core/hw/hw.cpp +++ /dev/null | |||
| @@ -1,96 +0,0 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/common_types.h" | ||
| 6 | #include "common/logging/log.h" | ||
| 7 | #include "core/hw/hw.h" | ||
| 8 | #include "core/hw/lcd.h" | ||
| 9 | |||
| 10 | namespace HW { | ||
| 11 | |||
| 12 | template <typename T> | ||
| 13 | inline void Read(T& var, const u32 addr) { | ||
| 14 | switch (addr & 0xFFFFF000) { | ||
| 15 | case VADDR_GPU: | ||
| 16 | case VADDR_GPU + 0x1000: | ||
| 17 | case VADDR_GPU + 0x2000: | ||
| 18 | case VADDR_GPU + 0x3000: | ||
| 19 | case VADDR_GPU + 0x4000: | ||
| 20 | case VADDR_GPU + 0x5000: | ||
| 21 | case VADDR_GPU + 0x6000: | ||
| 22 | case VADDR_GPU + 0x7000: | ||
| 23 | case VADDR_GPU + 0x8000: | ||
| 24 | case VADDR_GPU + 0x9000: | ||
| 25 | case VADDR_GPU + 0xA000: | ||
| 26 | case VADDR_GPU + 0xB000: | ||
| 27 | case VADDR_GPU + 0xC000: | ||
| 28 | case VADDR_GPU + 0xD000: | ||
| 29 | case VADDR_GPU + 0xE000: | ||
| 30 | case VADDR_GPU + 0xF000: | ||
| 31 | break; | ||
| 32 | case VADDR_LCD: | ||
| 33 | LCD::Read(var, addr); | ||
| 34 | break; | ||
| 35 | default: | ||
| 36 | LOG_ERROR(HW_Memory, "Unknown Read{} @ 0x{:08X}", sizeof(var) * 8, addr); | ||
| 37 | break; | ||
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 | template <typename T> | ||
| 42 | inline void Write(u32 addr, const T data) { | ||
| 43 | switch (addr & 0xFFFFF000) { | ||
| 44 | case VADDR_GPU: | ||
| 45 | case VADDR_GPU + 0x1000: | ||
| 46 | case VADDR_GPU + 0x2000: | ||
| 47 | case VADDR_GPU + 0x3000: | ||
| 48 | case VADDR_GPU + 0x4000: | ||
| 49 | case VADDR_GPU + 0x5000: | ||
| 50 | case VADDR_GPU + 0x6000: | ||
| 51 | case VADDR_GPU + 0x7000: | ||
| 52 | case VADDR_GPU + 0x8000: | ||
| 53 | case VADDR_GPU + 0x9000: | ||
| 54 | case VADDR_GPU + 0xA000: | ||
| 55 | case VADDR_GPU + 0xB000: | ||
| 56 | case VADDR_GPU + 0xC000: | ||
| 57 | case VADDR_GPU + 0xD000: | ||
| 58 | case VADDR_GPU + 0xE000: | ||
| 59 | case VADDR_GPU + 0xF000: | ||
| 60 | break; | ||
| 61 | case VADDR_LCD: | ||
| 62 | LCD::Write(addr, data); | ||
| 63 | break; | ||
| 64 | default: | ||
| 65 | LOG_ERROR(HW_Memory, "Unknown Write{} 0x{:08X} @ 0x{:08X}", sizeof(data) * 8, data, addr); | ||
| 66 | break; | ||
| 67 | } | ||
| 68 | } | ||
| 69 | |||
| 70 | // Explicitly instantiate template functions because we aren't defining this in the header: | ||
| 71 | |||
| 72 | template void Read<u64>(u64& var, const u32 addr); | ||
| 73 | template void Read<u32>(u32& var, const u32 addr); | ||
| 74 | template void Read<u16>(u16& var, const u32 addr); | ||
| 75 | template void Read<u8>(u8& var, const u32 addr); | ||
| 76 | |||
| 77 | template void Write<u64>(u32 addr, const u64 data); | ||
| 78 | template void Write<u32>(u32 addr, const u32 data); | ||
| 79 | template void Write<u16>(u32 addr, const u16 data); | ||
| 80 | template void Write<u8>(u32 addr, const u8 data); | ||
| 81 | |||
| 82 | /// Update hardware | ||
| 83 | void Update() {} | ||
| 84 | |||
| 85 | /// Initialize hardware | ||
| 86 | void Init() { | ||
| 87 | LCD::Init(); | ||
| 88 | LOG_DEBUG(HW, "Initialized OK"); | ||
| 89 | } | ||
| 90 | |||
| 91 | /// Shutdown hardware | ||
| 92 | void Shutdown() { | ||
| 93 | LCD::Shutdown(); | ||
| 94 | LOG_DEBUG(HW, "Shutdown OK"); | ||
| 95 | } | ||
| 96 | } // namespace HW | ||
diff --git a/src/core/hw/hw.h b/src/core/hw/hw.h deleted file mode 100644 index 5890d2b5c..000000000 --- a/src/core/hw/hw.h +++ /dev/null | |||
| @@ -1,50 +0,0 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "common/common_types.h" | ||
| 8 | |||
| 9 | namespace HW { | ||
| 10 | |||
| 11 | /// Beginnings of IO register regions, in the user VA space. | ||
| 12 | enum : u32 { | ||
| 13 | VADDR_HASH = 0x1EC01000, | ||
| 14 | VADDR_CSND = 0x1EC03000, | ||
| 15 | VADDR_DSP = 0x1EC40000, | ||
| 16 | VADDR_PDN = 0x1EC41000, | ||
| 17 | VADDR_CODEC = 0x1EC41000, | ||
| 18 | VADDR_SPI = 0x1EC42000, | ||
| 19 | VADDR_SPI_2 = 0x1EC43000, // Only used under TWL_FIRM? | ||
| 20 | VADDR_I2C = 0x1EC44000, | ||
| 21 | VADDR_CODEC_2 = 0x1EC45000, | ||
| 22 | VADDR_HID = 0x1EC46000, | ||
| 23 | VADDR_GPIO = 0x1EC47000, | ||
| 24 | VADDR_I2C_2 = 0x1EC48000, | ||
| 25 | VADDR_SPI_3 = 0x1EC60000, | ||
| 26 | VADDR_I2C_3 = 0x1EC61000, | ||
| 27 | VADDR_MIC = 0x1EC62000, | ||
| 28 | VADDR_PXI = 0x1EC63000, | ||
| 29 | VADDR_LCD = 0x1ED02000, | ||
| 30 | VADDR_DSP_2 = 0x1ED03000, | ||
| 31 | VADDR_HASH_2 = 0x1EE01000, | ||
| 32 | VADDR_GPU = 0x1EF00000, | ||
| 33 | }; | ||
| 34 | |||
| 35 | template <typename T> | ||
| 36 | void Read(T& var, const u32 addr); | ||
| 37 | |||
| 38 | template <typename T> | ||
| 39 | void Write(u32 addr, const T data); | ||
| 40 | |||
| 41 | /// Update hardware | ||
| 42 | void Update(); | ||
| 43 | |||
| 44 | /// Initialize hardware | ||
| 45 | void Init(); | ||
| 46 | |||
| 47 | /// Shutdown hardware | ||
| 48 | void Shutdown(); | ||
| 49 | |||
| 50 | } // namespace HW | ||
diff --git a/src/core/hw/lcd.cpp b/src/core/hw/lcd.cpp deleted file mode 100644 index 0b62174d5..000000000 --- a/src/core/hw/lcd.cpp +++ /dev/null | |||
| @@ -1,67 +0,0 @@ | |||
| 1 | // Copyright 2015 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <cstring> | ||
| 6 | #include "common/common_types.h" | ||
| 7 | #include "common/logging/log.h" | ||
| 8 | #include "core/hw/hw.h" | ||
| 9 | #include "core/hw/lcd.h" | ||
| 10 | #include "core/tracer/recorder.h" | ||
| 11 | |||
| 12 | namespace LCD { | ||
| 13 | |||
| 14 | Regs g_regs; | ||
| 15 | |||
| 16 | template <typename T> | ||
| 17 | inline void Read(T& var, const u32 raw_addr) { | ||
| 18 | u32 addr = raw_addr - HW::VADDR_LCD; | ||
| 19 | u32 index = addr / 4; | ||
| 20 | |||
| 21 | // Reads other than u32 are untested, so I'd rather have them abort than silently fail | ||
| 22 | if (index >= 0x400 || !std::is_same<T, u32>::value) { | ||
| 23 | LOG_ERROR(HW_LCD, "Unknown Read{} @ 0x{:08X}", sizeof(var) * 8, addr); | ||
| 24 | return; | ||
| 25 | } | ||
| 26 | |||
| 27 | var = g_regs[index]; | ||
| 28 | } | ||
| 29 | |||
| 30 | template <typename T> | ||
| 31 | inline void Write(u32 addr, const T data) { | ||
| 32 | addr -= HW::VADDR_LCD; | ||
| 33 | u32 index = addr / 4; | ||
| 34 | |||
| 35 | // Writes other than u32 are untested, so I'd rather have them abort than silently fail | ||
| 36 | if (index >= 0x400 || !std::is_same<T, u32>::value) { | ||
| 37 | LOG_ERROR(HW_LCD, "Unknown Write{} 0x{:08X} @ 0x{:08X}", sizeof(data) * 8, data, addr); | ||
| 38 | return; | ||
| 39 | } | ||
| 40 | |||
| 41 | g_regs[index] = static_cast<u32>(data); | ||
| 42 | } | ||
| 43 | |||
| 44 | // Explicitly instantiate template functions because we aren't defining this in the header: | ||
| 45 | |||
| 46 | template void Read<u64>(u64& var, const u32 addr); | ||
| 47 | template void Read<u32>(u32& var, const u32 addr); | ||
| 48 | template void Read<u16>(u16& var, const u32 addr); | ||
| 49 | template void Read<u8>(u8& var, const u32 addr); | ||
| 50 | |||
| 51 | template void Write<u64>(u32 addr, const u64 data); | ||
| 52 | template void Write<u32>(u32 addr, const u32 data); | ||
| 53 | template void Write<u16>(u32 addr, const u16 data); | ||
| 54 | template void Write<u8>(u32 addr, const u8 data); | ||
| 55 | |||
| 56 | /// Initialize hardware | ||
| 57 | void Init() { | ||
| 58 | memset(&g_regs, 0, sizeof(g_regs)); | ||
| 59 | LOG_DEBUG(HW_LCD, "Initialized OK"); | ||
| 60 | } | ||
| 61 | |||
| 62 | /// Shutdown hardware | ||
| 63 | void Shutdown() { | ||
| 64 | LOG_DEBUG(HW_LCD, "Shutdown OK"); | ||
| 65 | } | ||
| 66 | |||
| 67 | } // namespace LCD | ||
diff --git a/src/core/hw/lcd.h b/src/core/hw/lcd.h deleted file mode 100644 index d2db9700f..000000000 --- a/src/core/hw/lcd.h +++ /dev/null | |||
| @@ -1,86 +0,0 @@ | |||
| 1 | // Copyright 2015 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <cstddef> | ||
| 8 | #include <type_traits> | ||
| 9 | #include "common/bit_field.h" | ||
| 10 | #include "common/common_funcs.h" | ||
| 11 | #include "common/common_types.h" | ||
| 12 | |||
| 13 | #define LCD_REG_INDEX(field_name) (offsetof(LCD::Regs, field_name) / sizeof(u32)) | ||
| 14 | |||
| 15 | namespace LCD { | ||
| 16 | |||
| 17 | struct Regs { | ||
| 18 | |||
| 19 | union ColorFill { | ||
| 20 | u32 raw; | ||
| 21 | |||
| 22 | BitField<0, 8, u32> color_r; | ||
| 23 | BitField<8, 8, u32> color_g; | ||
| 24 | BitField<16, 8, u32> color_b; | ||
| 25 | BitField<24, 1, u32> is_enabled; | ||
| 26 | }; | ||
| 27 | |||
| 28 | INSERT_PADDING_WORDS(0x81); | ||
| 29 | ColorFill color_fill_top; | ||
| 30 | INSERT_PADDING_WORDS(0xE); | ||
| 31 | u32 backlight_top; | ||
| 32 | |||
| 33 | INSERT_PADDING_WORDS(0x1F0); | ||
| 34 | |||
| 35 | ColorFill color_fill_bottom; | ||
| 36 | INSERT_PADDING_WORDS(0xE); | ||
| 37 | u32 backlight_bottom; | ||
| 38 | INSERT_PADDING_WORDS(0x16F); | ||
| 39 | |||
| 40 | static constexpr size_t NumIds() { | ||
| 41 | return sizeof(Regs) / sizeof(u32); | ||
| 42 | } | ||
| 43 | |||
| 44 | const u32& operator[](int index) const { | ||
| 45 | const u32* content = reinterpret_cast<const u32*>(this); | ||
| 46 | return content[index]; | ||
| 47 | } | ||
| 48 | |||
| 49 | u32& operator[](int index) { | ||
| 50 | u32* content = reinterpret_cast<u32*>(this); | ||
| 51 | return content[index]; | ||
| 52 | } | ||
| 53 | }; | ||
| 54 | static_assert(std::is_standard_layout<Regs>::value, "Structure does not use standard layout"); | ||
| 55 | |||
| 56 | // TODO: MSVC does not support using offsetof() on non-static data members even though this | ||
| 57 | // is technically allowed since C++11. This macro should be enabled once MSVC adds | ||
| 58 | // support for that. | ||
| 59 | #ifndef _MSC_VER | ||
| 60 | #define ASSERT_REG_POSITION(field_name, position) \ | ||
| 61 | static_assert(offsetof(Regs, field_name) == position * 4, \ | ||
| 62 | "Field " #field_name " has invalid position") | ||
| 63 | |||
| 64 | ASSERT_REG_POSITION(color_fill_top, 0x81); | ||
| 65 | ASSERT_REG_POSITION(backlight_top, 0x90); | ||
| 66 | ASSERT_REG_POSITION(color_fill_bottom, 0x281); | ||
| 67 | ASSERT_REG_POSITION(backlight_bottom, 0x290); | ||
| 68 | |||
| 69 | #undef ASSERT_REG_POSITION | ||
| 70 | #endif // !defined(_MSC_VER) | ||
| 71 | |||
| 72 | extern Regs g_regs; | ||
| 73 | |||
| 74 | template <typename T> | ||
| 75 | void Read(T& var, const u32 addr); | ||
| 76 | |||
| 77 | template <typename T> | ||
| 78 | void Write(u32 addr, const T data); | ||
| 79 | |||
| 80 | /// Initialize hardware | ||
| 81 | void Init(); | ||
| 82 | |||
| 83 | /// Shutdown hardware | ||
| 84 | void Shutdown(); | ||
| 85 | |||
| 86 | } // namespace LCD | ||
diff --git a/src/core/loader/deconstructed_rom_directory.h b/src/core/loader/deconstructed_rom_directory.h index 982a037f7..7319ba6ea 100644 --- a/src/core/loader/deconstructed_rom_directory.h +++ b/src/core/loader/deconstructed_rom_directory.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include <string> | 7 | #include <string> |
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "core/file_sys/program_metadata.h" | 9 | #include "core/file_sys/program_metadata.h" |
| 10 | #include "core/hle/kernel/kernel.h" | 10 | #include "core/hle/kernel/object.h" |
| 11 | #include "core/loader/loader.h" | 11 | #include "core/loader/loader.h" |
| 12 | 12 | ||
| 13 | namespace Loader { | 13 | namespace Loader { |
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index fbf11e5d0..3ca6bcf8b 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #include "common/common_types.h" | 14 | #include "common/common_types.h" |
| 15 | #include "common/file_util.h" | 15 | #include "common/file_util.h" |
| 16 | #include "core/file_sys/vfs.h" | 16 | #include "core/file_sys/vfs.h" |
| 17 | #include "core/hle/kernel/kernel.h" | 17 | #include "core/hle/kernel/object.h" |
| 18 | 18 | ||
| 19 | namespace Kernel { | 19 | namespace Kernel { |
| 20 | struct AddressMapping; | 20 | struct AddressMapping; |
diff --git a/src/core/loader/nca.h b/src/core/loader/nca.h index 52c95953a..2edd81cb9 100644 --- a/src/core/loader/nca.h +++ b/src/core/loader/nca.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "core/file_sys/content_archive.h" | 9 | #include "core/file_sys/content_archive.h" |
| 10 | #include "core/file_sys/program_metadata.h" | 10 | #include "core/file_sys/program_metadata.h" |
| 11 | #include "core/hle/kernel/kernel.h" | 11 | #include "core/hle/kernel/object.h" |
| 12 | #include "core/loader/loader.h" | 12 | #include "core/loader/loader.h" |
| 13 | 13 | ||
| 14 | namespace Loader { | 14 | namespace Loader { |
diff --git a/src/core/loader/nro.h b/src/core/loader/nro.h index 04a0f497e..bb01c9e25 100644 --- a/src/core/loader/nro.h +++ b/src/core/loader/nro.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include <string> | 7 | #include <string> |
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "core/hle/kernel/kernel.h" | 9 | #include "core/hle/kernel/object.h" |
| 10 | #include "core/loader/linker.h" | 10 | #include "core/loader/linker.h" |
| 11 | #include "core/loader/loader.h" | 11 | #include "core/loader/loader.h" |
| 12 | 12 | ||
diff --git a/src/core/loader/nso.h b/src/core/loader/nso.h index 3f7567500..aaeb1f2a9 100644 --- a/src/core/loader/nso.h +++ b/src/core/loader/nso.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include <string> | 7 | #include <string> |
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "core/hle/kernel/kernel.h" | 9 | #include "core/hle/kernel/object.h" |
| 10 | #include "core/loader/linker.h" | 10 | #include "core/loader/linker.h" |
| 11 | #include "core/loader/loader.h" | 11 | #include "core/loader/loader.h" |
| 12 | 12 | ||
diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 444bcc387..79e0b347b 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp | |||
| @@ -5,10 +5,9 @@ | |||
| 5 | #include "core/gdbstub/gdbstub.h" | 5 | #include "core/gdbstub/gdbstub.h" |
| 6 | #include "core/hle/service/hid/hid.h" | 6 | #include "core/hle/service/hid/hid.h" |
| 7 | #include "core/settings.h" | 7 | #include "core/settings.h" |
| 8 | #include "video_core/renderer_base.h" | ||
| 8 | #include "video_core/video_core.h" | 9 | #include "video_core/video_core.h" |
| 9 | 10 | ||
| 10 | #include "core/frontend/emu_window.h" | ||
| 11 | |||
| 12 | namespace Settings { | 11 | namespace Settings { |
| 13 | 12 | ||
| 14 | Values values = {}; | 13 | Values values = {}; |
| @@ -20,9 +19,8 @@ void Apply() { | |||
| 20 | 19 | ||
| 21 | VideoCore::g_toggle_framelimit_enabled = values.toggle_framelimit; | 20 | VideoCore::g_toggle_framelimit_enabled = values.toggle_framelimit; |
| 22 | 21 | ||
| 23 | if (VideoCore::g_emu_window) { | 22 | if (VideoCore::g_renderer) { |
| 24 | auto layout = VideoCore::g_emu_window->GetFramebufferLayout(); | 23 | VideoCore::g_renderer->UpdateCurrentFramebufferLayout(); |
| 25 | VideoCore::g_emu_window->UpdateCurrentFramebufferLayout(layout.width, layout.height); | ||
| 26 | } | 24 | } |
| 27 | 25 | ||
| 28 | Service::HID::ReloadInputDevices(); | 26 | Service::HID::ReloadInputDevices(); |
diff --git a/src/input_common/keyboard.cpp b/src/input_common/keyboard.cpp index 0f0d10f23..525fe6abc 100644 --- a/src/input_common/keyboard.cpp +++ b/src/input_common/keyboard.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <atomic> | 5 | #include <atomic> |
| 6 | #include <list> | 6 | #include <list> |
| 7 | #include <mutex> | 7 | #include <mutex> |
| 8 | #include <utility> | ||
| 8 | #include "input_common/keyboard.h" | 9 | #include "input_common/keyboard.h" |
| 9 | 10 | ||
| 10 | namespace InputCommon { | 11 | namespace InputCommon { |
| @@ -12,9 +13,9 @@ namespace InputCommon { | |||
| 12 | class KeyButton final : public Input::ButtonDevice { | 13 | class KeyButton final : public Input::ButtonDevice { |
| 13 | public: | 14 | public: |
| 14 | explicit KeyButton(std::shared_ptr<KeyButtonList> key_button_list_) | 15 | explicit KeyButton(std::shared_ptr<KeyButtonList> key_button_list_) |
| 15 | : key_button_list(key_button_list_) {} | 16 | : key_button_list(std::move(key_button_list_)) {} |
| 16 | 17 | ||
| 17 | ~KeyButton(); | 18 | ~KeyButton() override; |
| 18 | 19 | ||
| 19 | bool GetStatus() const override { | 20 | bool GetStatus() const override { |
| 20 | return status.load(); | 21 | return status.load(); |
diff --git a/src/input_common/motion_emu.cpp b/src/input_common/motion_emu.cpp index caffe48cb..9570c060e 100644 --- a/src/input_common/motion_emu.cpp +++ b/src/input_common/motion_emu.cpp | |||
| @@ -131,7 +131,7 @@ public: | |||
| 131 | device = std::make_shared<MotionEmuDevice>(update_millisecond, sensitivity); | 131 | device = std::make_shared<MotionEmuDevice>(update_millisecond, sensitivity); |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | std::tuple<Math::Vec3<float>, Math::Vec3<float>> GetStatus() const { | 134 | std::tuple<Math::Vec3<float>, Math::Vec3<float>> GetStatus() const override { |
| 135 | return device->GetStatus(); | 135 | return device->GetStatus(); |
| 136 | } | 136 | } |
| 137 | 137 | ||
diff --git a/src/input_common/sdl/sdl.cpp b/src/input_common/sdl/sdl.cpp index 8d117c2d4..d1b960fd7 100644 --- a/src/input_common/sdl/sdl.cpp +++ b/src/input_common/sdl/sdl.cpp | |||
| @@ -82,7 +82,7 @@ private: | |||
| 82 | class SDLButton final : public Input::ButtonDevice { | 82 | class SDLButton final : public Input::ButtonDevice { |
| 83 | public: | 83 | public: |
| 84 | explicit SDLButton(std::shared_ptr<SDLJoystick> joystick_, int button_) | 84 | explicit SDLButton(std::shared_ptr<SDLJoystick> joystick_, int button_) |
| 85 | : joystick(joystick_), button(button_) {} | 85 | : joystick(std::move(joystick_)), button(button_) {} |
| 86 | 86 | ||
| 87 | bool GetStatus() const override { | 87 | bool GetStatus() const override { |
| 88 | return joystick->GetButton(button); | 88 | return joystick->GetButton(button); |
| @@ -96,7 +96,7 @@ private: | |||
| 96 | class SDLDirectionButton final : public Input::ButtonDevice { | 96 | class SDLDirectionButton final : public Input::ButtonDevice { |
| 97 | public: | 97 | public: |
| 98 | explicit SDLDirectionButton(std::shared_ptr<SDLJoystick> joystick_, int hat_, Uint8 direction_) | 98 | explicit SDLDirectionButton(std::shared_ptr<SDLJoystick> joystick_, int hat_, Uint8 direction_) |
| 99 | : joystick(joystick_), hat(hat_), direction(direction_) {} | 99 | : joystick(std::move(joystick_)), hat(hat_), direction(direction_) {} |
| 100 | 100 | ||
| 101 | bool GetStatus() const override { | 101 | bool GetStatus() const override { |
| 102 | return joystick->GetHatDirection(hat, direction); | 102 | return joystick->GetHatDirection(hat, direction); |
| @@ -112,7 +112,7 @@ class SDLAxisButton final : public Input::ButtonDevice { | |||
| 112 | public: | 112 | public: |
| 113 | explicit SDLAxisButton(std::shared_ptr<SDLJoystick> joystick_, int axis_, float threshold_, | 113 | explicit SDLAxisButton(std::shared_ptr<SDLJoystick> joystick_, int axis_, float threshold_, |
| 114 | bool trigger_if_greater_) | 114 | bool trigger_if_greater_) |
| 115 | : joystick(joystick_), axis(axis_), threshold(threshold_), | 115 | : joystick(std::move(joystick_)), axis(axis_), threshold(threshold_), |
| 116 | trigger_if_greater(trigger_if_greater_) {} | 116 | trigger_if_greater(trigger_if_greater_) {} |
| 117 | 117 | ||
| 118 | bool GetStatus() const override { | 118 | bool GetStatus() const override { |
| @@ -132,7 +132,7 @@ private: | |||
| 132 | class SDLAnalog final : public Input::AnalogDevice { | 132 | class SDLAnalog final : public Input::AnalogDevice { |
| 133 | public: | 133 | public: |
| 134 | SDLAnalog(std::shared_ptr<SDLJoystick> joystick_, int axis_x_, int axis_y_) | 134 | SDLAnalog(std::shared_ptr<SDLJoystick> joystick_, int axis_x_, int axis_y_) |
| 135 | : joystick(joystick_), axis_x(axis_x_), axis_y(axis_y_) {} | 135 | : joystick(std::move(joystick_)), axis_x(axis_x_), axis_y(axis_y_) {} |
| 136 | 136 | ||
| 137 | std::tuple<float, float> GetStatus() const override { | 137 | std::tuple<float, float> GetStatus() const override { |
| 138 | return joystick->GetAnalog(axis_x, axis_y); | 138 | return joystick->GetAnalog(axis_x, axis_y); |
| @@ -314,10 +314,6 @@ namespace Polling { | |||
| 314 | 314 | ||
| 315 | class SDLPoller : public InputCommon::Polling::DevicePoller { | 315 | class SDLPoller : public InputCommon::Polling::DevicePoller { |
| 316 | public: | 316 | public: |
| 317 | SDLPoller() = default; | ||
| 318 | |||
| 319 | ~SDLPoller() = default; | ||
| 320 | |||
| 321 | void Start() override { | 317 | void Start() override { |
| 322 | // SDL joysticks must be opened, otherwise they don't generate events | 318 | // SDL joysticks must be opened, otherwise they don't generate events |
| 323 | SDL_JoystickUpdate(); | 319 | SDL_JoystickUpdate(); |
| @@ -341,10 +337,6 @@ private: | |||
| 341 | 337 | ||
| 342 | class SDLButtonPoller final : public SDLPoller { | 338 | class SDLButtonPoller final : public SDLPoller { |
| 343 | public: | 339 | public: |
| 344 | SDLButtonPoller() = default; | ||
| 345 | |||
| 346 | ~SDLButtonPoller() = default; | ||
| 347 | |||
| 348 | Common::ParamPackage GetNextInput() override { | 340 | Common::ParamPackage GetNextInput() override { |
| 349 | SDL_Event event; | 341 | SDL_Event event; |
| 350 | while (SDL_PollEvent(&event)) { | 342 | while (SDL_PollEvent(&event)) { |
| @@ -364,10 +356,6 @@ public: | |||
| 364 | 356 | ||
| 365 | class SDLAnalogPoller final : public SDLPoller { | 357 | class SDLAnalogPoller final : public SDLPoller { |
| 366 | public: | 358 | public: |
| 367 | SDLAnalogPoller() = default; | ||
| 368 | |||
| 369 | ~SDLAnalogPoller() = default; | ||
| 370 | |||
| 371 | void Start() override { | 359 | void Start() override { |
| 372 | SDLPoller::Start(); | 360 | SDLPoller::Start(); |
| 373 | 361 | ||
diff --git a/src/video_core/renderer_base.cpp b/src/video_core/renderer_base.cpp index 30075b23c..dbe3edf09 100644 --- a/src/video_core/renderer_base.cpp +++ b/src/video_core/renderer_base.cpp | |||
| @@ -2,14 +2,22 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <atomic> | ||
| 6 | #include <memory> | 5 | #include <memory> |
| 6 | #include "core/frontend/emu_window.h" | ||
| 7 | #include "video_core/renderer_base.h" | 7 | #include "video_core/renderer_base.h" |
| 8 | #include "video_core/renderer_opengl/gl_rasterizer.h" | 8 | #include "video_core/renderer_opengl/gl_rasterizer.h" |
| 9 | #include "video_core/video_core.h" | 9 | |
| 10 | RendererBase::RendererBase(EmuWindow& window) : render_window{window} {} | ||
| 11 | RendererBase::~RendererBase() = default; | ||
| 12 | |||
| 13 | void RendererBase::UpdateCurrentFramebufferLayout() { | ||
| 14 | const Layout::FramebufferLayout& layout = render_window.GetFramebufferLayout(); | ||
| 15 | |||
| 16 | render_window.UpdateCurrentFramebufferLayout(layout.width, layout.height); | ||
| 17 | } | ||
| 10 | 18 | ||
| 11 | void RendererBase::RefreshRasterizerSetting() { | 19 | void RendererBase::RefreshRasterizerSetting() { |
| 12 | if (rasterizer == nullptr) { | 20 | if (rasterizer == nullptr) { |
| 13 | rasterizer = std::make_unique<RasterizerOpenGL>(); | 21 | rasterizer = std::make_unique<RasterizerOpenGL>(render_window); |
| 14 | } | 22 | } |
| 15 | } | 23 | } |
diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h index 89a960eaf..1cb161b7f 100644 --- a/src/video_core/renderer_base.h +++ b/src/video_core/renderer_base.h | |||
| @@ -18,23 +18,21 @@ public: | |||
| 18 | /// Used to reference a framebuffer | 18 | /// Used to reference a framebuffer |
| 19 | enum kFramebuffer { kFramebuffer_VirtualXFB = 0, kFramebuffer_EFB, kFramebuffer_Texture }; | 19 | enum kFramebuffer { kFramebuffer_VirtualXFB = 0, kFramebuffer_EFB, kFramebuffer_Texture }; |
| 20 | 20 | ||
| 21 | virtual ~RendererBase() {} | 21 | explicit RendererBase(EmuWindow& window); |
| 22 | virtual ~RendererBase(); | ||
| 22 | 23 | ||
| 23 | /// Swap buffers (render frame) | 24 | /// Swap buffers (render frame) |
| 24 | virtual void SwapBuffers(boost::optional<const Tegra::FramebufferConfig&> framebuffer) = 0; | 25 | virtual void SwapBuffers(boost::optional<const Tegra::FramebufferConfig&> framebuffer) = 0; |
| 25 | 26 | ||
| 26 | /** | ||
| 27 | * Set the emulator window to use for renderer | ||
| 28 | * @param window EmuWindow handle to emulator window to use for rendering | ||
| 29 | */ | ||
| 30 | virtual void SetWindow(EmuWindow* window) = 0; | ||
| 31 | |||
| 32 | /// Initialize the renderer | 27 | /// Initialize the renderer |
| 33 | virtual bool Init() = 0; | 28 | virtual bool Init() = 0; |
| 34 | 29 | ||
| 35 | /// Shutdown the renderer | 30 | /// Shutdown the renderer |
| 36 | virtual void ShutDown() = 0; | 31 | virtual void ShutDown() = 0; |
| 37 | 32 | ||
| 33 | /// Updates the framebuffer layout of the contained render window handle. | ||
| 34 | void UpdateCurrentFramebufferLayout(); | ||
| 35 | |||
| 38 | // Getter/setter functions: | 36 | // Getter/setter functions: |
| 39 | // ------------------------ | 37 | // ------------------------ |
| 40 | 38 | ||
| @@ -53,9 +51,8 @@ public: | |||
| 53 | void RefreshRasterizerSetting(); | 51 | void RefreshRasterizerSetting(); |
| 54 | 52 | ||
| 55 | protected: | 53 | protected: |
| 54 | EmuWindow& render_window; ///< Reference to the render window handle. | ||
| 56 | std::unique_ptr<VideoCore::RasterizerInterface> rasterizer; | 55 | std::unique_ptr<VideoCore::RasterizerInterface> rasterizer; |
| 57 | f32 m_current_fps = 0.0f; ///< Current framerate, should be set by the renderer | 56 | f32 m_current_fps = 0.0f; ///< Current framerate, should be set by the renderer |
| 58 | int m_current_frame = 0; ///< Current frame, should be set by the renderer | 57 | int m_current_frame = 0; ///< Current frame, should be set by the renderer |
| 59 | |||
| 60 | private: | ||
| 61 | }; | 58 | }; |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index a1c47bae9..6555db5bb 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | #include "common/logging/log.h" | 14 | #include "common/logging/log.h" |
| 15 | #include "common/math_util.h" | 15 | #include "common/math_util.h" |
| 16 | #include "common/microprofile.h" | 16 | #include "common/microprofile.h" |
| 17 | #include "common/scope_exit.h" | ||
| 18 | #include "core/core.h" | 17 | #include "core/core.h" |
| 19 | #include "core/frontend/emu_window.h" | 18 | #include "core/frontend/emu_window.h" |
| 20 | #include "core/hle/kernel/process.h" | 19 | #include "core/hle/kernel/process.h" |
| @@ -37,7 +36,7 @@ MICROPROFILE_DEFINE(OpenGL_Drawing, "OpenGL", "Drawing", MP_RGB(128, 128, 192)); | |||
| 37 | MICROPROFILE_DEFINE(OpenGL_Blits, "OpenGL", "Blits", MP_RGB(100, 100, 255)); | 36 | MICROPROFILE_DEFINE(OpenGL_Blits, "OpenGL", "Blits", MP_RGB(100, 100, 255)); |
| 38 | MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Mgmt", MP_RGB(100, 255, 100)); | 37 | MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Mgmt", MP_RGB(100, 255, 100)); |
| 39 | 38 | ||
| 40 | RasterizerOpenGL::RasterizerOpenGL() { | 39 | RasterizerOpenGL::RasterizerOpenGL(EmuWindow& window) : emu_window{window} { |
| 41 | // Create sampler objects | 40 | // Create sampler objects |
| 42 | for (size_t i = 0; i < texture_samplers.size(); ++i) { | 41 | for (size_t i = 0; i < texture_samplers.size(); ++i) { |
| 43 | texture_samplers[i].Create(); | 42 | texture_samplers[i].Create(); |
| @@ -395,7 +394,7 @@ void RasterizerOpenGL::Clear() { | |||
| 395 | if (clear_mask == 0) | 394 | if (clear_mask == 0) |
| 396 | return; | 395 | return; |
| 397 | 396 | ||
| 398 | ScopeAcquireGLContext acquire_context; | 397 | ScopeAcquireGLContext acquire_context{emu_window}; |
| 399 | 398 | ||
| 400 | auto [dirty_color_surface, dirty_depth_surface] = | 399 | auto [dirty_color_surface, dirty_depth_surface] = |
| 401 | ConfigureFramebuffers(use_color_fb, use_depth_fb); | 400 | ConfigureFramebuffers(use_color_fb, use_depth_fb); |
| @@ -425,7 +424,7 @@ void RasterizerOpenGL::DrawArrays() { | |||
| 425 | MICROPROFILE_SCOPE(OpenGL_Drawing); | 424 | MICROPROFILE_SCOPE(OpenGL_Drawing); |
| 426 | const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; | 425 | const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; |
| 427 | 426 | ||
| 428 | ScopeAcquireGLContext acquire_context; | 427 | ScopeAcquireGLContext acquire_context{emu_window}; |
| 429 | 428 | ||
| 430 | auto [dirty_color_surface, dirty_depth_surface] = | 429 | auto [dirty_color_surface, dirty_depth_surface] = |
| 431 | ConfigureFramebuffers(true, regs.zeta.Address() != 0 && regs.zeta_enable != 0); | 430 | ConfigureFramebuffers(true, regs.zeta.Address() != 0 && regs.zeta_enable != 0); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index e150be58f..6d6d85cc1 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h | |||
| @@ -21,11 +21,12 @@ | |||
| 21 | #include "video_core/renderer_opengl/gl_state.h" | 21 | #include "video_core/renderer_opengl/gl_state.h" |
| 22 | #include "video_core/renderer_opengl/gl_stream_buffer.h" | 22 | #include "video_core/renderer_opengl/gl_stream_buffer.h" |
| 23 | 23 | ||
| 24 | class EmuWindow; | ||
| 24 | struct ScreenInfo; | 25 | struct ScreenInfo; |
| 25 | 26 | ||
| 26 | class RasterizerOpenGL : public VideoCore::RasterizerInterface { | 27 | class RasterizerOpenGL : public VideoCore::RasterizerInterface { |
| 27 | public: | 28 | public: |
| 28 | RasterizerOpenGL(); | 29 | explicit RasterizerOpenGL(EmuWindow& renderer); |
| 29 | ~RasterizerOpenGL() override; | 30 | ~RasterizerOpenGL() override; |
| 30 | 31 | ||
| 31 | void DrawArrays() override; | 32 | void DrawArrays() override; |
| @@ -144,6 +145,8 @@ private: | |||
| 144 | 145 | ||
| 145 | RasterizerCacheOpenGL res_cache; | 146 | RasterizerCacheOpenGL res_cache; |
| 146 | 147 | ||
| 148 | EmuWindow& emu_window; | ||
| 149 | |||
| 147 | std::unique_ptr<GLShader::ProgramManager> shader_program_manager; | 150 | std::unique_ptr<GLShader::ProgramManager> shader_program_manager; |
| 148 | OGLVertexArray sw_vao; | 151 | OGLVertexArray sw_vao; |
| 149 | OGLVertexArray hw_vao; | 152 | OGLVertexArray hw_vao; |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index a4d9707cb..c8f0c4e28 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -118,6 +118,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 118 | {GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, ComponentType::UInt, false}, // RG16UI | 118 | {GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, ComponentType::UInt, false}, // RG16UI |
| 119 | {GL_RG16I, GL_RG_INTEGER, GL_SHORT, ComponentType::SInt, false}, // RG16I | 119 | {GL_RG16I, GL_RG_INTEGER, GL_SHORT, ComponentType::SInt, false}, // RG16I |
| 120 | {GL_RG16_SNORM, GL_RG, GL_SHORT, ComponentType::SNorm, false}, // RG16S | 120 | {GL_RG16_SNORM, GL_RG, GL_SHORT, ComponentType::SNorm, false}, // RG16S |
| 121 | {GL_RGB32F, GL_RGB, GL_FLOAT, ComponentType::Float, false}, // RGB32F | ||
| 121 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8 | 122 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8 |
| 122 | 123 | ||
| 123 | // DepthStencil formats | 124 | // DepthStencil formats |
| @@ -218,9 +219,10 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 218 | MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::RG16>, | 219 | MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::RG16>, |
| 219 | MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>, | 220 | MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>, |
| 220 | MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>, | 221 | MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>, |
| 221 | MortonCopy<true, PixelFormat::SRGBA8>, MortonCopy<true, PixelFormat::Z24S8>, | 222 | MortonCopy<true, PixelFormat::RGB32F>, MortonCopy<true, PixelFormat::SRGBA8>, |
| 222 | MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, | 223 | MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, |
| 223 | MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>, | 224 | MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>, |
| 225 | MortonCopy<true, PixelFormat::Z32FS8>, | ||
| 224 | }; | 226 | }; |
| 225 | 227 | ||
| 226 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | 228 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), |
| @@ -253,6 +255,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 253 | MortonCopy<false, PixelFormat::RG16UI>, | 255 | MortonCopy<false, PixelFormat::RG16UI>, |
| 254 | MortonCopy<false, PixelFormat::RG16I>, | 256 | MortonCopy<false, PixelFormat::RG16I>, |
| 255 | MortonCopy<false, PixelFormat::RG16S>, | 257 | MortonCopy<false, PixelFormat::RG16S>, |
| 258 | MortonCopy<false, PixelFormat::RGB32F>, | ||
| 256 | MortonCopy<false, PixelFormat::SRGBA8>, | 259 | MortonCopy<false, PixelFormat::SRGBA8>, |
| 257 | MortonCopy<false, PixelFormat::Z24S8>, | 260 | MortonCopy<false, PixelFormat::Z24S8>, |
| 258 | MortonCopy<false, PixelFormat::S8Z24>, | 261 | MortonCopy<false, PixelFormat::S8Z24>, |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index b73dc2b06..4e1e18d9c 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -48,16 +48,17 @@ struct SurfaceParams { | |||
| 48 | RG16UI = 23, | 48 | RG16UI = 23, |
| 49 | RG16I = 24, | 49 | RG16I = 24, |
| 50 | RG16S = 25, | 50 | RG16S = 25, |
| 51 | SRGBA8 = 26, | 51 | RGB32F = 26, |
| 52 | SRGBA8 = 27, | ||
| 52 | 53 | ||
| 53 | MaxColorFormat, | 54 | MaxColorFormat, |
| 54 | 55 | ||
| 55 | // DepthStencil formats | 56 | // DepthStencil formats |
| 56 | Z24S8 = 27, | 57 | Z24S8 = 28, |
| 57 | S8Z24 = 28, | 58 | S8Z24 = 29, |
| 58 | Z32F = 29, | 59 | Z32F = 30, |
| 59 | Z16 = 30, | 60 | Z16 = 31, |
| 60 | Z32FS8 = 31, | 61 | Z32FS8 = 32, |
| 61 | 62 | ||
| 62 | MaxDepthStencilFormat, | 63 | MaxDepthStencilFormat, |
| 63 | 64 | ||
| @@ -121,6 +122,7 @@ struct SurfaceParams { | |||
| 121 | 1, // RG16UI | 122 | 1, // RG16UI |
| 122 | 1, // RG16I | 123 | 1, // RG16I |
| 123 | 1, // RG16S | 124 | 1, // RG16S |
| 125 | 1, // RGB32F | ||
| 124 | 1, // SRGBA8 | 126 | 1, // SRGBA8 |
| 125 | 1, // Z24S8 | 127 | 1, // Z24S8 |
| 126 | 1, // S8Z24 | 128 | 1, // S8Z24 |
| @@ -164,6 +166,7 @@ struct SurfaceParams { | |||
| 164 | 32, // RG16UI | 166 | 32, // RG16UI |
| 165 | 32, // RG16I | 167 | 32, // RG16I |
| 166 | 32, // RG16S | 168 | 32, // RG16S |
| 169 | 96, // RGB32F | ||
| 167 | 32, // SRGBA8 | 170 | 32, // SRGBA8 |
| 168 | 32, // Z24S8 | 171 | 32, // Z24S8 |
| 169 | 32, // S8Z24 | 172 | 32, // S8Z24 |
| @@ -272,6 +275,8 @@ struct SurfaceParams { | |||
| 272 | UNREACHABLE(); | 275 | UNREACHABLE(); |
| 273 | case Tegra::Texture::TextureFormat::R32_G32: | 276 | case Tegra::Texture::TextureFormat::R32_G32: |
| 274 | return PixelFormat::RG32F; | 277 | return PixelFormat::RG32F; |
| 278 | case Tegra::Texture::TextureFormat::R32_G32_B32: | ||
| 279 | return PixelFormat::RGB32F; | ||
| 275 | case Tegra::Texture::TextureFormat::R16: | 280 | case Tegra::Texture::TextureFormat::R16: |
| 276 | switch (component_type) { | 281 | switch (component_type) { |
| 277 | case Tegra::Texture::ComponentType::FLOAT: | 282 | case Tegra::Texture::ComponentType::FLOAT: |
| @@ -363,6 +368,8 @@ struct SurfaceParams { | |||
| 363 | return Tegra::Texture::TextureFormat::A8R8G8B8; | 368 | return Tegra::Texture::TextureFormat::A8R8G8B8; |
| 364 | case PixelFormat::RGBA32F: | 369 | case PixelFormat::RGBA32F: |
| 365 | return Tegra::Texture::TextureFormat::R32_G32_B32_A32; | 370 | return Tegra::Texture::TextureFormat::R32_G32_B32_A32; |
| 371 | case PixelFormat::RGB32F: | ||
| 372 | return Tegra::Texture::TextureFormat::R32_G32_B32; | ||
| 366 | case PixelFormat::RG32F: | 373 | case PixelFormat::RG32F: |
| 367 | return Tegra::Texture::TextureFormat::R32_G32; | 374 | return Tegra::Texture::TextureFormat::R32_G32; |
| 368 | case PixelFormat::R32F: | 375 | case PixelFormat::R32F: |
diff --git a/src/video_core/renderer_opengl/gl_shader_manager.h b/src/video_core/renderer_opengl/gl_shader_manager.h index e29d551e1..2214c348a 100644 --- a/src/video_core/renderer_opengl/gl_shader_manager.h +++ b/src/video_core/renderer_opengl/gl_shader_manager.h | |||
| @@ -105,14 +105,14 @@ public: | |||
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | ShaderEntries UseProgrammableVertexShader(const MaxwellVSConfig& config, | 107 | ShaderEntries UseProgrammableVertexShader(const MaxwellVSConfig& config, |
| 108 | const ShaderSetup setup) { | 108 | const ShaderSetup& setup) { |
| 109 | ShaderEntries result; | 109 | ShaderEntries result; |
| 110 | std::tie(current.vs, result) = vertex_shaders.Get(config, setup); | 110 | std::tie(current.vs, result) = vertex_shaders.Get(config, setup); |
| 111 | return result; | 111 | return result; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | ShaderEntries UseProgrammableFragmentShader(const MaxwellFSConfig& config, | 114 | ShaderEntries UseProgrammableFragmentShader(const MaxwellFSConfig& config, |
| 115 | const ShaderSetup setup) { | 115 | const ShaderSetup& setup) { |
| 116 | ShaderEntries result; | 116 | ShaderEntries result; |
| 117 | std::tie(current.fs, result) = fragment_shaders.Get(config, setup); | 117 | std::tie(current.fs, result) = fragment_shaders.Get(config, setup); |
| 118 | return result; | 118 | return result; |
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index 3398d7c04..24b1d956b 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h | |||
| @@ -82,7 +82,7 @@ public: | |||
| 82 | GLenum logic_op; // GL_LOGIC_OP_MODE | 82 | GLenum logic_op; // GL_LOGIC_OP_MODE |
| 83 | 83 | ||
| 84 | // 3 texture units - one for each that is used in PICA fragment shader emulation | 84 | // 3 texture units - one for each that is used in PICA fragment shader emulation |
| 85 | struct { | 85 | struct TextureUnit { |
| 86 | GLuint texture_2d; // GL_TEXTURE_BINDING_2D | 86 | GLuint texture_2d; // GL_TEXTURE_BINDING_2D |
| 87 | GLuint sampler; // GL_SAMPLER_BINDING | 87 | GLuint sampler; // GL_SAMPLER_BINDING |
| 88 | struct { | 88 | struct { |
| @@ -104,7 +104,8 @@ public: | |||
| 104 | Unbind(); | 104 | Unbind(); |
| 105 | sampler = 0; | 105 | sampler = 0; |
| 106 | } | 106 | } |
| 107 | } texture_units[32]; | 107 | }; |
| 108 | std::array<TextureUnit, 32> texture_units; | ||
| 108 | 109 | ||
| 109 | struct { | 110 | struct { |
| 110 | GLuint read_framebuffer; // GL_READ_FRAMEBUFFER_BINDING | 111 | GLuint read_framebuffer; // GL_READ_FRAMEBUFFER_BINDING |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 7810b9147..74383c7cf 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -92,23 +92,23 @@ static std::array<GLfloat, 3 * 2> MakeOrthographicMatrix(const float width, cons | |||
| 92 | return matrix; | 92 | return matrix; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | ScopeAcquireGLContext::ScopeAcquireGLContext() { | 95 | ScopeAcquireGLContext::ScopeAcquireGLContext(EmuWindow& emu_window_) : emu_window{emu_window_} { |
| 96 | if (Settings::values.use_multi_core) { | 96 | if (Settings::values.use_multi_core) { |
| 97 | VideoCore::g_emu_window->MakeCurrent(); | 97 | emu_window.MakeCurrent(); |
| 98 | } | 98 | } |
| 99 | } | 99 | } |
| 100 | ScopeAcquireGLContext::~ScopeAcquireGLContext() { | 100 | ScopeAcquireGLContext::~ScopeAcquireGLContext() { |
| 101 | if (Settings::values.use_multi_core) { | 101 | if (Settings::values.use_multi_core) { |
| 102 | VideoCore::g_emu_window->DoneCurrent(); | 102 | emu_window.DoneCurrent(); |
| 103 | } | 103 | } |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | RendererOpenGL::RendererOpenGL() = default; | 106 | RendererOpenGL::RendererOpenGL(EmuWindow& window) : RendererBase{window} {} |
| 107 | RendererOpenGL::~RendererOpenGL() = default; | 107 | RendererOpenGL::~RendererOpenGL() = default; |
| 108 | 108 | ||
| 109 | /// Swap buffers (render frame) | 109 | /// Swap buffers (render frame) |
| 110 | void RendererOpenGL::SwapBuffers(boost::optional<const Tegra::FramebufferConfig&> framebuffer) { | 110 | void RendererOpenGL::SwapBuffers(boost::optional<const Tegra::FramebufferConfig&> framebuffer) { |
| 111 | ScopeAcquireGLContext acquire_context; | 111 | ScopeAcquireGLContext acquire_context{render_window}; |
| 112 | 112 | ||
| 113 | Core::System::GetInstance().perf_stats.EndSystemFrame(); | 113 | Core::System::GetInstance().perf_stats.EndSystemFrame(); |
| 114 | 114 | ||
| @@ -130,10 +130,10 @@ void RendererOpenGL::SwapBuffers(boost::optional<const Tegra::FramebufferConfig& | |||
| 130 | // Load the framebuffer from memory, draw it to the screen, and swap buffers | 130 | // Load the framebuffer from memory, draw it to the screen, and swap buffers |
| 131 | LoadFBToScreenInfo(*framebuffer, screen_info); | 131 | LoadFBToScreenInfo(*framebuffer, screen_info); |
| 132 | DrawScreen(); | 132 | DrawScreen(); |
| 133 | render_window->SwapBuffers(); | 133 | render_window.SwapBuffers(); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | render_window->PollEvents(); | 136 | render_window.PollEvents(); |
| 137 | 137 | ||
| 138 | Core::System::GetInstance().frame_limiter.DoFrameLimiting(CoreTiming::GetGlobalTimeUs()); | 138 | Core::System::GetInstance().frame_limiter.DoFrameLimiting(CoreTiming::GetGlobalTimeUs()); |
| 139 | Core::System::GetInstance().perf_stats.BeginSystemFrame(); | 139 | Core::System::GetInstance().perf_stats.BeginSystemFrame(); |
| @@ -356,7 +356,7 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x, | |||
| 356 | * Draws the emulated screens to the emulator window. | 356 | * Draws the emulated screens to the emulator window. |
| 357 | */ | 357 | */ |
| 358 | void RendererOpenGL::DrawScreen() { | 358 | void RendererOpenGL::DrawScreen() { |
| 359 | const auto& layout = render_window->GetFramebufferLayout(); | 359 | const auto& layout = render_window.GetFramebufferLayout(); |
| 360 | const auto& screen = layout.screen; | 360 | const auto& screen = layout.screen; |
| 361 | 361 | ||
| 362 | glViewport(0, 0, layout.width, layout.height); | 362 | glViewport(0, 0, layout.width, layout.height); |
| @@ -380,14 +380,6 @@ void RendererOpenGL::DrawScreen() { | |||
| 380 | /// Updates the framerate | 380 | /// Updates the framerate |
| 381 | void RendererOpenGL::UpdateFramerate() {} | 381 | void RendererOpenGL::UpdateFramerate() {} |
| 382 | 382 | ||
| 383 | /** | ||
| 384 | * Set the emulator window to use for renderer | ||
| 385 | * @param window EmuWindow handle to emulator window to use for rendering | ||
| 386 | */ | ||
| 387 | void RendererOpenGL::SetWindow(EmuWindow* window) { | ||
| 388 | render_window = window; | ||
| 389 | } | ||
| 390 | |||
| 391 | static const char* GetSource(GLenum source) { | 383 | static const char* GetSource(GLenum source) { |
| 392 | #define RET(s) \ | 384 | #define RET(s) \ |
| 393 | case GL_DEBUG_SOURCE_##s: \ | 385 | case GL_DEBUG_SOURCE_##s: \ |
| @@ -445,7 +437,7 @@ static void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum | |||
| 445 | 437 | ||
| 446 | /// Initialize the renderer | 438 | /// Initialize the renderer |
| 447 | bool RendererOpenGL::Init() { | 439 | bool RendererOpenGL::Init() { |
| 448 | ScopeAcquireGLContext acquire_context; | 440 | ScopeAcquireGLContext acquire_context{render_window}; |
| 449 | 441 | ||
| 450 | if (GLAD_GL_KHR_debug) { | 442 | if (GLAD_GL_KHR_debug) { |
| 451 | glEnable(GL_DEBUG_OUTPUT); | 443 | glEnable(GL_DEBUG_OUTPUT); |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index 59d92a3dc..ab7de41c8 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h | |||
| @@ -34,24 +34,21 @@ struct ScreenInfo { | |||
| 34 | /// Helper class to acquire/release OpenGL context within a given scope | 34 | /// Helper class to acquire/release OpenGL context within a given scope |
| 35 | class ScopeAcquireGLContext : NonCopyable { | 35 | class ScopeAcquireGLContext : NonCopyable { |
| 36 | public: | 36 | public: |
| 37 | ScopeAcquireGLContext(); | 37 | explicit ScopeAcquireGLContext(EmuWindow& window); |
| 38 | ~ScopeAcquireGLContext(); | 38 | ~ScopeAcquireGLContext(); |
| 39 | |||
| 40 | private: | ||
| 41 | EmuWindow& emu_window; | ||
| 39 | }; | 42 | }; |
| 40 | 43 | ||
| 41 | class RendererOpenGL : public RendererBase { | 44 | class RendererOpenGL : public RendererBase { |
| 42 | public: | 45 | public: |
| 43 | RendererOpenGL(); | 46 | explicit RendererOpenGL(EmuWindow& window); |
| 44 | ~RendererOpenGL() override; | 47 | ~RendererOpenGL() override; |
| 45 | 48 | ||
| 46 | /// Swap buffers (render frame) | 49 | /// Swap buffers (render frame) |
| 47 | void SwapBuffers(boost::optional<const Tegra::FramebufferConfig&> framebuffer) override; | 50 | void SwapBuffers(boost::optional<const Tegra::FramebufferConfig&> framebuffer) override; |
| 48 | 51 | ||
| 49 | /** | ||
| 50 | * Set the emulator window to use for renderer | ||
| 51 | * @param window EmuWindow handle to emulator window to use for rendering | ||
| 52 | */ | ||
| 53 | void SetWindow(EmuWindow* window) override; | ||
| 54 | |||
| 55 | /// Initialize the renderer | 52 | /// Initialize the renderer |
| 56 | bool Init() override; | 53 | bool Init() override; |
| 57 | 54 | ||
| @@ -72,8 +69,6 @@ private: | |||
| 72 | void LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, u8 color_a, | 69 | void LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, u8 color_a, |
| 73 | const TextureInfo& texture); | 70 | const TextureInfo& texture); |
| 74 | 71 | ||
| 75 | EmuWindow* render_window; ///< Handle to render window | ||
| 76 | |||
| 77 | OpenGLState state; | 72 | OpenGLState state; |
| 78 | 73 | ||
| 79 | // OpenGL object IDs | 74 | // OpenGL object IDs |
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index d794f8402..65db84ad3 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -57,6 +57,8 @@ u32 BytesPerPixel(TextureFormat format) { | |||
| 57 | case TextureFormat::BC7U: | 57 | case TextureFormat::BC7U: |
| 58 | // In this case a 'pixel' actually refers to a 4x4 tile. | 58 | // In this case a 'pixel' actually refers to a 4x4 tile. |
| 59 | return 16; | 59 | return 16; |
| 60 | case TextureFormat::R32_G32_B32: | ||
| 61 | return 12; | ||
| 60 | case TextureFormat::ASTC_2D_4X4: | 62 | case TextureFormat::ASTC_2D_4X4: |
| 61 | case TextureFormat::A8R8G8B8: | 63 | case TextureFormat::A8R8G8B8: |
| 62 | case TextureFormat::A2B10G10R10: | 64 | case TextureFormat::A2B10G10R10: |
| @@ -131,6 +133,7 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width, | |||
| 131 | case TextureFormat::R16_G16: | 133 | case TextureFormat::R16_G16: |
| 132 | case TextureFormat::BF10GF11RF11: | 134 | case TextureFormat::BF10GF11RF11: |
| 133 | case TextureFormat::ASTC_2D_4X4: | 135 | case TextureFormat::ASTC_2D_4X4: |
| 136 | case TextureFormat::R32_G32_B32: | ||
| 134 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, | 137 | CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, |
| 135 | unswizzled_data.data(), true, block_height); | 138 | unswizzled_data.data(), true, block_height); |
| 136 | break; | 139 | break; |
| @@ -190,6 +193,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat | |||
| 190 | case TextureFormat::R32: | 193 | case TextureFormat::R32: |
| 191 | case TextureFormat::R16: | 194 | case TextureFormat::R16: |
| 192 | case TextureFormat::R16_G16: | 195 | case TextureFormat::R16_G16: |
| 196 | case TextureFormat::R32_G32_B32: | ||
| 193 | // TODO(Subv): For the time being just forward the same data without any decoding. | 197 | // TODO(Subv): For the time being just forward the same data without any decoding. |
| 194 | rgba_data = texture_data; | 198 | rgba_data = texture_data; |
| 195 | break; | 199 | break; |
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index 289140f31..06b13e681 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp | |||
| @@ -13,16 +13,13 @@ | |||
| 13 | 13 | ||
| 14 | namespace VideoCore { | 14 | namespace VideoCore { |
| 15 | 15 | ||
| 16 | EmuWindow* g_emu_window = nullptr; ///< Frontend emulator window | ||
| 17 | std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin | 16 | std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin |
| 18 | 17 | ||
| 19 | std::atomic<bool> g_toggle_framelimit_enabled; | 18 | std::atomic<bool> g_toggle_framelimit_enabled; |
| 20 | 19 | ||
| 21 | /// Initialize the video core | 20 | /// Initialize the video core |
| 22 | bool Init(EmuWindow* emu_window) { | 21 | bool Init(EmuWindow& emu_window) { |
| 23 | g_emu_window = emu_window; | 22 | g_renderer = std::make_unique<RendererOpenGL>(emu_window); |
| 24 | g_renderer = std::make_unique<RendererOpenGL>(); | ||
| 25 | g_renderer->SetWindow(g_emu_window); | ||
| 26 | if (g_renderer->Init()) { | 23 | if (g_renderer->Init()) { |
| 27 | LOG_DEBUG(Render, "initialized OK"); | 24 | LOG_DEBUG(Render, "initialized OK"); |
| 28 | } else { | 25 | } else { |
diff --git a/src/video_core/video_core.h b/src/video_core/video_core.h index 37da62436..8707e9881 100644 --- a/src/video_core/video_core.h +++ b/src/video_core/video_core.h | |||
| @@ -18,7 +18,6 @@ namespace VideoCore { | |||
| 18 | enum class Renderer { Software, OpenGL }; | 18 | enum class Renderer { Software, OpenGL }; |
| 19 | 19 | ||
| 20 | extern std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin | 20 | extern std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin |
| 21 | extern EmuWindow* g_emu_window; ///< Emu window | ||
| 22 | 21 | ||
| 23 | // TODO: Wrap these in a user settings struct along with any other graphics settings (often set from | 22 | // TODO: Wrap these in a user settings struct along with any other graphics settings (often set from |
| 24 | // qt ui) | 23 | // qt ui) |
| @@ -28,7 +27,7 @@ extern std::atomic<bool> g_toggle_framelimit_enabled; | |||
| 28 | void Start(); | 27 | void Start(); |
| 29 | 28 | ||
| 30 | /// Initialize the video core | 29 | /// Initialize the video core |
| 31 | bool Init(EmuWindow* emu_window); | 30 | bool Init(EmuWindow& emu_window); |
| 32 | 31 | ||
| 33 | /// Shutdown the video core | 32 | /// Shutdown the video core |
| 34 | void Shutdown(); | 33 | void Shutdown(); |
diff --git a/src/yuzu/debugger/graphics/graphics_breakpoint_observer.cpp b/src/yuzu/debugger/graphics/graphics_breakpoint_observer.cpp index d6d61a739..5f459ccfb 100644 --- a/src/yuzu/debugger/graphics/graphics_breakpoint_observer.cpp +++ b/src/yuzu/debugger/graphics/graphics_breakpoint_observer.cpp | |||
| @@ -10,12 +10,12 @@ BreakPointObserverDock::BreakPointObserverDock(std::shared_ptr<Tegra::DebugConte | |||
| 10 | : QDockWidget(title, parent), BreakPointObserver(debug_context) { | 10 | : QDockWidget(title, parent), BreakPointObserver(debug_context) { |
| 11 | qRegisterMetaType<Tegra::DebugContext::Event>("Tegra::DebugContext::Event"); | 11 | qRegisterMetaType<Tegra::DebugContext::Event>("Tegra::DebugContext::Event"); |
| 12 | 12 | ||
| 13 | connect(this, SIGNAL(Resumed()), this, SLOT(OnResumed())); | 13 | connect(this, &BreakPointObserverDock::Resumed, this, &BreakPointObserverDock::OnResumed); |
| 14 | 14 | ||
| 15 | // NOTE: This signal is emitted from a non-GUI thread, but connect() takes | 15 | // NOTE: This signal is emitted from a non-GUI thread, but connect() takes |
| 16 | // care of delaying its handling to the GUI thread. | 16 | // care of delaying its handling to the GUI thread. |
| 17 | connect(this, SIGNAL(BreakPointHit(Tegra::DebugContext::Event, void*)), this, | 17 | connect(this, &BreakPointObserverDock::BreakPointHit, this, |
| 18 | SLOT(OnBreakPointHit(Tegra::DebugContext::Event, void*)), Qt::BlockingQueuedConnection); | 18 | &BreakPointObserverDock::OnBreakPointHit, Qt::BlockingQueuedConnection); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | void BreakPointObserverDock::OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) { | 21 | void BreakPointObserverDock::OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) { |
diff --git a/src/yuzu/debugger/graphics/graphics_breakpoint_observer.h b/src/yuzu/debugger/graphics/graphics_breakpoint_observer.h index 9d05493cf..ab32f0115 100644 --- a/src/yuzu/debugger/graphics/graphics_breakpoint_observer.h +++ b/src/yuzu/debugger/graphics/graphics_breakpoint_observer.h | |||
| @@ -23,11 +23,11 @@ public: | |||
| 23 | void OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) override; | 23 | void OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) override; |
| 24 | void OnMaxwellResume() override; | 24 | void OnMaxwellResume() override; |
| 25 | 25 | ||
| 26 | private slots: | ||
| 27 | virtual void OnBreakPointHit(Tegra::DebugContext::Event event, void* data) = 0; | ||
| 28 | virtual void OnResumed() = 0; | ||
| 29 | |||
| 30 | signals: | 26 | signals: |
| 31 | void Resumed(); | 27 | void Resumed(); |
| 32 | void BreakPointHit(Tegra::DebugContext::Event event, void* data); | 28 | void BreakPointHit(Tegra::DebugContext::Event event, void* data); |
| 29 | |||
| 30 | private: | ||
| 31 | virtual void OnBreakPointHit(Tegra::DebugContext::Event event, void* data) = 0; | ||
| 32 | virtual void OnResumed() = 0; | ||
| 33 | }; | 33 | }; |
diff --git a/src/yuzu/debugger/graphics/graphics_breakpoints.cpp b/src/yuzu/debugger/graphics/graphics_breakpoints.cpp index f98cc8152..eb16a38a0 100644 --- a/src/yuzu/debugger/graphics/graphics_breakpoints.cpp +++ b/src/yuzu/debugger/graphics/graphics_breakpoints.cpp | |||
| @@ -144,21 +144,25 @@ GraphicsBreakPointsWidget::GraphicsBreakPointsWidget( | |||
| 144 | 144 | ||
| 145 | qRegisterMetaType<Tegra::DebugContext::Event>("Tegra::DebugContext::Event"); | 145 | qRegisterMetaType<Tegra::DebugContext::Event>("Tegra::DebugContext::Event"); |
| 146 | 146 | ||
| 147 | connect(breakpoint_list, SIGNAL(doubleClicked(const QModelIndex&)), this, | 147 | connect(breakpoint_list, &QTreeView::doubleClicked, this, |
| 148 | SLOT(OnItemDoubleClicked(const QModelIndex&))); | 148 | &GraphicsBreakPointsWidget::OnItemDoubleClicked); |
| 149 | 149 | ||
| 150 | connect(resume_button, SIGNAL(clicked()), this, SLOT(OnResumeRequested())); | 150 | connect(resume_button, &QPushButton::clicked, this, |
| 151 | &GraphicsBreakPointsWidget::OnResumeRequested); | ||
| 151 | 152 | ||
| 152 | connect(this, SIGNAL(BreakPointHit(Tegra::DebugContext::Event, void*)), this, | 153 | connect(this, &GraphicsBreakPointsWidget::BreakPointHit, this, |
| 153 | SLOT(OnBreakPointHit(Tegra::DebugContext::Event, void*)), Qt::BlockingQueuedConnection); | 154 | &GraphicsBreakPointsWidget::OnBreakPointHit, Qt::BlockingQueuedConnection); |
| 154 | connect(this, SIGNAL(Resumed()), this, SLOT(OnResumed())); | 155 | connect(this, &GraphicsBreakPointsWidget::Resumed, this, &GraphicsBreakPointsWidget::OnResumed); |
| 155 | 156 | ||
| 156 | connect(this, SIGNAL(BreakPointHit(Tegra::DebugContext::Event, void*)), breakpoint_model, | 157 | connect(this, &GraphicsBreakPointsWidget::BreakPointHit, breakpoint_model, |
| 157 | SLOT(OnBreakPointHit(Tegra::DebugContext::Event)), Qt::BlockingQueuedConnection); | 158 | &BreakPointModel::OnBreakPointHit, Qt::BlockingQueuedConnection); |
| 158 | connect(this, SIGNAL(Resumed()), breakpoint_model, SLOT(OnResumed())); | 159 | connect(this, &GraphicsBreakPointsWidget::Resumed, breakpoint_model, |
| 160 | &BreakPointModel::OnResumed); | ||
| 159 | 161 | ||
| 160 | connect(this, SIGNAL(BreakPointsChanged(const QModelIndex&, const QModelIndex&)), | 162 | connect(this, &GraphicsBreakPointsWidget::BreakPointsChanged, |
| 161 | breakpoint_model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&))); | 163 | [this](const QModelIndex& top_left, const QModelIndex& bottom_right) { |
| 164 | breakpoint_model->dataChanged(top_left, bottom_right); | ||
| 165 | }); | ||
| 162 | 166 | ||
| 163 | QWidget* main_widget = new QWidget; | 167 | QWidget* main_widget = new QWidget; |
| 164 | auto main_layout = new QVBoxLayout; | 168 | auto main_layout = new QVBoxLayout; |
diff --git a/src/yuzu/debugger/graphics/graphics_breakpoints.h b/src/yuzu/debugger/graphics/graphics_breakpoints.h index ae0ede2e8..a920a2ae5 100644 --- a/src/yuzu/debugger/graphics/graphics_breakpoints.h +++ b/src/yuzu/debugger/graphics/graphics_breakpoints.h | |||
| @@ -26,18 +26,17 @@ public: | |||
| 26 | void OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) override; | 26 | void OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) override; |
| 27 | void OnMaxwellResume() override; | 27 | void OnMaxwellResume() override; |
| 28 | 28 | ||
| 29 | public slots: | ||
| 30 | void OnBreakPointHit(Tegra::DebugContext::Event event, void* data); | ||
| 31 | void OnItemDoubleClicked(const QModelIndex&); | ||
| 32 | void OnResumeRequested(); | ||
| 33 | void OnResumed(); | ||
| 34 | |||
| 35 | signals: | 29 | signals: |
| 36 | void Resumed(); | 30 | void Resumed(); |
| 37 | void BreakPointHit(Tegra::DebugContext::Event event, void* data); | 31 | void BreakPointHit(Tegra::DebugContext::Event event, void* data); |
| 38 | void BreakPointsChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight); | 32 | void BreakPointsChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight); |
| 39 | 33 | ||
| 40 | private: | 34 | private: |
| 35 | void OnBreakPointHit(Tegra::DebugContext::Event event, void* data); | ||
| 36 | void OnItemDoubleClicked(const QModelIndex&); | ||
| 37 | void OnResumeRequested(); | ||
| 38 | void OnResumed(); | ||
| 39 | |||
| 41 | QLabel* status_text; | 40 | QLabel* status_text; |
| 42 | QPushButton* resume_button; | 41 | QPushButton* resume_button; |
| 43 | 42 | ||
diff --git a/src/yuzu/debugger/graphics/graphics_breakpoints_p.h b/src/yuzu/debugger/graphics/graphics_breakpoints_p.h index 35a6876ae..7112b87e6 100644 --- a/src/yuzu/debugger/graphics/graphics_breakpoints_p.h +++ b/src/yuzu/debugger/graphics/graphics_breakpoints_p.h | |||
| @@ -25,7 +25,6 @@ public: | |||
| 25 | 25 | ||
| 26 | bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; | 26 | bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; |
| 27 | 27 | ||
| 28 | public slots: | ||
| 29 | void OnBreakPointHit(Tegra::DebugContext::Event event); | 28 | void OnBreakPointHit(Tegra::DebugContext::Event event); |
| 30 | void OnResumed(); | 29 | void OnResumed(); |
| 31 | 30 | ||
diff --git a/src/yuzu/debugger/graphics/graphics_surface.cpp b/src/yuzu/debugger/graphics/graphics_surface.cpp index c41ff693b..ff3efcdaa 100644 --- a/src/yuzu/debugger/graphics/graphics_surface.cpp +++ b/src/yuzu/debugger/graphics/graphics_surface.cpp | |||
| @@ -153,22 +153,24 @@ GraphicsSurfaceWidget::GraphicsSurfaceWidget(std::shared_ptr<Tegra::DebugContext | |||
| 153 | save_surface = new QPushButton(QIcon::fromTheme("document-save"), tr("Save")); | 153 | save_surface = new QPushButton(QIcon::fromTheme("document-save"), tr("Save")); |
| 154 | 154 | ||
| 155 | // Connections | 155 | // Connections |
| 156 | connect(this, SIGNAL(Update()), this, SLOT(OnUpdate())); | 156 | connect(this, &GraphicsSurfaceWidget::Update, this, &GraphicsSurfaceWidget::OnUpdate); |
| 157 | connect(surface_source_list, SIGNAL(currentIndexChanged(int)), this, | 157 | connect(surface_source_list, |
| 158 | SLOT(OnSurfaceSourceChanged(int))); | 158 | static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, |
| 159 | connect(surface_address_control, SIGNAL(ValueChanged(qint64)), this, | 159 | &GraphicsSurfaceWidget::OnSurfaceSourceChanged); |
| 160 | SLOT(OnSurfaceAddressChanged(qint64))); | 160 | connect(surface_address_control, &CSpinBox::ValueChanged, this, |
| 161 | connect(surface_width_control, SIGNAL(valueChanged(int)), this, | 161 | &GraphicsSurfaceWidget::OnSurfaceAddressChanged); |
| 162 | SLOT(OnSurfaceWidthChanged(int))); | 162 | connect(surface_width_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), |
| 163 | connect(surface_height_control, SIGNAL(valueChanged(int)), this, | 163 | this, &GraphicsSurfaceWidget::OnSurfaceWidthChanged); |
| 164 | SLOT(OnSurfaceHeightChanged(int))); | 164 | connect(surface_height_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), |
| 165 | connect(surface_format_control, SIGNAL(currentIndexChanged(int)), this, | 165 | this, &GraphicsSurfaceWidget::OnSurfaceHeightChanged); |
| 166 | SLOT(OnSurfaceFormatChanged(int))); | 166 | connect(surface_format_control, |
| 167 | connect(surface_picker_x_control, SIGNAL(valueChanged(int)), this, | 167 | static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, |
| 168 | SLOT(OnSurfacePickerXChanged(int))); | 168 | &GraphicsSurfaceWidget::OnSurfaceFormatChanged); |
| 169 | connect(surface_picker_y_control, SIGNAL(valueChanged(int)), this, | 169 | connect(surface_picker_x_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), |
| 170 | SLOT(OnSurfacePickerYChanged(int))); | 170 | this, &GraphicsSurfaceWidget::OnSurfacePickerXChanged); |
| 171 | connect(save_surface, SIGNAL(clicked()), this, SLOT(SaveSurface())); | 171 | connect(surface_picker_y_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), |
| 172 | this, &GraphicsSurfaceWidget::OnSurfacePickerYChanged); | ||
| 173 | connect(save_surface, &QPushButton::clicked, this, &GraphicsSurfaceWidget::SaveSurface); | ||
| 172 | 174 | ||
| 173 | auto main_widget = new QWidget; | 175 | auto main_widget = new QWidget; |
| 174 | auto main_layout = new QVBoxLayout; | 176 | auto main_layout = new QVBoxLayout; |
diff --git a/src/yuzu/debugger/graphics/graphics_surface.h b/src/yuzu/debugger/graphics/graphics_surface.h index 6a344bdfc..58f9db465 100644 --- a/src/yuzu/debugger/graphics/graphics_surface.h +++ b/src/yuzu/debugger/graphics/graphics_surface.h | |||
| @@ -65,16 +65,15 @@ public slots: | |||
| 65 | void OnSurfacePickerYChanged(int new_value); | 65 | void OnSurfacePickerYChanged(int new_value); |
| 66 | void OnUpdate(); | 66 | void OnUpdate(); |
| 67 | 67 | ||
| 68 | private slots: | 68 | signals: |
| 69 | void Update(); | ||
| 70 | |||
| 71 | private: | ||
| 69 | void OnBreakPointHit(Tegra::DebugContext::Event event, void* data) override; | 72 | void OnBreakPointHit(Tegra::DebugContext::Event event, void* data) override; |
| 70 | void OnResumed() override; | 73 | void OnResumed() override; |
| 71 | 74 | ||
| 72 | void SaveSurface(); | 75 | void SaveSurface(); |
| 73 | 76 | ||
| 74 | signals: | ||
| 75 | void Update(); | ||
| 76 | |||
| 77 | private: | ||
| 78 | QComboBox* surface_source_list; | 77 | QComboBox* surface_source_list; |
| 79 | CSpinBox* surface_address_control; | 78 | CSpinBox* surface_address_control; |
| 80 | QSpinBox* surface_width_control; | 79 | QSpinBox* surface_width_control; |
diff --git a/src/yuzu/debugger/wait_tree.h b/src/yuzu/debugger/wait_tree.h index 10fc9e968..6cbce6856 100644 --- a/src/yuzu/debugger/wait_tree.h +++ b/src/yuzu/debugger/wait_tree.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include <QTreeView> | 9 | #include <QTreeView> |
| 10 | #include <boost/container/flat_set.hpp> | 10 | #include <boost/container/flat_set.hpp> |
| 11 | #include "core/core.h" | 11 | #include "core/core.h" |
| 12 | #include "core/hle/kernel/kernel.h" | 12 | #include "core/hle/kernel/object.h" |
| 13 | 13 | ||
| 14 | class EmuThread; | 14 | class EmuThread; |
| 15 | 15 | ||
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index be38cfa9b..341867f7b 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -402,7 +402,7 @@ bool GMainWindow::LoadROM(const QString& filename) { | |||
| 402 | 402 | ||
| 403 | system.SetGPUDebugContext(debug_context); | 403 | system.SetGPUDebugContext(debug_context); |
| 404 | 404 | ||
| 405 | const Core::System::ResultStatus result{system.Load(render_window, filename.toStdString())}; | 405 | const Core::System::ResultStatus result{system.Load(*render_window, filename.toStdString())}; |
| 406 | 406 | ||
| 407 | render_window->DoneCurrent(); | 407 | render_window->DoneCurrent(); |
| 408 | 408 | ||
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index b5392c499..5ff6266bf 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp | |||
| @@ -162,7 +162,7 @@ int main(int argc, char** argv) { | |||
| 162 | 162 | ||
| 163 | SCOPE_EXIT({ system.Shutdown(); }); | 163 | SCOPE_EXIT({ system.Shutdown(); }); |
| 164 | 164 | ||
| 165 | const Core::System::ResultStatus load_result{system.Load(emu_window.get(), filepath)}; | 165 | const Core::System::ResultStatus load_result{system.Load(*emu_window, filepath)}; |
| 166 | 166 | ||
| 167 | switch (load_result) { | 167 | switch (load_result) { |
| 168 | case Core::System::ResultStatus::ErrorGetLoader: | 168 | case Core::System::ResultStatus::ErrorGetLoader: |