Previous Thread
Next Thread
Print Thread
Page 1 of 2 1 2
Joined: Feb 2014
Posts: 896
Likes: 59
G
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 896
Likes: 59
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();
}


regular:

[Linked Image from i.imgur.com]


with UI indicator on:

[Linked Image from i.imgur.com]


What do you guys think?

Joined: May 2009
Posts: 2,070
Likes: 99
J
Very Senior Member
Offline
Very Senior Member
J
Joined: May 2009
Posts: 2,070
Likes: 99
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. smile

Joined: Feb 2014
Posts: 896
Likes: 59
G
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 896
Likes: 59
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".

Joined: Mar 2001
Posts: 16,943
Likes: 69
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,943
Likes: 69
You can rotate the graphics in the F4 viewer? Mind blown.

Joined: Jul 2019
Posts: 20
E
Member
Offline
Member
E
Joined: Jul 2019
Posts: 20
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 :-)

Joined: Feb 2004
Posts: 2,417
Likes: 130
Very Senior Member
Online Content
Very Senior Member
Joined: Feb 2004
Posts: 2,417
Likes: 130
The documentation does have a summary of the controls for the graphics viewer: https://docs.mamedev.org/usingmame/defaultkeys.html#mame-user-interface-controls

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

Joined: Jun 2001
Posts: 484
Likes: 4
O
Senior Member
Online Content
Senior Member
O
Joined: Jun 2001
Posts: 484
Likes: 4
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.

Joined: Feb 2014
Posts: 896
Likes: 59
G
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 896
Likes: 59
One thing that I always wanted was to see the key assignments because I can never remember all the different layouts.

Seems like every 80s computer wanted to put the colon, equals and asterisk in different spots.

I wrote a little lua script to make an overlay of a 104 key keyboard just as a proof of concept:

[Linked Image from i.imgur.com]
[Linked Image from i.imgur.com]
[Linked Image from i.imgur.com]

1 member likes this: =CO=Windler
Joined: Dec 2011
Posts: 184
Likes: 2
Senior Member
Offline
Senior Member
Joined: Dec 2011
Posts: 184
Likes: 2
The -natural switch on the command line is your friend in these cases. It remaps the odd key locations to what's standard for a modern PC keyboard.

Joined: Feb 2014
Posts: 896
Likes: 59
G
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 896
Likes: 59
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

With "KEYCODE_0_PAD" it would occasionally crash.

token=KEYCODE_0_PAD
Segmentation fault (core dumped)

Page 1 of 2 1 2

Link Copied to Clipboard
Who's Online Now
1 members (robcfg), 22 guests, and 1 robot.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,132
Posts119,651
Members5,029
Most Online890
Jan 17th, 2020
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com