fix: Allow writes to DirectSound FIFOs in 8bit granularity
This fixes audio in games that directly write to sound FIFO using STRB instructions. Former-commit-id: 3efb686b28146c414d5fad289f958346a9a5db6e
This commit is contained in:
parent
1a382b4cee
commit
a585753dc2
|
@ -254,13 +254,19 @@ impl Bus for IoDevices {
|
|||
}
|
||||
|
||||
fn write_8(&mut self, addr: Addr, value: u8) {
|
||||
let t = self.read_16(addr & !1);
|
||||
let t = if addr & 1 != 0 {
|
||||
(t & 0xff) | (value as u16) << 8
|
||||
} else {
|
||||
(t & 0xff00) | (value as u16)
|
||||
};
|
||||
self.write_16(addr & !1, t);
|
||||
match addr + IO_BASE {
|
||||
/* FIFO_A */ 0x0400_00A0 | 0x0400_00A1 | 0x0400_00A2 | 0x0400_00A3 => self.sound.write_fifo(0, value as i8),
|
||||
/* FIFO_B */ 0x0400_00A4 | 0x0400_00A5 | 0x0400_00A6 | 0x0400_00A7 => self.sound.write_fifo(1, value as i8),
|
||||
_ => {
|
||||
let t = self.read_16(addr & !1);
|
||||
let t = if addr & 1 != 0 {
|
||||
(t & 0xff) | (value as u16) << 8
|
||||
} else {
|
||||
(t & 0xff00) | (value as u16)
|
||||
};
|
||||
self.write_16(addr & !1, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -204,10 +204,11 @@ impl SoundController {
|
|||
return;
|
||||
}
|
||||
|
||||
if !self.mse {
|
||||
warn!("MSE disabled, refusing to write");
|
||||
return;
|
||||
}
|
||||
// TODO - figure out which writes should be disabled when MSE is off
|
||||
// if !self.mse {
|
||||
// warn!("MSE disabled, refusing to write");
|
||||
// return;
|
||||
// }
|
||||
|
||||
match io_addr {
|
||||
REG_SOUNDCNT_L => {
|
||||
|
@ -288,6 +289,11 @@ impl SoundController {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn write_fifo(&mut self, id: usize, val: i8) {
|
||||
assert!(id == 0 || id == 1);
|
||||
self.dma_sound[id].fifo.write(val);
|
||||
}
|
||||
|
||||
pub fn handle_timer_overflow(
|
||||
&mut self,
|
||||
dmac: &mut DmaController,
|
||||
|
|
Reference in a new issue