From baa40a4af0ca6d1215be3ab4ea1a896ce9a04c04 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sat, 1 Feb 2014 19:42:31 +0100 Subject: [PATCH] dffclient: Add support for modifying the PE_CONTROL register. --- dffclient/command_info.cpp | 9 +++++++++ source/BPMemory.cpp | 2 +- source/BPMemory.h | 14 +++++--------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/dffclient/command_info.cpp b/dffclient/command_info.cpp index 3ffe07e..ac8524e 100644 --- a/dffclient/command_info.cpp +++ b/dffclient/command_info.cpp @@ -227,6 +227,15 @@ void LayoutStream::ActiveItemChanged(const QModelIndex& index) AddCheckBox(mode.alphaupdate, tr("Enable alpha writing")).endl(); AddCheckBox(mode.dither, tr("Enable dithering")).endl(); } + else if (fifo_data[cmd_start+1] == BPMEM_ZCOMPARE) // 0x43 + { + GET(PE_CONTROL, ctrl); + + AddLabel(tr("Pixel Engine control")).endl(); + AddLabel(tr("EFB pixel format: ")).AddComboBox(ctrl.pixel_format, {"RGB8 Z24", "RGBA6 Z24", "RGB565 Z16", "Z24", "Y8", "U8", "V8", "YUV420"}).endl(); + AddLabel(tr("EFB depth format: ")).AddComboBox(ctrl.zformat, {tr("Linear"), tr("Near"), tr("Mid"), tr("Far"), tr("Inverse near"), tr("Inverse mid"), tr("Inverse far")}).endl(); + AddCheckBox(ctrl.early_ztest, tr("Early depth test")).endl(); + } else if (fifo_data[cmd_start+1] == BPMEM_TRIGGER_EFB_COPY) // 0x52 { UPE_Copy& copy = *(UPE_Copy*)&cmddata; diff --git a/source/BPMemory.cpp b/source/BPMemory.cpp index b5dbc8c..d6d3754 100644 --- a/source/BPMemory.cpp +++ b/source/BPMemory.cpp @@ -116,7 +116,7 @@ void GetBPRegInfo(const u8* data, char* name, size_t name_size, char* desc, size case BPMEM_ZCOMPARE: // 0x43 { SetRegName(BPMEM_ZCOMPARE); - PE_CONTROL config; config.hex = cmddata; + PE_CONTROL& config = *(PE_CONTROL*)&cmddata; const char* pixel_formats[] = { "RGB8_Z24", "RGBA6_Z24", "RGB565_Z16", "Z24", "Y8", "U8", "V8", "YUV420" }; const char* zformats[] = { "linear", "compressed (near)", "compressed (mid)", "compressed (far)", "inv linear", "compressed (inv near)", "compressed (inv mid)", "compressed (inv far)" }; snprintf(desc, desc_size, "EFB pixel format: %s\n" diff --git a/source/BPMemory.h b/source/BPMemory.h index 9e22a69..8da307e 100644 --- a/source/BPMemory.h +++ b/source/BPMemory.h @@ -765,14 +765,10 @@ union FieldMask union PE_CONTROL { - struct - { - u32 pixel_format : 3; // PIXELFMT_X - u32 zformat : 3; // Z Compression for 16bit Z format - u32 early_ztest : 1; // 1: before tex stage - u32 unused : 17; - u32 rid : 8; - }; + BitField<0,3> pixel_format; // PIXELFMT_X + BitField<3,3> zformat; // Z compression for 16 bit Z format + BitField<6,1> early_ztest; // 1: before tex stage + u32 hex; }; @@ -781,7 +777,7 @@ union PE_CONTROL union TCInfo { - struct + struct { u32 scale_minus_1 : 16; u32 range_bias : 1;