chore: Make GameBoyAdvance the the bios argument as boxed slice rather then a Vec
On windows, the Vec may sit on the stack.. Former-commit-id: b8aa77858291c1b7ee6bfbfbec92646f18e819de
This commit is contained in:
parent
c4e8c71d1f
commit
84db854a06
|
@ -146,7 +146,7 @@ pub mod bindings {
|
|||
let hw = Hardware { key_state: 0xffff };
|
||||
let hw = Rc::new(RefCell::new(hw));
|
||||
|
||||
let mut gba = GameBoyAdvance::new(bios_rom, gamepak, hw.clone(), hw.clone(), hw.clone());
|
||||
let mut gba = GameBoyAdvance::new(bios_rom.into_boxed_slice(), gamepak, hw.clone(), hw.clone(), hw.clone());
|
||||
if skip_bios != 0 {
|
||||
gba.skip_bios();
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ fn main() {
|
|||
|
||||
let mut fps_counter = FpsCounter::default();
|
||||
let mut gba = GameBoyAdvance::new(
|
||||
bios_bin,
|
||||
bios_bin.into_boxed_slice(),
|
||||
cart,
|
||||
minifb.clone(),
|
||||
minifb.clone(),
|
||||
|
|
|
@ -137,7 +137,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
.build()?;
|
||||
|
||||
let mut gba = GameBoyAdvance::new(
|
||||
bios_bin,
|
||||
bios_bin.into_boxed_slice(),
|
||||
gamepak,
|
||||
video.clone(),
|
||||
audio.clone(),
|
||||
|
@ -255,7 +255,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
// create a new emulator - TODO, export to a function
|
||||
gba = GameBoyAdvance::new(
|
||||
bios_bin,
|
||||
bios_bin.into_boxed_slice(),
|
||||
gamepak,
|
||||
video.clone(),
|
||||
audio.clone(),
|
||||
|
|
|
@ -34,7 +34,7 @@ struct SaveState {
|
|||
|
||||
impl GameBoyAdvance {
|
||||
pub fn new(
|
||||
bios_rom: Vec<u8>,
|
||||
bios_rom: Box<[u8]>,
|
||||
gamepak: Cartridge,
|
||||
video_device: Rc<RefCell<dyn VideoInterface>>,
|
||||
audio_device: Rc<RefCell<dyn AudioInterface>>,
|
||||
|
@ -209,7 +209,7 @@ mod tests {
|
|||
impl InputInterface for DummyInterface {}
|
||||
|
||||
fn make_mock_gba(rom: &[u8]) -> GameBoyAdvance {
|
||||
let bios = vec![0; 0x4000];
|
||||
let bios = vec![0; 0x4000].into_boxed_slice();
|
||||
let cartridge = GamepakBuilder::new()
|
||||
.buffer(rom)
|
||||
.with_sram()
|
||||
|
|
|
@ -123,11 +123,11 @@ pub struct SysBus {
|
|||
}
|
||||
|
||||
impl SysBus {
|
||||
pub fn new(io: IoDevices, bios_rom: Vec<u8>, cartridge: Cartridge) -> SysBus {
|
||||
pub fn new(io: IoDevices, bios_rom: Box<[u8]>, cartridge: Cartridge) -> SysBus {
|
||||
SysBus {
|
||||
io: io,
|
||||
|
||||
bios: BoxedMemory::new(bios_rom.into_boxed_slice()),
|
||||
bios: BoxedMemory::new(bios_rom),
|
||||
onboard_work_ram: BoxedMemory::new(vec![0; WORK_RAM_SIZE].into_boxed_slice()),
|
||||
internal_work_ram: BoxedMemory::new(vec![0; INTERNAL_RAM_SIZE].into_boxed_slice()),
|
||||
cartridge: cartridge,
|
||||
|
|
Reference in a new issue