mirror of
https://github.com/NohamR/Reclass.git
synced 2026-05-10 19:59:21 +00:00
feat: scanner panel with signature/value search, rescan, address delegate
- Signature mode (IDA-style patterns with wildcards) and value mode (typed exact match) - Async scan engine with progress, cancel support - Re-scan updates all results with unified progress (single-pass read + table build) - Previous value column appears after first re-scan - WinDbg backtick address format with dimmed leading zeros (AddressDelegate) - Inline editing: address expressions navigate, value edits write to provider - Right-click context menu: Copy Address, Copy Value, Go to Address - Auto-sized columns, themed buttons with icons, dynamic combo width - 49 UI tests covering scan, rescan, editing, theming, progress completion
This commit is contained in:
85
src/scanner.h
Normal file
85
src/scanner.h
Normal file
@@ -0,0 +1,85 @@
|
||||
#pragma once
|
||||
#include "providers/provider.h"
|
||||
#include <QObject>
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QFutureWatcher>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
|
||||
namespace rcx {
|
||||
|
||||
// ── Scan request / result ──
|
||||
|
||||
struct ScanRequest {
|
||||
QByteArray pattern; // literal bytes to match
|
||||
QByteArray mask; // 0xFF = must match, 0x00 = wildcard
|
||||
|
||||
bool filterExecutable = false; // only scan +x regions
|
||||
bool filterWritable = false; // only scan +w regions
|
||||
|
||||
int alignment = 1; // 1 = every byte, 4 = dword, 8 = qword
|
||||
int maxResults = 50000;
|
||||
};
|
||||
|
||||
struct ScanResult {
|
||||
uint64_t address;
|
||||
QString regionModule;
|
||||
QByteArray scanValue; // cached bytes at scan/update time
|
||||
QByteArray previousValue; // value before last update
|
||||
};
|
||||
|
||||
// ── Value scan types ──
|
||||
|
||||
enum class ValueType {
|
||||
Int8, Int16, Int32, Int64,
|
||||
UInt8, UInt16, UInt32, UInt64,
|
||||
Float, Double,
|
||||
Vec2, Vec3, Vec4,
|
||||
UTF8, UTF16,
|
||||
HexBytes
|
||||
};
|
||||
|
||||
// ── Pattern parsing ──
|
||||
|
||||
// Parse IDA-style signature string ("48 8B ?? 05") into pattern + mask.
|
||||
// Returns true on success. On failure, sets errorMsg.
|
||||
bool parseSignature(const QString& input, QByteArray& pattern, QByteArray& mask,
|
||||
QString* errorMsg = nullptr);
|
||||
|
||||
// Serialize a typed value into raw bytes for exact-match scanning.
|
||||
// Returns true on success. On failure, sets errorMsg.
|
||||
bool serializeValue(ValueType type, const QString& input,
|
||||
QByteArray& pattern, QByteArray& mask,
|
||||
QString* errorMsg = nullptr);
|
||||
|
||||
// Natural alignment for a value type (used as default alignment for value scans).
|
||||
int naturalAlignment(ValueType type);
|
||||
|
||||
// ── Scan engine ──
|
||||
|
||||
class ScanEngine : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ScanEngine(QObject* parent = nullptr);
|
||||
|
||||
void start(std::shared_ptr<Provider> provider, const ScanRequest& req);
|
||||
void abort();
|
||||
bool isRunning() const;
|
||||
|
||||
signals:
|
||||
void progress(int percent);
|
||||
void finished(QVector<ScanResult> results);
|
||||
void error(QString message);
|
||||
|
||||
private:
|
||||
QVector<ScanResult> runScan(std::shared_ptr<Provider> prov, const ScanRequest& req);
|
||||
|
||||
std::atomic<bool> m_abort{false};
|
||||
QFutureWatcher<QVector<ScanResult>>* m_watcher = nullptr;
|
||||
};
|
||||
|
||||
} // namespace rcx
|
||||
|
||||
Q_DECLARE_METATYPE(QVector<rcx::ScanResult>)
|
||||
Reference in New Issue
Block a user