summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/acc/acc.cpp3
-rw-r--r--src/core/hle/service/glue/ectx.cpp43
-rw-r--r--src/core/hle/service/glue/ectx.h3
-rw-r--r--src/core/hle/service/sockets/bsd.cpp2
-rw-r--r--src/core/hle/service/sockets/nsd.cpp10
-rw-r--r--src/core/hle/service/sockets/nsd.h1
-rw-r--r--src/core/hle/service/sockets/sfdnsres.cpp16
-rw-r--r--src/core/hle/service/sockets/sfdnsres.h1
-rw-r--r--src/core/hle/service/sockets/sockets_translate.cpp38
-rw-r--r--src/core/hle/service/sockets/sockets_translate.h3
10 files changed, 115 insertions, 5 deletions
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index 6c29cb613..2632cd3ef 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -496,8 +496,9 @@ public:
496 void LoadIdTokenCache(HLERequestContext& ctx) { 496 void LoadIdTokenCache(HLERequestContext& ctx) {
497 LOG_WARNING(Service_ACC, "(STUBBED) called"); 497 LOG_WARNING(Service_ACC, "(STUBBED) called");
498 498
499 IPC::ResponseBuilder rb{ctx, 2}; 499 IPC::ResponseBuilder rb{ctx, 3};
500 rb.Push(ResultSuccess); 500 rb.Push(ResultSuccess);
501 rb.Push(0);
501 } 502 }
502 503
503protected: 504protected:
diff --git a/src/core/hle/service/glue/ectx.cpp b/src/core/hle/service/glue/ectx.cpp
index 1bd9314ae..6f71b62f3 100644
--- a/src/core/hle/service/glue/ectx.cpp
+++ b/src/core/hle/service/glue/ectx.cpp
@@ -2,13 +2,48 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/service/glue/ectx.h" 4#include "core/hle/service/glue/ectx.h"
5#include "core/hle/service/ipc_helpers.h"
5 6
6namespace Service::Glue { 7namespace Service::Glue {
7 8
9// This is nn::err::context::IContextRegistrar
10class IContextRegistrar : public ServiceFramework<IContextRegistrar> {
11public:
12 IContextRegistrar(Core::System& system_) : ServiceFramework{system_, "IContextRegistrar"} {
13 // clang-format off
14 static const FunctionInfo functions[] = {
15 {0, &IContextRegistrar::Complete, "Complete"},
16 };
17 // clang-format on
18
19 RegisterHandlers(functions);
20 }
21
22 ~IContextRegistrar() override = default;
23
24private:
25 void Complete(HLERequestContext& ctx) {
26 struct InputParameters {
27 u32 unk;
28 };
29 struct OutputParameters {
30 u32 unk;
31 };
32
33 IPC::RequestParser rp{ctx};
34 [[maybe_unused]] auto input = rp.PopRaw<InputParameters>();
35 [[maybe_unused]] auto value = ctx.ReadBuffer();
36
37 IPC::ResponseBuilder rb{ctx, 3};
38 rb.Push(ResultSuccess);
39 rb.Push(0);
40 }
41};
42
8ECTX_AW::ECTX_AW(Core::System& system_) : ServiceFramework{system_, "ectx:aw"} { 43ECTX_AW::ECTX_AW(Core::System& system_) : ServiceFramework{system_, "ectx:aw"} {
9 // clang-format off 44 // clang-format off
10 static const FunctionInfo functions[] = { 45 static const FunctionInfo functions[] = {
11 {0, nullptr, "CreateContextRegistrar"}, 46 {0, &ECTX_AW::CreateContextRegistrar, "CreateContextRegistrar"},
12 {1, nullptr, "CommitContext"}, 47 {1, nullptr, "CommitContext"},
13 }; 48 };
14 // clang-format on 49 // clang-format on
@@ -18,4 +53,10 @@ ECTX_AW::ECTX_AW(Core::System& system_) : ServiceFramework{system_, "ectx:aw"} {
18 53
19ECTX_AW::~ECTX_AW() = default; 54ECTX_AW::~ECTX_AW() = default;
20 55
56void ECTX_AW::CreateContextRegistrar(HLERequestContext& ctx) {
57 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
58 rb.Push(ResultSuccess);
59 rb.PushIpcInterface<IContextRegistrar>(std::make_shared<IContextRegistrar>(system));
60}
61
21} // namespace Service::Glue 62} // namespace Service::Glue
diff --git a/src/core/hle/service/glue/ectx.h b/src/core/hle/service/glue/ectx.h
index a608de053..ffa74d8d3 100644
--- a/src/core/hle/service/glue/ectx.h
+++ b/src/core/hle/service/glue/ectx.h
@@ -15,6 +15,9 @@ class ECTX_AW final : public ServiceFramework<ECTX_AW> {
15public: 15public:
16 explicit ECTX_AW(Core::System& system_); 16 explicit ECTX_AW(Core::System& system_);
17 ~ECTX_AW() override; 17 ~ECTX_AW() override;
18
19private:
20 void CreateContextRegistrar(HLERequestContext& ctx);
18}; 21};
19 22
20} // namespace Service::Glue 23} // namespace Service::Glue
diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp
index e63b0a357..11f8efbac 100644
--- a/src/core/hle/service/sockets/bsd.cpp
+++ b/src/core/hle/service/sockets/bsd.cpp
@@ -559,7 +559,7 @@ std::pair<s32, Errno> BSD::PollImpl(std::vector<u8>& write_buffer, std::span<con
559 559
560 const std::optional<FileDescriptor>& descriptor = file_descriptors[pollfd.fd]; 560 const std::optional<FileDescriptor>& descriptor = file_descriptors[pollfd.fd];
561 if (!descriptor) { 561 if (!descriptor) {
562 LOG_ERROR(Service, "File descriptor handle={} is not allocated", pollfd.fd); 562 LOG_TRACE(Service, "File descriptor handle={} is not allocated", pollfd.fd);
563 pollfd.revents = PollEvents::Nval; 563 pollfd.revents = PollEvents::Nval;
564 return {0, Errno::SUCCESS}; 564 return {0, Errno::SUCCESS};
565 } 565 }
diff --git a/src/core/hle/service/sockets/nsd.cpp b/src/core/hle/service/sockets/nsd.cpp
index 36c6cd05c..5dfcaabb1 100644
--- a/src/core/hle/service/sockets/nsd.cpp
+++ b/src/core/hle/service/sockets/nsd.cpp
@@ -24,7 +24,7 @@ NSD::NSD(Core::System& system_, const char* name) : ServiceFramework{system_, na
24 static const FunctionInfo functions[] = { 24 static const FunctionInfo functions[] = {
25 {5, nullptr, "GetSettingUrl"}, 25 {5, nullptr, "GetSettingUrl"},
26 {10, nullptr, "GetSettingName"}, 26 {10, nullptr, "GetSettingName"},
27 {11, nullptr, "GetEnvironmentIdentifier"}, 27 {11, &NSD::GetEnvironmentIdentifier, "GetEnvironmentIdentifier"},
28 {12, nullptr, "GetDeviceId"}, 28 {12, nullptr, "GetDeviceId"},
29 {13, nullptr, "DeleteSettings"}, 29 {13, nullptr, "DeleteSettings"},
30 {14, nullptr, "ImportSettings"}, 30 {14, nullptr, "ImportSettings"},
@@ -103,6 +103,14 @@ void NSD::ResolveEx(HLERequestContext& ctx) {
103 rb.Push(ResultSuccess); 103 rb.Push(ResultSuccess);
104} 104}
105 105
106void NSD::GetEnvironmentIdentifier(HLERequestContext& ctx) {
107 const std::string environment_identifier = "lp1";
108 ctx.WriteBuffer(environment_identifier);
109
110 IPC::ResponseBuilder rb{ctx, 2};
111 rb.Push(ResultSuccess);
112}
113
106void NSD::GetApplicationServerEnvironmentType(HLERequestContext& ctx) { 114void NSD::GetApplicationServerEnvironmentType(HLERequestContext& ctx) {
107 IPC::ResponseBuilder rb{ctx, 3}; 115 IPC::ResponseBuilder rb{ctx, 3};
108 rb.Push(ResultSuccess); 116 rb.Push(ResultSuccess);
diff --git a/src/core/hle/service/sockets/nsd.h b/src/core/hle/service/sockets/nsd.h
index 57760a0c8..b0cfec507 100644
--- a/src/core/hle/service/sockets/nsd.h
+++ b/src/core/hle/service/sockets/nsd.h
@@ -19,6 +19,7 @@ public:
19private: 19private:
20 void Resolve(HLERequestContext& ctx); 20 void Resolve(HLERequestContext& ctx);
21 void ResolveEx(HLERequestContext& ctx); 21 void ResolveEx(HLERequestContext& ctx);
22 void GetEnvironmentIdentifier(HLERequestContext& ctx);
22 void GetApplicationServerEnvironmentType(HLERequestContext& ctx); 23 void GetApplicationServerEnvironmentType(HLERequestContext& ctx);
23}; 24};
24 25
diff --git a/src/core/hle/service/sockets/sfdnsres.cpp b/src/core/hle/service/sockets/sfdnsres.cpp
index 84cc79de8..22e4a6f49 100644
--- a/src/core/hle/service/sockets/sfdnsres.cpp
+++ b/src/core/hle/service/sockets/sfdnsres.cpp
@@ -24,7 +24,7 @@ SFDNSRES::SFDNSRES(Core::System& system_) : ServiceFramework{system_, "sfdnsres"
24 {2, &SFDNSRES::GetHostByNameRequest, "GetHostByNameRequest"}, 24 {2, &SFDNSRES::GetHostByNameRequest, "GetHostByNameRequest"},
25 {3, nullptr, "GetHostByAddrRequest"}, 25 {3, nullptr, "GetHostByAddrRequest"},
26 {4, nullptr, "GetHostStringErrorRequest"}, 26 {4, nullptr, "GetHostStringErrorRequest"},
27 {5, nullptr, "GetGaiStringErrorRequest"}, 27 {5, &SFDNSRES::GetGaiStringErrorRequest, "GetGaiStringErrorRequest"},
28 {6, &SFDNSRES::GetAddrInfoRequest, "GetAddrInfoRequest"}, 28 {6, &SFDNSRES::GetAddrInfoRequest, "GetAddrInfoRequest"},
29 {7, nullptr, "GetNameInfoRequest"}, 29 {7, nullptr, "GetNameInfoRequest"},
30 {8, nullptr, "RequestCancelHandleRequest"}, 30 {8, nullptr, "RequestCancelHandleRequest"},
@@ -300,6 +300,20 @@ void SFDNSRES::GetAddrInfoRequest(HLERequestContext& ctx) {
300 }); 300 });
301} 301}
302 302
303void SFDNSRES::GetGaiStringErrorRequest(HLERequestContext& ctx) {
304 struct InputParameters {
305 GetAddrInfoError gai_errno;
306 };
307 IPC::RequestParser rp{ctx};
308 auto input = rp.PopRaw<InputParameters>();
309
310 const std::string result = Translate(input.gai_errno);
311 ctx.WriteBuffer(result);
312
313 IPC::ResponseBuilder rb{ctx, 2};
314 rb.Push(ResultSuccess);
315}
316
303void SFDNSRES::GetAddrInfoRequestWithOptions(HLERequestContext& ctx) { 317void SFDNSRES::GetAddrInfoRequestWithOptions(HLERequestContext& ctx) {
304 // Additional options are ignored 318 // Additional options are ignored
305 auto [data_size, emu_gai_err] = GetAddrInfoRequestImpl(ctx); 319 auto [data_size, emu_gai_err] = GetAddrInfoRequestImpl(ctx);
diff --git a/src/core/hle/service/sockets/sfdnsres.h b/src/core/hle/service/sockets/sfdnsres.h
index d99a9d560..282ef9071 100644
--- a/src/core/hle/service/sockets/sfdnsres.h
+++ b/src/core/hle/service/sockets/sfdnsres.h
@@ -18,6 +18,7 @@ public:
18 18
19private: 19private:
20 void GetHostByNameRequest(HLERequestContext& ctx); 20 void GetHostByNameRequest(HLERequestContext& ctx);
21 void GetGaiStringErrorRequest(HLERequestContext& ctx);
21 void GetHostByNameRequestWithOptions(HLERequestContext& ctx); 22 void GetHostByNameRequestWithOptions(HLERequestContext& ctx);
22 void GetAddrInfoRequest(HLERequestContext& ctx); 23 void GetAddrInfoRequest(HLERequestContext& ctx);
23 void GetAddrInfoRequestWithOptions(HLERequestContext& ctx); 24 void GetAddrInfoRequestWithOptions(HLERequestContext& ctx);
diff --git a/src/core/hle/service/sockets/sockets_translate.cpp b/src/core/hle/service/sockets/sockets_translate.cpp
index 2f9a0e39c..c1187209f 100644
--- a/src/core/hle/service/sockets/sockets_translate.cpp
+++ b/src/core/hle/service/sockets/sockets_translate.cpp
@@ -81,6 +81,44 @@ GetAddrInfoError Translate(Network::GetAddrInfoError error) {
81 } 81 }
82} 82}
83 83
84const char* Translate(GetAddrInfoError error) {
85 // https://android.googlesource.com/platform/bionic/+/085543106/libc/dns/net/getaddrinfo.c#254
86 switch (error) {
87 case GetAddrInfoError::SUCCESS:
88 return "Success";
89 case GetAddrInfoError::ADDRFAMILY:
90 return "Address family for hostname not supported";
91 case GetAddrInfoError::AGAIN:
92 return "Temporary failure in name resolution";
93 case GetAddrInfoError::BADFLAGS:
94 return "Invalid value for ai_flags";
95 case GetAddrInfoError::FAIL:
96 return "Non-recoverable failure in name resolution";
97 case GetAddrInfoError::FAMILY:
98 return "ai_family not supported";
99 case GetAddrInfoError::MEMORY:
100 return "Memory allocation failure";
101 case GetAddrInfoError::NODATA:
102 return "No address associated with hostname";
103 case GetAddrInfoError::NONAME:
104 return "hostname nor servname provided, or not known";
105 case GetAddrInfoError::SERVICE:
106 return "servname not supported for ai_socktype";
107 case GetAddrInfoError::SOCKTYPE:
108 return "ai_socktype not supported";
109 case GetAddrInfoError::SYSTEM:
110 return "System error returned in errno";
111 case GetAddrInfoError::BADHINTS:
112 return "Invalid value for hints";
113 case GetAddrInfoError::PROTOCOL:
114 return "Resolved protocol is unknown";
115 case GetAddrInfoError::OVERFLOW_:
116 return "Argument buffer overflow";
117 default:
118 return "Unknown error";
119 }
120}
121
84Network::Domain Translate(Domain domain) { 122Network::Domain Translate(Domain domain) {
85 switch (domain) { 123 switch (domain) {
86 case Domain::Unspecified: 124 case Domain::Unspecified:
diff --git a/src/core/hle/service/sockets/sockets_translate.h b/src/core/hle/service/sockets/sockets_translate.h
index 694868b37..bd6721fd3 100644
--- a/src/core/hle/service/sockets/sockets_translate.h
+++ b/src/core/hle/service/sockets/sockets_translate.h
@@ -20,6 +20,9 @@ std::pair<s32, Errno> Translate(std::pair<s32, Network::Errno> value);
20/// Translate abstract getaddrinfo error to guest getaddrinfo error 20/// Translate abstract getaddrinfo error to guest getaddrinfo error
21GetAddrInfoError Translate(Network::GetAddrInfoError value); 21GetAddrInfoError Translate(Network::GetAddrInfoError value);
22 22
23/// Translate guest error to string
24const char* Translate(GetAddrInfoError value);
25
23/// Translate guest domain to abstract domain 26/// Translate guest domain to abstract domain
24Network::Domain Translate(Domain domain); 27Network::Domain Translate(Domain domain);
25 28