summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/am/am_results.h1
-rw-r--r--src/core/hle/service/am/applet.h3
-rw-r--r--src/core/hle/service/am/service/application_functions.cpp18
3 files changed, 20 insertions, 2 deletions
diff --git a/src/core/hle/service/am/am_results.h b/src/core/hle/service/am/am_results.h
index 020896a2e..17bed2b12 100644
--- a/src/core/hle/service/am/am_results.h
+++ b/src/core/hle/service/am/am_results.h
@@ -13,5 +13,6 @@ constexpr Result ResultLibraryAppletTerminated{ErrorModule::AM, 22};
constexpr Result ResultInvalidOffset{ErrorModule::AM, 503};
constexpr Result ResultInvalidStorageType{ErrorModule::AM, 511};
constexpr Result ResultFatalSectionCountImbalance{ErrorModule::AM, 512};
+constexpr Result ResultNoData{ErrorModule::AM, 2};
} // namespace Service::AM
diff --git a/src/core/hle/service/am/applet.h b/src/core/hle/service/am/applet.h
index 0e286b8d7..a9b558618 100644
--- a/src/core/hle/service/am/applet.h
+++ b/src/core/hle/service/am/applet.h
@@ -133,6 +133,9 @@ struct Applet {
void UpdateSuspensionStateLocked(bool force_message);
void SetInteractibleLocked(bool interactible);
void OnProcessTerminatedLocked();
+
+ // Storage channels
+ std::deque<std::vector<u8>> friend_invitation_storage_channel;
};
} // namespace Service::AM
diff --git a/src/core/hle/service/am/service/application_functions.cpp b/src/core/hle/service/am/service/application_functions.cpp
index 5e5b9e771..19635d0c7 100644
--- a/src/core/hle/service/am/service/application_functions.cpp
+++ b/src/core/hle/service/am/service/application_functions.cpp
@@ -456,8 +456,22 @@ Result IApplicationFunctions::GetFriendInvitationStorageChannelEvent(
Result IApplicationFunctions::TryPopFromFriendInvitationStorageChannel(
Out<SharedPointer<IStorage>> out_storage) {
- LOG_INFO(Service_AM, "(STUBBED) called");
- R_THROW(AM::ResultNoDataInChannel);
+ LOG_DEBUG(Service_AM, "called");
+
+ std::scoped_lock lock{m_applet->lock};
+
+ // Check if there's any data in the friend invitation storage channel
+ if (m_applet->friend_invitation_storage_channel.empty()) {
+ R_THROW(AM::ResultNoData);
+ }
+
+ // Pop the most recent data
+ std::vector<u8> data = std::move(m_applet->friend_invitation_storage_channel.front());
+ m_applet->friend_invitation_storage_channel.pop_front();
+
+ // Create IStorage containing the data
+ *out_storage = std::make_shared<IStorage>(system, std::move(data));
+ R_SUCCEED();
}
Result IApplicationFunctions::GetNotificationStorageChannelEvent(