crash when reading a write-only register

This commit is contained in:
Flyinghead 2019-03-13 17:24:27 +01:00
parent e6d67baf02
commit f05af652cf
1 changed files with 2 additions and 2 deletions

View File

@ -43,7 +43,7 @@ u32 sb_ReadMem(u32 addr,u32 sz)
if (sb_regs[offset].flags & sz)
{
#endif
if (!(sb_regs[offset].flags & REG_RF) )
if (!(sb_regs[offset].flags & (REG_RF|REG_WO)))
{
if (sz==4)
return sb_regs[offset].data32;
@ -55,7 +55,7 @@ u32 sb_ReadMem(u32 addr,u32 sz)
else
{
//printf("SB: %08X\n",addr);
if (sb_regs[offset].readFunctionAddr == NULL)
if ((sb_regs[offset].flags & REG_WO) || sb_regs[offset].readFunctionAddr == NULL)
{
EMUERROR("sb_ReadMem write-only reg %08x %d\n", addr, sz);
return 0;