mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-21 02:52:44 +02:00
libstrat: remove trailing whitespace
This commit is contained in:
parent
4a120c3c16
commit
59b49c0e0c
@ -13,7 +13,7 @@
|
||||
* 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 <functional>
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 "stratosphere/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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
#include <switch.h>
|
||||
#include <cstdlib>
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 "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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
#include <switch.h>
|
||||
#include <type_traits>
|
||||
@ -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 <typename T>
|
||||
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 <typename T, size_t N>
|
||||
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 <typename T>
|
||||
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)) { }
|
||||
};
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
#include <algorithm>
|
||||
@ -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 <typename ServiceImpl>
|
||||
class Out<std::shared_ptr<ServiceImpl>> : public OutSessionTag {
|
||||
static_assert(std::is_base_of_v<IServiceObject, ServiceImpl>, "OutSessions must be shared_ptr<IServiceObject>!");
|
||||
|
||||
|
||||
template<typename, typename>
|
||||
friend class Out;
|
||||
|
||||
|
||||
private:
|
||||
std::shared_ptr<ServiceImpl> *srv;
|
||||
IDomainObject *domain = nullptr;
|
||||
u32 *object_id = nullptr;
|
||||
public:
|
||||
Out<std::shared_ptr<ServiceImpl>>(std::shared_ptr<IServiceObject> *s, IDomainObject *dm, u32 *o) : srv(reinterpret_cast<std::shared_ptr<ServiceImpl> *>(s)), domain(dm), object_id(o) { }
|
||||
|
||||
|
||||
ServiceObjectHolder GetHolder() {
|
||||
std::shared_ptr<ServiceImpl> 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<ServiceImpl> &&s) {
|
||||
*this->srv = std::move(s);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
#include <type_traits>
|
||||
@ -36,26 +36,26 @@ template <typename T>
|
||||
class Out<T, typename std::enable_if<std::is_trivial<T>::value || AllowedOut<T>::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;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
#include <memory>
|
||||
@ -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 <typename T>
|
||||
static constexpr size_t DispatchTableEntryCount() {
|
||||
@ -63,7 +63,7 @@ class ServiceObjectHolder {
|
||||
std::shared_ptr<IServiceObject> 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 <typename ServiceImpl>
|
||||
explicit ServiceObjectHolder(std::shared_ptr<ServiceImpl>&& s) : srv(std::move(s)), dispatch_table(DispatchTable<ServiceImpl>()), entry_count(DispatchTableEntryCount<ServiceImpl>()) { }
|
||||
|
||||
|
||||
template <typename ServiceImpl>
|
||||
ServiceImpl *GetServiceObject() const {
|
||||
if (GetServiceId() == ServiceObjectId<ServiceImpl>()) {
|
||||
@ -79,33 +79,33 @@ class ServiceObjectHolder {
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
template<typename ServiceImpl>
|
||||
ServiceImpl *GetServiceObjectUnsafe() const {
|
||||
return static_cast<ServiceImpl *>(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<uintptr_t>(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;
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <atomic>
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
#include <type_traits>
|
||||
@ -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<MovedHandle> : public OutHandleTag {
|
||||
private:
|
||||
MovedHandle *obj;
|
||||
public:
|
||||
public:
|
||||
Out(IpcHandle *o) : obj(static_cast<MovedHandle *>(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<CopiedHandle> : public OutHandleTag {
|
||||
private:
|
||||
CopiedHandle *obj;
|
||||
public:
|
||||
public:
|
||||
Out(IpcHandle *o) : obj(static_cast<CopiedHandle *>(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;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
@ -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<HosMutex> 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);
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
#include "hossynch.hpp"
|
||||
@ -26,31 +26,31 @@ class HosMessageQueue {
|
||||
HosCondVar cv_not_empty;
|
||||
std::unique_ptr<uintptr_t[]> buffer;
|
||||
size_t capacity;
|
||||
|
||||
|
||||
size_t count = 0;
|
||||
size_t offset = 0;
|
||||
public:
|
||||
HosMessageQueue(size_t c) : capacity(c) {
|
||||
this->buffer = std::make_unique<uintptr_t[]>(this->capacity);
|
||||
}
|
||||
|
||||
|
||||
HosMessageQueue(std::unique_ptr<uintptr_t[]> 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();
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 "mitm/sm_mitm.h"
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
#include <atomic>
|
||||
@ -30,19 +30,19 @@ class IMitmServiceObject : public IServiceObject {
|
||||
IMitmServiceObject(std::shared_ptr<Service> 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;
|
||||
};
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
@ -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 <typename T>
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
#include <cstdlib>
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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
|
||||
|
||||
/* Utilities. */
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 "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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
#include <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <switch.h>
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
* 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 <atomic>
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <switch.h>
|
||||
#include <switch/arm/atomics.h>
|
||||
#include <stratosphere/services/bpc_ams.h>
|
||||
@ -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;
|
||||
|
@ -13,7 +13,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <switch.h>
|
||||
#include <switch/arm/atomics.h>
|
||||
#include <stratosphere/services/dmntcht.h>
|
||||
|
@ -13,20 +13,20 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <mutex>
|
||||
#include <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
|
||||
|
||||
void HosMessageQueue::Send(uintptr_t data) {
|
||||
/* Acquire mutex, wait sendable. */
|
||||
std::scoped_lock<HosMutex> 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<HosMutex> 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<HosMutex> 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<HosMutex> 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<HosMutex> 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<HosMutex> 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<HosMutex> 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<HosMutex> 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<HosMutex> 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<HosMutex> 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];
|
||||
}
|
@ -13,7 +13,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <switch.h>
|
||||
#include <switch/arm/atomics.h>
|
||||
#include <stratosphere/mitm/sm_mitm.h>
|
||||
|
@ -13,7 +13,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <switch.h>
|
||||
#include <switch/arm/atomics.h>
|
||||
#include <stratosphere/services/smm_ams.h>
|
||||
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user