|
|
|
@ -31,7 +31,6 @@ Result IReceiver::AddSource(SourceName source_name) { |
|
|
|
const std::string name = source_name.GetString(); |
|
|
|
LOG_INFO(Service_PSC, "called: source_name={}", name); |
|
|
|
|
|
|
|
// Add source if it doesn't already exist
|
|
|
|
if (message_sources.find(name) == message_sources.end()) { |
|
|
|
message_sources[name] = {}; |
|
|
|
} |
|
|
|
@ -43,7 +42,6 @@ Result IReceiver::RemoveSource(SourceName source_name) { |
|
|
|
const std::string name = source_name.GetString(); |
|
|
|
LOG_INFO(Service_PSC, "called: source_name={}", name); |
|
|
|
|
|
|
|
// Remove source if it exists
|
|
|
|
message_sources.erase(name); |
|
|
|
|
|
|
|
R_SUCCEED(); |
|
|
|
@ -64,7 +62,6 @@ Result IReceiver::ReceiveWithTick(Out<OverlayNotification> out_notification, |
|
|
|
Out<MessageFlags> out_flags, Out<u64> out_tick) { |
|
|
|
LOG_DEBUG(Service_PSC, "called"); |
|
|
|
|
|
|
|
// Find the message with the lowest ID across all sources
|
|
|
|
const std::string* target_source = nullptr; |
|
|
|
size_t target_index = 0; |
|
|
|
|
|
|
|
@ -74,8 +71,6 @@ Result IReceiver::ReceiveWithTick(Out<OverlayNotification> out_notification, |
|
|
|
target_source = &source_name; |
|
|
|
target_index = 0; |
|
|
|
} |
|
|
|
// Note: In the real implementation, we would track message IDs
|
|
|
|
// For now, just use FIFO order
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -83,12 +78,10 @@ Result IReceiver::ReceiveWithTick(Out<OverlayNotification> out_notification, |
|
|
|
auto& messages = message_sources[*target_source]; |
|
|
|
*out_notification = messages[target_index].first; |
|
|
|
*out_flags = messages[target_index].second; |
|
|
|
*out_tick = 0; // TODO: Implement tick tracking
|
|
|
|
*out_tick = 0; |
|
|
|
|
|
|
|
// Remove the message
|
|
|
|
messages.erase(messages.begin() + target_index); |
|
|
|
|
|
|
|
// Clear event if no more messages
|
|
|
|
bool has_messages = false; |
|
|
|
for (const auto& [_, msgs] : message_sources) { |
|
|
|
if (!msgs.empty()) { |
|
|
|
@ -103,13 +96,12 @@ Result IReceiver::ReceiveWithTick(Out<OverlayNotification> out_notification, |
|
|
|
R_SUCCEED(); |
|
|
|
} |
|
|
|
|
|
|
|
// No messages available
|
|
|
|
*out_notification = {}; |
|
|
|
*out_flags = {}; |
|
|
|
*out_tick = 0; |
|
|
|
|
|
|
|
LOG_WARNING(Service_PSC, "No messages available"); |
|
|
|
R_THROW(ResultUnknown); // TODO: Use proper OvlnResult::NoMessages when available
|
|
|
|
R_THROW(ResultUnknown); |
|
|
|
} |
|
|
|
|
|
|
|
} // namespace Service::PSC
|