mirror of https://github.com/mgba-emu/mgba.git
Qt: Add string view to memory viewer
This commit is contained in:
parent
9972ff5019
commit
605d5ddcfd
|
@ -32,6 +32,9 @@ public:
|
||||||
void setAlignment(int);
|
void setAlignment(int);
|
||||||
int alignment() const { return m_align; }
|
int alignment() const { return m_align; }
|
||||||
|
|
||||||
|
QByteArray serialize();
|
||||||
|
void deserialize(const QByteArray&);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void jumpToAddress(const QString& hex);
|
void jumpToAddress(const QString& hex);
|
||||||
void jumpToAddress(uint32_t);
|
void jumpToAddress(uint32_t);
|
||||||
|
@ -61,9 +64,6 @@ private:
|
||||||
|
|
||||||
void adjustCursor(int adjust, bool shift);
|
void adjustCursor(int adjust, bool shift);
|
||||||
|
|
||||||
QByteArray serialize();
|
|
||||||
void deserialize(const QByteArray&);
|
|
||||||
|
|
||||||
mCore* m_core;
|
mCore* m_core;
|
||||||
QFont m_font;
|
QFont m_font;
|
||||||
int m_cellHeight;
|
int m_cellHeight;
|
||||||
|
|
|
@ -167,15 +167,25 @@ void MemoryView::updateSelection(uint32_t start, uint32_t end) {
|
||||||
|
|
||||||
void MemoryView::updateStatus() {
|
void MemoryView::updateStatus() {
|
||||||
int align = m_ui.hexfield->alignment();
|
int align = m_ui.hexfield->alignment();
|
||||||
|
if (!m_controller->isLoaded()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mCore* core = m_controller->thread()->core;
|
||||||
|
QByteArray selection(m_ui.hexfield->serialize());
|
||||||
|
QString text;
|
||||||
|
for (QChar c : selection) {
|
||||||
|
if (!c.isPrint() || c >= 127) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
text.append(c);
|
||||||
|
}
|
||||||
|
m_ui.stringVal->setText(text);
|
||||||
|
|
||||||
if (m_selection.first & (align - 1) || m_selection.second - m_selection.first != align) {
|
if (m_selection.first & (align - 1) || m_selection.second - m_selection.first != align) {
|
||||||
m_ui.sintVal->clear();
|
m_ui.sintVal->clear();
|
||||||
m_ui.uintVal->clear();
|
m_ui.uintVal->clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!m_controller->isLoaded()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mCore* core = m_controller->thread()->core;
|
|
||||||
union {
|
union {
|
||||||
uint32_t u32;
|
uint32_t u32;
|
||||||
int32_t i32;
|
int32_t i32;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>550</width>
|
<width>565</width>
|
||||||
<height>640</height>
|
<height>658</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -168,20 +168,39 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<zorder></zorder>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||||
<item row="0" column="0">
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Unsigned Integer:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="uintVal">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Signed Integer:</string>
|
<string>Signed Integer:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item>
|
||||||
<widget class="QLineEdit" name="sintVal">
|
<widget class="QLineEdit" name="sintVal">
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -190,17 +209,17 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="0" colspan="2">
|
||||||
<layout class="QFormLayout" name="formLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item row="0" column="0">
|
<item>
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Unsigned Integer:</string>
|
<string>String:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item>
|
||||||
<widget class="QLineEdit" name="uintVal">
|
<widget class="QLineEdit" name="stringVal">
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Reference in New Issue