mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 06:21:26 +12:00
Keep preceding 0 in firmware strings
This commit is contained in:
parent
5107d1b69b
commit
b86ecf7441
1 changed files with 13 additions and 1 deletions
|
@ -415,13 +415,25 @@ std::string utils::get_firmware_version()
|
||||||
version = version.substr(start, end - start);
|
version = version.substr(start, end - start);
|
||||||
|
|
||||||
// Trim version (e.g. '04.8900' becomes '4.89')
|
// Trim version (e.g. '04.8900' becomes '4.89')
|
||||||
const usz trim_start = version.find_first_not_of('0');
|
usz trim_start = version.find_first_not_of('0');
|
||||||
|
|
||||||
if (trim_start == umax)
|
if (trim_start == umax)
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keep at least one preceding 0 (e.g. '00.3100' becomes '0.31' instead of '.31')
|
||||||
|
if (version[trim_start] == '.')
|
||||||
|
{
|
||||||
|
if (trim_start == 0)
|
||||||
|
{
|
||||||
|
// Version starts with '.' for some reason
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
trim_start--;
|
||||||
|
}
|
||||||
|
|
||||||
const usz dot_pos = version.find_first_of('.', trim_start);
|
const usz dot_pos = version.find_first_of('.', trim_start);
|
||||||
|
|
||||||
if (dot_pos == umax)
|
if (dot_pos == umax)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue