diff --git a/mupen64plus-core/src/device/rcp/pi/pi_controller.c b/mupen64plus-core/src/device/rcp/pi/pi_controller.c index ed4405e..60ccaa5 100644 --- a/mupen64plus-core/src/device/rcp/pi/pi_controller.c +++ b/mupen64plus-core/src/device/rcp/pi/pi_controller.c @@ -55,9 +55,11 @@ static void dma_pi_read(struct pi_controller* pi) uint32_t cart_addr = pi->regs[PI_CART_ADDR_REG] & ~UINT32_C(1); uint32_t dram_addr = pi->regs[PI_DRAM_ADDR_REG] & 0xfffffe; - uint32_t length = (pi->regs[PI_RD_LEN_REG] & UINT32_C(0x00fffffe)) + 2; + uint32_t length = (pi->regs[PI_RD_LEN_REG] & UINT32_C(0x00ffffff)) + 1; const uint8_t* dram = (uint8_t*)pi->ri->rdram->dram; + if ((length & 0x1) && length >= 0x7F) + length +=1; if (dram_addr & 0x7) length -= dram_addr & 0x7; @@ -93,9 +95,11 @@ static void dma_pi_write(struct pi_controller* pi) uint32_t cart_addr = pi->regs[PI_CART_ADDR_REG] & ~UINT32_C(1); uint32_t dram_addr = pi->regs[PI_DRAM_ADDR_REG] & 0xfffffe; - uint32_t length = (pi->regs[PI_WR_LEN_REG] & UINT32_C(0x00fffffe)) + 2; + uint32_t length = (pi->regs[PI_WR_LEN_REG] & UINT32_C(0x00ffffff)) + 1; uint8_t* dram = (uint8_t*)pi->ri->rdram->dram; + if ((length & 0x1) && length >= 0x7F) + length +=1; if (dram_addr & 0x7) length -= dram_addr & 0x7; diff --git a/mupen64plus-core/src/device/rcp/rsp/rsp_core.c b/mupen64plus-core/src/device/rcp/rsp/rsp_core.c index 4059117..cbdfa32 100644 --- a/mupen64plus-core/src/device/rcp/rsp/rsp_core.c +++ b/mupen64plus-core/src/device/rcp/rsp/rsp_core.c @@ -42,18 +42,13 @@ static void do_sp_dma(struct rsp_core* sp, const struct sp_dma* dma) unsigned int l = dma->length; - unsigned int length = (l & 0xfff) + 1; + unsigned int length = ((l & 0xfff) | 7) + 1; unsigned int count = ((l >> 12) & 0xff) + 1; unsigned int skip = ((l >> 20) & 0xfff); - length = (length + 0x7) & ~0x7; unsigned int memaddr = dma->memaddr & 0xff8; unsigned int dramaddr = dma->dramaddr & 0xfffff8; - // Check length. - if ((memaddr + length) > 0x1000) - length = 0x1000 - memaddr; - unsigned char *spmem = (unsigned char*)sp->mem + (dma->memaddr & 0x1000); unsigned char *dram = (unsigned char*)sp->ri->rdram->dram;