diff options
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 84 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.h | 15 |
2 files changed, 63 insertions, 36 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 9c44e27c6..d31ab7970 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -239,8 +239,8 @@ ISelfController::ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger | |||
| 239 | {0, nullptr, "Exit"}, | 239 | {0, nullptr, "Exit"}, |
| 240 | {1, &ISelfController::LockExit, "LockExit"}, | 240 | {1, &ISelfController::LockExit, "LockExit"}, |
| 241 | {2, &ISelfController::UnlockExit, "UnlockExit"}, | 241 | {2, &ISelfController::UnlockExit, "UnlockExit"}, |
| 242 | {3, nullptr, "EnterFatalSection"}, | 242 | {3, &ISelfController::EnterFatalSection, "EnterFatalSection"}, |
| 243 | {4, nullptr, "LeaveFatalSection"}, | 243 | {4, &ISelfController::LeaveFatalSection, "LeaveFatalSection"}, |
| 244 | {9, &ISelfController::GetLibraryAppletLaunchableEvent, "GetLibraryAppletLaunchableEvent"}, | 244 | {9, &ISelfController::GetLibraryAppletLaunchableEvent, "GetLibraryAppletLaunchableEvent"}, |
| 245 | {10, &ISelfController::SetScreenShotPermission, "SetScreenShotPermission"}, | 245 | {10, &ISelfController::SetScreenShotPermission, "SetScreenShotPermission"}, |
| 246 | {11, &ISelfController::SetOperationModeChangedNotification, "SetOperationModeChangedNotification"}, | 246 | {11, &ISelfController::SetOperationModeChangedNotification, "SetOperationModeChangedNotification"}, |
| @@ -285,41 +285,54 @@ ISelfController::ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger | |||
| 285 | 285 | ||
| 286 | ISelfController::~ISelfController() = default; | 286 | ISelfController::~ISelfController() = default; |
| 287 | 287 | ||
| 288 | void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) { | 288 | void ISelfController::LockExit(Kernel::HLERequestContext& ctx) { |
| 289 | // Takes 3 input u8s with each field located immediately after the previous | ||
| 290 | // u8, these are bool flags. No output. | ||
| 291 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 289 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 292 | 290 | ||
| 293 | IPC::RequestParser rp{ctx}; | 291 | IPC::ResponseBuilder rb{ctx, 2}; |
| 292 | rb.Push(RESULT_SUCCESS); | ||
| 293 | } | ||
| 294 | 294 | ||
| 295 | struct FocusHandlingModeParams { | 295 | void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) { |
| 296 | u8 unknown0; | 296 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 297 | u8 unknown1; | ||
| 298 | u8 unknown2; | ||
| 299 | }; | ||
| 300 | auto flags = rp.PopRaw<FocusHandlingModeParams>(); | ||
| 301 | 297 | ||
| 302 | IPC::ResponseBuilder rb{ctx, 2}; | 298 | IPC::ResponseBuilder rb{ctx, 2}; |
| 303 | rb.Push(RESULT_SUCCESS); | 299 | rb.Push(RESULT_SUCCESS); |
| 304 | } | 300 | } |
| 305 | 301 | ||
| 306 | void ISelfController::SetRestartMessageEnabled(Kernel::HLERequestContext& ctx) { | 302 | void ISelfController::EnterFatalSection(Kernel::HLERequestContext& ctx) { |
| 307 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 303 | ++num_fatal_sections_entered; |
| 304 | LOG_DEBUG(Service_AM, "called. Num fatal sections entered: {}", num_fatal_sections_entered); | ||
| 308 | 305 | ||
| 309 | IPC::ResponseBuilder rb{ctx, 2}; | 306 | IPC::ResponseBuilder rb{ctx, 2}; |
| 310 | rb.Push(RESULT_SUCCESS); | 307 | rb.Push(RESULT_SUCCESS); |
| 311 | } | 308 | } |
| 312 | 309 | ||
| 313 | void ISelfController::SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx) { | 310 | void ISelfController::LeaveFatalSection(Kernel::HLERequestContext& ctx) { |
| 314 | IPC::RequestParser rp{ctx}; | 311 | LOG_DEBUG(Service_AM, "called."); |
| 315 | 312 | ||
| 316 | bool flag = rp.Pop<bool>(); | 313 | // Entry and exit of fatal sections must be balanced. |
| 317 | LOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag); | 314 | if (num_fatal_sections_entered == 0) { |
| 315 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 316 | rb.Push(ResultCode{ErrorModule::AM, 512}); | ||
| 317 | return; | ||
| 318 | } | ||
| 319 | |||
| 320 | --num_fatal_sections_entered; | ||
| 318 | 321 | ||
| 319 | IPC::ResponseBuilder rb{ctx, 2}; | 322 | IPC::ResponseBuilder rb{ctx, 2}; |
| 320 | rb.Push(RESULT_SUCCESS); | 323 | rb.Push(RESULT_SUCCESS); |
| 321 | } | 324 | } |
| 322 | 325 | ||
| 326 | void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) { | ||
| 327 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 328 | |||
| 329 | launchable_event.writable->Signal(); | ||
| 330 | |||
| 331 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 332 | rb.Push(RESULT_SUCCESS); | ||
| 333 | rb.PushCopyObjects(launchable_event.readable); | ||
| 334 | } | ||
| 335 | |||
| 323 | void ISelfController::SetScreenShotPermission(Kernel::HLERequestContext& ctx) { | 336 | void ISelfController::SetScreenShotPermission(Kernel::HLERequestContext& ctx) { |
| 324 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 337 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 325 | 338 | ||
| @@ -337,40 +350,51 @@ void ISelfController::SetOperationModeChangedNotification(Kernel::HLERequestCont | |||
| 337 | rb.Push(RESULT_SUCCESS); | 350 | rb.Push(RESULT_SUCCESS); |
| 338 | } | 351 | } |
| 339 | 352 | ||
| 340 | void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx) { | 353 | void ISelfController::SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx) { |
| 341 | // Takes 3 input u8s with each field located immediately after the previous | ||
| 342 | // u8, these are bool flags. No output. | ||
| 343 | IPC::RequestParser rp{ctx}; | 354 | IPC::RequestParser rp{ctx}; |
| 344 | 355 | ||
| 345 | bool enabled = rp.Pop<bool>(); | 356 | bool flag = rp.Pop<bool>(); |
| 346 | LOG_WARNING(Service_AM, "(STUBBED) called enabled={}", enabled); | 357 | LOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag); |
| 347 | 358 | ||
| 348 | IPC::ResponseBuilder rb{ctx, 2}; | 359 | IPC::ResponseBuilder rb{ctx, 2}; |
| 349 | rb.Push(RESULT_SUCCESS); | 360 | rb.Push(RESULT_SUCCESS); |
| 350 | } | 361 | } |
| 351 | 362 | ||
| 352 | void ISelfController::LockExit(Kernel::HLERequestContext& ctx) { | 363 | void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) { |
| 364 | // Takes 3 input u8s with each field located immediately after the previous | ||
| 365 | // u8, these are bool flags. No output. | ||
| 353 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 366 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 354 | 367 | ||
| 368 | IPC::RequestParser rp{ctx}; | ||
| 369 | |||
| 370 | struct FocusHandlingModeParams { | ||
| 371 | u8 unknown0; | ||
| 372 | u8 unknown1; | ||
| 373 | u8 unknown2; | ||
| 374 | }; | ||
| 375 | auto flags = rp.PopRaw<FocusHandlingModeParams>(); | ||
| 376 | |||
| 355 | IPC::ResponseBuilder rb{ctx, 2}; | 377 | IPC::ResponseBuilder rb{ctx, 2}; |
| 356 | rb.Push(RESULT_SUCCESS); | 378 | rb.Push(RESULT_SUCCESS); |
| 357 | } | 379 | } |
| 358 | 380 | ||
| 359 | void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) { | 381 | void ISelfController::SetRestartMessageEnabled(Kernel::HLERequestContext& ctx) { |
| 360 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 382 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 361 | 383 | ||
| 362 | IPC::ResponseBuilder rb{ctx, 2}; | 384 | IPC::ResponseBuilder rb{ctx, 2}; |
| 363 | rb.Push(RESULT_SUCCESS); | 385 | rb.Push(RESULT_SUCCESS); |
| 364 | } | 386 | } |
| 365 | 387 | ||
| 366 | void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) { | 388 | void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx) { |
| 367 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 389 | // Takes 3 input u8s with each field located immediately after the previous |
| 390 | // u8, these are bool flags. No output. | ||
| 391 | IPC::RequestParser rp{ctx}; | ||
| 368 | 392 | ||
| 369 | launchable_event.writable->Signal(); | 393 | bool enabled = rp.Pop<bool>(); |
| 394 | LOG_WARNING(Service_AM, "(STUBBED) called enabled={}", enabled); | ||
| 370 | 395 | ||
| 371 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 396 | IPC::ResponseBuilder rb{ctx, 2}; |
| 372 | rb.Push(RESULT_SUCCESS); | 397 | rb.Push(RESULT_SUCCESS); |
| 373 | rb.PushCopyObjects(launchable_event.readable); | ||
| 374 | } | 398 | } |
| 375 | 399 | ||
| 376 | void ISelfController::SetScreenShotImageOrientation(Kernel::HLERequestContext& ctx) { | 400 | void ISelfController::SetScreenShotImageOrientation(Kernel::HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 565dd8e9e..991b7d47c 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h | |||
| @@ -117,17 +117,19 @@ public: | |||
| 117 | ~ISelfController() override; | 117 | ~ISelfController() override; |
| 118 | 118 | ||
| 119 | private: | 119 | private: |
| 120 | void SetFocusHandlingMode(Kernel::HLERequestContext& ctx); | ||
| 121 | void SetRestartMessageEnabled(Kernel::HLERequestContext& ctx); | ||
| 122 | void SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx); | ||
| 123 | void SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx); | ||
| 124 | void SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx); | ||
| 125 | void LockExit(Kernel::HLERequestContext& ctx); | 120 | void LockExit(Kernel::HLERequestContext& ctx); |
| 126 | void UnlockExit(Kernel::HLERequestContext& ctx); | 121 | void UnlockExit(Kernel::HLERequestContext& ctx); |
| 122 | void EnterFatalSection(Kernel::HLERequestContext& ctx); | ||
| 123 | void LeaveFatalSection(Kernel::HLERequestContext& ctx); | ||
| 127 | void GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx); | 124 | void GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx); |
| 125 | void SetScreenShotPermission(Kernel::HLERequestContext& ctx); | ||
| 126 | void SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx); | ||
| 127 | void SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx); | ||
| 128 | void SetFocusHandlingMode(Kernel::HLERequestContext& ctx); | ||
| 129 | void SetRestartMessageEnabled(Kernel::HLERequestContext& ctx); | ||
| 130 | void SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx); | ||
| 128 | void SetScreenShotImageOrientation(Kernel::HLERequestContext& ctx); | 131 | void SetScreenShotImageOrientation(Kernel::HLERequestContext& ctx); |
| 129 | void CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx); | 132 | void CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx); |
| 130 | void SetScreenShotPermission(Kernel::HLERequestContext& ctx); | ||
| 131 | void SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx); | 133 | void SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx); |
| 132 | void SetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); | 134 | void SetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); |
| 133 | void GetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); | 135 | void GetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); |
| @@ -135,6 +137,7 @@ private: | |||
| 135 | std::shared_ptr<NVFlinger::NVFlinger> nvflinger; | 137 | std::shared_ptr<NVFlinger::NVFlinger> nvflinger; |
| 136 | Kernel::EventPair launchable_event; | 138 | Kernel::EventPair launchable_event; |
| 137 | u32 idle_time_detection_extension = 0; | 139 | u32 idle_time_detection_extension = 0; |
| 140 | u64 num_fatal_sections_entered = 0; | ||
| 138 | }; | 141 | }; |
| 139 | 142 | ||
| 140 | class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> { | 143 | class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> { |