X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fcommon%2Fplat_sdl.c;h=4446f72e20ad16630d71ec18be014a58284d39b7;hb=2d2e57b2cf580eeea067c667183f8354d75b0238;hp=3387b952ce2855d83f338b3c5755734c80858d50;hpb=74e770b1ecb6f0f0e506fd20c511c801249b5f5f;p=picodrive.git diff --git a/platform/common/plat_sdl.c b/platform/common/plat_sdl.c index 3387b95..4446f72 100644 --- a/platform/common/plat_sdl.c +++ b/platform/common/plat_sdl.c @@ -35,6 +35,7 @@ const struct in_default_bind in_sdl_defbinds[] __attribute__((weak)) = { { SDLK_RETURN, IN_BINDTYPE_PLAYER12, GBTN_START }, { SDLK_f, IN_BINDTYPE_PLAYER12, GBTN_MODE }, { SDLK_ESCAPE, IN_BINDTYPE_EMU, PEVB_MENU }, + { SDLK_TAB, IN_BINDTYPE_EMU, PEVB_RESET }, { SDLK_F1, IN_BINDTYPE_EMU, PEVB_STATE_SAVE }, { SDLK_F2, IN_BINDTYPE_EMU, PEVB_STATE_LOAD }, { SDLK_F3, IN_BINDTYPE_EMU, PEVB_SSLOT_PREV }, @@ -157,19 +158,19 @@ void plat_video_flip(void) SDL_LockYUVOverlay(plat_sdl_overlay); rgb565_to_uyvy(plat_sdl_overlay->pixels[0], shadow_fb, - g_screen_width * g_screen_height); + g_screen_ppitch * g_screen_height); SDL_UnlockYUVOverlay(plat_sdl_overlay); SDL_DisplayYUVOverlay(plat_sdl_overlay, &dstrect); } else if (plat_sdl_gl_active) { - gl_flip(shadow_fb, g_screen_width, g_screen_height); + gl_flip(shadow_fb, g_screen_ppitch, g_screen_height); } else { if (SDL_MUSTLOCK(plat_sdl_screen)) SDL_UnlockSurface(plat_sdl_screen); SDL_Flip(plat_sdl_screen); g_screen_ptr = plat_sdl_screen->pixels; - PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2); + PicoDrawSetOutBuf(g_screen_ptr, g_screen_ppitch * 2); } } @@ -203,13 +204,13 @@ void plat_video_menu_end(void) SDL_LockYUVOverlay(plat_sdl_overlay); rgb565_to_uyvy(plat_sdl_overlay->pixels[0], shadow_fb, - g_menuscreen_w * g_menuscreen_h); + g_menuscreen_pp * g_menuscreen_h); SDL_UnlockYUVOverlay(plat_sdl_overlay); SDL_DisplayYUVOverlay(plat_sdl_overlay, &dstrect); } else if (plat_sdl_gl_active) { - gl_flip(g_menuscreen_ptr, g_menuscreen_w, g_menuscreen_h); + gl_flip(g_menuscreen_ptr, g_menuscreen_pp, g_menuscreen_h); } else { if (SDL_MUSTLOCK(plat_sdl_screen)) @@ -236,7 +237,7 @@ void plat_video_loop_prepare(void) SDL_LockSurface(plat_sdl_screen); g_screen_ptr = plat_sdl_screen->pixels; } - PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2); + PicoDrawSetOutBuf(g_screen_ptr, g_screen_ppitch * 2); } void plat_early_init(void) @@ -264,6 +265,7 @@ void plat_init(void) g_menuscreen_w = plat_sdl_screen->w; g_menuscreen_h = plat_sdl_screen->h; + g_menuscreen_pp = g_menuscreen_w; g_menuscreen_ptr = NULL; shadow_size = g_menuscreen_w * g_menuscreen_h * 2; @@ -271,7 +273,7 @@ void plat_init(void) shadow_size = 320 * 480 * 2; shadow_fb = malloc(shadow_size); - g_menubg_ptr = malloc(shadow_size); + g_menubg_ptr = calloc(1, shadow_size); if (shadow_fb == NULL || g_menubg_ptr == NULL) { fprintf(stderr, "OOM\n"); exit(1); @@ -279,6 +281,7 @@ void plat_init(void) g_screen_width = 320; g_screen_height = 240; + g_screen_ppitch = 320; g_screen_ptr = shadow_fb; in_sdl_init(&in_sdl_platform_data, plat_sdl_event_handler);