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