service: hid: Set the correct maxEntry value and signal on acquire event handle

This commit is contained in:
Narr the Reg 2022-10-14 20:28:57 -05:00 committed by Billy Laws
parent baa6b5d5ea
commit 4da934579c
3 changed files with 11 additions and 9 deletions

View File

@ -188,8 +188,8 @@ namespace skyline::input {
info.header.timestamp = util::GetTimeTicks(); info.header.timestamp = util::GetTimeTicks();
info.header.entryCount = std::min(static_cast<u8>(info.header.entryCount + 1), constant::HidEntryCount); info.header.entryCount = std::min(static_cast<u8>(info.header.entryCount + 1), constant::HidEntryCount);
info.header.maxEntry = info.header.entryCount; info.header.maxEntry = info.header.entryCount - 1;
info.header.currentEntry = (info.header.currentEntry != constant::HidEntryCount - 1) ? info.header.currentEntry + 1 : 0; info.header.currentEntry = (info.header.currentEntry < info.header.maxEntry) ? info.header.currentEntry + 1 : 0;
auto &nextEntry{info.state.at(info.header.currentEntry)}; auto &nextEntry{info.state.at(info.header.currentEntry)};

View File

@ -74,15 +74,15 @@ namespace skyline::input {
return; return;
const auto &lastEntry{section.entries[section.header.currentEntry]}; const auto &lastEntry{section.entries[section.header.currentEntry]};
auto entryIndex{(section.header.currentEntry != constant::HidEntryCount - 1) ? section.header.currentEntry + 1 : 0};
auto &entry{section.entries[entryIndex]};
entry = screenState;
entry.globalTimestamp = lastEntry.globalTimestamp + 1;
entry.localTimestamp = lastEntry.localTimestamp + 1;
section.header.timestamp = util::GetTimeTicks(); section.header.timestamp = util::GetTimeTicks();
section.header.entryCount = std::min(static_cast<u8>(section.header.entryCount + 1), constant::HidEntryCount); section.header.entryCount = std::min(static_cast<u8>(section.header.entryCount + 1), constant::HidEntryCount);
section.header.maxEntry = section.header.entryCount; section.header.maxEntry = section.header.entryCount - 1;
section.header.currentEntry = entryIndex; section.header.currentEntry = (section.header.currentEntry < section.header.maxEntry) ? section.header.currentEntry + 1 : 0;
auto &entry{section.entries[section.header.currentEntry]};
entry = screenState;
entry.globalTimestamp = lastEntry.globalTimestamp + 1;
entry.localTimestamp = lastEntry.localTimestamp + 1;
} }
} }

View File

@ -79,6 +79,8 @@ namespace skyline::service::hid {
auto id{request.Pop<NpadId>()}; auto id{request.Pop<NpadId>()};
auto handle{state.process->InsertItem(state.input->npad.at(id).updateEvent)}; auto handle{state.process->InsertItem(state.input->npad.at(id).updateEvent)};
state.input->npad.at(id).updateEvent->Signal();
Logger::Debug("Npad {} Style Set Update Event Handle: 0x{:X}", id, handle); Logger::Debug("Npad {} Style Set Update Event Handle: 0x{:X}", id, handle);
response.copyHandles.push_back(handle); response.copyHandles.push_back(handle);
return {}; return {};