non-empty default value for ram (#465)

This commit is contained in:
Logan McNaughton 2025-07-02 14:33:19 +02:00 committed by GitHub
parent dc1535ea04
commit 31b4e7944b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 7 deletions

View File

@ -240,14 +240,14 @@ fn dma_write_flash(
.rdram
.mem
.get_mut(dram_addr as usize..dram_addr as usize + 4)
.unwrap_or_default()
.unwrap_or(&mut [0; 4])
.copy_from_slice(&device.cart.flashram.silicon_id[0].to_ne_bytes());
dram_addr += 4;
device
.rdram
.mem
.get_mut(dram_addr as usize..dram_addr as usize + 4)
.unwrap_or_default()
.unwrap_or(&mut [0; 4])
.copy_from_slice(&device.cart.flashram.silicon_id[1].to_ne_bytes());
} else if (cart_addr & 0x1ffff) < 0x10000
&& device.cart.flashram.mode == FlashramMode::ReadArray

View File

@ -76,7 +76,7 @@ pub fn write_mem(device: &mut device::Device, address: u64, value: u32, mask: u3
.rdram
.mem
.get_mut(address as usize..(address + 4) as usize)
.unwrap_or_default()
.unwrap_or(&mut [0; 4])
.copy_from_slice(&data.to_ne_bytes());
}
@ -118,14 +118,14 @@ pub fn init(device: &mut device::Device) {
.rdram
.mem
.get_mut(0x318..0x318 + 4)
.unwrap_or_default()
.unwrap_or(&mut [0; 4])
.copy_from_slice(&device.rdram.size.to_ne_bytes());
// hack, skip RDRAM initialization
device
.rdram
.mem
.get_mut(0x3f0..0x3f0 + 4)
.unwrap_or_default()
.unwrap_or(&mut [0; 4])
.copy_from_slice(&device.rdram.size.to_ne_bytes());
device.ri.regs[device::ri::RI_MODE_REG as usize] = 0x0e;

View File

@ -161,7 +161,7 @@ fn do_dma(device: &mut device::Device, dma: RspDma) {
.rdram
.mem
.get_mut(dram_addr as usize..dram_addr as usize + 4)
.unwrap_or_default()
.unwrap_or(&mut [0; 4])
.copy_from_slice(&data.to_ne_bytes());
mem_addr += 4;
dram_addr += 4;

View File

@ -105,7 +105,7 @@ fn copy_pif_rdram(device: &mut device::Device) {
.rdram
.mem
.get_mut(dram_addr + i..dram_addr + i + 4)
.unwrap_or_default()
.unwrap_or(&mut [0; 4])
.copy_from_slice(&data.to_ne_bytes());
i += 4;
}