diff --git a/include/stratosphere/ipc/ipc_service_session.hpp b/include/stratosphere/ipc/ipc_service_session.hpp index 59505062..a42cad4d 100644 --- a/include/stratosphere/ipc/ipc_service_session.hpp +++ b/include/stratosphere/ipc/ipc_service_session.hpp @@ -30,10 +30,6 @@ enum HipcControlCommand : u32 { HipcControlCommand_CloneCurrentObjectEx = 4 }; - -#define RESULT_DEFER_SESSION (0x6580A) - - class ServiceSession : public IWaitable { protected: @@ -150,7 +146,7 @@ class ServiceSession : public IWaitable { auto sub_obj = ctx->obj_holder->GetServiceObject()->GetObject(ctx->request.InThisObjectId); if (sub_obj == nullptr) { - return PrepareBasicDomainResponse(ctx, 0x3D80B); + return PrepareBasicDomainResponse(ctx, ResultHipcDomainObjectNotFound); } dispatch_table = sub_obj->GetDispatchTable(); entry_count = sub_obj->GetDispatchTableEntryCount(); @@ -213,7 +209,7 @@ class ServiceSession : public IWaitable ctx.rc = this->GetResponse(&ctx); } - if (ctx.rc == RESULT_DEFER_SESSION) { + if (ctx.rc == ResultServiceFrameworkRequestDeferredByUser) { /* Session defer. */ this->SetDeferred(true); } else if (ctx.rc == ResultKernelConnectionClosed) { @@ -239,7 +235,7 @@ class ServiceSession : public IWaitable memcpy(armGetTls(), this->backup_tls, sizeof(this->backup_tls)); Result rc = this->HandleReceived(); - if (rc != RESULT_DEFER_SESSION) { + if (rc != ResultServiceFrameworkRequestDeferredByUser) { this->SetDeferred(false); } return rc; @@ -285,7 +281,7 @@ class ServiceSession : public IWaitable /* Allocate new domain. */ auto new_domain = this->session->GetDomainManager()->AllocateDomain(); if (new_domain == nullptr) { - return 0x1900B; + return ResultHipcOutOfDomains; } /* Reserve an object in the domain for our session. */ @@ -305,13 +301,13 @@ class ServiceSession : public IWaitable Result CopyFromCurrentDomain(Out out_h, u32 id) { auto domain = this->session->obj_holder.GetServiceObject(); if (domain == nullptr) { - return 0x3D60B; + return ResultHipcTargetNotDomain; } auto object = domain->GetObject(id); if (object == nullptr) { - return 0x3D80B; + return ResultHipcDomainObjectNotFound; } Handle server_h, client_h; diff --git a/include/stratosphere/mitm/mitm_session.hpp b/include/stratosphere/mitm/mitm_session.hpp index 2f106bfe..86fa06ae 100644 --- a/include/stratosphere/mitm/mitm_session.hpp +++ b/include/stratosphere/mitm/mitm_session.hpp @@ -250,7 +250,7 @@ class MitmSession final : public ServiceSession { Result CopyFromCurrentDomain(Out out_h, u32 id) { auto domain = this->session->obj_holder.GetServiceObject(); if (domain == nullptr) { - return 0x3D60B; + return ResultHipcTargetNotDomain; } diff --git a/include/stratosphere/results.hpp b/include/stratosphere/results.hpp index f9d47504..660c97a0 100644 --- a/include/stratosphere/results.hpp +++ b/include/stratosphere/results.hpp @@ -21,9 +21,11 @@ #include "results/dmnt_results.hpp" #include "results/fatal_results.hpp" #include "results/fs_results.hpp" +#include "results/hipc_results.hpp" #include "results/kernel_results.hpp" #include "results/loader_results.hpp" #include "results/pm_results.hpp" +#include "results/sf_results.hpp" #include "results/sm_results.hpp" static constexpr Result ResultSuccess = 0; diff --git a/include/stratosphere/results/hipc_results.hpp b/include/stratosphere/results/hipc_results.hpp new file mode 100644 index 00000000..a77e0ebd --- /dev/null +++ b/include/stratosphere/results/hipc_results.hpp @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2018 Atmosphère-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once +#include + +static constexpr u32 Module_Hipc = 11; + +static constexpr Result ResultHipcOutOfDomains = MAKERESULT(Module_Hipc, 200); + +static constexpr Result ResultHipcSessionClosed = MAKERESULT(Module_Hipc, 301); + +static constexpr Result ResultHipcTargetNotDomain = MAKERESULT(Module_Hipc, 491); +static constexpr Result ResultHipcDomainObjectNotFound = MAKERESULT(Module_Hipc, 492); diff --git a/include/stratosphere/results/sf_results.hpp b/include/stratosphere/results/sf_results.hpp new file mode 100644 index 00000000..e02bfc35 --- /dev/null +++ b/include/stratosphere/results/sf_results.hpp @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2018 Atmosphère-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once +#include + +static constexpr u32 Module_ServiceFramework = 10; + +static constexpr Result ResultServiceFrameworkOutOfDomainEntries = MAKERESULT(Module_ServiceFramework, 301); + + +static constexpr Result ResultServiceFrameworkRequestDeferred = MAKERESULT(Module_ServiceFramework, 811); +static constexpr Result ResultServiceFrameworkRequestDeferredByUser = MAKERESULT(Module_ServiceFramework, 812); diff --git a/include/stratosphere/waitable_manager.hpp b/include/stratosphere/waitable_manager.hpp index c77ea57c..158cb294 100644 --- a/include/stratosphere/waitable_manager.hpp +++ b/include/stratosphere/waitable_manager.hpp @@ -359,19 +359,19 @@ class WaitableManager : public SessionManagerBase { return 0; } } - return 0x25A0A; + return ResultServiceFrameworkOutOfDomainEntries; } virtual Result ReserveSpecificObject(IDomainObject *domain, u32 object_id) override { std::scoped_lock lk{this->domain_lock}; if (object_id > ManagerOptions::MaxDomainObjects) { - return 0x25A0A; + return ResultServiceFrameworkOutOfDomainEntries; } if (this->domain_objects[object_id-1].owner == nullptr) { this->domain_objects[object_id-1].owner = domain; return 0; } - return 0x25A0A; + return ResultServiceFrameworkOutOfDomainEntries; } virtual void SetObject(IDomainObject *domain, u32 object_id, ServiceObjectHolder&& holder) override { @@ -398,27 +398,27 @@ class WaitableManager : public SessionManagerBase { virtual Result FreeObject(IDomainObject *domain, u32 object_id) override { std::scoped_lock lk{this->domain_lock}; if (object_id > ManagerOptions::MaxDomainObjects) { - return 0x3D80B; + return ResultHipcDomainObjectNotFound; } if (this->domain_objects[object_id-1].owner == domain) { this->domain_objects[object_id-1].obj_holder.Reset(); this->domain_objects[object_id-1].owner = nullptr; return 0x0; } - return 0x3D80B; + return ResultHipcDomainObjectNotFound; } virtual Result ForceFreeObject(u32 object_id) override { std::scoped_lock lk{this->domain_lock}; if (object_id > ManagerOptions::MaxDomainObjects) { - return 0x3D80B; + return ResultHipcDomainObjectNotFound; } if (this->domain_objects[object_id-1].owner != nullptr) { this->domain_objects[object_id-1].obj_holder.Reset(); this->domain_objects[object_id-1].owner = nullptr; return 0x0; } - return 0x3D80B; + return ResultHipcDomainObjectNotFound; } };