diff --git a/src/internal.cpp b/src/internal.cpp index c4dd5ed..e6ff8e8 100644 --- a/src/internal.cpp +++ b/src/internal.cpp @@ -85,4 +85,16 @@ namespace vkvm { unlockSharedMemory(); } + auto getRegisteredProcesses(EventType eventType) -> std::vector { + std::vector result; + auto ivt = getInterruptTable(); + for(int i = 0; i < impl.interruptEntrysPerEventType;i++){ + auto &entry= ivt[eventType * impl.interruptEntrysPerEventType + i]; + if (entry.pid != 0) { + result.push_back(entry.pid); + } + } + return result; + } + } diff --git a/src/internal.hpp b/src/internal.hpp index e1b5ea2..a84676a 100644 --- a/src/internal.hpp +++ b/src/internal.hpp @@ -126,6 +126,12 @@ constexpr int keyboardBufferSize = 16; */ auto buttonPressed(KeyCode keyCode) -> void; +/** + * get registered Prosesses for a given event type. + * @param eventType. + */ + auto getRegisteredProcesses(EventType eventType) -> std::vector; + // Shared Memory Layout // -------------------------------------------------------------------- // struct ControlRegisters diff --git a/src/vkvm.cpp b/src/vkvm.cpp index 331ba6c..d48d36b 100644 --- a/src/vkvm.cpp +++ b/src/vkvm.cpp @@ -63,6 +63,9 @@ namespace vkvm { } auto setPixel(int x, int y, Color color) -> bool { + if(x < 0 || y < 0){ + return false; + } if (x > getWidth() || y > getHeight()) { return false; }