-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
852667d
commit d2d9a47
Showing
3 changed files
with
7 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
use std::cell::RefCell; | ||
use std::rc::Rc; | ||
|
||
use super::cartridge::{get_cartridge_type, EmptyCartridge}; | ||
use super::mbc_none::NoMbcCartridge; | ||
use super::Cartridge; | ||
|
||
pub fn create_mbc(cartridge_data: &[u8]) -> Option<Rc<RefCell<dyn Cartridge>>> { | ||
pub fn create_mbc(cartridge_data: &[u8]) -> Option<Box<RefCell<dyn Cartridge>>> { | ||
// https://gbdev.io/pandocs/The_Cartridge_Header.html#0147--cartridge-type | ||
match get_cartridge_type(cartridge_data) { | ||
0x00 => Some(Rc::new(RefCell::new(NoMbcCartridge::new(cartridge_data)))), // rom only | ||
0x00 => Some(Box::new(RefCell::new(NoMbcCartridge::new(cartridge_data)))), // rom only | ||
_ => None, | ||
} | ||
} | ||
|
||
pub fn create_empty_mbc() -> Rc<RefCell<dyn Cartridge>> { | ||
Rc::new(RefCell::new(EmptyCartridge::new())) | ||
pub fn create_empty_mbc() -> Box<RefCell<dyn Cartridge>> { | ||
Box::new(RefCell::new(EmptyCartridge::new())) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters