mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-20 22:05:12 +00:00
ps4: kevent: fix Flip event
This commit is contained in:
parent
091a9eec26
commit
9bed1001bc
3 changed files with 63 additions and 5 deletions
|
|
@ -53,6 +53,30 @@ void orbis::EventEmitter::emit(sshort filter, uint fflags, intptr_t data,
|
|||
}
|
||||
}
|
||||
|
||||
void orbis::EventEmitter::emit(
|
||||
sshort filter, void *userData,
|
||||
std::optional<intptr_t> (*filterFn)(void *userData, KNote *note)) {
|
||||
std::lock_guard lock(mutex);
|
||||
|
||||
for (auto note : notes) {
|
||||
if (note->event.filter != filter) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::lock_guard lock(note->mutex);
|
||||
|
||||
if (note->triggered) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (auto data = filterFn(userData, note)) {
|
||||
note->event.data = *data;
|
||||
note->triggered = true;
|
||||
note->queue->cv.notify_all(note->queue->mtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void orbis::EventEmitter::subscribe(KNote *note) {
|
||||
std::lock_guard lock(mutex);
|
||||
notes.insert(note);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue