diff options
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 98 |
1 files changed, 55 insertions, 43 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index c47228935..40922ec3a 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.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 <cinttypes> | 5 | #include <cinttypes> |
| 6 | #include <stack> | ||
| 6 | #include "core/file_sys/filesystem.h" | 7 | #include "core/file_sys/filesystem.h" |
| 7 | #include "core/hle/ipc_helpers.h" | 8 | #include "core/hle/ipc_helpers.h" |
| 8 | #include "core/hle/kernel/event.h" | 9 | #include "core/hle/kernel/event.h" |
| @@ -348,49 +349,6 @@ void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) { | |||
| 348 | NGLOG_WARNING(Service_AM, "(STUBBED) called"); | 349 | NGLOG_WARNING(Service_AM, "(STUBBED) called"); |
| 349 | } | 350 | } |
| 350 | 351 | ||
| 351 | class ILibraryAppletAccessor final : public ServiceFramework<ILibraryAppletAccessor> { | ||
| 352 | public: | ||
| 353 | explicit ILibraryAppletAccessor() : ServiceFramework("ILibraryAppletAccessor") { | ||
| 354 | static const FunctionInfo functions[] = { | ||
| 355 | {0, &ILibraryAppletAccessor::GetAppletStateChangedEvent, "GetAppletStateChangedEvent"}, | ||
| 356 | {1, nullptr, "IsCompleted"}, | ||
| 357 | {10, nullptr, "Start"}, | ||
| 358 | {20, nullptr, "RequestExit"}, | ||
| 359 | {25, nullptr, "Terminate"}, | ||
| 360 | {30, nullptr, "GetResult"}, | ||
| 361 | {50, nullptr, "SetOutOfFocusApplicationSuspendingEnabled"}, | ||
| 362 | {100, nullptr, "PushInData"}, | ||
| 363 | {101, nullptr, "PopOutData"}, | ||
| 364 | {102, nullptr, "PushExtraStorage"}, | ||
| 365 | {103, nullptr, "PushInteractiveInData"}, | ||
| 366 | {104, nullptr, "PopInteractiveOutData"}, | ||
| 367 | {105, nullptr, "GetPopOutDataEvent"}, | ||
| 368 | {106, nullptr, "GetPopInteractiveOutDataEvent"}, | ||
| 369 | {110, nullptr, "NeedsToExitProcess"}, | ||
| 370 | {120, nullptr, "GetLibraryAppletInfo"}, | ||
| 371 | {150, nullptr, "RequestForAppletToGetForeground"}, | ||
| 372 | {160, nullptr, "GetIndirectLayerConsumerHandle"}, | ||
| 373 | }; | ||
| 374 | RegisterHandlers(functions); | ||
| 375 | |||
| 376 | state_changed_event = Kernel::Event::Create(Kernel::ResetType::OneShot, | ||
| 377 | "ILibraryAppletAccessor:StateChangedEvent"); | ||
| 378 | } | ||
| 379 | |||
| 380 | private: | ||
| 381 | void GetAppletStateChangedEvent(Kernel::HLERequestContext& ctx) { | ||
| 382 | state_changed_event->Signal(); | ||
| 383 | |||
| 384 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 385 | rb.Push(RESULT_SUCCESS); | ||
| 386 | rb.PushCopyObjects(state_changed_event); | ||
| 387 | |||
| 388 | NGLOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 389 | } | ||
| 390 | |||
| 391 | Kernel::SharedPtr<Kernel::Event> state_changed_event; | ||
| 392 | }; | ||
| 393 | |||
| 394 | class IStorageAccessor final : public ServiceFramework<IStorageAccessor> { | 352 | class IStorageAccessor final : public ServiceFramework<IStorageAccessor> { |
| 395 | public: | 353 | public: |
| 396 | explicit IStorageAccessor(std::vector<u8> buffer) | 354 | explicit IStorageAccessor(std::vector<u8> buffer) |
| @@ -472,6 +430,60 @@ private: | |||
| 472 | } | 430 | } |
| 473 | }; | 431 | }; |
| 474 | 432 | ||
| 433 | class ILibraryAppletAccessor final : public ServiceFramework<ILibraryAppletAccessor> { | ||
| 434 | public: | ||
| 435 | explicit ILibraryAppletAccessor() : ServiceFramework("ILibraryAppletAccessor") { | ||
| 436 | static const FunctionInfo functions[] = { | ||
| 437 | {0, &ILibraryAppletAccessor::GetAppletStateChangedEvent, "GetAppletStateChangedEvent"}, | ||
| 438 | {1, nullptr, "IsCompleted"}, | ||
| 439 | {10, nullptr, "Start"}, | ||
| 440 | {20, nullptr, "RequestExit"}, | ||
| 441 | {25, nullptr, "Terminate"}, | ||
| 442 | {30, nullptr, "GetResult"}, | ||
| 443 | {50, nullptr, "SetOutOfFocusApplicationSuspendingEnabled"}, | ||
| 444 | {100, &ILibraryAppletAccessor::PushInData, "PushInData"}, | ||
| 445 | {101, nullptr, "PopOutData"}, | ||
| 446 | {102, nullptr, "PushExtraStorage"}, | ||
| 447 | {103, nullptr, "PushInteractiveInData"}, | ||
| 448 | {104, nullptr, "PopInteractiveOutData"}, | ||
| 449 | {105, nullptr, "GetPopOutDataEvent"}, | ||
| 450 | {106, nullptr, "GetPopInteractiveOutDataEvent"}, | ||
| 451 | {110, nullptr, "NeedsToExitProcess"}, | ||
| 452 | {120, nullptr, "GetLibraryAppletInfo"}, | ||
| 453 | {150, nullptr, "RequestForAppletToGetForeground"}, | ||
| 454 | {160, nullptr, "GetIndirectLayerConsumerHandle"}, | ||
| 455 | }; | ||
| 456 | RegisterHandlers(functions); | ||
| 457 | |||
| 458 | state_changed_event = Kernel::Event::Create(Kernel::ResetType::OneShot, | ||
| 459 | "ILibraryAppletAccessor:StateChangedEvent"); | ||
| 460 | } | ||
| 461 | |||
| 462 | private: | ||
| 463 | void GetAppletStateChangedEvent(Kernel::HLERequestContext& ctx) { | ||
| 464 | state_changed_event->Signal(); | ||
| 465 | |||
| 466 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 467 | rb.Push(RESULT_SUCCESS); | ||
| 468 | rb.PushCopyObjects(state_changed_event); | ||
| 469 | |||
| 470 | NGLOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 471 | } | ||
| 472 | |||
| 473 | void PushInData(Kernel::HLERequestContext& ctx) { | ||
| 474 | IPC::RequestParser rp{ctx}; | ||
| 475 | storage_stack.push(rp.PopIpcInterface<AM::IStorage>()); | ||
| 476 | |||
| 477 | IPC::ResponseBuilder rb{rp.MakeBuilder(2, 0, 0)}; | ||
| 478 | rb.Push(RESULT_SUCCESS); | ||
| 479 | |||
| 480 | NGLOG_DEBUG(Service_AM, "called"); | ||
| 481 | } | ||
| 482 | |||
| 483 | std::stack<std::shared_ptr<AM::IStorage>> storage_stack; | ||
| 484 | Kernel::SharedPtr<Kernel::Event> state_changed_event; | ||
| 485 | }; | ||
| 486 | |||
| 475 | ILibraryAppletCreator::ILibraryAppletCreator() : ServiceFramework("ILibraryAppletCreator") { | 487 | ILibraryAppletCreator::ILibraryAppletCreator() : ServiceFramework("ILibraryAppletCreator") { |
| 476 | static const FunctionInfo functions[] = { | 488 | static const FunctionInfo functions[] = { |
| 477 | {0, &ILibraryAppletCreator::CreateLibraryApplet, "CreateLibraryApplet"}, | 489 | {0, &ILibraryAppletCreator::CreateLibraryApplet, "CreateLibraryApplet"}, |