Skip to content

Commit

Permalink
Keep preceding 0 in firmware strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Megamouse committed Apr 18, 2023
1 parent 3e6a475 commit c27c33a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion rpcs3/util/sysinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,25 @@ std::string utils::get_firmware_version()
version = version.substr(start, end - start);

// 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)
{
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);

if (dot_pos == umax)
Expand Down

0 comments on commit c27c33a

Please sign in to comment.