summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Host.h
blob: 0eacfe646d9d6445a3c0b21c8dab3b626a58601e (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
48
49
50
51
52
53
54
55
56
57
58
// Copyright 2015 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <atomic>

#include <QObject>

// Singleton that talks to the Core via the interface defined in Core/Host.h.
// Because Host_* calls might come from different threads than the MainWindow,
// the Host class communicates with it via signals/slots only.

// Many of the Host_* functions are ignored, and some shouldn't exist.
class Host final : public QObject
{
  Q_OBJECT

public:
  ~Host() override;

  static Host* GetInstance();

  bool GetRenderFocus();
  bool GetRenderFullFocus();
  bool GetRenderFullscreen();
  bool GetGBAFocus();
  bool GetTASInputFocus() const;

  void SetMainWindowHandle(void* handle);
  void SetRenderHandle(void* handle);
  void SetRenderFocus(bool focus);
  void SetRenderFullFocus(bool focus);
  void SetRenderFullscreen(bool fullscreen);
  void SetTASInputFocus(bool focus);
  void ResizeSurface(int new_width, int new_height);

signals:
  void RequestTitle(const QString& title);
  void RequestStop();
  void RequestRenderSize(int w, int h);
  void UpdateDisasmDialog();
  void JitCacheInvalidation();
  void JitProfileDataWiped();
  void PPCSymbolsChanged();
  void PPCBreakpointsChanged();

private:
  Host();

  std::atomic<void*> m_render_handle{nullptr};
  std::atomic<void*> m_main_window_handle{nullptr};
  std::atomic<bool> m_render_to_main{false};
  std::atomic<bool> m_render_focus{false};
  std::atomic<bool> m_render_full_focus{false};
  std::atomic<bool> m_render_fullscreen{false};
  std::atomic<bool> m_tas_input_focus{false};
};