mirror of
https://github.com/holub/mame
synced 2025-06-06 12:53:46 +03:00
ui: remove clock freqs trailing 0s on machine info screen (nw)
This commit is contained in:
parent
065a401ac0
commit
5e0edb6f4a
@ -57,7 +57,7 @@ void menu_device_config::populate(float &customtop, float &custombottom)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// get cpu specific clock that takes internal multiplier/dividers into account
|
// get cpu specific clock that takes internal multiplier/dividers into account
|
||||||
int clock = exec.device().clock();
|
u32 clock = exec.device().clock();
|
||||||
|
|
||||||
// count how many identical CPUs we have
|
// count how many identical CPUs we have
|
||||||
int count = 1;
|
int count = 1;
|
||||||
@ -69,16 +69,23 @@ void menu_device_config::populate(float &customtop, float &custombottom)
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if more than one, prepend a #x in front of the CPU name and display clock in kHz or MHz
|
std::string hz(std::to_string(clock));
|
||||||
util::stream_format(
|
int d = (clock >= 1'000'000'000) ? 9 : (clock >= 1'000'000) ? 6 : (clock >= 1000) ? 3 : 0;
|
||||||
str,
|
if (d > 0)
|
||||||
|
{
|
||||||
|
size_t dpos = hz.length() - d;
|
||||||
|
hz.insert(dpos, ".");
|
||||||
|
size_t last = hz.find_last_not_of('0');
|
||||||
|
hz = hz.substr(0, last + (last != dpos ? 1 : 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// if more than one, prepend a #x in front of the CPU name and display clock
|
||||||
|
util::stream_format(str,
|
||||||
(count > 1)
|
(count > 1)
|
||||||
? ((clock >= 1000000) ? _(" %1$d\xC3\x97%2$s %3$d.%4$06d\xC2\xA0MHz\n") : _(" %1$d\xC3\x97%2$s %5$d.%6$03d\xC2\xA0kHz\n"))
|
? ((clock != 0) ? " %1$d" UTF8_MULTIPLY "%2$s %3$s" UTF8_NBSP "%4$s\n" : " %1$d" UTF8_MULTIPLY "%2$s\n")
|
||||||
: ((clock >= 1000000) ? _(" %2$s %3$d.%4$06d\xC2\xA0MHz\n") : _(" %2$s %5$d.%6$03d\xC2\xA0kHz\n")),
|
: ((clock != 0) ? " %2$s %3$s" UTF8_NBSP "%4$s\n" : " %2$s\n"),
|
||||||
count,
|
count, name, hz,
|
||||||
name,
|
(d == 9) ? _("GHz") : (d == 6) ? _("MHz") : (d == 3) ? _("kHz") : _("Hz"));
|
||||||
clock / 1000000, clock % 1000000,
|
|
||||||
clock / 1000, clock % 1000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,17 +102,21 @@ void menu_device_config::populate(float &customtop, float &custombottom)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const rectangle &visarea = screen.visible_area();
|
std::string hz(std::to_string(float(screen.frame_period().as_hz())));
|
||||||
|
size_t last = hz.find_last_not_of('0');
|
||||||
|
size_t dpos = hz.find_last_of('.');
|
||||||
|
hz = hz.substr(0, last + (last != dpos ? 1 : 0));
|
||||||
|
|
||||||
|
const rectangle &visarea = screen.visible_area();
|
||||||
util::stream_format(
|
util::stream_format(
|
||||||
str,
|
str,
|
||||||
(screen.orientation() & ORIENTATION_SWAP_XY)
|
(screen.orientation() & ORIENTATION_SWAP_XY)
|
||||||
? _(" Screen '%1$s': %2$d \xC3\x97 %3$d (V) %4$f\xC2\xA0Hz\n")
|
? _(" Screen '%1$s': %2$d \xC3\x97 %3$d (V) %4$s\xC2\xA0Hz\n")
|
||||||
: _(" Screen '%1$s': %2$d \xC3\x97 %3$d (H) %4$f\xC2\xA0Hz\n"),
|
: _(" Screen '%1$s': %2$d \xC3\x97 %3$d (H) %4$s\xC2\xA0Hz\n"),
|
||||||
screen.tag(),
|
screen.tag(),
|
||||||
visarea.width(),
|
visarea.width(),
|
||||||
visarea.height(),
|
visarea.height(),
|
||||||
screen.frame_period().as_hz());
|
hz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,17 +140,25 @@ void menu_device_config::populate(float &customtop, float &custombottom)
|
|||||||
if (soundtags.insert(scan.device().tag()).second)
|
if (soundtags.insert(scan.device().tag()).second)
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
// if more than one, prepend a #x in front of the name and display clock in kHz or MHz
|
|
||||||
int const clock = sound.device().clock();
|
const u32 clock = sound.device().clock();
|
||||||
util::stream_format(
|
std::string hz(std::to_string(clock));
|
||||||
str,
|
int d = (clock >= 1'000'000'000) ? 9 : (clock >= 1'000'000) ? 6 : (clock >= 1000) ? 3 : 0;
|
||||||
|
if (d > 0)
|
||||||
|
{
|
||||||
|
size_t dpos = hz.length() - d;
|
||||||
|
hz.insert(dpos, ".");
|
||||||
|
size_t last = hz.find_last_not_of('0');
|
||||||
|
hz = hz.substr(0, last + (last != dpos ? 1 : 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// if more than one, prepend a #x in front of the name and display clock
|
||||||
|
util::stream_format(str,
|
||||||
(count > 1)
|
(count > 1)
|
||||||
? ((clock >= 1000000) ? _(" %1$d\xC3\x97%2$s %3$d.%4$06d\xC2\xA0MHz\n") : clock ? _(" %1$d\xC3\x97%2$s %5$d.%6$03d\xC2\xA0kHz\n") : _(" %1$d\xC3\x97%2$s\n"))
|
? ((clock != 0) ? " %1$d" UTF8_MULTIPLY "%2$s %3$s" UTF8_NBSP "%4$s\n" : " %1$d" UTF8_MULTIPLY "%2$s\n")
|
||||||
: ((clock >= 1000000) ? _(" %2$s %3$d.%4$06d\xC2\xA0MHz\n") : clock ? _(" %2$s %5$d.%6$03d\xC2\xA0kHz\n") : _(" %2$s\n")),
|
: ((clock != 0) ? " %2$s %3$s" UTF8_NBSP "%4$s\n" : " %2$s\n"),
|
||||||
count,
|
count, sound.device().name(), hz,
|
||||||
sound.device().name(),
|
(d == 9) ? _("GHz") : (d == 6) ? _("MHz") : (d == 3) ? _("kHz") : _("Hz"));
|
||||||
clock / 1000000, clock % 1000000,
|
|
||||||
clock / 1000, clock % 1000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ std::string machine_info::game_info_string() const
|
|||||||
if (!exectags.insert(exec.device().tag()).second)
|
if (!exectags.insert(exec.device().tag()).second)
|
||||||
continue;
|
continue;
|
||||||
// get cpu specific clock that takes internal multiplier/dividers into account
|
// get cpu specific clock that takes internal multiplier/dividers into account
|
||||||
int clock = exec.device().clock();
|
u32 clock = exec.device().clock();
|
||||||
|
|
||||||
// count how many identical CPUs we have
|
// count how many identical CPUs we have
|
||||||
int count = 1;
|
int count = 1;
|
||||||
@ -325,16 +325,23 @@ std::string machine_info::game_info_string() const
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if more than one, prepend a #x in front of the CPU name
|
std::string hz(std::to_string(clock));
|
||||||
// display clock in kHz or MHz
|
int d = (clock >= 1'000'000'000) ? 9 : (clock >= 1'000'000) ? 6 : (clock >= 1000) ? 3 : 0;
|
||||||
|
if (d > 0)
|
||||||
|
{
|
||||||
|
size_t dpos = hz.length() - d;
|
||||||
|
hz.insert(dpos, ".");
|
||||||
|
size_t last = hz.find_last_not_of('0');
|
||||||
|
hz = hz.substr(0, last + (last != dpos ? 1 : 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// if more than one, prepend a #x in front of the CPU name and display clock
|
||||||
util::stream_format(buf,
|
util::stream_format(buf,
|
||||||
(count > 1) ? "%1$d" UTF8_MULTIPLY "%2$s %3$d.%4$0*5$d%6$s\n" : "%2$s %3$d.%4$0*5$d%6$s\n",
|
(count > 1)
|
||||||
count,
|
? ((clock != 0) ? "%1$d" UTF8_MULTIPLY "%2$s %3$s" UTF8_NBSP "%4$s\n" : "%1$d" UTF8_MULTIPLY "%2$s\n")
|
||||||
name,
|
: ((clock != 0) ? "%2$s %3$s" UTF8_NBSP "%4$s\n" : "%2$s\n"),
|
||||||
(clock >= 1000000) ? (clock / 1000000) : (clock / 1000),
|
count, name, hz,
|
||||||
(clock >= 1000000) ? (clock % 1000000) : (clock % 1000),
|
(d == 9) ? _("GHz") : (d == 6) ? _("MHz") : (d == 3) ? _("kHz") : _("Hz"));
|
||||||
(clock >= 1000000) ? 6 : 3,
|
|
||||||
(clock >= 1000000) ? _("MHz") : _("kHz"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// loop over all sound chips
|
// loop over all sound chips
|
||||||
@ -360,19 +367,24 @@ std::string machine_info::game_info_string() const
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if more than one, prepend a #x in front of the CPU name
|
const u32 clock = sound.device().clock();
|
||||||
// display clock in kHz or MHz
|
std::string hz(std::to_string(clock));
|
||||||
int clock = sound.device().clock();
|
int d = (clock >= 1'000'000'000) ? 9 : (clock >= 1'000'000) ? 6 : (clock >= 1000) ? 3 : 0;
|
||||||
|
if (d > 0)
|
||||||
|
{
|
||||||
|
size_t dpos = hz.length() - d;
|
||||||
|
hz.insert(dpos, ".");
|
||||||
|
size_t last = hz.find_last_not_of('0');
|
||||||
|
hz = hz.substr(0, last + (last != dpos ? 1 : 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// if more than one, prepend a #x in front of the soundchip name and display clock
|
||||||
util::stream_format(buf,
|
util::stream_format(buf,
|
||||||
(count > 1)
|
(count > 1)
|
||||||
? ((clock != 0) ? "%1$d" UTF8_MULTIPLY "%2$s %3$d.%4$0*5$d%6$s\n" : "%1$d" UTF8_MULTIPLY "%2$s\n")
|
? ((clock != 0) ? "%1$d" UTF8_MULTIPLY "%2$s %3$s" UTF8_NBSP "%4$s\n" : "%1$d" UTF8_MULTIPLY "%2$s\n")
|
||||||
: ((clock != 0) ? "%2$s %3$d.%4$0*5$d%6$s\n" : "%2$s\n"),
|
: ((clock != 0) ? "%2$s %3$s" UTF8_NBSP "%4$s\n" : "%2$s\n"),
|
||||||
count,
|
count, sound.device().name(), hz,
|
||||||
sound.device().name(),
|
(d == 9) ? _("GHz") : (d == 6) ? _("MHz") : (d == 3) ? _("kHz") : _("Hz"));
|
||||||
(clock >= 1000000) ? (clock / 1000000) : (clock / 1000),
|
|
||||||
(clock >= 1000000) ? (clock % 1000000) : (clock % 1000),
|
|
||||||
(clock >= 1000000) ? 6 : 3,
|
|
||||||
(clock >= 1000000) ? _("MHz") : _("kHz"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// display screen information
|
// display screen information
|
||||||
@ -390,11 +402,16 @@ std::string machine_info::game_info_string() const
|
|||||||
detail = _("Vector");
|
detail = _("Vector");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
std::string hz(std::to_string(float(screen.frame_period().as_hz())));
|
||||||
|
size_t last = hz.find_last_not_of('0');
|
||||||
|
size_t dpos = hz.find_last_of('.');
|
||||||
|
hz = hz.substr(0, last + (last != dpos ? 1 : 0));
|
||||||
|
|
||||||
const rectangle &visarea = screen.visible_area();
|
const rectangle &visarea = screen.visible_area();
|
||||||
detail = string_format("%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz",
|
detail = string_format("%d " UTF8_MULTIPLY " %d (%s) %s" UTF8_NBSP "Hz",
|
||||||
visarea.width(), visarea.height(),
|
visarea.width(), visarea.height(),
|
||||||
(screen.orientation() & ORIENTATION_SWAP_XY) ? "V" : "H",
|
(screen.orientation() & ORIENTATION_SWAP_XY) ? "V" : "H",
|
||||||
screen.frame_period().as_hz());
|
hz);
|
||||||
}
|
}
|
||||||
|
|
||||||
util::stream_format(buf,
|
util::stream_format(buf,
|
||||||
|
Loading…
Reference in New Issue
Block a user