mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-21 19:12:42 +02:00
Improve mitm semantics a little bit more.
This commit is contained in:
parent
8fcac73ab2
commit
0bec72ca36
@ -19,6 +19,7 @@
|
||||
#include <atomic>
|
||||
|
||||
#include <stratosphere.hpp>
|
||||
#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<Service> s) : forward_service(s) {}
|
||||
IMitmServiceObject(std::shared_ptr<Service> 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:
|
||||
|
@ -96,8 +96,8 @@ class MitmServer : public IWaitable {
|
||||
}
|
||||
|
||||
smMitMExit();
|
||||
|
||||
this->GetSessionManager()->AddWaitable(new MitmSession(session_h, client_pid, forward_service, std::make_shared<T>(forward_service)));
|
||||
|
||||
this->GetSessionManager()->AddWaitable(new MitmSession(session_h, client_pid, forward_service, std::make_shared<T>(forward_service, client_pid)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -40,11 +40,7 @@ class MitmSession final : public ServiceSession {
|
||||
MitmSession(Handle s_h, u64 pid, std::shared_ptr<Service> fs, std::shared_ptr<T> 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<IMitmServiceObject>()->SetPidTid(client_pid, tid);
|
||||
|
||||
|
||||
this->service_post_process_handler = T::PostProcess;
|
||||
|
||||
size_t pbs;
|
||||
|
Loading…
Reference in New Issue
Block a user