diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/logging/backend.cpp | 2 | ||||
| -rw-r--r-- | src/common/logging/log.h | 2 | ||||
| -rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/hle/service/apt/apt.cpp | 74 | ||||
| -rw-r--r-- | src/core/hle/service/apt/apt.h | 49 | ||||
| -rw-r--r-- | src/core/hle/service/apt/apt_a.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/cfg/cfg.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/cfg/cfg.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/dsp_dsp.cpp | 31 | ||||
| -rw-r--r-- | src/core/hle/service/fs/fs_user.cpp | 80 | ||||
| -rw-r--r-- | src/core/hle/service/gsp_gpu.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.h | 6 | ||||
| -rw-r--r-- | src/core/hle/service/nim_u.cpp | 46 | ||||
| -rw-r--r-- | src/core/hle/service/nim_u.h | 23 | ||||
| -rw-r--r-- | src/core/hle/service/nwm_uds.cpp | 111 | ||||
| -rw-r--r-- | src/core/hle/service/ptm/ptm.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/ptm/ptm.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 18 | ||||
| -rw-r--r-- | src/core/hw/gpu.cpp | 2 |
20 files changed, 409 insertions, 68 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 649640e72..7d3534a43 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp | |||
| @@ -39,6 +39,8 @@ static std::shared_ptr<Logger> global_logger; | |||
| 39 | SUB(Service, AC) \ | 39 | SUB(Service, AC) \ |
| 40 | SUB(Service, PTM) \ | 40 | SUB(Service, PTM) \ |
| 41 | SUB(Service, LDR) \ | 41 | SUB(Service, LDR) \ |
| 42 | SUB(Service, NIM) \ | ||
| 43 | SUB(Service, NWM) \ | ||
| 42 | SUB(Service, CFG) \ | 44 | SUB(Service, CFG) \ |
| 43 | SUB(Service, DSP) \ | 45 | SUB(Service, DSP) \ |
| 44 | SUB(Service, HID) \ | 46 | SUB(Service, HID) \ |
diff --git a/src/common/logging/log.h b/src/common/logging/log.h index 83d64145b..123641cb4 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h | |||
| @@ -59,6 +59,8 @@ enum class Class : ClassType { | |||
| 59 | Service_AC, ///< The AC (WiFi status) service | 59 | Service_AC, ///< The AC (WiFi status) service |
| 60 | Service_PTM, ///< The PTM (Power status & misc.) service | 60 | Service_PTM, ///< The PTM (Power status & misc.) service |
| 61 | Service_LDR, ///< The LDR (3ds dll loader) service | 61 | Service_LDR, ///< The LDR (3ds dll loader) service |
| 62 | Service_NIM, ///< The NIM (Network interface manager) service | ||
| 63 | Service_NWM, ///< The NWM (Network manager) service | ||
| 62 | Service_CFG, ///< The CFG (Configuration) service | 64 | Service_CFG, ///< The CFG (Configuration) service |
| 63 | Service_DSP, ///< The DSP (DSP control) service | 65 | Service_DSP, ///< The DSP (DSP control) service |
| 64 | Service_HID, ///< The HID (User input) service | 66 | Service_HID, ///< The HID (User input) service |
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 33e5be3a4..bdf4b6212 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -69,6 +69,7 @@ set(SRCS | |||
| 69 | hle/service/news_s.cpp | 69 | hle/service/news_s.cpp |
| 70 | hle/service/news_u.cpp | 70 | hle/service/news_u.cpp |
| 71 | hle/service/nim_aoc.cpp | 71 | hle/service/nim_aoc.cpp |
| 72 | hle/service/nim_u.cpp | ||
| 72 | hle/service/ns_s.cpp | 73 | hle/service/ns_s.cpp |
| 73 | hle/service/nwm_uds.cpp | 74 | hle/service/nwm_uds.cpp |
| 74 | hle/service/pm_app.cpp | 75 | hle/service/pm_app.cpp |
| @@ -177,6 +178,7 @@ set(HEADERS | |||
| 177 | hle/service/news_s.h | 178 | hle/service/news_s.h |
| 178 | hle/service/news_u.h | 179 | hle/service/news_u.h |
| 179 | hle/service/nim_aoc.h | 180 | hle/service/nim_aoc.h |
| 181 | hle/service/nim_u.h | ||
| 180 | hle/service/ns_s.h | 182 | hle/service/ns_s.h |
| 181 | hle/service/nwm_uds.h | 183 | hle/service/nwm_uds.h |
| 182 | hle/service/pm_app.h | 184 | hle/service/pm_app.h |
diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 5971f860b..4861d9e5f 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp | |||
| @@ -28,16 +28,21 @@ namespace APT { | |||
| 28 | static const VAddr SHARED_FONT_VADDR = 0x18000000; | 28 | static const VAddr SHARED_FONT_VADDR = 0x18000000; |
| 29 | 29 | ||
| 30 | /// Handle to shared memory region designated to for shared system font | 30 | /// Handle to shared memory region designated to for shared system font |
| 31 | static Kernel::SharedPtr<Kernel::SharedMemory> shared_font_mem; | 31 | static Kernel::SharedPtr<Kernel::SharedMemory> shared_font_mem = nullptr; |
| 32 | 32 | ||
| 33 | static Kernel::SharedPtr<Kernel::Mutex> lock; | 33 | static Kernel::SharedPtr<Kernel::Mutex> lock = nullptr; |
| 34 | static Kernel::SharedPtr<Kernel::Event> notification_event; ///< APT notification event | 34 | static Kernel::SharedPtr<Kernel::Event> notification_event = nullptr; ///< APT notification event |
| 35 | static Kernel::SharedPtr<Kernel::Event> pause_event = 0; ///< APT pause event | 35 | static Kernel::SharedPtr<Kernel::Event> pause_event = nullptr; ///< APT pause event |
| 36 | static std::vector<u8> shared_font; | 36 | static std::vector<u8> shared_font; |
| 37 | 37 | ||
| 38 | static u32 cpu_percent = 0; ///< CPU time available to the running application | ||
| 39 | |||
| 38 | void Initialize(Service::Interface* self) { | 40 | void Initialize(Service::Interface* self) { |
| 39 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 41 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 42 | u32 app_id = cmd_buff[1]; | ||
| 43 | u32 flags = cmd_buff[2]; | ||
| 40 | 44 | ||
| 45 | cmd_buff[2] = 0x04000000; // According to 3dbrew, this value should be 0x04000000 | ||
| 41 | cmd_buff[3] = Kernel::g_handle_table.Create(notification_event).MoveFrom(); | 46 | cmd_buff[3] = Kernel::g_handle_table.Create(notification_event).MoveFrom(); |
| 42 | cmd_buff[4] = Kernel::g_handle_table.Create(pause_event).MoveFrom(); | 47 | cmd_buff[4] = Kernel::g_handle_table.Create(pause_event).MoveFrom(); |
| 43 | 48 | ||
| @@ -49,6 +54,8 @@ void Initialize(Service::Interface* self) { | |||
| 49 | lock->Release(); | 54 | lock->Release(); |
| 50 | 55 | ||
| 51 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | 56 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error |
| 57 | |||
| 58 | LOG_TRACE(Service_APT, "called app_id=0x%08X, flags=0x%08X", app_id, flags); | ||
| 52 | } | 59 | } |
| 53 | 60 | ||
| 54 | void GetSharedFont(Service::Interface* self) { | 61 | void GetSharedFont(Service::Interface* self) { |
| @@ -190,7 +197,38 @@ void CancelParameter(Service::Interface* self) { | |||
| 190 | cmd_buff[2] = 1; // Set to Success | 197 | cmd_buff[2] = 1; // Set to Success |
| 191 | 198 | ||
| 192 | LOG_WARNING(Service_APT, "(STUBBED) called flag1=0x%08X, unk=0x%08X, flag2=0x%08X, app_id=0x%08X", | 199 | LOG_WARNING(Service_APT, "(STUBBED) called flag1=0x%08X, unk=0x%08X, flag2=0x%08X, app_id=0x%08X", |
| 193 | flag1, unk, flag2, app_id); | 200 | flag1, unk, flag2, app_id); |
| 201 | } | ||
| 202 | |||
| 203 | void PrepareToStartApplication(Service::Interface* self) { | ||
| 204 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 205 | u32 title_info1 = cmd_buff[1]; | ||
| 206 | u32 title_info2 = cmd_buff[2]; | ||
| 207 | u32 title_info3 = cmd_buff[3]; | ||
| 208 | u32 title_info4 = cmd_buff[4]; | ||
| 209 | u32 flags = cmd_buff[5]; | ||
| 210 | |||
| 211 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 212 | |||
| 213 | LOG_WARNING(Service_APT, "(STUBBED) called title_info1=0x%08X, title_info2=0x%08X, title_info3=0x%08X," | ||
| 214 | "title_info4=0x%08X, flags=0x%08X", title_info1, title_info2, title_info3, title_info4, flags); | ||
| 215 | } | ||
| 216 | |||
| 217 | void StartApplication(Service::Interface* self) { | ||
| 218 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 219 | u32 buffer1_size = cmd_buff[1]; | ||
| 220 | u32 buffer2_size = cmd_buff[2]; | ||
| 221 | u32 flag = cmd_buff[3]; | ||
| 222 | u32 size1 = cmd_buff[4]; | ||
| 223 | u32 buffer1_ptr = cmd_buff[5]; | ||
| 224 | u32 size2 = cmd_buff[6]; | ||
| 225 | u32 buffer2_ptr = cmd_buff[7]; | ||
| 226 | |||
| 227 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 228 | |||
| 229 | LOG_WARNING(Service_APT, "(STUBBED) called buffer1_size=0x%08X, buffer2_size=0x%08X, flag=0x%08X," | ||
| 230 | "size1=0x%08X, buffer1_ptr=0x%08X, size2=0x%08X, buffer2_ptr=0x%08X", | ||
| 231 | buffer1_size, buffer2_size, flag, size1, buffer1_ptr, size2, buffer2_ptr); | ||
| 194 | } | 232 | } |
| 195 | 233 | ||
| 196 | void AppletUtility(Service::Interface* self) { | 234 | void AppletUtility(Service::Interface* self) { |
| @@ -205,15 +243,15 @@ void AppletUtility(Service::Interface* self) { | |||
| 205 | 243 | ||
| 206 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | 244 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error |
| 207 | 245 | ||
| 208 | LOG_WARNING(Service_APT, "(STUBBED) called unk=0x%08X, buffer1_size=0x%08x, buffer2_size=0x%08x, " | 246 | LOG_WARNING(Service_APT, "(STUBBED) called unk=0x%08X, buffer1_size=0x%08X, buffer2_size=0x%08X, " |
| 209 | "buffer1_addr=0x%08x, buffer2_addr=0x%08x", unk, buffer1_size, buffer2_size, | 247 | "buffer1_addr=0x%08X, buffer2_addr=0x%08X", unk, buffer1_size, buffer2_size, |
| 210 | buffer1_addr, buffer2_addr); | 248 | buffer1_addr, buffer2_addr); |
| 211 | } | 249 | } |
| 212 | 250 | ||
| 213 | void SetAppCpuTimeLimit(Service::Interface* self) { | 251 | void SetAppCpuTimeLimit(Service::Interface* self) { |
| 214 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 252 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 215 | u32 value = cmd_buff[1]; | 253 | u32 value = cmd_buff[1]; |
| 216 | u32 percent = cmd_buff[2]; | 254 | cpu_percent = cmd_buff[2]; |
| 217 | 255 | ||
| 218 | if (value != 1) { | 256 | if (value != 1) { |
| 219 | LOG_ERROR(Service_APT, "This value should be one, but is actually %u!", value); | 257 | LOG_ERROR(Service_APT, "This value should be one, but is actually %u!", value); |
| @@ -221,27 +259,26 @@ void SetAppCpuTimeLimit(Service::Interface* self) { | |||
| 221 | 259 | ||
| 222 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | 260 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error |
| 223 | 261 | ||
| 224 | LOG_WARNING(Service_APT, "(STUBBED) called percent=0x%08X, value=0x%08x", percent, value); | 262 | LOG_WARNING(Service_APT, "(STUBBED) called cpu_percent=%u, value=%u", cpu_percent, value); |
| 225 | } | 263 | } |
| 226 | 264 | ||
| 227 | void GetAppCpuTimeLimit(Service::Interface* self) { | 265 | void GetAppCpuTimeLimit(Service::Interface* self) { |
| 228 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 266 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 229 | u32 value = cmd_buff[1]; | 267 | u32 value = cmd_buff[1]; |
| 230 | 268 | ||
| 269 | ASSERT(cpu_percent != 0); | ||
| 270 | |||
| 231 | if (value != 1) { | 271 | if (value != 1) { |
| 232 | LOG_ERROR(Service_APT, "This value should be one, but is actually %u!", value); | 272 | LOG_ERROR(Service_APT, "This value should be one, but is actually %u!", value); |
| 233 | } | 273 | } |
| 234 | 274 | ||
| 235 | // TODO(purpasmart96): This is incorrect, I'm pretty sure the percentage should | ||
| 236 | // be set by the application. | ||
| 237 | |||
| 238 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | 275 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error |
| 239 | cmd_buff[2] = 0x80; // Set to 80% | 276 | cmd_buff[2] = cpu_percent; |
| 240 | 277 | ||
| 241 | LOG_WARNING(Service_APT, "(STUBBED) called value=0x%08x", value); | 278 | LOG_WARNING(Service_APT, "(STUBBED) called value=%u", value); |
| 242 | } | 279 | } |
| 243 | 280 | ||
| 244 | void APTInit() { | 281 | void Init() { |
| 245 | AddService(new APT_A_Interface); | 282 | AddService(new APT_A_Interface); |
| 246 | AddService(new APT_S_Interface); | 283 | AddService(new APT_S_Interface); |
| 247 | AddService(new APT_U_Interface); | 284 | AddService(new APT_U_Interface); |
| @@ -271,13 +308,14 @@ void APTInit() { | |||
| 271 | } | 308 | } |
| 272 | 309 | ||
| 273 | lock = Kernel::Mutex::Create(false, "APT_U:Lock"); | 310 | lock = Kernel::Mutex::Create(false, "APT_U:Lock"); |
| 274 | 311 | cpu_percent = 0; | |
| 312 | |||
| 275 | // TODO(bunnei): Check if these are created in Initialize or on APT process startup. | 313 | // TODO(bunnei): Check if these are created in Initialize or on APT process startup. |
| 276 | notification_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "APT_U:Notification"); | 314 | notification_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "APT_U:Notification"); |
| 277 | pause_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "APT_U:Pause"); | 315 | pause_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "APT_U:Pause"); |
| 278 | } | 316 | } |
| 279 | 317 | ||
| 280 | void APTShutdown() { | 318 | void Shutdown() { |
| 281 | 319 | ||
| 282 | } | 320 | } |
| 283 | 321 | ||
diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index a39adbff9..e7fa39325 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h | |||
| @@ -13,10 +13,13 @@ namespace APT { | |||
| 13 | 13 | ||
| 14 | /// Signals used by APT functions | 14 | /// Signals used by APT functions |
| 15 | enum class SignalType : u32 { | 15 | enum class SignalType : u32 { |
| 16 | None = 0x0, | 16 | None = 0x0, |
| 17 | AppJustStarted = 0x1, | 17 | AppJustStarted = 0x1, |
| 18 | ReturningToApp = 0xB, | 18 | LibAppJustStarted = 0x2, |
| 19 | ExitingApp = 0xC, | 19 | LibAppFinished = 0x3, |
| 20 | LibAppClosed = 0xA, | ||
| 21 | ReturningToApp = 0xB, | ||
| 22 | ExitingApp = 0xC, | ||
| 20 | }; | 23 | }; |
| 21 | 24 | ||
| 22 | /// App Id's used by APT functions | 25 | /// App Id's used by APT functions |
| @@ -179,6 +182,40 @@ void GlanceParameter(Service::Interface* self); | |||
| 179 | void CancelParameter(Service::Interface* self); | 182 | void CancelParameter(Service::Interface* self); |
| 180 | 183 | ||
| 181 | /** | 184 | /** |
| 185 | * APT::PrepareToStartApplication service function. When the input title-info programID is zero, | ||
| 186 | * NS will load the actual program ID via AMNet:GetTitleIDList. After doing some checks with the | ||
| 187 | * programID, NS will then set a NS state flag to value 1, then set the programID for AppID | ||
| 188 | * 0x300(application) to the input program ID(or the one from GetTitleIDList). A media-type field | ||
| 189 | * in the NS state is also set to the input media-type value | ||
| 190 | * (other state fields are set at this point as well). With 8.0.0-18, NS will set an u8 NS state | ||
| 191 | * field to value 1 when input flags bit8 is set | ||
| 192 | * Inputs: | ||
| 193 | * 1-4 : 0x10-byte title-info struct | ||
| 194 | * 4 : Flags | ||
| 195 | * Outputs: | ||
| 196 | * 0 : Return header | ||
| 197 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 198 | */ | ||
| 199 | void PrepareToStartApplication(Service::Interface* self); | ||
| 200 | |||
| 201 | /** | ||
| 202 | * APT::StartApplication service function. Buf0 is copied to NS FIRMparams+0x0, then Buf1 is copied | ||
| 203 | * to the NS FIRMparams+0x480. Then the application is launched. | ||
| 204 | * Inputs: | ||
| 205 | * 1 : Buffer 0 size, max size is 0x300 | ||
| 206 | * 2 : Buffer 1 size, max size is 0x20 (this can be zero) | ||
| 207 | * 3 : u8 flag | ||
| 208 | * 4 : (Size0<<14) | 2 | ||
| 209 | * 5 : Buffer 0 pointer | ||
| 210 | * 6 : (Size1<<14) | 0x802 | ||
| 211 | * 7 : Buffer 1 pointer | ||
| 212 | * Outputs: | ||
| 213 | * 0 : Return Header | ||
| 214 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 215 | */ | ||
| 216 | void StartApplication(Service::Interface* self); | ||
| 217 | |||
| 218 | /** | ||
| 182 | * APT::AppletUtility service function | 219 | * APT::AppletUtility service function |
| 183 | * Inputs: | 220 | * Inputs: |
| 184 | * 1 : Unknown, but clearly used for something | 221 | * 1 : Unknown, but clearly used for something |
| @@ -213,10 +250,10 @@ void SetAppCpuTimeLimit(Service::Interface* self); | |||
| 213 | void GetAppCpuTimeLimit(Service::Interface* self); | 250 | void GetAppCpuTimeLimit(Service::Interface* self); |
| 214 | 251 | ||
| 215 | /// Initialize the APT service | 252 | /// Initialize the APT service |
| 216 | void APTInit(); | 253 | void Init(); |
| 217 | 254 | ||
| 218 | /// Shutdown the APT service | 255 | /// Shutdown the APT service |
| 219 | void APTShutdown(); | 256 | void Shutdown(); |
| 220 | 257 | ||
| 221 | } // namespace APT | 258 | } // namespace APT |
| 222 | } // namespace Service | 259 | } // namespace Service |
diff --git a/src/core/hle/service/apt/apt_a.cpp b/src/core/hle/service/apt/apt_a.cpp index dbe5c1d87..864934245 100644 --- a/src/core/hle/service/apt/apt_a.cpp +++ b/src/core/hle/service/apt/apt_a.cpp | |||
| @@ -12,16 +12,16 @@ namespace APT { | |||
| 12 | const Interface::FunctionInfo FunctionTable[] = { | 12 | const Interface::FunctionInfo FunctionTable[] = { |
| 13 | {0x00010040, GetLockHandle, "GetLockHandle?"}, | 13 | {0x00010040, GetLockHandle, "GetLockHandle?"}, |
| 14 | {0x00020080, Initialize, "Initialize?"}, | 14 | {0x00020080, Initialize, "Initialize?"}, |
| 15 | {0x00030040, nullptr, "Enable?"}, | 15 | {0x00030040, Enable, "Enable?"}, |
| 16 | {0x00040040, nullptr, "Finalize?"}, | 16 | {0x00040040, nullptr, "Finalize?"}, |
| 17 | {0x00050040, nullptr, "GetAppletManInfo?"}, | 17 | {0x00050040, nullptr, "GetAppletManInfo?"}, |
| 18 | {0x00060040, nullptr, "GetAppletInfo?"}, | 18 | {0x00060040, nullptr, "GetAppletInfo?"}, |
| 19 | {0x000D0080, ReceiveParameter, "ReceiveParameter?"}, | 19 | {0x000D0080, ReceiveParameter, "ReceiveParameter?"}, |
| 20 | {0x000E0080, GlanceParameter, "GlanceParameter?"}, | 20 | {0x000E0080, GlanceParameter, "GlanceParameter?"}, |
| 21 | {0x003B0040, nullptr, "CancelLibraryApplet?"}, | 21 | {0x003B0040, nullptr, "CancelLibraryApplet?"}, |
| 22 | {0x00430040, nullptr, "NotifyToWait?"}, | 22 | {0x00430040, NotifyToWait, "NotifyToWait?"}, |
| 23 | {0x00440000, GetSharedFont, "GetSharedFont?"}, | 23 | {0x00440000, GetSharedFont, "GetSharedFont?"}, |
| 24 | {0x004B00C2, nullptr, "AppletUtility?"}, | 24 | {0x004B00C2, AppletUtility, "AppletUtility?"}, |
| 25 | {0x00550040, nullptr, "WriteInputToNsState?"}, | 25 | {0x00550040, nullptr, "WriteInputToNsState?"}, |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index 6adadb224..fe1245fe8 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp | |||
| @@ -170,7 +170,7 @@ ResultCode FormatConfig() { | |||
| 170 | return RESULT_SUCCESS; | 170 | return RESULT_SUCCESS; |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | void CFGInit() { | 173 | void Init() { |
| 174 | AddService(new CFG_I_Interface); | 174 | AddService(new CFG_I_Interface); |
| 175 | AddService(new CFG_S_Interface); | 175 | AddService(new CFG_S_Interface); |
| 176 | AddService(new CFG_U_Interface); | 176 | AddService(new CFG_U_Interface); |
| @@ -218,7 +218,7 @@ void CFGInit() { | |||
| 218 | FormatConfig(); | 218 | FormatConfig(); |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | void CFGShutdown() { | 221 | void Shutdown() { |
| 222 | 222 | ||
| 223 | } | 223 | } |
| 224 | 224 | ||
diff --git a/src/core/hle/service/cfg/cfg.h b/src/core/hle/service/cfg/cfg.h index e818d7bdc..3488c40d0 100644 --- a/src/core/hle/service/cfg/cfg.h +++ b/src/core/hle/service/cfg/cfg.h | |||
| @@ -135,10 +135,10 @@ ResultCode UpdateConfigNANDSavegame(); | |||
| 135 | ResultCode FormatConfig(); | 135 | ResultCode FormatConfig(); |
| 136 | 136 | ||
| 137 | /// Initialize the config service | 137 | /// Initialize the config service |
| 138 | void CFGInit(); | 138 | void Init(); |
| 139 | 139 | ||
| 140 | /// Shutdown the config service | 140 | /// Shutdown the config service |
| 141 | void CFGShutdown(); | 141 | void Shutdown(); |
| 142 | 142 | ||
| 143 | } // namespace CFG | 143 | } // namespace CFG |
| 144 | } // namespace Service | 144 | } // namespace Service |
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp index 0b3603ce1..f16f84e67 100644 --- a/src/core/hle/service/dsp_dsp.cpp +++ b/src/core/hle/service/dsp_dsp.cpp | |||
| @@ -84,6 +84,33 @@ static void GetSemaphoreEventHandle(Service::Interface* self) { | |||
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | /** | 86 | /** |
| 87 | * DSP_DSP::FlushDataCache service function | ||
| 88 | * | ||
| 89 | * This Function is a no-op, We aren't emulating the CPU cache any time soon. | ||
| 90 | * | ||
| 91 | * Inputs: | ||
| 92 | * 1 : Address | ||
| 93 | * 2 : Size | ||
| 94 | * 3 : Value 0, some descriptor for the KProcess Handle | ||
| 95 | * 4 : KProcess handle | ||
| 96 | * Outputs: | ||
| 97 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 98 | */ | ||
| 99 | static void FlushDataCache(Service::Interface* self) { | ||
| 100 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 101 | u32 address = cmd_buff[1]; | ||
| 102 | u32 size = cmd_buff[2]; | ||
| 103 | u32 process = cmd_buff[4]; | ||
| 104 | |||
| 105 | // TODO(purpasmart96): Verify return header on HW | ||
| 106 | |||
| 107 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 108 | |||
| 109 | LOG_DEBUG(Service_DSP, "(STUBBED) called address=0x%08X, size=0x%08X, process=0x%08X", | ||
| 110 | address, size, process); | ||
| 111 | } | ||
| 112 | |||
| 113 | /** | ||
| 87 | * DSP_DSP::RegisterInterruptEvents service function | 114 | * DSP_DSP::RegisterInterruptEvents service function |
| 88 | * Inputs: | 115 | * Inputs: |
| 89 | * 1 : Parameter 0 (purpose unknown) | 116 | * 1 : Parameter 0 (purpose unknown) |
| @@ -225,7 +252,7 @@ static void GetHeadphoneStatus(Service::Interface* self) { | |||
| 225 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | 252 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error |
| 226 | cmd_buff[2] = 0; // Not using headphones? | 253 | cmd_buff[2] = 0; // Not using headphones? |
| 227 | 254 | ||
| 228 | LOG_WARNING(Service_DSP, "(STUBBED) called"); | 255 | LOG_DEBUG(Service_DSP, "(STUBBED) called"); |
| 229 | } | 256 | } |
| 230 | 257 | ||
| 231 | const Interface::FunctionInfo FunctionTable[] = { | 258 | const Interface::FunctionInfo FunctionTable[] = { |
| @@ -242,7 +269,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 242 | {0x001000C0, ReadPipeIfPossible, "ReadPipeIfPossible"}, | 269 | {0x001000C0, ReadPipeIfPossible, "ReadPipeIfPossible"}, |
| 243 | {0x001100C2, LoadComponent, "LoadComponent"}, | 270 | {0x001100C2, LoadComponent, "LoadComponent"}, |
| 244 | {0x00120000, nullptr, "UnloadComponent"}, | 271 | {0x00120000, nullptr, "UnloadComponent"}, |
| 245 | {0x00130082, nullptr, "FlushDataCache"}, | 272 | {0x00130082, FlushDataCache, "FlushDataCache"}, |
| 246 | {0x00140082, nullptr, "InvalidateDCache"}, | 273 | {0x00140082, nullptr, "InvalidateDCache"}, |
| 247 | {0x00150082, RegisterInterruptEvents, "RegisterInterruptEvents"}, | 274 | {0x00150082, RegisterInterruptEvents, "RegisterInterruptEvents"}, |
| 248 | {0x00160000, GetSemaphoreEventHandle, "GetSemaphoreEventHandle"}, | 275 | {0x00160000, GetSemaphoreEventHandle, "GetSemaphoreEventHandle"}, |
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp index d8d1d5547..5bc94b1b1 100644 --- a/src/core/hle/service/fs/fs_user.cpp +++ b/src/core/hle/service/fs/fs_user.cpp | |||
| @@ -20,6 +20,8 @@ using Kernel::Session; | |||
| 20 | namespace Service { | 20 | namespace Service { |
| 21 | namespace FS { | 21 | namespace FS { |
| 22 | 22 | ||
| 23 | static u32 priority = -1; ///< For SetPriority and GetPriority service functions | ||
| 24 | |||
| 23 | static ArchiveHandle MakeArchiveHandle(u32 low_word, u32 high_word) { | 25 | static ArchiveHandle MakeArchiveHandle(u32 low_word, u32 high_word) { |
| 24 | return (u64)low_word | ((u64)high_word << 32); | 26 | return (u64)low_word | ((u64)high_word << 32); |
| 25 | } | 27 | } |
| @@ -215,7 +217,7 @@ static void DeleteDirectory(Service::Interface* self) { | |||
| 215 | 217 | ||
| 216 | LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", | 218 | LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", |
| 217 | dirname_type, dirname_size, dir_path.DebugStr().c_str()); | 219 | dirname_type, dirname_size, dir_path.DebugStr().c_str()); |
| 218 | 220 | ||
| 219 | cmd_buff[1] = DeleteDirectoryFromArchive(archive_handle, dir_path).raw; | 221 | cmd_buff[1] = DeleteDirectoryFromArchive(archive_handle, dir_path).raw; |
| 220 | } | 222 | } |
| 221 | 223 | ||
| @@ -424,7 +426,7 @@ static void IsSdmcWriteable(Service::Interface* self) { | |||
| 424 | cmd_buff[1] = RESULT_SUCCESS.raw; | 426 | cmd_buff[1] = RESULT_SUCCESS.raw; |
| 425 | // If the SD isn't enabled, it can't be writeable...else, stubbed true | 427 | // If the SD isn't enabled, it can't be writeable...else, stubbed true |
| 426 | cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0; | 428 | cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0; |
| 427 | 429 | ||
| 428 | LOG_DEBUG(Service_FS, " (STUBBED)"); | 430 | LOG_DEBUG(Service_FS, " (STUBBED)"); |
| 429 | } | 431 | } |
| 430 | 432 | ||
| @@ -511,7 +513,7 @@ static void CreateExtSaveData(Service::Interface* self) { | |||
| 511 | MediaType media_type = static_cast<MediaType>(cmd_buff[1] & 0xFF); | 513 | MediaType media_type = static_cast<MediaType>(cmd_buff[1] & 0xFF); |
| 512 | u32 save_low = cmd_buff[2]; | 514 | u32 save_low = cmd_buff[2]; |
| 513 | u32 save_high = cmd_buff[3]; | 515 | u32 save_high = cmd_buff[3]; |
| 514 | 516 | ||
| 515 | LOG_WARNING(Service_FS, "(STUBBED) savedata_high=%08X savedata_low=%08X cmd_buff[3]=%08X " | 517 | LOG_WARNING(Service_FS, "(STUBBED) savedata_high=%08X savedata_low=%08X cmd_buff[3]=%08X " |
| 516 | "cmd_buff[4]=%08X cmd_buff[5]=%08X cmd_buff[6]=%08X cmd_buff[7]=%08X cmd_buff[8]=%08X " | 518 | "cmd_buff[4]=%08X cmd_buff[5]=%08X cmd_buff[6]=%08X cmd_buff[7]=%08X cmd_buff[8]=%08X " |
| 517 | "cmd_buff[9]=%08X cmd_buff[10]=%08X cmd_buff[11]=%08X", save_high, save_low, | 519 | "cmd_buff[9]=%08X cmd_buff[10]=%08X cmd_buff[11]=%08X", save_high, save_low, |
| @@ -573,7 +575,7 @@ static void DeleteSystemSaveData(Service::Interface* self) { | |||
| 573 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 575 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 574 | u32 savedata_high = cmd_buff[1]; | 576 | u32 savedata_high = cmd_buff[1]; |
| 575 | u32 savedata_low = cmd_buff[2]; | 577 | u32 savedata_low = cmd_buff[2]; |
| 576 | 578 | ||
| 577 | cmd_buff[1] = DeleteSystemSaveData(savedata_high, savedata_low).raw; | 579 | cmd_buff[1] = DeleteSystemSaveData(savedata_high, savedata_low).raw; |
| 578 | } | 580 | } |
| 579 | 581 | ||
| @@ -601,12 +603,72 @@ static void CreateSystemSaveData(Service::Interface* self) { | |||
| 601 | 603 | ||
| 602 | LOG_WARNING(Service_FS, "(STUBBED) savedata_high=%08X savedata_low=%08X cmd_buff[3]=%08X " | 604 | LOG_WARNING(Service_FS, "(STUBBED) savedata_high=%08X savedata_low=%08X cmd_buff[3]=%08X " |
| 603 | "cmd_buff[4]=%08X cmd_buff[5]=%08X cmd_buff[6]=%08X cmd_buff[7]=%08X cmd_buff[8]=%08X " | 605 | "cmd_buff[4]=%08X cmd_buff[5]=%08X cmd_buff[6]=%08X cmd_buff[7]=%08X cmd_buff[8]=%08X " |
| 604 | "cmd_buff[9]=%08X", savedata_high, savedata_low, cmd_buff[3], cmd_buff[4], cmd_buff[5], | 606 | "cmd_buff[9]=%08X", savedata_high, savedata_low, cmd_buff[3], cmd_buff[4], cmd_buff[5], |
| 605 | cmd_buff[6], cmd_buff[7], cmd_buff[8], cmd_buff[9]); | 607 | cmd_buff[6], cmd_buff[7], cmd_buff[8], cmd_buff[9]); |
| 606 | 608 | ||
| 607 | cmd_buff[1] = CreateSystemSaveData(savedata_high, savedata_low).raw; | 609 | cmd_buff[1] = CreateSystemSaveData(savedata_high, savedata_low).raw; |
| 608 | } | 610 | } |
| 609 | 611 | ||
| 612 | /** | ||
| 613 | * FS_User::InitializeWithSdkVersion service function. | ||
| 614 | * Inputs: | ||
| 615 | * 0 : 0x08610042 | ||
| 616 | * 1 : Unknown | ||
| 617 | * 2 : Unknown | ||
| 618 | * 3 : Unknown | ||
| 619 | * Outputs: | ||
| 620 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 621 | */ | ||
| 622 | static void InitializeWithSdkVersion(Service::Interface* self) { | ||
| 623 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 624 | |||
| 625 | u32 unk1 = cmd_buff[1]; | ||
| 626 | u32 unk2 = cmd_buff[2]; | ||
| 627 | u32 unk3 = cmd_buff[3]; | ||
| 628 | |||
| 629 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 630 | |||
| 631 | LOG_WARNING(Service_FS, "(STUBBED) called unk1=0x%08X, unk2=0x%08X, unk3=0x%08X", | ||
| 632 | unk1, unk2, unk3); | ||
| 633 | } | ||
| 634 | |||
| 635 | /** | ||
| 636 | * FS_User::SetPriority service function. | ||
| 637 | * Inputs: | ||
| 638 | * 0 : 0x08620040 | ||
| 639 | * 1 : priority | ||
| 640 | * Outputs: | ||
| 641 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 642 | */ | ||
| 643 | static void SetPriority(Service::Interface* self) { | ||
| 644 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 645 | |||
| 646 | priority = cmd_buff[1]; | ||
| 647 | |||
| 648 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 649 | |||
| 650 | LOG_DEBUG(Service_FS, "called priority=0x%08X", priority); | ||
| 651 | } | ||
| 652 | |||
| 653 | /** | ||
| 654 | * FS_User::GetPriority service function. | ||
| 655 | * Inputs: | ||
| 656 | * 0 : 0x08630000 | ||
| 657 | * Outputs: | ||
| 658 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 659 | * 2 : priority | ||
| 660 | */ | ||
| 661 | static void GetPriority(Service::Interface* self) { | ||
| 662 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 663 | |||
| 664 | ASSERT(priority != -1); | ||
| 665 | |||
| 666 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 667 | cmd_buff[2] = priority; | ||
| 668 | |||
| 669 | LOG_DEBUG(Service_FS, "called priority=0x%08X", priority); | ||
| 670 | } | ||
| 671 | |||
| 610 | const Interface::FunctionInfo FunctionTable[] = { | 672 | const Interface::FunctionInfo FunctionTable[] = { |
| 611 | {0x000100C6, nullptr, "Dummy1"}, | 673 | {0x000100C6, nullptr, "Dummy1"}, |
| 612 | {0x040100C4, nullptr, "Control"}, | 674 | {0x040100C4, nullptr, "Control"}, |
| @@ -695,15 +757,17 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 695 | {0x08560240, CreateSystemSaveData, "CreateSystemSaveData"}, | 757 | {0x08560240, CreateSystemSaveData, "CreateSystemSaveData"}, |
| 696 | {0x08570080, DeleteSystemSaveData, "DeleteSystemSaveData"}, | 758 | {0x08570080, DeleteSystemSaveData, "DeleteSystemSaveData"}, |
| 697 | {0x08580000, nullptr, "GetMovableSedHashedKeyYRandomData"}, | 759 | {0x08580000, nullptr, "GetMovableSedHashedKeyYRandomData"}, |
| 698 | {0x08610042, nullptr, "InitializeWithSdkVersion"}, | 760 | {0x08610042, InitializeWithSdkVersion, "InitializeWithSdkVersion"}, |
| 699 | {0x08620040, nullptr, "SetPriority"}, | 761 | {0x08620040, SetPriority, "SetPriority"}, |
| 700 | {0x08630000, nullptr, "GetPriority"}, | 762 | {0x08630000, GetPriority, "GetPriority"}, |
| 701 | }; | 763 | }; |
| 702 | 764 | ||
| 703 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 765 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 704 | // Interface class | 766 | // Interface class |
| 705 | 767 | ||
| 706 | Interface::Interface() { | 768 | Interface::Interface() { |
| 769 | |||
| 770 | priority = -1; | ||
| 707 | Register(FunctionTable); | 771 | Register(FunctionTable); |
| 708 | } | 772 | } |
| 709 | 773 | ||
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index cff585698..26d3bcff6 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp | |||
| @@ -265,6 +265,9 @@ static void FlushDataCache(Service::Interface* self) { | |||
| 265 | // TODO(purpasmart96): Verify return header on HW | 265 | // TODO(purpasmart96): Verify return header on HW |
| 266 | 266 | ||
| 267 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | 267 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error |
| 268 | |||
| 269 | LOG_DEBUG(Service_GSP, "(STUBBED) called address=0x%08X, size=0x%08X, process=0x%08X", | ||
| 270 | address, size, process); | ||
| 268 | } | 271 | } |
| 269 | 272 | ||
| 270 | /** | 273 | /** |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 138603d9b..9ca5d13d4 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -45,7 +45,7 @@ static u32 next_touch_index = 0; | |||
| 45 | // * Set PadData.current_state.circle_left = 1 if current PadEntry.circle_pad_x <= -41 | 45 | // * Set PadData.current_state.circle_left = 1 if current PadEntry.circle_pad_x <= -41 |
| 46 | // * Set PadData.current_state.circle_right = 1 if current PadEntry.circle_pad_y <= -41 | 46 | // * Set PadData.current_state.circle_right = 1 if current PadEntry.circle_pad_y <= -41 |
| 47 | 47 | ||
| 48 | void HIDUpdate() { | 48 | void Update() { |
| 49 | SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer().ValueOr(nullptr)); | 49 | SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer().ValueOr(nullptr)); |
| 50 | const PadState state = VideoCore::g_emu_window->GetPadState(); | 50 | const PadState state = VideoCore::g_emu_window->GetPadState(); |
| 51 | 51 | ||
| @@ -155,7 +155,7 @@ void GetSoundVolume(Service::Interface* self) { | |||
| 155 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 155 | LOG_WARNING(Service_HID, "(STUBBED) called"); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | void HIDInit() { | 158 | void Init() { |
| 159 | using namespace Kernel; | 159 | using namespace Kernel; |
| 160 | 160 | ||
| 161 | AddService(new HID_U_Interface); | 161 | AddService(new HID_U_Interface); |
| @@ -174,7 +174,7 @@ void HIDInit() { | |||
| 174 | event_debug_pad = Event::Create(RESETTYPE_ONESHOT, "HID:EventDebugPad"); | 174 | event_debug_pad = Event::Create(RESETTYPE_ONESHOT, "HID:EventDebugPad"); |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | void HIDShutdown() { | 177 | void Shutdown() { |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | } // namespace HID | 180 | } // namespace HID |
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index 97462c7f8..897bd6764 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h | |||
| @@ -200,13 +200,13 @@ void EnableGyroscopeLow(Interface* self); | |||
| 200 | void GetSoundVolume(Interface* self); | 200 | void GetSoundVolume(Interface* self); |
| 201 | 201 | ||
| 202 | /// Checks for user input updates | 202 | /// Checks for user input updates |
| 203 | void HIDUpdate(); | 203 | void Update(); |
| 204 | 204 | ||
| 205 | /// Initialize HID service | 205 | /// Initialize HID service |
| 206 | void HIDInit(); | 206 | void Init(); |
| 207 | 207 | ||
| 208 | /// Shutdown HID service | 208 | /// Shutdown HID service |
| 209 | void HIDShutdown(); | 209 | void Shutdown(); |
| 210 | 210 | ||
| 211 | } | 211 | } |
| 212 | } | 212 | } |
diff --git a/src/core/hle/service/nim_u.cpp b/src/core/hle/service/nim_u.cpp new file mode 100644 index 000000000..a87d17ef0 --- /dev/null +++ b/src/core/hle/service/nim_u.cpp | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | // Copyright 2015 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "core/hle/hle.h" | ||
| 6 | #include "core/hle/service/nim_u.h" | ||
| 7 | |||
| 8 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 9 | // Namespace NIM_U | ||
| 10 | |||
| 11 | namespace NIM_U { | ||
| 12 | |||
| 13 | /** | ||
| 14 | * NIM_U::CheckSysUpdateAvailable service function | ||
| 15 | * Inputs: | ||
| 16 | * 1 : None | ||
| 17 | * Outputs: | ||
| 18 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 19 | * 2 : flag, 0 = no system update available, 1 = system update available. | ||
| 20 | */ | ||
| 21 | static void CheckSysUpdateAvailable(Service::Interface* self) { | ||
| 22 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 23 | |||
| 24 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 25 | cmd_buff[2] = 0; // No update available | ||
| 26 | |||
| 27 | LOG_WARNING(Service_NWM, "(STUBBED) called"); | ||
| 28 | } | ||
| 29 | |||
| 30 | const Interface::FunctionInfo FunctionTable[] = { | ||
| 31 | {0x00010000, nullptr, "StartSysUpdate"}, | ||
| 32 | {0x00020000, nullptr, "GetUpdateDownloadProgress"}, | ||
| 33 | {0x00040000, nullptr, "FinishTitlesInstall"}, | ||
| 34 | {0x00050000, nullptr, "CheckForSysUpdateEvent"}, | ||
| 35 | {0x00090000, CheckSysUpdateAvailable, "CheckSysUpdateAvailable"}, | ||
| 36 | {0x000A0000, nullptr, "GetState"}, | ||
| 37 | }; | ||
| 38 | |||
| 39 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 40 | // Interface class | ||
| 41 | |||
| 42 | Interface::Interface() { | ||
| 43 | Register(FunctionTable); | ||
| 44 | } | ||
| 45 | |||
| 46 | } // namespace | ||
diff --git a/src/core/hle/service/nim_u.h b/src/core/hle/service/nim_u.h new file mode 100644 index 000000000..57a1f6acf --- /dev/null +++ b/src/core/hle/service/nim_u.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | // Copyright 2015 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 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 10 | // Namespace NIM_U | ||
| 11 | |||
| 12 | namespace NIM_U { | ||
| 13 | |||
| 14 | class Interface : public Service::Interface { | ||
| 15 | public: | ||
| 16 | Interface(); | ||
| 17 | |||
| 18 | std::string GetPortName() const override { | ||
| 19 | return "nim:u"; | ||
| 20 | } | ||
| 21 | }; | ||
| 22 | |||
| 23 | } // namespace | ||
diff --git a/src/core/hle/service/nwm_uds.cpp b/src/core/hle/service/nwm_uds.cpp index 88be6c8d9..1cee81ab2 100644 --- a/src/core/hle/service/nwm_uds.cpp +++ b/src/core/hle/service/nwm_uds.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/hle/hle.h" | 5 | #include "core/hle/hle.h" |
| 6 | #include "core/hle/kernel/event.h" | ||
| 6 | #include "core/hle/service/nwm_uds.h" | 7 | #include "core/hle/service/nwm_uds.h" |
| 7 | 8 | ||
| 8 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 9 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| @@ -10,21 +11,115 @@ | |||
| 10 | 11 | ||
| 11 | namespace NWM_UDS { | 12 | namespace NWM_UDS { |
| 12 | 13 | ||
| 14 | static Kernel::SharedPtr<Kernel::Event> handle_event = nullptr; | ||
| 15 | |||
| 16 | /** | ||
| 17 | * NWM_UDS::Shutdown service function | ||
| 18 | * Inputs: | ||
| 19 | * 1 : None | ||
| 20 | * Outputs: | ||
| 21 | * 0 : Return header | ||
| 22 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 23 | */ | ||
| 24 | static void Shutdown(Service::Interface* self) { | ||
| 25 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 26 | |||
| 27 | // TODO(purpasmart): Verify return header on HW | ||
| 28 | |||
| 29 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 30 | |||
| 31 | LOG_WARNING(Service_NWM, "(STUBBED) called"); | ||
| 32 | } | ||
| 33 | |||
| 34 | /** | ||
| 35 | * NWM_UDS::RecvBeaconBroadcastData service function | ||
| 36 | * Inputs: | ||
| 37 | * 1 : Output buffer max size | ||
| 38 | * 2 : Unknown | ||
| 39 | * 3 : Unknown | ||
| 40 | * 4 : MAC address? | ||
| 41 | * 6-14 : Unknown, usually zero / uninitialized? | ||
| 42 | * 15 : WLan Comm ID | ||
| 43 | * 16 : This is the ID also located at offset 0xE in the CTR-generation structure. | ||
| 44 | * 17 : Value 0 | ||
| 45 | * 18 : Input handle | ||
| 46 | * 19 : (Size<<4) | 12 | ||
| 47 | * 20 : Output buffer ptr | ||
| 48 | * Outputs: | ||
| 49 | * 0 : Return header | ||
| 50 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 51 | */ | ||
| 52 | static void RecvBeaconBroadcastData(Service::Interface* self) { | ||
| 53 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 54 | u32 out_buffer_size = cmd_buff[1]; | ||
| 55 | u32 unk1 = cmd_buff[2]; | ||
| 56 | u32 unk2 = cmd_buff[3]; | ||
| 57 | u32 mac_address = cmd_buff[4]; | ||
| 58 | |||
| 59 | u32 unk3 = cmd_buff[6]; | ||
| 60 | |||
| 61 | u32 wlan_comm_id = cmd_buff[15]; | ||
| 62 | u32 ctr_gen_id = cmd_buff[16]; | ||
| 63 | u32 value = cmd_buff[17]; | ||
| 64 | u32 input_handle = cmd_buff[18]; | ||
| 65 | u32 new_buffer_size = cmd_buff[19]; | ||
| 66 | u32 out_buffer_ptr = cmd_buff[20]; | ||
| 67 | |||
| 68 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 69 | |||
| 70 | LOG_WARNING(Service_NWM, "(STUBBED) called out_buffer_size=0x%08X, unk1=0x%08X, unk2=0x%08X," | ||
| 71 | "mac_address=0x%08X, unk3=0x%08X, wlan_comm_id=0x%08X, ctr_gen_id=0x%08X," | ||
| 72 | "value=%u, input_handle=0x%08X, new_buffer_size=0x%08X, out_buffer_ptr=0x%08X", | ||
| 73 | out_buffer_size, unk1, unk2, mac_address, unk3, wlan_comm_id, ctr_gen_id, value, | ||
| 74 | input_handle, new_buffer_size, out_buffer_ptr); | ||
| 75 | } | ||
| 76 | |||
| 77 | /** | ||
| 78 | * NWM_UDS::Initialize service function | ||
| 79 | * Inputs: | ||
| 80 | * 1 : Unknown | ||
| 81 | * 2-11 : Input Structure | ||
| 82 | * 12 : Unknown u16 | ||
| 83 | * 13 : Value 0 | ||
| 84 | * 14 : Handle | ||
| 85 | * Outputs: | ||
| 86 | * 0 : Return header | ||
| 87 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 88 | * 2 : Value 0 | ||
| 89 | * 3 : Output handle | ||
| 90 | */ | ||
| 91 | static void Initialize(Service::Interface* self) { | ||
| 92 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 93 | u32 unk1 = cmd_buff[1]; | ||
| 94 | u32 unk2 = cmd_buff[12]; | ||
| 95 | u32 value = cmd_buff[13]; | ||
| 96 | u32 handle = cmd_buff[14]; | ||
| 97 | |||
| 98 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 99 | cmd_buff[2] = 0; | ||
| 100 | cmd_buff[3] = Kernel::g_handle_table.Create(handle_event).MoveFrom(); //TODO(purpasmart): Verify if this is a event handle | ||
| 101 | |||
| 102 | LOG_WARNING(Service_NWM, "(STUBBED) called unk1=0x%08X, unk2=0x%08X, value=%u, handle=0x%08X", | ||
| 103 | unk1, unk2, value, handle); | ||
| 104 | } | ||
| 105 | |||
| 13 | const Interface::FunctionInfo FunctionTable[] = { | 106 | const Interface::FunctionInfo FunctionTable[] = { |
| 14 | {0x00030000, nullptr, "Shutdown"}, | 107 | {0x00030000, Shutdown, "Shutdown"}, |
| 15 | {0x000F0404, nullptr, "RecvBeaconBroadcastData"}, | 108 | {0x000F0404, RecvBeaconBroadcastData, "RecvBeaconBroadcastData"}, |
| 16 | {0x00100042, nullptr, "SetBeaconAdditionalData"}, | 109 | {0x00100042, nullptr, "SetBeaconAdditionalData"}, |
| 17 | {0x001400C0, nullptr, "RecvBroadcastDataFrame"}, | 110 | {0x001400C0, nullptr, "RecvBroadcastDataFrame"}, |
| 18 | {0x001B0302, nullptr, "Initialize"}, | 111 | {0x001B0302, Initialize, "Initialize"}, |
| 19 | {0x001D0044, nullptr, "BeginHostingNetwork"}, | 112 | {0x001D0044, nullptr, "BeginHostingNetwork"}, |
| 20 | {0x001E0084, nullptr, "ConnectToNetwork"}, | 113 | {0x001E0084, nullptr, "ConnectToNetwork"}, |
| 21 | {0x001F0006, nullptr, "DecryptBeaconData"}, | 114 | {0x001F0006, nullptr, "DecryptBeaconData"}, |
| 22 | }; | 115 | }; |
| 23 | 116 | ||
| 24 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 117 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 25 | // Interface class | 118 | // Interface class |
| 26 | 119 | ||
| 27 | Interface::Interface() { | 120 | Interface::Interface() { |
| 121 | handle_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "NWM_UDS::handle_event"); | ||
| 122 | |||
| 28 | Register(FunctionTable); | 123 | Register(FunctionTable); |
| 29 | } | 124 | } |
| 30 | 125 | ||
diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp index 56c918d4f..57a301bec 100644 --- a/src/core/hle/service/ptm/ptm.cpp +++ b/src/core/hle/service/ptm/ptm.cpp | |||
| @@ -38,7 +38,7 @@ ChargeLevels GetBatteryLevel() { | |||
| 38 | return ChargeLevels::CompletelyFull; // Set to a completely full battery | 38 | return ChargeLevels::CompletelyFull; // Set to a completely full battery |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | void PTMInit() { | 41 | void Init() { |
| 42 | AddService(new PTM_Play_Interface); | 42 | AddService(new PTM_Play_Interface); |
| 43 | AddService(new PTM_Sysm_Interface); | 43 | AddService(new PTM_Sysm_Interface); |
| 44 | AddService(new PTM_U_Interface); | 44 | AddService(new PTM_U_Interface); |
| @@ -68,7 +68,7 @@ void PTMInit() { | |||
| 68 | } | 68 | } |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | void PTMShutdown() { | 71 | void Shutdown() { |
| 72 | 72 | ||
| 73 | } | 73 | } |
| 74 | 74 | ||
diff --git a/src/core/hle/service/ptm/ptm.h b/src/core/hle/service/ptm/ptm.h index f697aae4d..3c776aa8a 100644 --- a/src/core/hle/service/ptm/ptm.h +++ b/src/core/hle/service/ptm/ptm.h | |||
| @@ -56,10 +56,10 @@ u32 GetShellState(); | |||
| 56 | ChargeLevels GetBatteryLevel(); | 56 | ChargeLevels GetBatteryLevel(); |
| 57 | 57 | ||
| 58 | /// Initialize the PTM service | 58 | /// Initialize the PTM service |
| 59 | void PTMInit(); | 59 | void Init(); |
| 60 | 60 | ||
| 61 | /// Shutdown the PTM service | 61 | /// Shutdown the PTM service |
| 62 | void PTMShutdown(); | 62 | void Shutdown(); |
| 63 | 63 | ||
| 64 | } // namespace PTM | 64 | } // namespace PTM |
| 65 | } // namespace Service | 65 | } // namespace Service |
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 91f13cd7e..eeb404659 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include "core/hle/service/news_s.h" | 32 | #include "core/hle/service/news_s.h" |
| 33 | #include "core/hle/service/news_u.h" | 33 | #include "core/hle/service/news_u.h" |
| 34 | #include "core/hle/service/nim_aoc.h" | 34 | #include "core/hle/service/nim_aoc.h" |
| 35 | #include "core/hle/service/nim_u.h" | ||
| 35 | #include "core/hle/service/ns_s.h" | 36 | #include "core/hle/service/ns_s.h" |
| 36 | #include "core/hle/service/nwm_uds.h" | 37 | #include "core/hle/service/nwm_uds.h" |
| 37 | #include "core/hle/service/pm_app.h" | 38 | #include "core/hle/service/pm_app.h" |
| @@ -68,10 +69,10 @@ void Init() { | |||
| 68 | AddNamedPort(new ERR_F::Interface); | 69 | AddNamedPort(new ERR_F::Interface); |
| 69 | 70 | ||
| 70 | Service::FS::ArchiveInit(); | 71 | Service::FS::ArchiveInit(); |
| 71 | Service::CFG::CFGInit(); | 72 | Service::CFG::Init(); |
| 72 | Service::APT::APTInit(); | 73 | Service::APT::Init(); |
| 73 | Service::PTM::PTMInit(); | 74 | Service::PTM::Init(); |
| 74 | Service::HID::HIDInit(); | 75 | Service::HID::Init(); |
| 75 | 76 | ||
| 76 | AddService(new AC_U::Interface); | 77 | AddService(new AC_U::Interface); |
| 77 | AddService(new ACT_U::Interface); | 78 | AddService(new ACT_U::Interface); |
| @@ -98,6 +99,7 @@ void Init() { | |||
| 98 | AddService(new NEWS_S::Interface); | 99 | AddService(new NEWS_S::Interface); |
| 99 | AddService(new NEWS_U::Interface); | 100 | AddService(new NEWS_U::Interface); |
| 100 | AddService(new NIM_AOC::Interface); | 101 | AddService(new NIM_AOC::Interface); |
| 102 | AddService(new NIM_U::Interface); | ||
| 101 | AddService(new NS_S::Interface); | 103 | AddService(new NS_S::Interface); |
| 102 | AddService(new NWM_UDS::Interface); | 104 | AddService(new NWM_UDS::Interface); |
| 103 | AddService(new PM_APP::Interface); | 105 | AddService(new PM_APP::Interface); |
| @@ -110,10 +112,10 @@ void Init() { | |||
| 110 | 112 | ||
| 111 | /// Shutdown ServiceManager | 113 | /// Shutdown ServiceManager |
| 112 | void Shutdown() { | 114 | void Shutdown() { |
| 113 | Service::HID::HIDShutdown(); | 115 | Service::HID::Shutdown(); |
| 114 | Service::PTM::PTMShutdown(); | 116 | Service::PTM::Shutdown(); |
| 115 | Service::APT::APTShutdown(); | 117 | Service::APT::Shutdown(); |
| 116 | Service::CFG::CFGShutdown(); | 118 | Service::CFG::Shutdown(); |
| 117 | Service::FS::ArchiveShutdown(); | 119 | Service::FS::ArchiveShutdown(); |
| 118 | 120 | ||
| 119 | g_srv_services.clear(); | 121 | g_srv_services.clear(); |
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp index e6983a225..75e040b24 100644 --- a/src/core/hw/gpu.cpp +++ b/src/core/hw/gpu.cpp | |||
| @@ -312,7 +312,7 @@ static void VBlankCallback(u64 userdata, int cycles_late) { | |||
| 312 | DSP_DSP::SignalInterrupt(); | 312 | DSP_DSP::SignalInterrupt(); |
| 313 | 313 | ||
| 314 | // Check for user input updates | 314 | // Check for user input updates |
| 315 | Service::HID::HIDUpdate(); | 315 | Service::HID::Update(); |
| 316 | 316 | ||
| 317 | // Reschedule recurrent event | 317 | // Reschedule recurrent event |
| 318 | CoreTiming::ScheduleEvent(frame_ticks - cycles_late, vblank_event); | 318 | CoreTiming::ScheduleEvent(frame_ticks - cycles_late, vblank_event); |