Host.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Copyright 2015 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <atomic>
  5. #include <QObject>
  6. // Singleton that talks to the Core via the interface defined in Core/Host.h.
  7. // Because Host_* calls might come from different threads than the MainWindow,
  8. // the Host class communicates with it via signals/slots only.
  9. // Many of the Host_* functions are ignored, and some shouldn't exist.
  10. class Host final : public QObject
  11. {
  12. Q_OBJECT
  13. public:
  14. ~Host();
  15. static Host* GetInstance();
  16. bool GetRenderFocus();
  17. bool GetRenderFullFocus();
  18. bool GetRenderFullscreen();
  19. bool GetGBAFocus();
  20. bool GetTASInputFocus() const;
  21. void SetMainWindowHandle(void* handle);
  22. void SetRenderHandle(void* handle);
  23. void SetRenderFocus(bool focus);
  24. void SetRenderFullFocus(bool focus);
  25. void SetRenderFullscreen(bool fullscreen);
  26. void SetTASInputFocus(bool focus);
  27. void ResizeSurface(int new_width, int new_height);
  28. signals:
  29. void RequestTitle(const QString& title);
  30. void RequestStop();
  31. void RequestRenderSize(int w, int h);
  32. void UpdateDisasmDialog();
  33. void JitCacheInvalidation();
  34. void JitProfileDataWiped();
  35. void PPCSymbolsChanged();
  36. void PPCBreakpointsChanged();
  37. private:
  38. Host();
  39. std::atomic<void*> m_render_handle{nullptr};
  40. std::atomic<void*> m_main_window_handle{nullptr};
  41. std::atomic<bool> m_render_to_main{false};
  42. std::atomic<bool> m_render_focus{false};
  43. std::atomic<bool> m_render_full_focus{false};
  44. std::atomic<bool> m_render_fullscreen{false};
  45. std::atomic<bool> m_tas_input_focus{false};
  46. };