mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-14 01:27:00 +00:00
Keep second 0 in firmware strings
This commit is contained in:
parent
e133c8c2c3
commit
5107d1b69b
@ -414,15 +414,24 @@ std::string utils::get_firmware_version()
|
||||
|
||||
version = version.substr(start, end - start);
|
||||
|
||||
// Trim version
|
||||
// Trim version (e.g. '04.8900' becomes '4.89')
|
||||
const usz trim_start = version.find_first_not_of('0');
|
||||
const usz trim_end = version.find_last_not_of('0');
|
||||
|
||||
if (trim_start == umax)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
const usz dot_pos = version.find_first_of('.', trim_start);
|
||||
|
||||
if (dot_pos == umax)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
// Try to keep the second 0 in the minor version (e.g. '04.9000' becomes '4.90' instead of '4.9')
|
||||
const usz trim_end = std::max(version.find_last_not_of('0', dot_pos + 1), std::min(dot_pos + 2, version.size()));
|
||||
|
||||
return std::string(version.substr(trim_start, trim_end));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user