1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#[cfg(not(target_arch = "wasm32"))]
mod disk;

#[cfg(target_arch = "wasm32")]
mod wasm;

#[cfg(not(target_arch = "wasm32"))]
pub use disk::DiskLoadable;

#[cfg(target_arch = "wasm32")]
pub use wasm::JsValueLoadable;

/// Represents a predefined, immutable ROM file.
/// Useful for storing character, BASIC, kernal, etc. ROMs.
#[derive(Clone, Debug)]
pub struct RomFile {
  data: Vec<u8>,
}

impl RomFile {
  /// Creates a new ROM file from the given data.
  pub fn new(data: Vec<u8>) -> Self {
    Self { data }
  }

  /// Returns the contents of the ROM file.
  pub fn get_data(self) -> Vec<u8> {
    self.data
  }
}