diff --git a/pyboy/plugins/window_dummy.py b/pyboy/plugins/window_dummy.py index 24964069f..e336956b8 100644 --- a/pyboy/plugins/window_dummy.py +++ b/pyboy/plugins/window_dummy.py @@ -18,9 +18,6 @@ def __init__(self, pyboy, mb, pyboy_argv): return pyboy._rendering(False) - logger.warning( - 'This window type does not support frame-limiting. `pyboy.set_emulation_speed(...)` will have no effect, as it\'s always running at full speed.' - ) def enabled(self): return self.pyboy_argv.get("window_type") == "dummy" diff --git a/pyboy/plugins/window_headless.py b/pyboy/plugins/window_headless.py index 3e8e53cb1..35b98f415 100644 --- a/pyboy/plugins/window_headless.py +++ b/pyboy/plugins/window_headless.py @@ -17,10 +17,6 @@ def __init__(self, pyboy, mb, pyboy_argv): if not self.enabled(): return - logger.warning( - 'This window type does not support frame-limiting. `pyboy.set_emulation_speed(...)` will have no effect, as it\'s always running at full speed.' - ) - def enabled(self): return self.pyboy_argv.get("window_type") == "headless" diff --git a/pyboy/pyboy.py b/pyboy/pyboy.py index 8798a03c4..fcf2a461c 100644 --- a/pyboy/pyboy.py +++ b/pyboy/pyboy.py @@ -485,6 +485,17 @@ def set_emulation_speed(self, target_speed): Args: target_speed (int): Target emulation speed as multiplier of real-time. """ + if self.initialized: + unsupported_window_types_enabled = [ + self.plugin_manager.window_dummy_enabled, + self.plugin_manager.window_headless_enabled, + self.plugin_manager.window_open_gl_enabled + ] + if any(unsupported_window_types_enabled): + logger.warning( + 'This window type does not support frame-limiting. `pyboy.set_emulation_speed(...)` will have no effect, as it\'s always running at full speed.' + ) + if target_speed > 5: logger.warning("The emulation speed might not be accurate when speed-target is higher than 5") self.target_emulationspeed = target_speed