mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
AGS: Updated Multitasking setting
* Added `[misc] multitasking=[0,1]` to config, acting as a *starting* setting, which may be changed by runtime call to `SetMultitaskingMode`; * Ensure multitasking mode is overridden by connected external debugger (always on, if possible); * Let multitasking mode work in "fullscreen desktop" gfx mode (still disabled in exclusive fullscreen); * Now correctly reset multitasking mode if gfx mode changes. From upstream 9f091926e393f75c90c951f9597710bf17395332
This commit is contained in:
@@ -1219,9 +1219,6 @@ void display_switch_out_suspend() {
|
||||
}
|
||||
}
|
||||
|
||||
// restore the callbacks
|
||||
SetMultitasking(0);
|
||||
|
||||
_G(switching_away_from_game)--;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ struct GameSetup {
|
||||
bool load_latest_save; // load latest saved game on launch
|
||||
ScreenRotation rotation;
|
||||
bool show_fps;
|
||||
bool multitasking = false; // whether run on background, when game is switched out
|
||||
|
||||
DisplayModeSetup Screen;
|
||||
String software_render_driver;
|
||||
|
||||
@@ -643,19 +643,26 @@ void SetMultitasking(int mode) {
|
||||
if ((mode < 0) | (mode > 1))
|
||||
quit("!SetMultitasking: invalid mode parameter");
|
||||
|
||||
if (_GP(usetup).override_multitasking >= 0) {
|
||||
// Account for the override config option (must be checked first!)
|
||||
if ((_GP(usetup).override_multitasking >= 0) && (mode != _GP(usetup).override_multitasking)) {
|
||||
Debug::Printf("SetMultitasking: overridden by user config: %d -> %d", mode, _GP(usetup).override_multitasking);
|
||||
mode = _GP(usetup).override_multitasking;
|
||||
}
|
||||
|
||||
// Don't allow background running if full screen
|
||||
if ((mode == 1) && (!_GP(scsystem).windowed)) {
|
||||
Debug::Printf("SetMultitasking: overridden by fullscreen: %d -> %d", mode, 0);
|
||||
// Must run on background if debugger is connected
|
||||
if ((mode == 0) && (_G(editor_debugging_initialized) != 0)) {
|
||||
Debug::Printf("SetMultitasking: overridden by the external debugger: %d -> 1", mode);
|
||||
mode = 1;
|
||||
}
|
||||
|
||||
// Regardless, don't allow background running if exclusive full screen
|
||||
if ((mode == 1) && _G(gfxDriver)->GetDisplayMode().IsRealFullscreen()) {
|
||||
Debug::Printf("SetMultitasking: overridden by fullscreen: %d -> 0", mode);
|
||||
mode = 0;
|
||||
}
|
||||
|
||||
// Install engine callbacks for switching in and out the window
|
||||
Debug::Printf("SetMultitasking: mode %d", mode);
|
||||
Debug::Printf(kDbgMsg_Info, "Multitasking mode set: %d", mode);
|
||||
if (mode == 0) {
|
||||
sys_set_background_mode(false);
|
||||
sys_evt_set_focus_callbacks(display_switch_in_resume, display_switch_out_suspend);
|
||||
|
||||
@@ -349,6 +349,9 @@ void apply_config(const ConfigTree &cfg) {
|
||||
}
|
||||
}
|
||||
|
||||
// Various system options
|
||||
_GP(usetup).multitasking = CfgReadInt(cfg, "misc", "multitasking", 0) != 0;
|
||||
|
||||
// User's overrides and hacks
|
||||
_GP(usetup).override_multitasking = CfgReadInt(cfg, "override", "multitasking", -1);
|
||||
String override_os = CfgReadString(cfg, "override", "os");
|
||||
|
||||
@@ -1176,7 +1176,7 @@ int initialize_engine(const ConfigTree &startup_opts) {
|
||||
// Configure game window after renderer was initialized
|
||||
engine_setup_window();
|
||||
|
||||
SetMultitasking(0);
|
||||
SetMultitasking(_GP(usetup).multitasking);
|
||||
|
||||
sys_window_show_cursor(false); // hide the system cursor
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "ags/engine/ac/game_setup.h"
|
||||
#include "ags/shared/ac/game_setup_struct.h"
|
||||
#include "ags/engine/ac/game_state.h"
|
||||
#include "ags/engine/ac/global_game.h"
|
||||
#include "ags/engine/ac/mouse.h"
|
||||
#include "ags/engine/ac/runtime_defines.h"
|
||||
#include "ags/engine/ac/walk_behind.h"
|
||||
@@ -270,6 +271,9 @@ void engine_post_gfxmode_setup(const Size &init_desktop) {
|
||||
}
|
||||
engine_post_gfxmode_mouse_setup(init_desktop);
|
||||
|
||||
// reset multitasking (may be overridden by the current display mode)
|
||||
SetMultitasking(_GP(usetup).multitasking);
|
||||
|
||||
invalidate_screen();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "ags/shared/ac/common.h"
|
||||
#include "ags/shared/ac/character_info.h"
|
||||
#include "ags/engine/ac/game.h"
|
||||
#include "ags/engine/ac/game_setup.h"
|
||||
#include "ags/shared/ac/game_setup_struct.h"
|
||||
#include "ags/engine/ac/game_setup.h"
|
||||
#include "ags/engine/ac/game_state.h"
|
||||
@@ -57,6 +58,7 @@ void start_game_init_editor_debugging() {
|
||||
return;
|
||||
|
||||
// Debugger expects strict multitasking
|
||||
_GP(usetup).multitasking = true;
|
||||
_GP(usetup).override_multitasking = -1;
|
||||
SetMultitasking(1);
|
||||
|
||||
|
||||
@@ -473,8 +473,9 @@ bool graphics_mode_set_dm(const DisplayMode &dm) {
|
||||
_GP(SavedWindowedSetting).Dm = rdm;
|
||||
else
|
||||
_GP(SavedFullscreenSetting).Dm = rdm;
|
||||
Debug::Printf("Succeeded. Using gfx mode %d x %d (%d-bit) %s",
|
||||
rdm.Width, rdm.Height, rdm.ColorDepth, rdm.IsWindowed() ? "windowed" : "fullscreen");
|
||||
Debug::Printf(kDbgMsg_Info, "Graphics mode set: %d x %d (%d-bit) %s",
|
||||
rdm.Width, rdm.Height, rdm.ColorDepth,
|
||||
rdm.IsWindowed() ? "windowed" : (rdm.IsRealFullscreen() ? "fullscreen" : "fullscreen desktop"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user