duckstation

duckstation, but archived from the revision just before upstream changed it to a proprietary software project, this version is the libre one
git clone https://git.neptards.moe/u3shit/duckstation.git
Log | Files | Refs | README | LICENSE

memoryscannerwindow.h (1743B)


      1 // SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
      2 // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
      3 
      4 #pragma once
      5 
      6 #include "ui_memoryscannerwindow.h"
      7 
      8 #include "core/cheats.h"
      9 
     10 #include <QtCore/QTimer>
     11 #include <QtWidgets/QComboBox>
     12 #include <QtWidgets/QLabel>
     13 #include <QtWidgets/QPushButton>
     14 #include <QtWidgets/QTableWidget>
     15 #include <QtWidgets/QWidget>
     16 #include <optional>
     17 
     18 class MemoryScannerWindow : public QWidget
     19 {
     20   Q_OBJECT
     21 
     22 public:
     23   MemoryScannerWindow();
     24   ~MemoryScannerWindow();
     25 
     26 Q_SIGNALS:
     27   void closed();
     28 
     29 protected:
     30   void showEvent(QShowEvent* event);
     31   void closeEvent(QCloseEvent* event);
     32   void resizeEvent(QResizeEvent* event);
     33 
     34 private Q_SLOTS:
     35   void onSystemStarted();
     36   void onSystemDestroyed();
     37 
     38   void addToWatchClicked();
     39   void addManualWatchAddressClicked();
     40   void removeWatchClicked();
     41   void scanCurrentItemChanged(QTableWidgetItem* current, QTableWidgetItem* previous);
     42   void watchCurrentItemChanged(QTableWidgetItem* current, QTableWidgetItem* previous);
     43   void scanItemChanged(QTableWidgetItem* item);
     44   void watchItemChanged(QTableWidgetItem* item);
     45   void updateScanValue();
     46   void updateScanUi();
     47 
     48 private:
     49   enum : int
     50   {
     51     MAX_DISPLAYED_SCAN_RESULTS = 5000,
     52     SCAN_INTERVAL = 100,
     53   };
     54 
     55   void connectUi();
     56   void enableUi(bool enabled);
     57   void resizeColumns();
     58   void updateResults();
     59   void updateResultsValues();
     60   void updateWatch();
     61   void updateWatchValues();
     62 
     63   int getSelectedResultIndexFirst() const;
     64   int getSelectedResultIndexLast() const;
     65   int getSelectedWatchIndexFirst() const;
     66   int getSelectedWatchIndexLast() const;
     67 
     68   Ui::MemoryScannerWindow m_ui;
     69 
     70   MemoryScan m_scanner;
     71   MemoryWatchList m_watch;
     72 
     73   QTimer* m_update_timer = nullptr;
     74 };