mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-06-30 15:55:29 +02:00
[fs] fix crash on '#' comments in pchtxt patches
Adds `#` as a valid pchtxt comment, and fixes a crash that could occur when using odd-length values This patch was sent by Adam Kittelson <adam@apathydrive.com> Signed-off-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
parent
599ab16288
commit
4181f6f049
2 changed files with 2 additions and 2 deletions
|
|
@ -12,7 +12,7 @@ std::vector<u8> HexStringToVector(std::string_view str, bool little_endian) {
|
||||||
for (std::size_t i = str.size() - 2; i <= str.size(); i -= 2)
|
for (std::size_t i = str.size() - 2; i <= str.size(); i -= 2)
|
||||||
out[i / 2] = (ToHexNibble(str[i]) << 4) | ToHexNibble(str[i + 1]);
|
out[i / 2] = (ToHexNibble(str[i]) << 4) | ToHexNibble(str[i + 1]);
|
||||||
} else {
|
} else {
|
||||||
for (std::size_t i = 0; i < str.size(); i += 2)
|
for (std::size_t i = 0; i + 1 < str.size(); i += 2)
|
||||||
out[i / 2] = (ToHexNibble(str[i]) << 4) | ToHexNibble(str[i + 1]);
|
out[i / 2] = (ToHexNibble(str[i]) << 4) | ToHexNibble(str[i + 1]);
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
|
|
|
||||||
|
|
@ -256,7 +256,7 @@ void IPSwitchCompiler::Parse() {
|
||||||
const auto& patch_line = lines[++i];
|
const auto& patch_line = lines[++i];
|
||||||
|
|
||||||
// Patch line may contain comments
|
// Patch line may contain comments
|
||||||
if (StartsWith(patch_line, "//")) {
|
if (StartsWith(patch_line, "//") || StartsWith(patch_line, "#")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue