Some fixes, fixes PCjr when the emulator is started in full screen, fixes #1702.
This commit is contained in:
14
src/config.c
14
src/config.c
@@ -505,7 +505,7 @@ load_general(void)
|
|||||||
|
|
||||||
video_fullscreen_scale = config_get_int(cat, "video_fullscreen_scale", 0);
|
video_fullscreen_scale = config_get_int(cat, "video_fullscreen_scale", 0);
|
||||||
|
|
||||||
video_fullscreen_first = config_get_int(cat, "video_fullscreen_first", 1);
|
video_fullscreen_first = config_get_int(cat, "video_fullscreen_first", 0);
|
||||||
|
|
||||||
video_filter_method = config_get_int(cat, "video_filter_method", 1);
|
video_filter_method = config_get_int(cat, "video_filter_method", 1);
|
||||||
|
|
||||||
@@ -524,7 +524,10 @@ load_general(void)
|
|||||||
update_icons = config_get_int(cat, "update_icons", 1);
|
update_icons = config_get_int(cat, "update_icons", 1);
|
||||||
|
|
||||||
window_remember = config_get_int(cat, "window_remember", 0);
|
window_remember = config_get_int(cat, "window_remember", 0);
|
||||||
if (window_remember) {
|
if (window_remember || (vid_resize & 2)) {
|
||||||
|
if (!window_remember)
|
||||||
|
config_delete_var(cat, "window_remember");
|
||||||
|
|
||||||
p = config_get_string(cat, "window_coordinates", NULL);
|
p = config_get_string(cat, "window_coordinates", NULL);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
p = "0, 0, 0, 0";
|
p = "0, 0, 0, 0";
|
||||||
@@ -2156,8 +2159,11 @@ save_general(void)
|
|||||||
else
|
else
|
||||||
config_set_int(cat, "update_icons", update_icons);
|
config_set_int(cat, "update_icons", update_icons);
|
||||||
|
|
||||||
if (window_remember) {
|
if (window_remember || (vid_resize & 2)) {
|
||||||
config_set_int(cat, "window_remember", window_remember);
|
if (window_remember)
|
||||||
|
config_set_int(cat, "window_remember", window_remember);
|
||||||
|
else
|
||||||
|
config_delete_var(cat, "window_remember");
|
||||||
|
|
||||||
sprintf(temp, "%i, %i, %i, %i", window_w, window_h, window_x, window_y);
|
sprintf(temp, "%i, %i, %i, %i", window_w, window_h, window_x, window_y);
|
||||||
config_set_string(cat, "window_coordinates", temp);
|
config_set_string(cat, "window_coordinates", temp);
|
||||||
|
@@ -1047,10 +1047,10 @@ plat_setfullscreen(int on)
|
|||||||
int dpi = win_get_dpi(hwndMain);
|
int dpi = win_get_dpi(hwndMain);
|
||||||
|
|
||||||
/* Are we changing from the same state to the same state? */
|
/* Are we changing from the same state to the same state? */
|
||||||
if ((!!on) == (!!video_fullscreen))
|
if ((!!(on & 1)) == (!!video_fullscreen))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (on && video_fullscreen_first) {
|
if (on && (start_in_fullscreen || video_fullscreen_first)) {
|
||||||
video_fullscreen |= 2;
|
video_fullscreen |= 2;
|
||||||
if (ui_msgbox_header(MBX_INFO | MBX_DONTASK, (wchar_t *) IDS_2134, (wchar_t *) IDS_2052) == 10) {
|
if (ui_msgbox_header(MBX_INFO | MBX_DONTASK, (wchar_t *) IDS_2134, (wchar_t *) IDS_2052) == 10) {
|
||||||
video_fullscreen_first = 0;
|
video_fullscreen_first = 0;
|
||||||
@@ -1060,13 +1060,14 @@ plat_setfullscreen(int on)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* OK, claim the video. */
|
/* OK, claim the video. */
|
||||||
win_mouse_close();
|
if (!(on & 2))
|
||||||
|
win_mouse_close();
|
||||||
|
|
||||||
/* Close the current mode, and open the new one. */
|
/* Close the current mode, and open the new one. */
|
||||||
video_fullscreen = on | 2;
|
video_fullscreen = (on & 1) | 2;
|
||||||
if (vid_apis[vid_api].set_fs)
|
if (vid_apis[vid_api].set_fs)
|
||||||
vid_apis[vid_api].set_fs(on);
|
vid_apis[vid_api].set_fs(on & 1);
|
||||||
if (!on) {
|
if (!(on & 1)) {
|
||||||
plat_resize(scrnsz_x, scrnsz_y);
|
plat_resize(scrnsz_x, scrnsz_y);
|
||||||
if (vid_resize) {
|
if (vid_resize) {
|
||||||
/* scale the screen base on DPI */
|
/* scale the screen base on DPI */
|
||||||
@@ -1114,26 +1115,31 @@ plat_setfullscreen(int on)
|
|||||||
}
|
}
|
||||||
video_fullscreen &= 1;
|
video_fullscreen &= 1;
|
||||||
video_force_resize_set(1);
|
video_force_resize_set(1);
|
||||||
if (!on)
|
if (!(on & 1))
|
||||||
doresize = 1;
|
doresize = 1;
|
||||||
|
|
||||||
win_mouse_init();
|
win_mouse_init();
|
||||||
|
|
||||||
/* Release video and make it redraw the screen. */
|
if (!(on & 2)) {
|
||||||
device_force_redraw();
|
/* Release video and make it redraw the screen. */
|
||||||
|
device_force_redraw();
|
||||||
|
|
||||||
/* Send a CTRL break code so CTRL does not get stuck. */
|
/* Send a CTRL break code so CTRL does not get stuck. */
|
||||||
keyboard_input(0, 0x01D);
|
keyboard_input(0, 0x01D);
|
||||||
|
}
|
||||||
|
|
||||||
/* Finally, handle the host's mouse cursor. */
|
/* Finally, handle the host's mouse cursor. */
|
||||||
/* win_log("%s full screen, %s cursor\n", on ? "enter" : "leave", on ? "hide" : "show"); */
|
/* win_log("%s full screen, %s cursor\n", on ? "enter" : "leave", on ? "hide" : "show"); */
|
||||||
show_cursor(video_fullscreen ? 0 : -1);
|
show_cursor(video_fullscreen ? 0 : -1);
|
||||||
|
|
||||||
/* This is needed for OpenGL. */
|
if (!(on & 2)) {
|
||||||
plat_vidapi_enable(0);
|
/* This is needed for OpenGL. */
|
||||||
plat_vidapi_enable(1);
|
plat_vidapi_enable(0);
|
||||||
|
plat_vidapi_enable(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
plat_vid_reload_options(void)
|
plat_vid_reload_options(void)
|
||||||
{
|
{
|
||||||
|
@@ -234,7 +234,7 @@ sdl_blit(int x, int y, int w, int h)
|
|||||||
SDL_Rect r_src;
|
SDL_Rect r_src;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!sdl_enabled || (h <= 0) || (buffer32 == NULL) || (sdl_render == NULL) || (sdl_tex == NULL)) {
|
if (!sdl_enabled || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (buffer32 == NULL) || (sdl_render == NULL) || (sdl_tex == NULL)) {
|
||||||
video_blit_complete();
|
video_blit_complete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -277,6 +277,11 @@ sdl_destroy_window(void)
|
|||||||
static void
|
static void
|
||||||
sdl_destroy_texture(void)
|
sdl_destroy_texture(void)
|
||||||
{
|
{
|
||||||
|
if (sdl_tex != NULL) {
|
||||||
|
SDL_DestroyTexture(sdl_tex);
|
||||||
|
sdl_tex = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* SDL_DestroyRenderer also automatically destroys all associated textures. */
|
/* SDL_DestroyRenderer also automatically destroys all associated textures. */
|
||||||
if (sdl_render != NULL) {
|
if (sdl_render != NULL) {
|
||||||
SDL_DestroyRenderer(sdl_render);
|
SDL_DestroyRenderer(sdl_render);
|
||||||
@@ -339,13 +344,8 @@ sdl_select_best_hw_driver(void)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sdl_reinit_texture(void)
|
sdl_init_texture(void)
|
||||||
{
|
{
|
||||||
if (sdl_flags == -1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sdl_destroy_texture();
|
|
||||||
|
|
||||||
if (sdl_flags & RENDERER_HARDWARE) {
|
if (sdl_flags & RENDERER_HARDWARE) {
|
||||||
sdl_render = SDL_CreateRenderer(sdl_win, -1, SDL_RENDERER_ACCELERATED);
|
sdl_render = SDL_CreateRenderer(sdl_win, -1, SDL_RENDERER_ACCELERATED);
|
||||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, video_filter_method ? "1" : "0");
|
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, video_filter_method ? "1" : "0");
|
||||||
@@ -357,6 +357,17 @@ sdl_reinit_texture(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
sdl_reinit_texture(void)
|
||||||
|
{
|
||||||
|
if (sdl_flags == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
sdl_destroy_texture();
|
||||||
|
sdl_init_texture();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sdl_set_fs(int fs)
|
sdl_set_fs(int fs)
|
||||||
{
|
{
|
||||||
@@ -365,7 +376,6 @@ sdl_set_fs(int fs)
|
|||||||
|
|
||||||
SDL_LockMutex(sdl_mutex);
|
SDL_LockMutex(sdl_mutex);
|
||||||
sdl_enabled = 0;
|
sdl_enabled = 0;
|
||||||
sdl_destroy_texture();
|
|
||||||
|
|
||||||
if (fs) {
|
if (fs) {
|
||||||
ShowWindow(sdl_parent_hwnd, TRUE);
|
ShowWindow(sdl_parent_hwnd, TRUE);
|
||||||
@@ -408,7 +418,7 @@ sdl_set_fs(int fs)
|
|||||||
else
|
else
|
||||||
sdl_flags &= ~RENDERER_FULL_SCREEN;
|
sdl_flags &= ~RENDERER_FULL_SCREEN;
|
||||||
|
|
||||||
sdl_reinit_texture();
|
// sdl_reinit_texture();
|
||||||
sdl_enabled = 1;
|
sdl_enabled = 1;
|
||||||
SDL_UnlockMutex(sdl_mutex);
|
SDL_UnlockMutex(sdl_mutex);
|
||||||
}
|
}
|
||||||
@@ -456,6 +466,7 @@ sdl_init_common(int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sdl_win = SDL_CreateWindowFrom((void *)hwndRender);
|
sdl_win = SDL_CreateWindowFrom((void *)hwndRender);
|
||||||
|
sdl_init_texture();
|
||||||
sdl_set_fs(video_fullscreen & 1);
|
sdl_set_fs(video_fullscreen & 1);
|
||||||
|
|
||||||
/* Make sure we get a clean exit. */
|
/* Make sure we get a clean exit. */
|
||||||
@@ -554,16 +565,16 @@ sdl_enable(int enable)
|
|||||||
SDL_UnlockMutex(sdl_mutex);
|
SDL_UnlockMutex(sdl_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sdl_reload(void)
|
sdl_reload(void)
|
||||||
{
|
{
|
||||||
if (sdl_flags & RENDERER_HARDWARE)
|
if (sdl_flags & RENDERER_HARDWARE) {
|
||||||
{
|
SDL_LockMutex(sdl_mutex);
|
||||||
SDL_LockMutex(sdl_mutex);
|
|
||||||
|
|
||||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, video_filter_method ? "1" : "0");
|
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, video_filter_method ? "1" : "0");
|
||||||
sdl_reinit_texture();
|
sdl_reinit_texture();
|
||||||
|
|
||||||
SDL_UnlockMutex(sdl_mutex);
|
SDL_UnlockMutex(sdl_mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1427,7 +1427,8 @@ ui_init(int nCmdShow)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the mouse module. */
|
/* Initialize the mouse module. */
|
||||||
win_mouse_init();
|
if (!start_in_fullscreen && !video_fullscreen_first)
|
||||||
|
win_mouse_init();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Before we can create the Render window, we first have
|
* Before we can create the Render window, we first have
|
||||||
@@ -1457,16 +1458,16 @@ ui_init(int nCmdShow)
|
|||||||
else
|
else
|
||||||
plat_resize(scrnsz_x, scrnsz_y);
|
plat_resize(scrnsz_x, scrnsz_y);
|
||||||
|
|
||||||
|
/* Initialize the rendering window, or fullscreen. */
|
||||||
|
if (start_in_fullscreen || video_fullscreen_first)
|
||||||
|
plat_setfullscreen(3);
|
||||||
|
|
||||||
/* Fire up the machine. */
|
/* Fire up the machine. */
|
||||||
pc_reset_hard_init();
|
pc_reset_hard_init();
|
||||||
|
|
||||||
/* Set the PAUSE mode depending on the renderer. */
|
/* Set the PAUSE mode depending on the renderer. */
|
||||||
plat_pause(0);
|
plat_pause(0);
|
||||||
|
|
||||||
/* Initialize the rendering window, or fullscreen. */
|
|
||||||
if (start_in_fullscreen)
|
|
||||||
plat_setfullscreen(1);
|
|
||||||
|
|
||||||
/* If so requested via the command line, inform the
|
/* If so requested via the command line, inform the
|
||||||
* application that started us of our HWND, using the
|
* application that started us of our HWND, using the
|
||||||
* the hWnd and unique ID the application has given
|
* the hWnd and unique ID the application has given
|
||||||
|
Reference in New Issue
Block a user