2017-09-13 17:33:45 +00:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-09-13 17:33:45 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QTableWidgetItem>
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
|
|
|
|
enum class RegisterType
|
|
|
|
{
|
|
|
|
gpr, // General purpose registers, int (r0-r31)
|
2018-01-13 07:46:44 +00:00
|
|
|
fpr, // Floating point registers, double (f0-f31)
|
2017-09-13 17:33:45 +00:00
|
|
|
ibat, // Instruction BATs (IBAT0-IBAT7)
|
|
|
|
dbat, // Data BATs (DBAT0-DBAT7)
|
2018-01-07 10:26:55 +00:00
|
|
|
tb, // Time base register
|
2017-09-13 17:33:45 +00:00
|
|
|
pc, // Program counter
|
|
|
|
lr, // Link register
|
|
|
|
ctr, // Decremented and incremented by branch and count instructions
|
|
|
|
cr, // Condition register
|
2018-01-07 10:26:55 +00:00
|
|
|
xer, // Integer exception register
|
2017-09-13 17:33:45 +00:00
|
|
|
fpscr, // Floating point status and control register
|
|
|
|
msr, // Machine state register
|
|
|
|
srr, // Machine status save/restore register (SRR0 - SRR1)
|
|
|
|
sr, // Segment register (SR0 - SR15)
|
2018-01-07 10:26:55 +00:00
|
|
|
gqr, // Graphics quantization registers (GQR0 - GQR7)
|
2019-03-13 19:40:34 +00:00
|
|
|
hid, // Hardware Implementation-Dependent registers (HID0-2, HID4)
|
2017-09-13 17:33:45 +00:00
|
|
|
exceptions, // Keeps track of currently triggered exceptions
|
|
|
|
int_mask, // ???
|
|
|
|
int_cause, // ???
|
|
|
|
dsisr, // Defines the cause of data / alignment exceptions
|
|
|
|
dar, // Data adress register
|
|
|
|
pt_hashmask // ???
|
|
|
|
};
|
|
|
|
|
2022-04-29 15:19:03 +00:00
|
|
|
enum class RegisterDisplay : int
|
2017-09-13 17:33:45 +00:00
|
|
|
{
|
2022-04-29 15:19:03 +00:00
|
|
|
Hex = 0,
|
2017-09-13 17:33:45 +00:00
|
|
|
SInt32,
|
|
|
|
UInt32,
|
2018-01-13 07:46:44 +00:00
|
|
|
Float,
|
|
|
|
Double
|
2017-09-13 17:33:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
constexpr int DATA_TYPE = Qt::UserRole;
|
|
|
|
|
|
|
|
class RegisterColumn : public QTableWidgetItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit RegisterColumn(RegisterType type, std::function<u64()> get,
|
|
|
|
std::function<void(u64)> set);
|
|
|
|
|
|
|
|
void RefreshValue();
|
|
|
|
|
|
|
|
RegisterDisplay GetDisplay() const;
|
|
|
|
void SetDisplay(RegisterDisplay display);
|
|
|
|
u64 GetValue() const;
|
|
|
|
void SetValue();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void Update();
|
|
|
|
|
|
|
|
RegisterType m_type;
|
|
|
|
|
|
|
|
std::function<u64()> m_get_register;
|
|
|
|
std::function<void(u64)> m_set_register;
|
|
|
|
|
2018-10-09 22:47:32 +00:00
|
|
|
u64 m_value = 0;
|
2017-09-13 17:33:45 +00:00
|
|
|
RegisterDisplay m_display = RegisterDisplay::Hex;
|
|
|
|
};
|