Просмотр исходного кода

service: Fix all incorrect IPC response headers.

bunnei 8 лет назад
Родитель
Сommit
f9dae99006

+ 2 - 2
src/core/hle/service/acc/acc_u0.cpp

@@ -54,7 +54,7 @@ void ACC_U0::GetUserExistence(Kernel::HLERequestContext& ctx) {
 }
 
 void ACC_U0::GetProfile(Kernel::HLERequestContext& ctx) {
-    IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+    IPC::RequestBuilder rb{ctx, 2, 0, 1};
     rb.Push(RESULT_SUCCESS);
     rb.PushIpcInterface<IProfile>();
     LOG_DEBUG(Service, "called");
@@ -67,7 +67,7 @@ void ACC_U0::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) {
 }
 
 void ACC_U0::GetBaasAccountManagerForApplication(Kernel::HLERequestContext& ctx) {
-    IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+    IPC::RequestBuilder rb{ctx, 2, 0, 1};
     rb.Push(RESULT_SUCCESS);
     rb.PushIpcInterface<IManagerForApplication>();
     LOG_DEBUG(Service, "called");

+ 11 - 11
src/core/hle/service/am/applet_oe.cpp

@@ -291,7 +291,7 @@ private:
     std::vector<u8> buffer;
 
     void Open(Kernel::HLERequestContext& ctx) {
-        IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+        IPC::RequestBuilder rb{ctx, 2, 0, 1};
 
         rb.Push(RESULT_SUCCESS);
         rb.PushIpcInterface<AM::IStorageAccessor>(buffer);
@@ -328,7 +328,7 @@ private:
 
         std::vector<u8> buffer(data, data + sizeof(data));
 
-        IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+        IPC::RequestBuilder rb{ctx, 2, 0, 1};
 
         rb.Push(RESULT_SUCCESS);
         rb.PushIpcInterface<AM::IStorage>(buffer);
@@ -402,56 +402,56 @@ public:
 
 private:
     void GetAudioController(Kernel::HLERequestContext& ctx) {
-        IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+        IPC::RequestBuilder rb{ctx, 2, 0, 1};
         rb.Push(RESULT_SUCCESS);
         rb.PushIpcInterface<IAudioController>();
         LOG_DEBUG(Service, "called");
     }
 
     void GetDisplayController(Kernel::HLERequestContext& ctx) {
-        IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+        IPC::RequestBuilder rb{ctx, 2, 0, 1};
         rb.Push(RESULT_SUCCESS);
         rb.PushIpcInterface<IDisplayController>();
         LOG_DEBUG(Service, "called");
     }
 
     void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
-        IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+        IPC::RequestBuilder rb{ctx, 2, 0, 1};
         rb.Push(RESULT_SUCCESS);
         rb.PushIpcInterface<IDebugFunctions>();
         LOG_DEBUG(Service, "called");
     }
 
     void GetWindowController(Kernel::HLERequestContext& ctx) {
-        IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+        IPC::RequestBuilder rb{ctx, 2, 0, 1};
         rb.Push(RESULT_SUCCESS);
         rb.PushIpcInterface<IWindowController>();
         LOG_DEBUG(Service, "called");
     }
 
     void GetSelfController(Kernel::HLERequestContext& ctx) {
-        IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+        IPC::RequestBuilder rb{ctx, 2, 0, 1};
         rb.Push(RESULT_SUCCESS);
         rb.PushIpcInterface<ISelfController>(nvflinger);
         LOG_DEBUG(Service, "called");
     }
 
     void GetCommonStateGetter(Kernel::HLERequestContext& ctx) {
-        IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+        IPC::RequestBuilder rb{ctx, 2, 0, 1};
         rb.Push(RESULT_SUCCESS);
         rb.PushIpcInterface<ICommonStateGetter>();
         LOG_DEBUG(Service, "called");
     }
 
     void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) {
-        IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+        IPC::RequestBuilder rb{ctx, 2, 0, 1};
         rb.Push(RESULT_SUCCESS);
         rb.PushIpcInterface<ILibraryAppletCreator>();
         LOG_DEBUG(Service, "called");
     }
 
     void GetApplicationFunctions(Kernel::HLERequestContext& ctx) {
-        IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+        IPC::RequestBuilder rb{ctx, 2, 0, 1};
         rb.Push(RESULT_SUCCESS);
         rb.PushIpcInterface<IApplicationFunctions>();
         LOG_DEBUG(Service, "called");
@@ -461,7 +461,7 @@ private:
 };
 
 void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) {
-    IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+    IPC::RequestBuilder rb{ctx, 2, 0, 1};
     rb.Push(RESULT_SUCCESS);
     rb.PushIpcInterface<IApplicationProxy>(nvflinger);
     LOG_DEBUG(Service, "called");

+ 1 - 1
src/core/hle/service/apm/apm.cpp

@@ -58,7 +58,7 @@ APM::APM() : ServiceFramework("apm") {
 }
 
 void APM::OpenSession(Kernel::HLERequestContext& ctx) {
-    IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+    IPC::RequestBuilder rb{ctx, 2, 0, 1};
     rb.Push(RESULT_SUCCESS);
     rb.PushIpcInterface<ISession>();
 }

+ 1 - 1
src/core/hle/service/audio/audout_u.cpp

@@ -166,7 +166,7 @@ void AudOutU::ListAudioOuts(Kernel::HLERequestContext& ctx) {
 
     Memory::WriteBlock(buffer.Address(), &audio_interface[0], audio_interface.size());
 
-    IPC::RequestBuilder rb = rp.MakeBuilder(3, 0, 0, 0);
+    IPC::RequestBuilder rb = rp.MakeBuilder(3, 0, 0);
 
     rb.Push(RESULT_SUCCESS);
     // TODO(st4rk): we're currently returning only one audio interface

+ 2 - 2
src/core/hle/service/filesystem/fsp_srv.cpp

@@ -98,7 +98,7 @@ void FSP_SRV::Initalize(Kernel::HLERequestContext& ctx) {
 void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {
     LOG_WARNING(Service_FS, "(STUBBED) called");
 
-    IPC::RequestBuilder rb{ctx, 4};
+    IPC::RequestBuilder rb{ctx, 3};
     rb.Push(RESULT_SUCCESS);
     rb.Push<u32>(5);
 }
@@ -124,7 +124,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
         return;
     }
 
-    IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+    IPC::RequestBuilder rb{ctx, 2, 0, 1};
     rb.Push(RESULT_SUCCESS);
     rb.PushIpcInterface<IStorage>(std::move(storage.Unwrap()));
 }

+ 2 - 11
src/core/hle/service/hid/hid.cpp

@@ -169,19 +169,10 @@ private:
             applet_resource = std::make_shared<IAppletResource>();
         }
 
-        // TODO(Subv): Verify if this should return the interface as a domain object when called
-        // from within a domain.
-
-        auto sessions = Kernel::ServerSession::CreateSessionPair(applet_resource->GetServiceName());
-        auto server = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions);
-        auto client = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions);
-        applet_resource->ClientConnected(server);
-
-        LOG_DEBUG(Service, "called, initialized IAppletResource -> session=%u",
-                  client->GetObjectId());
         IPC::RequestBuilder rb{ctx, 2, 0, 1};
         rb.Push(RESULT_SUCCESS);
-        rb.PushMoveObjects(std::move(client));
+        rb.PushIpcInterface<IAppletResource>(applet_resource);
+        LOG_DEBUG(Service, "called");
     }
 };
 

+ 4 - 14
src/core/hle/service/lm/lm.cpp

@@ -65,7 +65,7 @@ private:
      */
     void Log(Kernel::HLERequestContext& ctx) {
         // This function only succeeds - Get that out of the way
-        IPC::RequestBuilder rb{ctx, 1};
+        IPC::RequestBuilder rb{ctx, 2};
         rb.Push(RESULT_SUCCESS);
 
         // Read MessageHeader, despite not doing anything with it right now
@@ -130,7 +130,7 @@ private:
         }
         output += message;
 
-        LOG_DEBUG(Debug_Emulated, "%s", output.c_str());
+        LOG_INFO(Debug_Emulated, "%s", output.c_str());
     }
 };
 
@@ -146,21 +146,11 @@ void InstallInterfaces(SM::ServiceManager& service_manager) {
  *      0: ResultCode
  */
 void LM::Initialize(Kernel::HLERequestContext& ctx) {
-    // TODO(Subv): Verify if this should return the interface as a domain object when called from
-    // within a domain.
-
-    auto logger = std::make_shared<Logger>();
-    auto sessions = Kernel::ServerSession::CreateSessionPair(logger->GetServiceName());
-    auto server = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions);
-    auto client = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions);
-    logger->ClientConnected(server);
-
-    LOG_DEBUG(Service_SM, "called, initialized logger -> session=%u", client->GetObjectId());
     IPC::RequestBuilder rb{ctx, 2, 0, 1};
     rb.Push(RESULT_SUCCESS);
-    rb.PushMoveObjects(std::move(client));
+    rb.PushIpcInterface<Logger>();
 
-    LOG_INFO(Service_SM, "called");
+    LOG_DEBUG(Service, "called");
 }
 
 LM::LM() : ServiceFramework("lm") {

+ 1 - 1
src/core/hle/service/pctl/pctl_a.cpp

@@ -15,7 +15,7 @@ public:
 };
 
 void PCTL_A::GetService(Kernel::HLERequestContext& ctx) {
-    IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+    IPC::RequestBuilder rb{ctx, 2, 0, 1};
     rb.Push(RESULT_SUCCESS);
     rb.PushIpcInterface<IParentalControlService>();
     LOG_DEBUG(Service, "called");

+ 1 - 1
src/core/hle/service/service.cpp

@@ -132,7 +132,7 @@ void ServiceFrameworkBase::InvokeRequest(Kernel::HLERequestContext& ctx) {
 ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& context) {
     switch (context.GetCommandType()) {
     case IPC::CommandType::Close: {
-        IPC::RequestBuilder rb{context, 1};
+        IPC::RequestBuilder rb{context, 2};
         rb.Push(RESULT_SUCCESS);
         return ResultCode(ErrorModule::HIPC, ErrorDescription::RemoteProcessDead);
     }

+ 1 - 2
src/core/hle/service/sm/controller.cpp

@@ -21,9 +21,8 @@ void Controller::ConvertSessionToDomain(Kernel::HLERequestContext& ctx) {
 }
 
 void Controller::DuplicateSession(Kernel::HLERequestContext& ctx) {
-    IPC::RequestBuilder rb{ctx, 2, 0, 1};
+    IPC::RequestBuilder rb{ctx, 2, 0, 1, true};
     rb.Push(RESULT_SUCCESS);
-    // TODO(Subv): Check if this is correct
     rb.PushMoveObjects(ctx.Session());
 
     LOG_DEBUG(Service, "called");

+ 3 - 3
src/core/hle/service/sm/sm.cpp

@@ -83,7 +83,7 @@ std::shared_ptr<ServiceManager> g_service_manager;
  *      0: ResultCode
  */
 void SM::Initialize(Kernel::HLERequestContext& ctx) {
-    IPC::RequestBuilder rb{ctx, 1};
+    IPC::RequestBuilder rb{ctx, 2};
     rb.Push(RESULT_SUCCESS);
     LOG_DEBUG(Service_SM, "called");
 }
@@ -99,7 +99,7 @@ void SM::GetService(Kernel::HLERequestContext& ctx) {
 
     auto client_port = service_manager->GetServicePort(name);
     if (client_port.Failed()) {
-        IPC::RequestBuilder rb = rp.MakeBuilder(2, 0, 0, 0);
+        IPC::RequestBuilder rb = rp.MakeBuilder(2, 0, 0);
         rb.Push(client_port.Code());
         LOG_ERROR(Service_SM, "called service=%s -> error 0x%08X", name.c_str(),
                   client_port.Code().raw);
@@ -112,7 +112,7 @@ void SM::GetService(Kernel::HLERequestContext& ctx) {
     if (session.Succeeded()) {
         LOG_DEBUG(Service_SM, "called service=%s -> session=%u", name.c_str(),
                   (*session)->GetObjectId());
-        IPC::RequestBuilder rb = rp.MakeBuilder(2, 0, 1, 0);
+        IPC::RequestBuilder rb = rp.MakeBuilder(2, 0, 1, true);
         rb.Push(session.Code());
         rb.PushMoveObjects(std::move(session).Unwrap());
     }

+ 7 - 28
src/core/hle/service/time/time.cpp

@@ -83,49 +83,28 @@ private:
 };
 
 void Module::Interface::GetStandardUserSystemClock(Kernel::HLERequestContext& ctx) {
-    // TODO(Subv): Verify if this should return the interface as a domain object when called from
-    // within a domain.
-    auto system_clock = std::make_shared<ISystemClock>();
-    auto sessions = Kernel::ServerSession::CreateSessionPair(system_clock->GetServiceName());
-    auto server = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions);
-    auto client = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions);
-    system_clock->ClientConnected(server);
-    LOG_DEBUG(Service, "called, initialized ISystemClock -> session=%u", client->GetObjectId());
     IPC::RequestBuilder rb{ctx, 2, 0, 1};
     rb.Push(RESULT_SUCCESS);
-    rb.PushMoveObjects(std::move(client));
+    rb.PushIpcInterface<ISystemClock>();
+    LOG_DEBUG(Service, "called");
 }
 
 void Module::Interface::GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx) {
-    // TODO(Subv): Verify if this should return the interface as a domain object when called from
-    // within a domain.
-    auto system_clock = std::make_shared<ISystemClock>();
-    auto sessions = Kernel::ServerSession::CreateSessionPair(system_clock->GetServiceName());
-    auto server = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions);
-    auto client = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions);
-    system_clock->ClientConnected(server);
-    LOG_DEBUG(Service, "called, initialized ISystemClock -> session=%u", client->GetObjectId());
     IPC::RequestBuilder rb{ctx, 2, 0, 1};
     rb.Push(RESULT_SUCCESS);
-    rb.PushMoveObjects(std::move(client));
+    rb.PushIpcInterface<ISystemClock>();
+    LOG_DEBUG(Service, "called");
 }
 
 void Module::Interface::GetStandardSteadyClock(Kernel::HLERequestContext& ctx) {
-    // TODO(Subv): Verify if this should return the interface as a domain object when called from
-    // within a domain.
-    auto steady_clock = std::make_shared<ISteadyClock>();
-    auto sessions = Kernel::ServerSession::CreateSessionPair(steady_clock->GetServiceName());
-    auto server = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions);
-    auto client = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions);
-    steady_clock->ClientConnected(server);
-    LOG_DEBUG(Service, "called, initialized ISteadyClock -> session=%u", client->GetObjectId());
     IPC::RequestBuilder rb{ctx, 2, 0, 1};
     rb.Push(RESULT_SUCCESS);
-    rb.PushMoveObjects(std::move(client));
+    rb.PushIpcInterface<ISteadyClock>();
+    LOG_DEBUG(Service, "called");
 }
 
 void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) {
-    IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+    IPC::RequestBuilder rb{ctx, 2, 0, 1};
     rb.Push(RESULT_SUCCESS);
     rb.PushIpcInterface<ITimeZoneService>();
     LOG_DEBUG(Service, "called");

+ 4 - 4
src/core/hle/service/vi/vi.cpp

@@ -597,7 +597,7 @@ private:
 void IApplicationDisplayService::GetRelayService(Kernel::HLERequestContext& ctx) {
     LOG_WARNING(Service, "(STUBBED) called");
 
-    IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+    IPC::RequestBuilder rb{ctx, 2, 0, 1};
     rb.Push(RESULT_SUCCESS);
     rb.PushIpcInterface<IHOSBinderDriver>(nv_flinger);
 }
@@ -605,7 +605,7 @@ void IApplicationDisplayService::GetRelayService(Kernel::HLERequestContext& ctx)
 void IApplicationDisplayService::GetSystemDisplayService(Kernel::HLERequestContext& ctx) {
     LOG_WARNING(Service, "(STUBBED) called");
 
-    IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+    IPC::RequestBuilder rb{ctx, 2, 0, 1};
     rb.Push(RESULT_SUCCESS);
     rb.PushIpcInterface<ISystemDisplayService>();
 }
@@ -613,7 +613,7 @@ void IApplicationDisplayService::GetSystemDisplayService(Kernel::HLERequestConte
 void IApplicationDisplayService::GetManagerDisplayService(Kernel::HLERequestContext& ctx) {
     LOG_WARNING(Service, "(STUBBED) called");
 
-    IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+    IPC::RequestBuilder rb{ctx, 2, 0, 1};
     rb.Push(RESULT_SUCCESS);
     rb.PushIpcInterface<IManagerDisplayService>(nv_flinger);
 }
@@ -622,7 +622,7 @@ void IApplicationDisplayService::GetIndirectDisplayTransactionService(
     Kernel::HLERequestContext& ctx) {
     LOG_WARNING(Service, "(STUBBED) called");
 
-    IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+    IPC::RequestBuilder rb{ctx, 2, 0, 1};
     rb.Push(RESULT_SUCCESS);
     rb.PushIpcInterface<IHOSBinderDriver>(nv_flinger);
 }

+ 2 - 1
src/core/hle/service/vi/vi_m.cpp

@@ -13,7 +13,8 @@ namespace VI {
 void VI_M::GetDisplayService(Kernel::HLERequestContext& ctx) {
     LOG_WARNING(Service, "(STUBBED) called");
 
-    IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+    IPC::RequestBuilder rb{ctx, 2, 0, 1};
+    rb.Push(RESULT_SUCCESS);
     rb.PushIpcInterface<IApplicationDisplayService>(nv_flinger);
 }