From 1f865fd524d32ddf627ac636bd2c6ee490ea78d0 Mon Sep 17 00:00:00 2001 From: B3n30 Date: Sat, 21 Jul 2018 18:54:06 -0500 Subject: [PATCH] Services/HTTP: Stubbed the Initialize function. --- src/core/hle/service/http_c.cpp | 19 ++++++++++++++++++- src/core/hle/service/http_c.h | 17 +++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/http_c.cpp b/src/core/hle/service/http_c.cpp index e61772078..72c48a8d3 100644 --- a/src/core/hle/service/http_c.cpp +++ b/src/core/hle/service/http_c.cpp @@ -9,9 +9,26 @@ namespace Service { namespace HTTP { +void HTTP_C::Initialize(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x1, 1, 4); + const u32 shmem_size = rp.Pop(); + rp.PopPID(); + shared_memory = rp.PopObject(); + if (shared_memory) { + shared_memory->name = "HTTP_C:shared_memory"; + } + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + // This returns 0xd8a0a046 if no network connection is available. + // Just assume we are always connected. + rb.Push(RESULT_SUCCESS); + + LOG_WARNING(Service_HTTP, "(STUBBED) called, shared memory size: {}", shmem_size); +} + HTTP_C::HTTP_C() : ServiceFramework("http:C", 32) { static const FunctionInfo functions[] = { - {0x00010044, nullptr, "Initialize"}, + {0x00010044, &HTTP_C::Initialize, "Initialize"}, {0x00020082, nullptr, "CreateContext"}, {0x00030040, nullptr, "CloseContext"}, {0x00040040, nullptr, "CancelConnection"}, diff --git a/src/core/hle/service/http_c.h b/src/core/hle/service/http_c.h index 82923b14b..34b0aa54f 100644 --- a/src/core/hle/service/http_c.h +++ b/src/core/hle/service/http_c.h @@ -4,6 +4,7 @@ #pragma once +#include "core/hle/kernel/shared_memory.h" #include "core/hle/service/service.h" namespace Service { @@ -12,6 +13,22 @@ namespace HTTP { class HTTP_C final : public ServiceFramework { public: HTTP_C(); + +private: + /** + * HTTP_C::Initialize service function + * Inputs: + * 1 : POST buffer size + * 2 : 0x20 + * 3 : 0x0 (Filled with process ID by ARM11 Kernel) + * 4 : 0x0 + * 5 : POST buffer memory block handle + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ + void Initialize(Kernel::HLERequestContext& ctx); + + Kernel::SharedPtr shared_memory = nullptr; }; void InstallInterfaces(SM::ServiceManager& service_manager);