CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Windows/GEDebugger/GEDebugger.h
Views: 1401
// Copyright (c) 2012- PPSSPP Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official git repository and contact information can be found at15// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.1617#pragma once1819#include "Common/CommonWindows.h"20#include "GPU/Common/GPUDebugInterface.h"21#include "GPU/Debugger/Debugger.h"22#include "Windows/resource.h"23#include "Windows/W32Util/DialogManager.h"24#include "Windows/W32Util/TabControl.h"25#include "Windows/GEDebugger/SimpleGLWindow.h"2627enum {28WM_GEDBG_STEPDISPLAYLIST = WM_USER + 200,29WM_GEDBG_TOGGLEPCBREAKPOINT,30WM_GEDBG_RUNTOWPARAM,31WM_GEDBG_SETCMDWPARAM,32WM_GEDBG_UPDATE_WATCH,33};3435class CtrlDisplayListView;36class TabDisplayLists;37class TabStateFlags;38class TabStateLighting;39class TabStateTexture;40class TabStateSettings;41class TabVertices;42class TabMatrices;43class TabStateWatch;44struct GPUgstate;4546enum class GETabPosition {47LEFT = 1,48RIGHT = 2,49TOPRIGHT = 4,50ALL = 7,51};52ENUM_CLASS_BITOPS(GETabPosition);5354enum class GETabType {55LIST_DISASM,56LISTS,57STATE,58WATCH,59};6061struct GEDebuggerTab {62const wchar_t *name;63GETabPosition pos;64GETabType type;65struct {66union {67Dialog *dlg;68CtrlDisplayListView *displayList;69void *ptr;70};71int index = -1;72} state[3];73void *(*add)(GEDebuggerTab *tab, TabControl *tabs, GETabPosition pos, HINSTANCE inst, HWND parent);74void (*remove)(GEDebuggerTab *tab, TabControl *tabs, GETabPosition pos, void *ptr);75void (*update)(GEDebuggerTab *tab, TabControl *tabs, GETabPosition pos, void *ptr);76};7778class StepCountDlg : public Dialog {79public:80StepCountDlg(HINSTANCE _hInstance, HWND _hParent);81~StepCountDlg();82protected:83BOOL DlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;84private:85void Jump(int count, bool relative);86};8788class CGEDebugger : public Dialog {89public:90CGEDebugger(HINSTANCE _hInstance, HWND _hParent);91~CGEDebugger();9293static void Init();9495protected:96BOOL DlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;9798private:99void SetupPreviews();100void UpdatePreviews();101void UpdatePrimaryPreview(const GPUgstate &state);102void UpdateSecondPreview(const GPUgstate &state);103u32 PrimPreviewOp();104void UpdatePrimPreview(u32 op, int which);105void CleanupPrimPreview();106void HandleRedraw(int which);107void UpdateSize(WORD width, WORD height);108void SavePosition();109void UpdateTextureLevel(int level);110void DescribePrimaryPreview(const GPUgstate &state, char desc[256]);111void DescribeSecondPreview(const GPUgstate &state, char desc[256]);112void PrimaryPreviewHover(int x, int y);113void SecondPreviewHover(int x, int y);114void PreviewExport(const GPUDebugBuffer *buffer);115void PreviewToClipboard(const GPUDebugBuffer *buffer, bool saveAlpha);116static void DescribePixel(u32 pix, GPUDebugBufferFormat fmt, int x, int y, char desc[256]);117static void DescribePixelRGBA(u32 pix, GPUDebugBufferFormat fmt, int x, int y, char desc[256]);118void UpdateMenus();119void UpdateTab(GEDebuggerTab *tab);120void AddTab(GEDebuggerTab *tab, GETabPosition mask);121void RemoveTab(GEDebuggerTab *tab, GETabPosition mask);122int HasTabIndex(GEDebuggerTab *tab, GETabPosition pos);123void CheckTabMessage(TabControl *t, GETabPosition pos, LPARAM lParam);124125u32 TexturePreviewFlags(const GPUgstate &state);126127SimpleGLWindow *primaryWindow = nullptr;128SimpleGLWindow *secondWindow = nullptr;129std::vector<GEDebuggerTab> tabStates_;130TabControl *tabs = nullptr;131TabControl *tabsRight_ = nullptr;132TabControl *tabsTR_ = nullptr;133TabControl *fbTabs = nullptr;134int textureLevel_ = 0;135bool showClut_ = false;136bool forceOpaque_ = false;137bool autoFlush_ = true;138// The most recent primary/framebuffer and texture buffers.139const GPUDebugBuffer *primaryBuffer_ = nullptr;140const GPUDebugBuffer *secondBuffer_ = nullptr;141bool primaryIsFramebuffer_ = false;142bool secondIsFramebuffer_ = false;143144uint32_t primaryTrackX_ = 0xFFFFFFFF;145uint32_t primaryTrackY_ = 0xFFFFFFFF;146uint32_t secondTrackX_ = 0xFFFFFFFF;147uint32_t secondTrackY_ = 0xFFFFFFFF;148149bool updating_ = false;150int previewsEnabled_ = 3;151int minWidth_;152int minHeight_;153154StepCountDlg stepCountDlg;155};156157158