diff options
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/applets/applet.cpp | 9 | ||||
| -rw-r--r-- | src/core/hle/applets/applet.h | 3 | ||||
| -rw-r--r-- | src/core/hle/function_wrappers.h | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 1 | ||||
| -rw-r--r-- | src/core/hle/service/am/am_net.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/service/apt/apt.cpp | 53 | ||||
| -rw-r--r-- | src/core/hle/service/apt/apt.h | 30 | ||||
| -rw-r--r-- | src/core/hle/service/apt/apt_a.cpp | 1 | ||||
| -rw-r--r-- | src/core/hle/service/apt/apt_s.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/apt/apt_u.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/gsp_gpu.cpp | 38 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.h | 5 | ||||
| -rw-r--r-- | src/core/hle/service/soc_u.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/svc.cpp | 4 |
16 files changed, 138 insertions, 39 deletions
diff --git a/src/core/hle/applets/applet.cpp b/src/core/hle/applets/applet.cpp index 826f6cbb6..bc2a1829e 100644 --- a/src/core/hle/applets/applet.cpp +++ b/src/core/hle/applets/applet.cpp | |||
| @@ -89,12 +89,21 @@ ResultCode Applet::Start(const Service::APT::AppletStartupParameter& parameter) | |||
| 89 | return result; | 89 | return result; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | bool IsLibraryAppletRunning() { | ||
| 93 | // Check the applets map for instances of any applet | ||
| 94 | for (auto itr = applets.begin(); itr != applets.end(); ++itr) | ||
| 95 | if (itr->second != nullptr) | ||
| 96 | return true; | ||
| 97 | return false; | ||
| 98 | } | ||
| 99 | |||
| 92 | void Init() { | 100 | void Init() { |
| 93 | // Register the applet update callback | 101 | // Register the applet update callback |
| 94 | applet_update_event = CoreTiming::RegisterEvent("HLE Applet Update Event", AppletUpdateEvent); | 102 | applet_update_event = CoreTiming::RegisterEvent("HLE Applet Update Event", AppletUpdateEvent); |
| 95 | } | 103 | } |
| 96 | 104 | ||
| 97 | void Shutdown() { | 105 | void Shutdown() { |
| 106 | CoreTiming::RemoveEvent(applet_update_event); | ||
| 98 | } | 107 | } |
| 99 | 108 | ||
| 100 | } | 109 | } |
diff --git a/src/core/hle/applets/applet.h b/src/core/hle/applets/applet.h index b235d0b8a..af442f81d 100644 --- a/src/core/hle/applets/applet.h +++ b/src/core/hle/applets/applet.h | |||
| @@ -67,6 +67,9 @@ protected: | |||
| 67 | Service::APT::AppletId id; ///< Id of this Applet | 67 | Service::APT::AppletId id; ///< Id of this Applet |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | /// Returns whether a library applet is currently running | ||
| 71 | bool IsLibraryAppletRunning(); | ||
| 72 | |||
| 70 | /// Initializes the HLE applets | 73 | /// Initializes the HLE applets |
| 71 | void Init(); | 74 | void Init(); |
| 72 | 75 | ||
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h index 9294789ec..1a0518926 100644 --- a/src/core/hle/function_wrappers.h +++ b/src/core/hle/function_wrappers.h | |||
| @@ -133,7 +133,7 @@ template<ResultCode func(u32)> void Wrap() { | |||
| 133 | FuncReturn(func(PARAM(0)).raw); | 133 | FuncReturn(func(PARAM(0)).raw); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | template<ResultCode func(s64*, u32, u32*, s32)> void Wrap(){ | 136 | template<ResultCode func(s64*, u32, u32*, u32)> void Wrap(){ |
| 137 | FuncReturn(func((s64*)Memory::GetPointer(PARAM(0)), PARAM(1), (u32*)Memory::GetPointer(PARAM(2)), | 137 | FuncReturn(func((s64*)Memory::GetPointer(PARAM(0)), PARAM(1), (u32*)Memory::GetPointer(PARAM(2)), |
| 138 | (s32)PARAM(3)).raw); | 138 | (s32)PARAM(3)).raw); |
| 139 | } | 139 | } |
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 8b49fc7df..29ea6d531 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #include "common/thread_queue_list.h" | 13 | #include "common/thread_queue_list.h" |
| 14 | 14 | ||
| 15 | #include "core/arm/arm_interface.h" | 15 | #include "core/arm/arm_interface.h" |
| 16 | #include "core/arm/skyeye_common/armdefs.h" | 16 | #include "core/arm/skyeye_common/armstate.h" |
| 17 | #include "core/core.h" | 17 | #include "core/core.h" |
| 18 | #include "core/core_timing.h" | 18 | #include "core/core_timing.h" |
| 19 | #include "core/hle/hle.h" | 19 | #include "core/hle/hle.h" |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 7332478fb..64f3bc7e9 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 6 | 6 | ||
| 7 | #include "core/hle/service/service.h" | 7 | #include "core/hle/service/service.h" |
| 8 | #include "core/hle/service/am/am.h" | ||
| 8 | #include "core/hle/service/am/am_app.h" | 9 | #include "core/hle/service/am/am_app.h" |
| 9 | #include "core/hle/service/am/am_net.h" | 10 | #include "core/hle/service/am/am_net.h" |
| 10 | #include "core/hle/service/am/am_sys.h" | 11 | #include "core/hle/service/am/am_sys.h" |
diff --git a/src/core/hle/service/am/am_net.cpp b/src/core/hle/service/am/am_net.cpp index b1af0e9d8..aa391f3b2 100644 --- a/src/core/hle/service/am/am_net.cpp +++ b/src/core/hle/service/am/am_net.cpp | |||
| @@ -28,7 +28,8 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 28 | {0x08130000, nullptr, "GetTotalContents"}, | 28 | {0x08130000, nullptr, "GetTotalContents"}, |
| 29 | {0x08140042, nullptr, "GetContentIndexes"}, | 29 | {0x08140042, nullptr, "GetContentIndexes"}, |
| 30 | {0x08150044, nullptr, "GetContentsInfo"}, | 30 | {0x08150044, nullptr, "GetContentsInfo"}, |
| 31 | {0x08190108, nullptr, "Unknown"}, | 31 | {0x08180042, nullptr, "GetCTCert"}, |
| 32 | {0x08190108, nullptr, "SetCertificates"}, | ||
| 32 | {0x081B00C2, nullptr, "InstallTitlesFinish"}, | 33 | {0x081B00C2, nullptr, "InstallTitlesFinish"}, |
| 33 | }; | 34 | }; |
| 34 | 35 | ||
diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 7b6ab4ce0..35402341b 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp | |||
| @@ -101,18 +101,19 @@ void NotifyToWait(Service::Interface* self) { | |||
| 101 | 101 | ||
| 102 | void GetLockHandle(Service::Interface* self) { | 102 | void GetLockHandle(Service::Interface* self) { |
| 103 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 103 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 104 | u32 flags = cmd_buff[1]; // TODO(bunnei): Figure out the purpose of the flag field | 104 | // Bits [0:2] are the applet type (System, Library, etc) |
| 105 | // Bit 5 tells the application that there's a pending APT parameter, | ||
| 106 | // this will cause the app to wait until parameter_event is signaled. | ||
| 107 | u32 applet_attributes = cmd_buff[1]; | ||
| 105 | 108 | ||
| 106 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | 109 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error |
| 107 | 110 | ||
| 108 | // Not sure what these parameters are used for, but retail apps check that they are 0 after | 111 | cmd_buff[2] = applet_attributes; // Applet Attributes, this value is passed to Enable. |
| 109 | // GetLockHandle has been called. | 112 | cmd_buff[3] = 0; // Least significant bit = power button state |
| 110 | cmd_buff[2] = 0; // Applet Attributes, this value is passed to Enable. | 113 | cmd_buff[4] = IPC::CopyHandleDesc(); |
| 111 | cmd_buff[3] = 0; | ||
| 112 | cmd_buff[4] = 0; | ||
| 113 | |||
| 114 | cmd_buff[5] = Kernel::g_handle_table.Create(lock).MoveFrom(); | 114 | cmd_buff[5] = Kernel::g_handle_table.Create(lock).MoveFrom(); |
| 115 | LOG_TRACE(Service_APT, "called handle=0x%08X", cmd_buff[5]); | 115 | |
| 116 | LOG_WARNING(Service_APT, "(STUBBED) called handle=0x%08X applet_attributes=0x%08X", cmd_buff[5], applet_attributes); | ||
| 116 | } | 117 | } |
| 117 | 118 | ||
| 118 | void Enable(Service::Interface* self) { | 119 | void Enable(Service::Interface* self) { |
| @@ -139,13 +140,16 @@ void IsRegistered(Service::Interface* self) { | |||
| 139 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 140 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 140 | u32 app_id = cmd_buff[1]; | 141 | u32 app_id = cmd_buff[1]; |
| 141 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | 142 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error |
| 142 | /// TODO(Subv): It is currently unknown what this value (0x400) means, | 143 | |
| 143 | /// but i believe it is used as a global "LibraryApplet" id, to verify if there's | 144 | // TODO(Subv): An application is considered "registered" if it has already called APT::Enable |
| 144 | /// any LibApplet currently running. This is not verified. | 145 | // handle this properly once we implement multiprocess support. |
| 145 | if (app_id != 0x400) | 146 | cmd_buff[2] = 0; // Set to not registered by default |
| 147 | |||
| 148 | if (app_id == static_cast<u32>(AppletId::AnyLibraryApplet)) { | ||
| 149 | cmd_buff[2] = HLE::Applets::IsLibraryAppletRunning() ? 1 : 0; | ||
| 150 | } else if (auto applet = HLE::Applets::Applet::Get(static_cast<AppletId>(app_id))) { | ||
| 146 | cmd_buff[2] = 1; // Set to registered | 151 | cmd_buff[2] = 1; // Set to registered |
| 147 | else | 152 | } |
| 148 | cmd_buff[2] = 0; // Set to not registered | ||
| 149 | LOG_WARNING(Service_APT, "(STUBBED) called app_id=0x%08X", app_id); | 153 | LOG_WARNING(Service_APT, "(STUBBED) called app_id=0x%08X", app_id); |
| 150 | } | 154 | } |
| 151 | 155 | ||
| @@ -330,7 +334,26 @@ void GetAppCpuTimeLimit(Service::Interface* self) { | |||
| 330 | void PrepareToStartLibraryApplet(Service::Interface* self) { | 334 | void PrepareToStartLibraryApplet(Service::Interface* self) { |
| 331 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 335 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 332 | AppletId applet_id = static_cast<AppletId>(cmd_buff[1]); | 336 | AppletId applet_id = static_cast<AppletId>(cmd_buff[1]); |
| 333 | cmd_buff[1] = HLE::Applets::Applet::Create(applet_id).raw; | 337 | auto applet = HLE::Applets::Applet::Get(applet_id); |
| 338 | if (applet) { | ||
| 339 | LOG_WARNING(Service_APT, "applet has already been started id=%08X", applet_id); | ||
| 340 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 341 | } else { | ||
| 342 | cmd_buff[1] = HLE::Applets::Applet::Create(applet_id).raw; | ||
| 343 | } | ||
| 344 | LOG_DEBUG(Service_APT, "called applet_id=%08X", applet_id); | ||
| 345 | } | ||
| 346 | |||
| 347 | void PreloadLibraryApplet(Service::Interface* self) { | ||
| 348 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 349 | AppletId applet_id = static_cast<AppletId>(cmd_buff[1]); | ||
| 350 | auto applet = HLE::Applets::Applet::Get(applet_id); | ||
| 351 | if (applet) { | ||
| 352 | LOG_WARNING(Service_APT, "applet has already been started id=%08X", applet_id); | ||
| 353 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 354 | } else { | ||
| 355 | cmd_buff[1] = HLE::Applets::Applet::Create(applet_id).raw; | ||
| 356 | } | ||
| 334 | LOG_DEBUG(Service_APT, "called applet_id=%08X", applet_id); | 357 | LOG_DEBUG(Service_APT, "called applet_id=%08X", applet_id); |
| 335 | } | 358 | } |
| 336 | 359 | ||
diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index 72972d05b..4a72b6b5c 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h | |||
| @@ -62,6 +62,7 @@ enum class AppletId : u32 { | |||
| 62 | Extrapad = 0x208, | 62 | Extrapad = 0x208, |
| 63 | Memolib = 0x209, | 63 | Memolib = 0x209, |
| 64 | Application = 0x300, | 64 | Application = 0x300, |
| 65 | AnyLibraryApplet = 0x400, | ||
| 65 | SoftwareKeyboard2 = 0x401, | 66 | SoftwareKeyboard2 = 0x401, |
| 66 | }; | 67 | }; |
| 67 | 68 | ||
| @@ -96,8 +97,26 @@ void GetSharedFont(Service::Interface* self); | |||
| 96 | */ | 97 | */ |
| 97 | void NotifyToWait(Service::Interface* self); | 98 | void NotifyToWait(Service::Interface* self); |
| 98 | 99 | ||
| 100 | /** | ||
| 101 | * APT::GetLockHandle service function | ||
| 102 | * Inputs: | ||
| 103 | * 1 : Applet attributes | ||
| 104 | * Outputs: | ||
| 105 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 106 | * 2 : Applet attributes | ||
| 107 | * 3 : Power button state | ||
| 108 | * 4 : IPC handle descriptor | ||
| 109 | * 5 : APT mutex handle | ||
| 110 | */ | ||
| 99 | void GetLockHandle(Service::Interface* self); | 111 | void GetLockHandle(Service::Interface* self); |
| 100 | 112 | ||
| 113 | /** | ||
| 114 | * APT::Enable service function | ||
| 115 | * Inputs: | ||
| 116 | * 1 : Applet attributes | ||
| 117 | * Outputs: | ||
| 118 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 119 | */ | ||
| 101 | void Enable(Service::Interface* self); | 120 | void Enable(Service::Interface* self); |
| 102 | 121 | ||
| 103 | /** | 122 | /** |
| @@ -284,6 +303,17 @@ void GetAppCpuTimeLimit(Service::Interface* self); | |||
| 284 | void PrepareToStartLibraryApplet(Service::Interface* self); | 303 | void PrepareToStartLibraryApplet(Service::Interface* self); |
| 285 | 304 | ||
| 286 | /** | 305 | /** |
| 306 | * APT::PreloadLibraryApplet service function | ||
| 307 | * Inputs: | ||
| 308 | * 0 : Command header [0x00160040] | ||
| 309 | * 1 : Id of the applet to start | ||
| 310 | * Outputs: | ||
| 311 | * 0 : Return header | ||
| 312 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 313 | */ | ||
| 314 | void PreloadLibraryApplet(Service::Interface* self); | ||
| 315 | |||
| 316 | /** | ||
| 287 | * APT::StartLibraryApplet service function | 317 | * APT::StartLibraryApplet service function |
| 288 | * Inputs: | 318 | * Inputs: |
| 289 | * 0 : Command header [0x001E0084] | 319 | * 0 : Command header [0x001E0084] |
diff --git a/src/core/hle/service/apt/apt_a.cpp b/src/core/hle/service/apt/apt_a.cpp index 88de339f9..22800c56f 100644 --- a/src/core/hle/service/apt/apt_a.cpp +++ b/src/core/hle/service/apt/apt_a.cpp | |||
| @@ -21,6 +21,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 21 | {0x000D0080, ReceiveParameter, "ReceiveParameter"}, | 21 | {0x000D0080, ReceiveParameter, "ReceiveParameter"}, |
| 22 | {0x000E0080, GlanceParameter, "GlanceParameter"}, | 22 | {0x000E0080, GlanceParameter, "GlanceParameter"}, |
| 23 | {0x000F0100, CancelParameter, "CancelParameter"}, | 23 | {0x000F0100, CancelParameter, "CancelParameter"}, |
| 24 | {0x00160040, PreloadLibraryApplet, "PreloadLibraryApplet"}, | ||
| 24 | {0x00180040, PrepareToStartLibraryApplet, "PrepareToStartLibraryApplet"}, | 25 | {0x00180040, PrepareToStartLibraryApplet, "PrepareToStartLibraryApplet"}, |
| 25 | {0x001E0084, StartLibraryApplet, "StartLibraryApplet"}, | 26 | {0x001E0084, StartLibraryApplet, "StartLibraryApplet"}, |
| 26 | {0x003B0040, nullptr, "CancelLibraryApplet?"}, | 27 | {0x003B0040, nullptr, "CancelLibraryApplet?"}, |
diff --git a/src/core/hle/service/apt/apt_s.cpp b/src/core/hle/service/apt/apt_s.cpp index 396d1f04a..3ac6ff94f 100644 --- a/src/core/hle/service/apt/apt_s.cpp +++ b/src/core/hle/service/apt/apt_s.cpp | |||
| @@ -32,9 +32,9 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 32 | {0x00130000, nullptr, "GetPreparationState"}, | 32 | {0x00130000, nullptr, "GetPreparationState"}, |
| 33 | {0x00140040, nullptr, "SetPreparationState"}, | 33 | {0x00140040, nullptr, "SetPreparationState"}, |
| 34 | {0x00150140, nullptr, "PrepareToStartApplication"}, | 34 | {0x00150140, nullptr, "PrepareToStartApplication"}, |
| 35 | {0x00160040, nullptr, "PreloadLibraryApplet"}, | 35 | {0x00160040, PreloadLibraryApplet, "PreloadLibraryApplet"}, |
| 36 | {0x00170040, nullptr, "FinishPreloadingLibraryApplet"}, | 36 | {0x00170040, nullptr, "FinishPreloadingLibraryApplet"}, |
| 37 | {0x00180040, nullptr, "PrepareToStartLibraryApplet"}, | 37 | {0x00180040, PrepareToStartLibraryApplet,"PrepareToStartLibraryApplet"}, |
| 38 | {0x00190040, nullptr, "PrepareToStartSystemApplet"}, | 38 | {0x00190040, nullptr, "PrepareToStartSystemApplet"}, |
| 39 | {0x001A0000, nullptr, "PrepareToStartNewestHomeMenu"}, | 39 | {0x001A0000, nullptr, "PrepareToStartNewestHomeMenu"}, |
| 40 | {0x001B00C4, nullptr, "StartApplication"}, | 40 | {0x001B00C4, nullptr, "StartApplication"}, |
diff --git a/src/core/hle/service/apt/apt_u.cpp b/src/core/hle/service/apt/apt_u.cpp index b724cd72b..146bfd595 100644 --- a/src/core/hle/service/apt/apt_u.cpp +++ b/src/core/hle/service/apt/apt_u.cpp | |||
| @@ -33,7 +33,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 33 | {0x00130000, nullptr, "GetPreparationState"}, | 33 | {0x00130000, nullptr, "GetPreparationState"}, |
| 34 | {0x00140040, nullptr, "SetPreparationState"}, | 34 | {0x00140040, nullptr, "SetPreparationState"}, |
| 35 | {0x00150140, nullptr, "PrepareToStartApplication"}, | 35 | {0x00150140, nullptr, "PrepareToStartApplication"}, |
| 36 | {0x00160040, nullptr, "PreloadLibraryApplet"}, | 36 | {0x00160040, PreloadLibraryApplet, "PreloadLibraryApplet"}, |
| 37 | {0x00170040, nullptr, "FinishPreloadingLibraryApplet"}, | 37 | {0x00170040, nullptr, "FinishPreloadingLibraryApplet"}, |
| 38 | {0x00180040, PrepareToStartLibraryApplet, "PrepareToStartLibraryApplet"}, | 38 | {0x00180040, PrepareToStartLibraryApplet, "PrepareToStartLibraryApplet"}, |
| 39 | {0x00190040, nullptr, "PrepareToStartSystemApplet"}, | 39 | {0x00190040, nullptr, "PrepareToStartSystemApplet"}, |
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index 8b40ba376..e93c1b436 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include "core/hw/lcd.h" | 14 | #include "core/hw/lcd.h" |
| 15 | 15 | ||
| 16 | #include "video_core/gpu_debugger.h" | 16 | #include "video_core/gpu_debugger.h" |
| 17 | #include "video_core/debug_utils/debug_utils.h" | ||
| 17 | #include "video_core/renderer_base.h" | 18 | #include "video_core/renderer_base.h" |
| 18 | #include "video_core/video_core.h" | 19 | #include "video_core/video_core.h" |
| 19 | 20 | ||
| @@ -226,6 +227,9 @@ void SetBufferSwap(u32 screen_id, const FrameBufferInfo& info) { | |||
| 226 | &info.format); | 227 | &info.format); |
| 227 | WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].active_fb)), 4, | 228 | WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].active_fb)), 4, |
| 228 | &info.shown_fb); | 229 | &info.shown_fb); |
| 230 | |||
| 231 | if (Pica::g_debug_context) | ||
| 232 | Pica::g_debug_context->OnEvent(Pica::DebugContext::Event::BufferSwapped, nullptr); | ||
| 229 | } | 233 | } |
| 230 | 234 | ||
| 231 | /** | 235 | /** |
| @@ -391,19 +395,24 @@ static void ExecuteCommand(const Command& command, u32 thread_id) { | |||
| 391 | case CommandId::SET_MEMORY_FILL: | 395 | case CommandId::SET_MEMORY_FILL: |
| 392 | { | 396 | { |
| 393 | auto& params = command.memory_fill; | 397 | auto& params = command.memory_fill; |
| 394 | WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(memory_fill_config[0].address_start)), | 398 | |
| 395 | Memory::VirtualToPhysicalAddress(params.start1) >> 3); | 399 | if (params.start1 != 0) { |
| 396 | WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(memory_fill_config[0].address_end)), | 400 | WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(memory_fill_config[0].address_start)), |
| 397 | Memory::VirtualToPhysicalAddress(params.end1) >> 3); | 401 | Memory::VirtualToPhysicalAddress(params.start1) >> 3); |
| 398 | WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(memory_fill_config[0].value_32bit)), params.value1); | 402 | WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(memory_fill_config[0].address_end)), |
| 399 | WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(memory_fill_config[0].control)), params.control1); | 403 | Memory::VirtualToPhysicalAddress(params.end1) >> 3); |
| 400 | 404 | WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(memory_fill_config[0].value_32bit)), params.value1); | |
| 401 | WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(memory_fill_config[1].address_start)), | 405 | WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(memory_fill_config[0].control)), params.control1); |
| 402 | Memory::VirtualToPhysicalAddress(params.start2) >> 3); | 406 | } |
| 403 | WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(memory_fill_config[1].address_end)), | 407 | |
| 404 | Memory::VirtualToPhysicalAddress(params.end2) >> 3); | 408 | if (params.start2 != 0) { |
| 405 | WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(memory_fill_config[1].value_32bit)), params.value2); | 409 | WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(memory_fill_config[1].address_start)), |
| 406 | WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(memory_fill_config[1].control)), params.control2); | 410 | Memory::VirtualToPhysicalAddress(params.start2) >> 3); |
| 411 | WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(memory_fill_config[1].address_end)), | ||
| 412 | Memory::VirtualToPhysicalAddress(params.end2) >> 3); | ||
| 413 | WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(memory_fill_config[1].value_32bit)), params.value2); | ||
| 414 | WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(memory_fill_config[1].control)), params.control2); | ||
| 415 | } | ||
| 407 | break; | 416 | break; |
| 408 | } | 417 | } |
| 409 | 418 | ||
| @@ -448,6 +457,9 @@ static void ExecuteCommand(const Command& command, u32 thread_id) { | |||
| 448 | default: | 457 | default: |
| 449 | LOG_ERROR(Service_GSP, "unknown command 0x%08X", (int)command.id.Value()); | 458 | LOG_ERROR(Service_GSP, "unknown command 0x%08X", (int)command.id.Value()); |
| 450 | } | 459 | } |
| 460 | |||
| 461 | if (Pica::g_debug_context) | ||
| 462 | Pica::g_debug_context->OnEvent(Pica::DebugContext::Event::GSPCommandProcessed, (void*)&command); | ||
| 451 | } | 463 | } |
| 452 | 464 | ||
| 453 | /** | 465 | /** |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 70caa7d80..c35b13b25 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -35,6 +35,16 @@ static Kernel::SharedPtr<Kernel::Event> event_debug_pad; | |||
| 35 | static u32 next_pad_index; | 35 | static u32 next_pad_index; |
| 36 | static u32 next_touch_index; | 36 | static u32 next_touch_index; |
| 37 | 37 | ||
| 38 | const std::array<Service::HID::PadState, Settings::NativeInput::NUM_INPUTS> pad_mapping = { | ||
| 39 | Service::HID::PAD_A, Service::HID::PAD_B, Service::HID::PAD_X, Service::HID::PAD_Y, | ||
| 40 | Service::HID::PAD_L, Service::HID::PAD_R, Service::HID::PAD_ZL, Service::HID::PAD_ZR, | ||
| 41 | Service::HID::PAD_START, Service::HID::PAD_SELECT, Service::HID::PAD_NONE, | ||
| 42 | Service::HID::PAD_UP, Service::HID::PAD_DOWN, Service::HID::PAD_LEFT, Service::HID::PAD_RIGHT, | ||
| 43 | Service::HID::PAD_CIRCLE_UP, Service::HID::PAD_CIRCLE_DOWN, Service::HID::PAD_CIRCLE_LEFT, Service::HID::PAD_CIRCLE_RIGHT, | ||
| 44 | Service::HID::PAD_C_UP, Service::HID::PAD_C_DOWN, Service::HID::PAD_C_LEFT, Service::HID::PAD_C_RIGHT | ||
| 45 | }; | ||
| 46 | |||
| 47 | |||
| 38 | // TODO(peachum): | 48 | // TODO(peachum): |
| 39 | // Add a method for setting analog input from joystick device for the circle Pad. | 49 | // Add a method for setting analog input from joystick device for the circle Pad. |
| 40 | // | 50 | // |
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index d50d479f8..517f4f2ae 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #ifndef _MSC_VER | 9 | #ifndef _MSC_VER |
| 10 | #include <cstddef> | 10 | #include <cstddef> |
| 11 | #endif | 11 | #endif |
| 12 | 12 | #include "core/settings.h" | |
| 13 | #include "common/bit_field.h" | 13 | #include "common/bit_field.h" |
| 14 | #include "common/common_funcs.h" | 14 | #include "common/common_funcs.h" |
| 15 | #include "common/common_types.h" | 15 | #include "common/common_types.h" |
| @@ -157,6 +157,9 @@ const PadState PAD_CIRCLE_LEFT = {{1u << 29}}; | |||
| 157 | const PadState PAD_CIRCLE_UP = {{1u << 30}}; | 157 | const PadState PAD_CIRCLE_UP = {{1u << 30}}; |
| 158 | const PadState PAD_CIRCLE_DOWN = {{1u << 31}}; | 158 | const PadState PAD_CIRCLE_DOWN = {{1u << 31}}; |
| 159 | 159 | ||
| 160 | |||
| 161 | extern const std::array<Service::HID::PadState, Settings::NativeInput::NUM_INPUTS> pad_mapping; | ||
| 162 | |||
| 160 | /** | 163 | /** |
| 161 | * HID::GetIPCHandles service function | 164 | * HID::GetIPCHandles service function |
| 162 | * Inputs: | 165 | * Inputs: |
diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp index d0e166fdf..d768a3fc7 100644 --- a/src/core/hle/service/soc_u.cpp +++ b/src/core/hle/service/soc_u.cpp | |||
| @@ -481,11 +481,17 @@ static void GetHostId(Service::Interface* self) { | |||
| 481 | 481 | ||
| 482 | char name[128]; | 482 | char name[128]; |
| 483 | gethostname(name, sizeof(name)); | 483 | gethostname(name, sizeof(name)); |
| 484 | hostent* host = gethostbyname(name); | 484 | addrinfo hints = {}; |
| 485 | in_addr* addr = reinterpret_cast<in_addr*>(host->h_addr); | 485 | addrinfo* res; |
| 486 | |||
| 487 | hints.ai_family = AF_INET; | ||
| 488 | getaddrinfo(name, NULL, &hints, &res); | ||
| 489 | sockaddr_in* sock_addr = reinterpret_cast<sockaddr_in*>(res->ai_addr); | ||
| 490 | in_addr* addr = &sock_addr->sin_addr; | ||
| 486 | 491 | ||
| 487 | cmd_buffer[2] = addr->s_addr; | 492 | cmd_buffer[2] = addr->s_addr; |
| 488 | cmd_buffer[1] = 0; | 493 | cmd_buffer[1] = 0; |
| 494 | freeaddrinfo(res); | ||
| 489 | } | 495 | } |
| 490 | 496 | ||
| 491 | static void Close(Service::Interface* self) { | 497 | static void Close(Service::Interface* self) { |
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index bdede964e..bb64fdfb7 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -334,7 +334,7 @@ static ResultCode GetResourceLimit(Handle* resource_limit, Handle process_handle | |||
| 334 | 334 | ||
| 335 | /// Get resource limit current values | 335 | /// Get resource limit current values |
| 336 | static ResultCode GetResourceLimitCurrentValues(s64* values, Handle resource_limit_handle, u32* names, | 336 | static ResultCode GetResourceLimitCurrentValues(s64* values, Handle resource_limit_handle, u32* names, |
| 337 | s32 name_count) { | 337 | u32 name_count) { |
| 338 | LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", | 338 | LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", |
| 339 | resource_limit_handle, names, name_count); | 339 | resource_limit_handle, names, name_count); |
| 340 | 340 | ||
| @@ -350,7 +350,7 @@ static ResultCode GetResourceLimitCurrentValues(s64* values, Handle resource_lim | |||
| 350 | 350 | ||
| 351 | /// Get resource limit max values | 351 | /// Get resource limit max values |
| 352 | static ResultCode GetResourceLimitLimitValues(s64* values, Handle resource_limit_handle, u32* names, | 352 | static ResultCode GetResourceLimitLimitValues(s64* values, Handle resource_limit_handle, u32* names, |
| 353 | s32 name_count) { | 353 | u32 name_count) { |
| 354 | LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", | 354 | LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", |
| 355 | resource_limit_handle, names, name_count); | 355 | resource_limit_handle, names, name_count); |
| 356 | 356 | ||