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

chore: more secure options

parent ac7e98cd
No related branches found
No related tags found
1 merge request!16Support for Game Boy Color (CGB) 😎🖍️
Pipeline #2573 failed
......@@ -32,9 +32,9 @@ cargo run --features debug
## Features
| Provider | Description |
| -------- | ------------------------------------------------------------------------------------------------- |
| `debug` | Activates the base `debug` feature from Boytacean. |
| `secure` | Additional safety instructions are executed to make sure the machine does no run "out of tracks". |
| `slow` | Runs the emulator at a very slow page 60x slower to allow visual debugging. |
| `cpulog` | Prints a log of the CPU instruction executed. |
| Provider | Description |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `debug` | Activates the base `debug` feature from Boytacean. |
| `secure` | Additional safety instructions are executed to make sure the machine does no run "out of tracks", making sure to run many `panic()` calls. |
| `slow` | Runs the emulator at a very slow page 60x slower to allow visual debugging. |
| `cpulog` | Prints a log of the CPU instruction executed. |
......@@ -601,6 +601,8 @@ pub static MBC1: Mbc = Mbc {
},
write_ram: |rom: &mut Cartridge, addr: u16, value: u8| {
if !rom.ram_enabled {
#[cfg(feature = "secure")]
panic!("Attempt to write to ERAM while write protect is active");
debugln!("Attempt to write to ERAM while write protect is active");
return;
}
......@@ -657,6 +659,8 @@ pub static MBC3: Mbc = Mbc {
},
write_ram: |rom: &mut Cartridge, addr: u16, value: u8| {
if !rom.ram_enabled {
#[cfg(feature = "secure")]
panic!("Attempt to write to ERAM while write protect is active");
debugln!("Attempt to write to ERAM while write protect is active");
return;
}
......@@ -709,6 +713,8 @@ pub static MBC5: Mbc = Mbc {
},
write_ram: |rom: &mut Cartridge, addr: u16, value: u8| {
if !rom.ram_enabled {
#[cfg(feature = "secure")]
panic!("Attempt to write to ERAM while write protect is active");
debugln!("Attempt to write to ERAM while write protect is active");
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment