Merge pull request #2992 from Subv/ac_srvframework
Services/AC: Converted the ac:i and ac:u services to the new service framework.
This commit is contained in:
commit
c14f802381
|
@ -2,11 +2,10 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/hle/ipc.h"
|
#include "core/hle/ipc.h"
|
||||||
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/kernel/event.h"
|
#include "core/hle/kernel/event.h"
|
||||||
#include "core/hle/kernel/handle_table.h"
|
#include "core/hle/kernel/handle_table.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
|
@ -17,169 +16,170 @@
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
namespace AC {
|
namespace AC {
|
||||||
|
void Module::Interface::CreateDefaultConfig(Kernel::HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp(ctx, 0x1, 0, 0);
|
||||||
|
|
||||||
struct ACConfig {
|
std::size_t desc_size;
|
||||||
std::array<u8, 0x200> data;
|
VAddr ac_config_addr = rp.PeekStaticBuffer(0, &desc_size);
|
||||||
};
|
|
||||||
|
|
||||||
static ACConfig default_config{};
|
ASSERT_MSG(desc_size >= sizeof(Module::ACConfig),
|
||||||
|
"Output buffer size can't fit ACConfig structure");
|
||||||
|
|
||||||
static bool ac_connected = false;
|
Memory::WriteBlock(ac_config_addr, &ac->default_config, sizeof(ACConfig));
|
||||||
|
|
||||||
static Kernel::SharedPtr<Kernel::Event> close_event;
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||||
static Kernel::SharedPtr<Kernel::Event> connect_event;
|
rb.Push(RESULT_SUCCESS);
|
||||||
static Kernel::SharedPtr<Kernel::Event> disconnect_event;
|
rb.PushStaticBuffer(ac_config_addr, sizeof(ACConfig), 0);
|
||||||
|
|
||||||
void CreateDefaultConfig(Interface* self) {
|
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
|
||||||
|
|
||||||
u32 ac_config_addr = cmd_buff[65];
|
|
||||||
|
|
||||||
ASSERT_MSG(cmd_buff[64] == (sizeof(ACConfig) << 14 | 2),
|
|
||||||
"Output buffer size not equal ACConfig size");
|
|
||||||
|
|
||||||
Memory::WriteBlock(ac_config_addr, &default_config, sizeof(ACConfig));
|
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
|
||||||
|
|
||||||
LOG_WARNING(Service_AC, "(STUBBED) called");
|
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectAsync(Interface* self) {
|
void Module::Interface::ConnectAsync(Kernel::HLERequestContext& ctx) {
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
IPC::RequestParser rp(ctx, 0x4, 0, 6);
|
||||||
|
|
||||||
connect_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]);
|
rp.Skip(2, false); // ProcessId descriptor
|
||||||
if (connect_event) {
|
ac->connect_event = rp.PopObject<Kernel::Event>();
|
||||||
connect_event->name = "AC:connect_event";
|
|
||||||
connect_event->Signal();
|
if (ac->connect_event) {
|
||||||
ac_connected = true;
|
ac->connect_event->name = "AC:connect_event";
|
||||||
|
ac->connect_event->Signal();
|
||||||
|
ac->ac_connected = true;
|
||||||
}
|
}
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
|
||||||
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
LOG_WARNING(Service_AC, "(STUBBED) called");
|
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetConnectResult(Interface* self) {
|
void Module::Interface::GetConnectResult(Kernel::HLERequestContext& ctx) {
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
IPC::RequestParser rp(ctx, 0x5, 0, 2);
|
||||||
|
rp.Skip(2, false); // ProcessId descriptor
|
||||||
|
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Module::Interface::CloseAsync(Kernel::HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp(ctx, 0x8, 0, 4);
|
||||||
|
rp.Skip(2, false); // ProcessId descriptor
|
||||||
|
|
||||||
|
ac->close_event = rp.PopObject<Kernel::Event>();
|
||||||
|
|
||||||
|
if (ac->ac_connected && ac->disconnect_event) {
|
||||||
|
ac->disconnect_event->Signal();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ac->close_event) {
|
||||||
|
ac->close_event->name = "AC:close_event";
|
||||||
|
ac->close_event->Signal();
|
||||||
|
}
|
||||||
|
|
||||||
|
ac->ac_connected = false;
|
||||||
|
|
||||||
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Module::Interface::GetCloseResult(Kernel::HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp(ctx, 0x9, 0, 2);
|
||||||
|
rp.Skip(2, false); // ProcessId descriptor
|
||||||
|
|
||||||
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
LOG_WARNING(Service_AC, "(STUBBED) called");
|
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloseAsync(Interface* self) {
|
void Module::Interface::GetWifiStatus(Kernel::HLERequestContext& ctx) {
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
IPC::RequestParser rp(ctx, 0xD, 0, 0);
|
||||||
|
|
||||||
if (ac_connected && disconnect_event) {
|
|
||||||
disconnect_event->Signal();
|
|
||||||
}
|
|
||||||
|
|
||||||
close_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]);
|
|
||||||
if (close_event) {
|
|
||||||
close_event->name = "AC:close_event";
|
|
||||||
close_event->Signal();
|
|
||||||
}
|
|
||||||
|
|
||||||
ac_connected = false;
|
|
||||||
|
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
|
||||||
LOG_WARNING(Service_AC, "(STUBBED) called");
|
|
||||||
}
|
|
||||||
|
|
||||||
void GetCloseResult(Interface* self) {
|
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
|
||||||
|
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
|
||||||
|
|
||||||
LOG_WARNING(Service_AC, "(STUBBED) called");
|
|
||||||
}
|
|
||||||
|
|
||||||
void GetWifiStatus(Interface* self) {
|
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
|
||||||
|
|
||||||
// TODO(purpasmart96): This function is only a stub,
|
// TODO(purpasmart96): This function is only a stub,
|
||||||
// it returns a valid result without implementing full functionality.
|
// it returns a valid result without implementing full functionality.
|
||||||
|
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
cmd_buff[2] = 0; // Connection type set to none
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
rb.Push<u32>(0); // Connection type set to none
|
||||||
|
|
||||||
LOG_WARNING(Service_AC, "(STUBBED) called");
|
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetInfraPriority(Interface* self) {
|
void Module::Interface::GetInfraPriority(Kernel::HLERequestContext& ctx) {
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
IPC::RequestParser rp(ctx, 0x27, 0, 2);
|
||||||
|
VAddr ac_config = rp.PopStaticBuffer();
|
||||||
|
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
cmd_buff[2] = 0; // Infra Priority, default 0
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
rb.Push<u32>(0); // Infra Priority, default 0
|
||||||
|
|
||||||
LOG_WARNING(Service_AC, "(STUBBED) called");
|
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetRequestEulaVersion(Interface* self) {
|
void Module::Interface::SetRequestEulaVersion(Kernel::HLERequestContext& ctx) {
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
IPC::RequestParser rp(ctx, 0x2D, 2, 2);
|
||||||
|
|
||||||
u32 major = cmd_buff[1] & 0xFF;
|
u32 major = rp.Pop<u8>();
|
||||||
u32 minor = cmd_buff[2] & 0xFF;
|
u32 minor = rp.Pop<u8>();
|
||||||
|
|
||||||
ASSERT_MSG(cmd_buff[3] == (sizeof(ACConfig) << 14 | 2),
|
VAddr ac_config = rp.PopStaticBuffer();
|
||||||
"Input buffer size not equal ACConfig size");
|
|
||||||
ASSERT_MSG(cmd_buff[64] == (sizeof(ACConfig) << 14 | 2),
|
|
||||||
"Output buffer size not equal ACConfig size");
|
|
||||||
|
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
// TODO(Subv): Copy over the input ACConfig to the stored ACConfig.
|
||||||
cmd_buff[2] = 0; // Infra Priority
|
|
||||||
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
rb.PushStaticBuffer(ac_config, sizeof(ACConfig), 0);
|
||||||
|
|
||||||
LOG_WARNING(Service_AC, "(STUBBED) called, major=%u, minor=%u", major, minor);
|
LOG_WARNING(Service_AC, "(STUBBED) called, major=%u, minor=%u", major, minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterDisconnectEvent(Interface* self) {
|
void Module::Interface::RegisterDisconnectEvent(Kernel::HLERequestContext& ctx) {
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
IPC::RequestParser rp(ctx, 0x30, 0, 4);
|
||||||
|
rp.Skip(2, false); // ProcessId descriptor
|
||||||
|
|
||||||
disconnect_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]);
|
ac->disconnect_event = rp.PopObject<Kernel::Event>();
|
||||||
if (disconnect_event) {
|
if (ac->disconnect_event) {
|
||||||
disconnect_event->name = "AC:disconnect_event";
|
ac->disconnect_event->name = "AC:disconnect_event";
|
||||||
}
|
}
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
|
||||||
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
LOG_WARNING(Service_AC, "(STUBBED) called");
|
LOG_WARNING(Service_AC, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void IsConnected(Interface* self) {
|
void Module::Interface::IsConnected(Kernel::HLERequestContext& ctx) {
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
IPC::RequestParser rp(ctx, 0x3E, 1, 2);
|
||||||
|
u32 unk = rp.Pop<u32>();
|
||||||
|
u32 unk_descriptor = rp.Pop<u32>();
|
||||||
|
u32 unk_param = rp.Pop<u32>();
|
||||||
|
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||||
cmd_buff[2] = ac_connected;
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
rb.Push(ac->ac_connected);
|
||||||
|
|
||||||
LOG_WARNING(Service_AC, "(STUBBED) called");
|
LOG_WARNING(Service_AC, "(STUBBED) called unk=%08X descriptor=%08X param=%08X", unk,
|
||||||
|
unk_descriptor, unk_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetClientVersion(Interface* self) {
|
void Module::Interface::SetClientVersion(Kernel::HLERequestContext& ctx) {
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
IPC::RequestParser rp(ctx, 0x40, 1, 2);
|
||||||
|
|
||||||
const u32 version = cmd_buff[1];
|
u32 version = rp.Pop<u32>();
|
||||||
self->SetVersion(version);
|
rp.Skip(2, false); // ProcessId descriptor
|
||||||
|
|
||||||
LOG_WARNING(Service_AC, "(STUBBED) called, version: 0x%08X", version);
|
LOG_WARNING(Service_AC, "(STUBBED) called, version: 0x%08X", version);
|
||||||
|
|
||||||
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init() {
|
Module::Interface::Interface(std::shared_ptr<Module> ac, const char* name, u32 max_session)
|
||||||
AddService(new AC_I);
|
: ac(std::move(ac)), ServiceFramework(name, max_session) {}
|
||||||
AddService(new AC_U);
|
|
||||||
|
|
||||||
ac_connected = false;
|
void InstallInterfaces(SM::ServiceManager& service_manager) {
|
||||||
|
auto ac = std::make_shared<Module>();
|
||||||
close_event = nullptr;
|
std::make_shared<AC_I>(ac)->InstallAsService(service_manager);
|
||||||
connect_event = nullptr;
|
std::make_shared<AC_U>(ac)->InstallAsService(service_manager);
|
||||||
disconnect_event = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Shutdown() {
|
|
||||||
ac_connected = false;
|
|
||||||
|
|
||||||
close_event = nullptr;
|
|
||||||
connect_event = nullptr;
|
|
||||||
disconnect_event = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace AC
|
} // namespace AC
|
||||||
|
|
|
@ -4,11 +4,22 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <memory>
|
||||||
|
#include "core/hle/kernel/kernel.h"
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
|
namespace Kernel {
|
||||||
|
class Event;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
|
|
||||||
class Interface;
|
|
||||||
|
|
||||||
namespace AC {
|
namespace AC {
|
||||||
|
class Module final {
|
||||||
|
public:
|
||||||
|
class Interface : public ServiceFramework<Interface> {
|
||||||
|
public:
|
||||||
|
Interface(std::shared_ptr<Module> ac, const char* name, u32 max_session);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AC::CreateDefaultConfig service function
|
* AC::CreateDefaultConfig service function
|
||||||
|
@ -18,7 +29,7 @@ namespace AC {
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void CreateDefaultConfig(Interface* self);
|
void CreateDefaultConfig(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AC::ConnectAsync service function
|
* AC::ConnectAsync service function
|
||||||
|
@ -31,7 +42,7 @@ void CreateDefaultConfig(Interface* self);
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void ConnectAsync(Interface* self);
|
void ConnectAsync(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AC::GetConnectResult service function
|
* AC::GetConnectResult service function
|
||||||
|
@ -40,7 +51,7 @@ void ConnectAsync(Interface* self);
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void GetConnectResult(Interface* self);
|
void GetConnectResult(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AC::CloseAsync service function
|
* AC::CloseAsync service function
|
||||||
|
@ -51,7 +62,7 @@ void GetConnectResult(Interface* self);
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void CloseAsync(Interface* self);
|
void CloseAsync(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AC::GetCloseResult service function
|
* AC::GetCloseResult service function
|
||||||
|
@ -60,7 +71,7 @@ void CloseAsync(Interface* self);
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void GetCloseResult(Interface* self);
|
void GetCloseResult(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AC::GetWifiStatus service function
|
* AC::GetWifiStatus service function
|
||||||
|
@ -68,7 +79,7 @@ void GetCloseResult(Interface* self);
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
* 2 : Output connection type, 0 = none, 1 = Old3DS Internet, 2 = New3DS Internet.
|
* 2 : Output connection type, 0 = none, 1 = Old3DS Internet, 2 = New3DS Internet.
|
||||||
*/
|
*/
|
||||||
void GetWifiStatus(Interface* self);
|
void GetWifiStatus(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AC::GetInfraPriority service function
|
* AC::GetInfraPriority service function
|
||||||
|
@ -79,7 +90,7 @@ void GetWifiStatus(Interface* self);
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
* 2 : Infra Priority
|
* 2 : Infra Priority
|
||||||
*/
|
*/
|
||||||
void GetInfraPriority(Interface* self);
|
void GetInfraPriority(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AC::SetRequestEulaVersion service function
|
* AC::SetRequestEulaVersion service function
|
||||||
|
@ -94,7 +105,7 @@ void GetInfraPriority(Interface* self);
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
* 2 : Infra Priority
|
* 2 : Infra Priority
|
||||||
*/
|
*/
|
||||||
void SetRequestEulaVersion(Interface* self);
|
void SetRequestEulaVersion(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AC::RegisterDisconnectEvent service function
|
* AC::RegisterDisconnectEvent service function
|
||||||
|
@ -105,7 +116,7 @@ void SetRequestEulaVersion(Interface* self);
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void RegisterDisconnectEvent(Interface* self);
|
void RegisterDisconnectEvent(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AC::IsConnected service function
|
* AC::IsConnected service function
|
||||||
|
@ -113,7 +124,7 @@ void RegisterDisconnectEvent(Interface* self);
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
* 2 : bool, is connected
|
* 2 : bool, is connected
|
||||||
*/
|
*/
|
||||||
void IsConnected(Interface* self);
|
void IsConnected(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AC::SetClientVersion service function
|
* AC::SetClientVersion service function
|
||||||
|
@ -122,13 +133,27 @@ void IsConnected(Interface* self);
|
||||||
* Outputs:
|
* Outputs:
|
||||||
* 1 : Result of function, 0 on success, otherwise error code
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
void SetClientVersion(Interface* self);
|
void SetClientVersion(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
/// Initialize AC service
|
protected:
|
||||||
void Init();
|
std::shared_ptr<Module> ac;
|
||||||
|
};
|
||||||
|
|
||||||
/// Shutdown AC service
|
protected:
|
||||||
void Shutdown();
|
struct ACConfig {
|
||||||
|
std::array<u8, 0x200> data;
|
||||||
|
};
|
||||||
|
|
||||||
|
ACConfig default_config{};
|
||||||
|
|
||||||
|
bool ac_connected = false;
|
||||||
|
|
||||||
|
Kernel::SharedPtr<Kernel::Event> close_event;
|
||||||
|
Kernel::SharedPtr<Kernel::Event> connect_event;
|
||||||
|
Kernel::SharedPtr<Kernel::Event> disconnect_event;
|
||||||
|
};
|
||||||
|
|
||||||
|
void InstallInterfaces(SM::ServiceManager& service_manager);
|
||||||
|
|
||||||
} // namespace AC
|
} // namespace AC
|
||||||
} // namespace Service
|
} // namespace Service
|
||||||
|
|
|
@ -2,37 +2,36 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "core/hle/service/ac/ac.h"
|
|
||||||
#include "core/hle/service/ac/ac_i.h"
|
#include "core/hle/service/ac/ac_i.h"
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
namespace AC {
|
namespace AC {
|
||||||
|
|
||||||
const Interface::FunctionInfo FunctionTable[] = {
|
// TODO(Subv): Find out the correct number of concurrent sessions allowed
|
||||||
{0x00010000, CreateDefaultConfig, "CreateDefaultConfig"},
|
AC_I::AC_I(std::shared_ptr<Module> ac) : Module::Interface(std::move(ac), "ac:i", 1) {
|
||||||
{0x00040006, ConnectAsync, "ConnectAsync"},
|
static const FunctionInfo functions[] = {
|
||||||
{0x00050002, GetConnectResult, "GetConnectResult"},
|
{0x00010000, &AC_I::CreateDefaultConfig, "CreateDefaultConfig"},
|
||||||
|
{0x00040006, &AC_I::ConnectAsync, "ConnectAsync"},
|
||||||
|
{0x00050002, &AC_I::GetConnectResult, "GetConnectResult"},
|
||||||
{0x00070002, nullptr, "CancelConnectAsync"},
|
{0x00070002, nullptr, "CancelConnectAsync"},
|
||||||
{0x00080004, CloseAsync, "CloseAsync"},
|
{0x00080004, &AC_I::CloseAsync, "CloseAsync"},
|
||||||
{0x00090002, GetCloseResult, "GetCloseResult"},
|
{0x00090002, &AC_I::GetCloseResult, "GetCloseResult"},
|
||||||
{0x000A0000, nullptr, "GetLastErrorCode"},
|
{0x000A0000, nullptr, "GetLastErrorCode"},
|
||||||
{0x000C0000, nullptr, "GetStatus"},
|
{0x000C0000, nullptr, "GetStatus"},
|
||||||
{0x000D0000, GetWifiStatus, "GetWifiStatus"},
|
{0x000D0000, &AC_I::GetWifiStatus, "GetWifiStatus"},
|
||||||
{0x000E0042, nullptr, "GetCurrentAPInfo"},
|
{0x000E0042, nullptr, "GetCurrentAPInfo"},
|
||||||
{0x00100042, nullptr, "GetCurrentNZoneInfo"},
|
{0x00100042, nullptr, "GetCurrentNZoneInfo"},
|
||||||
{0x00110042, nullptr, "GetNZoneApNumService"},
|
{0x00110042, nullptr, "GetNZoneApNumService"},
|
||||||
{0x001D0042, nullptr, "ScanAPs"},
|
{0x001D0042, nullptr, "ScanAPs"},
|
||||||
{0x00240042, nullptr, "AddDenyApType"},
|
{0x00240042, nullptr, "AddDenyApType"},
|
||||||
{0x00270002, GetInfraPriority, "GetInfraPriority"},
|
{0x00270002, &AC_I::GetInfraPriority, "GetInfraPriority"},
|
||||||
{0x002D0082, SetRequestEulaVersion, "SetRequestEulaVersion"},
|
{0x002D0082, &AC_I::SetRequestEulaVersion, "SetRequestEulaVersion"},
|
||||||
{0x00300004, RegisterDisconnectEvent, "RegisterDisconnectEvent"},
|
{0x00300004, &AC_I::RegisterDisconnectEvent, "RegisterDisconnectEvent"},
|
||||||
{0x003C0042, nullptr, "GetAPSSIDList"},
|
{0x003C0042, nullptr, "GetAPSSIDList"},
|
||||||
{0x003E0042, IsConnected, "IsConnected"},
|
{0x003E0042, &AC_I::IsConnected, "IsConnected"},
|
||||||
{0x00400042, SetClientVersion, "SetClientVersion"},
|
{0x00400042, &AC_I::SetClientVersion, "SetClientVersion"},
|
||||||
};
|
};
|
||||||
|
RegisterHandlers(functions);
|
||||||
AC_I::AC_I() {
|
|
||||||
Register(FunctionTable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace AC
|
} // namespace AC
|
||||||
|
|
|
@ -4,18 +4,15 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "core/hle/service/service.h"
|
#include <memory>
|
||||||
|
#include "core/hle/service/ac/ac.h"
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
namespace AC {
|
namespace AC {
|
||||||
|
|
||||||
class AC_I final : public Interface {
|
class AC_I final : public Module::Interface {
|
||||||
public:
|
public:
|
||||||
AC_I();
|
explicit AC_I(std::shared_ptr<Module> ac);
|
||||||
|
|
||||||
std::string GetPortName() const override {
|
|
||||||
return "ac:i";
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace AC
|
} // namespace AC
|
||||||
|
|
|
@ -2,37 +2,36 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "core/hle/service/ac/ac.h"
|
|
||||||
#include "core/hle/service/ac/ac_u.h"
|
#include "core/hle/service/ac/ac_u.h"
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
namespace AC {
|
namespace AC {
|
||||||
|
|
||||||
const Interface::FunctionInfo FunctionTable[] = {
|
// TODO(Subv): Find out the correct number of concurrent sessions allowed
|
||||||
{0x00010000, CreateDefaultConfig, "CreateDefaultConfig"},
|
AC_U::AC_U(std::shared_ptr<Module> ac) : Module::Interface(std::move(ac), "ac:u", 1) {
|
||||||
{0x00040006, ConnectAsync, "ConnectAsync"},
|
static const FunctionInfo functions[] = {
|
||||||
{0x00050002, GetConnectResult, "GetConnectResult"},
|
{0x00010000, &AC_U::CreateDefaultConfig, "CreateDefaultConfig"},
|
||||||
|
{0x00040006, &AC_U::ConnectAsync, "ConnectAsync"},
|
||||||
|
{0x00050002, &AC_U::GetConnectResult, "GetConnectResult"},
|
||||||
{0x00070002, nullptr, "CancelConnectAsync"},
|
{0x00070002, nullptr, "CancelConnectAsync"},
|
||||||
{0x00080004, CloseAsync, "CloseAsync"},
|
{0x00080004, &AC_U::CloseAsync, "CloseAsync"},
|
||||||
{0x00090002, GetCloseResult, "GetCloseResult"},
|
{0x00090002, &AC_U::GetCloseResult, "GetCloseResult"},
|
||||||
{0x000A0000, nullptr, "GetLastErrorCode"},
|
{0x000A0000, nullptr, "GetLastErrorCode"},
|
||||||
{0x000C0000, nullptr, "GetStatus"},
|
{0x000C0000, nullptr, "GetStatus"},
|
||||||
{0x000D0000, GetWifiStatus, "GetWifiStatus"},
|
{0x000D0000, &AC_U::GetWifiStatus, "GetWifiStatus"},
|
||||||
{0x000E0042, nullptr, "GetCurrentAPInfo"},
|
{0x000E0042, nullptr, "GetCurrentAPInfo"},
|
||||||
{0x00100042, nullptr, "GetCurrentNZoneInfo"},
|
{0x00100042, nullptr, "GetCurrentNZoneInfo"},
|
||||||
{0x00110042, nullptr, "GetNZoneApNumService"},
|
{0x00110042, nullptr, "GetNZoneApNumService"},
|
||||||
{0x001D0042, nullptr, "ScanAPs"},
|
{0x001D0042, nullptr, "ScanAPs"},
|
||||||
{0x00240042, nullptr, "AddDenyApType"},
|
{0x00240042, nullptr, "AddDenyApType"},
|
||||||
{0x00270002, GetInfraPriority, "GetInfraPriority"},
|
{0x00270002, &AC_U::GetInfraPriority, "GetInfraPriority"},
|
||||||
{0x002D0082, SetRequestEulaVersion, "SetRequestEulaVersion"},
|
{0x002D0082, &AC_U::SetRequestEulaVersion, "SetRequestEulaVersion"},
|
||||||
{0x00300004, RegisterDisconnectEvent, "RegisterDisconnectEvent"},
|
{0x00300004, &AC_U::RegisterDisconnectEvent, "RegisterDisconnectEvent"},
|
||||||
{0x003C0042, nullptr, "GetAPSSIDList"},
|
{0x003C0042, nullptr, "GetAPSSIDList"},
|
||||||
{0x003E0042, IsConnected, "IsConnected"},
|
{0x003E0042, &AC_U::IsConnected, "IsConnected"},
|
||||||
{0x00400042, SetClientVersion, "SetClientVersion"},
|
{0x00400042, &AC_U::SetClientVersion, "SetClientVersion"},
|
||||||
};
|
};
|
||||||
|
RegisterHandlers(functions);
|
||||||
AC_U::AC_U() {
|
|
||||||
Register(FunctionTable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace AC
|
} // namespace AC
|
||||||
|
|
|
@ -4,18 +4,15 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "core/hle/service/service.h"
|
#include <memory>
|
||||||
|
#include "core/hle/service/ac/ac.h"
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
namespace AC {
|
namespace AC {
|
||||||
|
|
||||||
class AC_U final : public Interface {
|
class AC_U final : public Module::Interface {
|
||||||
public:
|
public:
|
||||||
AC_U();
|
explicit AC_U(std::shared_ptr<Module> ac);
|
||||||
|
|
||||||
std::string GetPortName() const override {
|
|
||||||
return "ac:u";
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace AC
|
} // namespace AC
|
||||||
|
|
|
@ -216,11 +216,11 @@ void Init() {
|
||||||
SM::ServiceManager::InstallInterfaces(SM::g_service_manager);
|
SM::ServiceManager::InstallInterfaces(SM::g_service_manager);
|
||||||
|
|
||||||
NS::InstallInterfaces(*SM::g_service_manager);
|
NS::InstallInterfaces(*SM::g_service_manager);
|
||||||
|
AC::InstallInterfaces(*SM::g_service_manager);
|
||||||
|
|
||||||
AddNamedPort(new ERR::ERR_F);
|
AddNamedPort(new ERR::ERR_F);
|
||||||
|
|
||||||
FS::ArchiveInit();
|
FS::ArchiveInit();
|
||||||
AC::Init();
|
|
||||||
ACT::Init();
|
ACT::Init();
|
||||||
AM::Init();
|
AM::Init();
|
||||||
APT::Init();
|
APT::Init();
|
||||||
|
@ -273,7 +273,6 @@ void Shutdown() {
|
||||||
BOSS::Shutdown();
|
BOSS::Shutdown();
|
||||||
APT::Shutdown();
|
APT::Shutdown();
|
||||||
AM::Shutdown();
|
AM::Shutdown();
|
||||||
AC::Shutdown();
|
|
||||||
FS::ArchiveShutdown();
|
FS::ArchiveShutdown();
|
||||||
|
|
||||||
SM::g_service_manager = nullptr;
|
SM::g_service_manager = nullptr;
|
||||||
|
|
Reference in New Issue