mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 23:37:46 -04:00
platform sdl, fix minor bug in window size handling
This commit is contained in:
parent
e64742875a
commit
5aa5700685
2 changed files with 22 additions and 7 deletions
|
@ -161,6 +161,14 @@ void plat_video_set_size(int w, int h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void plat_video_set_shadow(int w, int h)
|
||||||
|
{
|
||||||
|
g_screen_width = w;
|
||||||
|
g_screen_height = h;
|
||||||
|
g_screen_ppitch = w;
|
||||||
|
g_screen_ptr = shadow_fb;
|
||||||
|
}
|
||||||
|
|
||||||
void plat_video_flip(void)
|
void plat_video_flip(void)
|
||||||
{
|
{
|
||||||
resize_buffers();
|
resize_buffers();
|
||||||
|
@ -292,8 +300,13 @@ void plat_video_loop_prepare(void)
|
||||||
|
|
||||||
// switch over to scaled output if available, but keep the aspect ratio
|
// switch over to scaled output if available, but keep the aspect ratio
|
||||||
if (plat_sdl_overlay || plat_sdl_gl_active) {
|
if (plat_sdl_overlay || plat_sdl_gl_active) {
|
||||||
|
if (g_menuscreen_w * 240 >= g_menuscreen_h * 320) {
|
||||||
g_screen_width = (240 * g_menuscreen_w/g_menuscreen_h) & ~1;
|
g_screen_width = (240 * g_menuscreen_w/g_menuscreen_h) & ~1;
|
||||||
g_screen_height= 240;
|
g_screen_height= 240;
|
||||||
|
} else {
|
||||||
|
g_screen_width = 320;
|
||||||
|
g_screen_height= (320 * g_menuscreen_h/g_menuscreen_w) & ~1;
|
||||||
|
}
|
||||||
g_screen_ppitch = g_screen_width;
|
g_screen_ppitch = g_screen_width;
|
||||||
g_screen_ptr = shadow_fb;
|
g_screen_ptr = shadow_fb;
|
||||||
}
|
}
|
||||||
|
@ -317,11 +330,13 @@ void plat_early_init(void)
|
||||||
static void plat_sdl_resize(int w, int h)
|
static void plat_sdl_resize(int w, int h)
|
||||||
{
|
{
|
||||||
// take over new settings
|
// take over new settings
|
||||||
|
if (plat_sdl_screen->w != area.w || plat_sdl_screen->h != area.h) {
|
||||||
g_menuscreen_h = plat_sdl_screen->h;
|
g_menuscreen_h = plat_sdl_screen->h;
|
||||||
g_menuscreen_w = plat_sdl_screen->w;
|
g_menuscreen_w = plat_sdl_screen->w;
|
||||||
resize_buffers();
|
resize_buffers();
|
||||||
rendstatus_old = -1;
|
rendstatus_old = -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void plat_sdl_quit(void)
|
static void plat_sdl_quit(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -442,7 +442,7 @@ void pemu_loop_prep(void)
|
||||||
void pemu_loop_end(void)
|
void pemu_loop_end(void)
|
||||||
{
|
{
|
||||||
/* do one more frame for menu bg */
|
/* do one more frame for menu bg */
|
||||||
plat_video_set_size(320, 240);
|
plat_video_set_shadow(320, 240);
|
||||||
pemu_forced_frame(0, 1);
|
pemu_forced_frame(0, 1);
|
||||||
g_menubg_src_w = g_screen_width;
|
g_menubg_src_w = g_screen_width;
|
||||||
g_menubg_src_h = g_screen_height;
|
g_menubg_src_h = g_screen_height;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue