graphics_framebuffer.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <QDockWidget>
  6. #include "video_core/debug_utils/debug_utils.h"
  7. class QComboBox;
  8. class QLabel;
  9. class QSpinBox;
  10. class CSpinBox;
  11. // Utility class which forwards calls to OnPicaBreakPointHit and OnPicaResume to public slots.
  12. // This is because the Pica breakpoint callbacks are called from a non-GUI thread, while
  13. // the widget usually wants to perform reactions in the GUI thread.
  14. class BreakPointObserverDock : public QDockWidget, Pica::DebugContext::BreakPointObserver {
  15. Q_OBJECT
  16. public:
  17. BreakPointObserverDock(std::shared_ptr<Pica::DebugContext> debug_context, const QString& title,
  18. QWidget* parent = nullptr);
  19. void OnPicaBreakPointHit(Pica::DebugContext::Event event, void* data) override;
  20. void OnPicaResume() override;
  21. private slots:
  22. virtual void OnBreakPointHit(Pica::DebugContext::Event event, void* data) = 0;
  23. virtual void OnResumed() = 0;
  24. signals:
  25. void Resumed();
  26. void BreakPointHit(Pica::DebugContext::Event event, void* data);
  27. };
  28. class GraphicsFramebufferWidget : public BreakPointObserverDock {
  29. Q_OBJECT
  30. using Event = Pica::DebugContext::Event;
  31. enum class Source {
  32. PicaTarget = 0,
  33. Custom = 1,
  34. // TODO: Add GPU framebuffer sources!
  35. };
  36. enum class Format {
  37. RGBA8 = 0,
  38. RGB8 = 1,
  39. RGBA5551 = 2,
  40. RGB565 = 3,
  41. RGBA4 = 4,
  42. };
  43. public:
  44. GraphicsFramebufferWidget(std::shared_ptr<Pica::DebugContext> debug_context, QWidget* parent = nullptr);
  45. public slots:
  46. void OnFramebufferSourceChanged(int new_value);
  47. void OnFramebufferAddressChanged(qint64 new_value);
  48. void OnFramebufferWidthChanged(unsigned int new_value);
  49. void OnFramebufferHeightChanged(unsigned int new_value);
  50. void OnFramebufferFormatChanged(int new_value);
  51. void OnUpdate();
  52. private slots:
  53. void OnBreakPointHit(Pica::DebugContext::Event event, void* data) override;
  54. void OnResumed() override;
  55. signals:
  56. void Update();
  57. private:
  58. QComboBox* framebuffer_source_list;
  59. CSpinBox* framebuffer_address_control;
  60. QSpinBox* framebuffer_width_control;
  61. QSpinBox* framebuffer_height_control;
  62. QComboBox* framebuffer_format_control;
  63. QLabel* framebuffer_picture_label;
  64. Source framebuffer_source;
  65. unsigned framebuffer_address;
  66. unsigned framebuffer_width;
  67. unsigned framebuffer_height;
  68. Format framebuffer_format;
  69. };