mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-21 19:36:55 +02:00
system service: deliver initial AppContent entitlement updates through shared queue
This commit is contained in:
@@ -7,9 +7,12 @@
|
||||
#include "libs/dialog.h"
|
||||
#include "libs/errno.h"
|
||||
#include "libs/libs.h"
|
||||
#include "libs/systemService.h"
|
||||
#include "loader/symbolDatabase.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <deque>
|
||||
#include <mutex>
|
||||
|
||||
namespace Libs {
|
||||
|
||||
@@ -70,6 +73,14 @@ struct SystemServiceEvent {
|
||||
uint8_t data[8192];
|
||||
};
|
||||
|
||||
static std::mutex g_event_mutex;
|
||||
static std::deque<int32_t> g_events;
|
||||
|
||||
void NotifyEntitlementUpdate() {
|
||||
std::scoped_lock lock(g_event_mutex);
|
||||
g_events.push_back(0x10000003); // SCE_SYSTEM_SERVICE_EVENT_ENTITLEMENT_UPDATE
|
||||
}
|
||||
|
||||
struct SystemServiceDisplaySafeAreaInfo {
|
||||
float ratio;
|
||||
uint8_t reserved[128];
|
||||
@@ -153,7 +164,14 @@ static int KYTY_SYSV_ABI SystemServiceReceiveEvent(SystemServiceEvent* event) {
|
||||
event->event_type = -1;
|
||||
std::memset(event->data, 0, sizeof(event->data));
|
||||
|
||||
return SYSTEM_SERVICE_ERROR_NO_EVENT;
|
||||
std::scoped_lock lock(g_event_mutex);
|
||||
if (g_events.empty()) {
|
||||
return SYSTEM_SERVICE_ERROR_NO_EVENT;
|
||||
}
|
||||
event->event_type = g_events.front();
|
||||
g_events.pop_front();
|
||||
LOGF("\t SystemService event = 0x%08x\n", static_cast<uint32_t>(event->event_type));
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int KYTY_SYSV_ABI SystemServiceGetStatus(SystemServiceStatus* status) {
|
||||
@@ -167,6 +185,10 @@ static int KYTY_SYSV_ABI SystemServiceGetStatus(SystemServiceStatus* status) {
|
||||
*status = SystemServiceStatus();
|
||||
status->is_system_ui_overlaid = dialog.active;
|
||||
status->is_in_background_execution = dialog.background;
|
||||
{
|
||||
std::scoped_lock lock(g_event_mutex);
|
||||
status->event_num = static_cast<int32_t>(g_events.size());
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user