Widescreen.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2023 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <memory>
  5. #include "VideoCommon/VideoConfig.h"
  6. #include "VideoCommon/VideoEvents.h"
  7. class PointerWrap;
  8. // This class is responsible for tracking the game's aspect ratio.
  9. // This exclusively supports 4:3 or 16:9 detection by default.
  10. class WidescreenManager
  11. {
  12. public:
  13. WidescreenManager();
  14. // Just a helper to tell whether the game seems to be running in widescreen,
  15. // or if it's being forced to.
  16. bool IsGameWidescreen() const { return m_is_game_widescreen; }
  17. void DoState(PointerWrap& p);
  18. private:
  19. enum class HeuristicState
  20. {
  21. Inactive,
  22. Active_NotFound,
  23. Active_Found_Normal,
  24. Active_Found_Anamorphic,
  25. };
  26. // Returns whether the widescreen state wants to change, and its target value
  27. std::optional<bool> GetWidescreenOverride() const;
  28. void UpdateWidescreenHeuristic();
  29. bool m_is_game_widescreen = false;
  30. bool m_was_orthographically_anamorphic = false;
  31. HeuristicState m_heuristic_state = HeuristicState::Inactive;
  32. Common::EventHook m_update_widescreen;
  33. Common::EventHook m_config_changed;
  34. };
  35. extern std::unique_ptr<WidescreenManager> g_widescreen;