sf: Change interface definition methodology (#1074)
* sf: Begin experimenting with new interface declaration format * sf: convert fs interfaces to new format * sf: finish conversion of libstrat to new definitions * sf: convert loader to new format * sf: convert spl to new format * sf: update ncm for new format * sf: convert pm to new format * sf: convert ro/sm to new format * sf: update fatal for new format * sf: support building dmnt under new scheme * sf: update ams.mitm for new format * sf: correct invocation def for pointer holder * fs: correct 10.x+ user bindings for Get*SpaceSize
This commit is contained in:
@@ -20,11 +20,13 @@ namespace ams::sf::hipc::impl {
|
||||
|
||||
namespace {
|
||||
|
||||
class MitmQueryService : public IServiceObject {
|
||||
private:
|
||||
enum class CommandId {
|
||||
ShouldMitm = 65000,
|
||||
};
|
||||
#define AMS_SF_HIPC_IMPL_I_MITM_QUERY_SERVICE_INTERFACE_INFO(C, H) \
|
||||
AMS_SF_METHOD_INFO(C, H, 65000, void, ShouldMitm, (sf::Out<bool> out, const sm::MitmProcessInfo &client_info))
|
||||
|
||||
AMS_SF_DEFINE_INTERFACE(IMitmQueryService, AMS_SF_HIPC_IMPL_I_MITM_QUERY_SERVICE_INTERFACE_INFO)
|
||||
|
||||
|
||||
class MitmQueryService {
|
||||
private:
|
||||
ServerManagerBase::MitmQueryFunction query_function;
|
||||
public:
|
||||
@@ -33,11 +35,8 @@ namespace ams::sf::hipc::impl {
|
||||
void ShouldMitm(sf::Out<bool> out, const sm::MitmProcessInfo &client_info) {
|
||||
out.SetValue(this->query_function(client_info));
|
||||
}
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
MAKE_SERVICE_COMMAND_META(ShouldMitm),
|
||||
};
|
||||
};
|
||||
static_assert(IsIMitmQueryService<MitmQueryService>);
|
||||
|
||||
/* Globals. */
|
||||
os::Mutex g_query_server_lock(false);
|
||||
@@ -66,7 +65,7 @@ namespace ams::sf::hipc::impl {
|
||||
g_constructed_server = true;
|
||||
}
|
||||
|
||||
R_ABORT_UNLESS(GetPointer(g_query_server_storage)->RegisterSession(query_handle, cmif::ServiceObjectHolder(std::make_shared<MitmQueryService>(query_func))));
|
||||
R_ABORT_UNLESS(GetPointer(g_query_server_storage)->RegisterSession(query_handle, cmif::ServiceObjectHolder(sf::MakeShared<IMitmQueryService, MitmQueryService>(query_func))));
|
||||
|
||||
if (AMS_UNLIKELY(!g_registered_any)) {
|
||||
R_ABORT_UNLESS(os::CreateThread(std::addressof(g_query_server_process_thread), &QueryServerProcessThreadMain, GetPointer(g_query_server_storage), g_server_process_thread_stack, sizeof(g_server_process_thread_stack), AMS_GET_SYSTEM_THREAD_PRIORITY(mitm_sf, QueryServerProcessThread)));
|
||||
|
||||
@@ -19,15 +19,16 @@ namespace ams::sf::hipc {
|
||||
|
||||
namespace impl {
|
||||
|
||||
class HipcManager : public IServiceObject {
|
||||
private:
|
||||
enum class CommandId {
|
||||
ConvertCurrentObjectToDomain = 0,
|
||||
CopyFromCurrentDomain = 1,
|
||||
CloneCurrentObject = 2,
|
||||
QueryPointerBufferSize = 3,
|
||||
CloneCurrentObjectEx = 4,
|
||||
};
|
||||
#define AMS_SF_HIPC_IMPL_I_HIPC_MANAGER_INTERFACE_INFO(C, H) \
|
||||
AMS_SF_METHOD_INFO(C, H, 0, Result, ConvertCurrentObjectToDomain, (ams::sf::Out<ams::sf::cmif::DomainObjectId> out)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 1, Result, CopyFromCurrentDomain, (ams::sf::OutMoveHandle out, ams::sf::cmif::DomainObjectId object_id)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 2, Result, CloneCurrentObject, (ams::sf::OutMoveHandle out)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 3, void, QueryPointerBufferSize, (ams::sf::Out<u16> out)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 4, Result, CloneCurrentObjectEx, (ams::sf::OutMoveHandle out, u32 tag))
|
||||
|
||||
AMS_SF_DEFINE_INTERFACE(IHipcManager, AMS_SF_HIPC_IMPL_I_HIPC_MANAGER_INTERFACE_INFO)
|
||||
|
||||
class HipcManager final {
|
||||
private:
|
||||
ServerDomainSessionManager *manager;
|
||||
ServerSession *session;
|
||||
@@ -150,16 +151,8 @@ namespace ams::sf::hipc {
|
||||
Result CloneCurrentObjectEx(sf::OutMoveHandle out, u32 tag) {
|
||||
return this->CloneCurrentObjectImpl(out.GetHandlePointer(), this->manager->GetSessionManagerByTag(tag));
|
||||
}
|
||||
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
MAKE_SERVICE_COMMAND_META(ConvertCurrentObjectToDomain),
|
||||
MAKE_SERVICE_COMMAND_META(CopyFromCurrentDomain),
|
||||
MAKE_SERVICE_COMMAND_META(CloneCurrentObject),
|
||||
MAKE_SERVICE_COMMAND_META(QueryPointerBufferSize),
|
||||
MAKE_SERVICE_COMMAND_META(CloneCurrentObjectEx),
|
||||
};
|
||||
};
|
||||
static_assert(IsIHipcManager<HipcManager>);
|
||||
|
||||
}
|
||||
|
||||
@@ -168,7 +161,7 @@ namespace ams::sf::hipc {
|
||||
/* Note: This is safe, as no additional references to the hipc manager can ever be stored. */
|
||||
/* The shared pointer to stack object is definitely gross, though. */
|
||||
impl::HipcManager hipc_manager(this, session);
|
||||
return this->DispatchRequest(cmif::ServiceObjectHolder(std::move(ServiceObjectTraits<impl::HipcManager>::SharedPointerHelper::GetEmptyDeleteSharedPointer(&hipc_manager))), session, in_message, out_message);
|
||||
return this->DispatchRequest(cmif::ServiceObjectHolder(sf::GetSharedPointerTo<impl::IHipcManager>(hipc_manager)), session, in_message, out_message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user