mirror of https://git.suyu.dev/suyu/suyu
kernel/server_session: Add IsSession() member function
Allows querying the inverse of IsDomain() to make things more readable. This will likely also be usable in the event of implementing ConvertDomainToSession().
This commit is contained in:
parent
301baaa942
commit
aac5792a2b
|
@ -152,7 +152,7 @@ ResultCode ServerSession::HandleSyncRequest(SharedPtr<Thread> thread) {
|
||||||
// Handle scenario when ConvertToDomain command was issued, as we must do the conversion at the
|
// Handle scenario when ConvertToDomain command was issued, as we must do the conversion at the
|
||||||
// end of the command such that only commands following this one are handled as domains
|
// end of the command such that only commands following this one are handled as domains
|
||||||
if (convert_to_domain) {
|
if (convert_to_domain) {
|
||||||
ASSERT_MSG(domain_request_handlers.empty(), "already a domain");
|
ASSERT_MSG(IsSession(), "ServerSession is already a domain instance.");
|
||||||
domain_request_handlers = {hle_handler};
|
domain_request_handlers = {hle_handler};
|
||||||
convert_to_domain = false;
|
convert_to_domain = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,12 @@ public:
|
||||||
|
|
||||||
/// Returns true if the session has been converted to a domain, otherwise False
|
/// Returns true if the session has been converted to a domain, otherwise False
|
||||||
bool IsDomain() const {
|
bool IsDomain() const {
|
||||||
return !domain_request_handlers.empty();
|
return !IsSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns true if this session has not been converted to a domain, otherwise false.
|
||||||
|
bool IsSession() const {
|
||||||
|
return domain_request_handlers.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Converts the session to a domain at the end of the current command
|
/// Converts the session to a domain at the end of the current command
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
namespace Service::SM {
|
namespace Service::SM {
|
||||||
|
|
||||||
void Controller::ConvertSessionToDomain(Kernel::HLERequestContext& ctx) {
|
void Controller::ConvertSessionToDomain(Kernel::HLERequestContext& ctx) {
|
||||||
ASSERT_MSG(!ctx.Session()->IsDomain(), "session is alread a domain");
|
ASSERT_MSG(ctx.Session()->IsSession(), "Session is already a domain");
|
||||||
ctx.Session()->ConvertToDomain();
|
ctx.Session()->ConvertToDomain();
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
|
Loading…
Reference in New Issue