2013-09-22 10:27:09 -07:00
|
|
|
// Copyright (c) 2012- PPSSPP Project.
|
|
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
|
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
|
|
// Official git repository and contact information can be found at
|
|
|
|
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "Common/CommonWindows.h"
|
2015-08-23 09:25:05 -07:00
|
|
|
#include "GPU/Common/GPUDebugInterface.h"
|
2018-09-01 09:41:20 -07:00
|
|
|
#include "GPU/Debugger/Debugger.h"
|
2013-09-22 10:27:09 -07:00
|
|
|
#include "Windows/resource.h"
|
|
|
|
|
#include "Windows/W32Util/DialogManager.h"
|
2013-09-28 20:57:02 +02:00
|
|
|
#include "Windows/W32Util/TabControl.h"
|
2013-09-22 19:05:33 -07:00
|
|
|
#include "Windows/GEDebugger/SimpleGLWindow.h"
|
2013-09-22 10:27:09 -07:00
|
|
|
|
2013-09-28 14:34:08 +02:00
|
|
|
enum {
|
2018-09-01 09:41:20 -07:00
|
|
|
WM_GEDBG_STEPDISPLAYLIST = WM_USER + 200,
|
2013-10-02 00:41:37 +02:00
|
|
|
WM_GEDBG_TOGGLEPCBREAKPOINT,
|
2013-10-06 19:17:06 -07:00
|
|
|
WM_GEDBG_RUNTOWPARAM,
|
|
|
|
|
WM_GEDBG_SETCMDWPARAM,
|
2016-05-21 19:11:42 -07:00
|
|
|
WM_GEDBG_UPDATE_WATCH,
|
2013-09-28 14:34:08 +02:00
|
|
|
};
|
|
|
|
|
|
2013-09-27 18:03:08 +02:00
|
|
|
class CtrlDisplayListView;
|
2013-09-29 01:02:05 +02:00
|
|
|
class TabDisplayLists;
|
2013-09-30 00:57:46 -07:00
|
|
|
class TabStateFlags;
|
2013-09-30 01:13:06 -07:00
|
|
|
class TabStateLighting;
|
2013-09-30 08:18:28 -07:00
|
|
|
class TabStateTexture;
|
2013-09-30 01:13:06 -07:00
|
|
|
class TabStateSettings;
|
2014-02-08 20:42:23 -08:00
|
|
|
class TabVertices;
|
2014-02-08 23:27:05 -08:00
|
|
|
class TabMatrices;
|
2016-05-21 19:11:42 -07:00
|
|
|
class TabStateWatch;
|
2015-08-23 09:25:05 -07:00
|
|
|
struct GPUgstate;
|
2013-09-27 18:03:08 +02:00
|
|
|
|
2022-08-14 09:12:57 -07:00
|
|
|
enum class GETabPosition {
|
|
|
|
|
LEFT = 1,
|
|
|
|
|
RIGHT = 2,
|
|
|
|
|
TOPRIGHT = 4,
|
|
|
|
|
ALL = 7,
|
|
|
|
|
};
|
|
|
|
|
ENUM_CLASS_BITOPS(GETabPosition);
|
|
|
|
|
|
|
|
|
|
enum class GETabType {
|
|
|
|
|
LIST_DISASM,
|
|
|
|
|
LISTS,
|
|
|
|
|
STATE,
|
|
|
|
|
WATCH,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct GEDebuggerTab {
|
|
|
|
|
const wchar_t *name;
|
|
|
|
|
GETabPosition pos;
|
|
|
|
|
GETabType type;
|
2022-08-14 10:16:16 -07:00
|
|
|
struct {
|
|
|
|
|
union {
|
|
|
|
|
Dialog *dlg;
|
|
|
|
|
CtrlDisplayListView *displayList;
|
|
|
|
|
void *ptr;
|
|
|
|
|
};
|
|
|
|
|
int index = -1;
|
2022-08-14 09:12:57 -07:00
|
|
|
} state[3];
|
|
|
|
|
void *(*add)(GEDebuggerTab *tab, TabControl *tabs, GETabPosition pos, HINSTANCE inst, HWND parent);
|
|
|
|
|
void (*remove)(GEDebuggerTab *tab, TabControl *tabs, GETabPosition pos, void *ptr);
|
|
|
|
|
void (*update)(GEDebuggerTab *tab, TabControl *tabs, GETabPosition pos, void *ptr);
|
|
|
|
|
};
|
|
|
|
|
|
2018-12-06 18:16:54 +09:00
|
|
|
class StepCountDlg : public Dialog {
|
|
|
|
|
public:
|
|
|
|
|
StepCountDlg(HINSTANCE _hInstance, HWND _hParent);
|
2018-12-18 00:27:02 +09:00
|
|
|
~StepCountDlg();
|
2018-12-06 18:16:54 +09:00
|
|
|
protected:
|
2022-12-10 20:32:12 -08:00
|
|
|
BOOL DlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
|
2018-12-06 18:16:54 +09:00
|
|
|
private:
|
2018-12-24 04:23:03 +09:00
|
|
|
void Jump(int count, bool relative);
|
2018-12-06 18:16:54 +09:00
|
|
|
};
|
|
|
|
|
|
2013-09-22 10:27:09 -07:00
|
|
|
class CGEDebugger : public Dialog {
|
|
|
|
|
public:
|
|
|
|
|
CGEDebugger(HINSTANCE _hInstance, HWND _hParent);
|
2013-09-22 19:05:33 -07:00
|
|
|
~CGEDebugger();
|
2013-09-22 10:27:09 -07:00
|
|
|
|
2013-09-27 22:41:44 -07:00
|
|
|
static void Init();
|
2013-10-01 12:05:19 +02:00
|
|
|
|
2013-09-22 10:27:09 -07:00
|
|
|
protected:
|
2022-12-10 20:32:12 -08:00
|
|
|
BOOL DlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
|
2013-09-22 19:05:33 -07:00
|
|
|
|
2013-09-23 23:45:17 -07:00
|
|
|
private:
|
2013-09-27 22:41:44 -07:00
|
|
|
void SetupPreviews();
|
|
|
|
|
void UpdatePreviews();
|
2016-01-10 10:05:50 -08:00
|
|
|
void UpdatePrimaryPreview(const GPUgstate &state);
|
|
|
|
|
void UpdateSecondPreview(const GPUgstate &state);
|
2017-12-23 01:57:03 -08:00
|
|
|
u32 PrimPreviewOp();
|
|
|
|
|
void UpdatePrimPreview(u32 op, int which);
|
2013-10-13 20:47:52 -07:00
|
|
|
void CleanupPrimPreview();
|
2017-12-23 01:57:03 -08:00
|
|
|
void HandleRedraw(int which);
|
2013-09-28 16:04:56 +02:00
|
|
|
void UpdateSize(WORD width, WORD height);
|
|
|
|
|
void SavePosition();
|
2014-06-15 10:01:32 -07:00
|
|
|
void UpdateTextureLevel(int level);
|
2020-11-02 09:21:29 +01:00
|
|
|
void DescribePrimaryPreview(const GPUgstate &state, char desc[256]);
|
|
|
|
|
void DescribeSecondPreview(const GPUgstate &state, char desc[256]);
|
2016-01-10 10:05:50 -08:00
|
|
|
void PrimaryPreviewHover(int x, int y);
|
|
|
|
|
void SecondPreviewHover(int x, int y);
|
2017-12-21 15:45:52 -08:00
|
|
|
void PreviewExport(const GPUDebugBuffer *buffer);
|
2022-09-24 11:43:52 -07:00
|
|
|
void PreviewToClipboard(const GPUDebugBuffer *buffer, bool saveAlpha);
|
2022-08-11 22:45:40 +02:00
|
|
|
static void DescribePixel(u32 pix, GPUDebugBufferFormat fmt, int x, int y, char desc[256]);
|
|
|
|
|
static void DescribePixelRGBA(u32 pix, GPUDebugBufferFormat fmt, int x, int y, char desc[256]);
|
2022-01-22 13:12:59 -08:00
|
|
|
void UpdateMenus();
|
2022-08-14 09:12:57 -07:00
|
|
|
void UpdateTab(GEDebuggerTab *tab);
|
|
|
|
|
void AddTab(GEDebuggerTab *tab, GETabPosition mask);
|
|
|
|
|
void RemoveTab(GEDebuggerTab *tab, GETabPosition mask);
|
2022-08-14 10:16:16 -07:00
|
|
|
int HasTabIndex(GEDebuggerTab *tab, GETabPosition pos);
|
|
|
|
|
void CheckTabMessage(TabControl *t, GETabPosition pos, LPARAM lParam);
|
2013-09-28 16:04:56 +02:00
|
|
|
|
2016-01-10 10:05:50 -08:00
|
|
|
u32 TexturePreviewFlags(const GPUgstate &state);
|
|
|
|
|
|
2017-10-28 18:03:27 +02:00
|
|
|
SimpleGLWindow *primaryWindow = nullptr;
|
|
|
|
|
SimpleGLWindow *secondWindow = nullptr;
|
2022-08-14 09:12:57 -07:00
|
|
|
std::vector<GEDebuggerTab> tabStates_;
|
2017-10-28 18:03:27 +02:00
|
|
|
TabControl *tabs = nullptr;
|
2022-08-11 22:45:40 +02:00
|
|
|
TabControl *tabsRight_ = nullptr;
|
2022-08-14 09:12:57 -07:00
|
|
|
TabControl *tabsTR_ = nullptr;
|
2017-10-28 18:03:27 +02:00
|
|
|
TabControl *fbTabs = nullptr;
|
|
|
|
|
int textureLevel_ = 0;
|
|
|
|
|
bool showClut_ = false;
|
|
|
|
|
bool forceOpaque_ = false;
|
2022-09-21 21:16:56 -07:00
|
|
|
bool autoFlush_ = true;
|
2015-08-23 09:25:05 -07:00
|
|
|
// The most recent primary/framebuffer and texture buffers.
|
2017-10-28 18:03:27 +02:00
|
|
|
const GPUDebugBuffer *primaryBuffer_ = nullptr;
|
|
|
|
|
const GPUDebugBuffer *secondBuffer_ = nullptr;
|
2022-10-10 22:35:42 -07:00
|
|
|
bool primaryIsFramebuffer_ = false;
|
|
|
|
|
bool secondIsFramebuffer_ = false;
|
2013-09-28 16:04:56 +02:00
|
|
|
|
2022-09-24 12:23:02 -07:00
|
|
|
uint32_t primaryTrackX_ = 0xFFFFFFFF;
|
|
|
|
|
uint32_t primaryTrackY_ = 0xFFFFFFFF;
|
|
|
|
|
uint32_t secondTrackX_ = 0xFFFFFFFF;
|
|
|
|
|
uint32_t secondTrackY_ = 0xFFFFFFFF;
|
|
|
|
|
|
2017-12-23 01:57:03 -08:00
|
|
|
bool updating_ = false;
|
2017-12-23 02:16:43 -08:00
|
|
|
int previewsEnabled_ = 3;
|
2016-01-10 10:05:50 -08:00
|
|
|
int minWidth_;
|
|
|
|
|
int minHeight_;
|
2018-12-06 18:16:54 +09:00
|
|
|
|
|
|
|
|
StepCountDlg stepCountDlg;
|
2013-09-22 10:27:09 -07:00
|
|
|
};
|