diff options
Diffstat (limited to 'src')
40 files changed, 517 insertions, 147 deletions
diff --git a/src/common/fiber.cpp b/src/common/fiber.cpp index 39532ff58..62010d762 100644 --- a/src/common/fiber.cpp +++ b/src/common/fiber.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | namespace Common { | 12 | namespace Common { |
| 13 | 13 | ||
| 14 | constexpr std::size_t default_stack_size = 256 * 1024; | 14 | constexpr std::size_t default_stack_size = 512 * 1024; |
| 15 | 15 | ||
| 16 | struct Fiber::FiberImpl { | 16 | struct Fiber::FiberImpl { |
| 17 | FiberImpl() : stack{default_stack_size}, rewind_stack{default_stack_size} {} | 17 | FiberImpl() : stack{default_stack_size}, rewind_stack{default_stack_size} {} |
diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp index ec4407b6e..53d78de32 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp | |||
| @@ -306,13 +306,18 @@ void ARM_Dynarmic_32::ClearExclusiveState() { | |||
| 306 | 306 | ||
| 307 | void ARM_Dynarmic_32::PageTableChanged(Common::PageTable& page_table, | 307 | void ARM_Dynarmic_32::PageTableChanged(Common::PageTable& page_table, |
| 308 | std::size_t new_address_space_size_in_bits) { | 308 | std::size_t new_address_space_size_in_bits) { |
| 309 | ThreadContext32 ctx{}; | ||
| 310 | SaveContext(ctx); | ||
| 311 | |||
| 309 | auto key = std::make_pair(&page_table, new_address_space_size_in_bits); | 312 | auto key = std::make_pair(&page_table, new_address_space_size_in_bits); |
| 310 | auto iter = jit_cache.find(key); | 313 | auto iter = jit_cache.find(key); |
| 311 | if (iter != jit_cache.end()) { | 314 | if (iter != jit_cache.end()) { |
| 312 | jit = iter->second; | 315 | jit = iter->second; |
| 316 | LoadContext(ctx); | ||
| 313 | return; | 317 | return; |
| 314 | } | 318 | } |
| 315 | jit = MakeJit(page_table, new_address_space_size_in_bits); | 319 | jit = MakeJit(page_table, new_address_space_size_in_bits); |
| 320 | LoadContext(ctx); | ||
| 316 | jit_cache.emplace(key, jit); | 321 | jit_cache.emplace(key, jit); |
| 317 | } | 322 | } |
| 318 | 323 | ||
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp index ae5566ab8..b36b7d918 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp | |||
| @@ -348,13 +348,18 @@ void ARM_Dynarmic_64::ClearExclusiveState() { | |||
| 348 | 348 | ||
| 349 | void ARM_Dynarmic_64::PageTableChanged(Common::PageTable& page_table, | 349 | void ARM_Dynarmic_64::PageTableChanged(Common::PageTable& page_table, |
| 350 | std::size_t new_address_space_size_in_bits) { | 350 | std::size_t new_address_space_size_in_bits) { |
| 351 | ThreadContext64 ctx{}; | ||
| 352 | SaveContext(ctx); | ||
| 353 | |||
| 351 | auto key = std::make_pair(&page_table, new_address_space_size_in_bits); | 354 | auto key = std::make_pair(&page_table, new_address_space_size_in_bits); |
| 352 | auto iter = jit_cache.find(key); | 355 | auto iter = jit_cache.find(key); |
| 353 | if (iter != jit_cache.end()) { | 356 | if (iter != jit_cache.end()) { |
| 354 | jit = iter->second; | 357 | jit = iter->second; |
| 358 | LoadContext(ctx); | ||
| 355 | return; | 359 | return; |
| 356 | } | 360 | } |
| 357 | jit = MakeJit(page_table, new_address_space_size_in_bits); | 361 | jit = MakeJit(page_table, new_address_space_size_in_bits); |
| 362 | LoadContext(ctx); | ||
| 358 | jit_cache.emplace(key, jit); | 363 | jit_cache.emplace(key, jit); |
| 359 | } | 364 | } |
| 360 | 365 | ||
diff --git a/src/core/file_sys/system_archive/ng_word.cpp b/src/core/file_sys/system_archive/ng_word.cpp index 100d3c5db..8d86d563a 100644 --- a/src/core/file_sys/system_archive/ng_word.cpp +++ b/src/core/file_sys/system_archive/ng_word.cpp | |||
| @@ -14,7 +14,7 @@ namespace NgWord1Data { | |||
| 14 | constexpr std::size_t NUMBER_WORD_TXT_FILES = 0x10; | 14 | constexpr std::size_t NUMBER_WORD_TXT_FILES = 0x10; |
| 15 | 15 | ||
| 16 | // Should this archive replacement mysteriously not work on a future game, consider updating. | 16 | // Should this archive replacement mysteriously not work on a future game, consider updating. |
| 17 | constexpr std::array<u8, 4> VERSION_DAT{0x0, 0x0, 0x0, 0x19}; // 5.1.0 System Version | 17 | constexpr std::array<u8, 4> VERSION_DAT{0x0, 0x0, 0x0, 0x20}; // 11.0.1 System Version |
| 18 | 18 | ||
| 19 | constexpr std::array<u8, 30> WORD_TXT{ | 19 | constexpr std::array<u8, 30> WORD_TXT{ |
| 20 | 0xFE, 0xFF, 0x00, 0x5E, 0x00, 0x76, 0x00, 0x65, 0x00, 0x72, 0x00, 0x79, 0x00, 0x62, 0x00, | 20 | 0xFE, 0xFF, 0x00, 0x5E, 0x00, 0x76, 0x00, 0x65, 0x00, 0x72, 0x00, 0x79, 0x00, 0x62, 0x00, |
| @@ -43,7 +43,7 @@ namespace NgWord2Data { | |||
| 43 | constexpr std::size_t NUMBER_AC_NX_FILES = 0x10; | 43 | constexpr std::size_t NUMBER_AC_NX_FILES = 0x10; |
| 44 | 44 | ||
| 45 | // Should this archive replacement mysteriously not work on a future game, consider updating. | 45 | // Should this archive replacement mysteriously not work on a future game, consider updating. |
| 46 | constexpr std::array<u8, 4> VERSION_DAT{0x0, 0x0, 0x0, 0x15}; // 5.1.0 System Version | 46 | constexpr std::array<u8, 4> VERSION_DAT{0x0, 0x0, 0x0, 0x1A}; // 11.0.1 System Version |
| 47 | 47 | ||
| 48 | constexpr std::array<u8, 0x2C> AC_NX_DATA{ | 48 | constexpr std::array<u8, 0x2C> AC_NX_DATA{ |
| 49 | 0x1F, 0x8B, 0x08, 0x08, 0xD5, 0x2C, 0x09, 0x5C, 0x04, 0x00, 0x61, 0x63, 0x72, 0x61, 0x77, | 49 | 0x1F, 0x8B, 0x08, 0x08, 0xD5, 0x2C, 0x09, 0x5C, 0x04, 0x00, 0x61, 0x63, 0x72, 0x61, 0x77, |
diff --git a/src/core/file_sys/system_archive/system_version.cpp b/src/core/file_sys/system_archive/system_version.cpp index 7bfbc9a67..54704105b 100644 --- a/src/core/file_sys/system_archive/system_version.cpp +++ b/src/core/file_sys/system_archive/system_version.cpp | |||
| @@ -14,15 +14,15 @@ namespace SystemVersionData { | |||
| 14 | 14 | ||
| 15 | constexpr u8 VERSION_MAJOR = 11; | 15 | constexpr u8 VERSION_MAJOR = 11; |
| 16 | constexpr u8 VERSION_MINOR = 0; | 16 | constexpr u8 VERSION_MINOR = 0; |
| 17 | constexpr u8 VERSION_MICRO = 0; | 17 | constexpr u8 VERSION_MICRO = 1; |
| 18 | 18 | ||
| 19 | constexpr u8 REVISION_MAJOR = 5; | 19 | constexpr u8 REVISION_MAJOR = 1; |
| 20 | constexpr u8 REVISION_MINOR = 0; | 20 | constexpr u8 REVISION_MINOR = 0; |
| 21 | 21 | ||
| 22 | constexpr char PLATFORM_STRING[] = "NX"; | 22 | constexpr char PLATFORM_STRING[] = "NX"; |
| 23 | constexpr char VERSION_HASH[] = "34197eba8810e2edd5e9dfcfbde7b340882e856d"; | 23 | constexpr char VERSION_HASH[] = "69103fcb2004dace877094c2f8c29e6113be5dbf"; |
| 24 | constexpr char DISPLAY_VERSION[] = "11.0.0"; | 24 | constexpr char DISPLAY_VERSION[] = "11.0.1"; |
| 25 | constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 11.0.0-5.0"; | 25 | constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 11.0.1-1.0"; |
| 26 | 26 | ||
| 27 | } // namespace SystemVersionData | 27 | } // namespace SystemVersionData |
| 28 | 28 | ||
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 780008b08..5b6c7792e 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -68,9 +68,9 @@ struct KernelCore::Impl { | |||
| 68 | InitializePhysicalCores(); | 68 | InitializePhysicalCores(); |
| 69 | InitializeSystemResourceLimit(kernel, system); | 69 | InitializeSystemResourceLimit(kernel, system); |
| 70 | InitializeMemoryLayout(); | 70 | InitializeMemoryLayout(); |
| 71 | InitializePreemption(kernel); | ||
| 72 | InitializeSchedulers(); | 71 | InitializeSchedulers(); |
| 73 | InitializeSuspendThreads(); | 72 | InitializeSuspendThreads(); |
| 73 | InitializePreemption(kernel); | ||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | void InitializeCores() { | 76 | void InitializeCores() { |
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index 72a877d68..0a6621ef2 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp | |||
| @@ -133,7 +133,7 @@ private: | |||
| 133 | void GetBlockedUserListIds(Kernel::HLERequestContext& ctx) { | 133 | void GetBlockedUserListIds(Kernel::HLERequestContext& ctx) { |
| 134 | // This is safe to stub, as there should be no adverse consequences from reporting no | 134 | // This is safe to stub, as there should be no adverse consequences from reporting no |
| 135 | // blocked users. | 135 | // blocked users. |
| 136 | LOG_WARNING(Service_ACC, "(STUBBED) called"); | 136 | LOG_WARNING(Service_Friend, "(STUBBED) called"); |
| 137 | IPC::ResponseBuilder rb{ctx, 3}; | 137 | IPC::ResponseBuilder rb{ctx, 3}; |
| 138 | rb.Push(RESULT_SUCCESS); | 138 | rb.Push(RESULT_SUCCESS); |
| 139 | rb.Push<u32>(0); // Indicates there are no blocked users | 139 | rb.Push<u32>(0); // Indicates there are no blocked users |
| @@ -141,14 +141,14 @@ private: | |||
| 141 | 141 | ||
| 142 | void DeclareCloseOnlinePlaySession(Kernel::HLERequestContext& ctx) { | 142 | void DeclareCloseOnlinePlaySession(Kernel::HLERequestContext& ctx) { |
| 143 | // Stub used by Splatoon 2 | 143 | // Stub used by Splatoon 2 |
| 144 | LOG_WARNING(Service_ACC, "(STUBBED) called"); | 144 | LOG_WARNING(Service_Friend, "(STUBBED) called"); |
| 145 | IPC::ResponseBuilder rb{ctx, 2}; | 145 | IPC::ResponseBuilder rb{ctx, 2}; |
| 146 | rb.Push(RESULT_SUCCESS); | 146 | rb.Push(RESULT_SUCCESS); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | void UpdateUserPresence(Kernel::HLERequestContext& ctx) { | 149 | void UpdateUserPresence(Kernel::HLERequestContext& ctx) { |
| 150 | // Stub used by Retro City Rampage | 150 | // Stub used by Retro City Rampage |
| 151 | LOG_WARNING(Service_ACC, "(STUBBED) called"); | 151 | LOG_WARNING(Service_Friend, "(STUBBED) called"); |
| 152 | IPC::ResponseBuilder rb{ctx, 2}; | 152 | IPC::ResponseBuilder rb{ctx, 2}; |
| 153 | rb.Push(RESULT_SUCCESS); | 153 | rb.Push(RESULT_SUCCESS); |
| 154 | } | 154 | } |
| @@ -159,7 +159,7 @@ private: | |||
| 159 | const auto uuid = rp.PopRaw<Common::UUID>(); | 159 | const auto uuid = rp.PopRaw<Common::UUID>(); |
| 160 | [[maybe_unused]] const auto filter = rp.PopRaw<SizedFriendFilter>(); | 160 | [[maybe_unused]] const auto filter = rp.PopRaw<SizedFriendFilter>(); |
| 161 | const auto pid = rp.Pop<u64>(); | 161 | const auto pid = rp.Pop<u64>(); |
| 162 | LOG_WARNING(Service_ACC, "(STUBBED) called, offset={}, uuid={}, pid={}", friend_offset, | 162 | LOG_WARNING(Service_Friend, "(STUBBED) called, offset={}, uuid={}, pid={}", friend_offset, |
| 163 | uuid.Format(), pid); | 163 | uuid.Format(), pid); |
| 164 | 164 | ||
| 165 | IPC::ResponseBuilder rb{ctx, 3}; | 165 | IPC::ResponseBuilder rb{ctx, 3}; |
| @@ -191,7 +191,7 @@ public: | |||
| 191 | 191 | ||
| 192 | private: | 192 | private: |
| 193 | void GetEvent(Kernel::HLERequestContext& ctx) { | 193 | void GetEvent(Kernel::HLERequestContext& ctx) { |
| 194 | LOG_DEBUG(Service_ACC, "called"); | 194 | LOG_DEBUG(Service_Friend, "called"); |
| 195 | 195 | ||
| 196 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 196 | IPC::ResponseBuilder rb{ctx, 2, 1}; |
| 197 | rb.Push(RESULT_SUCCESS); | 197 | rb.Push(RESULT_SUCCESS); |
| @@ -199,7 +199,7 @@ private: | |||
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | void Clear(Kernel::HLERequestContext& ctx) { | 201 | void Clear(Kernel::HLERequestContext& ctx) { |
| 202 | LOG_DEBUG(Service_ACC, "called"); | 202 | LOG_DEBUG(Service_Friend, "called"); |
| 203 | while (!notifications.empty()) { | 203 | while (!notifications.empty()) { |
| 204 | notifications.pop(); | 204 | notifications.pop(); |
| 205 | } | 205 | } |
| @@ -210,10 +210,10 @@ private: | |||
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | void Pop(Kernel::HLERequestContext& ctx) { | 212 | void Pop(Kernel::HLERequestContext& ctx) { |
| 213 | LOG_DEBUG(Service_ACC, "called"); | 213 | LOG_DEBUG(Service_Friend, "called"); |
| 214 | 214 | ||
| 215 | if (notifications.empty()) { | 215 | if (notifications.empty()) { |
| 216 | LOG_ERROR(Service_ACC, "No notifications in queue!"); | 216 | LOG_ERROR(Service_Friend, "No notifications in queue!"); |
| 217 | IPC::ResponseBuilder rb{ctx, 2}; | 217 | IPC::ResponseBuilder rb{ctx, 2}; |
| 218 | rb.Push(ERR_NO_NOTIFICATIONS); | 218 | rb.Push(ERR_NO_NOTIFICATIONS); |
| 219 | return; | 219 | return; |
| @@ -231,7 +231,8 @@ private: | |||
| 231 | break; | 231 | break; |
| 232 | default: | 232 | default: |
| 233 | // HOS seems not have an error case for an unknown notification | 233 | // HOS seems not have an error case for an unknown notification |
| 234 | LOG_WARNING(Service_ACC, "Unknown notification {:08X}", notification.notification_type); | 234 | LOG_WARNING(Service_Friend, "Unknown notification {:08X}", |
| 235 | notification.notification_type); | ||
| 235 | break; | 236 | break; |
| 236 | } | 237 | } |
| 237 | 238 | ||
| @@ -269,14 +270,14 @@ void Module::Interface::CreateFriendService(Kernel::HLERequestContext& ctx) { | |||
| 269 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 270 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 270 | rb.Push(RESULT_SUCCESS); | 271 | rb.Push(RESULT_SUCCESS); |
| 271 | rb.PushIpcInterface<IFriendService>(system); | 272 | rb.PushIpcInterface<IFriendService>(system); |
| 272 | LOG_DEBUG(Service_ACC, "called"); | 273 | LOG_DEBUG(Service_Friend, "called"); |
| 273 | } | 274 | } |
| 274 | 275 | ||
| 275 | void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx) { | 276 | void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx) { |
| 276 | IPC::RequestParser rp{ctx}; | 277 | IPC::RequestParser rp{ctx}; |
| 277 | auto uuid = rp.PopRaw<Common::UUID>(); | 278 | auto uuid = rp.PopRaw<Common::UUID>(); |
| 278 | 279 | ||
| 279 | LOG_DEBUG(Service_ACC, "called, uuid={}", uuid.Format()); | 280 | LOG_DEBUG(Service_Friend, "called, uuid={}", uuid.Format()); |
| 280 | 281 | ||
| 281 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 282 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 282 | rb.Push(RESULT_SUCCESS); | 283 | rb.Push(RESULT_SUCCESS); |
diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index e7063f8ef..93c43a203 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include <cstring> | 5 | #include <cstring> |
| 6 | #include "common/common_types.h" | 6 | #include "common/common_types.h" |
| 7 | #include "common/logging/log.h" | ||
| 7 | #include "core/core_timing.h" | 8 | #include "core/core_timing.h" |
| 8 | #include "core/frontend/emu_window.h" | 9 | #include "core/frontend/emu_window.h" |
| 9 | #include "core/hle/service/hid/controllers/gesture.h" | 10 | #include "core/hle/service/hid/controllers/gesture.h" |
| @@ -19,9 +20,9 @@ Controller_Gesture::~Controller_Gesture() = default; | |||
| 19 | 20 | ||
| 20 | void Controller_Gesture::OnInit() { | 21 | void Controller_Gesture::OnInit() { |
| 21 | for (std::size_t id = 0; id < MAX_FINGERS; ++id) { | 22 | for (std::size_t id = 0; id < MAX_FINGERS; ++id) { |
| 22 | mouse_finger_id[id] = MAX_FINGERS; | 23 | mouse_finger_id[id] = MAX_POINTS; |
| 23 | keyboard_finger_id[id] = MAX_FINGERS; | 24 | keyboard_finger_id[id] = MAX_POINTS; |
| 24 | udp_finger_id[id] = MAX_FINGERS; | 25 | udp_finger_id[id] = MAX_POINTS; |
| 25 | } | 26 | } |
| 26 | } | 27 | } |
| 27 | 28 | ||
| @@ -142,6 +143,10 @@ std::optional<std::size_t> Controller_Gesture::GetUnusedFingerID() const { | |||
| 142 | std::size_t Controller_Gesture::UpdateTouchInputEvent( | 143 | std::size_t Controller_Gesture::UpdateTouchInputEvent( |
| 143 | const std::tuple<float, float, bool>& touch_input, std::size_t finger_id) { | 144 | const std::tuple<float, float, bool>& touch_input, std::size_t finger_id) { |
| 144 | const auto& [x, y, pressed] = touch_input; | 145 | const auto& [x, y, pressed] = touch_input; |
| 146 | if (finger_id > MAX_POINTS) { | ||
| 147 | LOG_ERROR(Service_HID, "Invalid finger id {}", finger_id); | ||
| 148 | return MAX_POINTS; | ||
| 149 | } | ||
| 145 | if (pressed) { | 150 | if (pressed) { |
| 146 | if (finger_id == MAX_POINTS) { | 151 | if (finger_id == MAX_POINTS) { |
| 147 | const auto first_free_id = GetUnusedFingerID(); | 152 | const auto first_free_id = GetUnusedFingerID(); |
diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index 5219f2dad..be60492a4 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <cstring> | 6 | #include <cstring> |
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "common/logging/log.h" | ||
| 8 | #include "core/core_timing.h" | 9 | #include "core/core_timing.h" |
| 9 | #include "core/frontend/emu_window.h" | 10 | #include "core/frontend/emu_window.h" |
| 10 | #include "core/frontend/input.h" | 11 | #include "core/frontend/input.h" |
| @@ -118,6 +119,10 @@ std::optional<std::size_t> Controller_Touchscreen::GetUnusedFingerID() const { | |||
| 118 | std::size_t Controller_Touchscreen::UpdateTouchInputEvent( | 119 | std::size_t Controller_Touchscreen::UpdateTouchInputEvent( |
| 119 | const std::tuple<float, float, bool>& touch_input, std::size_t finger_id) { | 120 | const std::tuple<float, float, bool>& touch_input, std::size_t finger_id) { |
| 120 | const auto& [x, y, pressed] = touch_input; | 121 | const auto& [x, y, pressed] = touch_input; |
| 122 | if (finger_id > MAX_FINGERS) { | ||
| 123 | LOG_ERROR(Service_HID, "Invalid finger id {}", finger_id); | ||
| 124 | return MAX_FINGERS; | ||
| 125 | } | ||
| 121 | if (pressed) { | 126 | if (pressed) { |
| 122 | Attributes attribute{}; | 127 | Attributes attribute{}; |
| 123 | if (finger_id == MAX_FINGERS) { | 128 | if (finger_id == MAX_FINGERS) { |
diff --git a/src/core/hle/service/nvdrv/devices/nvdevice.h b/src/core/hle/service/nvdrv/devices/nvdevice.h index 5681599ba..b37f023df 100644 --- a/src/core/hle/service/nvdrv/devices/nvdevice.h +++ b/src/core/hle/service/nvdrv/devices/nvdevice.h | |||
| @@ -31,7 +31,7 @@ public: | |||
| 31 | * @param output A buffer where the output data will be written to. | 31 | * @param output A buffer where the output data will be written to. |
| 32 | * @returns The result code of the ioctl. | 32 | * @returns The result code of the ioctl. |
| 33 | */ | 33 | */ |
| 34 | virtual NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, | 34 | virtual NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 35 | std::vector<u8>& output) = 0; | 35 | std::vector<u8>& output) = 0; |
| 36 | 36 | ||
| 37 | /** | 37 | /** |
| @@ -42,7 +42,7 @@ public: | |||
| 42 | * @param output A buffer where the output data will be written to. | 42 | * @param output A buffer where the output data will be written to. |
| 43 | * @returns The result code of the ioctl. | 43 | * @returns The result code of the ioctl. |
| 44 | */ | 44 | */ |
| 45 | virtual NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 45 | virtual NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 46 | const std::vector<u8>& inline_input, std::vector<u8>& output) = 0; | 46 | const std::vector<u8>& inline_input, std::vector<u8>& output) = 0; |
| 47 | 47 | ||
| 48 | /** | 48 | /** |
| @@ -53,8 +53,20 @@ public: | |||
| 53 | * @param inline_output A buffer where the inlined output data will be written to. | 53 | * @param inline_output A buffer where the inlined output data will be written to. |
| 54 | * @returns The result code of the ioctl. | 54 | * @returns The result code of the ioctl. |
| 55 | */ | 55 | */ |
| 56 | virtual NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 56 | virtual NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 57 | std::vector<u8>& inline_output) = 0; | 57 | std::vector<u8>& output, std::vector<u8>& inline_output) = 0; |
| 58 | |||
| 59 | /** | ||
| 60 | * Called once a device is openned | ||
| 61 | * @param fd The device fd | ||
| 62 | */ | ||
| 63 | virtual void OnOpen(DeviceFD fd) = 0; | ||
| 64 | |||
| 65 | /** | ||
| 66 | * Called once a device is closed | ||
| 67 | * @param fd The device fd | ||
| 68 | */ | ||
| 69 | virtual void OnClose(DeviceFD fd) = 0; | ||
| 58 | 70 | ||
| 59 | protected: | 71 | protected: |
| 60 | Core::System& system; | 72 | Core::System& system; |
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp index ce615c758..5ab7e39b0 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp | |||
| @@ -18,24 +18,27 @@ nvdisp_disp0::nvdisp_disp0(Core::System& system, std::shared_ptr<nvmap> nvmap_de | |||
| 18 | : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} | 18 | : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} |
| 19 | nvdisp_disp0 ::~nvdisp_disp0() = default; | 19 | nvdisp_disp0 ::~nvdisp_disp0() = default; |
| 20 | 20 | ||
| 21 | NvResult nvdisp_disp0::Ioctl1(Ioctl command, const std::vector<u8>& input, | 21 | NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 22 | std::vector<u8>& output) { | 22 | std::vector<u8>& output) { |
| 23 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 23 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 24 | return NvResult::NotImplemented; | 24 | return NvResult::NotImplemented; |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | NvResult nvdisp_disp0::Ioctl2(Ioctl command, const std::vector<u8>& input, | 27 | NvResult nvdisp_disp0::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 28 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 28 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 29 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 29 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 30 | return NvResult::NotImplemented; | 30 | return NvResult::NotImplemented; |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | NvResult nvdisp_disp0::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 33 | NvResult nvdisp_disp0::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 34 | std::vector<u8>& inline_output) { | 34 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 35 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 35 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 36 | return NvResult::NotImplemented; | 36 | return NvResult::NotImplemented; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | void nvdisp_disp0::OnOpen(DeviceFD fd) {} | ||
| 40 | void nvdisp_disp0::OnClose(DeviceFD fd) {} | ||
| 41 | |||
| 39 | void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, | 42 | void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, |
| 40 | u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform, | 43 | u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform, |
| 41 | const Common::Rectangle<int>& crop_rect) { | 44 | const Common::Rectangle<int>& crop_rect) { |
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h index 55a33b7e4..59c9b6101 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h | |||
| @@ -20,11 +20,15 @@ public: | |||
| 20 | explicit nvdisp_disp0(Core::System& system, std::shared_ptr<nvmap> nvmap_dev); | 20 | explicit nvdisp_disp0(Core::System& system, std::shared_ptr<nvmap> nvmap_dev); |
| 21 | ~nvdisp_disp0() override; | 21 | ~nvdisp_disp0() override; |
| 22 | 22 | ||
| 23 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 23 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 24 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 24 | std::vector<u8>& output) override; |
| 25 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 25 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 26 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 26 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 27 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 27 | std::vector<u8>& inline_output) override; | 28 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 29 | |||
| 30 | void OnOpen(DeviceFD fd) override; | ||
| 31 | void OnClose(DeviceFD fd) override; | ||
| 28 | 32 | ||
| 29 | /// Performs a screen flip, drawing the buffer pointed to by the handle. | 33 | /// Performs a screen flip, drawing the buffer pointed to by the handle. |
| 30 | void flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, u32 stride, | 34 | void flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, u32 stride, |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp index 6b062e10e..f7b3dc317 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp | |||
| @@ -21,7 +21,7 @@ nvhost_as_gpu::nvhost_as_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_ | |||
| 21 | : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} | 21 | : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} |
| 22 | nvhost_as_gpu::~nvhost_as_gpu() = default; | 22 | nvhost_as_gpu::~nvhost_as_gpu() = default; |
| 23 | 23 | ||
| 24 | NvResult nvhost_as_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, | 24 | NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 25 | std::vector<u8>& output) { | 25 | std::vector<u8>& output) { |
| 26 | switch (command.group) { | 26 | switch (command.group) { |
| 27 | case 'A': | 27 | case 'A': |
| @@ -39,7 +39,7 @@ NvResult nvhost_as_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, | |||
| 39 | case 0x8: | 39 | case 0x8: |
| 40 | return GetVARegions(input, output); | 40 | return GetVARegions(input, output); |
| 41 | case 0x9: | 41 | case 0x9: |
| 42 | return InitalizeEx(input, output); | 42 | return AllocAsEx(input, output); |
| 43 | case 0x14: | 43 | case 0x14: |
| 44 | return Remap(input, output); | 44 | return Remap(input, output); |
| 45 | default: | 45 | default: |
| @@ -54,14 +54,14 @@ NvResult nvhost_as_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, | |||
| 54 | return NvResult::NotImplemented; | 54 | return NvResult::NotImplemented; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | NvResult nvhost_as_gpu::Ioctl2(Ioctl command, const std::vector<u8>& input, | 57 | NvResult nvhost_as_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 58 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 58 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 59 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 59 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 60 | return NvResult::NotImplemented; | 60 | return NvResult::NotImplemented; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | NvResult nvhost_as_gpu::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 63 | NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 64 | std::vector<u8>& inline_output) { | 64 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 65 | switch (command.group) { | 65 | switch (command.group) { |
| 66 | case 'A': | 66 | case 'A': |
| 67 | switch (command.cmd) { | 67 | switch (command.cmd) { |
| @@ -78,11 +78,19 @@ NvResult nvhost_as_gpu::Ioctl3(Ioctl command, const std::vector<u8>& input, std: | |||
| 78 | return NvResult::NotImplemented; | 78 | return NvResult::NotImplemented; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | NvResult nvhost_as_gpu::InitalizeEx(const std::vector<u8>& input, std::vector<u8>& output) { | 81 | void nvhost_as_gpu::OnOpen(DeviceFD fd) {} |
| 82 | IoctlInitalizeEx params{}; | 82 | void nvhost_as_gpu::OnClose(DeviceFD fd) {} |
| 83 | |||
| 84 | NvResult nvhost_as_gpu::AllocAsEx(const std::vector<u8>& input, std::vector<u8>& output) { | ||
| 85 | IoctlAllocAsEx params{}; | ||
| 83 | std::memcpy(¶ms, input.data(), input.size()); | 86 | std::memcpy(¶ms, input.data(), input.size()); |
| 84 | 87 | ||
| 85 | LOG_WARNING(Service_NVDRV, "(STUBBED) called, big_page_size=0x{:X}", params.big_page_size); | 88 | LOG_WARNING(Service_NVDRV, "(STUBBED) called, big_page_size=0x{:X}", params.big_page_size); |
| 89 | if (params.big_page_size == 0) { | ||
| 90 | params.big_page_size = DEFAULT_BIG_PAGE_SIZE; | ||
| 91 | } | ||
| 92 | |||
| 93 | big_page_size = params.big_page_size; | ||
| 86 | 94 | ||
| 87 | return NvResult::Success; | 95 | return NvResult::Success; |
| 88 | } | 96 | } |
| @@ -276,13 +284,18 @@ NvResult nvhost_as_gpu::GetVARegions(const std::vector<u8>& input, std::vector<u | |||
| 276 | params.buf_size); | 284 | params.buf_size); |
| 277 | 285 | ||
| 278 | params.buf_size = 0x30; | 286 | params.buf_size = 0x30; |
| 279 | params.regions[0].offset = 0x04000000; | ||
| 280 | params.regions[0].page_size = 0x1000; | ||
| 281 | params.regions[0].pages = 0x3fbfff; | ||
| 282 | 287 | ||
| 283 | params.regions[1].offset = 0x04000000; | 288 | params.small = IoctlVaRegion{ |
| 284 | params.regions[1].page_size = 0x10000; | 289 | .offset = 0x04000000, |
| 285 | params.regions[1].pages = 0x1bffff; | 290 | .page_size = DEFAULT_SMALL_PAGE_SIZE, |
| 291 | .pages = 0x3fbfff, | ||
| 292 | }; | ||
| 293 | |||
| 294 | params.big = IoctlVaRegion{ | ||
| 295 | .offset = 0x04000000, | ||
| 296 | .page_size = big_page_size, | ||
| 297 | .pages = 0x1bffff, | ||
| 298 | }; | ||
| 286 | 299 | ||
| 287 | // TODO(ogniK): This probably can stay stubbed but should add support way way later | 300 | // TODO(ogniK): This probably can stay stubbed but should add support way way later |
| 288 | 301 | ||
| @@ -299,18 +312,25 @@ NvResult nvhost_as_gpu::GetVARegions(const std::vector<u8>& input, std::vector<u | |||
| 299 | params.buf_size); | 312 | params.buf_size); |
| 300 | 313 | ||
| 301 | params.buf_size = 0x30; | 314 | params.buf_size = 0x30; |
| 302 | params.regions[0].offset = 0x04000000; | ||
| 303 | params.regions[0].page_size = 0x1000; | ||
| 304 | params.regions[0].pages = 0x3fbfff; | ||
| 305 | 315 | ||
| 306 | params.regions[1].offset = 0x04000000; | 316 | params.small = IoctlVaRegion{ |
| 307 | params.regions[1].page_size = 0x10000; | 317 | .offset = 0x04000000, |
| 308 | params.regions[1].pages = 0x1bffff; | 318 | .page_size = 0x1000, |
| 319 | .pages = 0x3fbfff, | ||
| 320 | }; | ||
| 321 | |||
| 322 | params.big = IoctlVaRegion{ | ||
| 323 | .offset = 0x04000000, | ||
| 324 | .page_size = big_page_size, | ||
| 325 | .pages = 0x1bffff, | ||
| 326 | }; | ||
| 309 | 327 | ||
| 310 | // TODO(ogniK): This probably can stay stubbed but should add support way way later | 328 | // TODO(ogniK): This probably can stay stubbed but should add support way way later |
| 311 | 329 | ||
| 312 | std::memcpy(output.data(), ¶ms, output.size()); | 330 | std::memcpy(output.data(), ¶ms, output.size()); |
| 313 | std::memcpy(inline_output.data(), ¶ms.regions, inline_output.size()); | 331 | std::memcpy(inline_output.data(), ¶ms.small, sizeof(IoctlVaRegion)); |
| 332 | std::memcpy(inline_output.data() + sizeof(IoctlVaRegion), ¶ms.big, sizeof(IoctlVaRegion)); | ||
| 333 | |||
| 314 | return NvResult::Success; | 334 | return NvResult::Success; |
| 315 | } | 335 | } |
| 316 | 336 | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h index 08035fa0e..d86a9cab6 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h | |||
| @@ -16,6 +16,9 @@ | |||
| 16 | 16 | ||
| 17 | namespace Service::Nvidia::Devices { | 17 | namespace Service::Nvidia::Devices { |
| 18 | 18 | ||
| 19 | constexpr u32 DEFAULT_BIG_PAGE_SIZE = 1 << 16; | ||
| 20 | constexpr u32 DEFAULT_SMALL_PAGE_SIZE = 1 << 12; | ||
| 21 | |||
| 19 | class nvmap; | 22 | class nvmap; |
| 20 | 23 | ||
| 21 | enum class AddressSpaceFlags : u32 { | 24 | enum class AddressSpaceFlags : u32 { |
| @@ -30,11 +33,15 @@ public: | |||
| 30 | explicit nvhost_as_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev); | 33 | explicit nvhost_as_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev); |
| 31 | ~nvhost_as_gpu() override; | 34 | ~nvhost_as_gpu() override; |
| 32 | 35 | ||
| 33 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 36 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 34 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 37 | std::vector<u8>& output) override; |
| 38 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 35 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 39 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 36 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 40 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 37 | std::vector<u8>& inline_output) override; | 41 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 42 | |||
| 43 | void OnOpen(DeviceFD fd) override; | ||
| 44 | void OnClose(DeviceFD fd) override; | ||
| 38 | 45 | ||
| 39 | private: | 46 | private: |
| 40 | class BufferMap final { | 47 | class BufferMap final { |
| @@ -76,16 +83,16 @@ private: | |||
| 76 | bool is_allocated{}; | 83 | bool is_allocated{}; |
| 77 | }; | 84 | }; |
| 78 | 85 | ||
| 79 | struct IoctlInitalizeEx { | 86 | struct IoctlAllocAsEx { |
| 80 | u32_le big_page_size{}; // depends on GPU's available_big_page_sizes; 0=default | 87 | u32_le flags{}; // usually passes 1 |
| 81 | s32_le as_fd{}; // ignored; passes 0 | 88 | s32_le as_fd{}; // ignored; passes 0 |
| 82 | u32_le flags{}; // passes 0 | 89 | u32_le big_page_size{}; |
| 83 | u32_le reserved{}; // ignored; passes 0 | 90 | u32_le reserved{}; // ignored; passes 0 |
| 84 | u64_le unk0{}; | 91 | u64_le va_range_start{}; |
| 85 | u64_le unk1{}; | 92 | u64_le va_range_end{}; |
| 86 | u64_le unk2{}; | 93 | u64_le va_range_split{}; |
| 87 | }; | 94 | }; |
| 88 | static_assert(sizeof(IoctlInitalizeEx) == 40, "IoctlInitalizeEx is incorrect size"); | 95 | static_assert(sizeof(IoctlAllocAsEx) == 40, "IoctlAllocAsEx is incorrect size"); |
| 89 | 96 | ||
| 90 | struct IoctlAllocSpace { | 97 | struct IoctlAllocSpace { |
| 91 | u32_le pages{}; | 98 | u32_le pages{}; |
| @@ -149,14 +156,16 @@ private: | |||
| 149 | u64_le buf_addr{}; // (contained output user ptr on linux, ignored) | 156 | u64_le buf_addr{}; // (contained output user ptr on linux, ignored) |
| 150 | u32_le buf_size{}; // forced to 2*sizeof(struct va_region) | 157 | u32_le buf_size{}; // forced to 2*sizeof(struct va_region) |
| 151 | u32_le reserved{}; | 158 | u32_le reserved{}; |
| 152 | IoctlVaRegion regions[2]{}; | 159 | IoctlVaRegion small{}; |
| 160 | IoctlVaRegion big{}; | ||
| 153 | }; | 161 | }; |
| 154 | static_assert(sizeof(IoctlGetVaRegions) == 16 + sizeof(IoctlVaRegion) * 2, | 162 | static_assert(sizeof(IoctlGetVaRegions) == 16 + sizeof(IoctlVaRegion) * 2, |
| 155 | "IoctlGetVaRegions is incorrect size"); | 163 | "IoctlGetVaRegions is incorrect size"); |
| 156 | 164 | ||
| 157 | s32 channel{}; | 165 | s32 channel{}; |
| 166 | u32 big_page_size{DEFAULT_BIG_PAGE_SIZE}; | ||
| 158 | 167 | ||
| 159 | NvResult InitalizeEx(const std::vector<u8>& input, std::vector<u8>& output); | 168 | NvResult AllocAsEx(const std::vector<u8>& input, std::vector<u8>& output); |
| 160 | NvResult AllocateSpace(const std::vector<u8>& input, std::vector<u8>& output); | 169 | NvResult AllocateSpace(const std::vector<u8>& input, std::vector<u8>& output); |
| 161 | NvResult Remap(const std::vector<u8>& input, std::vector<u8>& output); | 170 | NvResult Remap(const std::vector<u8>& input, std::vector<u8>& output); |
| 162 | NvResult MapBufferEx(const std::vector<u8>& input, std::vector<u8>& output); | 171 | NvResult MapBufferEx(const std::vector<u8>& input, std::vector<u8>& output); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index f6129ef10..9f00d5cb0 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | |||
| @@ -20,7 +20,8 @@ nvhost_ctrl::nvhost_ctrl(Core::System& system, EventInterface& events_interface, | |||
| 20 | : nvdevice(system), events_interface{events_interface}, syncpoint_manager{syncpoint_manager} {} | 20 | : nvdevice(system), events_interface{events_interface}, syncpoint_manager{syncpoint_manager} {} |
| 21 | nvhost_ctrl::~nvhost_ctrl() = default; | 21 | nvhost_ctrl::~nvhost_ctrl() = default; |
| 22 | 22 | ||
| 23 | NvResult nvhost_ctrl::Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { | 23 | NvResult nvhost_ctrl::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 24 | std::vector<u8>& output) { | ||
| 24 | switch (command.group) { | 25 | switch (command.group) { |
| 25 | case 0x0: | 26 | case 0x0: |
| 26 | switch (command.cmd) { | 27 | switch (command.cmd) { |
| @@ -46,18 +47,21 @@ NvResult nvhost_ctrl::Ioctl1(Ioctl command, const std::vector<u8>& input, std::v | |||
| 46 | return NvResult::NotImplemented; | 47 | return NvResult::NotImplemented; |
| 47 | } | 48 | } |
| 48 | 49 | ||
| 49 | NvResult nvhost_ctrl::Ioctl2(Ioctl command, const std::vector<u8>& input, | 50 | NvResult nvhost_ctrl::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 50 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 51 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 51 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 52 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 52 | return NvResult::NotImplemented; | 53 | return NvResult::NotImplemented; |
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | NvResult nvhost_ctrl::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 56 | NvResult nvhost_ctrl::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 56 | std::vector<u8>& inline_outpu) { | 57 | std::vector<u8>& output, std::vector<u8>& inline_outpu) { |
| 57 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 58 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 58 | return NvResult::NotImplemented; | 59 | return NvResult::NotImplemented; |
| 59 | } | 60 | } |
| 60 | 61 | ||
| 62 | void nvhost_ctrl::OnOpen(DeviceFD fd) {} | ||
| 63 | void nvhost_ctrl::OnClose(DeviceFD fd) {} | ||
| 64 | |||
| 61 | NvResult nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) { | 65 | NvResult nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) { |
| 62 | IocGetConfigParams params{}; | 66 | IocGetConfigParams params{}; |
| 63 | std::memcpy(¶ms, input.data(), sizeof(params)); | 67 | std::memcpy(¶ms, input.data(), sizeof(params)); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h index c5aa1362a..9178789c3 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h | |||
| @@ -18,11 +18,15 @@ public: | |||
| 18 | SyncpointManager& syncpoint_manager); | 18 | SyncpointManager& syncpoint_manager); |
| 19 | ~nvhost_ctrl() override; | 19 | ~nvhost_ctrl() override; |
| 20 | 20 | ||
| 21 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 21 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 22 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 22 | std::vector<u8>& output) override; |
| 23 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 23 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 24 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 24 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 25 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 25 | std::vector<u8>& inline_output) override; | 26 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 27 | |||
| 28 | void OnOpen(DeviceFD fd) override; | ||
| 29 | void OnClose(DeviceFD fd) override; | ||
| 26 | 30 | ||
| 27 | private: | 31 | private: |
| 28 | struct IocSyncptReadParams { | 32 | struct IocSyncptReadParams { |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp index 0320d3ae2..933d42f3f 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp | |||
| @@ -15,7 +15,7 @@ namespace Service::Nvidia::Devices { | |||
| 15 | nvhost_ctrl_gpu::nvhost_ctrl_gpu(Core::System& system) : nvdevice(system) {} | 15 | nvhost_ctrl_gpu::nvhost_ctrl_gpu(Core::System& system) : nvdevice(system) {} |
| 16 | nvhost_ctrl_gpu::~nvhost_ctrl_gpu() = default; | 16 | nvhost_ctrl_gpu::~nvhost_ctrl_gpu() = default; |
| 17 | 17 | ||
| 18 | NvResult nvhost_ctrl_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, | 18 | NvResult nvhost_ctrl_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 19 | std::vector<u8>& output) { | 19 | std::vector<u8>& output) { |
| 20 | switch (command.group) { | 20 | switch (command.group) { |
| 21 | case 'G': | 21 | case 'G': |
| @@ -47,13 +47,13 @@ NvResult nvhost_ctrl_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, | |||
| 47 | return NvResult::NotImplemented; | 47 | return NvResult::NotImplemented; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | NvResult nvhost_ctrl_gpu::Ioctl2(Ioctl command, const std::vector<u8>& input, | 50 | NvResult nvhost_ctrl_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 51 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 51 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 52 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 52 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 53 | return NvResult::NotImplemented; | 53 | return NvResult::NotImplemented; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | NvResult nvhost_ctrl_gpu::Ioctl3(Ioctl command, const std::vector<u8>& input, | 56 | NvResult nvhost_ctrl_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 57 | std::vector<u8>& output, std::vector<u8>& inline_output) { | 57 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 58 | switch (command.group) { | 58 | switch (command.group) { |
| 59 | case 'G': | 59 | case 'G': |
| @@ -73,6 +73,9 @@ NvResult nvhost_ctrl_gpu::Ioctl3(Ioctl command, const std::vector<u8>& input, | |||
| 73 | return NvResult::NotImplemented; | 73 | return NvResult::NotImplemented; |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | void nvhost_ctrl_gpu::OnOpen(DeviceFD fd) {} | ||
| 77 | void nvhost_ctrl_gpu::OnClose(DeviceFD fd) {} | ||
| 78 | |||
| 76 | NvResult nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, | 79 | NvResult nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, |
| 77 | std::vector<u8>& output) { | 80 | std::vector<u8>& output) { |
| 78 | LOG_DEBUG(Service_NVDRV, "called"); | 81 | LOG_DEBUG(Service_NVDRV, "called"); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h index 137b88238..f98aa841a 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h | |||
| @@ -16,11 +16,15 @@ public: | |||
| 16 | explicit nvhost_ctrl_gpu(Core::System& system); | 16 | explicit nvhost_ctrl_gpu(Core::System& system); |
| 17 | ~nvhost_ctrl_gpu() override; | 17 | ~nvhost_ctrl_gpu() override; |
| 18 | 18 | ||
| 19 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 19 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 20 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 20 | std::vector<u8>& output) override; |
| 21 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 21 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 22 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 22 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 23 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 23 | std::vector<u8>& inline_output) override; | 24 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 25 | |||
| 26 | void OnOpen(DeviceFD fd) override; | ||
| 27 | void OnClose(DeviceFD fd) override; | ||
| 24 | 28 | ||
| 25 | private: | 29 | private: |
| 26 | struct IoctlGpuCharacteristics { | 30 | struct IoctlGpuCharacteristics { |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index af8b3d9f1..e83aaa798 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp | |||
| @@ -23,7 +23,8 @@ nvhost_gpu::nvhost_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev, | |||
| 23 | 23 | ||
| 24 | nvhost_gpu::~nvhost_gpu() = default; | 24 | nvhost_gpu::~nvhost_gpu() = default; |
| 25 | 25 | ||
| 26 | NvResult nvhost_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { | 26 | NvResult nvhost_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 27 | std::vector<u8>& output) { | ||
| 27 | switch (command.group) { | 28 | switch (command.group) { |
| 28 | case 0x0: | 29 | case 0x0: |
| 29 | switch (command.cmd) { | 30 | switch (command.cmd) { |
| @@ -74,7 +75,7 @@ NvResult nvhost_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, std::ve | |||
| 74 | return NvResult::NotImplemented; | 75 | return NvResult::NotImplemented; |
| 75 | }; | 76 | }; |
| 76 | 77 | ||
| 77 | NvResult nvhost_gpu::Ioctl2(Ioctl command, const std::vector<u8>& input, | 78 | NvResult nvhost_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 78 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 79 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 79 | switch (command.group) { | 80 | switch (command.group) { |
| 80 | case 'H': | 81 | case 'H': |
| @@ -88,12 +89,15 @@ NvResult nvhost_gpu::Ioctl2(Ioctl command, const std::vector<u8>& input, | |||
| 88 | return NvResult::NotImplemented; | 89 | return NvResult::NotImplemented; |
| 89 | } | 90 | } |
| 90 | 91 | ||
| 91 | NvResult nvhost_gpu::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 92 | NvResult nvhost_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 92 | std::vector<u8>& inline_output) { | 93 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 93 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 94 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 94 | return NvResult::NotImplemented; | 95 | return NvResult::NotImplemented; |
| 95 | } | 96 | } |
| 96 | 97 | ||
| 98 | void nvhost_gpu::OnOpen(DeviceFD fd) {} | ||
| 99 | void nvhost_gpu::OnClose(DeviceFD fd) {} | ||
| 100 | |||
| 97 | NvResult nvhost_gpu::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { | 101 | NvResult nvhost_gpu::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { |
| 98 | IoctlSetNvmapFD params{}; | 102 | IoctlSetNvmapFD params{}; |
| 99 | std::memcpy(¶ms, input.data(), input.size()); | 103 | std::memcpy(¶ms, input.data(), input.size()); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h index e0298b4fe..12a1a1133 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h | |||
| @@ -26,11 +26,15 @@ public: | |||
| 26 | SyncpointManager& syncpoint_manager); | 26 | SyncpointManager& syncpoint_manager); |
| 27 | ~nvhost_gpu() override; | 27 | ~nvhost_gpu() override; |
| 28 | 28 | ||
| 29 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 29 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 30 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 30 | std::vector<u8>& output) override; |
| 31 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 31 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 32 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 32 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 33 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 33 | std::vector<u8>& inline_output) override; | 34 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 35 | |||
| 36 | void OnOpen(DeviceFD fd) override; | ||
| 37 | void OnClose(DeviceFD fd) override; | ||
| 34 | 38 | ||
| 35 | private: | 39 | private: |
| 36 | enum class CtxObjects : u32_le { | 40 | enum class CtxObjects : u32_le { |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp index ecba1dba1..c8031970b 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp | |||
| @@ -16,7 +16,7 @@ nvhost_nvdec::nvhost_nvdec(Core::System& system, std::shared_ptr<nvmap> nvmap_de | |||
| 16 | : nvhost_nvdec_common(system, std::move(nvmap_dev), syncpoint_manager) {} | 16 | : nvhost_nvdec_common(system, std::move(nvmap_dev), syncpoint_manager) {} |
| 17 | nvhost_nvdec::~nvhost_nvdec() = default; | 17 | nvhost_nvdec::~nvhost_nvdec() = default; |
| 18 | 18 | ||
| 19 | NvResult nvhost_nvdec::Ioctl1(Ioctl command, const std::vector<u8>& input, | 19 | NvResult nvhost_nvdec::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 20 | std::vector<u8>& output) { | 20 | std::vector<u8>& output) { |
| 21 | switch (command.group) { | 21 | switch (command.group) { |
| 22 | case 0x0: | 22 | case 0x0: |
| @@ -57,16 +57,19 @@ NvResult nvhost_nvdec::Ioctl1(Ioctl command, const std::vector<u8>& input, | |||
| 57 | return NvResult::NotImplemented; | 57 | return NvResult::NotImplemented; |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | NvResult nvhost_nvdec::Ioctl2(Ioctl command, const std::vector<u8>& input, | 60 | NvResult nvhost_nvdec::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 61 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 61 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 62 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 62 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 63 | return NvResult::NotImplemented; | 63 | return NvResult::NotImplemented; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | NvResult nvhost_nvdec::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 66 | NvResult nvhost_nvdec::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 67 | std::vector<u8>& inline_output) { | 67 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 68 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 68 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 69 | return NvResult::NotImplemented; | 69 | return NvResult::NotImplemented; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | void nvhost_nvdec::OnOpen(DeviceFD fd) {} | ||
| 73 | void nvhost_nvdec::OnClose(DeviceFD fd) {} | ||
| 74 | |||
| 72 | } // namespace Service::Nvidia::Devices | 75 | } // namespace Service::Nvidia::Devices |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h index 77ef53cdd..6c38a8c24 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h | |||
| @@ -15,11 +15,15 @@ public: | |||
| 15 | SyncpointManager& syncpoint_manager); | 15 | SyncpointManager& syncpoint_manager); |
| 16 | ~nvhost_nvdec() override; | 16 | ~nvhost_nvdec() override; |
| 17 | 17 | ||
| 18 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 18 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 19 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 19 | std::vector<u8>& output) override; |
| 20 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 20 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 21 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 21 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 22 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 22 | std::vector<u8>& inline_output) override; | 23 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 24 | |||
| 25 | void OnOpen(DeviceFD fd) override; | ||
| 26 | void OnClose(DeviceFD fd) override; | ||
| 23 | }; | 27 | }; |
| 24 | 28 | ||
| 25 | } // namespace Service::Nvidia::Devices | 29 | } // namespace Service::Nvidia::Devices |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp index 2d06955c0..0a9c35c01 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp | |||
| @@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices { | |||
| 13 | nvhost_nvjpg::nvhost_nvjpg(Core::System& system) : nvdevice(system) {} | 13 | nvhost_nvjpg::nvhost_nvjpg(Core::System& system) : nvdevice(system) {} |
| 14 | nvhost_nvjpg::~nvhost_nvjpg() = default; | 14 | nvhost_nvjpg::~nvhost_nvjpg() = default; |
| 15 | 15 | ||
| 16 | NvResult nvhost_nvjpg::Ioctl1(Ioctl command, const std::vector<u8>& input, | 16 | NvResult nvhost_nvjpg::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 17 | std::vector<u8>& output) { | 17 | std::vector<u8>& output) { |
| 18 | switch (command.group) { | 18 | switch (command.group) { |
| 19 | case 'H': | 19 | case 'H': |
| @@ -32,18 +32,21 @@ NvResult nvhost_nvjpg::Ioctl1(Ioctl command, const std::vector<u8>& input, | |||
| 32 | return NvResult::NotImplemented; | 32 | return NvResult::NotImplemented; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | NvResult nvhost_nvjpg::Ioctl2(Ioctl command, const std::vector<u8>& input, | 35 | NvResult nvhost_nvjpg::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 36 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 36 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 37 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 37 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 38 | return NvResult::NotImplemented; | 38 | return NvResult::NotImplemented; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | NvResult nvhost_nvjpg::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 41 | NvResult nvhost_nvjpg::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 42 | std::vector<u8>& inline_output) { | 42 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 43 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 43 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 44 | return NvResult::NotImplemented; | 44 | return NvResult::NotImplemented; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | void nvhost_nvjpg::OnOpen(DeviceFD fd) {} | ||
| 48 | void nvhost_nvjpg::OnClose(DeviceFD fd) {} | ||
| 49 | |||
| 47 | NvResult nvhost_nvjpg::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { | 50 | NvResult nvhost_nvjpg::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { |
| 48 | IoctlSetNvmapFD params{}; | 51 | IoctlSetNvmapFD params{}; |
| 49 | std::memcpy(¶ms, input.data(), input.size()); | 52 | std::memcpy(¶ms, input.data(), input.size()); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h index 43948d18d..1f97b642f 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h | |||
| @@ -16,11 +16,15 @@ public: | |||
| 16 | explicit nvhost_nvjpg(Core::System& system); | 16 | explicit nvhost_nvjpg(Core::System& system); |
| 17 | ~nvhost_nvjpg() override; | 17 | ~nvhost_nvjpg() override; |
| 18 | 18 | ||
| 19 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 19 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 20 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 20 | std::vector<u8>& output) override; |
| 21 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 21 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 22 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 22 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 23 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 23 | std::vector<u8>& inline_output) override; | 24 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 25 | |||
| 26 | void OnOpen(DeviceFD fd) override; | ||
| 27 | void OnClose(DeviceFD fd) override; | ||
| 24 | 28 | ||
| 25 | private: | 29 | private: |
| 26 | struct IoctlSetNvmapFD { | 30 | struct IoctlSetNvmapFD { |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp index 70849a9bd..0421fb956 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp | |||
| @@ -16,7 +16,8 @@ nvhost_vic::nvhost_vic(Core::System& system, std::shared_ptr<nvmap> nvmap_dev, | |||
| 16 | 16 | ||
| 17 | nvhost_vic::~nvhost_vic() = default; | 17 | nvhost_vic::~nvhost_vic() = default; |
| 18 | 18 | ||
| 19 | NvResult nvhost_vic::Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { | 19 | NvResult nvhost_vic::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 20 | std::vector<u8>& output) { | ||
| 20 | switch (command.group) { | 21 | switch (command.group) { |
| 21 | case 0x0: | 22 | case 0x0: |
| 22 | switch (command.cmd) { | 23 | switch (command.cmd) { |
| @@ -55,16 +56,19 @@ NvResult nvhost_vic::Ioctl1(Ioctl command, const std::vector<u8>& input, std::ve | |||
| 55 | return NvResult::NotImplemented; | 56 | return NvResult::NotImplemented; |
| 56 | } | 57 | } |
| 57 | 58 | ||
| 58 | NvResult nvhost_vic::Ioctl2(Ioctl command, const std::vector<u8>& input, | 59 | NvResult nvhost_vic::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 59 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 60 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 60 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 61 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 61 | return NvResult::NotImplemented; | 62 | return NvResult::NotImplemented; |
| 62 | } | 63 | } |
| 63 | 64 | ||
| 64 | NvResult nvhost_vic::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 65 | NvResult nvhost_vic::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 65 | std::vector<u8>& inline_output) { | 66 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 66 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 67 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 67 | return NvResult::NotImplemented; | 68 | return NvResult::NotImplemented; |
| 68 | } | 69 | } |
| 69 | 70 | ||
| 71 | void nvhost_vic::OnOpen(DeviceFD fd) {} | ||
| 72 | void nvhost_vic::OnClose(DeviceFD fd) {} | ||
| 73 | |||
| 70 | } // namespace Service::Nvidia::Devices | 74 | } // namespace Service::Nvidia::Devices |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.h b/src/core/hle/service/nvdrv/devices/nvhost_vic.h index f401c61fa..cebefad71 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.h | |||
| @@ -14,10 +14,14 @@ public: | |||
| 14 | SyncpointManager& syncpoint_manager); | 14 | SyncpointManager& syncpoint_manager); |
| 15 | ~nvhost_vic(); | 15 | ~nvhost_vic(); |
| 16 | 16 | ||
| 17 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 17 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 18 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 18 | std::vector<u8>& output) override; |
| 19 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 19 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 20 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 20 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 21 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 21 | std::vector<u8>& inline_output) override; | 22 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 23 | |||
| 24 | void OnOpen(DeviceFD fd) override; | ||
| 25 | void OnClose(DeviceFD fd) override; | ||
| 22 | }; | 26 | }; |
| 23 | } // namespace Service::Nvidia::Devices | 27 | } // namespace Service::Nvidia::Devices |
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp index 4015a2740..dd1355522 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.cpp +++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp | |||
| @@ -19,7 +19,8 @@ nvmap::nvmap(Core::System& system) : nvdevice(system) { | |||
| 19 | 19 | ||
| 20 | nvmap::~nvmap() = default; | 20 | nvmap::~nvmap() = default; |
| 21 | 21 | ||
| 22 | NvResult nvmap::Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { | 22 | NvResult nvmap::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 23 | std::vector<u8>& output) { | ||
| 23 | switch (command.group) { | 24 | switch (command.group) { |
| 24 | case 0x1: | 25 | case 0x1: |
| 25 | switch (command.cmd) { | 26 | switch (command.cmd) { |
| @@ -47,18 +48,21 @@ NvResult nvmap::Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector< | |||
| 47 | return NvResult::NotImplemented; | 48 | return NvResult::NotImplemented; |
| 48 | } | 49 | } |
| 49 | 50 | ||
| 50 | NvResult nvmap::Ioctl2(Ioctl command, const std::vector<u8>& input, | 51 | NvResult nvmap::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 51 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 52 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 52 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 53 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 53 | return NvResult::NotImplemented; | 54 | return NvResult::NotImplemented; |
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | NvResult nvmap::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 57 | NvResult nvmap::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 57 | std::vector<u8>& inline_output) { | 58 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 58 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 59 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 59 | return NvResult::NotImplemented; | 60 | return NvResult::NotImplemented; |
| 60 | } | 61 | } |
| 61 | 62 | ||
| 63 | void nvmap::OnOpen(DeviceFD fd) {} | ||
| 64 | void nvmap::OnClose(DeviceFD fd) {} | ||
| 65 | |||
| 62 | VAddr nvmap::GetObjectAddress(u32 handle) const { | 66 | VAddr nvmap::GetObjectAddress(u32 handle) const { |
| 63 | auto object = GetObject(handle); | 67 | auto object = GetObject(handle); |
| 64 | ASSERT(object); | 68 | ASSERT(object); |
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.h b/src/core/hle/service/nvdrv/devices/nvmap.h index 4484bd79f..208875845 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.h +++ b/src/core/hle/service/nvdrv/devices/nvmap.h | |||
| @@ -19,11 +19,15 @@ public: | |||
| 19 | explicit nvmap(Core::System& system); | 19 | explicit nvmap(Core::System& system); |
| 20 | ~nvmap() override; | 20 | ~nvmap() override; |
| 21 | 21 | ||
| 22 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 22 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 23 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 23 | std::vector<u8>& output) override; |
| 24 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 24 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 25 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 25 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 26 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 26 | std::vector<u8>& inline_output) override; | 27 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 28 | |||
| 29 | void OnOpen(DeviceFD fd) override; | ||
| 30 | void OnClose(DeviceFD fd) override; | ||
| 27 | 31 | ||
| 28 | /// Returns the allocated address of an nvmap object given its handle. | 32 | /// Returns the allocated address of an nvmap object given its handle. |
| 29 | VAddr GetObjectAddress(u32 handle) const; | 33 | VAddr GetObjectAddress(u32 handle) const; |
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index abba80112..ede77858a 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp | |||
| @@ -89,6 +89,8 @@ DeviceFD Module::Open(const std::string& device_name) { | |||
| 89 | auto device = devices[device_name]; | 89 | auto device = devices[device_name]; |
| 90 | const DeviceFD fd = next_fd++; | 90 | const DeviceFD fd = next_fd++; |
| 91 | 91 | ||
| 92 | device->OnOpen(fd); | ||
| 93 | |||
| 92 | open_files[fd] = std::move(device); | 94 | open_files[fd] = std::move(device); |
| 93 | 95 | ||
| 94 | return fd; | 96 | return fd; |
| @@ -108,7 +110,7 @@ NvResult Module::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input | |||
| 108 | return NvResult::NotImplemented; | 110 | return NvResult::NotImplemented; |
| 109 | } | 111 | } |
| 110 | 112 | ||
| 111 | return itr->second->Ioctl1(command, input, output); | 113 | return itr->second->Ioctl1(fd, command, input, output); |
| 112 | } | 114 | } |
| 113 | 115 | ||
| 114 | NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 116 | NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| @@ -125,7 +127,7 @@ NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input | |||
| 125 | return NvResult::NotImplemented; | 127 | return NvResult::NotImplemented; |
| 126 | } | 128 | } |
| 127 | 129 | ||
| 128 | return itr->second->Ioctl2(command, input, inline_input, output); | 130 | return itr->second->Ioctl2(fd, command, input, inline_input, output); |
| 129 | } | 131 | } |
| 130 | 132 | ||
| 131 | NvResult Module::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 133 | NvResult Module::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| @@ -142,7 +144,7 @@ NvResult Module::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input | |||
| 142 | return NvResult::NotImplemented; | 144 | return NvResult::NotImplemented; |
| 143 | } | 145 | } |
| 144 | 146 | ||
| 145 | return itr->second->Ioctl3(command, input, output, inline_output); | 147 | return itr->second->Ioctl3(fd, command, input, output, inline_output); |
| 146 | } | 148 | } |
| 147 | 149 | ||
| 148 | NvResult Module::Close(DeviceFD fd) { | 150 | NvResult Module::Close(DeviceFD fd) { |
| @@ -158,6 +160,8 @@ NvResult Module::Close(DeviceFD fd) { | |||
| 158 | return NvResult::NotImplemented; | 160 | return NvResult::NotImplemented; |
| 159 | } | 161 | } |
| 160 | 162 | ||
| 163 | itr->second->OnClose(fd); | ||
| 164 | |||
| 161 | open_files.erase(itr); | 165 | open_files.erase(itr); |
| 162 | 166 | ||
| 163 | return NvResult::Success; | 167 | return NvResult::Success; |
diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index 78e9cd708..5fcd91f68 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp | |||
| @@ -42,7 +42,9 @@ void BSD::PollWork::Execute(BSD* bsd) { | |||
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | void BSD::PollWork::Response(Kernel::HLERequestContext& ctx) { | 44 | void BSD::PollWork::Response(Kernel::HLERequestContext& ctx) { |
| 45 | ctx.WriteBuffer(write_buffer); | 45 | if (write_buffer.size() > 0) { |
| 46 | ctx.WriteBuffer(write_buffer); | ||
| 47 | } | ||
| 46 | 48 | ||
| 47 | IPC::ResponseBuilder rb{ctx, 4}; | 49 | IPC::ResponseBuilder rb{ctx, 4}; |
| 48 | rb.Push(RESULT_SUCCESS); | 50 | rb.Push(RESULT_SUCCESS); |
| @@ -55,7 +57,9 @@ void BSD::AcceptWork::Execute(BSD* bsd) { | |||
| 55 | } | 57 | } |
| 56 | 58 | ||
| 57 | void BSD::AcceptWork::Response(Kernel::HLERequestContext& ctx) { | 59 | void BSD::AcceptWork::Response(Kernel::HLERequestContext& ctx) { |
| 58 | ctx.WriteBuffer(write_buffer); | 60 | if (write_buffer.size() > 0) { |
| 61 | ctx.WriteBuffer(write_buffer); | ||
| 62 | } | ||
| 59 | 63 | ||
| 60 | IPC::ResponseBuilder rb{ctx, 5}; | 64 | IPC::ResponseBuilder rb{ctx, 5}; |
| 61 | rb.Push(RESULT_SUCCESS); | 65 | rb.Push(RESULT_SUCCESS); |
diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp index dea6b0fe0..6903dd534 100644 --- a/src/core/hle/service/spl/module.cpp +++ b/src/core/hle/service/spl/module.cpp | |||
| @@ -43,6 +43,11 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system | |||
| 43 | auto module = std::make_shared<Module>(); | 43 | auto module = std::make_shared<Module>(); |
| 44 | std::make_shared<CSRNG>(system, module)->InstallAsService(service_manager); | 44 | std::make_shared<CSRNG>(system, module)->InstallAsService(service_manager); |
| 45 | std::make_shared<SPL>(system, module)->InstallAsService(service_manager); | 45 | std::make_shared<SPL>(system, module)->InstallAsService(service_manager); |
| 46 | std::make_shared<SPL_MIG>(system, module)->InstallAsService(service_manager); | ||
| 47 | std::make_shared<SPL_FS>(system, module)->InstallAsService(service_manager); | ||
| 48 | std::make_shared<SPL_SSL>(system, module)->InstallAsService(service_manager); | ||
| 49 | std::make_shared<SPL_ES>(system, module)->InstallAsService(service_manager); | ||
| 50 | std::make_shared<SPL_MANU>(system, module)->InstallAsService(service_manager); | ||
| 46 | } | 51 | } |
| 47 | 52 | ||
| 48 | } // namespace Service::SPL | 53 | } // namespace Service::SPL |
diff --git a/src/core/hle/service/spl/spl.cpp b/src/core/hle/service/spl/spl.cpp index 3fabc2c79..4e212610f 100644 --- a/src/core/hle/service/spl/spl.cpp +++ b/src/core/hle/service/spl/spl.cpp | |||
| @@ -8,6 +8,24 @@ namespace Service::SPL { | |||
| 8 | 8 | ||
| 9 | SPL::SPL(Core::System& system_, std::shared_ptr<Module> module_) | 9 | SPL::SPL(Core::System& system_, std::shared_ptr<Module> module_) |
| 10 | : Interface(system_, std::move(module_), "spl:") { | 10 | : Interface(system_, std::move(module_), "spl:") { |
| 11 | // clang-format off | ||
| 12 | static const FunctionInfo functions[] = { | ||
| 13 | {0, nullptr, "GetConfig"}, | ||
| 14 | {1, nullptr, "ModularExponentiate"}, | ||
| 15 | {5, nullptr, "SetConfig"}, | ||
| 16 | {7, &SPL::GetRandomBytes, "GetRandomBytes"}, | ||
| 17 | {11, nullptr, "IsDevelopment"}, | ||
| 18 | {24, nullptr, "SetBootReason"}, | ||
| 19 | {25, nullptr, "GetBootReason"}, | ||
| 20 | }; | ||
| 21 | // clang-format on | ||
| 22 | |||
| 23 | RegisterHandlers(functions); | ||
| 24 | } | ||
| 25 | |||
| 26 | SPL_MIG::SPL_MIG(Core::System& system_, std::shared_ptr<Module> module_) | ||
| 27 | : Interface(system_, std::move(module_), "spl:mig") { | ||
| 28 | // clang-format off | ||
| 11 | static const FunctionInfo functions[] = { | 29 | static const FunctionInfo functions[] = { |
| 12 | {0, nullptr, "GetConfig"}, | 30 | {0, nullptr, "GetConfig"}, |
| 13 | {1, nullptr, "ModularExponentiate"}, | 31 | {1, nullptr, "ModularExponentiate"}, |
| @@ -15,19 +33,67 @@ SPL::SPL(Core::System& system_, std::shared_ptr<Module> module_) | |||
| 15 | {3, nullptr, "LoadAesKey"}, | 33 | {3, nullptr, "LoadAesKey"}, |
| 16 | {4, nullptr, "GenerateAesKey"}, | 34 | {4, nullptr, "GenerateAesKey"}, |
| 17 | {5, nullptr, "SetConfig"}, | 35 | {5, nullptr, "SetConfig"}, |
| 18 | {7, &SPL::GetRandomBytes, "GetRandomBytes"}, | 36 | {7, &SPL::GetRandomBytes, "GenerateRandomBytes"}, |
| 19 | {9, nullptr, "ImportLotusKey"}, | 37 | {11, nullptr, "IsDevelopment"}, |
| 20 | {10, nullptr, "DecryptLotusMessage"}, | 38 | {14, nullptr, "DecryptAesKey"}, |
| 39 | {15, nullptr, "CryptAesCtr"}, | ||
| 40 | {16, nullptr, "ComputeCmac"}, | ||
| 41 | {21, nullptr, "AllocateAesKeyslot"}, | ||
| 42 | {22, nullptr, "DeallocateAesKeySlot"}, | ||
| 43 | {23, nullptr, "GetAesKeyslotAvailableEvent"}, | ||
| 44 | {24, nullptr, "SetBootReason"}, | ||
| 45 | {25, nullptr, "GetBootReason"}, | ||
| 46 | }; | ||
| 47 | // clang-format on | ||
| 48 | |||
| 49 | RegisterHandlers(functions); | ||
| 50 | } | ||
| 51 | |||
| 52 | SPL_FS::SPL_FS(Core::System& system_, std::shared_ptr<Module> module_) | ||
| 53 | : Interface(system_, std::move(module_), "spl:fs") { | ||
| 54 | // clang-format off | ||
| 55 | static const FunctionInfo functions[] = { | ||
| 56 | {0, nullptr, "GetConfig"}, | ||
| 57 | {1, nullptr, "ModularExponentiate"}, | ||
| 58 | {2, nullptr, "GenerateAesKek"}, | ||
| 59 | {3, nullptr, "LoadAesKey"}, | ||
| 60 | {4, nullptr, "GenerateAesKey"}, | ||
| 61 | {5, nullptr, "SetConfig"}, | ||
| 62 | {7, &SPL::GetRandomBytes, "GenerateRandomBytes"}, | ||
| 21 | {11, nullptr, "IsDevelopment"}, | 63 | {11, nullptr, "IsDevelopment"}, |
| 22 | {12, nullptr, "GenerateSpecificAesKey"}, | 64 | {12, nullptr, "GenerateSpecificAesKey"}, |
| 23 | {13, nullptr, "DecryptDeviceUniqueData"}, | ||
| 24 | {14, nullptr, "DecryptAesKey"}, | 65 | {14, nullptr, "DecryptAesKey"}, |
| 25 | {15, nullptr, "CryptAesCtr"}, | 66 | {15, nullptr, "CryptAesCtr"}, |
| 26 | {16, nullptr, "ComputeCmac"}, | 67 | {16, nullptr, "ComputeCmac"}, |
| 27 | {17, nullptr, "ImportEsKey"}, | ||
| 28 | {18, nullptr, "UnwrapTitleKey"}, | ||
| 29 | {19, nullptr, "LoadTitleKey"}, | 68 | {19, nullptr, "LoadTitleKey"}, |
| 30 | {20, nullptr, "PrepareEsCommonKey"}, | 69 | {21, nullptr, "AllocateAesKeyslot"}, |
| 70 | {22, nullptr, "DeallocateAesKeySlot"}, | ||
| 71 | {23, nullptr, "GetAesKeyslotAvailableEvent"}, | ||
| 72 | {24, nullptr, "SetBootReason"}, | ||
| 73 | {25, nullptr, "GetBootReason"}, | ||
| 74 | {31, nullptr, "GetPackage2Hash"}, | ||
| 75 | }; | ||
| 76 | // clang-format on | ||
| 77 | |||
| 78 | RegisterHandlers(functions); | ||
| 79 | } | ||
| 80 | |||
| 81 | SPL_SSL::SPL_SSL(Core::System& system_, std::shared_ptr<Module> module_) | ||
| 82 | : Interface(system_, std::move(module_), "spl:ssl") { | ||
| 83 | // clang-format off | ||
| 84 | static const FunctionInfo functions[] = { | ||
| 85 | {0, nullptr, "GetConfig"}, | ||
| 86 | {1, nullptr, "ModularExponentiate"}, | ||
| 87 | {2, nullptr, "GenerateAesKek"}, | ||
| 88 | {3, nullptr, "LoadAesKey"}, | ||
| 89 | {4, nullptr, "GenerateAesKey"}, | ||
| 90 | {5, nullptr, "SetConfig"}, | ||
| 91 | {7, &SPL::GetRandomBytes, "GetRandomBytes"}, | ||
| 92 | {11, nullptr, "IsDevelopment"}, | ||
| 93 | {13, nullptr, "DecryptDeviceUniqueData"}, | ||
| 94 | {14, nullptr, "DecryptAesKey"}, | ||
| 95 | {15, nullptr, "CryptAesCtr"}, | ||
| 96 | {16, nullptr, "ComputeCmac"}, | ||
| 31 | {21, nullptr, "AllocateAesKeyslot"}, | 97 | {21, nullptr, "AllocateAesKeyslot"}, |
| 32 | {22, nullptr, "DeallocateAesKeySlot"}, | 98 | {22, nullptr, "DeallocateAesKeySlot"}, |
| 33 | {23, nullptr, "GetAesKeyslotAvailableEvent"}, | 99 | {23, nullptr, "GetAesKeyslotAvailableEvent"}, |
| @@ -35,15 +101,83 @@ SPL::SPL(Core::System& system_, std::shared_ptr<Module> module_) | |||
| 35 | {25, nullptr, "GetBootReason"}, | 101 | {25, nullptr, "GetBootReason"}, |
| 36 | {26, nullptr, "DecryptAndStoreSslClientCertKey"}, | 102 | {26, nullptr, "DecryptAndStoreSslClientCertKey"}, |
| 37 | {27, nullptr, "ModularExponentiateWithSslClientCertKey"}, | 103 | {27, nullptr, "ModularExponentiateWithSslClientCertKey"}, |
| 104 | }; | ||
| 105 | // clang-format on | ||
| 106 | |||
| 107 | RegisterHandlers(functions); | ||
| 108 | } | ||
| 109 | |||
| 110 | SPL_ES::SPL_ES(Core::System& system_, std::shared_ptr<Module> module_) | ||
| 111 | : Interface(system_, std::move(module_), "spl:es") { | ||
| 112 | // clang-format off | ||
| 113 | static const FunctionInfo functions[] = { | ||
| 114 | {0, nullptr, "GetConfig"}, | ||
| 115 | {1, nullptr, "ModularExponentiate"}, | ||
| 116 | {2, nullptr, "GenerateAesKek"}, | ||
| 117 | {3, nullptr, "LoadAesKey"}, | ||
| 118 | {4, nullptr, "GenerateAesKey"}, | ||
| 119 | {5, nullptr, "SetConfig"}, | ||
| 120 | {7, &SPL::GetRandomBytes, "GenerateRandomBytes"}, | ||
| 121 | {11, nullptr, "IsDevelopment"}, | ||
| 122 | {13, nullptr, "DecryptDeviceUniqueData"}, | ||
| 123 | {14, nullptr, "DecryptAesKey"}, | ||
| 124 | {15, nullptr, "CryptAesCtr"}, | ||
| 125 | {16, nullptr, "ComputeCmac"}, | ||
| 126 | {18, nullptr, "UnwrapTitleKey"}, | ||
| 127 | {20, nullptr, "PrepareEsCommonKey"}, | ||
| 128 | {21, nullptr, "AllocateAesKeyslot"}, | ||
| 129 | {22, nullptr, "DeallocateAesKeySlot"}, | ||
| 130 | {23, nullptr, "GetAesKeyslotAvailableEvent"}, | ||
| 131 | {24, nullptr, "SetBootReason"}, | ||
| 132 | {25, nullptr, "GetBootReason"}, | ||
| 38 | {28, nullptr, "DecryptAndStoreDrmDeviceCertKey"}, | 133 | {28, nullptr, "DecryptAndStoreDrmDeviceCertKey"}, |
| 39 | {29, nullptr, "ModularExponentiateWithDrmDeviceCertKey"}, | 134 | {29, nullptr, "ModularExponentiateWithDrmDeviceCertKey"}, |
| 40 | {30, nullptr, "ReencryptDeviceUniqueData "}, | 135 | {31, nullptr, "PrepareEsArchiveKey"}, |
| 41 | {31, nullptr, "PrepareEsArchiveKey"}, // This is also GetPackage2Hash? | ||
| 42 | {32, nullptr, "LoadPreparedAesKey"}, | 136 | {32, nullptr, "LoadPreparedAesKey"}, |
| 43 | }; | 137 | }; |
| 138 | // clang-format on | ||
| 139 | |||
| 140 | RegisterHandlers(functions); | ||
| 141 | } | ||
| 142 | |||
| 143 | SPL_MANU::SPL_MANU(Core::System& system_, std::shared_ptr<Module> module_) | ||
| 144 | : Interface(system_, std::move(module_), "spl:manu") { | ||
| 145 | // clang-format off | ||
| 146 | static const FunctionInfo functions[] = { | ||
| 147 | {0, nullptr, "GetConfig"}, | ||
| 148 | {1, nullptr, "ModularExponentiate"}, | ||
| 149 | {2, nullptr, "GenerateAesKek"}, | ||
| 150 | {3, nullptr, "LoadAesKey"}, | ||
| 151 | {4, nullptr, "GenerateAesKey"}, | ||
| 152 | {5, nullptr, "SetConfig"}, | ||
| 153 | {7, &SPL::GetRandomBytes, "GetRandomBytes"}, | ||
| 154 | {11, nullptr, "IsDevelopment"}, | ||
| 155 | {13, nullptr, "DecryptDeviceUniqueData"}, | ||
| 156 | {14, nullptr, "DecryptAesKey"}, | ||
| 157 | {15, nullptr, "CryptAesCtr"}, | ||
| 158 | {16, nullptr, "ComputeCmac"}, | ||
| 159 | {21, nullptr, "AllocateAesKeyslot"}, | ||
| 160 | {22, nullptr, "DeallocateAesKeySlot"}, | ||
| 161 | {23, nullptr, "GetAesKeyslotAvailableEvent"}, | ||
| 162 | {24, nullptr, "SetBootReason"}, | ||
| 163 | {25, nullptr, "GetBootReason"}, | ||
| 164 | {30, nullptr, "ReencryptDeviceUniqueData"}, | ||
| 165 | }; | ||
| 166 | // clang-format on | ||
| 167 | |||
| 44 | RegisterHandlers(functions); | 168 | RegisterHandlers(functions); |
| 45 | } | 169 | } |
| 46 | 170 | ||
| 47 | SPL::~SPL() = default; | 171 | SPL::~SPL() = default; |
| 48 | 172 | ||
| 173 | SPL_MIG::~SPL_MIG() = default; | ||
| 174 | |||
| 175 | SPL_FS::~SPL_FS() = default; | ||
| 176 | |||
| 177 | SPL_SSL::~SPL_SSL() = default; | ||
| 178 | |||
| 179 | SPL_ES::~SPL_ES() = default; | ||
| 180 | |||
| 181 | SPL_MANU::~SPL_MANU() = default; | ||
| 182 | |||
| 49 | } // namespace Service::SPL | 183 | } // namespace Service::SPL |
diff --git a/src/core/hle/service/spl/spl.h b/src/core/hle/service/spl/spl.h index d27d16b86..9b35012ed 100644 --- a/src/core/hle/service/spl/spl.h +++ b/src/core/hle/service/spl/spl.h | |||
| @@ -18,4 +18,34 @@ public: | |||
| 18 | ~SPL() override; | 18 | ~SPL() override; |
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | class SPL_MIG final : public Module::Interface { | ||
| 22 | public: | ||
| 23 | explicit SPL_MIG(Core::System& system_, std::shared_ptr<Module> module_); | ||
| 24 | ~SPL_MIG() override; | ||
| 25 | }; | ||
| 26 | |||
| 27 | class SPL_FS final : public Module::Interface { | ||
| 28 | public: | ||
| 29 | explicit SPL_FS(Core::System& system_, std::shared_ptr<Module> module_); | ||
| 30 | ~SPL_FS() override; | ||
| 31 | }; | ||
| 32 | |||
| 33 | class SPL_SSL final : public Module::Interface { | ||
| 34 | public: | ||
| 35 | explicit SPL_SSL(Core::System& system_, std::shared_ptr<Module> module_); | ||
| 36 | ~SPL_SSL() override; | ||
| 37 | }; | ||
| 38 | |||
| 39 | class SPL_ES final : public Module::Interface { | ||
| 40 | public: | ||
| 41 | explicit SPL_ES(Core::System& system_, std::shared_ptr<Module> module_); | ||
| 42 | ~SPL_ES() override; | ||
| 43 | }; | ||
| 44 | |||
| 45 | class SPL_MANU final : public Module::Interface { | ||
| 46 | public: | ||
| 47 | explicit SPL_MANU(Core::System& system_, std::shared_ptr<Module> module_); | ||
| 48 | ~SPL_MANU() override; | ||
| 49 | }; | ||
| 50 | |||
| 21 | } // namespace Service::SPL | 51 | } // namespace Service::SPL |
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index 16c942e21..78543688f 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp | |||
| @@ -140,6 +140,8 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal( | |||
| 140 | 140 | ||
| 141 | const auto current_time_point{ | 141 | const auto current_time_point{ |
| 142 | time_manager.GetStandardSteadyClockCore().GetCurrentTimePoint(system)}; | 142 | time_manager.GetStandardSteadyClockCore().GetCurrentTimePoint(system)}; |
| 143 | clock_snapshot.steady_clock_time_point = current_time_point; | ||
| 144 | |||
| 143 | if (const ResultCode result{Clock::ClockSnapshot::GetCurrentTime( | 145 | if (const ResultCode result{Clock::ClockSnapshot::GetCurrentTime( |
| 144 | clock_snapshot.user_time, current_time_point, clock_snapshot.user_context)}; | 146 | clock_snapshot.user_time, current_time_point, clock_snapshot.user_context)}; |
| 145 | result != RESULT_SUCCESS) { | 147 | result != RESULT_SUCCESS) { |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 8661895ae..7423287ea 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -1217,6 +1217,32 @@ private: | |||
| 1217 | } | 1217 | } |
| 1218 | } | 1218 | } |
| 1219 | 1219 | ||
| 1220 | void GetIndirectLayerImageMap(Kernel::HLERequestContext& ctx) { | ||
| 1221 | IPC::RequestParser rp{ctx}; | ||
| 1222 | const auto width = rp.Pop<s64>(); | ||
| 1223 | const auto height = rp.Pop<s64>(); | ||
| 1224 | const auto indirect_layer_consumer_handle = rp.Pop<u64>(); | ||
| 1225 | const auto applet_resource_user_id = rp.Pop<u64>(); | ||
| 1226 | |||
| 1227 | LOG_WARNING(Service_VI, | ||
| 1228 | "(STUBBED) called, width={}, height={}, indirect_layer_consumer_handle={}, " | ||
| 1229 | "applet_resource_user_id={}", | ||
| 1230 | width, height, indirect_layer_consumer_handle, applet_resource_user_id); | ||
| 1231 | |||
| 1232 | std::vector<u8> out_buffer(0x46); | ||
| 1233 | ctx.WriteBuffer(out_buffer); | ||
| 1234 | |||
| 1235 | // TODO: Figure out what these are | ||
| 1236 | |||
| 1237 | constexpr s64 unknown_result_1 = 0; | ||
| 1238 | constexpr s64 unknown_result_2 = 0; | ||
| 1239 | |||
| 1240 | IPC::ResponseBuilder rb{ctx, 6}; | ||
| 1241 | rb.Push(unknown_result_1); | ||
| 1242 | rb.Push(unknown_result_2); | ||
| 1243 | rb.Push(RESULT_SUCCESS); | ||
| 1244 | } | ||
| 1245 | |||
| 1220 | void GetIndirectLayerImageRequiredMemoryInfo(Kernel::HLERequestContext& ctx) { | 1246 | void GetIndirectLayerImageRequiredMemoryInfo(Kernel::HLERequestContext& ctx) { |
| 1221 | IPC::RequestParser rp{ctx}; | 1247 | IPC::RequestParser rp{ctx}; |
| 1222 | const auto width = rp.Pop<u64>(); | 1248 | const auto width = rp.Pop<u64>(); |
| @@ -1276,7 +1302,7 @@ IApplicationDisplayService::IApplicationDisplayService(Core::System& system_, | |||
| 1276 | {2031, &IApplicationDisplayService::DestroyStrayLayer, "DestroyStrayLayer"}, | 1302 | {2031, &IApplicationDisplayService::DestroyStrayLayer, "DestroyStrayLayer"}, |
| 1277 | {2101, &IApplicationDisplayService::SetLayerScalingMode, "SetLayerScalingMode"}, | 1303 | {2101, &IApplicationDisplayService::SetLayerScalingMode, "SetLayerScalingMode"}, |
| 1278 | {2102, &IApplicationDisplayService::ConvertScalingMode, "ConvertScalingMode"}, | 1304 | {2102, &IApplicationDisplayService::ConvertScalingMode, "ConvertScalingMode"}, |
| 1279 | {2450, nullptr, "GetIndirectLayerImageMap"}, | 1305 | {2450, &IApplicationDisplayService::GetIndirectLayerImageMap, "GetIndirectLayerImageMap"}, |
| 1280 | {2451, nullptr, "GetIndirectLayerImageCropMap"}, | 1306 | {2451, nullptr, "GetIndirectLayerImageCropMap"}, |
| 1281 | {2460, &IApplicationDisplayService::GetIndirectLayerImageRequiredMemoryInfo, | 1307 | {2460, &IApplicationDisplayService::GetIndirectLayerImageRequiredMemoryInfo, |
| 1282 | "GetIndirectLayerImageRequiredMemoryInfo"}, | 1308 | "GetIndirectLayerImageRequiredMemoryInfo"}, |
diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp index 1ae5f1d62..5776fccdc 100644 --- a/src/video_core/renderer_opengl/gl_device.cpp +++ b/src/video_core/renderer_opengl/gl_device.cpp | |||
| @@ -210,6 +210,12 @@ Device::Device() { | |||
| 210 | const bool is_amd = vendor == "ATI Technologies Inc."; | 210 | const bool is_amd = vendor == "ATI Technologies Inc."; |
| 211 | const bool is_intel = vendor == "Intel"; | 211 | const bool is_intel = vendor == "Intel"; |
| 212 | 212 | ||
| 213 | #ifdef __unix__ | ||
| 214 | const bool is_linux = true; | ||
| 215 | #else | ||
| 216 | const bool is_linux = false; | ||
| 217 | #endif | ||
| 218 | |||
| 213 | bool disable_fast_buffer_sub_data = false; | 219 | bool disable_fast_buffer_sub_data = false; |
| 214 | if (is_nvidia && version == "4.6.0 NVIDIA 443.24") { | 220 | if (is_nvidia && version == "4.6.0 NVIDIA 443.24") { |
| 215 | LOG_WARNING( | 221 | LOG_WARNING( |
| @@ -249,7 +255,9 @@ Device::Device() { | |||
| 249 | GLAD_GL_NV_gpu_program5 && GLAD_GL_NV_compute_program5 && | 255 | GLAD_GL_NV_gpu_program5 && GLAD_GL_NV_compute_program5 && |
| 250 | GLAD_GL_NV_transform_feedback && GLAD_GL_NV_transform_feedback2; | 256 | GLAD_GL_NV_transform_feedback && GLAD_GL_NV_transform_feedback2; |
| 251 | 257 | ||
| 252 | use_asynchronous_shaders = Settings::values.use_asynchronous_shaders.GetValue(); | 258 | // Blocks AMD and Intel OpenGL drivers on Windows from using asynchronous shader compilation. |
| 259 | use_asynchronous_shaders = Settings::values.use_asynchronous_shaders.GetValue() && | ||
| 260 | !(is_amd || (is_intel && !is_linux)); | ||
| 253 | use_driver_cache = is_nvidia; | 261 | use_driver_cache = is_nvidia; |
| 254 | 262 | ||
| 255 | LOG_INFO(Render_OpenGL, "Renderer_VariableAOFFI: {}", has_variable_aoffi); | 263 | LOG_INFO(Render_OpenGL, "Renderer_VariableAOFFI: {}", has_variable_aoffi); |
| @@ -261,6 +269,10 @@ Device::Device() { | |||
| 261 | if (Settings::values.use_assembly_shaders.GetValue() && !use_assembly_shaders) { | 269 | if (Settings::values.use_assembly_shaders.GetValue() && !use_assembly_shaders) { |
| 262 | LOG_ERROR(Render_OpenGL, "Assembly shaders enabled but not supported"); | 270 | LOG_ERROR(Render_OpenGL, "Assembly shaders enabled but not supported"); |
| 263 | } | 271 | } |
| 272 | |||
| 273 | if (Settings::values.use_asynchronous_shaders.GetValue() && !use_asynchronous_shaders) { | ||
| 274 | LOG_WARNING(Render_OpenGL, "Asynchronous shader compilation enabled but not supported"); | ||
| 275 | } | ||
| 264 | } | 276 | } |
| 265 | 277 | ||
| 266 | Device::Device(std::nullptr_t) { | 278 | Device::Device(std::nullptr_t) { |
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 34d396434..697cb16b9 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -51,7 +51,7 @@ constexpr std::array REQUIRED_EXTENSIONS{ | |||
| 51 | #ifdef _WIN32 | 51 | #ifdef _WIN32 |
| 52 | VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME, | 52 | VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME, |
| 53 | #endif | 53 | #endif |
| 54 | #ifdef __linux__ | 54 | #ifdef __unix__ |
| 55 | VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME, | 55 | VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME, |
| 56 | #endif | 56 | #endif |
| 57 | }; | 57 | }; |
diff --git a/src/video_core/vulkan_common/vulkan_memory_allocator.cpp b/src/video_core/vulkan_common/vulkan_memory_allocator.cpp index 2a8b7a907..fa37aa79a 100644 --- a/src/video_core/vulkan_common/vulkan_memory_allocator.cpp +++ b/src/video_core/vulkan_common/vulkan_memory_allocator.cpp | |||
| @@ -62,7 +62,7 @@ public: | |||
| 62 | : memory{std::move(memory_)}, allocation_size{allocation_size_}, property_flags{properties}, | 62 | : memory{std::move(memory_)}, allocation_size{allocation_size_}, property_flags{properties}, |
| 63 | shifted_memory_type{1U << type} {} | 63 | shifted_memory_type{1U << type} {} |
| 64 | 64 | ||
| 65 | #if defined(_WIN32) || defined(__linux__) | 65 | #if defined(_WIN32) || defined(__unix__) |
| 66 | ~MemoryAllocation() { | 66 | ~MemoryAllocation() { |
| 67 | if (owning_opengl_handle != 0) { | 67 | if (owning_opengl_handle != 0) { |
| 68 | glDeleteMemoryObjectsEXT(1, &owning_opengl_handle); | 68 | glDeleteMemoryObjectsEXT(1, &owning_opengl_handle); |
| @@ -114,7 +114,7 @@ public: | |||
| 114 | } | 114 | } |
| 115 | return owning_opengl_handle; | 115 | return owning_opengl_handle; |
| 116 | } | 116 | } |
| 117 | #elif __linux__ | 117 | #elif __unix__ |
| 118 | [[nodiscard]] u32 ExportOpenGLHandle() { | 118 | [[nodiscard]] u32 ExportOpenGLHandle() { |
| 119 | if (!owning_opengl_handle) { | 119 | if (!owning_opengl_handle) { |
| 120 | glCreateMemoryObjectsEXT(1, &owning_opengl_handle); | 120 | glCreateMemoryObjectsEXT(1, &owning_opengl_handle); |
| @@ -165,7 +165,7 @@ private: | |||
| 165 | const u32 shifted_memory_type; ///< Shifted Vulkan memory type. | 165 | const u32 shifted_memory_type; ///< Shifted Vulkan memory type. |
| 166 | std::vector<Range> commits; ///< All commit ranges done from this allocation. | 166 | std::vector<Range> commits; ///< All commit ranges done from this allocation. |
| 167 | std::span<u8> memory_mapped_span; ///< Memory mapped span. Empty if not queried before. | 167 | std::span<u8> memory_mapped_span; ///< Memory mapped span. Empty if not queried before. |
| 168 | #if defined(_WIN32) || defined(__linux__) | 168 | #if defined(_WIN32) || defined(__unix__) |
| 169 | u32 owning_opengl_handle{}; ///< Owning OpenGL memory object handle. | 169 | u32 owning_opengl_handle{}; ///< Owning OpenGL memory object handle. |
| 170 | #endif | 170 | #endif |
| 171 | }; | 171 | }; |
| @@ -249,7 +249,7 @@ void MemoryAllocator::AllocMemory(VkMemoryPropertyFlags flags, u32 type_mask, u6 | |||
| 249 | .pNext = nullptr, | 249 | .pNext = nullptr, |
| 250 | #ifdef _WIN32 | 250 | #ifdef _WIN32 |
| 251 | .handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT, | 251 | .handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT, |
| 252 | #elif __linux__ | 252 | #elif __unix__ |
| 253 | .handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT, | 253 | .handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT, |
| 254 | #else | 254 | #else |
| 255 | .handleTypes = 0, | 255 | .handleTypes = 0, |
diff --git a/src/yuzu/configuration/configure_filesystem.cpp b/src/yuzu/configuration/configure_filesystem.cpp index bde2d4620..58f644af4 100644 --- a/src/yuzu/configuration/configure_filesystem.cpp +++ b/src/yuzu/configuration/configure_filesystem.cpp | |||
| @@ -103,7 +103,10 @@ void ConfigureFilesystem::SetDirectory(DirectoryTarget target, QLineEdit* edit) | |||
| 103 | str = QFileDialog::getOpenFileName(this, caption, QFileInfo(edit->text()).dir().path(), | 103 | str = QFileDialog::getOpenFileName(this, caption, QFileInfo(edit->text()).dir().path(), |
| 104 | QStringLiteral("NX Gamecard;*.xci")); | 104 | QStringLiteral("NX Gamecard;*.xci")); |
| 105 | } else { | 105 | } else { |
| 106 | str = QFileDialog::getExistingDirectory(this, caption, edit->text()) + QDir::separator(); | 106 | str = QFileDialog::getExistingDirectory(this, caption, edit->text()); |
| 107 | if (!str.isNull() && str.back() != QDir::separator()) { | ||
| 108 | str.append(QDir::separator()); | ||
| 109 | } | ||
| 107 | } | 110 | } |
| 108 | 111 | ||
| 109 | if (str.isEmpty()) | 112 | if (str.isEmpty()) |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 24bfa4d34..06445b993 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -320,6 +320,34 @@ GMainWindow::GMainWindow() | |||
| 320 | continue; | 320 | continue; |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | // Launch game with a specific user | ||
| 324 | if (args[i] == QStringLiteral("-u")) { | ||
| 325 | if (i >= args.size() - 1) { | ||
| 326 | continue; | ||
| 327 | } | ||
| 328 | |||
| 329 | if (args[i + 1].startsWith(QChar::fromLatin1('-'))) { | ||
| 330 | continue; | ||
| 331 | } | ||
| 332 | |||
| 333 | bool argument_ok; | ||
| 334 | const std::size_t selected_user = args[++i].toUInt(&argument_ok); | ||
| 335 | |||
| 336 | if (!argument_ok) { | ||
| 337 | LOG_ERROR(Frontend, "Invalid user argument"); | ||
| 338 | continue; | ||
| 339 | } | ||
| 340 | |||
| 341 | const Service::Account::ProfileManager manager; | ||
| 342 | if (!manager.UserExistsIndex(selected_user)) { | ||
| 343 | LOG_ERROR(Frontend, "Selected user doesn't exist"); | ||
| 344 | continue; | ||
| 345 | } | ||
| 346 | |||
| 347 | Settings::values.current_user = selected_user; | ||
| 348 | continue; | ||
| 349 | } | ||
| 350 | |||
| 323 | // Launch game at path | 351 | // Launch game at path |
| 324 | if (args[i] == QStringLiteral("-g")) { | 352 | if (args[i] == QStringLiteral("-g")) { |
| 325 | if (i >= args.size() - 1) { | 353 | if (i >= args.size() - 1) { |