yuzu/debugger: Specify string conversions explicitly
This commit is contained in:
parent
45ff10c9a0
commit
4832b29d3d
10 changed files with 143 additions and 131 deletions
|
@ -34,8 +34,8 @@ QVariant GPUCommandStreamItemModel::data(const QModelIndex& index, int role) con
|
|||
{Service::GSP::CommandId::CACHE_FLUSH, "CACHE_FLUSH"},
|
||||
};
|
||||
const u32* command_data = reinterpret_cast<const u32*>(&command);
|
||||
QString str = QString("%1 %2 %3 %4 %5 %6 %7 %8 %9")
|
||||
.arg(command_names[command.id])
|
||||
QString str = QStringLiteral("%1 %2 %3 %4 %5 %6 %7 %8 %9")
|
||||
.arg(QString::fromUtf8(command_names[command.id]))
|
||||
.arg(command_data[0], 8, 16, QLatin1Char('0'))
|
||||
.arg(command_data[1], 8, 16, QLatin1Char('0'))
|
||||
.arg(command_data[2], 8, 16, QLatin1Char('0'))
|
||||
|
@ -65,7 +65,7 @@ void GPUCommandStreamItemModel::OnGXCommandFinishedInternal(int total_command_co
|
|||
|
||||
GPUCommandStreamWidget::GPUCommandStreamWidget(QWidget* parent)
|
||||
: QDockWidget(tr("Graphics Debugger"), parent) {
|
||||
setObjectName("GraphicsDebugger");
|
||||
setObjectName(QStringLiteral("GraphicsDebugger"));
|
||||
|
||||
GPUCommandStreamItemModel* command_model = new GPUCommandStreamItemModel(this);
|
||||
g_debugger.RegisterObserver(command_model);
|
||||
|
|
|
@ -141,7 +141,7 @@ GraphicsBreakPointsWidget::GraphicsBreakPointsWidget(
|
|||
std::shared_ptr<Pica::DebugContext> debug_context, QWidget* parent)
|
||||
: QDockWidget(tr("Pica Breakpoints"), parent), Pica::DebugContext::BreakPointObserver(
|
||||
debug_context) {
|
||||
setObjectName("PicaBreakPointsWidget");
|
||||
setObjectName(QStringLiteral("PicaBreakPointsWidget"));
|
||||
|
||||
status_text = new QLabel(tr("Emulation running"));
|
||||
resume_button = new QPushButton(tr("Resume"));
|
||||
|
|
|
@ -76,11 +76,11 @@ QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const {
|
|||
case 0:
|
||||
return QString::fromLatin1(Pica::Regs::GetRegisterName(write.cmd_id));
|
||||
case 1:
|
||||
return QString("%1").arg(write.cmd_id, 3, 16, QLatin1Char('0'));
|
||||
return QStringLiteral("%1").arg(write.cmd_id, 3, 16, QLatin1Char('0'));
|
||||
case 2:
|
||||
return QString("%1").arg(write.mask, 4, 2, QLatin1Char('0'));
|
||||
return QStringLiteral("%1").arg(write.mask, 4, 2, QLatin1Char('0'));
|
||||
case 3:
|
||||
return QString("%1").arg(write.value, 8, 16, QLatin1Char('0'));
|
||||
return QStringLiteral("%1").arg(write.value, 8, 16, QLatin1Char('0'));
|
||||
}
|
||||
} else if (role == CommandIdRole) {
|
||||
return QVariant::fromValue<int>(write.cmd_id);
|
||||
|
@ -184,7 +184,7 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) {
|
|||
|
||||
GPUCommandListWidget::GPUCommandListWidget(QWidget* parent)
|
||||
: QDockWidget(tr("Pica Command List"), parent) {
|
||||
setObjectName("Pica Command List");
|
||||
setObjectName(QStringLiteral("Pica Command List"));
|
||||
GPUCommandListModel* model = new GPUCommandListModel(this);
|
||||
|
||||
QWidget* main_widget = new QWidget;
|
||||
|
@ -246,9 +246,9 @@ void GPUCommandListWidget::CopyAllToClipboard() {
|
|||
for (int col = 0; col < model->columnCount({}); ++col) {
|
||||
QModelIndex index = model->index(row, col);
|
||||
text += model->data(index).value<QString>();
|
||||
text += '\t';
|
||||
text += QLatin1Char('\t');
|
||||
}
|
||||
text += '\n';
|
||||
text += QLatin1Char('\n');
|
||||
}
|
||||
|
||||
clipboard->setText(text);
|
||||
|
|
|
@ -51,7 +51,7 @@ GraphicsSurfaceWidget::GraphicsSurfaceWidget(std::shared_ptr<Pica::DebugContext>
|
|||
QWidget* parent)
|
||||
: BreakPointObserverDock(debug_context, tr("Pica Surface Viewer"), parent),
|
||||
surface_source(Source::ColorBuffer) {
|
||||
setObjectName("PicaSurface");
|
||||
setObjectName(QStringLiteral("PicaSurface"));
|
||||
|
||||
surface_source_list = new QComboBox;
|
||||
surface_source_list->addItem(tr("Color Buffer"));
|
||||
|
@ -66,7 +66,7 @@ GraphicsSurfaceWidget::GraphicsSurfaceWidget(std::shared_ptr<Pica::DebugContext>
|
|||
surface_address_control = new CSpinBox;
|
||||
surface_address_control->SetBase(16);
|
||||
surface_address_control->SetRange(0, 0xFFFFFFFF);
|
||||
surface_address_control->SetPrefix("0x");
|
||||
surface_address_control->SetPrefix(QStringLiteral("0x"));
|
||||
|
||||
unsigned max_dimension = 16384; // TODO: Find actual maximum
|
||||
|
||||
|
@ -121,7 +121,7 @@ GraphicsSurfaceWidget::GraphicsSurfaceWidget(std::shared_ptr<Pica::DebugContext>
|
|||
scroll_area->setWidgetResizable(false);
|
||||
scroll_area->setWidget(surface_picture_label);
|
||||
|
||||
save_surface = new QPushButton(QIcon::fromTheme("document-save"), tr("Save"));
|
||||
save_surface = new QPushButton(QIcon::fromTheme(QStringLiteral("document-save")), tr("Save"));
|
||||
|
||||
// Connections
|
||||
connect(this, &GraphicsSurfaceWidget::Update, this, &GraphicsSurfaceWidget::OnUpdate);
|
||||
|
@ -313,7 +313,7 @@ void GraphicsSurfaceWidget::Pick(int x, int y) {
|
|||
switch (format) {
|
||||
case Format::RGBA8: {
|
||||
auto value = Color::DecodeRGBA8(pixel) / 255.0f;
|
||||
return QString("Red: %1, Green: %2, Blue: %3, Alpha: %4")
|
||||
return QStringLiteral("Red: %1, Green: %2, Blue: %3, Alpha: %4")
|
||||
.arg(QString::number(value.r(), 'f', 2))
|
||||
.arg(QString::number(value.g(), 'f', 2))
|
||||
.arg(QString::number(value.b(), 'f', 2))
|
||||
|
@ -321,14 +321,14 @@ void GraphicsSurfaceWidget::Pick(int x, int y) {
|
|||
}
|
||||
case Format::RGB8: {
|
||||
auto value = Color::DecodeRGB8(pixel) / 255.0f;
|
||||
return QString("Red: %1, Green: %2, Blue: %3")
|
||||
return QStringLiteral("Red: %1, Green: %2, Blue: %3")
|
||||
.arg(QString::number(value.r(), 'f', 2))
|
||||
.arg(QString::number(value.g(), 'f', 2))
|
||||
.arg(QString::number(value.b(), 'f', 2));
|
||||
}
|
||||
case Format::RGB5A1: {
|
||||
auto value = Color::DecodeRGB5A1(pixel) / 255.0f;
|
||||
return QString("Red: %1, Green: %2, Blue: %3, Alpha: %4")
|
||||
return QStringLiteral("Red: %1, Green: %2, Blue: %3, Alpha: %4")
|
||||
.arg(QString::number(value.r(), 'f', 2))
|
||||
.arg(QString::number(value.g(), 'f', 2))
|
||||
.arg(QString::number(value.b(), 'f', 2))
|
||||
|
@ -336,69 +336,72 @@ void GraphicsSurfaceWidget::Pick(int x, int y) {
|
|||
}
|
||||
case Format::RGB565: {
|
||||
auto value = Color::DecodeRGB565(pixel) / 255.0f;
|
||||
return QString("Red: %1, Green: %2, Blue: %3")
|
||||
return QStringLiteral("Red: %1, Green: %2, Blue: %3")
|
||||
.arg(QString::number(value.r(), 'f', 2))
|
||||
.arg(QString::number(value.g(), 'f', 2))
|
||||
.arg(QString::number(value.b(), 'f', 2));
|
||||
}
|
||||
case Format::RGBA4: {
|
||||
auto value = Color::DecodeRGBA4(pixel) / 255.0f;
|
||||
return QString("Red: %1, Green: %2, Blue: %3, Alpha: %4")
|
||||
return QStringLiteral("Red: %1, Green: %2, Blue: %3, Alpha: %4")
|
||||
.arg(QString::number(value.r(), 'f', 2))
|
||||
.arg(QString::number(value.g(), 'f', 2))
|
||||
.arg(QString::number(value.b(), 'f', 2))
|
||||
.arg(QString::number(value.a(), 'f', 2));
|
||||
}
|
||||
case Format::IA8:
|
||||
return QString("Index: %1, Alpha: %2").arg(pixel[0]).arg(pixel[1]);
|
||||
return QStringLiteral("Index: %1, Alpha: %2").arg(pixel[0]).arg(pixel[1]);
|
||||
case Format::RG8: {
|
||||
auto value = Color::DecodeRG8(pixel) / 255.0f;
|
||||
return QString("Red: %1, Green: %2")
|
||||
return QStringLiteral("Red: %1, Green: %2")
|
||||
.arg(QString::number(value.r(), 'f', 2))
|
||||
.arg(QString::number(value.g(), 'f', 2));
|
||||
}
|
||||
case Format::I8:
|
||||
return QString("Index: %1").arg(*pixel);
|
||||
return QStringLiteral("Index: %1").arg(*pixel);
|
||||
case Format::A8:
|
||||
return QString("Alpha: %1").arg(QString::number(*pixel / 255.0f, 'f', 2));
|
||||
return QStringLiteral("Alpha: %1").arg(QString::number(*pixel / 255.0f, 'f', 2));
|
||||
case Format::IA4:
|
||||
return QString("Index: %1, Alpha: %2").arg(*pixel & 0xF).arg((*pixel & 0xF0) >> 4);
|
||||
return QStringLiteral("Index: %1, Alpha: %2")
|
||||
.arg(*pixel & 0xF)
|
||||
.arg((*pixel & 0xF0) >> 4);
|
||||
case Format::I4: {
|
||||
u8 i = (*pixel >> ((offset % 2) ? 4 : 0)) & 0xF;
|
||||
return QString("Index: %1").arg(i);
|
||||
return QStringLiteral("Index: %1").arg(i);
|
||||
}
|
||||
case Format::A4: {
|
||||
u8 a = (*pixel >> ((offset % 2) ? 4 : 0)) & 0xF;
|
||||
return QString("Alpha: %1").arg(QString::number(a / 15.0f, 'f', 2));
|
||||
return QStringLiteral("Alpha: %1").arg(QString::number(a / 15.0f, 'f', 2));
|
||||
}
|
||||
case Format::ETC1:
|
||||
case Format::ETC1A4:
|
||||
// TODO: Display block information or channel values?
|
||||
return QString("Compressed data");
|
||||
return QStringLiteral("Compressed data");
|
||||
case Format::D16: {
|
||||
auto value = Color::DecodeD16(pixel);
|
||||
return QString("Depth: %1").arg(QString::number(value / (float)0xFFFF, 'f', 4));
|
||||
return QStringLiteral("Depth: %1").arg(QString::number(value / (float)0xFFFF, 'f', 4));
|
||||
}
|
||||
case Format::D24: {
|
||||
auto value = Color::DecodeD24(pixel);
|
||||
return QString("Depth: %1").arg(QString::number(value / (float)0xFFFFFF, 'f', 4));
|
||||
return QStringLiteral("Depth: %1")
|
||||
.arg(QString::number(value / (float)0xFFFFFF, 'f', 4));
|
||||
}
|
||||
case Format::D24X8:
|
||||
case Format::X24S8: {
|
||||
auto values = Color::DecodeD24S8(pixel);
|
||||
return QString("Depth: %1, Stencil: %2")
|
||||
return QStringLiteral("Depth: %1, Stencil: %2")
|
||||
.arg(QString::number(values[0] / (float)0xFFFFFF, 'f', 4))
|
||||
.arg(values[1]);
|
||||
}
|
||||
case Format::Unknown:
|
||||
return QString("Unknown format");
|
||||
return QStringLiteral("Unknown format");
|
||||
default:
|
||||
return QString("Unhandled format");
|
||||
return QStringLiteral("Unhandled format");
|
||||
}
|
||||
return QString("");
|
||||
return QString{};
|
||||
};
|
||||
|
||||
QString nibbles = "";
|
||||
QString nibbles;
|
||||
for (unsigned i = 0; i < nibbles_per_pixel; i++) {
|
||||
unsigned nibble_index = i;
|
||||
if (nibble_mode) {
|
||||
|
@ -410,7 +413,7 @@ void GraphicsSurfaceWidget::Pick(int x, int y) {
|
|||
}
|
||||
|
||||
surface_info_label->setText(
|
||||
QString("Raw: 0x%3\n(%4)").arg(nibbles).arg(GetText(surface_format, pixel)));
|
||||
QStringLiteral("Raw: 0x%3\n(%4)").arg(nibbles).arg(GetText(surface_format, pixel)));
|
||||
surface_info_label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ GraphicsTracingWidget::GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext>
|
|||
QWidget* parent)
|
||||
: BreakPointObserverDock(debug_context, tr("CiTrace Recorder"), parent) {
|
||||
|
||||
setObjectName("CiTracing");
|
||||
setObjectName(QStringLiteral("CiTracing"));
|
||||
|
||||
QPushButton* start_recording = new QPushButton(tr("Start Recording"));
|
||||
QPushButton* stop_recording =
|
||||
new QPushButton(QIcon::fromTheme("document-save"), tr("Stop and Save"));
|
||||
new QPushButton(QIcon::fromTheme(QStringLiteral("document-save")), tr("Stop and Save"));
|
||||
QPushButton* abort_recording = new QPushButton(tr("Abort Recording"));
|
||||
|
||||
connect(this, &GraphicsTracingWidget::SetStartTracingButtonEnabled, start_recording,
|
||||
|
@ -109,8 +109,8 @@ void GraphicsTracingWidget::StopRecording() {
|
|||
if (!context)
|
||||
return;
|
||||
|
||||
QString filename = QFileDialog::getSaveFileName(this, tr("Save CiTrace"), "citrace.ctf",
|
||||
tr("CiTrace File (*.ctf)"));
|
||||
QString filename = QFileDialog::getSaveFileName(
|
||||
this, tr("Save CiTrace"), QStringLiteral("citrace.ctf"), tr("CiTrace File (*.ctf)"));
|
||||
|
||||
if (filename.isEmpty()) {
|
||||
// If the user canceled the dialog, keep recording
|
||||
|
|
|
@ -86,10 +86,11 @@ QVariant GraphicsVertexShaderModel::data(const QModelIndex& index, int role) con
|
|||
if (par->info.HasLabel(index.row()))
|
||||
return QString::fromStdString(par->info.GetLabel(index.row()));
|
||||
|
||||
return QString("%1").arg(4 * index.row(), 4, 16, QLatin1Char('0'));
|
||||
return QStringLiteral("%1").arg(4 * index.row(), 4, 16, QLatin1Char('0'));
|
||||
|
||||
case 1:
|
||||
return QString("%1").arg(par->info.code[index.row()].hex, 8, 16, QLatin1Char('0'));
|
||||
return QStringLiteral("%1").arg(par->info.code[index.row()].hex, 8, 16,
|
||||
QLatin1Char('0'));
|
||||
|
||||
case 2: {
|
||||
std::ostringstream output;
|
||||
|
@ -341,8 +342,9 @@ QVariant GraphicsVertexShaderModel::data(const QModelIndex& index, int role) con
|
|||
}
|
||||
|
||||
void GraphicsVertexShaderWidget::DumpShader() {
|
||||
QString filename = QFileDialog::getSaveFileName(
|
||||
this, tr("Save Shader Dump"), "shader_dump.shbin", tr("Shader Binary (*.shbin)"));
|
||||
QString filename = QFileDialog::getSaveFileName(this, tr("Save Shader Dump"),
|
||||
QStringLiteral("shader_dump.shbin"),
|
||||
tr("Shader Binary (*.shbin)"));
|
||||
|
||||
if (filename.isEmpty()) {
|
||||
// If the user canceled the dialog, don't dump anything.
|
||||
|
@ -358,8 +360,8 @@ void GraphicsVertexShaderWidget::DumpShader() {
|
|||
|
||||
GraphicsVertexShaderWidget::GraphicsVertexShaderWidget(
|
||||
std::shared_ptr<Pica::DebugContext> debug_context, QWidget* parent)
|
||||
: BreakPointObserverDock(debug_context, "Pica Vertex Shader", parent) {
|
||||
setObjectName("PicaVertexShader");
|
||||
: BreakPointObserverDock(debug_context, tr("Pica Vertex Shader"), parent) {
|
||||
setObjectName(QStringLiteral("PicaVertexShader"));
|
||||
|
||||
// Clear input vertex data so that it contains valid float values in case a debug shader
|
||||
// execution happens before the first Vertex Loaded breakpoint.
|
||||
|
@ -387,7 +389,8 @@ GraphicsVertexShaderWidget::GraphicsVertexShaderWidget(
|
|||
binary_list->setRootIsDecorated(false);
|
||||
binary_list->setAlternatingRowColors(true);
|
||||
|
||||
auto dump_shader = new QPushButton(QIcon::fromTheme("document-save"), tr("Dump"));
|
||||
auto dump_shader =
|
||||
new QPushButton(QIcon::fromTheme(QStringLiteral("document-save")), tr("Dump"));
|
||||
|
||||
instruction_description = new QLabel;
|
||||
|
||||
|
@ -487,14 +490,14 @@ void GraphicsVertexShaderWidget::Reload(bool replace_vertex_data, void* vertex_d
|
|||
for (unsigned attr = 0; attr < 16; ++attr) {
|
||||
for (unsigned comp = 0; comp < 4; ++comp) {
|
||||
input_data[4 * attr + comp]->setText(
|
||||
QString("%1").arg(input_vertex.attr[attr][comp].ToFloat32()));
|
||||
QStringLiteral("%1").arg(input_vertex.attr[attr][comp].ToFloat32()));
|
||||
}
|
||||
}
|
||||
breakpoint_warning->hide();
|
||||
} else {
|
||||
for (unsigned attr = 0; attr < 16; ++attr) {
|
||||
for (unsigned comp = 0; comp < 4; ++comp) {
|
||||
input_data[4 * attr + comp]->setText(QString("???"));
|
||||
input_data[4 * attr + comp]->setText(QStringLiteral("???"));
|
||||
}
|
||||
}
|
||||
breakpoint_warning->show();
|
||||
|
@ -524,7 +527,7 @@ void GraphicsVertexShaderWidget::Reload(bool replace_vertex_data, void* vertex_d
|
|||
// Reload widget state
|
||||
for (int attr = 0; attr < num_attributes; ++attr) {
|
||||
unsigned source_attr = shader_config.GetRegisterForAttribute(attr);
|
||||
input_data_mapping[attr]->setText(QString("-> v%1").arg(source_attr));
|
||||
input_data_mapping[attr]->setText(QStringLiteral("-> v%1").arg(source_attr));
|
||||
input_data_container[attr]->setVisible(true);
|
||||
}
|
||||
// Only show input attributes which are used as input to the shader
|
||||
|
@ -552,6 +555,8 @@ void GraphicsVertexShaderWidget::OnInputAttributeChanged(int index) {
|
|||
|
||||
void GraphicsVertexShaderWidget::OnCycleIndexChanged(int index) {
|
||||
QString text;
|
||||
const QString true_string = QStringLiteral("true");
|
||||
const QString false_string = QStringLiteral("false");
|
||||
|
||||
auto& record = debug_data.records[index];
|
||||
if (record.mask & Pica::Shader::DebugDataRecord::SRC1)
|
||||
|
@ -591,15 +596,15 @@ void GraphicsVertexShaderWidget::OnCycleIndexChanged(int index) {
|
|||
.arg(record.address_registers[1]);
|
||||
if (record.mask & Pica::Shader::DebugDataRecord::CMP_RESULT)
|
||||
text += tr("Compare Result: %1, %2\n")
|
||||
.arg(record.conditional_code[0] ? "true" : "false")
|
||||
.arg(record.conditional_code[1] ? "true" : "false");
|
||||
.arg(record.conditional_code[0] ? true_string : false_string)
|
||||
.arg(record.conditional_code[1] ? true_string : false_string);
|
||||
|
||||
if (record.mask & Pica::Shader::DebugDataRecord::COND_BOOL_IN)
|
||||
text += tr("Static Condition: %1\n").arg(record.cond_bool ? "true" : "false");
|
||||
text += tr("Static Condition: %1\n").arg(record.cond_bool ? true_string : false_string);
|
||||
if (record.mask & Pica::Shader::DebugDataRecord::COND_CMP_IN)
|
||||
text += tr("Dynamic Conditions: %1, %2\n")
|
||||
.arg(record.cond_cmp[0] ? "true" : "false")
|
||||
.arg(record.cond_cmp[1] ? "true" : "false");
|
||||
.arg(record.cond_cmp[0] ? true_string : false_string)
|
||||
.arg(record.cond_cmp[1] ? true_string : false_string);
|
||||
if (record.mask & Pica::Shader::DebugDataRecord::LOOP_INT_IN)
|
||||
text += tr("Loop Parameters: %1 (repeats), %2 (initializer), %3 (increment), %4\n")
|
||||
.arg(record.loop_int.x)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue