fix(event): correct minor logic errors in windows message loop

This commit is contained in:
fallenoak 2023-03-15 22:33:47 -05:00
parent b295c541e3
commit e6b43f9758

View File

@ -5,10 +5,22 @@
int32_t OsInputGet(OSINPUT* id, int32_t* param0, int32_t* param1, int32_t* param2, int32_t* param3) {
// TODO window rect comparisons
while (Input::s_queueTail == Input::s_queueHead) {
MSG msg;
if (Input::s_queueTail != Input::s_queueHead) {
OsQueueGet(id, param0, param1, param2, param3);
return 1;
}
if (!PeekMessage(&msg, nullptr, 0, 0, 0)) {
// TODO Sub8714B0(dwordB1C220);
while (true) {
MSG msg;
auto peekResult = PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE);
if (Input::s_queueTail != Input::s_queueHead) {
break;
}
if (!peekResult) {
return 0;
}
@ -26,11 +38,13 @@ int32_t OsInputGet(OSINPUT* id, int32_t* param0, int32_t* param1, int32_t* param
}
TranslateMessage(&msg);
DispatchMessage(&msg);
if (Input::s_queueTail != Input::s_queueHead) {
break;
}
}
OsQueueGet(id, param0, param1, param2, param3);
return 1;
}