Skip to content

Commit

Permalink
Rename WidgetDatabaseView to AbstractDatabaseView, also `vectorty…
Browse files Browse the repository at this point in the history
…pe` to `valuetype` in json, (WIP) add old implementation of std::list
  • Loading branch information
Mr-Auto committed Jun 2, 2024
1 parent 824ed21 commit bff3f4b
Show file tree
Hide file tree
Showing 16 changed files with 300 additions and 93 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ x64dbg_plugin(${PROJECT_NAME}
include/Data/StdString.h
include/Data/StdMap.h
include/Data/EntityList.h
include/Data/OldStdList.h
include/Views/ViewToolbar.h
include/Views/ViewEntityDB.h
include/Views/ViewParticleDB.h
Expand Down Expand Up @@ -101,7 +102,7 @@ x64dbg_plugin(${PROJECT_NAME}
include/QtHelpers/WidgetSampling.h
include/QtHelpers/WidgetSamplesPlot.h
include/QtHelpers/ItemModelLoggerSamples.h
include/QtHelpers/WidgetDatabaseView.h
include/QtHelpers/AbstractDatabaseView.h
include/QtHelpers/WidgetAutorefresh.h
include/QtHelpers/LongLongSpinBox.h
src/Spelunky2.cpp
Expand Down Expand Up @@ -151,7 +152,7 @@ x64dbg_plugin(${PROJECT_NAME}
src/QtHelpers/ItemModelLoggerFields.cpp
src/QtHelpers/WidgetSamplesPlot.cpp
src/QtHelpers/ItemModelLoggerSamples.cpp
src/QtHelpers/WidgetDatabaseView.cpp
src/QtHelpers/AbstractDatabaseView.cpp
src/QtHelpers/WidgetAutorefresh.cpp
${CMAKE_CURRENT_BINARY_DIR}/include/pluginconfig.h
resources/spelunky2.qrc
Expand Down
1 change: 1 addition & 0 deletions include/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ namespace S2Plugin
Array,
Matrix,
EntityList,
OldStdList,
};

struct VirtualFunction
Expand Down
101 changes: 101 additions & 0 deletions include/Data/OldStdList.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#pragma once

#include "pluginmain.h"
#include <list>

namespace S2Plugin
{
// this is the pre C++ 11 version standard
class OldStdList
{
public:
OldStdList(uintptr_t address) : _end(address){};

struct Node
{
Node(uintptr_t address) : nodeAddress(address){};

Node prev() const
{
return Script::Memory::ReadQword(nodeAddress);
}
Node next() const
{
return Script::Memory::ReadQword(nodeAddress + sizeof(uintptr_t));
}
uintptr_t value_ptr() const
{
return nodeAddress + 2 * sizeof(uintptr_t);
}
uintptr_t operator*() const
{
return value_ptr();
}
Node operator++()
{
nodeAddress = next().nodeAddress;
return *this;
}
Node operator--(int)
{
auto tmp = *this;
nodeAddress = prev().nodeAddress;
return tmp;
}
Node operator++(int)
{
auto tmp = *this;
nodeAddress = next().nodeAddress;
return tmp;
}
Node operator--()
{
nodeAddress = prev().nodeAddress;
return *this;
}
bool operator==(const Node& other) const
{
return nodeAddress == other.nodeAddress;
}
bool operator!=(const Node& other) const
{
return nodeAddress != other.nodeAddress;
}

private:
uintptr_t nodeAddress;
};

Node begin() const
{
return _end.next();
}
Node end() const
{
return _end;
}
bool empty() const
{
return begin() == end();
}
Node cbegin() const
{
return begin();
}
Node cend() const
{
return end();
}
Node back() const
{
return _end.prev();
}
Node front() const
{
return _end.next();
}

private:
Node _end;
};
}; // namespace S2Plugin
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ namespace S2Plugin
struct MemoryField;
using ID_type = uint32_t;

class WidgetDatabaseView : public QWidget
class AbstractDatabaseView : public QWidget
{
Q_OBJECT
public:
WidgetDatabaseView(MemoryFieldType type, QWidget* parent = nullptr);
AbstractDatabaseView(MemoryFieldType type, QWidget* parent = nullptr);
virtual void showID(ID_type id) = 0;

protected:
Expand Down
4 changes: 2 additions & 2 deletions include/Views/ViewCharacterDB.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#pragma once

#include "QtHelpers/WidgetDatabaseView.h"
#include "QtHelpers/AbstractDatabaseView.h"

namespace S2Plugin
{
class TreeViewMemoryFields;

class ViewCharacterDB : public WidgetDatabaseView
class ViewCharacterDB : public AbstractDatabaseView
{
Q_OBJECT
public:
Expand Down
4 changes: 2 additions & 2 deletions include/Views/ViewEntityDB.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#pragma once

#include "QtHelpers/WidgetDatabaseView.h"
#include "QtHelpers/AbstractDatabaseView.h"

namespace S2Plugin
{
class TreeViewMemoryFields;

class ViewEntityDB : public WidgetDatabaseView
class ViewEntityDB : public AbstractDatabaseView
{
Q_OBJECT
public:
Expand Down
4 changes: 2 additions & 2 deletions include/Views/ViewParticleDB.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#pragma once

#include "QtHelpers/WidgetDatabaseView.h"
#include "QtHelpers/AbstractDatabaseView.h"

namespace S2Plugin
{
class TreeViewMemoryFields;

class ViewParticleDB : public WidgetDatabaseView
class ViewParticleDB : public AbstractDatabaseView
{
Q_OBJECT
public:
Expand Down
4 changes: 2 additions & 2 deletions include/Views/ViewTextureDB.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#pragma once

#include "QtHelpers/WidgetDatabaseView.h"
#include "QtHelpers/AbstractDatabaseView.h"

namespace S2Plugin
{
class TreeViewMemoryFields;

class ViewTextureDB : public WidgetDatabaseView
class ViewTextureDB : public AbstractDatabaseView
{
Q_OBJECT
public:
Expand Down
Loading

0 comments on commit bff3f4b

Please sign in to comment.