mirror of
https://github.com/libretro/Mu.git
synced 2026-02-04 05:35:13 +00:00
Can now copy from log output
This commit is contained in:
@@ -72,26 +72,27 @@ void DebugViewer::on_debugGetHexValues_clicked(){
|
||||
int64_t address = numberFromString(ui->debugAddress->text(), false/*negative allowed*/);
|
||||
int64_t length = numberFromString(ui->debugLength->text(), false/*negative allowed*/);
|
||||
uint8_t bits = bitsPerEntry;
|
||||
|
||||
ui->debugValueList->clear();
|
||||
QString data = "";
|
||||
|
||||
if(address != INT64_MIN && length != INT64_MIN && length != 0 && address + bits / 8 * length - 1 <= 0xFFFFFFFF){
|
||||
for(int64_t count = 0; count < length; count++){
|
||||
uint64_t data = emu.debugGetEmulatorMemory(address, bits);
|
||||
uint64_t emuData = emu.debugGetEmulatorMemory(address, bits);
|
||||
QString value;
|
||||
value += QString::asprintf("0x%08X", (uint32_t)address);
|
||||
value += ":";
|
||||
if(data != UINT64_MAX)
|
||||
value += QString::asprintf("0x%0*X", bits / 8 * 2, (uint32_t)data);
|
||||
if(emuData != UINT64_MAX)
|
||||
value += QString::asprintf("0x%0*X", bits / 8 * 2, (uint32_t)emuData);
|
||||
else
|
||||
value += "Unsafe Access";
|
||||
ui->debugValueList->addItem(value);
|
||||
data += value + '\n';
|
||||
address += bits / 8;
|
||||
}
|
||||
}
|
||||
else{
|
||||
ui->debugValueList->addItem("Invalid Parameters");
|
||||
data += "Invalid Parameters";
|
||||
}
|
||||
|
||||
ui->debugValueList->setText(data);
|
||||
}
|
||||
|
||||
void DebugViewer::on_debugDecompile_clicked(){
|
||||
@@ -99,12 +100,10 @@ void DebugViewer::on_debugDecompile_clicked(){
|
||||
int64_t address = numberFromString(ui->debugAddress->text(), true/*negative not allowed*/);
|
||||
int64_t length = numberFromString(ui->debugLength->text(), true/*negative not allowed*/);
|
||||
|
||||
ui->debugValueList->clear();
|
||||
|
||||
if(address != INT64_MIN && length != INT64_MIN && length != 0)
|
||||
ui->debugValueList->addItems(emu.debugDisassemble(address, length).split('\n'));
|
||||
ui->debugValueList->setText(emu.debugDisassemble(address, length));
|
||||
else
|
||||
ui->debugValueList->addItem("Invalid Parameters");
|
||||
ui->debugValueList->setText("Invalid Parameters");
|
||||
}
|
||||
|
||||
void DebugViewer::on_debug8Bit_clicked(){
|
||||
@@ -126,10 +125,7 @@ void DebugViewer::on_debugDumpToFile_clicked(){
|
||||
QString fileBuffer;
|
||||
QFile fileOut(((MainWindow*)parentWidget())->settings->value("resourceDirectory", "").toString() + "/debugDumps/" + ui->debugFilePath->text());
|
||||
|
||||
for(int index = 0; index < ui->debugValueList->count(); index++){
|
||||
fileBuffer += ui->debugValueList->item(index)->text();
|
||||
fileBuffer += '\n';
|
||||
}
|
||||
fileBuffer = ui->debugValueList->toPlainText();
|
||||
|
||||
if(fileOut.open(QFile::ReadWrite)){
|
||||
//if a QString is used for output a '\0' will be appended to every character
|
||||
@@ -139,16 +135,14 @@ void DebugViewer::on_debugDumpToFile_clicked(){
|
||||
}
|
||||
|
||||
void DebugViewer::on_debugDumpToTerminal_clicked(){
|
||||
for(int index = 0; index < ui->debugValueList->count(); index++)
|
||||
printf("%s\n", ui->debugValueList->item(index)->text().toStdString().c_str());
|
||||
printf("%s\n", ui->debugValueList->toPlainText().toStdString().c_str());
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void DebugViewer::on_debugShowRegisters_clicked(){
|
||||
EmuWrapper& emu = ((MainWindow*)parentWidget())->emu;
|
||||
|
||||
ui->debugValueList->clear();
|
||||
ui->debugValueList->addItems(emu.debugGetCpuRegisterString().split('\n'));
|
||||
ui->debugValueList->setText(emu.debugGetCpuRegisterString());
|
||||
}
|
||||
|
||||
void DebugViewer::on_debugShowDebugLogs_clicked(){
|
||||
@@ -156,22 +150,24 @@ void DebugViewer::on_debugShowDebugLogs_clicked(){
|
||||
QVector<QString>& debugStrings = emu.debugGetLogEntrys();
|
||||
QVector<uint64_t>& duplicateCallCount = emu.debugGetDuplicateLogEntryCount();
|
||||
int64_t length = numberFromString(ui->debugLength->text(), true/*negative allowed*/);
|
||||
QString data = "";
|
||||
|
||||
ui->debugValueList->clear();
|
||||
if(length != INT64_MIN && qAbs(length) < debugStrings.size()){
|
||||
if(length < 0){
|
||||
for(uint64_t stringNum = debugStrings.size() + length; stringNum < debugStrings.size(); stringNum++)
|
||||
ui->debugValueList->addItem(debugStrings[stringNum] + "(printed " + QString::number(duplicateCallCount[stringNum]) + " times)");
|
||||
data += debugStrings[stringNum] + "(printed " + QString::number(duplicateCallCount[stringNum]) + " times)\n";
|
||||
}
|
||||
else{
|
||||
for(uint64_t stringNum = 0; stringNum < length; stringNum++)
|
||||
ui->debugValueList->addItem(debugStrings[stringNum] + "(printed " + QString::number(duplicateCallCount[stringNum]) + " times)");
|
||||
data += debugStrings[stringNum] + "(printed " + QString::number(duplicateCallCount[stringNum]) + " times)\n";
|
||||
}
|
||||
}
|
||||
else{
|
||||
for(uint64_t stringNum = 0; stringNum < debugStrings.size(); stringNum++)
|
||||
ui->debugValueList->addItem(debugStrings[stringNum] + "(printed " + QString::number(duplicateCallCount[stringNum]) + " times)");
|
||||
data += debugStrings[stringNum] + "(printed " + QString::number(duplicateCallCount[stringNum]) + " times)\n";
|
||||
}
|
||||
|
||||
ui->debugValueList->setText(data);
|
||||
}
|
||||
|
||||
void DebugViewer::on_debugEraseDebugLogs_clicked(){
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="10" column="1" colspan="3">
|
||||
<item row="9" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugDumpToFile">
|
||||
<property name="text">
|
||||
<string>Dump To File</string>
|
||||
@@ -55,10 +55,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="12">
|
||||
<widget class="QListWidget" name="debugValueList"/>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugDecompile">
|
||||
<property name="text">
|
||||
<string>Decompile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugGetHexValues">
|
||||
<property name="text">
|
||||
<string>Get Hex Values</string>
|
||||
@@ -68,28 +72,28 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<item row="1" column="3">
|
||||
<widget class="QRadioButton" name="debug32Bit">
|
||||
<property name="text">
|
||||
<string>32bit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="debug8Bit">
|
||||
<property name="text">
|
||||
<string>8bit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="3">
|
||||
<item row="2" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="debugLength">
|
||||
<property name="placeholderText">
|
||||
<string>Length</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1" colspan="3">
|
||||
<item row="8" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugEraseDebugLogs">
|
||||
<property name="text">
|
||||
<string>Erase Debug Logs</string>
|
||||
@@ -99,7 +103,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="3">
|
||||
<item row="7" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugShowDebugLogs">
|
||||
<property name="text">
|
||||
<string>Show Debug Logs</string>
|
||||
@@ -109,14 +113,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<item row="1" column="2">
|
||||
<widget class="QRadioButton" name="debug16Bit">
|
||||
<property name="text">
|
||||
<string>16bit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="3">
|
||||
<item row="10" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugDumpToTerminal">
|
||||
<property name="text">
|
||||
<string>Dump To Terminal</string>
|
||||
@@ -126,31 +130,40 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<item row="0" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="debugAddress">
|
||||
<property name="placeholderText">
|
||||
<string>Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="3">
|
||||
<item row="3" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="debugFilePath">
|
||||
<property name="placeholderText">
|
||||
<string>File Path</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="3">
|
||||
<item row="6" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugShowRegisters">
|
||||
<property name="text">
|
||||
<string>Show Registers</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugDecompile">
|
||||
<property name="text">
|
||||
<string>Decompile</string>
|
||||
<item row="0" column="0" rowspan="11">
|
||||
<widget class="QTextEdit" name="debugValueList">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="acceptRichText">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user