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 = Hardware { key_state: 0xffff };
|
||||||
let hw = Rc::new(RefCell::new(hw));
|
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 {
|
if skip_bios != 0 {
|
||||||
gba.skip_bios();
|
gba.skip_bios();
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ fn main() {
|
||||||
|
|
||||||
let mut fps_counter = FpsCounter::default();
|
let mut fps_counter = FpsCounter::default();
|
||||||
let mut gba = GameBoyAdvance::new(
|
let mut gba = GameBoyAdvance::new(
|
||||||
bios_bin,
|
bios_bin.into_boxed_slice(),
|
||||||
cart,
|
cart,
|
||||||
minifb.clone(),
|
minifb.clone(),
|
||||||
minifb.clone(),
|
minifb.clone(),
|
||||||
|
|
|
@ -137,7 +137,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
let mut gba = GameBoyAdvance::new(
|
let mut gba = GameBoyAdvance::new(
|
||||||
bios_bin,
|
bios_bin.into_boxed_slice(),
|
||||||
gamepak,
|
gamepak,
|
||||||
video.clone(),
|
video.clone(),
|
||||||
audio.clone(),
|
audio.clone(),
|
||||||
|
@ -255,7 +255,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
|
||||||
// create a new emulator - TODO, export to a function
|
// create a new emulator - TODO, export to a function
|
||||||
gba = GameBoyAdvance::new(
|
gba = GameBoyAdvance::new(
|
||||||
bios_bin,
|
bios_bin.into_boxed_slice(),
|
||||||
gamepak,
|
gamepak,
|
||||||
video.clone(),
|
video.clone(),
|
||||||
audio.clone(),
|
audio.clone(),
|
||||||
|
|
|
@ -34,7 +34,7 @@ struct SaveState {
|
||||||
|
|
||||||
impl GameBoyAdvance {
|
impl GameBoyAdvance {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
bios_rom: Vec<u8>,
|
bios_rom: Box<[u8]>,
|
||||||
gamepak: Cartridge,
|
gamepak: Cartridge,
|
||||||
video_device: Rc<RefCell<dyn VideoInterface>>,
|
video_device: Rc<RefCell<dyn VideoInterface>>,
|
||||||
audio_device: Rc<RefCell<dyn AudioInterface>>,
|
audio_device: Rc<RefCell<dyn AudioInterface>>,
|
||||||
|
@ -209,7 +209,7 @@ mod tests {
|
||||||
impl InputInterface for DummyInterface {}
|
impl InputInterface for DummyInterface {}
|
||||||
|
|
||||||
fn make_mock_gba(rom: &[u8]) -> GameBoyAdvance {
|
fn make_mock_gba(rom: &[u8]) -> GameBoyAdvance {
|
||||||
let bios = vec![0; 0x4000];
|
let bios = vec![0; 0x4000].into_boxed_slice();
|
||||||
let cartridge = GamepakBuilder::new()
|
let cartridge = GamepakBuilder::new()
|
||||||
.buffer(rom)
|
.buffer(rom)
|
||||||
.with_sram()
|
.with_sram()
|
||||||
|
|
|
@ -123,11 +123,11 @@ pub struct SysBus {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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 {
|
SysBus {
|
||||||
io: io,
|
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()),
|
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()),
|
internal_work_ram: BoxedMemory::new(vec![0; INTERNAL_RAM_SIZE].into_boxed_slice()),
|
||||||
cartridge: cartridge,
|
cartridge: cartridge,
|
||||||
|
|
Reference in a new issue