Only initialise maxEntry for active input devices

This caused the menus in Sonic Mania to be nonfunctional, futhermore,
default init is not ran for the input structs so the default max
definition in CommonHeader never actually applied.
This commit is contained in:
Billy Laws 2020-11-20 20:30:13 +00:00 committed by ◱ PixelyIon
parent bc5c094860
commit 7167393e3c
3 changed files with 3 additions and 1 deletions

View File

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

View File

@ -21,7 +21,7 @@ namespace skyline {
u64 timestamp; //!< The timestamp of the latest entry in ticks
u64 entryCount; //!< The number of written entries
u64 currentEntry; //!< The index of the latest entry
u64 maxEntry{constant::HidEntryCount - 1}; //!< The maximum entry index (16)
u64 maxEntry; //!< The maximum entry index
};
static_assert(sizeof(CommonHeader) == 0x20);
}

View File

@ -37,6 +37,7 @@ namespace skyline::input {
section.header.timestamp = util::GetTimeTicks();
section.header.entryCount = std::min(static_cast<u8>(section.header.entryCount + 1), constant::HidEntryCount);
section.header.maxEntry = constant::HidEntryCount - 1;
section.header.currentEntry = entryIndex;
}
}