libretro / mame2003-plus-libretro

Updated 2018 version of MAME (0.78) for libretro. with added game support plus many fixes and improvements
Other
191 stars 109 forks source link

use the frontend to display 'missing samples warning' #440

Closed markwkidd closed 5 years ago

markwkidd commented 6 years ago

Now that @grant2258 straightened out the logic that was segfaulting with incorrect romsets it got me thinking.

Sometime, maybe when I've got a three day weekend, I'd like to see if I can display a MAME UI/visual error message when the romset is wrong in addition to writing an error message to the log. Not a high priority improvement, but it would be cool 🕶

edit: bparker06 from RetroArch has used the nuklear barebones UI library to add status messages to a different core. I don't remember the details although I think it was a PSX emulator core. I'll try to find out. This is nuklear: https://github.com/vurtun/nuklear

markwkidd commented 6 years ago

hehe @grant2258 what do I see when I log into Discord this morning? You are talking about this same concept in #programming

markwkidd commented 6 years ago

r5 in the #programming channel mentioned this additional information:

bparker used ugui on beetle-psx. I think it writes a message directly to the core's [framebuffer] https://github.com/libretro/beetle-psx-libretro/tree/master/deps/ugui

gouchi also sent this link about ugui

markwkidd I think bparker mentioned IIRC ugui https://embeddedlightning.com/ugui

ghost commented 6 years ago

well we might just need to adjust our view of the mame ui no point in using something else when mame has it built in.

ghost commented 6 years ago

I do still firmly believe ra should be capable of showing a dialog box with information and a yes/no action maybe im expecting too much but ill implement it like we discussed on #programming for now.

markwkidd commented 5 years ago

I just had my mind blown by the news that the libretro API already allows us to display status messages via the frontend. the callback is RETRO_ENVIRONMENT_SET_MESSAGE which I'll definitely be looking into for use in this core!

I'm attaching a video of the way one of the PSX cores uses this notification to display a warning when the BIOS is missing. according to natinusula on discord these messages will still appear even if the core exists after adding the message to the queue.

video of mission BIOS OSD message in RetroArch

ghost commented 5 years ago

https://github.com/libretro/mame2003-plus-libretro/blob/3701ec3497e8439c28e2d43d59d216ceff255a6e/src/common.c#L1344-L1363

this is where you can add the messages

ghost commented 5 years ago

there is one little request i do have can you leave the log_cb in as well when you update this.

markwkidd commented 5 years ago

We should definitely keep log_cb intact.

Note to self: also use the OSD to display brief warning for romsets that are have a status of preliminary, baddump, nodump, or protection.

markwkidd commented 5 years ago

I have implemented messages for error and warning states during rom loading in common.c: https://github.com/libretro/mame2003-plus-libretro/commit/d7f62a55fd63ae2bbe6cc0542fe913ad7671b619

it's anticlimactic in RetroArch as far as the rom loading error though.

The way these OSD messages are implemented by RetroArch means there is no "stack" where there can be more than one message. Once I set the OSD message for a bad romset I think it is not appearing in RA because RA immediately uses the same OSD code to display an "Failed to Load Content" message that overrides the one I just set in the core.

Nonetheless that is just one frontend. "Stacked" RA notifications is being worked on, even, I think.

At any rate, I need to apply this to the other conditions mentioned in the new title, but it should be pretty painless. It will be useful even in RA as it is now to have warning messages about preliminary drivers.

ghost commented 5 years ago

Well this reminds me something does need fixed up. Ill tell you how to trigger this segfault make a new empty file call it boom.zip load it up youll get setfault. It a nice feature cheers for adding it Mark

Now rename this empty zip to wboy.zip load it it will say you have missing roms. (wboy) is a valid driver name.

Now when we get crash reports im thinking someone could be using a wrong erm set name we dont have. This is next on my todo list. Wont take long to track it down and that and fix that lil sucka.

ghost commented 5 years ago

@markwkidd there is a problem with error since it set bail you dont see it because the core closes down.

You might want to put a sleep in there for a second or two whatever you think is enough to see the message.

markwkidd commented 5 years ago

These messages are supposed to persist even after the core shuts down.

But as you mention it, waiting there might also be the best thing in order to make sure that's actually true and that some other message doesn't preempt this one.

ghost commented 5 years ago

i didnt see any message at all when i made a wboy.zip. Hmmm my notifications might be off for some reason i dont see anything when i press gamefocus mode i.m using a default config pretty sure i didnt change anything ill have a hunt about might be my end

markwkidd commented 5 years ago

When you set a message like this via the frontend it also logs into the console. Can you confirm you see the new code logging a message to the console at least? (I did in my testing before merging the new code)

ghost commented 5 years ago

looks like I did have them off but i just see the failed to load content notification now. That is enough of a hint to be honest will flag the warnings that the important bits

markwkidd commented 5 years ago

Alrighty, I've implemented a simple global function to make it about as easy to set a frontend message as it is to use log_cb: https://github.com/libretro/mame2003-plus-libretro/blob/29881d6ba74a6d3b5913092ae12b30b568b3e4db/src/mame2003/mame2003.c#L84-L89

I used that function to display a somewhat generic message when there are driver warnings: https://github.com/libretro/mame2003-plus-libretro/blob/29881d6ba74a6d3b5913092ae12b30b568b3e4db/src/usrintrf.c#L2505

Ta-da! Right now it's just one generic message when there are driver warnings. I'm not sure whether it would be any better to include details since there is a limited amount of space for the text. screenshot 2018-12-10 15 05 56

ghost commented 5 years ago

how do you disable serialization mark at least this gives users some feedback hopefully is isint turned off when people set the skip warnings ect!

markwkidd commented 5 years ago

I'm not really sure how to disable serialization in a comprehensive way.

Right now there are a few drivers where I've added a field to disable the serialization at the code level but that's all I've done that touches on serialization.

markwkidd commented 5 years ago

@grant2258 here's the current serialization approach: https://github.com/libretro/mame2003-plus-libretro/issues/175#issuecomment-390328928

Because our driver declarations don't have the serialization metadata like more recent MAME, all I know to do is add it to drivers where we know there are problems. Basically the same situation as the controls.c where the serialization metadata would need to be enabled driver-by-driver.

markwkidd commented 5 years ago

@grant2258 do you know a good place to hook in a warning if the romset supports audio samples, but no samples are found? At first readthrough I didn't see a good spot.

ghost commented 5 years ago

https://github.com/libretro/mame2003-plus-libretro/blob/8dff23b3a58809e29794f9de2e6f37e29aa54cd0/src/common.c#L447

set a flag here then clear the flag on print else it will make a message for every sample missing

markwkidd commented 5 years ago

Thanks @grant2258 I've just merged a PR that lets me close this issue! Woo! https://github.com/libretro/mame2003-plus-libretro/pull/541

Of course if more frontend messages are needed more can be added!

ghost commented 5 years ago

nice work! i dont see any games marked with GAME_DOESNT_SERIALIZE ?

markwkidd commented 5 years ago

I think Sexy Parodius is flagged as doesn't serialize. I'm away from my computer for a bit but I'll see what's up once I'm back.

On Sat, Dec 15, 2018, 9:08 PM grant2258 <notifications@github.com wrote:

nice work! i dont see any games marked with GAME_DOESNT_SERIALIZE ?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/libretro/mame2003-plus-libretro/issues/440#issuecomment-447612097, or mute the thread https://github.com/notifications/unsubscribe-auth/ASphdiBGOZKxk0ZdkASgMW-uY21Plk42ks5u5asVgaJpZM4YB9Ke .

ghost commented 5 years ago

im off to bed myself left some info for you in discord got the games i know of crashing running