diff options
Diffstat (limited to 'src')
40 files changed, 647 insertions, 147 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index b2b071e7e..61969af2b 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -140,7 +140,7 @@ struct Values { | |||
| 140 | Category::LibraryApplet}; | 140 | Category::LibraryApplet}; |
| 141 | Setting<AppletMode> data_erase_applet_mode{linkage, AppletMode::HLE, "data_erase_applet_mode", | 141 | Setting<AppletMode> data_erase_applet_mode{linkage, AppletMode::HLE, "data_erase_applet_mode", |
| 142 | Category::LibraryApplet}; | 142 | Category::LibraryApplet}; |
| 143 | Setting<AppletMode> error_applet_mode{linkage, AppletMode::HLE, "error_applet_mode", | 143 | Setting<AppletMode> error_applet_mode{linkage, AppletMode::LLE, "error_applet_mode", |
| 144 | Category::LibraryApplet}; | 144 | Category::LibraryApplet}; |
| 145 | Setting<AppletMode> net_connect_applet_mode{linkage, AppletMode::HLE, "net_connect_applet_mode", | 145 | Setting<AppletMode> net_connect_applet_mode{linkage, AppletMode::HLE, "net_connect_applet_mode", |
| 146 | Category::LibraryApplet}; | 146 | Category::LibraryApplet}; |
| @@ -435,8 +435,6 @@ struct Values { | |||
| 435 | linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug}; | 435 | linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug}; |
| 436 | Setting<bool> enable_renderdoc_hotkey{linkage, false, "renderdoc_hotkey", | 436 | Setting<bool> enable_renderdoc_hotkey{linkage, false, "renderdoc_hotkey", |
| 437 | Category::RendererDebug}; | 437 | Category::RendererDebug}; |
| 438 | // TODO: remove this once AMDVLK supports VK_EXT_depth_bias_control | ||
| 439 | bool renderer_amdvlk_depth_bias_workaround{}; | ||
| 440 | Setting<bool> disable_buffer_reorder{linkage, false, "disable_buffer_reorder", | 438 | Setting<bool> disable_buffer_reorder{linkage, false, "disable_buffer_reorder", |
| 441 | Category::RendererDebug}; | 439 | Category::RendererDebug}; |
| 442 | 440 | ||
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 1eb43d816..63a6da12e 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -1047,9 +1047,12 @@ add_library(core STATIC | |||
| 1047 | hle/service/spl/spl_module.h | 1047 | hle/service/spl/spl_module.h |
| 1048 | hle/service/spl/spl_results.h | 1048 | hle/service/spl/spl_results.h |
| 1049 | hle/service/spl/spl_types.h | 1049 | hle/service/spl/spl_types.h |
| 1050 | hle/service/ssl/cert_store.cpp | ||
| 1051 | hle/service/ssl/cert_store.h | ||
| 1050 | hle/service/ssl/ssl.cpp | 1052 | hle/service/ssl/ssl.cpp |
| 1051 | hle/service/ssl/ssl.h | 1053 | hle/service/ssl/ssl.h |
| 1052 | hle/service/ssl/ssl_backend.h | 1054 | hle/service/ssl/ssl_backend.h |
| 1055 | hle/service/ssl/ssl_types.h | ||
| 1053 | hle/service/usb/usb.cpp | 1056 | hle/service/usb/usb.cpp |
| 1054 | hle/service/usb/usb.h | 1057 | hle/service/usb/usb.h |
| 1055 | hle/service/vi/application_display_service.cpp | 1058 | hle/service/vi/application_display_service.cpp |
diff --git a/src/core/core.cpp b/src/core/core.cpp index 9e8936728..dc515bc82 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -425,11 +425,6 @@ struct System::Impl { | |||
| 425 | room_member->SendGameInfo(game_info); | 425 | room_member->SendGameInfo(game_info); |
| 426 | } | 426 | } |
| 427 | 427 | ||
| 428 | // Workarounds: | ||
| 429 | // Activate this in Super Smash Brothers Ultimate, it only affects AMD cards using AMDVLK | ||
| 430 | Settings::values.renderer_amdvlk_depth_bias_workaround = | ||
| 431 | params.program_id == 0x1006A800016E000ULL; | ||
| 432 | |||
| 433 | status = SystemResultStatus::Success; | 428 | status = SystemResultStatus::Success; |
| 434 | return status; | 429 | return status; |
| 435 | } | 430 | } |
| @@ -489,9 +484,6 @@ struct System::Impl { | |||
| 489 | room_member->SendGameInfo(game_info); | 484 | room_member->SendGameInfo(game_info); |
| 490 | } | 485 | } |
| 491 | 486 | ||
| 492 | // Workarounds | ||
| 493 | Settings::values.renderer_amdvlk_depth_bias_workaround = false; | ||
| 494 | |||
| 495 | LOG_DEBUG(Core, "Shutdown OK"); | 487 | LOG_DEBUG(Core, "Shutdown OK"); |
| 496 | } | 488 | } |
| 497 | 489 | ||
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index f21553644..fad111d44 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -25,8 +25,8 @@ | |||
| 25 | #include "core/hle/service/acc/async_context.h" | 25 | #include "core/hle/service/acc/async_context.h" |
| 26 | #include "core/hle/service/acc/errors.h" | 26 | #include "core/hle/service/acc/errors.h" |
| 27 | #include "core/hle/service/acc/profile_manager.h" | 27 | #include "core/hle/service/acc/profile_manager.h" |
| 28 | #include "core/hle/service/cmif_serialization.h" | ||
| 28 | #include "core/hle/service/glue/glue_manager.h" | 29 | #include "core/hle/service/glue/glue_manager.h" |
| 29 | #include "core/hle/service/ipc_helpers.h" | ||
| 30 | #include "core/hle/service/server_manager.h" | 30 | #include "core/hle/service/server_manager.h" |
| 31 | #include "core/loader/loader.h" | 31 | #include "core/loader/loader.h" |
| 32 | 32 | ||
| @@ -74,12 +74,12 @@ static void SanitizeJPEGImageSize(std::vector<u8>& image) { | |||
| 74 | 74 | ||
| 75 | class IManagerForSystemService final : public ServiceFramework<IManagerForSystemService> { | 75 | class IManagerForSystemService final : public ServiceFramework<IManagerForSystemService> { |
| 76 | public: | 76 | public: |
| 77 | explicit IManagerForSystemService(Core::System& system_, Common::UUID) | 77 | explicit IManagerForSystemService(Core::System& system_, Common::UUID uuid) |
| 78 | : ServiceFramework{system_, "IManagerForSystemService"} { | 78 | : ServiceFramework{system_, "IManagerForSystemService"}, account_id{uuid} { |
| 79 | // clang-format off | 79 | // clang-format off |
| 80 | static const FunctionInfo functions[] = { | 80 | static const FunctionInfo functions[] = { |
| 81 | {0, &IManagerForSystemService::CheckAvailability, "CheckAvailability"}, | 81 | {0, D<&IManagerForSystemService::CheckAvailability>, "CheckAvailability"}, |
| 82 | {1, nullptr, "GetAccountId"}, | 82 | {1, D<&IManagerForSystemService::GetAccountId>, "GetAccountId"}, |
| 83 | {2, nullptr, "EnsureIdTokenCacheAsync"}, | 83 | {2, nullptr, "EnsureIdTokenCacheAsync"}, |
| 84 | {3, nullptr, "LoadIdTokenCache"}, | 84 | {3, nullptr, "LoadIdTokenCache"}, |
| 85 | {100, nullptr, "SetSystemProgramIdentification"}, | 85 | {100, nullptr, "SetSystemProgramIdentification"}, |
| @@ -109,11 +109,18 @@ public: | |||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | private: | 111 | private: |
| 112 | void CheckAvailability(HLERequestContext& ctx) { | 112 | Result CheckAvailability() { |
| 113 | LOG_WARNING(Service_ACC, "(STUBBED) called"); | 113 | LOG_WARNING(Service_ACC, "(STUBBED) called"); |
| 114 | IPC::ResponseBuilder rb{ctx, 2}; | 114 | R_SUCCEED(); |
| 115 | rb.Push(ResultSuccess); | ||
| 116 | } | 115 | } |
| 116 | |||
| 117 | Result GetAccountId(Out<u64> out_account_id) { | ||
| 118 | LOG_WARNING(Service_ACC, "(STUBBED) called"); | ||
| 119 | *out_account_id = account_id.Hash(); | ||
| 120 | R_SUCCEED(); | ||
| 121 | } | ||
| 122 | |||
| 123 | Common::UUID account_id; | ||
| 117 | }; | 124 | }; |
| 118 | 125 | ||
| 119 | // 3.0.0+ | 126 | // 3.0.0+ |
diff --git a/src/core/hle/service/acc/acc_u1.cpp b/src/core/hle/service/acc/acc_u1.cpp index 92f704c2f..eecc94387 100644 --- a/src/core/hle/service/acc/acc_u1.cpp +++ b/src/core/hle/service/acc/acc_u1.cpp | |||
| @@ -23,7 +23,7 @@ ACC_U1::ACC_U1(std::shared_ptr<Module> module_, std::shared_ptr<ProfileManager> | |||
| 23 | {99, nullptr, "DebugActivateOpenContextRetention"}, | 23 | {99, nullptr, "DebugActivateOpenContextRetention"}, |
| 24 | {100, nullptr, "GetUserRegistrationNotifier"}, | 24 | {100, nullptr, "GetUserRegistrationNotifier"}, |
| 25 | {101, nullptr, "GetUserStateChangeNotifier"}, | 25 | {101, nullptr, "GetUserStateChangeNotifier"}, |
| 26 | {102, nullptr, "GetBaasAccountManagerForSystemService"}, | 26 | {102, &ACC_U1::GetBaasAccountManagerForSystemService, "GetBaasAccountManagerForSystemService"}, |
| 27 | {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, | 27 | {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, |
| 28 | {104, nullptr, "GetProfileUpdateNotifier"}, | 28 | {104, nullptr, "GetProfileUpdateNotifier"}, |
| 29 | {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, | 29 | {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, |
diff --git a/src/core/hle/service/am/am_types.h b/src/core/hle/service/am/am_types.h index 46afb3996..a14defb40 100644 --- a/src/core/hle/service/am/am_types.h +++ b/src/core/hle/service/am/am_types.h | |||
| @@ -48,11 +48,6 @@ enum class SystemButtonType { | |||
| 48 | CaptureButtonLongPressing, | 48 | CaptureButtonLongPressing, |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | enum class SysPlatformRegion : s32 { | ||
| 52 | Global = 1, | ||
| 53 | Terra = 2, | ||
| 54 | }; | ||
| 55 | |||
| 56 | struct AppletProcessLaunchReason { | 51 | struct AppletProcessLaunchReason { |
| 57 | u8 flag; | 52 | u8 flag; |
| 58 | INSERT_PADDING_BYTES(3); | 53 | INSERT_PADDING_BYTES(3); |
diff --git a/src/core/hle/service/am/service/common_state_getter.cpp b/src/core/hle/service/am/service/common_state_getter.cpp index 548498e83..a32855ffa 100644 --- a/src/core/hle/service/am/service/common_state_getter.cpp +++ b/src/core/hle/service/am/service/common_state_getter.cpp | |||
| @@ -260,9 +260,9 @@ Result ICommonStateGetter::GetAppletLaunchedHistory( | |||
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | Result ICommonStateGetter::GetSettingsPlatformRegion( | 262 | Result ICommonStateGetter::GetSettingsPlatformRegion( |
| 263 | Out<SysPlatformRegion> out_settings_platform_region) { | 263 | Out<Set::PlatformRegion> out_settings_platform_region) { |
| 264 | LOG_INFO(Service_AM, "called"); | 264 | LOG_INFO(Service_AM, "called"); |
| 265 | *out_settings_platform_region = SysPlatformRegion::Global; | 265 | *out_settings_platform_region = Set::PlatformRegion::Global; |
| 266 | R_SUCCEED(); | 266 | R_SUCCEED(); |
| 267 | } | 267 | } |
| 268 | 268 | ||
diff --git a/src/core/hle/service/am/service/common_state_getter.h b/src/core/hle/service/am/service/common_state_getter.h index 5a8dca3d6..59a46fa94 100644 --- a/src/core/hle/service/am/service/common_state_getter.h +++ b/src/core/hle/service/am/service/common_state_getter.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include "core/hle/service/cmif_types.h" | 8 | #include "core/hle/service/cmif_types.h" |
| 9 | #include "core/hle/service/pm/pm.h" | 9 | #include "core/hle/service/pm/pm.h" |
| 10 | #include "core/hle/service/service.h" | 10 | #include "core/hle/service/service.h" |
| 11 | #include "core/hle/service/set/settings_types.h" | ||
| 11 | 12 | ||
| 12 | namespace Kernel { | 13 | namespace Kernel { |
| 13 | class KReadableEvent; | 14 | class KReadableEvent; |
| @@ -50,7 +51,7 @@ private: | |||
| 50 | Result GetOperationModeSystemInfo(Out<u32> out_operation_mode_system_info); | 51 | Result GetOperationModeSystemInfo(Out<u32> out_operation_mode_system_info); |
| 51 | Result GetAppletLaunchedHistory(Out<s32> out_count, | 52 | Result GetAppletLaunchedHistory(Out<s32> out_count, |
| 52 | OutArray<AppletId, BufferAttr_HipcMapAlias> out_applet_ids); | 53 | OutArray<AppletId, BufferAttr_HipcMapAlias> out_applet_ids); |
| 53 | Result GetSettingsPlatformRegion(Out<SysPlatformRegion> out_settings_platform_region); | 54 | Result GetSettingsPlatformRegion(Out<Set::PlatformRegion> out_settings_platform_region); |
| 54 | Result SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(); | 55 | Result SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(); |
| 55 | 56 | ||
| 56 | void SetCpuBoostMode(HLERequestContext& ctx); | 57 | void SetCpuBoostMode(HLERequestContext& ctx); |
diff --git a/src/core/hle/service/erpt/erpt.cpp b/src/core/hle/service/erpt/erpt.cpp index 39ae3a723..6b7eab5ef 100644 --- a/src/core/hle/service/erpt/erpt.cpp +++ b/src/core/hle/service/erpt/erpt.cpp | |||
| @@ -18,7 +18,7 @@ public: | |||
| 18 | // clang-format off | 18 | // clang-format off |
| 19 | static const FunctionInfo functions[] = { | 19 | static const FunctionInfo functions[] = { |
| 20 | {0, C<&ErrorReportContext::SubmitContext>, "SubmitContext"}, | 20 | {0, C<&ErrorReportContext::SubmitContext>, "SubmitContext"}, |
| 21 | {1, nullptr, "CreateReportV0"}, | 21 | {1, C<&ErrorReportContext::CreateReportV0>, "CreateReportV0"}, |
| 22 | {2, nullptr, "SetInitialLaunchSettingsCompletionTime"}, | 22 | {2, nullptr, "SetInitialLaunchSettingsCompletionTime"}, |
| 23 | {3, nullptr, "ClearInitialLaunchSettingsCompletionTime"}, | 23 | {3, nullptr, "ClearInitialLaunchSettingsCompletionTime"}, |
| 24 | {4, nullptr, "UpdatePowerOnTime"}, | 24 | {4, nullptr, "UpdatePowerOnTime"}, |
| @@ -28,7 +28,8 @@ public: | |||
| 28 | {8, nullptr, "ClearApplicationLaunchTime"}, | 28 | {8, nullptr, "ClearApplicationLaunchTime"}, |
| 29 | {9, nullptr, "SubmitAttachment"}, | 29 | {9, nullptr, "SubmitAttachment"}, |
| 30 | {10, nullptr, "CreateReportWithAttachments"}, | 30 | {10, nullptr, "CreateReportWithAttachments"}, |
| 31 | {11, nullptr, "CreateReport"}, | 31 | {11, C<&ErrorReportContext::CreateReportV1>, "CreateReportV1"}, |
| 32 | {12, C<&ErrorReportContext::CreateReport>, "CreateReport"}, | ||
| 32 | {20, nullptr, "RegisterRunningApplet"}, | 33 | {20, nullptr, "RegisterRunningApplet"}, |
| 33 | {21, nullptr, "UnregisterRunningApplet"}, | 34 | {21, nullptr, "UnregisterRunningApplet"}, |
| 34 | {22, nullptr, "UpdateAppletSuspendedDuration"}, | 35 | {22, nullptr, "UpdateAppletSuspendedDuration"}, |
| @@ -40,10 +41,37 @@ public: | |||
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | private: | 43 | private: |
| 43 | Result SubmitContext(InBuffer<BufferAttr_HipcMapAlias> buffer_a, | 44 | Result SubmitContext(InBuffer<BufferAttr_HipcMapAlias> context_entry, |
| 44 | InBuffer<BufferAttr_HipcMapAlias> buffer_b) { | 45 | InBuffer<BufferAttr_HipcMapAlias> field_list) { |
| 45 | LOG_WARNING(Service_SET, "(STUBBED) called, buffer_a_size={}, buffer_b_size={}", | 46 | LOG_WARNING(Service_SET, "(STUBBED) called, context_entry_size={}, field_list_size={}", |
| 46 | buffer_a.size(), buffer_b.size()); | 47 | context_entry.size(), field_list.size()); |
| 48 | R_SUCCEED(); | ||
| 49 | } | ||
| 50 | |||
| 51 | Result CreateReportV0(u32 report_type, InBuffer<BufferAttr_HipcMapAlias> context_entry, | ||
| 52 | InBuffer<BufferAttr_HipcMapAlias> report_list, | ||
| 53 | InBuffer<BufferAttr_HipcMapAlias> report_meta_data) { | ||
| 54 | LOG_WARNING(Service_SET, "(STUBBED) called, report_type={:#x}", report_type); | ||
| 55 | R_SUCCEED(); | ||
| 56 | } | ||
| 57 | |||
| 58 | Result CreateReportV1(u32 report_type, u32 unknown, | ||
| 59 | InBuffer<BufferAttr_HipcMapAlias> context_entry, | ||
| 60 | InBuffer<BufferAttr_HipcMapAlias> report_list, | ||
| 61 | InBuffer<BufferAttr_HipcMapAlias> report_meta_data) { | ||
| 62 | LOG_WARNING(Service_SET, "(STUBBED) called, report_type={:#x}, unknown={:#x}", report_type, | ||
| 63 | unknown); | ||
| 64 | R_SUCCEED(); | ||
| 65 | } | ||
| 66 | |||
| 67 | Result CreateReport(u32 report_type, u32 unknown, u32 create_report_option_flag, | ||
| 68 | InBuffer<BufferAttr_HipcMapAlias> context_entry, | ||
| 69 | InBuffer<BufferAttr_HipcMapAlias> report_list, | ||
| 70 | InBuffer<BufferAttr_HipcMapAlias> report_meta_data) { | ||
| 71 | LOG_WARNING( | ||
| 72 | Service_SET, | ||
| 73 | "(STUBBED) called, report_type={:#x}, unknown={:#x}, create_report_option_flag={:#x}", | ||
| 74 | report_type, unknown, create_report_option_flag); | ||
| 47 | R_SUCCEED(); | 75 | R_SUCCEED(); |
| 48 | } | 76 | } |
| 49 | }; | 77 | }; |
diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp index 223284255..60290f1a6 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp | |||
| @@ -71,7 +71,7 @@ FSP_SRV::FSP_SRV(Core::System& system_) | |||
| 71 | {28, nullptr, "DeleteSaveDataFileSystemBySaveDataAttribute"}, | 71 | {28, nullptr, "DeleteSaveDataFileSystemBySaveDataAttribute"}, |
| 72 | {30, nullptr, "OpenGameCardStorage"}, | 72 | {30, nullptr, "OpenGameCardStorage"}, |
| 73 | {31, nullptr, "OpenGameCardFileSystem"}, | 73 | {31, nullptr, "OpenGameCardFileSystem"}, |
| 74 | {32, nullptr, "ExtendSaveDataFileSystem"}, | 74 | {32, D<&FSP_SRV::ExtendSaveDataFileSystem>, "ExtendSaveDataFileSystem"}, |
| 75 | {33, nullptr, "DeleteCacheStorage"}, | 75 | {33, nullptr, "DeleteCacheStorage"}, |
| 76 | {34, D<&FSP_SRV::GetCacheStorageSize>, "GetCacheStorageSize"}, | 76 | {34, D<&FSP_SRV::GetCacheStorageSize>, "GetCacheStorageSize"}, |
| 77 | {35, nullptr, "CreateSaveDataFileSystemByHashSalt"}, | 77 | {35, nullptr, "CreateSaveDataFileSystemByHashSalt"}, |
| @@ -79,9 +79,9 @@ FSP_SRV::FSP_SRV(Core::System& system_) | |||
| 79 | {51, D<&FSP_SRV::OpenSaveDataFileSystem>, "OpenSaveDataFileSystem"}, | 79 | {51, D<&FSP_SRV::OpenSaveDataFileSystem>, "OpenSaveDataFileSystem"}, |
| 80 | {52, D<&FSP_SRV::OpenSaveDataFileSystemBySystemSaveDataId>, "OpenSaveDataFileSystemBySystemSaveDataId"}, | 80 | {52, D<&FSP_SRV::OpenSaveDataFileSystemBySystemSaveDataId>, "OpenSaveDataFileSystemBySystemSaveDataId"}, |
| 81 | {53, D<&FSP_SRV::OpenReadOnlySaveDataFileSystem>, "OpenReadOnlySaveDataFileSystem"}, | 81 | {53, D<&FSP_SRV::OpenReadOnlySaveDataFileSystem>, "OpenReadOnlySaveDataFileSystem"}, |
| 82 | {57, nullptr, "ReadSaveDataFileSystemExtraDataBySaveDataSpaceId"}, | 82 | {57, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataSpaceId>, "ReadSaveDataFileSystemExtraDataBySaveDataSpaceId"}, |
| 83 | {58, nullptr, "ReadSaveDataFileSystemExtraData"}, | 83 | {58, D<&FSP_SRV::ReadSaveDataFileSystemExtraData>, "ReadSaveDataFileSystemExtraData"}, |
| 84 | {59, nullptr, "WriteSaveDataFileSystemExtraData"}, | 84 | {59, D<&FSP_SRV::WriteSaveDataFileSystemExtraData>, "WriteSaveDataFileSystemExtraData"}, |
| 85 | {60, nullptr, "OpenSaveDataInfoReader"}, | 85 | {60, nullptr, "OpenSaveDataInfoReader"}, |
| 86 | {61, D<&FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId>, "OpenSaveDataInfoReaderBySaveDataSpaceId"}, | 86 | {61, D<&FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId>, "OpenSaveDataInfoReaderBySaveDataSpaceId"}, |
| 87 | {62, D<&FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage>, "OpenSaveDataInfoReaderOnlyCacheStorage"}, | 87 | {62, D<&FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage>, "OpenSaveDataInfoReaderOnlyCacheStorage"}, |
| @@ -90,8 +90,8 @@ FSP_SRV::FSP_SRV(Core::System& system_) | |||
| 90 | {66, nullptr, "WriteSaveDataFileSystemExtraData2"}, | 90 | {66, nullptr, "WriteSaveDataFileSystemExtraData2"}, |
| 91 | {67, D<&FSP_SRV::FindSaveDataWithFilter>, "FindSaveDataWithFilter"}, | 91 | {67, D<&FSP_SRV::FindSaveDataWithFilter>, "FindSaveDataWithFilter"}, |
| 92 | {68, nullptr, "OpenSaveDataInfoReaderBySaveDataFilter"}, | 92 | {68, nullptr, "OpenSaveDataInfoReaderBySaveDataFilter"}, |
| 93 | {69, nullptr, "ReadSaveDataFileSystemExtraDataBySaveDataAttribute"}, | 93 | {69, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataBySaveDataAttribute"}, |
| 94 | {70, D<&FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute>, "WriteSaveDataFileSystemExtraDataBySaveDataAttribute"}, | 94 | {70, D<&FSP_SRV::WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"}, |
| 95 | {71, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"}, | 95 | {71, D<&FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute>, "ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute"}, |
| 96 | {80, nullptr, "OpenSaveDataMetaFile"}, | 96 | {80, nullptr, "OpenSaveDataMetaFile"}, |
| 97 | {81, nullptr, "OpenSaveDataTransferManager"}, | 97 | {81, nullptr, "OpenSaveDataTransferManager"}, |
| @@ -317,9 +317,23 @@ Result FSP_SRV::FindSaveDataWithFilter(Out<s64> out_count, | |||
| 317 | R_THROW(FileSys::ResultTargetNotFound); | 317 | R_THROW(FileSys::ResultTargetNotFound); |
| 318 | } | 318 | } |
| 319 | 319 | ||
| 320 | Result FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute() { | 320 | Result FSP_SRV::WriteSaveDataFileSystemExtraData(InBuffer<BufferAttr_HipcMapAlias> buffer, |
| 321 | LOG_WARNING(Service_FS, "(STUBBED) called."); | 321 | FileSys::SaveDataSpaceId space_id, |
| 322 | u64 save_data_id) { | ||
| 323 | LOG_WARNING(Service_FS, "(STUBBED) called, space_id={}, save_data_id={:016X}", space_id, | ||
| 324 | save_data_id); | ||
| 325 | R_SUCCEED(); | ||
| 326 | } | ||
| 322 | 327 | ||
| 328 | Result FSP_SRV::WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( | ||
| 329 | InBuffer<BufferAttr_HipcMapAlias> buffer, InBuffer<BufferAttr_HipcMapAlias> mask_buffer, | ||
| 330 | FileSys::SaveDataSpaceId space_id, FileSys::SaveDataAttribute attribute) { | ||
| 331 | LOG_WARNING(Service_FS, | ||
| 332 | "(STUBBED) called, space_id={}, attribute.program_id={:016X}\n" | ||
| 333 | "attribute.user_id={:016X}{:016X}, attribute.save_id={:016X}\n" | ||
| 334 | "attribute.type={}, attribute.rank={}, attribute.index={}", | ||
| 335 | space_id, attribute.program_id, attribute.user_id[1], attribute.user_id[0], | ||
| 336 | attribute.system_save_data_id, attribute.type, attribute.rank, attribute.index); | ||
| 323 | R_SUCCEED(); | 337 | R_SUCCEED(); |
| 324 | } | 338 | } |
| 325 | 339 | ||
| @@ -341,6 +355,38 @@ Result FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( | |||
| 341 | R_SUCCEED(); | 355 | R_SUCCEED(); |
| 342 | } | 356 | } |
| 343 | 357 | ||
| 358 | Result FSP_SRV::ReadSaveDataFileSystemExtraData(OutBuffer<BufferAttr_HipcMapAlias> out_buffer, | ||
| 359 | u64 save_data_id) { | ||
| 360 | // Stub, backend needs an impl to read/write the SaveDataExtraData | ||
| 361 | LOG_WARNING(Service_FS, "(STUBBED) called, save_data_id={:016X}", save_data_id); | ||
| 362 | std::memset(out_buffer.data(), 0, out_buffer.size()); | ||
| 363 | R_SUCCEED(); | ||
| 364 | } | ||
| 365 | |||
| 366 | Result FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataAttribute( | ||
| 367 | OutBuffer<BufferAttr_HipcMapAlias> out_buffer, FileSys::SaveDataSpaceId space_id, | ||
| 368 | FileSys::SaveDataAttribute attribute) { | ||
| 369 | // Stub, backend needs an impl to read/write the SaveDataExtraData | ||
| 370 | LOG_WARNING(Service_FS, | ||
| 371 | "(STUBBED) called, space_id={}, attribute.program_id={:016X}\n" | ||
| 372 | "attribute.user_id={:016X}{:016X}, attribute.save_id={:016X}\n" | ||
| 373 | "attribute.type={}, attribute.rank={}, attribute.index={}", | ||
| 374 | space_id, attribute.program_id, attribute.user_id[1], attribute.user_id[0], | ||
| 375 | attribute.system_save_data_id, attribute.type, attribute.rank, attribute.index); | ||
| 376 | std::memset(out_buffer.data(), 0, out_buffer.size()); | ||
| 377 | R_SUCCEED(); | ||
| 378 | } | ||
| 379 | |||
| 380 | Result FSP_SRV::ReadSaveDataFileSystemExtraDataBySaveDataSpaceId( | ||
| 381 | OutBuffer<BufferAttr_HipcMapAlias> out_buffer, FileSys::SaveDataSpaceId space_id, | ||
| 382 | u64 save_data_id) { | ||
| 383 | // Stub, backend needs an impl to read/write the SaveDataExtraData | ||
| 384 | LOG_WARNING(Service_FS, "(STUBBED) called, space_id={}, save_data_id={:016X}", space_id, | ||
| 385 | save_data_id); | ||
| 386 | std::memset(out_buffer.data(), 0, out_buffer.size()); | ||
| 387 | R_SUCCEED(); | ||
| 388 | } | ||
| 389 | |||
| 344 | Result FSP_SRV::OpenSaveDataTransferProhibiter( | 390 | Result FSP_SRV::OpenSaveDataTransferProhibiter( |
| 345 | OutInterface<ISaveDataTransferProhibiter> out_prohibiter, u64 id) { | 391 | OutInterface<ISaveDataTransferProhibiter> out_prohibiter, u64 id) { |
| 346 | LOG_WARNING(Service_FS, "(STUBBED) called, id={:016X}", id); | 392 | LOG_WARNING(Service_FS, "(STUBBED) called, id={:016X}", id); |
| @@ -476,6 +522,16 @@ Result FSP_SRV::FlushAccessLogOnSdCard() { | |||
| 476 | R_SUCCEED(); | 522 | R_SUCCEED(); |
| 477 | } | 523 | } |
| 478 | 524 | ||
| 525 | Result FSP_SRV::ExtendSaveDataFileSystem(FileSys::SaveDataSpaceId space_id, u64 save_data_id, | ||
| 526 | s64 available_size, s64 journal_size) { | ||
| 527 | // We don't have an index of save data ids, so we can't implement this. | ||
| 528 | LOG_WARNING(Service_FS, | ||
| 529 | "(STUBBED) called, space_id={}, save_data_id={:016X}, available_size={:#x}, " | ||
| 530 | "journal_size={:#x}", | ||
| 531 | space_id, save_data_id, available_size, journal_size); | ||
| 532 | R_SUCCEED(); | ||
| 533 | } | ||
| 534 | |||
| 479 | Result FSP_SRV::GetCacheStorageSize(s32 index, Out<s64> out_data_size, Out<s64> out_journal_size) { | 535 | Result FSP_SRV::GetCacheStorageSize(s32 index, Out<s64> out_data_size, Out<s64> out_journal_size) { |
| 480 | LOG_WARNING(Service_FS, "(STUBBED) called with index={}", index); | 536 | LOG_WARNING(Service_FS, "(STUBBED) called with index={}", index); |
| 481 | 537 | ||
diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.h b/src/core/hle/service/filesystem/fsp/fsp_srv.h index 83d9cb51c..b565cace0 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.h +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.h | |||
| @@ -70,7 +70,19 @@ private: | |||
| 70 | Result FindSaveDataWithFilter(Out<s64> out_count, OutBuffer<BufferAttr_HipcMapAlias> out_buffer, | 70 | Result FindSaveDataWithFilter(Out<s64> out_count, OutBuffer<BufferAttr_HipcMapAlias> out_buffer, |
| 71 | FileSys::SaveDataSpaceId space_id, | 71 | FileSys::SaveDataSpaceId space_id, |
| 72 | FileSys::SaveDataFilter filter); | 72 | FileSys::SaveDataFilter filter); |
| 73 | Result WriteSaveDataFileSystemExtraDataBySaveDataAttribute(); | 73 | Result WriteSaveDataFileSystemExtraData(InBuffer<BufferAttr_HipcMapAlias> buffer, |
| 74 | FileSys::SaveDataSpaceId space_id, u64 save_data_id); | ||
| 75 | Result WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( | ||
| 76 | InBuffer<BufferAttr_HipcMapAlias> buffer, InBuffer<BufferAttr_HipcMapAlias> mask_buffer, | ||
| 77 | FileSys::SaveDataSpaceId space_id, FileSys::SaveDataAttribute attribute); | ||
| 78 | Result ReadSaveDataFileSystemExtraData(OutBuffer<BufferAttr_HipcMapAlias> out_buffer, | ||
| 79 | u64 save_data_id); | ||
| 80 | Result ReadSaveDataFileSystemExtraDataBySaveDataAttribute( | ||
| 81 | OutBuffer<BufferAttr_HipcMapAlias> out_buffer, FileSys::SaveDataSpaceId space_id, | ||
| 82 | FileSys::SaveDataAttribute attribute); | ||
| 83 | Result ReadSaveDataFileSystemExtraDataBySaveDataSpaceId( | ||
| 84 | OutBuffer<BufferAttr_HipcMapAlias> out_buffer, FileSys::SaveDataSpaceId space_id, | ||
| 85 | u64 save_data_id); | ||
| 74 | Result ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( | 86 | Result ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( |
| 75 | FileSys::SaveDataSpaceId space_id, FileSys::SaveDataAttribute attribute, | 87 | FileSys::SaveDataSpaceId space_id, FileSys::SaveDataAttribute attribute, |
| 76 | InBuffer<BufferAttr_HipcMapAlias> mask_buffer, | 88 | InBuffer<BufferAttr_HipcMapAlias> mask_buffer, |
| @@ -91,6 +103,8 @@ private: | |||
| 91 | Result GetProgramIndexForAccessLog(Out<AccessLogVersion> out_access_log_version, | 103 | Result GetProgramIndexForAccessLog(Out<AccessLogVersion> out_access_log_version, |
| 92 | Out<u32> out_access_log_program_index); | 104 | Out<u32> out_access_log_program_index); |
| 93 | Result OpenMultiCommitManager(OutInterface<IMultiCommitManager> out_interface); | 105 | Result OpenMultiCommitManager(OutInterface<IMultiCommitManager> out_interface); |
| 106 | Result ExtendSaveDataFileSystem(FileSys::SaveDataSpaceId space_id, u64 save_data_id, | ||
| 107 | s64 available_size, s64 journal_size); | ||
| 94 | Result GetCacheStorageSize(s32 index, Out<s64> out_data_size, Out<s64> out_journal_size); | 108 | Result GetCacheStorageSize(s32 index, Out<s64> out_data_size, Out<s64> out_journal_size); |
| 95 | 109 | ||
| 96 | FileSystemController& fsc; | 110 | FileSystemController& fsc; |
diff --git a/src/core/hle/service/ldn/monitor_service.cpp b/src/core/hle/service/ldn/monitor_service.cpp index 3471f69da..ea6ac4d5d 100644 --- a/src/core/hle/service/ldn/monitor_service.cpp +++ b/src/core/hle/service/ldn/monitor_service.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | 2 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/hle/service/cmif_serialization.h" | 4 | #include "core/hle/service/cmif_serialization.h" |
| 5 | #include "core/hle/service/ldn/ldn_results.h" | ||
| 5 | #include "core/hle/service/ldn/monitor_service.h" | 6 | #include "core/hle/service/ldn/monitor_service.h" |
| 6 | 7 | ||
| 7 | namespace Service::LDN { | 8 | namespace Service::LDN { |
| @@ -17,7 +18,7 @@ IMonitorService::IMonitorService(Core::System& system_) | |||
| 17 | {4, nullptr, "GetSecurityParameterForMonitor"}, | 18 | {4, nullptr, "GetSecurityParameterForMonitor"}, |
| 18 | {5, nullptr, "GetNetworkConfigForMonitor"}, | 19 | {5, nullptr, "GetNetworkConfigForMonitor"}, |
| 19 | {100, C<&IMonitorService::InitializeMonitor>, "InitializeMonitor"}, | 20 | {100, C<&IMonitorService::InitializeMonitor>, "InitializeMonitor"}, |
| 20 | {101, nullptr, "FinalizeMonitor"}, | 21 | {101, C<&IMonitorService::FinalizeMonitor>, "FinalizeMonitor"}, |
| 21 | }; | 22 | }; |
| 22 | // clang-format on | 23 | // clang-format on |
| 23 | 24 | ||
| @@ -27,16 +28,18 @@ IMonitorService::IMonitorService(Core::System& system_) | |||
| 27 | IMonitorService::~IMonitorService() = default; | 28 | IMonitorService::~IMonitorService() = default; |
| 28 | 29 | ||
| 29 | Result IMonitorService::GetStateForMonitor(Out<State> out_state) { | 30 | Result IMonitorService::GetStateForMonitor(Out<State> out_state) { |
| 30 | LOG_INFO(Service_LDN, "called"); | 31 | LOG_WARNING(Service_LDN, "(STUBBED) called"); |
| 31 | 32 | *out_state = State::None; | |
| 32 | *out_state = state; | ||
| 33 | R_SUCCEED(); | 33 | R_SUCCEED(); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | Result IMonitorService::InitializeMonitor() { | 36 | Result IMonitorService::InitializeMonitor() { |
| 37 | LOG_INFO(Service_LDN, "called"); | 37 | LOG_INFO(Service_LDN, "called"); |
| 38 | R_SUCCEED(); | ||
| 39 | } | ||
| 38 | 40 | ||
| 39 | state = State::Initialized; | 41 | Result IMonitorService::FinalizeMonitor() { |
| 42 | LOG_INFO(Service_LDN, "called"); | ||
| 40 | R_SUCCEED(); | 43 | R_SUCCEED(); |
| 41 | } | 44 | } |
| 42 | 45 | ||
diff --git a/src/core/hle/service/ldn/monitor_service.h b/src/core/hle/service/ldn/monitor_service.h index 61aacef30..e663145b4 100644 --- a/src/core/hle/service/ldn/monitor_service.h +++ b/src/core/hle/service/ldn/monitor_service.h | |||
| @@ -21,6 +21,7 @@ public: | |||
| 21 | private: | 21 | private: |
| 22 | Result GetStateForMonitor(Out<State> out_state); | 22 | Result GetStateForMonitor(Out<State> out_state); |
| 23 | Result InitializeMonitor(); | 23 | Result InitializeMonitor(); |
| 24 | Result FinalizeMonitor(); | ||
| 24 | 25 | ||
| 25 | State state{State::None}; | 26 | State state{State::None}; |
| 26 | }; | 27 | }; |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index bf12d69a5..efc9cca1c 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include "common/assert.h" | 5 | #include "common/assert.h" |
| 6 | #include "common/logging/log.h" | 6 | #include "common/logging/log.h" |
| 7 | #include "core/core.h" | 7 | #include "core/core.h" |
| 8 | #include "core/hle/kernel/k_process.h" | ||
| 8 | #include "core/hle/service/nvdrv/core/container.h" | 9 | #include "core/hle/service/nvdrv/core/container.h" |
| 9 | #include "core/hle/service/nvdrv/core/nvmap.h" | 10 | #include "core/hle/service/nvdrv/core/nvmap.h" |
| 10 | #include "core/hle/service/nvdrv/core/syncpoint_manager.h" | 11 | #include "core/hle/service/nvdrv/core/syncpoint_manager.h" |
| @@ -75,7 +76,7 @@ NvResult nvhost_gpu::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> inpu | |||
| 75 | case 0xd: | 76 | case 0xd: |
| 76 | return WrapFixed(this, &nvhost_gpu::SetChannelPriority, input, output); | 77 | return WrapFixed(this, &nvhost_gpu::SetChannelPriority, input, output); |
| 77 | case 0x1a: | 78 | case 0x1a: |
| 78 | return WrapFixed(this, &nvhost_gpu::AllocGPFIFOEx2, input, output); | 79 | return WrapFixed(this, &nvhost_gpu::AllocGPFIFOEx2, input, output, fd); |
| 79 | case 0x1b: | 80 | case 0x1b: |
| 80 | return WrapFixedVariable(this, &nvhost_gpu::SubmitGPFIFOBase1, input, output, true); | 81 | return WrapFixedVariable(this, &nvhost_gpu::SubmitGPFIFOBase1, input, output, true); |
| 81 | case 0x1d: | 82 | case 0x1d: |
| @@ -120,8 +121,13 @@ NvResult nvhost_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> inpu | |||
| 120 | return NvResult::NotImplemented; | 121 | return NvResult::NotImplemented; |
| 121 | } | 122 | } |
| 122 | 123 | ||
| 123 | void nvhost_gpu::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {} | 124 | void nvhost_gpu::OnOpen(NvCore::SessionId session_id, DeviceFD fd) { |
| 124 | void nvhost_gpu::OnClose(DeviceFD fd) {} | 125 | sessions[fd] = session_id; |
| 126 | } | ||
| 127 | |||
| 128 | void nvhost_gpu::OnClose(DeviceFD fd) { | ||
| 129 | sessions.erase(fd); | ||
| 130 | } | ||
| 125 | 131 | ||
| 126 | NvResult nvhost_gpu::SetNVMAPfd(IoctlSetNvmapFD& params) { | 132 | NvResult nvhost_gpu::SetNVMAPfd(IoctlSetNvmapFD& params) { |
| 127 | LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); | 133 | LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); |
| @@ -161,7 +167,7 @@ NvResult nvhost_gpu::SetChannelPriority(IoctlChannelSetPriority& params) { | |||
| 161 | return NvResult::Success; | 167 | return NvResult::Success; |
| 162 | } | 168 | } |
| 163 | 169 | ||
| 164 | NvResult nvhost_gpu::AllocGPFIFOEx2(IoctlAllocGpfifoEx2& params) { | 170 | NvResult nvhost_gpu::AllocGPFIFOEx2(IoctlAllocGpfifoEx2& params, DeviceFD fd) { |
| 165 | LOG_WARNING(Service_NVDRV, | 171 | LOG_WARNING(Service_NVDRV, |
| 166 | "(STUBBED) called, num_entries={:X}, flags={:X}, unk0={:X}, " | 172 | "(STUBBED) called, num_entries={:X}, flags={:X}, unk0={:X}, " |
| 167 | "unk1={:X}, unk2={:X}, unk3={:X}", | 173 | "unk1={:X}, unk2={:X}, unk3={:X}", |
| @@ -173,7 +179,12 @@ NvResult nvhost_gpu::AllocGPFIFOEx2(IoctlAllocGpfifoEx2& params) { | |||
| 173 | return NvResult::AlreadyAllocated; | 179 | return NvResult::AlreadyAllocated; |
| 174 | } | 180 | } |
| 175 | 181 | ||
| 176 | system.GPU().InitChannel(*channel_state); | 182 | u64 program_id{}; |
| 183 | if (auto* const session = core.GetSession(sessions[fd]); session != nullptr) { | ||
| 184 | program_id = session->process->GetProgramId(); | ||
| 185 | } | ||
| 186 | |||
| 187 | system.GPU().InitChannel(*channel_state, program_id); | ||
| 177 | 188 | ||
| 178 | params.fence_out = syncpoint_manager.GetSyncpointFence(channel_syncpoint); | 189 | params.fence_out = syncpoint_manager.GetSyncpointFence(channel_syncpoint); |
| 179 | 190 | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h index e34a978db..e0aeef953 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h | |||
| @@ -192,7 +192,7 @@ private: | |||
| 192 | NvResult ZCullBind(IoctlZCullBind& params); | 192 | NvResult ZCullBind(IoctlZCullBind& params); |
| 193 | NvResult SetErrorNotifier(IoctlSetErrorNotifier& params); | 193 | NvResult SetErrorNotifier(IoctlSetErrorNotifier& params); |
| 194 | NvResult SetChannelPriority(IoctlChannelSetPriority& params); | 194 | NvResult SetChannelPriority(IoctlChannelSetPriority& params); |
| 195 | NvResult AllocGPFIFOEx2(IoctlAllocGpfifoEx2& params); | 195 | NvResult AllocGPFIFOEx2(IoctlAllocGpfifoEx2& params, DeviceFD fd); |
| 196 | NvResult AllocateObjectContext(IoctlAllocObjCtx& params); | 196 | NvResult AllocateObjectContext(IoctlAllocObjCtx& params); |
| 197 | 197 | ||
| 198 | NvResult SubmitGPFIFOImpl(IoctlSubmitGpfifo& params, Tegra::CommandList&& entries); | 198 | NvResult SubmitGPFIFOImpl(IoctlSubmitGpfifo& params, Tegra::CommandList&& entries); |
| @@ -210,6 +210,7 @@ private: | |||
| 210 | NvCore::SyncpointManager& syncpoint_manager; | 210 | NvCore::SyncpointManager& syncpoint_manager; |
| 211 | NvCore::NvMap& nvmap; | 211 | NvCore::NvMap& nvmap; |
| 212 | std::shared_ptr<Tegra::Control::ChannelState> channel_state; | 212 | std::shared_ptr<Tegra::Control::ChannelState> channel_state; |
| 213 | std::unordered_map<DeviceFD, NvCore::SessionId> sessions; | ||
| 213 | u32 channel_syncpoint; | 214 | u32 channel_syncpoint; |
| 214 | std::mutex channel_mutex; | 215 | std::mutex channel_mutex; |
| 215 | 216 | ||
diff --git a/src/core/hle/service/set/settings_types.h b/src/core/hle/service/set/settings_types.h index 4fd34f46b..92c2948b0 100644 --- a/src/core/hle/service/set/settings_types.h +++ b/src/core/hle/service/set/settings_types.h | |||
| @@ -243,6 +243,11 @@ enum class TvResolution : u32 { | |||
| 243 | Resolution480p, | 243 | Resolution480p, |
| 244 | }; | 244 | }; |
| 245 | 245 | ||
| 246 | enum class PlatformRegion : s32 { | ||
| 247 | Global = 1, | ||
| 248 | Terra = 2, | ||
| 249 | }; | ||
| 250 | |||
| 246 | constexpr std::array<LanguageCode, 18> available_language_codes = {{ | 251 | constexpr std::array<LanguageCode, 18> available_language_codes = {{ |
| 247 | LanguageCode::JA, | 252 | LanguageCode::JA, |
| 248 | LanguageCode::EN_US, | 253 | LanguageCode::EN_US, |
diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp index 900d5408f..0dc8db821 100644 --- a/src/core/hle/service/set/system_settings_server.cpp +++ b/src/core/hle/service/set/system_settings_server.cpp | |||
| @@ -272,8 +272,8 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_) | |||
| 272 | {180, nullptr, "SetZoomFlag"}, | 272 | {180, nullptr, "SetZoomFlag"}, |
| 273 | {181, nullptr, "GetT"}, | 273 | {181, nullptr, "GetT"}, |
| 274 | {182, nullptr, "SetT"}, | 274 | {182, nullptr, "SetT"}, |
| 275 | {183, nullptr, "GetPlatformRegion"}, | 275 | {183, C<&ISystemSettingsServer::GetPlatformRegion>, "GetPlatformRegion"}, |
| 276 | {184, nullptr, "SetPlatformRegion"}, | 276 | {184, C<&ISystemSettingsServer::SetPlatformRegion>, "SetPlatformRegion"}, |
| 277 | {185, C<&ISystemSettingsServer::GetHomeMenuSchemeModel>, "GetHomeMenuSchemeModel"}, | 277 | {185, C<&ISystemSettingsServer::GetHomeMenuSchemeModel>, "GetHomeMenuSchemeModel"}, |
| 278 | {186, nullptr, "GetMemoryUsageRateFlag"}, | 278 | {186, nullptr, "GetMemoryUsageRateFlag"}, |
| 279 | {187, C<&ISystemSettingsServer::GetTouchScreenMode>, "GetTouchScreenMode"}, | 279 | {187, C<&ISystemSettingsServer::GetTouchScreenMode>, "GetTouchScreenMode"}, |
| @@ -1250,6 +1250,18 @@ Result ISystemSettingsServer::GetHomeMenuScheme(Out<HomeMenuScheme> out_home_men | |||
| 1250 | R_SUCCEED(); | 1250 | R_SUCCEED(); |
| 1251 | } | 1251 | } |
| 1252 | 1252 | ||
| 1253 | Result ISystemSettingsServer::GetPlatformRegion(Out<PlatformRegion> out_platform_region) { | ||
| 1254 | LOG_WARNING(Service_SET, "(STUBBED) called"); | ||
| 1255 | |||
| 1256 | *out_platform_region = PlatformRegion::Global; | ||
| 1257 | R_SUCCEED(); | ||
| 1258 | } | ||
| 1259 | |||
| 1260 | Result ISystemSettingsServer::SetPlatformRegion(PlatformRegion platform_region) { | ||
| 1261 | LOG_WARNING(Service_SET, "(STUBBED) called"); | ||
| 1262 | R_SUCCEED(); | ||
| 1263 | } | ||
| 1264 | |||
| 1253 | Result ISystemSettingsServer::GetHomeMenuSchemeModel(Out<u32> out_home_menu_scheme_model) { | 1265 | Result ISystemSettingsServer::GetHomeMenuSchemeModel(Out<u32> out_home_menu_scheme_model) { |
| 1254 | LOG_WARNING(Service_SET, "(STUBBED) called"); | 1266 | LOG_WARNING(Service_SET, "(STUBBED) called"); |
| 1255 | 1267 | ||
diff --git a/src/core/hle/service/set/system_settings_server.h b/src/core/hle/service/set/system_settings_server.h index 9a1154ad6..993e5de7d 100644 --- a/src/core/hle/service/set/system_settings_server.h +++ b/src/core/hle/service/set/system_settings_server.h | |||
| @@ -149,6 +149,8 @@ public: | |||
| 149 | Result GetHomeMenuScheme(Out<HomeMenuScheme> out_home_menu_scheme); | 149 | Result GetHomeMenuScheme(Out<HomeMenuScheme> out_home_menu_scheme); |
| 150 | Result GetHomeMenuSchemeModel(Out<u32> out_home_menu_scheme_model); | 150 | Result GetHomeMenuSchemeModel(Out<u32> out_home_menu_scheme_model); |
| 151 | Result GetTouchScreenMode(Out<TouchScreenMode> out_touch_screen_mode); | 151 | Result GetTouchScreenMode(Out<TouchScreenMode> out_touch_screen_mode); |
| 152 | Result GetPlatformRegion(Out<PlatformRegion> out_platform_region); | ||
| 153 | Result SetPlatformRegion(PlatformRegion platform_region); | ||
| 152 | Result SetTouchScreenMode(TouchScreenMode touch_screen_mode); | 154 | Result SetTouchScreenMode(TouchScreenMode touch_screen_mode); |
| 153 | Result GetFieldTestingFlag(Out<bool> out_field_testing_flag); | 155 | Result GetFieldTestingFlag(Out<bool> out_field_testing_flag); |
| 154 | Result GetPanelCrcMode(Out<s32> out_panel_crc_mode); | 156 | Result GetPanelCrcMode(Out<s32> out_panel_crc_mode); |
diff --git a/src/core/hle/service/ssl/cert_store.cpp b/src/core/hle/service/ssl/cert_store.cpp new file mode 100644 index 000000000..b321e5d32 --- /dev/null +++ b/src/core/hle/service/ssl/cert_store.cpp | |||
| @@ -0,0 +1,156 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "common/alignment.h" | ||
| 5 | #include "core/core.h" | ||
| 6 | #include "core/file_sys/content_archive.h" | ||
| 7 | #include "core/file_sys/nca_metadata.h" | ||
| 8 | #include "core/file_sys/registered_cache.h" | ||
| 9 | #include "core/file_sys/romfs.h" | ||
| 10 | #include "core/hle/service/filesystem/filesystem.h" | ||
| 11 | #include "core/hle/service/ssl/cert_store.h" | ||
| 12 | |||
| 13 | namespace Service::SSL { | ||
| 14 | |||
| 15 | // https://switchbrew.org/wiki/SSL_services#CertStore | ||
| 16 | |||
| 17 | CertStore::CertStore(Core::System& system) { | ||
| 18 | constexpr u64 CertStoreDataId = 0x0100000000000800ULL; | ||
| 19 | |||
| 20 | auto& fsc = system.GetFileSystemController(); | ||
| 21 | |||
| 22 | // Attempt to load certificate data from storage | ||
| 23 | const auto nca = | ||
| 24 | fsc.GetSystemNANDContents()->GetEntry(CertStoreDataId, FileSys::ContentRecordType::Data); | ||
| 25 | if (!nca) { | ||
| 26 | return; | ||
| 27 | } | ||
| 28 | const auto romfs = nca->GetRomFS(); | ||
| 29 | if (!romfs) { | ||
| 30 | return; | ||
| 31 | } | ||
| 32 | const auto extracted = FileSys::ExtractRomFS(romfs); | ||
| 33 | if (!extracted) { | ||
| 34 | LOG_ERROR(Service_SSL, "CertStore could not be extracted, corrupt RomFS?"); | ||
| 35 | return; | ||
| 36 | } | ||
| 37 | const auto cert_store_file = extracted->GetFile("ssl_TrustedCerts.bdf"); | ||
| 38 | if (!cert_store_file) { | ||
| 39 | LOG_ERROR(Service_SSL, "Failed to find trusted certificates in CertStore"); | ||
| 40 | return; | ||
| 41 | } | ||
| 42 | |||
| 43 | // Read and verify the header. | ||
| 44 | CertStoreHeader header; | ||
| 45 | cert_store_file->ReadObject(std::addressof(header)); | ||
| 46 | |||
| 47 | if (header.magic != Common::MakeMagic('s', 's', 'l', 'T')) { | ||
| 48 | LOG_ERROR(Service_SSL, "Invalid certificate store magic"); | ||
| 49 | return; | ||
| 50 | } | ||
| 51 | |||
| 52 | // Ensure the file can contains the number of entries it says it does. | ||
| 53 | const u64 expected_size = sizeof(header) + sizeof(CertStoreEntry) * header.num_entries; | ||
| 54 | const u64 actual_size = cert_store_file->GetSize(); | ||
| 55 | if (actual_size < expected_size) { | ||
| 56 | LOG_ERROR(Service_SSL, "Size mismatch, expected at least {} bytes, got {}", expected_size, | ||
| 57 | actual_size); | ||
| 58 | return; | ||
| 59 | } | ||
| 60 | |||
| 61 | // Read entries. | ||
| 62 | std::vector<CertStoreEntry> entries(header.num_entries); | ||
| 63 | cert_store_file->ReadArray(entries.data(), header.num_entries, sizeof(header)); | ||
| 64 | |||
| 65 | // Insert into memory store. | ||
| 66 | for (const auto& entry : entries) { | ||
| 67 | m_certs.emplace(entry.certificate_id, | ||
| 68 | Certificate{ | ||
| 69 | .status = entry.certificate_status, | ||
| 70 | .der_data = cert_store_file->ReadBytes( | ||
| 71 | entry.der_size, entry.der_offset + sizeof(header)), | ||
| 72 | }); | ||
| 73 | } | ||
| 74 | } | ||
| 75 | |||
| 76 | CertStore::~CertStore() = default; | ||
| 77 | |||
| 78 | template <typename F> | ||
| 79 | void CertStore::ForEachCertificate(std::span<const CaCertificateId> certificate_ids, F&& f) { | ||
| 80 | if (certificate_ids.size() == 1 && certificate_ids.front() == CaCertificateId::All) { | ||
| 81 | for (const auto& entry : m_certs) { | ||
| 82 | f(entry); | ||
| 83 | } | ||
| 84 | } else { | ||
| 85 | for (const auto certificate_id : certificate_ids) { | ||
| 86 | const auto entry = m_certs.find(certificate_id); | ||
| 87 | if (entry == m_certs.end()) { | ||
| 88 | continue; | ||
| 89 | } | ||
| 90 | f(*entry); | ||
| 91 | } | ||
| 92 | } | ||
| 93 | } | ||
| 94 | |||
| 95 | Result CertStore::GetCertificates(u32* out_num_entries, std::span<u8> out_data, | ||
| 96 | std::span<const CaCertificateId> certificate_ids) { | ||
| 97 | // Ensure the buffer is large enough to hold the output. | ||
| 98 | u32 required_size; | ||
| 99 | R_TRY(this->GetCertificateBufSize(std::addressof(required_size), out_num_entries, | ||
| 100 | certificate_ids)); | ||
| 101 | R_UNLESS(out_data.size_bytes() >= required_size, ResultUnknown); | ||
| 102 | |||
| 103 | // Make parallel arrays. | ||
| 104 | std::vector<BuiltInCertificateInfo> cert_infos; | ||
| 105 | std::vector<u8> der_datas; | ||
| 106 | |||
| 107 | const u32 der_data_offset = (*out_num_entries + 1) * sizeof(BuiltInCertificateInfo); | ||
| 108 | u32 cur_der_offset = der_data_offset; | ||
| 109 | |||
| 110 | // Fill output. | ||
| 111 | this->ForEachCertificate(certificate_ids, [&](auto& entry) { | ||
| 112 | const auto& [status, cur_der_data] = entry.second; | ||
| 113 | BuiltInCertificateInfo cert_info{ | ||
| 114 | .cert_id = entry.first, | ||
| 115 | .status = status, | ||
| 116 | .der_size = cur_der_data.size(), | ||
| 117 | .der_offset = cur_der_offset, | ||
| 118 | }; | ||
| 119 | |||
| 120 | cert_infos.push_back(cert_info); | ||
| 121 | der_datas.insert(der_datas.end(), cur_der_data.begin(), cur_der_data.end()); | ||
| 122 | cur_der_offset += static_cast<u32>(cur_der_data.size()); | ||
| 123 | }); | ||
| 124 | |||
| 125 | // Append terminator entry. | ||
| 126 | cert_infos.push_back(BuiltInCertificateInfo{ | ||
| 127 | .cert_id = CaCertificateId::All, | ||
| 128 | .status = TrustedCertStatus::Invalid, | ||
| 129 | .der_size = 0, | ||
| 130 | .der_offset = 0, | ||
| 131 | }); | ||
| 132 | |||
| 133 | // Write to output span. | ||
| 134 | std::memcpy(out_data.data(), cert_infos.data(), | ||
| 135 | cert_infos.size() * sizeof(BuiltInCertificateInfo)); | ||
| 136 | std::memcpy(out_data.data() + der_data_offset, der_datas.data(), der_datas.size()); | ||
| 137 | |||
| 138 | R_SUCCEED(); | ||
| 139 | } | ||
| 140 | |||
| 141 | Result CertStore::GetCertificateBufSize(u32* out_size, u32* out_num_entries, | ||
| 142 | std::span<const CaCertificateId> certificate_ids) { | ||
| 143 | // Output size is at least the size of the terminator entry. | ||
| 144 | *out_size = sizeof(BuiltInCertificateInfo); | ||
| 145 | *out_num_entries = 0; | ||
| 146 | |||
| 147 | this->ForEachCertificate(certificate_ids, [&](auto& entry) { | ||
| 148 | *out_size += sizeof(BuiltInCertificateInfo); | ||
| 149 | *out_size += Common::AlignUp(static_cast<u32>(entry.second.der_data.size()), 4); | ||
| 150 | (*out_num_entries)++; | ||
| 151 | }); | ||
| 152 | |||
| 153 | R_SUCCEED(); | ||
| 154 | } | ||
| 155 | |||
| 156 | } // namespace Service::SSL | ||
diff --git a/src/core/hle/service/ssl/cert_store.h b/src/core/hle/service/ssl/cert_store.h new file mode 100644 index 000000000..613d7b02a --- /dev/null +++ b/src/core/hle/service/ssl/cert_store.h | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include <map> | ||
| 7 | #include <span> | ||
| 8 | #include <vector> | ||
| 9 | |||
| 10 | #include "core/hle/result.h" | ||
| 11 | #include "core/hle/service/ssl/ssl_types.h" | ||
| 12 | |||
| 13 | namespace Core { | ||
| 14 | class System; | ||
| 15 | } | ||
| 16 | |||
| 17 | namespace Service::SSL { | ||
| 18 | |||
| 19 | class CertStore { | ||
| 20 | public: | ||
| 21 | explicit CertStore(Core::System& system); | ||
| 22 | ~CertStore(); | ||
| 23 | |||
| 24 | Result GetCertificates(u32* out_num_entries, std::span<u8> out_data, | ||
| 25 | std::span<const CaCertificateId> certificate_ids); | ||
| 26 | Result GetCertificateBufSize(u32* out_size, u32* out_num_entries, | ||
| 27 | std::span<const CaCertificateId> certificate_ids); | ||
| 28 | |||
| 29 | private: | ||
| 30 | template <typename F> | ||
| 31 | void ForEachCertificate(std::span<const CaCertificateId> certs, F&& f); | ||
| 32 | |||
| 33 | private: | ||
| 34 | struct Certificate { | ||
| 35 | TrustedCertStatus status; | ||
| 36 | std::vector<u8> der_data; | ||
| 37 | }; | ||
| 38 | |||
| 39 | std::map<CaCertificateId, Certificate> m_certs; | ||
| 40 | }; | ||
| 41 | |||
| 42 | } // namespace Service::SSL | ||
diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index 0fbb43057..008ee4492 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp | |||
| @@ -5,11 +5,13 @@ | |||
| 5 | 5 | ||
| 6 | #include "core/core.h" | 6 | #include "core/core.h" |
| 7 | #include "core/hle/result.h" | 7 | #include "core/hle/result.h" |
| 8 | #include "core/hle/service/cmif_serialization.h" | ||
| 8 | #include "core/hle/service/ipc_helpers.h" | 9 | #include "core/hle/service/ipc_helpers.h" |
| 9 | #include "core/hle/service/server_manager.h" | 10 | #include "core/hle/service/server_manager.h" |
| 10 | #include "core/hle/service/service.h" | 11 | #include "core/hle/service/service.h" |
| 11 | #include "core/hle/service/sm/sm.h" | 12 | #include "core/hle/service/sm/sm.h" |
| 12 | #include "core/hle/service/sockets/bsd.h" | 13 | #include "core/hle/service/sockets/bsd.h" |
| 14 | #include "core/hle/service/ssl/cert_store.h" | ||
| 13 | #include "core/hle/service/ssl/ssl.h" | 15 | #include "core/hle/service/ssl/ssl.h" |
| 14 | #include "core/hle/service/ssl/ssl_backend.h" | 16 | #include "core/hle/service/ssl/ssl_backend.h" |
| 15 | #include "core/internal_network/network.h" | 17 | #include "core/internal_network/network.h" |
| @@ -492,13 +494,14 @@ private: | |||
| 492 | 494 | ||
| 493 | class ISslService final : public ServiceFramework<ISslService> { | 495 | class ISslService final : public ServiceFramework<ISslService> { |
| 494 | public: | 496 | public: |
| 495 | explicit ISslService(Core::System& system_) : ServiceFramework{system_, "ssl"} { | 497 | explicit ISslService(Core::System& system_) |
| 498 | : ServiceFramework{system_, "ssl"}, cert_store{system} { | ||
| 496 | // clang-format off | 499 | // clang-format off |
| 497 | static const FunctionInfo functions[] = { | 500 | static const FunctionInfo functions[] = { |
| 498 | {0, &ISslService::CreateContext, "CreateContext"}, | 501 | {0, &ISslService::CreateContext, "CreateContext"}, |
| 499 | {1, nullptr, "GetContextCount"}, | 502 | {1, nullptr, "GetContextCount"}, |
| 500 | {2, nullptr, "GetCertificates"}, | 503 | {2, D<&ISslService::GetCertificates>, "GetCertificates"}, |
| 501 | {3, nullptr, "GetCertificateBufSize"}, | 504 | {3, D<&ISslService::GetCertificateBufSize>, "GetCertificateBufSize"}, |
| 502 | {4, nullptr, "DebugIoctl"}, | 505 | {4, nullptr, "DebugIoctl"}, |
| 503 | {5, &ISslService::SetInterfaceVersion, "SetInterfaceVersion"}, | 506 | {5, &ISslService::SetInterfaceVersion, "SetInterfaceVersion"}, |
| 504 | {6, nullptr, "FlushSessionCache"}, | 507 | {6, nullptr, "FlushSessionCache"}, |
| @@ -540,6 +543,22 @@ private: | |||
| 540 | IPC::ResponseBuilder rb{ctx, 2}; | 543 | IPC::ResponseBuilder rb{ctx, 2}; |
| 541 | rb.Push(ResultSuccess); | 544 | rb.Push(ResultSuccess); |
| 542 | } | 545 | } |
| 546 | |||
| 547 | Result GetCertificateBufSize( | ||
| 548 | Out<u32> out_size, InArray<CaCertificateId, BufferAttr_HipcMapAlias> certificate_ids) { | ||
| 549 | LOG_INFO(Service_SSL, "called"); | ||
| 550 | u32 num_entries; | ||
| 551 | R_RETURN(cert_store.GetCertificateBufSize(out_size, &num_entries, certificate_ids)); | ||
| 552 | } | ||
| 553 | |||
| 554 | Result GetCertificates(Out<u32> out_num_entries, OutBuffer<BufferAttr_HipcMapAlias> out_buffer, | ||
| 555 | InArray<CaCertificateId, BufferAttr_HipcMapAlias> certificate_ids) { | ||
| 556 | LOG_INFO(Service_SSL, "called"); | ||
| 557 | R_RETURN(cert_store.GetCertificates(out_num_entries, out_buffer, certificate_ids)); | ||
| 558 | } | ||
| 559 | |||
| 560 | private: | ||
| 561 | CertStore cert_store; | ||
| 543 | }; | 562 | }; |
| 544 | 563 | ||
| 545 | void LoopProcess(Core::System& system) { | 564 | void LoopProcess(Core::System& system) { |
diff --git a/src/core/hle/service/ssl/ssl_types.h b/src/core/hle/service/ssl/ssl_types.h new file mode 100644 index 000000000..dbc3dbf64 --- /dev/null +++ b/src/core/hle/service/ssl/ssl_types.h | |||
| @@ -0,0 +1,107 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "common/common_types.h" | ||
| 7 | |||
| 8 | namespace Service::SSL { | ||
| 9 | |||
| 10 | enum class CaCertificateId : s32 { | ||
| 11 | All = -1, | ||
| 12 | NintendoCAG3 = 1, | ||
| 13 | NintendoClass2CAG3 = 2, | ||
| 14 | NintendoRootCAG4 = 3, | ||
| 15 | AmazonRootCA1 = 1000, | ||
| 16 | StarfieldServicesRootCertificateAuthorityG2 = 1001, | ||
| 17 | AddTrustExternalCARoot = 1002, | ||
| 18 | COMODOCertificationAuthority = 1003, | ||
| 19 | UTNDATACorpSGC = 1004, | ||
| 20 | UTNUSERFirstHardware = 1005, | ||
| 21 | BaltimoreCyberTrustRoot = 1006, | ||
| 22 | CybertrustGlobalRoot = 1007, | ||
| 23 | VerizonGlobalRootCA = 1008, | ||
| 24 | DigiCertAssuredIDRootCA = 1009, | ||
| 25 | DigiCertAssuredIDRootG2 = 1010, | ||
| 26 | DigiCertGlobalRootCA = 1011, | ||
| 27 | DigiCertGlobalRootG2 = 1012, | ||
| 28 | DigiCertHighAssuranceEVRootCA = 1013, | ||
| 29 | EntrustnetCertificationAuthority2048 = 1014, | ||
| 30 | EntrustRootCertificationAuthority = 1015, | ||
| 31 | EntrustRootCertificationAuthorityG2 = 1016, | ||
| 32 | GeoTrustGlobalCA2 = 1017, | ||
| 33 | GeoTrustGlobalCA = 1018, | ||
| 34 | GeoTrustPrimaryCertificationAuthorityG3 = 1019, | ||
| 35 | GeoTrustPrimaryCertificationAuthority = 1020, | ||
| 36 | GlobalSignRootCA = 1021, | ||
| 37 | GlobalSignRootCAR2 = 1022, | ||
| 38 | GlobalSignRootCAR3 = 1023, | ||
| 39 | GoDaddyClass2CertificationAuthority = 1024, | ||
| 40 | GoDaddyRootCertificateAuthorityG2 = 1025, | ||
| 41 | StarfieldClass2CertificationAuthority = 1026, | ||
| 42 | StarfieldRootCertificateAuthorityG2 = 1027, | ||
| 43 | thawtePrimaryRootCAG3 = 1028, | ||
| 44 | thawtePrimaryRootCA = 1029, | ||
| 45 | VeriSignClass3PublicPrimaryCertificationAuthorityG3 = 1030, | ||
| 46 | VeriSignClass3PublicPrimaryCertificationAuthorityG5 = 1031, | ||
| 47 | VeriSignUniversalRootCertificationAuthority = 1032, | ||
| 48 | DSTRootCAX3 = 1033, | ||
| 49 | USERTrustRsaCertificationAuthority = 1034, | ||
| 50 | ISRGRootX10 = 1035, | ||
| 51 | USERTrustEccCertificationAuthority = 1036, | ||
| 52 | COMODORsaCertificationAuthority = 1037, | ||
| 53 | COMODOEccCertificationAuthority = 1038, | ||
| 54 | AmazonRootCA2 = 1039, | ||
| 55 | AmazonRootCA3 = 1040, | ||
| 56 | AmazonRootCA4 = 1041, | ||
| 57 | DigiCertAssuredIDRootG3 = 1042, | ||
| 58 | DigiCertGlobalRootG3 = 1043, | ||
| 59 | DigiCertTrustedRootG4 = 1044, | ||
| 60 | EntrustRootCertificationAuthorityEC1 = 1045, | ||
| 61 | EntrustRootCertificationAuthorityG4 = 1046, | ||
| 62 | GlobalSignECCRootCAR4 = 1047, | ||
| 63 | GlobalSignECCRootCAR5 = 1048, | ||
| 64 | GlobalSignECCRootCAR6 = 1049, | ||
| 65 | GTSRootR1 = 1050, | ||
| 66 | GTSRootR2 = 1051, | ||
| 67 | GTSRootR3 = 1052, | ||
| 68 | GTSRootR4 = 1053, | ||
| 69 | SecurityCommunicationRootCA = 1054, | ||
| 70 | GlobalSignRootE4 = 1055, | ||
| 71 | GlobalSignRootR4 = 1056, | ||
| 72 | TTeleSecGlobalRootClass2 = 1057, | ||
| 73 | DigiCertTLSECCP384RootG5 = 1058, | ||
| 74 | DigiCertTLSRSA4096RootG5 = 1059, | ||
| 75 | }; | ||
| 76 | |||
| 77 | enum class TrustedCertStatus : s32 { | ||
| 78 | Invalid = -1, | ||
| 79 | Removed = 0, | ||
| 80 | EnabledTrusted = 1, | ||
| 81 | EnabledNotTrusted = 2, | ||
| 82 | Revoked = 3, | ||
| 83 | }; | ||
| 84 | |||
| 85 | struct BuiltInCertificateInfo { | ||
| 86 | CaCertificateId cert_id; | ||
| 87 | TrustedCertStatus status; | ||
| 88 | u64 der_size; | ||
| 89 | u64 der_offset; | ||
| 90 | }; | ||
| 91 | static_assert(sizeof(BuiltInCertificateInfo) == 0x18, "BuiltInCertificateInfo has incorrect size."); | ||
| 92 | |||
| 93 | struct CertStoreHeader { | ||
| 94 | u32 magic; | ||
| 95 | u32 num_entries; | ||
| 96 | }; | ||
| 97 | static_assert(sizeof(CertStoreHeader) == 0x8, "CertStoreHeader has incorrect size."); | ||
| 98 | |||
| 99 | struct CertStoreEntry { | ||
| 100 | CaCertificateId certificate_id; | ||
| 101 | TrustedCertStatus certificate_status; | ||
| 102 | u32 der_size; | ||
| 103 | u32 der_offset; | ||
| 104 | }; | ||
| 105 | static_assert(sizeof(CertStoreEntry) == 0x10, "CertStoreEntry has incorrect size."); | ||
| 106 | |||
| 107 | } // namespace Service::SSL | ||
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index ed7a5b27e..af237703d 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -1488,7 +1488,10 @@ void BufferCache<P>::ImmediateUploadMemory([[maybe_unused]] Buffer& buffer, | |||
| 1488 | std::span<const u8> upload_span; | 1488 | std::span<const u8> upload_span; |
| 1489 | const DAddr device_addr = buffer.CpuAddr() + copy.dst_offset; | 1489 | const DAddr device_addr = buffer.CpuAddr() + copy.dst_offset; |
| 1490 | if (IsRangeGranular(device_addr, copy.size)) { | 1490 | if (IsRangeGranular(device_addr, copy.size)) { |
| 1491 | upload_span = std::span(device_memory.GetPointer<u8>(device_addr), copy.size); | 1491 | auto* const ptr = device_memory.GetPointer<u8>(device_addr); |
| 1492 | if (ptr != nullptr) { | ||
| 1493 | upload_span = std::span(ptr, copy.size); | ||
| 1494 | } | ||
| 1492 | } else { | 1495 | } else { |
| 1493 | if (immediate_buffer.empty()) { | 1496 | if (immediate_buffer.empty()) { |
| 1494 | immediate_buffer = ImmediateBuffer(largest_copy); | 1497 | immediate_buffer = ImmediateBuffer(largest_copy); |
diff --git a/src/video_core/buffer_cache/usage_tracker.h b/src/video_core/buffer_cache/usage_tracker.h index 5f8688d31..ae511ccb6 100644 --- a/src/video_core/buffer_cache/usage_tracker.h +++ b/src/video_core/buffer_cache/usage_tracker.h | |||
| @@ -26,6 +26,9 @@ public: | |||
| 26 | void Track(u64 offset, u64 size) noexcept { | 26 | void Track(u64 offset, u64 size) noexcept { |
| 27 | const size_t page = offset >> PAGE_SHIFT; | 27 | const size_t page = offset >> PAGE_SHIFT; |
| 28 | const size_t page_end = (offset + size) >> PAGE_SHIFT; | 28 | const size_t page_end = (offset + size) >> PAGE_SHIFT; |
| 29 | if (page_end < page || page_end >= pages.size()) { | ||
| 30 | return; | ||
| 31 | } | ||
| 29 | TrackPage(page, offset, size); | 32 | TrackPage(page, offset, size); |
| 30 | if (page == page_end) { | 33 | if (page == page_end) { |
| 31 | return; | 34 | return; |
| @@ -41,6 +44,9 @@ public: | |||
| 41 | [[nodiscard]] bool IsUsed(u64 offset, u64 size) const noexcept { | 44 | [[nodiscard]] bool IsUsed(u64 offset, u64 size) const noexcept { |
| 42 | const size_t page = offset >> PAGE_SHIFT; | 45 | const size_t page = offset >> PAGE_SHIFT; |
| 43 | const size_t page_end = (offset + size) >> PAGE_SHIFT; | 46 | const size_t page_end = (offset + size) >> PAGE_SHIFT; |
| 47 | if (page_end < page || page_end >= pages.size()) { | ||
| 48 | return false; | ||
| 49 | } | ||
| 44 | if (IsPageUsed(page, offset, size)) { | 50 | if (IsPageUsed(page, offset, size)) { |
| 45 | return true; | 51 | return true; |
| 46 | } | 52 | } |
diff --git a/src/video_core/control/channel_state.cpp b/src/video_core/control/channel_state.cpp index 832025d75..2539997d5 100644 --- a/src/video_core/control/channel_state.cpp +++ b/src/video_core/control/channel_state.cpp | |||
| @@ -16,8 +16,9 @@ namespace Tegra::Control { | |||
| 16 | 16 | ||
| 17 | ChannelState::ChannelState(s32 bind_id_) : bind_id{bind_id_}, initialized{} {} | 17 | ChannelState::ChannelState(s32 bind_id_) : bind_id{bind_id_}, initialized{} {} |
| 18 | 18 | ||
| 19 | void ChannelState::Init(Core::System& system, GPU& gpu) { | 19 | void ChannelState::Init(Core::System& system, GPU& gpu, u64 program_id_) { |
| 20 | ASSERT(memory_manager); | 20 | ASSERT(memory_manager); |
| 21 | program_id = program_id_; | ||
| 21 | dma_pusher = std::make_unique<Tegra::DmaPusher>(system, gpu, *memory_manager, *this); | 22 | dma_pusher = std::make_unique<Tegra::DmaPusher>(system, gpu, *memory_manager, *this); |
| 22 | maxwell_3d = std::make_unique<Engines::Maxwell3D>(system, *memory_manager); | 23 | maxwell_3d = std::make_unique<Engines::Maxwell3D>(system, *memory_manager); |
| 23 | fermi_2d = std::make_unique<Engines::Fermi2D>(*memory_manager); | 24 | fermi_2d = std::make_unique<Engines::Fermi2D>(*memory_manager); |
diff --git a/src/video_core/control/channel_state.h b/src/video_core/control/channel_state.h index 3a7b9872c..b385f4939 100644 --- a/src/video_core/control/channel_state.h +++ b/src/video_core/control/channel_state.h | |||
| @@ -40,11 +40,12 @@ struct ChannelState { | |||
| 40 | ChannelState(ChannelState&& other) noexcept = default; | 40 | ChannelState(ChannelState&& other) noexcept = default; |
| 41 | ChannelState& operator=(ChannelState&& other) noexcept = default; | 41 | ChannelState& operator=(ChannelState&& other) noexcept = default; |
| 42 | 42 | ||
| 43 | void Init(Core::System& system, GPU& gpu); | 43 | void Init(Core::System& system, GPU& gpu, u64 program_id); |
| 44 | 44 | ||
| 45 | void BindRasterizer(VideoCore::RasterizerInterface* rasterizer); | 45 | void BindRasterizer(VideoCore::RasterizerInterface* rasterizer); |
| 46 | 46 | ||
| 47 | s32 bind_id = -1; | 47 | s32 bind_id = -1; |
| 48 | u64 program_id = 0; | ||
| 48 | /// 3D engine | 49 | /// 3D engine |
| 49 | std::unique_ptr<Engines::Maxwell3D> maxwell_3d; | 50 | std::unique_ptr<Engines::Maxwell3D> maxwell_3d; |
| 50 | /// 2D engine | 51 | /// 2D engine |
diff --git a/src/video_core/control/channel_state_cache.cpp b/src/video_core/control/channel_state_cache.cpp index 4ebeb6356..f8c6a762d 100644 --- a/src/video_core/control/channel_state_cache.cpp +++ b/src/video_core/control/channel_state_cache.cpp | |||
| @@ -7,7 +7,7 @@ namespace VideoCommon { | |||
| 7 | 7 | ||
| 8 | ChannelInfo::ChannelInfo(Tegra::Control::ChannelState& channel_state) | 8 | ChannelInfo::ChannelInfo(Tegra::Control::ChannelState& channel_state) |
| 9 | : maxwell3d{*channel_state.maxwell_3d}, kepler_compute{*channel_state.kepler_compute}, | 9 | : maxwell3d{*channel_state.maxwell_3d}, kepler_compute{*channel_state.kepler_compute}, |
| 10 | gpu_memory{*channel_state.memory_manager} {} | 10 | gpu_memory{*channel_state.memory_manager}, program_id{channel_state.program_id} {} |
| 11 | 11 | ||
| 12 | template class VideoCommon::ChannelSetupCaches<VideoCommon::ChannelInfo>; | 12 | template class VideoCommon::ChannelSetupCaches<VideoCommon::ChannelInfo>; |
| 13 | 13 | ||
diff --git a/src/video_core/control/channel_state_cache.h b/src/video_core/control/channel_state_cache.h index 1dbfda299..7480d60d1 100644 --- a/src/video_core/control/channel_state_cache.h +++ b/src/video_core/control/channel_state_cache.h | |||
| @@ -39,6 +39,7 @@ public: | |||
| 39 | Tegra::Engines::Maxwell3D& maxwell3d; | 39 | Tegra::Engines::Maxwell3D& maxwell3d; |
| 40 | Tegra::Engines::KeplerCompute& kepler_compute; | 40 | Tegra::Engines::KeplerCompute& kepler_compute; |
| 41 | Tegra::MemoryManager& gpu_memory; | 41 | Tegra::MemoryManager& gpu_memory; |
| 42 | u64 program_id; | ||
| 42 | }; | 43 | }; |
| 43 | 44 | ||
| 44 | template <class P> | 45 | template <class P> |
| @@ -77,9 +78,10 @@ protected: | |||
| 77 | P* channel_state; | 78 | P* channel_state; |
| 78 | size_t current_channel_id{UNSET_CHANNEL}; | 79 | size_t current_channel_id{UNSET_CHANNEL}; |
| 79 | size_t current_address_space{}; | 80 | size_t current_address_space{}; |
| 80 | Tegra::Engines::Maxwell3D* maxwell3d; | 81 | Tegra::Engines::Maxwell3D* maxwell3d{}; |
| 81 | Tegra::Engines::KeplerCompute* kepler_compute; | 82 | Tegra::Engines::KeplerCompute* kepler_compute{}; |
| 82 | Tegra::MemoryManager* gpu_memory; | 83 | Tegra::MemoryManager* gpu_memory{}; |
| 84 | u64 program_id{}; | ||
| 83 | 85 | ||
| 84 | std::deque<P> channel_storage; | 86 | std::deque<P> channel_storage; |
| 85 | std::deque<size_t> free_channel_ids; | 87 | std::deque<size_t> free_channel_ids; |
diff --git a/src/video_core/control/channel_state_cache.inc b/src/video_core/control/channel_state_cache.inc index 31f792ddd..d882d8222 100644 --- a/src/video_core/control/channel_state_cache.inc +++ b/src/video_core/control/channel_state_cache.inc | |||
| @@ -58,6 +58,7 @@ void ChannelSetupCaches<P>::BindToChannel(s32 id) { | |||
| 58 | maxwell3d = &channel_state->maxwell3d; | 58 | maxwell3d = &channel_state->maxwell3d; |
| 59 | kepler_compute = &channel_state->kepler_compute; | 59 | kepler_compute = &channel_state->kepler_compute; |
| 60 | gpu_memory = &channel_state->gpu_memory; | 60 | gpu_memory = &channel_state->gpu_memory; |
| 61 | program_id = channel_state->program_id; | ||
| 61 | current_address_space = gpu_memory->GetID(); | 62 | current_address_space = gpu_memory->GetID(); |
| 62 | } | 63 | } |
| 63 | 64 | ||
| @@ -76,6 +77,7 @@ void ChannelSetupCaches<P>::EraseChannel(s32 id) { | |||
| 76 | maxwell3d = nullptr; | 77 | maxwell3d = nullptr; |
| 77 | kepler_compute = nullptr; | 78 | kepler_compute = nullptr; |
| 78 | gpu_memory = nullptr; | 79 | gpu_memory = nullptr; |
| 80 | program_id = 0; | ||
| 79 | } else if (current_channel_id != UNSET_CHANNEL) { | 81 | } else if (current_channel_id != UNSET_CHANNEL) { |
| 80 | channel_state = &channel_storage[current_channel_id]; | 82 | channel_state = &channel_storage[current_channel_id]; |
| 81 | } | 83 | } |
diff --git a/src/video_core/engines/draw_manager.cpp b/src/video_core/engines/draw_manager.cpp index d77ff455b..971025cb5 100644 --- a/src/video_core/engines/draw_manager.cpp +++ b/src/video_core/engines/draw_manager.cpp | |||
| @@ -216,14 +216,11 @@ void DrawManager::DrawTexture() { | |||
| 216 | const bool lower_left{regs.window_origin.mode != | 216 | const bool lower_left{regs.window_origin.mode != |
| 217 | Maxwell3D::Regs::WindowOrigin::Mode::UpperLeft}; | 217 | Maxwell3D::Regs::WindowOrigin::Mode::UpperLeft}; |
| 218 | if (lower_left) { | 218 | if (lower_left) { |
| 219 | draw_texture_state.dst_y0 -= dst_height; | 219 | draw_texture_state.dst_y0 = |
| 220 | static_cast<f32>(regs.surface_clip.height) - draw_texture_state.dst_y0; | ||
| 220 | } | 221 | } |
| 221 | draw_texture_state.dst_x1 = | 222 | draw_texture_state.dst_x1 = draw_texture_state.dst_x0 + dst_width; |
| 222 | draw_texture_state.dst_x0 + | 223 | draw_texture_state.dst_y1 = draw_texture_state.dst_y0 + dst_height; |
| 223 | static_cast<f32>(Settings::values.resolution_info.ScaleUp(static_cast<u32>(dst_width))); | ||
| 224 | draw_texture_state.dst_y1 = | ||
| 225 | draw_texture_state.dst_y0 + | ||
| 226 | static_cast<f32>(Settings::values.resolution_info.ScaleUp(static_cast<u32>(dst_height))); | ||
| 227 | draw_texture_state.src_x0 = static_cast<float>(regs.draw_texture.src_x0) / 4096.f; | 224 | draw_texture_state.src_x0 = static_cast<float>(regs.draw_texture.src_x0) / 4096.f; |
| 228 | draw_texture_state.src_y0 = static_cast<float>(regs.draw_texture.src_y0) / 4096.f; | 225 | draw_texture_state.src_y0 = static_cast<float>(regs.draw_texture.src_y0) / 4096.f; |
| 229 | draw_texture_state.src_x1 = | 226 | draw_texture_state.src_x1 = |
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 8e663f2a8..6d0b32339 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -67,8 +67,8 @@ struct GPU::Impl { | |||
| 67 | return CreateChannel(new_channel_id++); | 67 | return CreateChannel(new_channel_id++); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | void InitChannel(Control::ChannelState& to_init) { | 70 | void InitChannel(Control::ChannelState& to_init, u64 program_id) { |
| 71 | to_init.Init(system, gpu); | 71 | to_init.Init(system, gpu, program_id); |
| 72 | to_init.BindRasterizer(rasterizer); | 72 | to_init.BindRasterizer(rasterizer); |
| 73 | rasterizer->InitializeChannel(to_init); | 73 | rasterizer->InitializeChannel(to_init); |
| 74 | } | 74 | } |
| @@ -412,8 +412,8 @@ std::shared_ptr<Control::ChannelState> GPU::AllocateChannel() { | |||
| 412 | return impl->AllocateChannel(); | 412 | return impl->AllocateChannel(); |
| 413 | } | 413 | } |
| 414 | 414 | ||
| 415 | void GPU::InitChannel(Control::ChannelState& to_init) { | 415 | void GPU::InitChannel(Control::ChannelState& to_init, u64 program_id) { |
| 416 | impl->InitChannel(to_init); | 416 | impl->InitChannel(to_init, program_id); |
| 417 | } | 417 | } |
| 418 | 418 | ||
| 419 | void GPU::BindChannel(s32 channel_id) { | 419 | void GPU::BindChannel(s32 channel_id) { |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index ad535512c..50014e51f 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -149,7 +149,7 @@ public: | |||
| 149 | 149 | ||
| 150 | std::shared_ptr<Control::ChannelState> AllocateChannel(); | 150 | std::shared_ptr<Control::ChannelState> AllocateChannel(); |
| 151 | 151 | ||
| 152 | void InitChannel(Control::ChannelState& to_init); | 152 | void InitChannel(Control::ChannelState& to_init, u64 program_id); |
| 153 | 153 | ||
| 154 | void BindChannel(s32 channel_id); | 154 | void BindChannel(s32 channel_id); |
| 155 | 155 | ||
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 16af8e6bd..d376d86d8 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -370,27 +370,32 @@ void RasterizerOpenGL::DrawTexture() { | |||
| 370 | const auto& sampler = texture_cache.GetGraphicsSampler(draw_texture_state.src_sampler); | 370 | const auto& sampler = texture_cache.GetGraphicsSampler(draw_texture_state.src_sampler); |
| 371 | const auto& texture = texture_cache.GetImageView(draw_texture_state.src_texture); | 371 | const auto& texture = texture_cache.GetImageView(draw_texture_state.src_texture); |
| 372 | 372 | ||
| 373 | const auto Scale = [&](auto dim) -> s32 { | ||
| 374 | return Settings::values.resolution_info.ScaleUp(static_cast<s32>(dim)); | ||
| 375 | }; | ||
| 376 | |||
| 377 | Region2D dst_region = { | ||
| 378 | Offset2D{.x = Scale(draw_texture_state.dst_x0), .y = Scale(draw_texture_state.dst_y0)}, | ||
| 379 | Offset2D{.x = Scale(draw_texture_state.dst_x1), .y = Scale(draw_texture_state.dst_y1)}}; | ||
| 380 | Region2D src_region = { | ||
| 381 | Offset2D{.x = Scale(draw_texture_state.src_x0), .y = Scale(draw_texture_state.src_y0)}, | ||
| 382 | Offset2D{.x = Scale(draw_texture_state.src_x1), .y = Scale(draw_texture_state.src_y1)}}; | ||
| 383 | Extent3D src_size = {static_cast<u32>(Scale(texture.size.width)), | ||
| 384 | static_cast<u32>(Scale(texture.size.height)), texture.size.depth}; | ||
| 385 | |||
| 373 | if (device.HasDrawTexture()) { | 386 | if (device.HasDrawTexture()) { |
| 374 | state_tracker.BindFramebuffer(texture_cache.GetFramebuffer()->Handle()); | 387 | state_tracker.BindFramebuffer(texture_cache.GetFramebuffer()->Handle()); |
| 375 | 388 | ||
| 376 | glDrawTextureNV(texture.DefaultHandle(), sampler->Handle(), draw_texture_state.dst_x0, | 389 | glDrawTextureNV(texture.DefaultHandle(), sampler->Handle(), |
| 377 | draw_texture_state.dst_y0, draw_texture_state.dst_x1, | 390 | static_cast<f32>(dst_region.start.x), static_cast<f32>(dst_region.start.y), |
| 378 | draw_texture_state.dst_y1, 0, | 391 | static_cast<f32>(dst_region.end.x), static_cast<f32>(dst_region.end.y), 0, |
| 379 | draw_texture_state.src_x0 / static_cast<float>(texture.size.width), | 392 | draw_texture_state.src_x0 / static_cast<float>(texture.size.width), |
| 380 | draw_texture_state.src_y0 / static_cast<float>(texture.size.height), | 393 | draw_texture_state.src_y0 / static_cast<float>(texture.size.height), |
| 381 | draw_texture_state.src_x1 / static_cast<float>(texture.size.width), | 394 | draw_texture_state.src_x1 / static_cast<float>(texture.size.width), |
| 382 | draw_texture_state.src_y1 / static_cast<float>(texture.size.height)); | 395 | draw_texture_state.src_y1 / static_cast<float>(texture.size.height)); |
| 383 | } else { | 396 | } else { |
| 384 | Region2D dst_region = {Offset2D{.x = static_cast<s32>(draw_texture_state.dst_x0), | ||
| 385 | .y = static_cast<s32>(draw_texture_state.dst_y0)}, | ||
| 386 | Offset2D{.x = static_cast<s32>(draw_texture_state.dst_x1), | ||
| 387 | .y = static_cast<s32>(draw_texture_state.dst_y1)}}; | ||
| 388 | Region2D src_region = {Offset2D{.x = static_cast<s32>(draw_texture_state.src_x0), | ||
| 389 | .y = static_cast<s32>(draw_texture_state.src_y0)}, | ||
| 390 | Offset2D{.x = static_cast<s32>(draw_texture_state.src_x1), | ||
| 391 | .y = static_cast<s32>(draw_texture_state.src_y1)}}; | ||
| 392 | blit_image.BlitColor(texture_cache.GetFramebuffer()->Handle(), texture.DefaultHandle(), | 397 | blit_image.BlitColor(texture_cache.GetFramebuffer()->Handle(), texture.DefaultHandle(), |
| 393 | sampler->Handle(), dst_region, src_region, texture.size); | 398 | sampler->Handle(), dst_region, src_region, src_size); |
| 394 | state_tracker.InvalidateState(); | 399 | state_tracker.InvalidateState(); |
| 395 | } | 400 | } |
| 396 | 401 | ||
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index 50462cdde..c4bad6fca 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp | |||
| @@ -215,6 +215,7 @@ ShaderCache::ShaderCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, | |||
| 215 | .support_gl_variable_aoffi = device.HasVariableAoffi(), | 215 | .support_gl_variable_aoffi = device.HasVariableAoffi(), |
| 216 | .support_gl_sparse_textures = device.HasSparseTexture2(), | 216 | .support_gl_sparse_textures = device.HasSparseTexture2(), |
| 217 | .support_gl_derivative_control = device.HasDerivativeControl(), | 217 | .support_gl_derivative_control = device.HasDerivativeControl(), |
| 218 | .support_geometry_streams = true, | ||
| 218 | 219 | ||
| 219 | .warp_size_potentially_larger_than_guest = device.IsWarpSizePotentiallyLargerThanGuest(), | 220 | .warp_size_potentially_larger_than_guest = device.IsWarpSizePotentiallyLargerThanGuest(), |
| 220 | 221 | ||
diff --git a/src/video_core/renderer_vulkan/vk_query_cache.cpp b/src/video_core/renderer_vulkan/vk_query_cache.cpp index 7cbc9c73c..a28296bda 100644 --- a/src/video_core/renderer_vulkan/vk_query_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_query_cache.cpp | |||
| @@ -1064,8 +1064,6 @@ public: | |||
| 1064 | } | 1064 | } |
| 1065 | }); | 1065 | }); |
| 1066 | } | 1066 | } |
| 1067 | auto* ptr = device_memory.GetPointer<u8>(new_query->dependant_address); | ||
| 1068 | ASSERT(ptr != nullptr); | ||
| 1069 | 1067 | ||
| 1070 | new_query->dependant_manage = must_manage_dependance; | 1068 | new_query->dependant_manage = must_manage_dependance; |
| 1071 | pending_flush_queries.push_back(index); | 1069 | pending_flush_queries.push_back(index); |
| @@ -1104,9 +1102,11 @@ public: | |||
| 1104 | tfb_streamer.Free(query->dependant_index); | 1102 | tfb_streamer.Free(query->dependant_index); |
| 1105 | } else { | 1103 | } else { |
| 1106 | u8* pointer = device_memory.GetPointer<u8>(query->dependant_address); | 1104 | u8* pointer = device_memory.GetPointer<u8>(query->dependant_address); |
| 1107 | u32 result; | 1105 | if (pointer != nullptr) { |
| 1108 | std::memcpy(&result, pointer, sizeof(u32)); | 1106 | u32 result; |
| 1109 | num_vertices = static_cast<u64>(result) / query->stride; | 1107 | std::memcpy(&result, pointer, sizeof(u32)); |
| 1108 | num_vertices = static_cast<u64>(result) / query->stride; | ||
| 1109 | } | ||
| 1110 | } | 1110 | } |
| 1111 | query->value = [&]() -> u64 { | 1111 | query->value = [&]() -> u64 { |
| 1112 | switch (query->topology) { | 1112 | switch (query->topology) { |
| @@ -1360,7 +1360,9 @@ bool QueryCacheRuntime::HostConditionalRenderingCompareValues(VideoCommon::Looku | |||
| 1360 | const auto check_value = [&](DAddr address) { | 1360 | const auto check_value = [&](DAddr address) { |
| 1361 | u8* ptr = impl->device_memory.GetPointer<u8>(address); | 1361 | u8* ptr = impl->device_memory.GetPointer<u8>(address); |
| 1362 | u64 value{}; | 1362 | u64 value{}; |
| 1363 | std::memcpy(&value, ptr, sizeof(value)); | 1363 | if (ptr != nullptr) { |
| 1364 | std::memcpy(&value, ptr, sizeof(value)); | ||
| 1365 | } | ||
| 1364 | return value == 0; | 1366 | return value == 0; |
| 1365 | }; | 1367 | }; |
| 1366 | std::array<VideoCommon::LookupData*, 2> objects{&object_1, &object_2}; | 1368 | std::array<VideoCommon::LookupData*, 2> objects{&object_1, &object_2}; |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 74f9f099e..8ba50a834 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -125,11 +125,23 @@ VkRect2D GetScissorState(const Maxwell& regs, size_t index, u32 up_scale = 1, u3 | |||
| 125 | return value < 0 ? std::min<s32>(converted_value - acumm, -1) | 125 | return value < 0 ? std::min<s32>(converted_value - acumm, -1) |
| 126 | : std::max<s32>(converted_value + acumm, 1); | 126 | : std::max<s32>(converted_value + acumm, 1); |
| 127 | }; | 127 | }; |
| 128 | |||
| 129 | const bool lower_left = regs.window_origin.mode != Maxwell::WindowOrigin::Mode::UpperLeft; | ||
| 130 | const s32 clip_height = regs.surface_clip.height; | ||
| 131 | |||
| 132 | // Flip coordinates if lower left | ||
| 133 | s32 min_y = lower_left ? (clip_height - src.max_y) : src.min_y.Value(); | ||
| 134 | s32 max_y = lower_left ? (clip_height - src.min_y) : src.max_y.Value(); | ||
| 135 | |||
| 136 | // Bound to render area | ||
| 137 | min_y = std::max(min_y, 0); | ||
| 138 | max_y = std::max(max_y, 0); | ||
| 139 | |||
| 128 | if (src.enable) { | 140 | if (src.enable) { |
| 129 | scissor.offset.x = scale_up(static_cast<s32>(src.min_x)); | 141 | scissor.offset.x = scale_up(src.min_x); |
| 130 | scissor.offset.y = scale_up(static_cast<s32>(src.min_y)); | 142 | scissor.offset.y = scale_up(min_y); |
| 131 | scissor.extent.width = scale_up(src.max_x - src.min_x); | 143 | scissor.extent.width = scale_up(src.max_x - src.min_x); |
| 132 | scissor.extent.height = scale_up(src.max_y - src.min_y); | 144 | scissor.extent.height = scale_up(max_y - min_y); |
| 133 | } else { | 145 | } else { |
| 134 | scissor.offset.x = 0; | 146 | scissor.offset.x = 0; |
| 135 | scissor.offset.y = 0; | 147 | scissor.offset.y = 0; |
| @@ -308,17 +320,33 @@ void RasterizerVulkan::DrawTexture() { | |||
| 308 | const auto& draw_texture_state = maxwell3d->draw_manager->GetDrawTextureState(); | 320 | const auto& draw_texture_state = maxwell3d->draw_manager->GetDrawTextureState(); |
| 309 | const auto& sampler = texture_cache.GetGraphicsSampler(draw_texture_state.src_sampler); | 321 | const auto& sampler = texture_cache.GetGraphicsSampler(draw_texture_state.src_sampler); |
| 310 | const auto& texture = texture_cache.GetImageView(draw_texture_state.src_texture); | 322 | const auto& texture = texture_cache.GetImageView(draw_texture_state.src_texture); |
| 311 | Region2D dst_region = {Offset2D{.x = static_cast<s32>(draw_texture_state.dst_x0), | 323 | const auto* framebuffer = texture_cache.GetFramebuffer(); |
| 312 | .y = static_cast<s32>(draw_texture_state.dst_y0)}, | 324 | |
| 313 | Offset2D{.x = static_cast<s32>(draw_texture_state.dst_x1), | 325 | const bool src_rescaling = texture_cache.IsRescaling() && texture.IsRescaled(); |
| 314 | .y = static_cast<s32>(draw_texture_state.dst_y1)}}; | 326 | const bool dst_rescaling = texture_cache.IsRescaling() && framebuffer->IsRescaled(); |
| 315 | Region2D src_region = {Offset2D{.x = static_cast<s32>(draw_texture_state.src_x0), | 327 | |
| 316 | .y = static_cast<s32>(draw_texture_state.src_y0)}, | 328 | const auto ScaleSrc = [&](auto dim_f) -> s32 { |
| 317 | Offset2D{.x = static_cast<s32>(draw_texture_state.src_x1), | 329 | auto dim = static_cast<s32>(dim_f); |
| 318 | .y = static_cast<s32>(draw_texture_state.src_y1)}}; | 330 | return src_rescaling ? Settings::values.resolution_info.ScaleUp(dim) : dim; |
| 319 | blit_image.BlitColor(texture_cache.GetFramebuffer(), texture.RenderTarget(), | 331 | }; |
| 320 | texture.ImageHandle(), sampler->Handle(), dst_region, src_region, | 332 | |
| 321 | texture.size); | 333 | const auto ScaleDst = [&](auto dim_f) -> s32 { |
| 334 | auto dim = static_cast<s32>(dim_f); | ||
| 335 | return dst_rescaling ? Settings::values.resolution_info.ScaleUp(dim) : dim; | ||
| 336 | }; | ||
| 337 | |||
| 338 | Region2D dst_region = {Offset2D{.x = ScaleDst(draw_texture_state.dst_x0), | ||
| 339 | .y = ScaleDst(draw_texture_state.dst_y0)}, | ||
| 340 | Offset2D{.x = ScaleDst(draw_texture_state.dst_x1), | ||
| 341 | .y = ScaleDst(draw_texture_state.dst_y1)}}; | ||
| 342 | Region2D src_region = {Offset2D{.x = ScaleSrc(draw_texture_state.src_x0), | ||
| 343 | .y = ScaleSrc(draw_texture_state.src_y0)}, | ||
| 344 | Offset2D{.x = ScaleSrc(draw_texture_state.src_x1), | ||
| 345 | .y = ScaleSrc(draw_texture_state.src_y1)}}; | ||
| 346 | Extent3D src_size = {static_cast<u32>(ScaleSrc(texture.size.width)), | ||
| 347 | static_cast<u32>(ScaleSrc(texture.size.height)), texture.size.depth}; | ||
| 348 | blit_image.BlitColor(framebuffer, texture.RenderTarget(), texture.ImageHandle(), | ||
| 349 | sampler->Handle(), dst_region, src_region, src_size); | ||
| 322 | } | 350 | } |
| 323 | 351 | ||
| 324 | void RasterizerVulkan::Clear(u32 layer_count) { | 352 | void RasterizerVulkan::Clear(u32 layer_count) { |
| @@ -1054,37 +1082,16 @@ void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D::Regs& regs) { | |||
| 1054 | regs.zeta.format == Tegra::DepthFormat::X8Z24_UNORM || | 1082 | regs.zeta.format == Tegra::DepthFormat::X8Z24_UNORM || |
| 1055 | regs.zeta.format == Tegra::DepthFormat::S8Z24_UNORM || | 1083 | regs.zeta.format == Tegra::DepthFormat::S8Z24_UNORM || |
| 1056 | regs.zeta.format == Tegra::DepthFormat::V8Z24_UNORM; | 1084 | regs.zeta.format == Tegra::DepthFormat::V8Z24_UNORM; |
| 1057 | bool force_unorm = ([&] { | 1085 | if (is_d24 && !device.SupportsD24DepthBuffer() && program_id == 0x1006A800016E000ULL) { |
| 1058 | if (!is_d24 || device.SupportsD24DepthBuffer()) { | 1086 | // Only activate this in Super Smash Brothers Ultimate |
| 1059 | return false; | ||
| 1060 | } | ||
| 1061 | if (device.IsExtDepthBiasControlSupported()) { | ||
| 1062 | return true; | ||
| 1063 | } | ||
| 1064 | if (!Settings::values.renderer_amdvlk_depth_bias_workaround) { | ||
| 1065 | return false; | ||
| 1066 | } | ||
| 1067 | // the base formulas can be obtained from here: | 1087 | // the base formulas can be obtained from here: |
| 1068 | // https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-output-merger-stage-depth-bias | 1088 | // https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-output-merger-stage-depth-bias |
| 1069 | const double rescale_factor = | 1089 | const double rescale_factor = |
| 1070 | static_cast<double>(1ULL << (32 - 24)) / (static_cast<double>(0x1.ep+127)); | 1090 | static_cast<double>(1ULL << (32 - 24)) / (static_cast<double>(0x1.ep+127)); |
| 1071 | units = static_cast<float>(static_cast<double>(units) * rescale_factor); | 1091 | units = static_cast<float>(static_cast<double>(units) * rescale_factor); |
| 1072 | return false; | 1092 | } |
| 1073 | })(); | ||
| 1074 | scheduler.Record([constant = units, clamp = regs.depth_bias_clamp, | 1093 | scheduler.Record([constant = units, clamp = regs.depth_bias_clamp, |
| 1075 | factor = regs.slope_scale_depth_bias, force_unorm, | 1094 | factor = regs.slope_scale_depth_bias](vk::CommandBuffer cmdbuf) { |
| 1076 | precise = device.HasExactDepthBiasControl()](vk::CommandBuffer cmdbuf) { | ||
| 1077 | if (force_unorm) { | ||
| 1078 | VkDepthBiasRepresentationInfoEXT info{ | ||
| 1079 | .sType = VK_STRUCTURE_TYPE_DEPTH_BIAS_REPRESENTATION_INFO_EXT, | ||
| 1080 | .pNext = nullptr, | ||
| 1081 | .depthBiasRepresentation = | ||
| 1082 | VK_DEPTH_BIAS_REPRESENTATION_LEAST_REPRESENTABLE_VALUE_FORCE_UNORM_EXT, | ||
| 1083 | .depthBiasExact = precise ? VK_TRUE : VK_FALSE, | ||
| 1084 | }; | ||
| 1085 | cmdbuf.SetDepthBias(constant, clamp, factor, &info); | ||
| 1086 | return; | ||
| 1087 | } | ||
| 1088 | cmdbuf.SetDepthBias(constant, clamp, factor); | 1095 | cmdbuf.SetDepthBias(constant, clamp, factor); |
| 1089 | }); | 1096 | }); |
| 1090 | } | 1097 | } |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 832b5e2b1..6d4deb0eb 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -1962,21 +1962,22 @@ Framebuffer::Framebuffer(TextureCacheRuntime& runtime, std::span<ImageView*, NUM | |||
| 1962 | } | 1962 | } |
| 1963 | 1963 | ||
| 1964 | Framebuffer::Framebuffer(TextureCacheRuntime& runtime, ImageView* color_buffer, | 1964 | Framebuffer::Framebuffer(TextureCacheRuntime& runtime, ImageView* color_buffer, |
| 1965 | ImageView* depth_buffer, VkExtent2D extent, bool is_rescaled) | 1965 | ImageView* depth_buffer, VkExtent2D extent, bool is_rescaled_) |
| 1966 | : render_area{extent} { | 1966 | : render_area{extent} { |
| 1967 | std::array<ImageView*, NUM_RT> color_buffers{color_buffer}; | 1967 | std::array<ImageView*, NUM_RT> color_buffers{color_buffer}; |
| 1968 | CreateFramebuffer(runtime, color_buffers, depth_buffer, is_rescaled); | 1968 | CreateFramebuffer(runtime, color_buffers, depth_buffer, is_rescaled_); |
| 1969 | } | 1969 | } |
| 1970 | 1970 | ||
| 1971 | Framebuffer::~Framebuffer() = default; | 1971 | Framebuffer::~Framebuffer() = default; |
| 1972 | 1972 | ||
| 1973 | void Framebuffer::CreateFramebuffer(TextureCacheRuntime& runtime, | 1973 | void Framebuffer::CreateFramebuffer(TextureCacheRuntime& runtime, |
| 1974 | std::span<ImageView*, NUM_RT> color_buffers, | 1974 | std::span<ImageView*, NUM_RT> color_buffers, |
| 1975 | ImageView* depth_buffer, bool is_rescaled) { | 1975 | ImageView* depth_buffer, bool is_rescaled_) { |
| 1976 | boost::container::small_vector<VkImageView, NUM_RT + 1> attachments; | 1976 | boost::container::small_vector<VkImageView, NUM_RT + 1> attachments; |
| 1977 | RenderPassKey renderpass_key{}; | 1977 | RenderPassKey renderpass_key{}; |
| 1978 | s32 num_layers = 1; | 1978 | s32 num_layers = 1; |
| 1979 | 1979 | ||
| 1980 | is_rescaled = is_rescaled_; | ||
| 1980 | const auto& resolution = runtime.resolution; | 1981 | const auto& resolution = runtime.resolution; |
| 1981 | 1982 | ||
| 1982 | u32 width = std::numeric_limits<u32>::max(); | 1983 | u32 width = std::numeric_limits<u32>::max(); |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index aaeb5ef93..8501ec384 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h | |||
| @@ -361,6 +361,10 @@ public: | |||
| 361 | return has_stencil; | 361 | return has_stencil; |
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | [[nodiscard]] bool IsRescaled() const noexcept { | ||
| 365 | return is_rescaled; | ||
| 366 | } | ||
| 367 | |||
| 364 | private: | 368 | private: |
| 365 | vk::Framebuffer framebuffer; | 369 | vk::Framebuffer framebuffer; |
| 366 | VkRenderPass renderpass{}; | 370 | VkRenderPass renderpass{}; |
| @@ -373,6 +377,7 @@ private: | |||
| 373 | std::array<size_t, NUM_RT> rt_map{}; | 377 | std::array<size_t, NUM_RT> rt_map{}; |
| 374 | bool has_depth{}; | 378 | bool has_depth{}; |
| 375 | bool has_stencil{}; | 379 | bool has_stencil{}; |
| 380 | bool is_rescaled{}; | ||
| 376 | }; | 381 | }; |
| 377 | 382 | ||
| 378 | struct TextureCacheParams { | 383 | struct TextureCacheParams { |
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index bfd3d00b6..feb1c575e 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -72,12 +72,19 @@ TextureCache<P>::TextureCache(Runtime& runtime_, Tegra::MaxwellDeviceMemoryManag | |||
| 72 | 72 | ||
| 73 | template <class P> | 73 | template <class P> |
| 74 | void TextureCache<P>::RunGarbageCollector() { | 74 | void TextureCache<P>::RunGarbageCollector() { |
| 75 | bool high_priority_mode = total_used_memory >= expected_memory; | 75 | bool high_priority_mode = false; |
| 76 | bool aggressive_mode = total_used_memory >= critical_memory; | 76 | bool aggressive_mode = false; |
| 77 | const u64 ticks_to_destroy = aggressive_mode ? 10ULL : high_priority_mode ? 25ULL : 50ULL; | 77 | u64 ticks_to_destroy = 0; |
| 78 | size_t num_iterations = aggressive_mode ? 40 : (high_priority_mode ? 20 : 10); | 78 | size_t num_iterations = 0; |
| 79 | const auto clean_up = [this, &num_iterations, &high_priority_mode, | 79 | |
| 80 | &aggressive_mode](ImageId image_id) { | 80 | const auto Configure = [&](bool allow_aggressive) { |
| 81 | high_priority_mode = total_used_memory >= expected_memory; | ||
| 82 | aggressive_mode = allow_aggressive && total_used_memory >= critical_memory; | ||
| 83 | ticks_to_destroy = aggressive_mode ? 10ULL : high_priority_mode ? 25ULL : 50ULL; | ||
| 84 | num_iterations = aggressive_mode ? 40 : (high_priority_mode ? 20 : 10); | ||
| 85 | }; | ||
| 86 | const auto Cleanup = [this, &num_iterations, &high_priority_mode, | ||
| 87 | &aggressive_mode](ImageId image_id) { | ||
| 81 | if (num_iterations == 0) { | 88 | if (num_iterations == 0) { |
| 82 | return true; | 89 | return true; |
| 83 | } | 90 | } |
| @@ -123,7 +130,16 @@ void TextureCache<P>::RunGarbageCollector() { | |||
| 123 | } | 130 | } |
| 124 | return false; | 131 | return false; |
| 125 | }; | 132 | }; |
| 126 | lru_cache.ForEachItemBelow(frame_tick - ticks_to_destroy, clean_up); | 133 | |
| 134 | // Try to remove anything old enough and not high priority. | ||
| 135 | Configure(false); | ||
| 136 | lru_cache.ForEachItemBelow(frame_tick - ticks_to_destroy, Cleanup); | ||
| 137 | |||
| 138 | // If pressure is still too high, prune aggressively. | ||
| 139 | if (total_used_memory >= critical_memory) { | ||
| 140 | Configure(true); | ||
| 141 | lru_cache.ForEachItemBelow(frame_tick - ticks_to_destroy, Cleanup); | ||
| 142 | } | ||
| 127 | } | 143 | } |
| 128 | 144 | ||
| 129 | template <class P> | 145 | template <class P> |
diff --git a/src/yuzu/configuration/configure_applets.cpp b/src/yuzu/configuration/configure_applets.cpp index 513ecb548..139bfa9da 100644 --- a/src/yuzu/configuration/configure_applets.cpp +++ b/src/yuzu/configuration/configure_applets.cpp | |||
| @@ -59,9 +59,7 @@ void ConfigureApplets::Setup(const ConfigurationShared::Builder& builder) { | |||
| 59 | 59 | ||
| 60 | // Untested applets | 60 | // Untested applets |
| 61 | if (setting->Id() == Settings::values.data_erase_applet_mode.Id() || | 61 | if (setting->Id() == Settings::values.data_erase_applet_mode.Id() || |
| 62 | setting->Id() == Settings::values.error_applet_mode.Id() || | ||
| 63 | setting->Id() == Settings::values.net_connect_applet_mode.Id() || | 62 | setting->Id() == Settings::values.net_connect_applet_mode.Id() || |
| 64 | setting->Id() == Settings::values.web_applet_mode.Id() || | ||
| 65 | setting->Id() == Settings::values.shop_applet_mode.Id() || | 63 | setting->Id() == Settings::values.shop_applet_mode.Id() || |
| 66 | setting->Id() == Settings::values.login_share_applet_mode.Id() || | 64 | setting->Id() == Settings::values.login_share_applet_mode.Id() || |
| 67 | setting->Id() == Settings::values.wifi_web_auth_applet_mode.Id() || | 65 | setting->Id() == Settings::values.wifi_web_auth_applet_mode.Id() || |