mirror of
https://github.com/zoriya/ComSquare.git
synced 2025-12-20 14:15:11 +00:00
59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
//
|
|
// Created by Melefo on 19/02/2020.
|
|
//
|
|
|
|
#ifndef COMSQUARE_APUDEBUG_HPP
|
|
#define COMSQUARE_APUDEBUG_HPP
|
|
|
|
#include "../APU/APU.hpp"
|
|
#include "../SNES.hpp"
|
|
#include "../../ui/ui_apuView.h"
|
|
|
|
namespace ComSquare::Debugger
|
|
{
|
|
class APUDebug : public APU::APU {
|
|
private:
|
|
//! @brief The QT window for this debugger.
|
|
ClosableWindow<APUDebug> *_window;
|
|
|
|
//! @brief A widget that contain the whole UI.
|
|
Ui::APUView _ui;
|
|
|
|
//! @brief A reference to the snes (to disable the debugger).
|
|
SNES &_snes;
|
|
|
|
//! @brief Update the debugger panel values
|
|
void _updatePanel();
|
|
|
|
//! @brief Convert CPU APU flags to a string.
|
|
std::string _getPSWString();
|
|
|
|
//! @brief Replace original _executeInstruction to write to the logger.
|
|
int _executeInstruction() override;
|
|
|
|
//! @brief return the mnemonic of the current instruction done.
|
|
std::string _getInstructionString();
|
|
|
|
public slots:
|
|
//! @brief Called when the window is closed. Turn off the debugger and revert to a basic APU.
|
|
void disableDebugger();
|
|
public:
|
|
//! @brief Convert a basic APU to a debugging APU.
|
|
explicit APUDebug(ComSquare::APU::APU &apu, SNES &snes);
|
|
APUDebug(const APUDebug &) = delete;
|
|
APUDebug &operator=(const APUDebug &) = delete;
|
|
~APUDebug() override = default;
|
|
|
|
//! @brief Override the apu's update to disable debugging.
|
|
void update(unsigned cycles) override;
|
|
|
|
//! @brief Return true if the CPU is overloaded with debugging features.
|
|
bool isDebugger() override;
|
|
|
|
//! @brief Focus the debugger's window.
|
|
void focus();
|
|
};
|
|
}
|
|
|
|
#endif //COMSQUARE_APUDEBUG_HPP
|