From 76401e8ffb3795e127ab8c377c1ac29aa2745d02 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 12 Jun 2022 23:38:33 -0700 Subject: [PATCH] BS2Emu: Initialize the last rows of postMatrices to the identity matrix This fixes Datel titles having missing textures (which was an issue with the previous commit). --- Source/Core/Core/Boot/Boot_BS2Emu.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Source/Core/Core/Boot/Boot_BS2Emu.cpp b/Source/Core/Core/Boot/Boot_BS2Emu.cpp index 2c51a8ddbf..9068c63983 100644 --- a/Source/Core/Core/Boot/Boot_BS2Emu.cpp +++ b/Source/Core/Core/Boot/Boot_BS2Emu.cpp @@ -37,6 +37,10 @@ #include "DiscIO/RiivolutionPatcher.h" #include "DiscIO/VolumeDisc.h" +#include "VideoCommon/VertexManagerBase.h" +#include "VideoCommon/VertexShaderManager.h" +#include "VideoCommon/XFMemory.h" + namespace { void PresetTimeBaseTicks() @@ -253,6 +257,17 @@ bool CBoot::EmulatedBS2_GC(const DiscIO::VolumeDisc& volume, SetupGCMemory(); + // Datel titles don't initialize the postMatrices, but they have dual-texture coordinate + // transformation enabled. We initialize all of xfmem to 0, which results in everything using + // a texture coordinate of (0, 0), breaking textures. Normally the IPL will initialize the last + // entry to the identity matrix, but the whole point of BS2 EMU is that it skips the IPL, so we + // need to do this initialization ourselves. + xfmem.postMatrices[0x3d * 4 + 0] = 1.0f; + xfmem.postMatrices[0x3e * 4 + 1] = 1.0f; + xfmem.postMatrices[0x3f * 4 + 2] = 1.0f; + g_vertex_manager->Flush(); + VertexShaderManager::InvalidateXFRange(XFMEM_POSTMATRICES + 0x3d * 4, XFMEM_POSTMATRICES_END); + DVDReadDiscID(volume, 0x00000000); bool streaming = Memory::Read_U8(0x80000008);