mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-31 06:48:22 -04:00
strat: use m_ for member variables
This commit is contained in:
parent
ce28591ab2
commit
a595c232b9
425 changed files with 8531 additions and 8484 deletions
|
@ -18,9 +18,9 @@
|
|||
|
||||
namespace ams::pm::impl {
|
||||
|
||||
ProcessInfo::ProcessInfo(os::NativeHandle h, os::ProcessId pid, ldr::PinId pin, const ncm::ProgramLocation &l, const cfg::OverrideStatus &s) : process_id(pid), pin_id(pin), loc(l), status(s), handle(h), state(svc::ProcessState_Created), flags(0) {
|
||||
os::InitializeMultiWaitHolder(std::addressof(this->multi_wait_holder), this->handle);
|
||||
os::SetMultiWaitHolderUserData(std::addressof(this->multi_wait_holder), reinterpret_cast<uintptr_t>(this));
|
||||
ProcessInfo::ProcessInfo(os::NativeHandle h, os::ProcessId pid, ldr::PinId pin, const ncm::ProgramLocation &l, const cfg::OverrideStatus &s) : m_process_id(pid), m_pin_id(pin), m_loc(l), m_status(s), m_handle(h), m_state(svc::ProcessState_Created), m_flags(0) {
|
||||
os::InitializeMultiWaitHolder(std::addressof(m_multi_wait_holder), m_handle);
|
||||
os::SetMultiWaitHolderUserData(std::addressof(m_multi_wait_holder), reinterpret_cast<uintptr_t>(this));
|
||||
}
|
||||
|
||||
ProcessInfo::~ProcessInfo() {
|
||||
|
@ -28,18 +28,18 @@ namespace ams::pm::impl {
|
|||
}
|
||||
|
||||
void ProcessInfo::Cleanup() {
|
||||
if (this->handle != os::InvalidNativeHandle) {
|
||||
if (m_handle != os::InvalidNativeHandle) {
|
||||
/* Unregister the process. */
|
||||
fsprUnregisterProgram(this->process_id.value);
|
||||
sm::manager::UnregisterProcess(this->process_id);
|
||||
ldr::pm::UnpinProgram(this->pin_id);
|
||||
fsprUnregisterProgram(m_process_id.value);
|
||||
sm::manager::UnregisterProcess(m_process_id);
|
||||
ldr::pm::UnpinProgram(m_pin_id);
|
||||
|
||||
/* Close the process's handle. */
|
||||
os::CloseNativeHandle(this->handle);
|
||||
this->handle = os::InvalidNativeHandle;
|
||||
os::CloseNativeHandle(m_handle);
|
||||
m_handle = os::InvalidNativeHandle;
|
||||
|
||||
/* Unlink the process from its multi wait. */
|
||||
os::UnlinkMultiWaitHolder(std::addressof(this->multi_wait_holder));
|
||||
os::UnlinkMultiWaitHolder(std::addressof(m_multi_wait_holder));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,26 +38,26 @@ namespace ams::pm::impl {
|
|||
Flag_UnhandledException = (1 << 9),
|
||||
};
|
||||
private:
|
||||
util::IntrusiveListNode list_node;
|
||||
const os::ProcessId process_id;
|
||||
const ldr::PinId pin_id;
|
||||
const ncm::ProgramLocation loc;
|
||||
const cfg::OverrideStatus status;
|
||||
os::NativeHandle handle;
|
||||
svc::ProcessState state;
|
||||
u32 flags;
|
||||
os::MultiWaitHolderType multi_wait_holder;
|
||||
util::IntrusiveListNode m_list_node;
|
||||
const os::ProcessId m_process_id;
|
||||
const ldr::PinId m_pin_id;
|
||||
const ncm::ProgramLocation m_loc;
|
||||
const cfg::OverrideStatus m_status;
|
||||
os::NativeHandle m_handle;
|
||||
svc::ProcessState m_state;
|
||||
u32 m_flags;
|
||||
os::MultiWaitHolderType m_multi_wait_holder;
|
||||
private:
|
||||
void SetFlag(Flag flag) {
|
||||
this->flags |= flag;
|
||||
m_flags |= flag;
|
||||
}
|
||||
|
||||
void ClearFlag(Flag flag) {
|
||||
this->flags &= ~flag;
|
||||
m_flags &= ~flag;
|
||||
}
|
||||
|
||||
bool HasFlag(Flag flag) const {
|
||||
return (this->flags & flag);
|
||||
return (m_flags & flag);
|
||||
}
|
||||
public:
|
||||
ProcessInfo(os::NativeHandle h, os::ProcessId pid, ldr::PinId pin, const ncm::ProgramLocation &l, const cfg::OverrideStatus &s);
|
||||
|
@ -65,43 +65,43 @@ namespace ams::pm::impl {
|
|||
void Cleanup();
|
||||
|
||||
void LinkToMultiWait(os::MultiWaitType &multi_wait) {
|
||||
os::LinkMultiWaitHolder(std::addressof(multi_wait), std::addressof(this->multi_wait_holder));
|
||||
os::LinkMultiWaitHolder(std::addressof(multi_wait), std::addressof(m_multi_wait_holder));
|
||||
}
|
||||
|
||||
os::NativeHandle GetHandle() const {
|
||||
return this->handle;
|
||||
return m_handle;
|
||||
}
|
||||
|
||||
os::ProcessId GetProcessId() const {
|
||||
return this->process_id;
|
||||
return m_process_id;
|
||||
}
|
||||
|
||||
ldr::PinId GetPinId() const {
|
||||
return this->pin_id;
|
||||
return m_pin_id;
|
||||
}
|
||||
|
||||
const ncm::ProgramLocation &GetProgramLocation() const {
|
||||
return this->loc;
|
||||
return m_loc;
|
||||
}
|
||||
|
||||
const cfg::OverrideStatus &GetOverrideStatus() const {
|
||||
return this->status;
|
||||
return m_status;
|
||||
}
|
||||
|
||||
svc::ProcessState GetState() const {
|
||||
return this->state;
|
||||
return m_state;
|
||||
}
|
||||
|
||||
void SetState(svc::ProcessState state) {
|
||||
this->state = state;
|
||||
m_state = state;
|
||||
}
|
||||
|
||||
bool HasStarted() const {
|
||||
return this->state != svc::ProcessState_Created && this->state != svc::ProcessState_CreatedAttached;
|
||||
return m_state != svc::ProcessState_Created && m_state != svc::ProcessState_CreatedAttached;
|
||||
}
|
||||
|
||||
bool HasTerminated() const {
|
||||
return this->state == svc::ProcessState_Terminated;
|
||||
return m_state == svc::ProcessState_Terminated;
|
||||
}
|
||||
|
||||
#define DEFINE_FLAG_SET(flag) \
|
||||
|
@ -165,18 +165,18 @@ namespace ams::pm::impl {
|
|||
#undef DEFINE_FLAG_CLEAR
|
||||
};
|
||||
|
||||
class ProcessList final : public util::IntrusiveListMemberTraits<&ProcessInfo::list_node>::ListType {
|
||||
class ProcessList final : public util::IntrusiveListMemberTraits<&ProcessInfo::m_list_node>::ListType {
|
||||
private:
|
||||
os::SdkMutex lock;
|
||||
os::SdkMutex m_lock;
|
||||
public:
|
||||
constexpr ProcessList() : lock() { /* ... */ }
|
||||
constexpr ProcessList() : m_lock() { /* ... */ }
|
||||
|
||||
void Lock() {
|
||||
this->lock.Lock();
|
||||
m_lock.Lock();
|
||||
}
|
||||
|
||||
void Unlock() {
|
||||
this->lock.Unlock();
|
||||
m_lock.Unlock();
|
||||
}
|
||||
|
||||
void Remove(ProcessInfo *process_info) {
|
||||
|
@ -184,18 +184,18 @@ namespace ams::pm::impl {
|
|||
}
|
||||
|
||||
ProcessInfo *Find(os::ProcessId process_id) {
|
||||
for (auto it = this->begin(); it != this->end(); it++) {
|
||||
if ((*it).GetProcessId() == process_id) {
|
||||
return std::addressof(*it);
|
||||
for (auto &info : *this) {
|
||||
if (info.GetProcessId() == process_id) {
|
||||
return std::addressof(info);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ProcessInfo *Find(ncm::ProgramId program_id) {
|
||||
for (auto it = this->begin(); it != this->end(); it++) {
|
||||
if ((*it).GetProgramLocation().program_id == program_id) {
|
||||
return std::addressof(*it);
|
||||
for (auto &info : *this) {
|
||||
if (info.GetProgramLocation().program_id == program_id) {
|
||||
return std::addressof(info);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -205,30 +205,30 @@ namespace ams::pm::impl {
|
|||
|
||||
class ProcessListAccessor final {
|
||||
private:
|
||||
ProcessList &list;
|
||||
ProcessList &m_list;
|
||||
public:
|
||||
explicit ProcessListAccessor(ProcessList &l) : list(l) {
|
||||
this->list.Lock();
|
||||
explicit ProcessListAccessor(ProcessList &l) : m_list(l) {
|
||||
m_list.Lock();
|
||||
}
|
||||
|
||||
~ProcessListAccessor() {
|
||||
this->list.Unlock();
|
||||
m_list.Unlock();
|
||||
}
|
||||
|
||||
ProcessList *operator->() {
|
||||
return std::addressof(this->list);
|
||||
return std::addressof(m_list);
|
||||
}
|
||||
|
||||
const ProcessList *operator->() const {
|
||||
return std::addressof(this->list);
|
||||
return std::addressof(m_list);
|
||||
}
|
||||
|
||||
ProcessList &operator*() {
|
||||
return this->list;
|
||||
return m_list;
|
||||
}
|
||||
|
||||
const ProcessList &operator*() const {
|
||||
return this->list;
|
||||
return m_list;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -78,27 +78,27 @@ namespace ams::pm::impl {
|
|||
NON_MOVEABLE(ProcessInfoAllocator);
|
||||
static_assert(MaxProcessInfos >= 0x40, "MaxProcessInfos is too small.");
|
||||
private:
|
||||
util::TypedStorage<ProcessInfo> process_info_storages[MaxProcessInfos]{};
|
||||
bool process_info_allocated[MaxProcessInfos]{};
|
||||
os::SdkMutex lock{};
|
||||
util::TypedStorage<ProcessInfo> m_process_info_storages[MaxProcessInfos]{};
|
||||
bool m_process_info_allocated[MaxProcessInfos]{};
|
||||
os::SdkMutex m_lock{};
|
||||
private:
|
||||
constexpr inline size_t GetProcessInfoIndex(ProcessInfo *process_info) const {
|
||||
return process_info - GetPointer(this->process_info_storages[0]);
|
||||
return process_info - GetPointer(m_process_info_storages[0]);
|
||||
}
|
||||
public:
|
||||
constexpr ProcessInfoAllocator() = default;
|
||||
|
||||
template<typename... Args>
|
||||
ProcessInfo *AllocateProcessInfo(Args &&... args) {
|
||||
std::scoped_lock lk(this->lock);
|
||||
std::scoped_lock lk(m_lock);
|
||||
|
||||
for (size_t i = 0; i < MaxProcessInfos; i++) {
|
||||
if (!this->process_info_allocated[i]) {
|
||||
this->process_info_allocated[i] = true;
|
||||
if (!m_process_info_allocated[i]) {
|
||||
m_process_info_allocated[i] = true;
|
||||
|
||||
std::memset(this->process_info_storages + i, 0, sizeof(this->process_info_storages[i]));
|
||||
std::memset(m_process_info_storages + i, 0, sizeof(m_process_info_storages[i]));
|
||||
|
||||
return util::ConstructAt(this->process_info_storages[i], std::forward<Args>(args)...);
|
||||
return util::ConstructAt(m_process_info_storages[i], std::forward<Args>(args)...);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,14 +106,14 @@ namespace ams::pm::impl {
|
|||
}
|
||||
|
||||
void FreeProcessInfo(ProcessInfo *process_info) {
|
||||
std::scoped_lock lk(this->lock);
|
||||
std::scoped_lock lk(m_lock);
|
||||
|
||||
const size_t index = this->GetProcessInfoIndex(process_info);
|
||||
AMS_ABORT_UNLESS(index < MaxProcessInfos);
|
||||
AMS_ABORT_UNLESS(this->process_info_allocated[index]);
|
||||
AMS_ABORT_UNLESS(m_process_info_allocated[index]);
|
||||
|
||||
util::DestroyAt(this->process_info_storages[index]);
|
||||
this->process_info_allocated[index] = false;
|
||||
util::DestroyAt(m_process_info_storages[index]);
|
||||
m_process_info_allocated[index] = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue