diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/hle/service/cmif_serialization.h | 50 | ||||
-rw-r--r-- | src/core/hle/service/mii/mii.cpp | 15 | ||||
-rw-r--r-- | src/core/hle/service/sockets/sockets.h | 1 | ||||
-rw-r--r-- | src/core/hle/service/sockets/sockets_translate.cpp | 2 |
4 files changed, 49 insertions, 19 deletions
diff --git a/src/core/hle/service/cmif_serialization.h b/src/core/hle/service/cmif_serialization.h index 9ee26400d..5eabf51fe 100644 --- a/src/core/hle/service/cmif_serialization.h +++ b/src/core/hle/service/cmif_serialization.h @@ -122,14 +122,14 @@ struct RequestLayout { u32 domain_interface_count; }; -template <ArgumentType Type1, ArgumentType Type2, typename MethodArguments, size_t PrevAlign = 1, size_t DataOffset = 0, size_t ArgIndex = 0> -constexpr u32 GetArgumentRawDataSize() { +template <typename MethodArguments, size_t PrevAlign = 1, size_t DataOffset = 0, size_t ArgIndex = 0> +constexpr u32 GetInRawDataSize() { if constexpr (ArgIndex >= std::tuple_size_v<MethodArguments>) { return static_cast<u32>(DataOffset); } else { using ArgType = std::tuple_element_t<ArgIndex, MethodArguments>; - if constexpr (ArgumentTraits<ArgType>::Type == Type1 || ArgumentTraits<ArgType>::Type == Type2) { + if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::InData || ArgumentTraits<ArgType>::Type == ArgumentType::InProcessId) { constexpr size_t ArgAlign = alignof(ArgType); constexpr size_t ArgSize = sizeof(ArgType); @@ -138,9 +138,33 @@ constexpr u32 GetArgumentRawDataSize() { constexpr size_t ArgOffset = Common::AlignUp(DataOffset, ArgAlign); constexpr size_t ArgEnd = ArgOffset + ArgSize; - return GetArgumentRawDataSize<Type1, Type2, MethodArguments, ArgAlign, ArgEnd, ArgIndex + 1>(); + return GetInRawDataSize<MethodArguments, ArgAlign, ArgEnd, ArgIndex + 1>(); + } else { + return GetInRawDataSize<MethodArguments, PrevAlign, DataOffset, ArgIndex + 1>(); + } + } +} + +template <typename MethodArguments, size_t PrevAlign = 1, size_t DataOffset = 0, size_t ArgIndex = 0> +constexpr u32 GetOutRawDataSize() { + if constexpr (ArgIndex >= std::tuple_size_v<MethodArguments>) { + return static_cast<u32>(DataOffset); + } else { + using ArgType = std::tuple_element_t<ArgIndex, MethodArguments>; + + if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::OutData) { + using RawArgType = typename ArgType::Type; + constexpr size_t ArgAlign = alignof(RawArgType); + constexpr size_t ArgSize = sizeof(RawArgType); + + static_assert(PrevAlign <= ArgAlign, "Output argument is not ordered by alignment"); + + constexpr size_t ArgOffset = Common::AlignUp(DataOffset, ArgAlign); + constexpr size_t ArgEnd = ArgOffset + ArgSize; + + return GetOutRawDataSize<MethodArguments, ArgAlign, ArgEnd, ArgIndex + 1>(); } else { - return GetArgumentRawDataSize<Type1, Type2, MethodArguments, PrevAlign, DataOffset, ArgIndex + 1>(); + return GetOutRawDataSize<MethodArguments, PrevAlign, DataOffset, ArgIndex + 1>(); } } } @@ -165,7 +189,7 @@ constexpr RequestLayout GetNonDomainReplyInLayout() { return RequestLayout{ .copy_handle_count = GetArgumentTypeCount<ArgumentType::InCopyHandle, MethodArguments>(), .move_handle_count = 0, - .cmif_raw_data_size = GetArgumentRawDataSize<ArgumentType::InData, ArgumentType::InProcessId, MethodArguments>(), + .cmif_raw_data_size = GetInRawDataSize<MethodArguments>(), .domain_interface_count = 0, }; } @@ -175,7 +199,7 @@ constexpr RequestLayout GetDomainReplyInLayout() { return RequestLayout{ .copy_handle_count = GetArgumentTypeCount<ArgumentType::InCopyHandle, MethodArguments>(), .move_handle_count = 0, - .cmif_raw_data_size = GetArgumentRawDataSize<ArgumentType::InData, ArgumentType::InProcessId, MethodArguments>(), + .cmif_raw_data_size = GetInRawDataSize<MethodArguments>(), .domain_interface_count = GetArgumentTypeCount<ArgumentType::InInterface, MethodArguments>(), }; } @@ -185,7 +209,7 @@ constexpr RequestLayout GetNonDomainReplyOutLayout() { return RequestLayout{ .copy_handle_count = GetArgumentTypeCount<ArgumentType::OutCopyHandle, MethodArguments>(), .move_handle_count = GetArgumentTypeCount<ArgumentType::OutMoveHandle, MethodArguments>() + GetArgumentTypeCount<ArgumentType::OutInterface, MethodArguments>(), - .cmif_raw_data_size = GetArgumentRawDataSize<ArgumentType::OutData, ArgumentType::OutData, MethodArguments>(), + .cmif_raw_data_size = GetOutRawDataSize<MethodArguments>(), .domain_interface_count = 0, }; } @@ -195,7 +219,7 @@ constexpr RequestLayout GetDomainReplyOutLayout() { return RequestLayout{ .copy_handle_count = GetArgumentTypeCount<ArgumentType::OutCopyHandle, MethodArguments>(), .move_handle_count = GetArgumentTypeCount<ArgumentType::OutMoveHandle, MethodArguments>(), - .cmif_raw_data_size = GetArgumentRawDataSize<ArgumentType::OutData, ArgumentType::OutData, MethodArguments>(), + .cmif_raw_data_size = GetOutRawDataSize<MethodArguments>(), .domain_interface_count = GetArgumentTypeCount<ArgumentType::OutInterface, MethodArguments>(), }; } @@ -337,13 +361,15 @@ void WriteOutArgument(bool is_domain, CallArguments& args, u8* raw_data, HLERequ using ArgType = std::tuple_element_t<ArgIndex, MethodArguments>; if constexpr (ArgumentTraits<ArgType>::Type == ArgumentType::OutData) { - constexpr size_t ArgAlign = alignof(ArgType); - constexpr size_t ArgSize = sizeof(ArgType); + using RawArgType = decltype(std::get<ArgIndex>(args).raw); + constexpr size_t ArgAlign = alignof(RawArgType); + constexpr size_t ArgSize = sizeof(RawArgType); static_assert(PrevAlign <= ArgAlign, "Output argument is not ordered by alignment"); static_assert(!RawDataFinished, "All output interface arguments must appear after raw data"); static_assert(!std::is_pointer_v<ArgType>, "Output raw data must not be a pointer"); - static_assert(std::is_trivially_copyable_v<decltype(std::get<ArgIndex>(args).raw)>, "Output raw data must be trivially copyable"); + static_assert(!std::is_pointer_v<RawArgType>, "Output raw data must not be a pointer"); + static_assert(std::is_trivially_copyable_v<RawArgType>, "Output raw data must be trivially copyable"); constexpr size_t ArgOffset = Common::AlignUp(DataOffset, ArgAlign); constexpr size_t ArgEnd = ArgOffset + ArgSize; diff --git a/src/core/hle/service/mii/mii.cpp b/src/core/hle/service/mii/mii.cpp index b4d16fed5..efb7f6e32 100644 --- a/src/core/hle/service/mii/mii.cpp +++ b/src/core/hle/service/mii/mii.cpp @@ -111,7 +111,8 @@ private: R_RETURN(result); } - Result UpdateLatest(Out<CharInfo> out_char_info, CharInfo& char_info, SourceFlag source_flag) { + Result UpdateLatest(Out<CharInfo> out_char_info, const CharInfo& char_info, + SourceFlag source_flag) { LOG_INFO(Service_Mii, "called with source_flag={}", source_flag); R_RETURN(manager->UpdateLatest(metadata, *out_char_info, char_info, source_flag)); @@ -159,7 +160,7 @@ private: R_RETURN(result); } - Result UpdateLatest1(Out<StoreData> out_store_data, StoreData& store_data, + Result UpdateLatest1(Out<StoreData> out_store_data, const StoreData& store_data, SourceFlag source_flag) { LOG_INFO(Service_Mii, "called with source_flag={}", source_flag); R_UNLESS(is_system, ResultPermissionDenied); @@ -243,7 +244,7 @@ private: R_SUCCEED(); } - Result GetIndex(Out<s32> out_index, CharInfo& char_info) { + Result GetIndex(Out<s32> out_index, const CharInfo& char_info) { LOG_DEBUG(Service_Mii, "called"); R_RETURN(manager->GetIndex(metadata, char_info, *out_index)); @@ -257,25 +258,25 @@ private: R_SUCCEED(); } - Result Convert(Out<CharInfo> out_char_info, Ver3StoreData& mii_v3) { + Result Convert(Out<CharInfo> out_char_info, const Ver3StoreData& mii_v3) { LOG_INFO(Service_Mii, "called"); R_RETURN(manager->ConvertV3ToCharInfo(*out_char_info, mii_v3)); } - Result ConvertCoreDataToCharInfo(Out<CharInfo> out_char_info, CoreData& core_data) { + Result ConvertCoreDataToCharInfo(Out<CharInfo> out_char_info, const CoreData& core_data) { LOG_INFO(Service_Mii, "called"); R_RETURN(manager->ConvertCoreDataToCharInfo(*out_char_info, core_data)); } - Result ConvertCharInfoToCoreData(Out<CoreData> out_core_data, CharInfo& char_info) { + Result ConvertCharInfoToCoreData(Out<CoreData> out_core_data, const CharInfo& char_info) { LOG_INFO(Service_Mii, "called"); R_RETURN(manager->ConvertCharInfoToCoreData(*out_core_data, char_info)); } - Result Append(CharInfo& char_info) { + Result Append(const CharInfo& char_info) { LOG_INFO(Service_Mii, "called"); R_RETURN(manager->Append(metadata, char_info)); diff --git a/src/core/hle/service/sockets/sockets.h b/src/core/hle/service/sockets/sockets.h index f86af01a4..f3ea31bde 100644 --- a/src/core/hle/service/sockets/sockets.h +++ b/src/core/hle/service/sockets/sockets.h @@ -24,6 +24,7 @@ enum class Errno : u32 { CONNRESET = 104, NOTCONN = 107, TIMEDOUT = 110, + CONNREFUSED = 111, INPROGRESS = 115, }; diff --git a/src/core/hle/service/sockets/sockets_translate.cpp b/src/core/hle/service/sockets/sockets_translate.cpp index aed05250c..21bb3e776 100644 --- a/src/core/hle/service/sockets/sockets_translate.cpp +++ b/src/core/hle/service/sockets/sockets_translate.cpp @@ -25,6 +25,8 @@ Errno Translate(Network::Errno value) { return Errno::MFILE; case Network::Errno::PIPE: return Errno::PIPE; + case Network::Errno::CONNREFUSED: + return Errno::CONNREFUSED; case Network::Errno::NOTCONN: return Errno::NOTCONN; case Network::Errno::TIMEDOUT: |