mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-08 09:29:58 +00:00
kernel/svc: Correct behavior of svcResetSignal()
While partially correct, this service call allows the retrieved event to be null, as it also uses the same handle to check if it was referring to a Process instance. The previous two changes put the necessary machinery in place to allow for this, so we can simply call those member functions here and be done with it.
This commit is contained in:
parent
c7462ce712
commit
2f253986df
1 changed files with 11 additions and 4 deletions
|
@ -1433,17 +1433,24 @@ static ResultCode CloseHandle(Handle handle) {
|
||||||
return handle_table.Close(handle);
|
return handle_table.Close(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reset an event
|
/// Clears the signaled state of an event or process.
|
||||||
static ResultCode ResetSignal(Handle handle) {
|
static ResultCode ResetSignal(Handle handle) {
|
||||||
LOG_DEBUG(Kernel_SVC, "called handle 0x{:08X}", handle);
|
LOG_DEBUG(Kernel_SVC, "called handle 0x{:08X}", handle);
|
||||||
|
|
||||||
const auto& handle_table = Core::CurrentProcess()->GetHandleTable();
|
const auto& handle_table = Core::CurrentProcess()->GetHandleTable();
|
||||||
|
|
||||||
auto event = handle_table.Get<ReadableEvent>(handle);
|
auto event = handle_table.Get<ReadableEvent>(handle);
|
||||||
|
if (event) {
|
||||||
|
return event->Reset();
|
||||||
|
}
|
||||||
|
|
||||||
ASSERT(event != nullptr);
|
auto process = handle_table.Get<Process>(handle);
|
||||||
|
if (process) {
|
||||||
|
return process->ClearSignalState();
|
||||||
|
}
|
||||||
|
|
||||||
event->Clear();
|
LOG_ERROR(Kernel_SVC, "Invalid handle (0x{:08X})", handle);
|
||||||
return RESULT_SUCCESS;
|
return ERR_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a TransferMemory object
|
/// Creates a TransferMemory object
|
||||||
|
|
Loading…
Reference in a new issue