Skip to content
Snippets Groups Projects
Verified Commit 6216e19f authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

chore: sgb flag support

parent 77e1730a
No related branches found
No related tags found
No related merge requests found
Pipeline #4641 passed
......@@ -252,6 +252,12 @@ pub enum CgbMode {
CgbOnly = 0xc0,
}
#[cfg_attr(feature = "wasm", wasm_bindgen)]
pub enum SgbMode {
NoSgb = 0x00,
SgbFunctions = 0x03,
}
impl CgbMode {
pub fn description(&self) -> &'static str {
match self {
......@@ -634,6 +640,13 @@ impl Cartridge {
}
}
pub fn sgb_flag(&self) -> SgbMode {
match self.rom_data[0x0146] {
0x03 => SgbMode::SgbFunctions,
_ => SgbMode::NoSgb,
}
}
pub fn gb_mode(&self) -> GameBoyMode {
match self.cgb_flag() {
CgbMode::CgbCompatible | CgbMode::CgbOnly => GameBoyMode::Cgb,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment