mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
Fullscreen/windowed fixes when using overrides (#16213)
This commit is contained in:
parent
bc5805e8e6
commit
c43f4738d9
3 changed files with 38 additions and 8 deletions
|
@ -33,6 +33,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "file_path_special.h"
|
#include "file_path_special.h"
|
||||||
|
#include "command.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "content.h"
|
#include "content.h"
|
||||||
#include "config.def.h"
|
#include "config.def.h"
|
||||||
|
@ -4451,6 +4452,10 @@ bool config_load_override_file(const char *config_path)
|
||||||
*/
|
*/
|
||||||
bool config_unload_override(void)
|
bool config_unload_override(void)
|
||||||
{
|
{
|
||||||
|
settings_t *settings = config_st;
|
||||||
|
bool fullscreen_prev = settings->bools.video_fullscreen;
|
||||||
|
uint32_t flags = runloop_get_flags();
|
||||||
|
|
||||||
runloop_state_get_ptr()->flags &= ~RUNLOOP_FLAG_OVERRIDES_ACTIVE;
|
runloop_state_get_ptr()->flags &= ~RUNLOOP_FLAG_OVERRIDES_ACTIVE;
|
||||||
path_clear(RARCH_PATH_CONFIG_OVERRIDE);
|
path_clear(RARCH_PATH_CONFIG_OVERRIDE);
|
||||||
|
|
||||||
|
@ -4462,6 +4467,20 @@ bool config_unload_override(void)
|
||||||
path_get(RARCH_PATH_CONFIG), config_st))
|
path_get(RARCH_PATH_CONFIG), config_st))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (settings->bools.video_fullscreen != fullscreen_prev)
|
||||||
|
{
|
||||||
|
/* This is for 'win32_common.c', so we don't save
|
||||||
|
* fullscreen size and position if we're switching
|
||||||
|
* back to windowed mode.
|
||||||
|
* Might be useful for other devices as well? */
|
||||||
|
if ( settings->bools.video_window_save_positions
|
||||||
|
&& !settings->bools.video_fullscreen)
|
||||||
|
settings->skip_window_positions = true;
|
||||||
|
|
||||||
|
if (flags & RUNLOOP_FLAG_CORE_RUNNING)
|
||||||
|
command_event(CMD_EVENT_REINIT, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
RARCH_LOG("[Overrides]: Configuration overrides unloaded, original configuration restored.\n");
|
RARCH_LOG("[Overrides]: Configuration overrides unloaded, original configuration restored.\n");
|
||||||
|
|
||||||
/* Reset save paths */
|
/* Reset save paths */
|
||||||
|
|
|
@ -569,6 +569,7 @@ typedef struct settings
|
||||||
} paths;
|
} paths;
|
||||||
|
|
||||||
bool modified;
|
bool modified;
|
||||||
|
bool skip_window_positions;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -877,17 +877,27 @@ static void win32_save_position(void)
|
||||||
placement.rcNormalPosition.right = 0;
|
placement.rcNormalPosition.right = 0;
|
||||||
placement.rcNormalPosition.bottom = 0;
|
placement.rcNormalPosition.bottom = 0;
|
||||||
|
|
||||||
if (GetWindowPlacement(main_window.hwnd, &placement))
|
/* If 'skip_window_positions' is true it means we've
|
||||||
|
* just unloaded an override that had fullscreen mode
|
||||||
|
* enabled while we have windowed mode set globally,
|
||||||
|
* in this case we skip the following blocks to not
|
||||||
|
* end up with fullscreen size and position. */
|
||||||
|
if (!settings->skip_window_positions)
|
||||||
{
|
{
|
||||||
g_win32->pos_x = placement.rcNormalPosition.left;
|
if (GetWindowPlacement(main_window.hwnd, &placement))
|
||||||
g_win32->pos_y = placement.rcNormalPosition.top;
|
{
|
||||||
}
|
g_win32->pos_x = placement.rcNormalPosition.left;
|
||||||
|
g_win32->pos_y = placement.rcNormalPosition.top;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetWindowRect(main_window.hwnd, &rect))
|
if (GetWindowRect(main_window.hwnd, &rect))
|
||||||
{
|
{
|
||||||
g_win32->pos_width = rect.right - rect.left;
|
g_win32->pos_width = rect.right - rect.left;
|
||||||
g_win32->pos_height = rect.bottom - rect.top;
|
g_win32->pos_height = rect.bottom - rect.top;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
settings->skip_window_positions = false;
|
||||||
|
|
||||||
if (window_save_positions)
|
if (window_save_positions)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue