diff options
| author | 2017-01-12 10:12:46 -0500 | |
|---|---|---|
| committer | 2017-01-12 10:12:46 -0500 | |
| commit | 597a7c615c9ca3ed8e2fdb49b75111badf537af5 (patch) | |
| tree | b589785fde61e62f94f0eac439174094d59c6133 /src | |
| parent | Merge pull request #2397 from Subv/pulse (diff) | |
| parent | Service/AC: add ac:i service (diff) | |
| download | yuzu-597a7c615c9ca3ed8e2fdb49b75111badf537af5.tar.gz yuzu-597a7c615c9ca3ed8e2fdb49b75111badf537af5.tar.xz yuzu-597a7c615c9ca3ed8e2fdb49b75111badf537af5.zip | |
Merge pull request #2308 from mailwl/ac-i
Service/AC: add ac:i service
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | src/core/hle/service/ac/ac.cpp | 181 | ||||
| -rw-r--r-- | src/core/hle/service/ac/ac.h | 134 | ||||
| -rw-r--r-- | src/core/hle/service/ac/ac_i.cpp | 39 | ||||
| -rw-r--r-- | src/core/hle/service/ac/ac_i.h | 22 | ||||
| -rw-r--r-- | src/core/hle/service/ac/ac_u.cpp | 39 | ||||
| -rw-r--r-- | src/core/hle/service/ac/ac_u.h (renamed from src/core/hle/service/ac_u.h) | 1 | ||||
| -rw-r--r-- | src/core/hle/service/ac_u.cpp | 291 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 6 |
9 files changed, 424 insertions, 297 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 4c5b633e0..faad0a561 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -54,7 +54,9 @@ set(SRCS | |||
| 54 | hle/kernel/thread.cpp | 54 | hle/kernel/thread.cpp |
| 55 | hle/kernel/timer.cpp | 55 | hle/kernel/timer.cpp |
| 56 | hle/kernel/vm_manager.cpp | 56 | hle/kernel/vm_manager.cpp |
| 57 | hle/service/ac_u.cpp | 57 | hle/service/ac/ac.cpp |
| 58 | hle/service/ac/ac_i.cpp | ||
| 59 | hle/service/ac/ac_u.cpp | ||
| 58 | hle/service/act/act.cpp | 60 | hle/service/act/act.cpp |
| 59 | hle/service/act/act_a.cpp | 61 | hle/service/act/act_a.cpp |
| 60 | hle/service/act/act_u.cpp | 62 | hle/service/act/act_u.cpp |
| @@ -229,7 +231,9 @@ set(HEADERS | |||
| 229 | hle/kernel/timer.h | 231 | hle/kernel/timer.h |
| 230 | hle/kernel/vm_manager.h | 232 | hle/kernel/vm_manager.h |
| 231 | hle/result.h | 233 | hle/result.h |
| 232 | hle/service/ac_u.h | 234 | hle/service/ac/ac.h |
| 235 | hle/service/ac/ac_i.h | ||
| 236 | hle/service/ac/ac_u.h | ||
| 233 | hle/service/act/act.h | 237 | hle/service/act/act.h |
| 234 | hle/service/act/act_a.h | 238 | hle/service/act/act_a.h |
| 235 | hle/service/act/act_u.h | 239 | hle/service/act/act_u.h |
diff --git a/src/core/hle/service/ac/ac.cpp b/src/core/hle/service/ac/ac.cpp new file mode 100644 index 000000000..aa270a2c3 --- /dev/null +++ b/src/core/hle/service/ac/ac.cpp | |||
| @@ -0,0 +1,181 @@ | |||
| 1 | // Copyright 2016 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <array> | ||
| 6 | |||
| 7 | #include "common/logging/log.h" | ||
| 8 | #include "core/hle/kernel/event.h" | ||
| 9 | #include "core/hle/service/ac/ac.h" | ||
| 10 | #include "core/hle/service/ac/ac_i.h" | ||
| 11 | #include "core/hle/service/ac/ac_u.h" | ||
| 12 | |||
| 13 | namespace Service { | ||
| 14 | namespace AC { | ||
| 15 | |||
| 16 | struct ACConfig { | ||
| 17 | std::array<u8, 0x200> data; | ||
| 18 | }; | ||
| 19 | |||
| 20 | static ACConfig default_config{}; | ||
| 21 | |||
| 22 | static bool ac_connected = false; | ||
| 23 | |||
| 24 | static Kernel::SharedPtr<Kernel::Event> close_event; | ||
| 25 | static Kernel::SharedPtr<Kernel::Event> connect_event; | ||
| 26 | static Kernel::SharedPtr<Kernel::Event> disconnect_event; | ||
| 27 | |||
| 28 | void CreateDefaultConfig(Interface* self) { | ||
| 29 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 30 | |||
| 31 | u32 ac_config_addr = cmd_buff[65]; | ||
| 32 | |||
| 33 | ASSERT_MSG(cmd_buff[64] == (sizeof(ACConfig) << 14 | 2), | ||
| 34 | "Output buffer size not equal ACConfig size"); | ||
| 35 | |||
| 36 | Memory::WriteBlock(ac_config_addr, &default_config, sizeof(ACConfig)); | ||
| 37 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 38 | |||
| 39 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 40 | } | ||
| 41 | |||
| 42 | void ConnectAsync(Interface* self) { | ||
| 43 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 44 | |||
| 45 | connect_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]); | ||
| 46 | if (connect_event) { | ||
| 47 | connect_event->name = "AC:connect_event"; | ||
| 48 | connect_event->Signal(); | ||
| 49 | ac_connected = true; | ||
| 50 | } | ||
| 51 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 52 | |||
| 53 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 54 | } | ||
| 55 | |||
| 56 | void GetConnectResult(Interface* self) { | ||
| 57 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 58 | |||
| 59 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 60 | |||
| 61 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 62 | } | ||
| 63 | |||
| 64 | void CloseAsync(Interface* self) { | ||
| 65 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 66 | |||
| 67 | if (ac_connected && disconnect_event) { | ||
| 68 | disconnect_event->Signal(); | ||
| 69 | } | ||
| 70 | |||
| 71 | close_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]); | ||
| 72 | if (close_event) { | ||
| 73 | close_event->name = "AC:close_event"; | ||
| 74 | close_event->Signal(); | ||
| 75 | } | ||
| 76 | |||
| 77 | ac_connected = false; | ||
| 78 | |||
| 79 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 80 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 81 | } | ||
| 82 | |||
| 83 | void GetCloseResult(Interface* self) { | ||
| 84 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 85 | |||
| 86 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 87 | |||
| 88 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 89 | } | ||
| 90 | |||
| 91 | void GetWifiStatus(Interface* self) { | ||
| 92 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 93 | |||
| 94 | // TODO(purpasmart96): This function is only a stub, | ||
| 95 | // it returns a valid result without implementing full functionality. | ||
| 96 | |||
| 97 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 98 | cmd_buff[2] = 0; // Connection type set to none | ||
| 99 | |||
| 100 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 101 | } | ||
| 102 | |||
| 103 | void GetInfraPriority(Interface* self) { | ||
| 104 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 105 | |||
| 106 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 107 | cmd_buff[2] = 0; // Infra Priority, default 0 | ||
| 108 | |||
| 109 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 110 | } | ||
| 111 | |||
| 112 | void SetRequestEulaVersion(Interface* self) { | ||
| 113 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 114 | |||
| 115 | u32 major = cmd_buff[1] & 0xFF; | ||
| 116 | u32 minor = cmd_buff[2] & 0xFF; | ||
| 117 | |||
| 118 | ASSERT_MSG(cmd_buff[3] == (sizeof(ACConfig) << 14 | 2), | ||
| 119 | "Input buffer size not equal ACConfig size"); | ||
| 120 | ASSERT_MSG(cmd_buff[64] == (sizeof(ACConfig) << 14 | 2), | ||
| 121 | "Output buffer size not equal ACConfig size"); | ||
| 122 | |||
| 123 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 124 | cmd_buff[2] = 0; // Infra Priority | ||
| 125 | |||
| 126 | LOG_WARNING(Service_AC, "(STUBBED) called, major=%u, minor=%u", major, minor); | ||
| 127 | } | ||
| 128 | |||
| 129 | void RegisterDisconnectEvent(Interface* self) { | ||
| 130 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 131 | |||
| 132 | disconnect_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]); | ||
| 133 | if (disconnect_event) { | ||
| 134 | disconnect_event->name = "AC:disconnect_event"; | ||
| 135 | } | ||
| 136 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 137 | |||
| 138 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 139 | } | ||
| 140 | |||
| 141 | void IsConnected(Interface* self) { | ||
| 142 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 143 | |||
| 144 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 145 | cmd_buff[2] = ac_connected; | ||
| 146 | |||
| 147 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 148 | } | ||
| 149 | |||
| 150 | void SetClientVersion(Interface* self) { | ||
| 151 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 152 | |||
| 153 | const u32 version = cmd_buff[1]; | ||
| 154 | self->SetVersion(version); | ||
| 155 | |||
| 156 | LOG_WARNING(Service_AC, "(STUBBED) called, version: 0x%08X", version); | ||
| 157 | |||
| 158 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 159 | } | ||
| 160 | |||
| 161 | void Init() { | ||
| 162 | AddService(new AC_I); | ||
| 163 | AddService(new AC_U); | ||
| 164 | |||
| 165 | ac_connected = false; | ||
| 166 | |||
| 167 | close_event = nullptr; | ||
| 168 | connect_event = nullptr; | ||
| 169 | disconnect_event = nullptr; | ||
| 170 | } | ||
| 171 | |||
| 172 | void Shutdown() { | ||
| 173 | ac_connected = false; | ||
| 174 | |||
| 175 | close_event = nullptr; | ||
| 176 | connect_event = nullptr; | ||
| 177 | disconnect_event = nullptr; | ||
| 178 | } | ||
| 179 | |||
| 180 | } // namespace AC | ||
| 181 | } // namespace Service | ||
diff --git a/src/core/hle/service/ac/ac.h b/src/core/hle/service/ac/ac.h new file mode 100644 index 000000000..6185faf9b --- /dev/null +++ b/src/core/hle/service/ac/ac.h | |||
| @@ -0,0 +1,134 @@ | |||
| 1 | // Copyright 2016 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | namespace Service { | ||
| 8 | |||
| 9 | class Interface; | ||
| 10 | |||
| 11 | namespace AC { | ||
| 12 | |||
| 13 | /** | ||
| 14 | * AC::CreateDefaultConfig service function | ||
| 15 | * Inputs: | ||
| 16 | * 64 : ACConfig size << 14 | 2 | ||
| 17 | * 65 : pointer to ACConfig struct | ||
| 18 | * Outputs: | ||
| 19 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 20 | */ | ||
| 21 | void CreateDefaultConfig(Interface* self); | ||
| 22 | |||
| 23 | /** | ||
| 24 | * AC::ConnectAsync service function | ||
| 25 | * Inputs: | ||
| 26 | * 1 : ProcessId Header | ||
| 27 | * 3 : Copy Handle Header | ||
| 28 | * 4 : Connection Event handle | ||
| 29 | * 5 : ACConfig size << 14 | 2 | ||
| 30 | * 6 : pointer to ACConfig struct | ||
| 31 | * Outputs: | ||
| 32 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 33 | */ | ||
| 34 | void ConnectAsync(Interface* self); | ||
| 35 | |||
| 36 | /** | ||
| 37 | * AC::GetConnectResult service function | ||
| 38 | * Inputs: | ||
| 39 | * 1 : ProcessId Header | ||
| 40 | * Outputs: | ||
| 41 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 42 | */ | ||
| 43 | void GetConnectResult(Interface* self); | ||
| 44 | |||
| 45 | /** | ||
| 46 | * AC::CloseAsync service function | ||
| 47 | * Inputs: | ||
| 48 | * 1 : ProcessId Header | ||
| 49 | * 3 : Copy Handle Header | ||
| 50 | * 4 : Event handle, should be signaled when AC connection is closed | ||
| 51 | * Outputs: | ||
| 52 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 53 | */ | ||
| 54 | void CloseAsync(Interface* self); | ||
| 55 | |||
| 56 | /** | ||
| 57 | * AC::GetCloseResult service function | ||
| 58 | * Inputs: | ||
| 59 | * 1 : ProcessId Header | ||
| 60 | * Outputs: | ||
| 61 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 62 | */ | ||
| 63 | void GetCloseResult(Interface* self); | ||
| 64 | |||
| 65 | /** | ||
| 66 | * AC::GetWifiStatus service function | ||
| 67 | * Outputs: | ||
| 68 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 69 | * 2 : Output connection type, 0 = none, 1 = Old3DS Internet, 2 = New3DS Internet. | ||
| 70 | */ | ||
| 71 | void GetWifiStatus(Interface* self); | ||
| 72 | |||
| 73 | /** | ||
| 74 | * AC::GetInfraPriority service function | ||
| 75 | * Inputs: | ||
| 76 | * 1 : ACConfig size << 14 | 2 | ||
| 77 | * 2 : pointer to ACConfig struct | ||
| 78 | * Outputs: | ||
| 79 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 80 | * 2 : Infra Priority | ||
| 81 | */ | ||
| 82 | void GetInfraPriority(Interface* self); | ||
| 83 | |||
| 84 | /** | ||
| 85 | * AC::SetRequestEulaVersion service function | ||
| 86 | * Inputs: | ||
| 87 | * 1 : Eula Version major | ||
| 88 | * 2 : Eula Version minor | ||
| 89 | * 3 : ACConfig size << 14 | 2 | ||
| 90 | * 4 : Input pointer to ACConfig struct | ||
| 91 | * 64 : ACConfig size << 14 | 2 | ||
| 92 | * 65 : Output pointer to ACConfig struct | ||
| 93 | * Outputs: | ||
| 94 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 95 | * 2 : Infra Priority | ||
| 96 | */ | ||
| 97 | void SetRequestEulaVersion(Interface* self); | ||
| 98 | |||
| 99 | /** | ||
| 100 | * AC::RegisterDisconnectEvent service function | ||
| 101 | * Inputs: | ||
| 102 | * 1 : ProcessId Header | ||
| 103 | * 3 : Copy Handle Header | ||
| 104 | * 4 : Event handle, should be signaled when AC connection is closed | ||
| 105 | * Outputs: | ||
| 106 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 107 | */ | ||
| 108 | void RegisterDisconnectEvent(Interface* self); | ||
| 109 | |||
| 110 | /** | ||
| 111 | * AC::IsConnected service function | ||
| 112 | * Outputs: | ||
| 113 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 114 | * 2 : bool, is connected | ||
| 115 | */ | ||
| 116 | void IsConnected(Interface* self); | ||
| 117 | |||
| 118 | /** | ||
| 119 | * AC::SetClientVersion service function | ||
| 120 | * Inputs: | ||
| 121 | * 1 : Used SDK Version | ||
| 122 | * Outputs: | ||
| 123 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 124 | */ | ||
| 125 | void SetClientVersion(Interface* self); | ||
| 126 | |||
| 127 | /// Initialize AC service | ||
| 128 | void Init(); | ||
| 129 | |||
| 130 | /// Shutdown AC service | ||
| 131 | void Shutdown(); | ||
| 132 | |||
| 133 | } // namespace AC | ||
| 134 | } // namespace Service | ||
diff --git a/src/core/hle/service/ac/ac_i.cpp b/src/core/hle/service/ac/ac_i.cpp new file mode 100644 index 000000000..b22fe3698 --- /dev/null +++ b/src/core/hle/service/ac/ac_i.cpp | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | // Copyright 2016 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "core/hle/service/ac/ac.h" | ||
| 6 | #include "core/hle/service/ac/ac_i.h" | ||
| 7 | |||
| 8 | namespace Service { | ||
| 9 | namespace AC { | ||
| 10 | |||
| 11 | const Interface::FunctionInfo FunctionTable[] = { | ||
| 12 | {0x00010000, CreateDefaultConfig, "CreateDefaultConfig"}, | ||
| 13 | {0x00040006, ConnectAsync, "ConnectAsync"}, | ||
| 14 | {0x00050002, GetConnectResult, "GetConnectResult"}, | ||
| 15 | {0x00070002, nullptr, "CancelConnectAsync"}, | ||
| 16 | {0x00080004, CloseAsync, "CloseAsync"}, | ||
| 17 | {0x00090002, GetCloseResult, "GetCloseResult"}, | ||
| 18 | {0x000A0000, nullptr, "GetLastErrorCode"}, | ||
| 19 | {0x000C0000, nullptr, "GetStatus"}, | ||
| 20 | {0x000D0000, GetWifiStatus, "GetWifiStatus"}, | ||
| 21 | {0x000E0042, nullptr, "GetCurrentAPInfo"}, | ||
| 22 | {0x00100042, nullptr, "GetCurrentNZoneInfo"}, | ||
| 23 | {0x00110042, nullptr, "GetNZoneApNumService"}, | ||
| 24 | {0x001D0042, nullptr, "ScanAPs"}, | ||
| 25 | {0x00240042, nullptr, "AddDenyApType"}, | ||
| 26 | {0x00270002, GetInfraPriority, "GetInfraPriority"}, | ||
| 27 | {0x002D0082, SetRequestEulaVersion, "SetRequestEulaVersion"}, | ||
| 28 | {0x00300004, RegisterDisconnectEvent, "RegisterDisconnectEvent"}, | ||
| 29 | {0x003C0042, nullptr, "GetAPSSIDList"}, | ||
| 30 | {0x003E0042, IsConnected, "IsConnected"}, | ||
| 31 | {0x00400042, SetClientVersion, "SetClientVersion"}, | ||
| 32 | }; | ||
| 33 | |||
| 34 | AC_I::AC_I() { | ||
| 35 | Register(FunctionTable); | ||
| 36 | } | ||
| 37 | |||
| 38 | } // namespace AC | ||
| 39 | } // namespace Service | ||
diff --git a/src/core/hle/service/ac/ac_i.h b/src/core/hle/service/ac/ac_i.h new file mode 100644 index 000000000..465bba59c --- /dev/null +++ b/src/core/hle/service/ac/ac_i.h | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | // Copyright 2016 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "core/hle/service/service.h" | ||
| 8 | |||
| 9 | namespace Service { | ||
| 10 | namespace AC { | ||
| 11 | |||
| 12 | class AC_I final : public Interface { | ||
| 13 | public: | ||
| 14 | AC_I(); | ||
| 15 | |||
| 16 | std::string GetPortName() const override { | ||
| 17 | return "ac:i"; | ||
| 18 | } | ||
| 19 | }; | ||
| 20 | |||
| 21 | } // namespace AC | ||
| 22 | } // namespace Service | ||
diff --git a/src/core/hle/service/ac/ac_u.cpp b/src/core/hle/service/ac/ac_u.cpp new file mode 100644 index 000000000..346671b4a --- /dev/null +++ b/src/core/hle/service/ac/ac_u.cpp | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "core/hle/service/ac/ac.h" | ||
| 6 | #include "core/hle/service/ac/ac_u.h" | ||
| 7 | |||
| 8 | namespace Service { | ||
| 9 | namespace AC { | ||
| 10 | |||
| 11 | const Interface::FunctionInfo FunctionTable[] = { | ||
| 12 | {0x00010000, CreateDefaultConfig, "CreateDefaultConfig"}, | ||
| 13 | {0x00040006, ConnectAsync, "ConnectAsync"}, | ||
| 14 | {0x00050002, GetConnectResult, "GetConnectResult"}, | ||
| 15 | {0x00070002, nullptr, "CancelConnectAsync"}, | ||
| 16 | {0x00080004, CloseAsync, "CloseAsync"}, | ||
| 17 | {0x00090002, GetCloseResult, "GetCloseResult"}, | ||
| 18 | {0x000A0000, nullptr, "GetLastErrorCode"}, | ||
| 19 | {0x000C0000, nullptr, "GetStatus"}, | ||
| 20 | {0x000D0000, GetWifiStatus, "GetWifiStatus"}, | ||
| 21 | {0x000E0042, nullptr, "GetCurrentAPInfo"}, | ||
| 22 | {0x00100042, nullptr, "GetCurrentNZoneInfo"}, | ||
| 23 | {0x00110042, nullptr, "GetNZoneApNumService"}, | ||
| 24 | {0x001D0042, nullptr, "ScanAPs"}, | ||
| 25 | {0x00240042, nullptr, "AddDenyApType"}, | ||
| 26 | {0x00270002, GetInfraPriority, "GetInfraPriority"}, | ||
| 27 | {0x002D0082, SetRequestEulaVersion, "SetRequestEulaVersion"}, | ||
| 28 | {0x00300004, RegisterDisconnectEvent, "RegisterDisconnectEvent"}, | ||
| 29 | {0x003C0042, nullptr, "GetAPSSIDList"}, | ||
| 30 | {0x003E0042, IsConnected, "IsConnected"}, | ||
| 31 | {0x00400042, SetClientVersion, "SetClientVersion"}, | ||
| 32 | }; | ||
| 33 | |||
| 34 | AC_U::AC_U() { | ||
| 35 | Register(FunctionTable); | ||
| 36 | } | ||
| 37 | |||
| 38 | } // namespace AC | ||
| 39 | } // namespace Service | ||
diff --git a/src/core/hle/service/ac_u.h b/src/core/hle/service/ac/ac_u.h index 573c32d7e..f9d21e112 100644 --- a/src/core/hle/service/ac_u.h +++ b/src/core/hle/service/ac/ac_u.h | |||
| @@ -12,7 +12,6 @@ namespace AC { | |||
| 12 | class AC_U final : public Interface { | 12 | class AC_U final : public Interface { |
| 13 | public: | 13 | public: |
| 14 | AC_U(); | 14 | AC_U(); |
| 15 | ~AC_U(); | ||
| 16 | 15 | ||
| 17 | std::string GetPortName() const override { | 16 | std::string GetPortName() const override { |
| 18 | return "ac:u"; | 17 | return "ac:u"; |
diff --git a/src/core/hle/service/ac_u.cpp b/src/core/hle/service/ac_u.cpp deleted file mode 100644 index 36204db4d..000000000 --- a/src/core/hle/service/ac_u.cpp +++ /dev/null | |||
| @@ -1,291 +0,0 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <array> | ||
| 6 | |||
| 7 | #include "common/logging/log.h" | ||
| 8 | #include "core/hle/kernel/event.h" | ||
| 9 | #include "core/hle/service/ac_u.h" | ||
| 10 | |||
| 11 | namespace Service { | ||
| 12 | namespace AC { | ||
| 13 | |||
| 14 | struct ACConfig { | ||
| 15 | std::array<u8, 0x200> data; | ||
| 16 | }; | ||
| 17 | |||
| 18 | static ACConfig default_config{}; | ||
| 19 | |||
| 20 | static bool ac_connected = false; | ||
| 21 | |||
| 22 | static Kernel::SharedPtr<Kernel::Event> close_event; | ||
| 23 | static Kernel::SharedPtr<Kernel::Event> connect_event; | ||
| 24 | static Kernel::SharedPtr<Kernel::Event> disconnect_event; | ||
| 25 | |||
| 26 | /** | ||
| 27 | * AC_U::CreateDefaultConfig service function | ||
| 28 | * Inputs: | ||
| 29 | * 64 : ACConfig size << 14 | 2 | ||
| 30 | * 65 : pointer to ACConfig struct | ||
| 31 | * Outputs: | ||
| 32 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 33 | */ | ||
| 34 | static void CreateDefaultConfig(Interface* self) { | ||
| 35 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 36 | |||
| 37 | u32 ac_config_addr = cmd_buff[65]; | ||
| 38 | |||
| 39 | ASSERT_MSG(cmd_buff[64] == (sizeof(ACConfig) << 14 | 2), | ||
| 40 | "Output buffer size not equal ACConfig size"); | ||
| 41 | |||
| 42 | Memory::WriteBlock(ac_config_addr, &default_config, sizeof(ACConfig)); | ||
| 43 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 44 | |||
| 45 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 46 | } | ||
| 47 | |||
| 48 | /** | ||
| 49 | * AC_U::ConnectAsync service function | ||
| 50 | * Inputs: | ||
| 51 | * 1 : ProcessId Header | ||
| 52 | * 3 : Copy Handle Header | ||
| 53 | * 4 : Connection Event handle | ||
| 54 | * 5 : ACConfig size << 14 | 2 | ||
| 55 | * 6 : pointer to ACConfig struct | ||
| 56 | * Outputs: | ||
| 57 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 58 | */ | ||
| 59 | static void ConnectAsync(Interface* self) { | ||
| 60 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 61 | |||
| 62 | connect_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]); | ||
| 63 | if (connect_event) { | ||
| 64 | connect_event->name = "AC_U:connect_event"; | ||
| 65 | connect_event->Signal(); | ||
| 66 | ac_connected = true; | ||
| 67 | } | ||
| 68 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 69 | |||
| 70 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 71 | } | ||
| 72 | |||
| 73 | /** | ||
| 74 | * AC_U::GetConnectResult service function | ||
| 75 | * Inputs: | ||
| 76 | * 1 : ProcessId Header | ||
| 77 | * Outputs: | ||
| 78 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 79 | */ | ||
| 80 | static void GetConnectResult(Interface* self) { | ||
| 81 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 82 | |||
| 83 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 84 | |||
| 85 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 86 | } | ||
| 87 | |||
| 88 | /** | ||
| 89 | * AC_U::CloseAsync service function | ||
| 90 | * Inputs: | ||
| 91 | * 1 : ProcessId Header | ||
| 92 | * 3 : Copy Handle Header | ||
| 93 | * 4 : Event handle, should be signaled when AC connection is closed | ||
| 94 | * Outputs: | ||
| 95 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 96 | */ | ||
| 97 | static void CloseAsync(Interface* self) { | ||
| 98 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 99 | |||
| 100 | if (ac_connected && disconnect_event) { | ||
| 101 | disconnect_event->Signal(); | ||
| 102 | } | ||
| 103 | |||
| 104 | close_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]); | ||
| 105 | if (close_event) { | ||
| 106 | close_event->name = "AC_U:close_event"; | ||
| 107 | close_event->Signal(); | ||
| 108 | } | ||
| 109 | |||
| 110 | ac_connected = false; | ||
| 111 | |||
| 112 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 113 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 114 | } | ||
| 115 | |||
| 116 | /** | ||
| 117 | * AC_U::GetCloseResult service function | ||
| 118 | * Inputs: | ||
| 119 | * 1 : ProcessId Header | ||
| 120 | * Outputs: | ||
| 121 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 122 | */ | ||
| 123 | static void GetCloseResult(Interface* self) { | ||
| 124 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 125 | |||
| 126 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 127 | |||
| 128 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 129 | } | ||
| 130 | |||
| 131 | /** | ||
| 132 | * AC_U::GetWifiStatus service function | ||
| 133 | * Outputs: | ||
| 134 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 135 | * 2 : Output connection type, 0 = none, 1 = Old3DS Internet, 2 = New3DS Internet. | ||
| 136 | */ | ||
| 137 | static void GetWifiStatus(Interface* self) { | ||
| 138 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 139 | |||
| 140 | // TODO(purpasmart96): This function is only a stub, | ||
| 141 | // it returns a valid result without implementing full functionality. | ||
| 142 | |||
| 143 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 144 | cmd_buff[2] = 0; // Connection type set to none | ||
| 145 | |||
| 146 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 147 | } | ||
| 148 | |||
| 149 | /** | ||
| 150 | * AC_U::GetInfraPriority service function | ||
| 151 | * Inputs: | ||
| 152 | * 1 : ACConfig size << 14 | 2 | ||
| 153 | * 2 : pointer to ACConfig struct | ||
| 154 | * Outputs: | ||
| 155 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 156 | * 2 : Infra Priority | ||
| 157 | */ | ||
| 158 | static void GetInfraPriority(Interface* self) { | ||
| 159 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 160 | |||
| 161 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 162 | cmd_buff[2] = 0; // Infra Priority, default 0 | ||
| 163 | |||
| 164 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 165 | } | ||
| 166 | |||
| 167 | /** | ||
| 168 | * AC_U::SetRequestEulaVersion service function | ||
| 169 | * Inputs: | ||
| 170 | * 1 : Eula Version major | ||
| 171 | * 2 : Eula Version minor | ||
| 172 | * 3 : ACConfig size << 14 | 2 | ||
| 173 | * 4 : Input pointer to ACConfig struct | ||
| 174 | * 64 : ACConfig size << 14 | 2 | ||
| 175 | * 65 : Output pointer to ACConfig struct | ||
| 176 | * Outputs: | ||
| 177 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 178 | * 2 : Infra Priority | ||
| 179 | */ | ||
| 180 | static void SetRequestEulaVersion(Interface* self) { | ||
| 181 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 182 | |||
| 183 | u32 major = cmd_buff[1] & 0xFF; | ||
| 184 | u32 minor = cmd_buff[2] & 0xFF; | ||
| 185 | |||
| 186 | ASSERT_MSG(cmd_buff[3] == (sizeof(ACConfig) << 14 | 2), | ||
| 187 | "Input buffer size not equal ACConfig size"); | ||
| 188 | ASSERT_MSG(cmd_buff[64] == (sizeof(ACConfig) << 14 | 2), | ||
| 189 | "Output buffer size not equal ACConfig size"); | ||
| 190 | |||
| 191 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 192 | cmd_buff[2] = 0; // Infra Priority | ||
| 193 | |||
| 194 | LOG_WARNING(Service_AC, "(STUBBED) called, major=%u, minor=%u", major, minor); | ||
| 195 | } | ||
| 196 | |||
| 197 | /** | ||
| 198 | * AC_U::RegisterDisconnectEvent service function | ||
| 199 | * Inputs: | ||
| 200 | * 1 : ProcessId Header | ||
| 201 | * 3 : Copy Handle Header | ||
| 202 | * 4 : Event handle, should be signaled when AC connection is closed | ||
| 203 | * Outputs: | ||
| 204 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 205 | */ | ||
| 206 | static void RegisterDisconnectEvent(Interface* self) { | ||
| 207 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 208 | |||
| 209 | disconnect_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]); | ||
| 210 | if (disconnect_event) { | ||
| 211 | disconnect_event->name = "AC_U:disconnect_event"; | ||
| 212 | } | ||
| 213 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 214 | |||
| 215 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 216 | } | ||
| 217 | |||
| 218 | /** | ||
| 219 | * AC_U::IsConnected service function | ||
| 220 | * Outputs: | ||
| 221 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 222 | * 2 : bool, is connected | ||
| 223 | */ | ||
| 224 | static void IsConnected(Interface* self) { | ||
| 225 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 226 | |||
| 227 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 228 | cmd_buff[2] = ac_connected; | ||
| 229 | |||
| 230 | LOG_WARNING(Service_AC, "(STUBBED) called"); | ||
| 231 | } | ||
| 232 | |||
| 233 | /** | ||
| 234 | * AC_U::SetClientVersion service function | ||
| 235 | * Inputs: | ||
| 236 | * 1 : Used SDK Version | ||
| 237 | * Outputs: | ||
| 238 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 239 | */ | ||
| 240 | static void SetClientVersion(Interface* self) { | ||
| 241 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 242 | |||
| 243 | const u32 version = cmd_buff[1]; | ||
| 244 | self->SetVersion(version); | ||
| 245 | |||
| 246 | LOG_WARNING(Service_AC, "(STUBBED) called, version: 0x%08X", version); | ||
| 247 | |||
| 248 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 249 | } | ||
| 250 | |||
| 251 | const Interface::FunctionInfo FunctionTable[] = { | ||
| 252 | {0x00010000, CreateDefaultConfig, "CreateDefaultConfig"}, | ||
| 253 | {0x00040006, ConnectAsync, "ConnectAsync"}, | ||
| 254 | {0x00050002, GetConnectResult, "GetConnectResult"}, | ||
| 255 | {0x00070002, nullptr, "CancelConnectAsync"}, | ||
| 256 | {0x00080004, CloseAsync, "CloseAsync"}, | ||
| 257 | {0x00090002, GetCloseResult, "GetCloseResult"}, | ||
| 258 | {0x000A0000, nullptr, "GetLastErrorCode"}, | ||
| 259 | {0x000C0000, nullptr, "GetStatus"}, | ||
| 260 | {0x000D0000, GetWifiStatus, "GetWifiStatus"}, | ||
| 261 | {0x000E0042, nullptr, "GetCurrentAPInfo"}, | ||
| 262 | {0x00100042, nullptr, "GetCurrentNZoneInfo"}, | ||
| 263 | {0x00110042, nullptr, "GetNZoneApNumService"}, | ||
| 264 | {0x001D0042, nullptr, "ScanAPs"}, | ||
| 265 | {0x00240042, nullptr, "AddDenyApType"}, | ||
| 266 | {0x00270002, GetInfraPriority, "GetInfraPriority"}, | ||
| 267 | {0x002D0082, SetRequestEulaVersion, "SetRequestEulaVersion"}, | ||
| 268 | {0x00300004, RegisterDisconnectEvent, "RegisterDisconnectEvent"}, | ||
| 269 | {0x003C0042, nullptr, "GetAPSSIDList"}, | ||
| 270 | {0x003E0042, IsConnected, "IsConnected"}, | ||
| 271 | {0x00400042, SetClientVersion, "SetClientVersion"}, | ||
| 272 | }; | ||
| 273 | |||
| 274 | AC_U::AC_U() { | ||
| 275 | Register(FunctionTable); | ||
| 276 | |||
| 277 | ac_connected = false; | ||
| 278 | |||
| 279 | close_event = nullptr; | ||
| 280 | connect_event = nullptr; | ||
| 281 | disconnect_event = nullptr; | ||
| 282 | } | ||
| 283 | |||
| 284 | AC_U::~AC_U() { | ||
| 285 | close_event = nullptr; | ||
| 286 | connect_event = nullptr; | ||
| 287 | disconnect_event = nullptr; | ||
| 288 | } | ||
| 289 | |||
| 290 | } // namespace AC | ||
| 291 | } // namespace Service | ||
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index f3190e0fa..0672ac2e3 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -6,9 +6,8 @@ | |||
| 6 | 6 | ||
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | #include "common/string_util.h" | 8 | #include "common/string_util.h" |
| 9 | |||
| 10 | #include "core/hle/kernel/server_port.h" | 9 | #include "core/hle/kernel/server_port.h" |
| 11 | #include "core/hle/service/ac_u.h" | 10 | #include "core/hle/service/ac/ac.h" |
| 12 | #include "core/hle/service/act/act.h" | 11 | #include "core/hle/service/act/act.h" |
| 13 | #include "core/hle/service/am/am.h" | 12 | #include "core/hle/service/am/am.h" |
| 14 | #include "core/hle/service/apt/apt.h" | 13 | #include "core/hle/service/apt/apt.h" |
| @@ -138,6 +137,7 @@ void Init() { | |||
| 138 | AddNamedPort(new ERR::ERR_F); | 137 | AddNamedPort(new ERR::ERR_F); |
| 139 | 138 | ||
| 140 | FS::ArchiveInit(); | 139 | FS::ArchiveInit(); |
| 140 | AC::Init(); | ||
| 141 | ACT::Init(); | 141 | ACT::Init(); |
| 142 | AM::Init(); | 142 | AM::Init(); |
| 143 | APT::Init(); | 143 | APT::Init(); |
| @@ -158,7 +158,6 @@ void Init() { | |||
| 158 | PTM::Init(); | 158 | PTM::Init(); |
| 159 | QTM::Init(); | 159 | QTM::Init(); |
| 160 | 160 | ||
| 161 | AddService(new AC::AC_U); | ||
| 162 | AddService(new CSND::CSND_SND); | 161 | AddService(new CSND::CSND_SND); |
| 163 | AddService(new DSP_DSP::Interface); | 162 | AddService(new DSP_DSP::Interface); |
| 164 | AddService(new GSP::GSP_GPU); | 163 | AddService(new GSP::GSP_GPU); |
| @@ -192,6 +191,7 @@ void Shutdown() { | |||
| 192 | BOSS::Shutdown(); | 191 | BOSS::Shutdown(); |
| 193 | APT::Shutdown(); | 192 | APT::Shutdown(); |
| 194 | AM::Shutdown(); | 193 | AM::Shutdown(); |
| 194 | AC::Shutdown(); | ||
| 195 | FS::ArchiveShutdown(); | 195 | FS::ArchiveShutdown(); |
| 196 | 196 | ||
| 197 | g_srv_services.clear(); | 197 | g_srv_services.clear(); |