diff options
Diffstat (limited to 'src/frontend/mame/ui/info.cpp')
-rw-r--r-- | src/frontend/mame/ui/info.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/frontend/mame/ui/info.cpp b/src/frontend/mame/ui/info.cpp index 3e9623369a3..47935d26bd5 100644 --- a/src/frontend/mame/ui/info.cpp +++ b/src/frontend/mame/ui/info.cpp @@ -464,13 +464,16 @@ std::string machine_info::game_info_string() const detail = _("Vector"); else { - std::string hz(std::to_string(u32(screen.frame_period().as_hz() * 1'000'000 + 0.5))); - size_t dpos = hz.length() - 6; - if (dpos == 0) - hz.insert(dpos++, "0"); - hz.insert(dpos, "."); - size_t last = hz.find_last_not_of('0'); - hz = hz.substr(0, last + (last != dpos ? 1 : 0)); + const u32 rate = u32(screen.frame_period().as_hz() * 1'000'000 + 0.5); + const bool valid = rate >= 1'000'000; + std::string hz(valid ? std::to_string(rate) : "?"); + if (valid) + { + size_t dpos = hz.length() - 6; + hz.insert(dpos, "."); + size_t last = hz.find_last_not_of('0'); + hz = hz.substr(0, last + (last != dpos ? 1 : 0)); + } const rectangle &visarea = screen.visible_area(); detail = string_format("%d " UTF8_MULTIPLY " %d (%s) %s" UTF8_NBSP "Hz", |