Debian Codegraph @

Source/Core/VideoCommon/Widescreen.h

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