CPU/Recompiler: Fix corrupted constant address byte/halfword writes

Fixes broken rendering in Dino Crisis.
This commit is contained in:
Connor McLaughlin 2021-04-27 02:11:15 +10:00
parent fda106811c
commit e842abfa8a

View file

@ -120,11 +120,15 @@ void CodeGenerator::EmitStoreGuestMemory(const CodeBlockInstruction& cbi, const
{
void* ptr = GetDirectWriteMemoryPointer(
static_cast<u32>(address.constant_value),
(value.size == RegSize_8) ? MemoryAccessSize::Byte :
((value.size == RegSize_16) ? MemoryAccessSize::HalfWord : MemoryAccessSize::Word));
(size == RegSize_8) ? MemoryAccessSize::Byte :
((size == RegSize_16) ? MemoryAccessSize::HalfWord : MemoryAccessSize::Word));
if (ptr)
{
if (value.size != size)
EmitStoreGlobal(ptr, value.ViewAsSize(size));
else
EmitStoreGlobal(ptr, value);
return;
}
}