diff --git a/include/stratosphere/mitm/imitmserviceobject.hpp b/include/stratosphere/mitm/imitmserviceobject.hpp index 2ab51d2f..e13c4d5f 100644 --- a/include/stratosphere/mitm/imitmserviceobject.hpp +++ b/include/stratosphere/mitm/imitmserviceobject.hpp @@ -19,6 +19,7 @@ #include #include +#include "mitm_query_service.hpp" class IMitmServiceObject : public IServiceObject { protected: @@ -26,7 +27,9 @@ class IMitmServiceObject : public IServiceObject { u64 process_id = 0; u64 title_id = 0; public: - IMitmServiceObject(std::shared_ptr s) : forward_service(s) {} + IMitmServiceObject(std::shared_ptr s, u64 pid) : forward_service(s), process_id(pid) { + MitmQueryUtils::GetAssociatedTidForPid(this->process_id, &this->title_id); + } virtual u64 GetTitleId() { return this->title_id; @@ -36,11 +39,6 @@ class IMitmServiceObject : public IServiceObject { return this->process_id; } - void SetPidTid(u64 pid, u64 tid) { - this->process_id = pid; - this->title_id = tid; - } - static bool ShouldMitm(u64 pid, u64 tid); protected: diff --git a/include/stratosphere/mitm/mitm_server.hpp b/include/stratosphere/mitm/mitm_server.hpp index 0474c7ae..0529c851 100644 --- a/include/stratosphere/mitm/mitm_server.hpp +++ b/include/stratosphere/mitm/mitm_server.hpp @@ -96,8 +96,8 @@ class MitmServer : public IWaitable { } smMitMExit(); - - this->GetSessionManager()->AddWaitable(new MitmSession(session_h, client_pid, forward_service, std::make_shared(forward_service))); + + this->GetSessionManager()->AddWaitable(new MitmSession(session_h, client_pid, forward_service, std::make_shared(forward_service, client_pid))); return 0; } diff --git a/include/stratosphere/mitm/mitm_session.hpp b/include/stratosphere/mitm/mitm_session.hpp index 69e74646..27105dba 100644 --- a/include/stratosphere/mitm/mitm_session.hpp +++ b/include/stratosphere/mitm/mitm_session.hpp @@ -40,11 +40,7 @@ class MitmSession final : public ServiceSession { MitmSession(Handle s_h, u64 pid, std::shared_ptr fs, std::shared_ptr srv) : ServiceSession(s_h), client_pid(pid) { this->forward_service = std::move(fs); this->obj_holder = std::move(ServiceObjectHolder(std::move(srv))); - - u64 tid = 0; - MitmQueryUtils::GetAssociatedTidForPid(client_pid, &tid); - this->obj_holder.GetServiceObjectUnsafe()->SetPidTid(client_pid, tid); - + this->service_post_process_handler = T::PostProcess; size_t pbs;