irixxxx / picodrive

Fast MegaDrive/MegaCD/32X emulator
Other
47 stars 24 forks source link

cosmetic fixes for pandora port and PD 2.0 #102

Closed notaz closed 7 months ago

notaz commented 7 months ago

Remaining issues that need discussion:

For whatever reason PicoFrameStartSMS calls emu_video_mode_change every frame, which breaks SMS on pandora. The operation is also expensive as it has to do syscalls to set up the fb/layers. My quick hack was

-  if (Pico.est.rendstatus != rendstatus_old || lines != rendlines) {
+  if (rendstatus_old == -1 || lines != rendlines) {

but that seems wrong as that block also resets sprites to 0.

In libpicofe, e0bf7946 masks away old keys, but that breaks "hold R + press dpad" functionality for custom layer positioning. What is that masking for? Can we avoid masking keys that are kept held?

Other than that things seem to work ok, tested MD, 32X, CD, SMS, GG, SG.

irixxxx commented 7 months ago

I think the repeated call to emu_video_mode_change is caused by calling PicoDrawSetOutFormat inside it. Can you tell me why this in there? I think PicoDrawSetOutFormat should be called in plat_video_loop_prepare or in plat_video_toggle_renderer. Besides, I notice that the handling of rendstatus around calling emu_video_mode_change is different for SMS and MD. I'll have a look as to why that is.

I can't remember why I made this change to libpicofe. Might as well try to do without, or fix it.

irixxxx commented 7 months ago

I've changed the handling in FrameStartSMS, but I still think SetOutFormat shouldn't be called in emu_video_mode_change. Try this:

diff --git a/platform/pandora/plat.c b/platform/pandora/plat.c
index 9b71d87a..9db7a9bb 100644
--- a/platform/pandora/plat.c
+++ b/platform/pandora/plat.c
@@ -387,8 +387,6 @@ void emu_video_mode_change(int start_line, int line_count, int start_col, int co
        vout_fbdev_resize(layer_fb, fb_w, fb_h, 16, fb_left, fb_right, fb_top, fb_bottom, 4, 0);
        vout_fbdev_clear(layer_fb);
        plat_video_flip();
-
-       PicoDrawSetOutFormat(PDF_RGB555, 0);
 }

 void plat_video_loop_prepare(void)
@@ -397,6 +395,7 @@ void plat_video_loop_prepare(void)
        memset(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);
        g_menuscreen_ptr = vout_fbdev_flip(main_fb);

+       PicoDrawSetOutFormat(PDF_RGB555, 0);
        // emu_video_mode_change will call pnd_setup_layer()
 }

I've also checked to disable the menu key masking in libpicofe. No idea why I wanted this, but it apparently works without the masking.

notaz commented 7 months ago

Can you tell me why this in there?

Probably I thought it made sense 10 years ago. Moved now, seems to work.

I've also checked to disable the menu key masking in libpicofe.

You mean you removed it? If so, have you pushed?

irixxxx commented 7 months ago

No, not yet. I just conducted some basic tests, and that looked OK. I intend to look over the menu code to make sure that parallel key presses won't do harm though.

irixxxx commented 7 months ago

FYI I've pushed the change into my libpicofe fork.