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