strat: use m_ for member variables

This commit is contained in:
Michael Scire 2021-10-10 00:14:06 -07:00
parent ce28591ab2
commit a595c232b9
425 changed files with 8531 additions and 8484 deletions

View file

@ -19,12 +19,12 @@
namespace ams::gpio::server {
ManagerImpl::ManagerImpl() {
this->heap_handle = lmem::CreateExpHeap(this->heap_buffer, sizeof(this->heap_buffer), lmem::CreateOption_None);
this->pad_allocator.Attach(this->heap_handle);
m_heap_handle = lmem::CreateExpHeap(m_heap_buffer, sizeof(m_heap_buffer), lmem::CreateOption_None);
m_pad_allocator.Attach(m_heap_handle);
}
ManagerImpl::~ManagerImpl() {
lmem::DestroyExpHeap(this->heap_handle);
lmem::DestroyExpHeap(m_heap_handle);
}
Result ManagerImpl::OpenSessionForDev(ams::sf::Out<ams::sf::SharedPointer<gpio::sf::IPadSession>> out, s32 pad_descriptor) {
@ -69,7 +69,7 @@ namespace ams::gpio::server {
Result ManagerImpl::OpenSession2(ams::sf::Out<ams::sf::SharedPointer<gpio::sf::IPadSession>> out, DeviceCode device_code, ddsf::AccessMode access_mode) {
/* Allocate a session. */
auto session = Factory::CreateSharedEmplaced<gpio::sf::IPadSession, PadSessionImpl>(std::addressof(this->pad_allocator), this);
auto session = Factory::CreateSharedEmplaced<gpio::sf::IPadSession, PadSessionImpl>(std::addressof(m_pad_allocator), this);
/* Open the session. */
R_TRY(session.GetImpl().OpenSession(device_code, access_mode));

View file

@ -24,9 +24,9 @@ namespace ams::gpio::server {
using Allocator = ams::sf::ExpHeapAllocator;
using Factory = ams::sf::ObjectFactory<Allocator::Policy>;
private:
lmem::HeapHandle heap_handle;
Allocator pad_allocator;
u8 heap_buffer[12_KB];
lmem::HeapHandle m_heap_handle;
Allocator m_pad_allocator;
u8 m_heap_buffer[12_KB];
public:
ManagerImpl();

View file

@ -22,54 +22,54 @@ namespace ams::gpio::server {
class PadSessionImpl {
private:
ManagerImpl *parent; /* NOTE: this is an sf::SharedPointer<> in Nintendo's code. */
gpio::driver::GpioPadSession internal_pad_session;
bool has_session;
os::SystemEvent system_event;
ManagerImpl *m_parent; /* NOTE: this is an sf::SharedPointer<> in Nintendo's code. */
gpio::driver::GpioPadSession m_internal_pad_session;
bool m_has_session;
os::SystemEvent m_system_event;
public:
explicit PadSessionImpl(ManagerImpl *p) : parent(p), has_session(false) { /* ... */ }
explicit PadSessionImpl(ManagerImpl *p) : m_parent(p), m_has_session(false) { /* ... */ }
~PadSessionImpl() {
if (this->has_session) {
gpio::driver::CloseSession(std::addressof(this->internal_pad_session));
if (m_has_session) {
gpio::driver::CloseSession(std::addressof(m_internal_pad_session));
}
}
Result OpenSession(DeviceCode device_code, ddsf::AccessMode access_mode) {
AMS_ABORT_UNLESS(!this->has_session);
AMS_ABORT_UNLESS(!m_has_session);
R_TRY(gpio::driver::OpenSession(std::addressof(this->internal_pad_session), device_code, access_mode));
this->has_session = true;
R_TRY(gpio::driver::OpenSession(std::addressof(m_internal_pad_session), device_code, access_mode));
m_has_session = true;
return ResultSuccess();
}
public:
/* Actual commands. */
Result SetDirection(gpio::Direction direction) {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* Validate the direction. */
R_UNLESS((direction == Direction_Input || direction == Direction_Output), gpio::ResultInvalidArgument());
/* Invoke the driver library. */
R_TRY(gpio::driver::SetDirection(std::addressof(this->internal_pad_session), direction));
R_TRY(gpio::driver::SetDirection(std::addressof(m_internal_pad_session), direction));
return ResultSuccess();
}
Result GetDirection(ams::sf::Out<gpio::Direction> out) {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* Invoke the driver library. */
R_TRY(gpio::driver::GetDirection(out.GetPointer(), std::addressof(this->internal_pad_session)));
R_TRY(gpio::driver::GetDirection(out.GetPointer(), std::addressof(m_internal_pad_session)));
return ResultSuccess();
}
Result SetInterruptMode(gpio::InterruptMode mode) {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(mode);
@ -78,7 +78,7 @@ namespace ams::gpio::server {
Result GetInterruptMode(ams::sf::Out<gpio::InterruptMode> out) {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(out);
@ -87,7 +87,7 @@ namespace ams::gpio::server {
Result SetInterruptEnable(bool enable) {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(enable);
@ -96,7 +96,7 @@ namespace ams::gpio::server {
Result GetInterruptEnable(ams::sf::Out<bool> out) {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(out);
@ -105,7 +105,7 @@ namespace ams::gpio::server {
Result GetInterruptStatus(ams::sf::Out<gpio::InterruptStatus> out) {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(out);
@ -114,7 +114,7 @@ namespace ams::gpio::server {
Result ClearInterruptStatus() {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* TODO */
AMS_ABORT();
@ -122,30 +122,30 @@ namespace ams::gpio::server {
Result SetValue(gpio::GpioValue value) {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* Validate the value. */
R_UNLESS((value == GpioValue_Low || value == GpioValue_High), gpio::ResultInvalidArgument());
/* Invoke the driver library. */
R_TRY(gpio::driver::SetValue(std::addressof(this->internal_pad_session), value));
R_TRY(gpio::driver::SetValue(std::addressof(m_internal_pad_session), value));
return ResultSuccess();
}
Result GetValue(ams::sf::Out<gpio::GpioValue> out) {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* Invoke the driver library. */
R_TRY(gpio::driver::GetValue(out.GetPointer(), std::addressof(this->internal_pad_session)));
R_TRY(gpio::driver::GetValue(out.GetPointer(), std::addressof(m_internal_pad_session)));
return ResultSuccess();
}
Result BindInterrupt(ams::sf::OutCopyHandle out) {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(out);
@ -154,7 +154,7 @@ namespace ams::gpio::server {
Result UnbindInterrupt() {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* TODO */
AMS_ABORT();
@ -162,7 +162,7 @@ namespace ams::gpio::server {
Result SetDebounceEnabled(bool enable) {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(enable);
@ -171,7 +171,7 @@ namespace ams::gpio::server {
Result GetDebounceEnabled(ams::sf::Out<bool> out) {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(out);
@ -180,7 +180,7 @@ namespace ams::gpio::server {
Result SetDebounceTime(s32 ms) {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(ms);
@ -189,7 +189,7 @@ namespace ams::gpio::server {
Result GetDebounceTime(ams::sf::Out<s32> out) {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(out);
@ -198,7 +198,7 @@ namespace ams::gpio::server {
Result SetValueForSleepState(gpio::GpioValue value) {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(value);
@ -207,7 +207,7 @@ namespace ams::gpio::server {
Result GetValueForSleepState(ams::sf::Out<gpio::GpioValue> out) {
/* Validate our state. */
AMS_ASSERT(this->has_session);
AMS_ASSERT(m_has_session);
/* TODO */
AMS_UNUSED(out);