mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-08-21 15:43:22 +02:00
lm: Fix ReadLeb128
Fixes assertion on Bloodstained Ritual of the Night. We would over read sometimes, this is fixed by checking if the top bit is set in the first iteration. We also lock the loop off to be only the max size of the type we can fit. Finally we changed an incorrect print of "DEBUG" to "TRACE" to reflect the proper log severity
This commit is contained in:
parent
4a01812ebe
commit
9d5a56a40b
@ -143,17 +143,19 @@ private:
|
|||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 ReadLeb128(const std::vector<u8>& data, std::size_t& offset) {
|
u64 ReadLeb128(const std::vector<u8>& data, std::size_t& offset) {
|
||||||
u32 result{};
|
u64 result{};
|
||||||
u32 shift{};
|
u32 shift{};
|
||||||
do {
|
|
||||||
result |= (data[offset] & 0x7f) << shift;
|
for (std::size_t i = 0; i < sizeof(u64); i++) {
|
||||||
|
const auto v = data[offset];
|
||||||
|
result |= (static_cast<u64>(v & 0x7f) << shift);
|
||||||
shift += 7;
|
shift += 7;
|
||||||
offset++;
|
offset++;
|
||||||
if (offset >= data.size()) {
|
if (offset >= data.size() || ((v & 0x80) == 0)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while ((data[offset] & 0x80) != 0);
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +264,7 @@ private:
|
|||||||
|
|
||||||
switch (entry.severity) {
|
switch (entry.severity) {
|
||||||
case LogSeverity::Trace:
|
case LogSeverity::Trace:
|
||||||
LOG_DEBUG(Service_LM, "LogManager DEBUG ({}):\n{}", DestinationToString(destination),
|
LOG_DEBUG(Service_LM, "LogManager TRACE ({}):\n{}", DestinationToString(destination),
|
||||||
output_log);
|
output_log);
|
||||||
break;
|
break;
|
||||||
case LogSeverity::Info:
|
case LogSeverity::Info:
|
||||||
|
Loading…
Reference in New Issue
Block a user