Skip to content

Commit

Permalink
add WidgetAutorefresh for quick and easy setup of the common autore…
Browse files Browse the repository at this point in the history
…fresh bar, add `ViewStruct` to simply view a struct like state,save data, gamemanager etc., remove pointers to layouts and other unused stuff (or like referenced in one function), other cleanup
  • Loading branch information
Mr-Auto committed May 1, 2024
1 parent 6619242 commit 840f44b
Show file tree
Hide file tree
Showing 64 changed files with 608 additions and 1,257 deletions.
12 changes: 4 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,12 @@ x64dbg_plugin(${PROJECT_NAME}
include/Views/ViewTextureDB.h
include/Views/ViewEntity.h
include/Views/ViewEntities.h
include/Views/ViewState.h
include/Views/ViewSaveGame.h
include/Views/ViewGameManager.h
include/Views/ViewStruct.h
include/Views/ViewLevelGen.h
include/Views/ViewVirtualTable.h
include/Views/ViewStringsTable.h
include/Views/ViewLogger.h
include/Views/ViewVirtualFunctions.h
include/Views/ViewOnline.h
include/Views/ViewStdVector.h
include/Views/ViewJournalPage.h
include/Views/ViewThreads.h
Expand All @@ -102,6 +99,7 @@ x64dbg_plugin(${PROJECT_NAME}
include/QtHelpers/WidgetSamplesPlot.h
include/QtHelpers/ItemModelLoggerSamples.h
include/QtHelpers/WidgetDatabaseView.h
include/QtHelpers/WidgetAutorefresh.h
src/Spelunky2.cpp
src/Configuration.cpp
src/Data/EntityDB.cpp
Expand All @@ -121,15 +119,12 @@ x64dbg_plugin(${PROJECT_NAME}
src/Views/ViewTextureDB.cpp
src/Views/ViewEntity.cpp
src/Views/ViewEntities.cpp
src/Views/ViewState.cpp
src/Views/ViewSaveGame.cpp
src/Views/ViewGameManager.cpp
src/Views/ViewStruct.cpp
src/Views/ViewLevelGen.cpp
src/Views/ViewVirtualTable.cpp
src/Views/ViewStringsTable.cpp
src/Views/ViewLogger.cpp
src/Views/ViewVirtualFunctions.cpp
src/Views/ViewOnline.cpp
src/Views/ViewStdVector.cpp
src/Views/ViewStdMap.cpp
src/Views/ViewJournalPage.cpp
Expand All @@ -151,6 +146,7 @@ x64dbg_plugin(${PROJECT_NAME}
src/QtHelpers/WidgetSamplesPlot.cpp
src/QtHelpers/ItemModelLoggerSamples.cpp
src/QtHelpers/WidgetDatabaseView.cpp
src/QtHelpers/WidgetAutorefresh.cpp
${CMAKE_CURRENT_BINARY_DIR}/include/pluginconfig.h
resources/spelunky2.qrc
)
Expand Down
1 change: 0 additions & 1 deletion include/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <QColor>
#include <QMetaEnum>
#include <cstdint>
#include <memory>
#include <nlohmann/json.hpp>
#include <string>
#include <string_view>
Expand Down
1 change: 1 addition & 0 deletions include/Data/Logger.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <QColor>
#include <QObject>
#include <QTimer>
#include <any>
#include <cstdint>
Expand Down
2 changes: 0 additions & 2 deletions include/Data/State.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#pragma once

#include <cstdint>
#include <string>
#include <unordered_map>

namespace S2Plugin
{
Expand Down
1 change: 0 additions & 1 deletion include/Data/StdString.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "pluginmain.h"
#include <cstdint>
#include <memory>
#include <string>

namespace S2Plugin
Expand Down
4 changes: 4 additions & 0 deletions include/QtHelpers/DialogEditSimpleValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

#include <QDialog>
#include <QLineEdit>
#include <QSize>
#include <QString>
#include <QWidget>
#include <cstdint>

namespace S2Plugin
{
Expand Down
5 changes: 5 additions & 0 deletions include/QtHelpers/DialogEditState.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
#include <QComboBox>
#include <QDialog>
#include <QLineEdit>
#include <QSize>
#include <QString>
#include <QWidget>
#include <cstdint>
#include <string>

namespace S2Plugin
{
Expand Down
3 changes: 3 additions & 0 deletions include/QtHelpers/ItemModelGatherVirtualData.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#pragma once

#include <QAbstractItemModel>
#include <QModelIndex>
#include <QSortFilterProxyModel>
#include <QVariant>
#include <cstdint>
#include <string>
#include <vector>

namespace S2Plugin
{
Expand Down
2 changes: 2 additions & 0 deletions include/QtHelpers/ItemModelLoggerFields.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once

#include <QAbstractItemModel>
#include <QModelIndex>
#include <QVariant>

namespace S2Plugin
{
Expand Down
2 changes: 2 additions & 0 deletions include/QtHelpers/ItemModelLoggerSamples.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once

#include <QAbstractItemModel>
#include <QModelIndex>
#include <QVariant>

namespace S2Plugin
{
Expand Down
2 changes: 2 additions & 0 deletions include/QtHelpers/ItemModelStates.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#pragma once

#include <QAbstractItemModel>
#include <QModelIndex>
#include <QSortFilterProxyModel>
#include <QVariant>
#include <cstdint>
#include <string>
#include <vector>
Expand Down
2 changes: 2 additions & 0 deletions include/QtHelpers/ItemModelVirtualFunctions.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#pragma once

#include <QAbstractItemModel>
#include <QModelIndex>
#include <QSortFilterProxyModel>
#include <QVariant>
#include <cstdint>
#include <string>

Expand Down
5 changes: 4 additions & 1 deletion include/QtHelpers/ItemModelVirtualTable.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#pragma once

#include <QAbstractItemModel>
#include <QObject>
#include <QModelIndex>
#include <QSortFilterProxyModel>
#include <QString>
#include <QVariant>
#include <cstdint>

namespace S2Plugin
{
Expand Down
1 change: 1 addition & 0 deletions include/QtHelpers/SortFilterProxyModelStringsTable.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <QModelIndex>
#include <QSortFilterProxyModel>
#include <QString>

Expand Down
4 changes: 4 additions & 0 deletions include/QtHelpers/StyledItemDelegateColorPicker.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#pragma once

#include <QBrush>
#include <QModelIndex>
#include <QPainter>
#include <QStyledItemDelegate>

namespace S2Plugin
{
class StyledItemDelegateColorPicker : public QStyledItemDelegate
{
using QStyledItemDelegate::QStyledItemDelegate;

protected:
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
Expand Down
3 changes: 3 additions & 0 deletions include/QtHelpers/StyledItemDelegateHTML.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#pragma once

#include <QModelIndex>
#include <QPainter>
#include <QStyleOptionViewItem>
#include <QStyledItemDelegate>

namespace S2Plugin
Expand Down
6 changes: 3 additions & 3 deletions include/QtHelpers/TableViewLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
#include <QDragMoveEvent>
#include <QDropEvent>
#include <QKeyEvent>
#include <QModelIndex>
#include <QPaintEvent>
#include <QTableView>
#include <memory>
#include <QWidget>
#include <cstdint>

namespace S2Plugin
{
class Logger;
class StyledItemDelegateColorPicker;

static constexpr uint8_t gsLogFieldColColor = 0;
static constexpr uint8_t gsLogFieldColMemoryOffset = 1;
Expand All @@ -35,7 +36,6 @@ namespace S2Plugin
void cellClicked(const QModelIndex& index);

private:
std::unique_ptr<StyledItemDelegateColorPicker> mColorPickerDelegate;
Logger* mLogger;
};
} // namespace S2Plugin
22 changes: 18 additions & 4 deletions include/QtHelpers/TreeViewMemoryFields.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#pragma once

#include <QDragEnterEvent>
#include <QDragMoveEvent>
#include <QDropEvent>
#include <QModelIndex>
#include <QStandardItemModel>
#include <QTreeView>
#include <QWidget>
#include <array>
#include <memory>
#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
Expand Down Expand Up @@ -47,13 +52,22 @@ namespace S2Plugin
void updateTableHeader(bool restoreColumnWidths = true);
void setEnableChangeHighlighting(bool b) noexcept;

void updateTree(uintptr_t newAddr = 0, uintptr_t newComparisonAddr = 0, bool initial = false);
void updateTree(uintptr_t newAddr, uintptr_t newComparisonAddr = 0, bool initial = false);
void updateRow(int row, std::optional<uintptr_t> newAddr = std::nullopt, std::optional<uintptr_t> newAddrComparison = std::nullopt, QStandardItem* parent = nullptr,
bool disableChangeHighlightingForField = false);

void labelAll(std::string_view prefix = {});

ColumnFilter activeColumns;
void labelAll(std::string_view prefix);

public slots:
void labelAll() // for the slots so we don't corrupt the parameters
{
labelAll({});
}
void updateTree()
{
updateTree(0, 0, false);
}

protected:
void dragEnterEvent(QDragEnterEvent* event) override;
Expand Down
31 changes: 31 additions & 0 deletions include/QtHelpers/WidgetAutorefresh.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#pragma once

#include <QCheckBox>
#include <QLineEdit>
#include <QPushButton>
#include <QString>
#include <QTimer>
#include <QWidget>

namespace S2Plugin
{
class WidgetAutorefresh : public QWidget
{
Q_OBJECT
public:
WidgetAutorefresh(const QString& initialInterval, QWidget* parrent = nullptr);
signals:
void refresh();

public slots:
void toggleAutoRefresh(bool checked);
protected slots:
void autoRefreshIntervalChanged(const QString& text);

private:
QPushButton* mRefreshButton;
QCheckBox* mAutoRefreshCheckBox;
QTimer* mAutoRefreshTimer;
QLineEdit* mAutoRefreshIntervalLineEdit;
};
} // namespace S2Plugin
3 changes: 3 additions & 0 deletions include/QtHelpers/WidgetDatabaseView.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
#include <QTableWidget>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QVariant>
#include <QWidget>
#include <cstdint>
#include <optional>
#include <string>
#include <vector>

/* Things to implement:
* setWindowTitle
Expand Down
6 changes: 6 additions & 0 deletions include/QtHelpers/WidgetMemoryView.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#pragma once

#include <QColor>
#include <QFont>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QRect>
#include <QSize>
#include <QString>
#include <QStyleOptionTabWidgetFrame>
#include <QWidget>
Expand Down
3 changes: 3 additions & 0 deletions include/QtHelpers/WidgetSamplesPlot.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#pragma once

#include <QEvent>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QPoint>
#include <QSize>
#include <QWidget>

namespace S2Plugin
Expand Down
5 changes: 5 additions & 0 deletions include/QtHelpers/WidgetSampling.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#pragma once

#include <QFont>
#include <QFontMetrics>
#include <QPaintEvent>
#include <QPainter>
#include <QPointF>
#include <QSize>
#include <QString>
#include <QWidget>

namespace S2Plugin
Expand Down
3 changes: 3 additions & 0 deletions include/QtHelpers/WidgetSpelunkyLevel.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#pragma once

#include "Data/Entity.h"
#include <QBrush>
#include <QPaintEvent>
#include <QSize>
#include <QWidget>
#include <array>
#include <cstdint>
Expand Down
8 changes: 8 additions & 0 deletions include/QtHelpers/WidgetSpelunkyRooms.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
#pragma once

#include <QFont>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QSize>
#include <QString>
#include <QWidget>
#include <cstdint>
#include <string>
#include <unordered_map>
#include <vector>

namespace S2Plugin
{
Expand Down
1 change: 0 additions & 1 deletion include/Spelunky2.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "Data/VirtualTableLookup.h"
#include <cstdint>
#include <string>
#include <unordered_map>

namespace S2Plugin
{
Expand Down
3 changes: 2 additions & 1 deletion include/Views/ViewEntities.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

#include <QCheckBox>
#include <QLineEdit>
#include <QPushButton>
#include <QSize>
#include <QString>
#include <QWidget>
#include <array>

namespace S2Plugin
Expand Down
Loading

0 comments on commit 840f44b

Please sign in to comment.