From 0703367f991632f0470e1b826047751f1aeffc57 Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 5 Sep 2024 12:28:25 -0500 Subject: [PATCH] cleanup code --- src/core/libraries/gnmdriver/gnmdriver.cpp | 41 +++++++++++----------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/src/core/libraries/gnmdriver/gnmdriver.cpp b/src/core/libraries/gnmdriver/gnmdriver.cpp index d8e17cefe..00920711e 100644 --- a/src/core/libraries/gnmdriver/gnmdriver.cpp +++ b/src/core/libraries/gnmdriver/gnmdriver.cpp @@ -372,30 +372,29 @@ s32 PS4_SYSV_ABI sceGnmAddEqEvent(SceKernelEqueue eq, u64 id, void* udata) { kernel_event.event.udata = udata; eq->AddEvent(kernel_event); - if (id == 64) { - Platform::IrqC::Instance()->Register( - Platform::InterruptId::GfxEop, - [=](Platform::InterruptId irq) { - ASSERT_MSG(irq == Platform::InterruptId::GfxEop, - "An unexpected IRQ occured"); // We need to convert IRQ# to event id and do - // proper filtering in trigger function - eq->TriggerEvent(GnmEventIdents::GfxEop, SceKernelEvent::Filter::GraphicsCore, nullptr); - }, - eq); - } else if (id >= 0 && id <= 6) { - auto interruptId = (Platform::InterruptId)id; + Platform::InterruptId interruptId; + GnmEventIdents eventId; - Platform::IrqC::Instance()->Register( - interruptId, - [=](Platform::InterruptId irq) { - ASSERT_MSG(irq == interruptId, - "An unexpected IRQ occured"); // We need to convert IRQ# to event id and do - // proper filtering in trigger function - eq->TriggerEvent((GnmEventIdents)id, SceKernelEvent::Filter::GraphicsCore, nullptr); - }, - eq); + if (id == 64) { + interruptId = Platform::InterruptId::GfxEop; + eventId = GnmEventIdents::GfxEop; + } else if (id >= 0 && id <= 6) { + interruptId = static_cast(id); + eventId = static_cast(id); + } else { + LOG_ERROR(Lib_GnmDriver, "unknown id {}", id); + return ORBIS_OK; } + Platform::IrqC::Instance()->Register( + interruptId, + [=](Platform::InterruptId irq) { + ASSERT_MSG(irq == interruptId, "An unexpected IRQ occurred"); + eq->TriggerEvent(eventId, SceKernelEvent::Filter::GraphicsCore, nullptr); + }, + eq + ); + return ORBIS_OK; }