diff --git a/include/meta_tools.hpp b/include/meta_tools.hpp index 0c9e921f..040680d1 100644 --- a/include/meta_tools.hpp +++ b/include/meta_tools.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere.hpp b/include/stratosphere.hpp index cc386d67..b9141543 100644 --- a/include/stratosphere.hpp +++ b/include/stratosphere.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include "stratosphere/utilities.hpp" diff --git a/include/stratosphere/emummc_utilities.hpp b/include/stratosphere/emummc_utilities.hpp index 04bcfd7d..d2b52e04 100644 --- a/include/stratosphere/emummc_utilities.hpp +++ b/include/stratosphere/emummc_utilities.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include #include diff --git a/include/stratosphere/ipc.hpp b/include/stratosphere/ipc.hpp index 9c72d84b..09cdf25f 100644 --- a/include/stratosphere/ipc.hpp +++ b/include/stratosphere/ipc.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include "ipc/ipc_service_object.hpp" diff --git a/include/stratosphere/ipc/ipc_buffers.hpp b/include/stratosphere/ipc/ipc_buffers.hpp index 2786a5e5..903ee435 100644 --- a/include/stratosphere/ipc/ipc_buffers.hpp +++ b/include/stratosphere/ipc/ipc_buffers.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include #include @@ -39,12 +39,12 @@ struct InBuffer : public InBufferBase { size_t num_elements; BufferType type; static const BufferType expected_type = e_t; - + /* Convenience. */ T& operator[](size_t i) const { return buffer[i]; } - + InBuffer(void *b, size_t n, BufferType t) : buffer((T *)b), num_elements(n/sizeof(T)), type(t) { } }; @@ -57,12 +57,12 @@ struct OutBuffer : OutBufferBase { size_t num_elements; BufferType type; static const BufferType expected_type = e_t; - + /* Convenience. */ T& operator[](size_t i) const { return buffer[i]; } - + OutBuffer(void *b, size_t n, BufferType t) : buffer((T *)b), num_elements(n/sizeof(T)), type(t) { } }; @@ -73,29 +73,29 @@ template struct InPointer : public InPointerBase { T *pointer; size_t num_elements; - + /* Convenience. */ T& operator[](size_t i) const { return pointer[i]; } - + InPointer(void *p, size_t n) : pointer((T *)p), num_elements(n/sizeof(T)) { } }; /* Represents a C descriptor. */ struct OutPointerWithServerSizeBase : public IpcBufferBase {}; - + template struct OutPointerWithServerSize : public OutPointerWithServerSizeBase { T *pointer; static const size_t num_elements = N; static const size_t element_size = sizeof(T); - + /* Convenience. */ T& operator[](size_t i) const { return pointer[i]; } - + OutPointerWithServerSize(void *p) : pointer((T *)p) { } OutPointerWithServerSize(void *p, size_t n) : pointer((T *)p) { } }; @@ -107,11 +107,11 @@ template struct OutPointerWithClientSize : public OutPointerWithClientSizeBase { T *pointer; size_t num_elements; - + /* Convenience. */ T& operator[](size_t i) const { return pointer[i]; } - + OutPointerWithClientSize(void *p, size_t n) : pointer((T *)p), num_elements(n/sizeof(T)) { } }; diff --git a/include/stratosphere/ipc/ipc_domain_object.hpp b/include/stratosphere/ipc/ipc_domain_object.hpp index b0c01252..3cc9cbca 100644 --- a/include/stratosphere/ipc/ipc_domain_object.hpp +++ b/include/stratosphere/ipc/ipc_domain_object.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include #include @@ -43,39 +43,39 @@ class IDomainObject : public IServiceObject { DomainManager *manager; public: IDomainObject(DomainManager *m) : manager(m) {} - + virtual ~IDomainObject() override { this->manager->FreeDomain(this); } - + DomainManager *GetManager() { return this->manager; } - + ServiceObjectHolder *GetObject(u32 object_id) { return this->manager->GetObject(this, object_id); } - + Result ReserveObject(u32 *out_object_id) { return this->manager->ReserveObject(this, out_object_id); } - + Result ReserveSpecificObject(u32 object_id) { return this->manager->ReserveSpecificObject(this, object_id); } - + void SetObject(u32 object_id, ServiceObjectHolder&& holder) { this->manager->SetObject(this, object_id, std::move(holder)); } - + Result FreeObject(u32 object_id) { return this->manager->FreeObject(this, object_id); } - + Result ForceFreeObject(u32 object_id) { return this->manager->ForceFreeObject(object_id); } - + public: DEFINE_SERVICE_DISPATCH_TABLE { /* IDomainObject has no callable functions. */ @@ -94,36 +94,36 @@ static constexpr bool IsDomainObject(ServiceObjectHolder *holder) { template class Out> : public OutSessionTag { static_assert(std::is_base_of_v, "OutSessions must be shared_ptr!"); - + template friend class Out; - + private: std::shared_ptr *srv; IDomainObject *domain = nullptr; u32 *object_id = nullptr; public: Out>(std::shared_ptr *s, IDomainObject *dm, u32 *o) : srv(reinterpret_cast *>(s)), domain(dm), object_id(o) { } - + ServiceObjectHolder GetHolder() { std::shared_ptr clone = *srv; return ServiceObjectHolder(std::move(clone)); } - + bool IsDomain() { return domain != nullptr; } - + u32 GetObjectId() { return *object_id; } - + void ChangeObjectId(u32 o) { domain->ForceFreeObject(*object_id); domain->ReserveSpecificObject(o); *object_id = o; } - + void SetValue(std::shared_ptr &&s) { *this->srv = std::move(s); } diff --git a/include/stratosphere/ipc/ipc_out.hpp b/include/stratosphere/ipc/ipc_out.hpp index c3dc6bfd..aba2254e 100644 --- a/include/stratosphere/ipc/ipc_out.hpp +++ b/include/stratosphere/ipc/ipc_out.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include #include @@ -36,26 +36,26 @@ template class Out::value || AllowedOut::value>::type> : public OutDataTag { private: T *obj; -public: +public: Out(T *o) : obj(o) { } - + void SetValue(const T& t) { *obj = t; } - + const T& GetValue() { return *obj; } - + T *GetPointer() { return obj; } - + /* Convenience operators. */ T& operator*() { return *obj; } - + T* operator->() { return obj; } diff --git a/include/stratosphere/ipc/ipc_response_context.hpp b/include/stratosphere/ipc/ipc_response_context.hpp index cb120dd1..f1f87482 100644 --- a/include/stratosphere/ipc/ipc_response_context.hpp +++ b/include/stratosphere/ipc/ipc_response_context.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/ipc/ipc_service_object.hpp b/include/stratosphere/ipc/ipc_service_object.hpp index 01040513..0341c92a 100644 --- a/include/stratosphere/ipc/ipc_service_object.hpp +++ b/include/stratosphere/ipc/ipc_service_object.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include #include @@ -39,7 +39,7 @@ class IServiceObject { }; #define SERVICE_DISPATCH_TABLE_NAME s_DispatchTable -#define DEFINE_SERVICE_DISPATCH_TABLE static constexpr ServiceCommandMeta SERVICE_DISPATCH_TABLE_NAME[] +#define DEFINE_SERVICE_DISPATCH_TABLE static constexpr ServiceCommandMeta SERVICE_DISPATCH_TABLE_NAME[] template static constexpr size_t DispatchTableEntryCount() { @@ -63,7 +63,7 @@ class ServiceObjectHolder { std::shared_ptr srv; const ServiceCommandMeta *dispatch_table; size_t entry_count; - + /* Private copy constructor. */ ServiceObjectHolder(const ServiceObjectHolder& other) : srv(other.srv), dispatch_table(other.dispatch_table), entry_count(other.entry_count) { } ServiceObjectHolder& operator=(const ServiceObjectHolder& other); @@ -71,7 +71,7 @@ class ServiceObjectHolder { /* Templated constructor ensures correct type id at runtime. */ template explicit ServiceObjectHolder(std::shared_ptr&& s) : srv(std::move(s)), dispatch_table(DispatchTable()), entry_count(DispatchTableEntryCount()) { } - + template ServiceImpl *GetServiceObject() const { if (GetServiceId() == ServiceObjectId()) { @@ -79,33 +79,33 @@ class ServiceObjectHolder { } return nullptr; } - + template ServiceImpl *GetServiceObjectUnsafe() const { return static_cast(this->srv.get()); } - + const ServiceCommandMeta *GetDispatchTable() const { return this->dispatch_table; } - + size_t GetDispatchTableEntryCount() const { return this->entry_count; } - + constexpr uintptr_t GetServiceId() const { return reinterpret_cast(this->dispatch_table); } - + bool IsMitmObject() const { return this->srv->IsMitmObject(); } - + /* Default constructor, move constructor, move assignment operator. */ ServiceObjectHolder() : srv(nullptr), dispatch_table(nullptr) { } ServiceObjectHolder(ServiceObjectHolder&& other) : srv(std::move(other.srv)), dispatch_table(std::move(other.dispatch_table)), entry_count(std::move(other.entry_count)) { } - + ServiceObjectHolder& operator=(ServiceObjectHolder&& other) { this->srv = other.srv; this->dispatch_table = other.dispatch_table; @@ -113,21 +113,21 @@ class ServiceObjectHolder { other.Reset(); return *this; } - + explicit operator bool() const { return this->srv != nullptr; } - + bool operator!() const { return this->srv == nullptr; } - + void Reset() { this->srv.reset(); this->dispatch_table = nullptr; this->entry_count = 0; } - + ServiceObjectHolder Clone() const { ServiceObjectHolder clone(*this); return clone; diff --git a/include/stratosphere/ipc/ipc_session_manager_base.hpp b/include/stratosphere/ipc/ipc_session_manager_base.hpp index 6358ff96..ed980115 100644 --- a/include/stratosphere/ipc/ipc_session_manager_base.hpp +++ b/include/stratosphere/ipc/ipc_session_manager_base.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include @@ -23,10 +23,10 @@ class SessionManagerBase : public WaitableManagerBase, public DomainManager { public: SessionManagerBase() = default; - virtual ~SessionManagerBase() = default; - + virtual ~SessionManagerBase() = default; + virtual void AddSession(Handle server_h, ServiceObjectHolder &&service) = 0; - + static Result CreateSessionHandles(Handle *server_h, Handle *client_h) { return svcCreateSession(server_h, client_h, 0, 0); } diff --git a/include/stratosphere/ipc/ipc_special.hpp b/include/stratosphere/ipc/ipc_special.hpp index d8dcd674..0588631b 100644 --- a/include/stratosphere/ipc/ipc_special.hpp +++ b/include/stratosphere/ipc/ipc_special.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include #include @@ -25,11 +25,11 @@ struct PidDescriptorTag{}; struct PidDescriptor : public PidDescriptorTag { u64 pid; - + void operator=(u64 &p) { pid = p; } - + PidDescriptor(u64 p) : pid(p) { } }; @@ -44,12 +44,12 @@ struct MovedHandle : public IpcHandle { void operator=(const Handle &h) { this->handle = h; } - + void operator=(const IpcHandle &o) { this->handle = o.handle; } - - MovedHandle(Handle h) { + + MovedHandle(Handle h) { this->handle = h; } }; @@ -59,12 +59,12 @@ struct CopiedHandle : public IpcHandle { void operator=(const Handle &h) { handle = h; } - + void operator=(const IpcHandle &o) { this->handle = o.handle; } - - CopiedHandle(Handle h) { + + CopiedHandle(Handle h) { this->handle = h; } }; @@ -73,34 +73,34 @@ template <> class Out : public OutHandleTag { private: MovedHandle *obj; -public: +public: Out(IpcHandle *o) : obj(static_cast(o)) { } - + void SetValue(const Handle& h) { *obj = h; } - + void SetValue(const MovedHandle& o) { *obj = o; } - + const MovedHandle& GetValue() { return *obj; } - + MovedHandle* GetPointer() { return obj; } - + Handle* GetHandlePointer() { return &obj->handle; } - + /* Convenience operators. */ MovedHandle& operator*() { return *obj; } - + MovedHandle* operator->() { return obj; } @@ -110,34 +110,34 @@ template <> class Out : public OutHandleTag { private: CopiedHandle *obj; -public: +public: Out(IpcHandle *o) : obj(static_cast(o)) { } - + void SetValue(const Handle& h) { *obj = h; } - + void SetValue(const CopiedHandle& o) { *obj = o; } - + const CopiedHandle& GetValue() { return *obj; } - + CopiedHandle* GetPointer() { return obj; } - + Handle* GetHandlePointer() { return &obj->handle; } - + /* Convenience operators. */ CopiedHandle& operator*() { return *obj; } - + CopiedHandle* operator->() { return obj; } diff --git a/include/stratosphere/iwaitable.hpp b/include/stratosphere/iwaitable.hpp index ccd2beae..9997a42e 100644 --- a/include/stratosphere/iwaitable.hpp +++ b/include/stratosphere/iwaitable.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include @@ -31,46 +31,46 @@ class IWaitable { bool is_signaled = false; public: virtual ~IWaitable() = default; - + virtual Result HandleDeferred() { /* By default, HandleDeferred panics, because object shouldn't be deferrable. */ std::abort(); } - + bool IsSignaled() { std::scoped_lock lock(this->sig_lock); return this->is_signaled; } - + virtual Handle GetHandle() = 0; virtual Result HandleSignaled(u64 timeout) = 0; - + WaitableManagerBase *GetManager() { return this->manager; } - + void SetManager(WaitableManagerBase *m) { this->manager = m; } - + void UpdatePriority() { if (manager) { this->wait_priority = this->manager->GetNextPriority(); } } - + bool IsDeferred() { return this->is_deferred; } - + void SetDeferred(bool d) { this->is_deferred = d; } - + static bool Compare(IWaitable *a, IWaitable *b) { return (a->wait_priority < b->wait_priority) && !a->IsDeferred() && (a->GetHandle() != INVALID_HANDLE); } - + void NotifyManagerSignaled() { if (this->manager) { this->manager->NotifySignaled(this); diff --git a/include/stratosphere/message_queue.hpp b/include/stratosphere/message_queue.hpp index c062bcaf..cd9dc743 100644 --- a/include/stratosphere/message_queue.hpp +++ b/include/stratosphere/message_queue.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include #include "hossynch.hpp" @@ -26,31 +26,31 @@ class HosMessageQueue { HosCondVar cv_not_empty; std::unique_ptr buffer; size_t capacity; - + size_t count = 0; size_t offset = 0; public: HosMessageQueue(size_t c) : capacity(c) { this->buffer = std::make_unique(this->capacity); } - + HosMessageQueue(std::unique_ptr buf, size_t c) : buffer(std::move(buf)), capacity(c) { } - + /* Sending (FIFO functionality) */ void Send(uintptr_t data); bool TrySend(uintptr_t data); bool TimedSend(uintptr_t data, u64 timeout); - + /* Sending (LIFO functionality) */ void SendNext(uintptr_t data); bool TrySendNext(uintptr_t data); bool TimedSendNext(uintptr_t data, u64 timeout); - + /* Receive functionality */ void Receive(uintptr_t *out); bool TryReceive(uintptr_t *out); bool TimedReceive(uintptr_t *out, u64 timeout); - + /* Peek functionality */ void Peek(uintptr_t *out); bool TryPeek(uintptr_t *out); @@ -59,11 +59,11 @@ class HosMessageQueue { bool IsFull() { return this->count >= this->capacity; } - + bool IsEmpty() { return this->count == 0; } - + void SendInternal(uintptr_t data); void SendNextInternal(uintptr_t data); uintptr_t ReceiveInternal(); diff --git a/include/stratosphere/mitm.hpp b/include/stratosphere/mitm.hpp index 648a8117..1f7a4c32 100644 --- a/include/stratosphere/mitm.hpp +++ b/include/stratosphere/mitm.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include "mitm/sm_mitm.h" diff --git a/include/stratosphere/mitm/imitmserviceobject.hpp b/include/stratosphere/mitm/imitmserviceobject.hpp index db33550d..83351a04 100644 --- a/include/stratosphere/mitm/imitmserviceobject.hpp +++ b/include/stratosphere/mitm/imitmserviceobject.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include #include @@ -30,19 +30,19 @@ class IMitmServiceObject : public IServiceObject { IMitmServiceObject(std::shared_ptr s, u64 pid) : forward_service(s), process_id(pid) { MitmQueryUtils::GetAssociatedTidForPid(this->process_id, &this->title_id); } - + virtual u64 GetTitleId() { return this->title_id; } - + virtual u64 GetProcessId() { return this->process_id; } - + virtual bool IsMitmObject() const override { return true; } - + static bool ShouldMitm(u64 pid, u64 tid); - + protected: virtual ~IMitmServiceObject() = default; }; diff --git a/include/stratosphere/mitm/mitm_query_service.hpp b/include/stratosphere/mitm/mitm_query_service.hpp index 49a2c231..c0afab85 100644 --- a/include/stratosphere/mitm/mitm_query_service.hpp +++ b/include/stratosphere/mitm/mitm_query_service.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include #include @@ -26,7 +26,7 @@ enum MitmQueryServiceCommand { namespace MitmQueryUtils { Result GetAssociatedTidForPid(u64 pid, u64 *tid); - void AssociatePidToTid(u64 pid, u64 tid); + void AssociatePidToTid(u64 pid, u64 tid); } template diff --git a/include/stratosphere/on_crash.hpp b/include/stratosphere/on_crash.hpp index 272d189b..2f66f60e 100644 --- a/include/stratosphere/on_crash.hpp +++ b/include/stratosphere/on_crash.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include #include diff --git a/include/stratosphere/results.hpp b/include/stratosphere/results.hpp index e8ac6010..70970fee 100644 --- a/include/stratosphere/results.hpp +++ b/include/stratosphere/results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once /* Utilities. */ diff --git a/include/stratosphere/results/ams_results.hpp b/include/stratosphere/results/ams_results.hpp index 6ed81f5d..245d7d2d 100644 --- a/include/stratosphere/results/ams_results.hpp +++ b/include/stratosphere/results/ams_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/creport_results.hpp b/include/stratosphere/results/creport_results.hpp index f8f8908c..905fe3eb 100644 --- a/include/stratosphere/results/creport_results.hpp +++ b/include/stratosphere/results/creport_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/debug_results.hpp b/include/stratosphere/results/debug_results.hpp index c42d5389..6a8f3b5b 100644 --- a/include/stratosphere/results/debug_results.hpp +++ b/include/stratosphere/results/debug_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/dmnt_results.hpp b/include/stratosphere/results/dmnt_results.hpp index d4f139ab..ff3dec2c 100644 --- a/include/stratosphere/results/dmnt_results.hpp +++ b/include/stratosphere/results/dmnt_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/fatal_results.hpp b/include/stratosphere/results/fatal_results.hpp index b03c7385..29e09eb6 100644 --- a/include/stratosphere/results/fatal_results.hpp +++ b/include/stratosphere/results/fatal_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/fs_results.hpp b/include/stratosphere/results/fs_results.hpp index 659e1165..fc8c924d 100644 --- a/include/stratosphere/results/fs_results.hpp +++ b/include/stratosphere/results/fs_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/hipc_results.hpp b/include/stratosphere/results/hipc_results.hpp index 4c825a3b..86ef678b 100644 --- a/include/stratosphere/results/hipc_results.hpp +++ b/include/stratosphere/results/hipc_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/i2c_results.hpp b/include/stratosphere/results/i2c_results.hpp index 3f6d7c34..5ce74b63 100644 --- a/include/stratosphere/results/i2c_results.hpp +++ b/include/stratosphere/results/i2c_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/kernel_results.hpp b/include/stratosphere/results/kernel_results.hpp index fde58c6d..c5366303 100644 --- a/include/stratosphere/results/kernel_results.hpp +++ b/include/stratosphere/results/kernel_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/kvdb_results.hpp b/include/stratosphere/results/kvdb_results.hpp index b6600af6..8248f8f2 100644 --- a/include/stratosphere/results/kvdb_results.hpp +++ b/include/stratosphere/results/kvdb_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/lr_results.hpp b/include/stratosphere/results/lr_results.hpp index dbc9885c..5b2a01b9 100644 --- a/include/stratosphere/results/lr_results.hpp +++ b/include/stratosphere/results/lr_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/ncm_results.hpp b/include/stratosphere/results/ncm_results.hpp index 3029f7b0..87cc115e 100644 --- a/include/stratosphere/results/ncm_results.hpp +++ b/include/stratosphere/results/ncm_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/pm_results.hpp b/include/stratosphere/results/pm_results.hpp index 2f14a6d6..0293b4e6 100644 --- a/include/stratosphere/results/pm_results.hpp +++ b/include/stratosphere/results/pm_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/ro_results.hpp b/include/stratosphere/results/ro_results.hpp index da0ce669..f5ed217e 100644 --- a/include/stratosphere/results/ro_results.hpp +++ b/include/stratosphere/results/ro_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/settings_results.hpp b/include/stratosphere/results/settings_results.hpp index 0311092a..c153169c 100644 --- a/include/stratosphere/results/settings_results.hpp +++ b/include/stratosphere/results/settings_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/sf_results.hpp b/include/stratosphere/results/sf_results.hpp index 4fb8f5b9..aed8d5fb 100644 --- a/include/stratosphere/results/sf_results.hpp +++ b/include/stratosphere/results/sf_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/sm_results.hpp b/include/stratosphere/results/sm_results.hpp index c5732bda..41d99cc1 100644 --- a/include/stratosphere/results/sm_results.hpp +++ b/include/stratosphere/results/sm_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/spl_results.hpp b/include/stratosphere/results/spl_results.hpp index a661e91d..002c07d5 100644 --- a/include/stratosphere/results/spl_results.hpp +++ b/include/stratosphere/results/spl_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/updater_results.hpp b/include/stratosphere/results/updater_results.hpp index 9617185d..24717acb 100644 --- a/include/stratosphere/results/updater_results.hpp +++ b/include/stratosphere/results/updater_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/results/vi_results.hpp b/include/stratosphere/results/vi_results.hpp index 91159648..6449b367 100644 --- a/include/stratosphere/results/vi_results.hpp +++ b/include/stratosphere/results/vi_results.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/services.hpp b/include/stratosphere/services.hpp index 57172c30..4143c0c2 100644 --- a/include/stratosphere/services.hpp +++ b/include/stratosphere/services.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include "ipc.hpp" diff --git a/include/stratosphere/services/bpc_ams.h b/include/stratosphere/services/bpc_ams.h index fee75264..c8e11a73 100644 --- a/include/stratosphere/services/bpc_ams.h +++ b/include/stratosphere/services/bpc_ams.h @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/services/dmntcht.h b/include/stratosphere/services/dmntcht.h index 3c46d5ad..6f8d5ddc 100644 --- a/include/stratosphere/services/dmntcht.h +++ b/include/stratosphere/services/dmntcht.h @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/services/smm_ams.h b/include/stratosphere/services/smm_ams.h index 2c4734b1..fd857fb1 100644 --- a/include/stratosphere/services/smm_ams.h +++ b/include/stratosphere/services/smm_ams.h @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/title_ids.hpp b/include/stratosphere/title_ids.hpp index 95195a8a..86dcfc9e 100644 --- a/include/stratosphere/title_ids.hpp +++ b/include/stratosphere/title_ids.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include diff --git a/include/stratosphere/version_check.hpp b/include/stratosphere/version_check.hpp index 9643b00a..f9f3dea1 100644 --- a/include/stratosphere/version_check.hpp +++ b/include/stratosphere/version_check.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include @@ -25,23 +25,23 @@ static inline void GetAtmosphereApiVersion(u32 *major, u32 *minor, u32 *micro, u if (R_FAILED(SmcGetConfig((SplConfigItem)65000, &exosphere_cfg))) { fatalSimple(ResultAtmosphereExosphereNotPresent); } - + if (mkey_rev) { *mkey_rev = (u32)((exosphere_cfg >> 0x00) & 0xFF); } - + if (target_fw) { *target_fw = (u32)((exosphere_cfg >> 0x08) & 0xFF); } - + if (micro) { *micro = (u32)((exosphere_cfg >> 0x10) & 0xFF); } - + if (minor) { *minor = (u32)((exosphere_cfg >> 0x18) & 0xFF); } - + if (major) { *major = (u32)((exosphere_cfg >> 0x20) & 0xFF); } @@ -54,7 +54,7 @@ static inline u32 MakeAtmosphereVersion(u32 major, u32 minor, u32 micro) { static inline void CheckAtmosphereVersion(u32 expected_major, u32 expected_minor, u32 expected_micro) { u32 major, minor, micro; GetAtmosphereApiVersion(&major, &minor, µ, nullptr, nullptr); - + if (MakeAtmosphereVersion(major, minor, micro) < MakeAtmosphereVersion(expected_major, expected_minor, expected_micro)) { fatalSimple(ResultAtmosphereVersionMismatch); } diff --git a/include/stratosphere/waitable_manager_base.hpp b/include/stratosphere/waitable_manager_base.hpp index 0070e861..3f2997ca 100644 --- a/include/stratosphere/waitable_manager_base.hpp +++ b/include/stratosphere/waitable_manager_base.hpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #pragma once #include @@ -28,11 +28,11 @@ class WaitableManagerBase { u64 GetNextPriority() { return std::atomic_fetch_add(&cur_priority, (u64)1); } - + virtual void AddWaitable(IWaitable *w) = 0; virtual void NotifySignaled(IWaitable *w) = 0; - - virtual void RequestStop() = 0; + + virtual void RequestStop() = 0; virtual void Process() = 0; }; diff --git a/source/bpc_ams.c b/source/bpc_ams.c index 2336b6e9..0728e091 100644 --- a/source/bpc_ams.c +++ b/source/bpc_ams.c @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #include #include #include @@ -39,19 +39,19 @@ Result bpcAmsInitialize(void) { void bpcAmsExit(void) { if (atomicDecrement64(&g_bpcAmsAmsRefcnt) == 0) - serviceClose(&g_bpcAmsSrv); + serviceClose(&g_bpcAmsSrv); } Result bpcAmsRebootToFatalError(AtmosphereFatalErrorContext *ctx) { IpcCommand c; ipcInitialize(&c); ipcAddSendBuffer(&c, ctx, sizeof(*ctx), BufferType_Normal); - + struct { u64 magic; u64 cmd_id; } *raw; - + raw = serviceIpcPrepareHeader(&g_bpcAmsSrv, &c, sizeof(*raw)); raw->magic = SFCI_MAGIC; diff --git a/source/dmntcht.c b/source/dmntcht.c index 70b07a0a..eb6476f0 100644 --- a/source/dmntcht.c +++ b/source/dmntcht.c @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #include #include #include diff --git a/source/message_queue.cpp b/source/message_queue.cpp index 9be09e22..d972e53e 100644 --- a/source/message_queue.cpp +++ b/source/message_queue.cpp @@ -13,20 +13,20 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #include #include #include - + void HosMessageQueue::Send(uintptr_t data) { /* Acquire mutex, wait sendable. */ std::scoped_lock lock(this->queue_lock); - + while (this->IsFull()) { this->cv_not_full.Wait(&this->queue_lock); } - + /* Send, signal. */ this->SendInternal(data); this->cv_not_empty.WakeAll(); @@ -37,7 +37,7 @@ bool HosMessageQueue::TrySend(uintptr_t data) { if (this->IsFull()) { return false; } - + /* Send, signal. */ this->SendInternal(data); this->cv_not_empty.WakeAll(); @@ -47,15 +47,15 @@ bool HosMessageQueue::TrySend(uintptr_t data) { bool HosMessageQueue::TimedSend(uintptr_t data, u64 timeout) { std::scoped_lock lock(this->queue_lock); TimeoutHelper timeout_helper(timeout); - + while (this->IsFull()) { if (timeout_helper.TimedOut()) { return false; } - + this->cv_not_full.TimedWait(timeout, &this->queue_lock); } - + /* Send, signal. */ this->SendInternal(data); this->cv_not_empty.WakeAll(); @@ -65,11 +65,11 @@ bool HosMessageQueue::TimedSend(uintptr_t data, u64 timeout) { void HosMessageQueue::SendNext(uintptr_t data) { /* Acquire mutex, wait sendable. */ std::scoped_lock lock(this->queue_lock); - + while (this->IsFull()) { this->cv_not_full.Wait(&this->queue_lock); } - + /* Send, signal. */ this->SendNextInternal(data); this->cv_not_empty.WakeAll(); @@ -80,7 +80,7 @@ bool HosMessageQueue::TrySendNext(uintptr_t data) { if (this->IsFull()) { return false; } - + /* Send, signal. */ this->SendNextInternal(data); this->cv_not_empty.WakeAll(); @@ -90,15 +90,15 @@ bool HosMessageQueue::TrySendNext(uintptr_t data) { bool HosMessageQueue::TimedSendNext(uintptr_t data, u64 timeout) { std::scoped_lock lock(this->queue_lock); TimeoutHelper timeout_helper(timeout); - + while (this->IsFull()) { if (timeout_helper.TimedOut()) { return false; } - + this->cv_not_full.TimedWait(timeout, &this->queue_lock); } - + /* Send, signal. */ this->SendNextInternal(data); this->cv_not_empty.WakeAll(); @@ -108,11 +108,11 @@ bool HosMessageQueue::TimedSendNext(uintptr_t data, u64 timeout) { void HosMessageQueue::Receive(uintptr_t *out) { /* Acquire mutex, wait receivable. */ std::scoped_lock lock(this->queue_lock); - + while (this->IsEmpty()) { this->cv_not_empty.Wait(&this->queue_lock); } - + /* Receive, signal. */ *out = this->ReceiveInternal(); this->cv_not_full.WakeAll(); @@ -120,11 +120,11 @@ void HosMessageQueue::Receive(uintptr_t *out) { bool HosMessageQueue::TryReceive(uintptr_t *out) { /* Acquire mutex, wait receivable. */ std::scoped_lock lock(this->queue_lock); - + if (this->IsEmpty()) { return false; } - + /* Receive, signal. */ *out = this->ReceiveInternal(); this->cv_not_full.WakeAll(); @@ -134,15 +134,15 @@ bool HosMessageQueue::TryReceive(uintptr_t *out) { bool HosMessageQueue::TimedReceive(uintptr_t *out, u64 timeout) { std::scoped_lock lock(this->queue_lock); TimeoutHelper timeout_helper(timeout); - + while (this->IsEmpty()) { if (timeout_helper.TimedOut()) { return false; } - + this->cv_not_empty.TimedWait(timeout, &this->queue_lock); } - + /* Receive, signal. */ *out = this->ReceiveInternal(); this->cv_not_full.WakeAll(); @@ -152,11 +152,11 @@ bool HosMessageQueue::TimedReceive(uintptr_t *out, u64 timeout) { void HosMessageQueue::Peek(uintptr_t *out) { /* Acquire mutex, wait receivable. */ std::scoped_lock lock(this->queue_lock); - + while (this->IsEmpty()) { this->cv_not_empty.Wait(&this->queue_lock); } - + /* Peek. */ *out = this->PeekInternal(); } @@ -164,11 +164,11 @@ void HosMessageQueue::Peek(uintptr_t *out) { bool HosMessageQueue::TryPeek(uintptr_t *out) { /* Acquire mutex, wait receivable. */ std::scoped_lock lock(this->queue_lock); - + if (this->IsEmpty()) { return false; } - + /* Peek. */ *out = this->PeekInternal(); return true; @@ -177,15 +177,15 @@ bool HosMessageQueue::TryPeek(uintptr_t *out) { bool HosMessageQueue::TimedPeek(uintptr_t *out, u64 timeout) { std::scoped_lock lock(this->queue_lock); TimeoutHelper timeout_helper(timeout); - + while (this->IsEmpty()) { if (timeout_helper.TimedOut()) { return false; } - + this->cv_not_empty.TimedWait(timeout, &this->queue_lock); } - + /* Peek. */ *out = this->PeekInternal(); return true; @@ -196,7 +196,7 @@ void HosMessageQueue::SendInternal(uintptr_t data) { if (this->count >= this->capacity) { std::abort(); } - + /* Write data to tail of queue. */ this->buffer[(this->count++ + this->offset) % this->capacity] = data; } @@ -206,7 +206,7 @@ void HosMessageQueue::SendNextInternal(uintptr_t data) { if (this->count >= this->capacity) { std::abort(); } - + /* Write data to head of queue. */ this->offset = (this->offset + this->capacity - 1) % this->capacity; this->buffer[this->offset] = data; @@ -218,7 +218,7 @@ uintptr_t HosMessageQueue::ReceiveInternal() { if (this->count == 0) { std::abort(); } - + uintptr_t data = this->buffer[this->offset]; this->offset = (this->offset + 1) % this->capacity; this->count--; @@ -230,6 +230,6 @@ uintptr_t HosMessageQueue::PeekInternal() { if (this->count == 0) { std::abort(); } - + return this->buffer[this->offset]; } \ No newline at end of file diff --git a/source/sm_mitm.c b/source/sm_mitm.c index 668852c2..61686fdf 100644 --- a/source/sm_mitm.c +++ b/source/sm_mitm.c @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #include #include #include diff --git a/source/smm_ams.c b/source/smm_ams.c index 22cf21c7..3820cfd7 100644 --- a/source/smm_ams.c +++ b/source/smm_ams.c @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #include #include #include @@ -32,13 +32,13 @@ Result smManagerAmsInitialize(void) { void smManagerAmsExit(void) { if (atomicDecrement64(&g_smManagerAmsRefcnt) == 0) - serviceClose(&g_smManagerAmsSrv); + serviceClose(&g_smManagerAmsSrv); } Result smManagerAmsEndInitialDefers(void) { IpcCommand c; ipcInitialize(&c); - + struct { u64 magic; u64 cmd_id; @@ -48,22 +48,22 @@ Result smManagerAmsEndInitialDefers(void) { raw->magic = SFCI_MAGIC; raw->cmd_id = 65000; - + Result rc = serviceIpcDispatch(&g_smManagerAmsSrv); - + if (R_SUCCEEDED(rc)) { IpcParsedCommand r; struct { u64 magic; u64 result; } *resp; - + serviceIpcParse(&g_smManagerAmsSrv, &r, sizeof(*resp)); resp = r.Raw; rc = resp->result; } - + return rc; } @@ -71,7 +71,7 @@ Result smManagerAmsEndInitialDefers(void) { Result smManagerAmsHasMitm(bool *out, const char* name) { IpcCommand c; ipcInitialize(&c); - + struct { u64 magic; u64 cmd_id; @@ -82,9 +82,9 @@ Result smManagerAmsHasMitm(bool *out, const char* name) { raw->magic = SFCI_MAGIC; raw->cmd_id = 65001; raw->service_name = smEncodeName(name); - + Result rc = serviceIpcDispatch(&g_smManagerAmsSrv); - + if (R_SUCCEEDED(rc)) { IpcParsedCommand r; struct { @@ -92,16 +92,16 @@ Result smManagerAmsHasMitm(bool *out, const char* name) { u64 result; u8 has_mitm; } *resp; - + serviceIpcParse(&g_smManagerAmsSrv, &r, sizeof(*resp)); resp = r.Raw; rc = resp->result; - + if (R_SUCCEEDED(rc)) { *out = resp->has_mitm != 0; } } - + return rc; }