mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-05 09:13:43 -04:00
tipc: tentative core serialization logic (missing imports, won't compile)
This commit is contained in:
parent
dc6a0d7562
commit
e93d71d932
6 changed files with 688 additions and 7 deletions
|
@ -65,6 +65,7 @@
|
|||
#include <vapours/results/spl_results.hpp>
|
||||
#include <vapours/results/svc_results.hpp>
|
||||
#include <vapours/results/time_results.hpp>
|
||||
#include <vapours/results/tipc_results.hpp>
|
||||
#include <vapours/results/tma_results.hpp>
|
||||
#include <vapours/results/updater_results.hpp>
|
||||
#include <vapours/results/usb_results.hpp>
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::tipc {
|
||||
|
||||
R_DEFINE_NAMESPACE_RESULT_MODULE(35);
|
||||
|
||||
R_DEFINE_ERROR_RESULT(InvalidMethod, 10);
|
||||
R_DEFINE_ERROR_RESULT(InvalidMessageFormat, 15);
|
||||
|
||||
R_DEFINE_ERROR_RESULT(RequestDeferred, 100);
|
||||
R_DEFINE_ERROR_RESULT(SessionClosed, 101);
|
||||
|
||||
}
|
|
@ -410,20 +410,24 @@ namespace ams::svc::ipc {
|
|||
|
||||
template<typename T>
|
||||
ALWAYS_INLINE const T &GetRaw(s32 index) const {
|
||||
return *reinterpret_cast<const T *>(this->buffer + index);
|
||||
if constexpr (!std::same_as<T, bool>) {
|
||||
return *reinterpret_cast<const T *>(this->buffer + index);
|
||||
} else {
|
||||
return *reinterpret_cast<const u8 *>(this->buffer + index) & 1;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
ALWAYS_INLINE s32 SetRaw(s32 index, const T &val) {
|
||||
ALWAYS_INLINE s32 SetRaw(s32 index, const T &val) const {
|
||||
*reinterpret_cast<const T *>(this->buffer + index) = val;
|
||||
return index + (util::AlignUp(sizeof(val), sizeof(*this->buffer)) / sizeof(*this->buffer));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void GetRawArray(s32 index, void *dst, size_t len) {
|
||||
ALWAYS_INLINE void GetRawArray(s32 index, void *dst, size_t len) const {
|
||||
__builtin_memcpy(dst, this->buffer + index, len);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void SetRawArray(s32 index, const void *src, size_t len) {
|
||||
ALWAYS_INLINE void SetRawArray(s32 index, const void *src, size_t len) const {
|
||||
__builtin_memcpy(this->buffer + index, src, len);
|
||||
}
|
||||
|
||||
|
@ -489,10 +493,18 @@ namespace ams::svc::ipc {
|
|||
__builtin_memcpy(this->buffer + index, std::addressof(value), sizeof(value));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u32 Get32(s32 index) const {
|
||||
return this->buffer[index];
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u64 Get64(s32 index) const {
|
||||
u64 value;
|
||||
__builtin_memcpy(std::addressof(value), this->buffer + index, sizeof(value));
|
||||
return value;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u64 GetProcessId(s32 index) const {
|
||||
u64 pid;
|
||||
__builtin_memcpy(std::addressof(pid), this->buffer + index, sizeof(pid));
|
||||
return pid;
|
||||
return this->Get64(index);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE ams::svc::Handle GetHandle(s32 index) const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue