GPU: Fix handling of GP1(09h)

This commit is contained in:
Connor McLaughlin 2019-12-11 16:47:49 +10:00
parent ffe90083d3
commit 8f624afb59
2 changed files with 22 additions and 7 deletions

View File

@ -38,6 +38,7 @@ void GPU::UpdateSettings()
void GPU::Reset() void GPU::Reset()
{ {
SoftReset(); SoftReset();
m_set_texture_disable_mask = false;
m_GPUREAD_latch = 0; m_GPUREAD_latch = 0;
} }
@ -96,6 +97,8 @@ bool GPU::DoState(StateWrapper& sw)
sw.Do(&m_drawing_offset.y); sw.Do(&m_drawing_offset.y);
sw.Do(&m_drawing_offset.x); sw.Do(&m_drawing_offset.x);
sw.Do(&m_set_texture_disable_mask);
sw.Do(&m_crtc_state.regs.display_address_start); sw.Do(&m_crtc_state.regs.display_address_start);
sw.Do(&m_crtc_state.regs.horizontal_display_range); sw.Do(&m_crtc_state.regs.horizontal_display_range);
sw.Do(&m_crtc_state.regs.vertical_display_range); sw.Do(&m_crtc_state.regs.vertical_display_range);
@ -600,6 +603,13 @@ void GPU::WriteGP1(u32 value)
} }
break; break;
case 0x09: // Allow texture disable
{
m_set_texture_disable_mask = ConvertToBoolUnchecked(param & 0x01);
Log_DebugPrintf("Set texture disable mask <- %s", m_set_texture_disable_mask ? "allowed" : "ignored");
}
break;
case 0x10: case 0x10:
case 0x11: case 0x11:
case 0x12: case 0x12:
@ -725,22 +735,26 @@ void GPU::FlushRender() {}
void GPU::SetDrawMode(u16 value) void GPU::SetDrawMode(u16 value)
{ {
const DrawMode::Reg reg{static_cast<u16>(value & DrawMode::Reg::MASK)}; DrawMode::Reg new_mode_reg{static_cast<u16>(value & DrawMode::Reg::MASK)};
if (reg.bits == m_draw_mode.mode_reg.bits) if (!m_set_texture_disable_mask)
new_mode_reg.texture_disable = false;
if (new_mode_reg.bits == m_draw_mode.mode_reg.bits)
return; return;
if ((reg.bits & DrawMode::Reg::TEXTURE_PAGE_MASK) != (m_draw_mode.mode_reg.bits & DrawMode::Reg::TEXTURE_PAGE_MASK)) if ((new_mode_reg.bits & DrawMode::Reg::TEXTURE_PAGE_MASK) !=
(m_draw_mode.mode_reg.bits & DrawMode::Reg::TEXTURE_PAGE_MASK))
{ {
m_draw_mode.texture_page_x = reg.GetTexturePageXBase(); m_draw_mode.texture_page_x = new_mode_reg.GetTexturePageXBase();
m_draw_mode.texture_page_y = reg.GetTexturePageYBase(); m_draw_mode.texture_page_y = new_mode_reg.GetTexturePageYBase();
m_draw_mode.texture_page_changed = true; m_draw_mode.texture_page_changed = true;
} }
m_draw_mode.mode_reg.bits = reg.bits; m_draw_mode.mode_reg.bits = new_mode_reg.bits;
// Bits 0..10 are returned in the GPU status register. // Bits 0..10 are returned in the GPU status register.
m_GPUSTAT.bits = m_GPUSTAT.bits =
m_GPUSTAT.bits & ~(DrawMode::Reg::GPUSTAT_MASK) | (ZeroExtend32(reg.bits) & DrawMode::Reg::GPUSTAT_MASK); m_GPUSTAT.bits & ~(DrawMode::Reg::GPUSTAT_MASK) | (ZeroExtend32(new_mode_reg.bits) & DrawMode::Reg::GPUSTAT_MASK);
m_GPUSTAT.texture_disable = m_draw_mode.mode_reg.texture_disable; m_GPUSTAT.texture_disable = m_draw_mode.mode_reg.texture_disable;
} }

View File

@ -469,6 +469,7 @@ protected:
s32 y; s32 y;
} m_drawing_offset = {}; } m_drawing_offset = {};
bool m_set_texture_disable_mask = false;
bool m_drawing_area_changed = false; bool m_drawing_area_changed = false;
bool m_drawing_offset_changed = false; bool m_drawing_offset_changed = false;
bool m_force_progressive_scan = false; bool m_force_progressive_scan = false;