mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-21 19:12:42 +02:00
results: add sf/hipc results.
This commit is contained in:
parent
033c77716c
commit
27164564a1
@ -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<IDomainObject>()->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<MovedHandle> out_h, u32 id) {
|
||||
auto domain = this->session->obj_holder.GetServiceObject<IDomainObject>();
|
||||
if (domain == nullptr) {
|
||||
return 0x3D60B;
|
||||
return ResultHipcTargetNotDomain;
|
||||
}
|
||||
|
||||
|
||||
auto object = domain->GetObject(id);
|
||||
if (object == nullptr) {
|
||||
return 0x3D80B;
|
||||
return ResultHipcDomainObjectNotFound;
|
||||
}
|
||||
|
||||
Handle server_h, client_h;
|
||||
|
@ -250,7 +250,7 @@ class MitmSession final : public ServiceSession {
|
||||
Result CopyFromCurrentDomain(Out<MovedHandle> out_h, u32 id) {
|
||||
auto domain = this->session->obj_holder.GetServiceObject<IDomainObject>();
|
||||
if (domain == nullptr) {
|
||||
return 0x3D60B;
|
||||
return ResultHipcTargetNotDomain;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
27
include/stratosphere/results/hipc_results.hpp
Normal file
27
include/stratosphere/results/hipc_results.hpp
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <switch.h>
|
||||
|
||||
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);
|
26
include/stratosphere/results/sf_results.hpp
Normal file
26
include/stratosphere/results/sf_results.hpp
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <switch.h>
|
||||
|
||||
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);
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user