So I was thinking, how about an OSD indicator for whether the UI keys are active? Sure you can hit the SCROLL lock key to discover its status (and toggle them in the process), but why not an indicator of some kind?
Adding a single line to speed_text to check the machine().ui_active() and concatenating a " UI" to the end will add a little indicator.
Code
//-------------------------------------------------
// speed_text - print the text to be displayed
// into a string buffer
//-------------------------------------------------
std::string video_manager::speed_text()
{
std::ostringstream str;
// if we're paused, just display Paused
bool paused = machine().paused();
if (paused)
str << "paused";
// if we're fast forwarding, just display Fast-forward
else if (m_fastforward)
str << "fast ";
// if we're auto frameskipping, display that plus the level
else if (effective_autoframeskip())
util::stream_format(str, "auto%2d/%d", effective_frameskip(), m_frameskip_max ? m_frameskip_max : MAX_FRAMESKIP);
// otherwise, just display the frameskip plus the level
else
util::stream_format(str, "skip %d/%d", effective_frameskip(), MAX_FRAMESKIP);
// append the speed for all cases except paused
if (!paused)
util::stream_format(str, " %3d%%", int(100 * m_speed_percent + 0.5));
// display the number of partial updates as well
int partials = 0;
for (screen_device &screen : screen_device_enumerator(machine().root_device()))
partials += screen.partial_updates();
if (partials > 1)
util::stream_format(str, "\n%d partial updates", partials);
if (machine().ui_active()) str << " UI"; // just add a single line here <<<<<<<<<<<
return str.str();
}
I don't think much of it. - You already need to have the UI keys enabled in order to bring up the speed readout. - I don't know about everyone else, but I certainly don't make a habit of commonly running with the speed readout enabled, because I don't need that junk obstructing my view of the emulated machine. - Even without it up, giving a quick tap on 'P' is a readonably quick check to see if the UI keys are enabled. - The whole "UI keys" situation has a whole lot bigger fish to fry, like the keys still registering with the emulated machine as well as MAME's internal UI, than this change which doesn't really solve anything.
You're doing great with the discrete TTL stuff, but you very clearly aren't a UI/UX coder. Let's let the people who do that sort of thing professionally handle it, and then we can all stick to what we have an aptitude for.
One thing that could make the fps counter less obscuring is to set an alpha value of around 0.5:
void mame_ui_manager::draw_fps_counter(render_container &container) { draw_text_full( container, machine().video().speed_text(), 0.0f, 0.0f, 1.0f, ui::text_layout::text_justify::RIGHT, ui::text_layout::word_wrapping::WORD, OPAQUE_, rgb_t::white().set_a(128), rgb_t::black().set_a(128), nullptr, nullptr); // use set_a to set alpha to 0.5 }
I suppose one could create a lua plugin to show the status.
There isn't actually a command line option to turn on the fps counter on startup, I don't believe.
========================
Another thing I noticed was that you can't actually exit from mame using the menus. Sure, mame's geared to power users and you can use ESC or Alt+F4 or click on the close X, but for UI completeness shouldn't there be an Exit Mame option?
========================
After many years of using mame, I finally figured out how the F4 show decoded graphics option works. I'd see the palette and think oh boring then hit ESC. If I'd hit Return it would cycle to gfxdecode, then to tilemap, and back to palette. Something that would make it more user-friendly would be to display a list of the keys to use like R for rotate, Enter to go to graphics, +/- to zoom, etc. It's true that the gfxdecode keys are covered in the mame documentation, but I mistakenly believed it was just to show off the palette and nothing more.
I looked at the list of key assignments in the UI and could never figure out what "UI Rotate" was, finally I realized it was used for the rotation of "Show decoded graphics".
Another thing I noticed was that you can't actually exit from mame using the menus. Sure, mame's geared to power users and you can use ESC or Alt+F4 or click on the close X, but for UI completeness shouldn't there be an Exit Mame option?
I agree. For a while I was using CTRL-ALT-DEL to exit MAME until I found out about -window mode which gives you an X to click on :-)
That’s been there for ages now. Having the controls displayed on-screen all the time would waste a lot of space and quickly annoy people who do know what the controls are.
Originally Posted by exidyboy
Originally Posted by Golden Child
Another thing I noticed was that you can't actually exit from mame using the menus. Sure, mame's geared to power users and you can use ESC or Alt+F4 or click on the close X, but for UI completeness shouldn't there be an Exit Mame option?
I agree. For a while I was using CTRL-ALT-DEL to exit MAME until I found out about -window mode which gives you an X to click on :-)
Why would you need to do that? There are quite a few other ways to get your OS UI back:
On Windows, Alt+Tab and the Windows key will both get out out of full-screen MAME, even when UI controls are disabled. Then you can right-click the task bar icon and close MAME that way.
On macOS, I believe Command-Tab will always let you get focus off MAME if it hasn’t completely frozen.
If you’ve worked out how to disable UI controls or you’re running a system without a keyboard, Alt+Enter (or Option+Return) gets you out of full screen mode. This should be one of your first guesses, as it was the toggle full screen mode key combination for DOS prompts since Windows 3, and many games have copied it so it’s almost a standard.
Once you get focus off MAME, you can go and read the documentation :P
Also alt-enter will crash mame on linux because of weird race conditions in the communication with the X server, so that's a way to get out of mame too.
Yes, Alegend, that'll work too. I guess I'm so used to using the default keyboard that comes up.
Just for fun, let's check the pressed status of the keys:
One thing that didn't work properly (and segfaulted occasionally) is trying to use code_to_token on KEYCODE_0_PAD and the rest of the keypad tokens. For some reason, they come up as INVALID.
I suspect it has to do with how it breaks the tokens by underscores and the PAD tokens have an "extra" underscore like KEYCODE_1_PAD instead of how the other KEYCODE tokens don't have an extra underscore and are a single word like KEYCODE_OPENBRACE.
Code
X = manager.machine.input:code_from_token("KEYCODE_0_PAD") print( manager.machine.input:code_to_token(X))
INVALID
edit: here's something interesting: the keycode is labeled in the source as KEYCODE_0_PAD but passing KEYCODE_0PAD to code_to_token does work!
X = manager.machine.input:code_from_token("KEYCODE_0PAD") print( manager.machine.input:code_to_token(X))
KEYCODE_0PAD