mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-04 00:28:51 -04:00
pm: address review comments.
This commit is contained in:
parent
08ad48fbf3
commit
a9f5b7728b
10 changed files with 135 additions and 145 deletions
|
@ -459,6 +459,17 @@ namespace sts::sm::impl {
|
|||
return ResultSuccess;
|
||||
}
|
||||
|
||||
Result WaitService(ServiceName service) {
|
||||
bool has_service = false;
|
||||
R_TRY(impl::HasService(&has_service, service));
|
||||
|
||||
/* Wait until we have the service. */
|
||||
if (!has_service) {
|
||||
return ResultServiceFrameworkRequestDeferredByUser;
|
||||
}
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
Result GetServiceHandle(Handle *out, u64 pid, ServiceName service) {
|
||||
/* Validate service name. */
|
||||
R_TRY(ValidateServiceName(service));
|
||||
|
@ -564,6 +575,17 @@ namespace sts::sm::impl {
|
|||
return ResultSuccess;
|
||||
}
|
||||
|
||||
Result WaitMitm(ServiceName service) {
|
||||
bool has_mitm = false;
|
||||
R_TRY(impl::HasMitm(&has_mitm, service));
|
||||
|
||||
/* Wait until we have the mitm. */
|
||||
if (!has_mitm) {
|
||||
return ResultServiceFrameworkRequestDeferredByUser;
|
||||
}
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
Result InstallMitm(Handle *out, Handle *out_query, u64 pid, ServiceName service) {
|
||||
/* Validate service name. */
|
||||
R_TRY(ValidateServiceName(service));
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace sts::sm::impl {
|
|||
|
||||
/* Service management. */
|
||||
Result HasService(bool *out, ServiceName service);
|
||||
Result WaitService(ServiceName service);
|
||||
Result GetServiceHandle(Handle *out, u64 pid, ServiceName service);
|
||||
Result RegisterService(Handle *out, u64 pid, ServiceName service, size_t max_sessions, bool is_light);
|
||||
Result RegisterServiceForSelf(Handle *out, ServiceName service, size_t max_sessions);
|
||||
|
@ -33,6 +34,7 @@ namespace sts::sm::impl {
|
|||
|
||||
/* Mitm extensions. */
|
||||
Result HasMitm(bool *out, ServiceName service);
|
||||
Result WaitMitm(ServiceName service);
|
||||
Result InstallMitm(Handle *out, Handle *out_query, u64 pid, ServiceName service);
|
||||
Result UninstallMitm(u64 pid, ServiceName service);
|
||||
Result AcknowledgeMitmSession(u64 *out_pid, Handle *out_hnd, u64 pid, ServiceName service);
|
||||
|
|
|
@ -75,9 +75,19 @@ namespace sts::sm {
|
|||
return impl::HasMitm(out.GetPointer(), service);
|
||||
}
|
||||
|
||||
Result UserService::AtmosphereWaitMitm(ServiceName service) {
|
||||
R_TRY(this->EnsureInitialized());
|
||||
return impl::WaitMitm(service);
|
||||
}
|
||||
|
||||
Result UserService::AtmosphereHasService(Out<bool> out, ServiceName service) {
|
||||
R_TRY(this->EnsureInitialized());
|
||||
return impl::HasService(out.GetPointer(), service);
|
||||
}
|
||||
|
||||
Result UserService::AtmosphereWaitService(ServiceName service) {
|
||||
R_TRY(this->EnsureInitialized());
|
||||
return impl::WaitService(service);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,8 +36,10 @@ namespace sts::sm {
|
|||
AtmosphereAssociatePidTidForMitm = 65002,
|
||||
AtmosphereAcknowledgeMitmSession = 65003,
|
||||
AtmosphereHasMitm = 65004,
|
||||
AtmosphereWaitMitm = 65005,
|
||||
|
||||
AtmosphereHasService = 65100,
|
||||
AtmosphereWaitService = 65101,
|
||||
};
|
||||
private:
|
||||
u64 pid = InvalidProcessId;
|
||||
|
@ -57,8 +59,10 @@ namespace sts::sm {
|
|||
virtual Result AtmosphereAssociatePidTidForMitm(u64 pid, u64 tid);
|
||||
virtual Result AtmosphereAcknowledgeMitmSession(Out<u64> client_pid, Out<MovedHandle> fwd_h, ServiceName service);
|
||||
virtual Result AtmosphereHasMitm(Out<bool> out, ServiceName service);
|
||||
virtual Result AtmosphereWaitMitm(ServiceName service);
|
||||
|
||||
virtual Result AtmosphereHasService(Out<bool> out, ServiceName service);
|
||||
virtual Result AtmosphereWaitService(ServiceName service);
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
MAKE_SERVICE_COMMAND_META(UserService, Initialize),
|
||||
|
@ -71,8 +75,10 @@ namespace sts::sm {
|
|||
MAKE_SERVICE_COMMAND_META(UserService, AtmosphereAssociatePidTidForMitm),
|
||||
MAKE_SERVICE_COMMAND_META(UserService, AtmosphereAcknowledgeMitmSession),
|
||||
MAKE_SERVICE_COMMAND_META(UserService, AtmosphereHasMitm),
|
||||
MAKE_SERVICE_COMMAND_META(UserService, AtmosphereWaitMitm),
|
||||
|
||||
MAKE_SERVICE_COMMAND_META(UserService, AtmosphereHasService),
|
||||
MAKE_SERVICE_COMMAND_META(UserService, AtmosphereWaitService),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue