diff options
Diffstat (limited to 'src/citra_qt/debugger/graphics/graphics_surface.h')
| -rw-r--r-- | src/citra_qt/debugger/graphics/graphics_surface.h | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/src/citra_qt/debugger/graphics/graphics_surface.h b/src/citra_qt/debugger/graphics/graphics_surface.h new file mode 100644 index 000000000..28f5650a7 --- /dev/null +++ b/src/citra_qt/debugger/graphics/graphics_surface.h | |||
| @@ -0,0 +1,118 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <QLabel> | ||
| 8 | #include <QPushButton> | ||
| 9 | #include "citra_qt/debugger/graphics/graphics_breakpoint_observer.h" | ||
| 10 | |||
| 11 | class QComboBox; | ||
| 12 | class QSpinBox; | ||
| 13 | class CSpinBox; | ||
| 14 | |||
| 15 | class GraphicsSurfaceWidget; | ||
| 16 | |||
| 17 | class SurfacePicture : public QLabel { | ||
| 18 | Q_OBJECT | ||
| 19 | |||
| 20 | public: | ||
| 21 | explicit SurfacePicture(QWidget* parent = nullptr, | ||
| 22 | GraphicsSurfaceWidget* surface_widget = nullptr); | ||
| 23 | ~SurfacePicture(); | ||
| 24 | |||
| 25 | protected slots: | ||
| 26 | virtual void mouseMoveEvent(QMouseEvent* event); | ||
| 27 | virtual void mousePressEvent(QMouseEvent* event); | ||
| 28 | |||
| 29 | private: | ||
| 30 | GraphicsSurfaceWidget* surface_widget; | ||
| 31 | }; | ||
| 32 | |||
| 33 | class GraphicsSurfaceWidget : public BreakPointObserverDock { | ||
| 34 | Q_OBJECT | ||
| 35 | |||
| 36 | using Event = Pica::DebugContext::Event; | ||
| 37 | |||
| 38 | enum class Source { | ||
| 39 | ColorBuffer = 0, | ||
| 40 | DepthBuffer = 1, | ||
| 41 | StencilBuffer = 2, | ||
| 42 | Texture0 = 3, | ||
| 43 | Texture1 = 4, | ||
| 44 | Texture2 = 5, | ||
| 45 | Custom = 6, | ||
| 46 | }; | ||
| 47 | |||
| 48 | enum class Format { | ||
| 49 | // These must match the TextureFormat type! | ||
| 50 | RGBA8 = 0, | ||
| 51 | RGB8 = 1, | ||
| 52 | RGB5A1 = 2, | ||
| 53 | RGB565 = 3, | ||
| 54 | RGBA4 = 4, | ||
| 55 | IA8 = 5, | ||
| 56 | RG8 = 6, ///< @note Also called HILO8 in 3DBrew. | ||
| 57 | I8 = 7, | ||
| 58 | A8 = 8, | ||
| 59 | IA4 = 9, | ||
| 60 | I4 = 10, | ||
| 61 | A4 = 11, | ||
| 62 | ETC1 = 12, // compressed | ||
| 63 | ETC1A4 = 13, | ||
| 64 | MaxTextureFormat = 13, | ||
| 65 | D16 = 14, | ||
| 66 | D24 = 15, | ||
| 67 | D24X8 = 16, | ||
| 68 | X24S8 = 17, | ||
| 69 | Unknown = 18, | ||
| 70 | }; | ||
| 71 | |||
| 72 | static unsigned int NibblesPerPixel(Format format); | ||
| 73 | |||
| 74 | public: | ||
| 75 | explicit GraphicsSurfaceWidget(std::shared_ptr<Pica::DebugContext> debug_context, | ||
| 76 | QWidget* parent = nullptr); | ||
| 77 | void Pick(int x, int y); | ||
| 78 | |||
| 79 | public slots: | ||
| 80 | void OnSurfaceSourceChanged(int new_value); | ||
| 81 | void OnSurfaceAddressChanged(qint64 new_value); | ||
| 82 | void OnSurfaceWidthChanged(int new_value); | ||
| 83 | void OnSurfaceHeightChanged(int new_value); | ||
| 84 | void OnSurfaceFormatChanged(int new_value); | ||
| 85 | void OnSurfacePickerXChanged(int new_value); | ||
| 86 | void OnSurfacePickerYChanged(int new_value); | ||
| 87 | void OnUpdate(); | ||
| 88 | |||
| 89 | private slots: | ||
| 90 | void OnBreakPointHit(Pica::DebugContext::Event event, void* data) override; | ||
| 91 | void OnResumed() override; | ||
| 92 | |||
| 93 | void SaveSurface(); | ||
| 94 | |||
| 95 | signals: | ||
| 96 | void Update(); | ||
| 97 | |||
| 98 | private: | ||
| 99 | QComboBox* surface_source_list; | ||
| 100 | CSpinBox* surface_address_control; | ||
| 101 | QSpinBox* surface_width_control; | ||
| 102 | QSpinBox* surface_height_control; | ||
| 103 | QComboBox* surface_format_control; | ||
| 104 | |||
| 105 | SurfacePicture* surface_picture_label; | ||
| 106 | QSpinBox* surface_picker_x_control; | ||
| 107 | QSpinBox* surface_picker_y_control; | ||
| 108 | QLabel* surface_info_label; | ||
| 109 | QPushButton* save_surface; | ||
| 110 | |||
| 111 | Source surface_source; | ||
| 112 | unsigned surface_address; | ||
| 113 | unsigned surface_width; | ||
| 114 | unsigned surface_height; | ||
| 115 | Format surface_format; | ||
| 116 | int surface_picker_x = 0; | ||
| 117 | int surface_picker_y = 0; | ||
| 118 | }; | ||