Statically round up PI_WR_LEN_REG to nearest even

This commit is contained in:
LegendOfDragoon 2016-02-09 17:21:29 -08:00
parent cb3ada6ece
commit ad5370a252
1 changed files with 2 additions and 6 deletions

View File

@ -198,12 +198,8 @@ void CDMA::PI_DMA_READ()
void CDMA::PI_DMA_WRITE() void CDMA::PI_DMA_WRITE()
{ {
uint32_t PI_WR_LEN_REG = ((g_Reg->PI_WR_LEN_REG) & 0x00FFFFFFul) + 1; uint32_t PI_WR_LEN_REG = ((g_Reg->PI_WR_LEN_REG) & 0x00FFFFFEul) + 2;
/* rounding PI_WR_LEN_REG up to the nearest even number fixes AI Shougi 3, Doraemon 3, etc. */
if ((PI_WR_LEN_REG & 1) != 0)
{
PI_WR_LEN_REG += 1; /* fixes AI Shougi 3, Doraemon 3, etc. */
}
g_Reg->PI_STATUS_REG |= PI_STATUS_DMA_BUSY; g_Reg->PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
if (g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG > g_MMU->RdramSize()) if (g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG > g_MMU->RdramSize())