Skip to content
Snippets Groups Projects
gb.rs 26.7 KiB
Newer Older
  • Learn to ignore specific revisions
  • 
    #[cfg(feature = "wasm")]
    #[wasm_bindgen]
    extern "C" {
        #[wasm_bindgen(js_namespace = window)]
    
    João Magalhães's avatar
    João Magalhães committed
        fn panic(message: &str);
    
        #[wasm_bindgen(js_namespace = window, js_name = loggerCallback)]
        fn logger_callback(data: Vec<u8>);
    
    
        #[wasm_bindgen(js_namespace = window, js_name = printerCallback)]
        fn printer_callback(image_buffer: Vec<u8>);
    
    }
    
    #[cfg(feature = "wasm")]
    pub fn hook_impl(info: &PanicInfo) {
    
    João Magalhães's avatar
    João Magalhães committed
        let message = info.to_string();
        panic(message.as_str());
    
    impl AudioProvider for GameBoy {
    
        fn audio_output(&self) -> u8 {
    
            self.apu_i().output()
    
        fn audio_buffer(&self) -> &VecDeque<u8> {
    
            self.apu_i().audio_buffer()
    
        fn clear_audio_buffer(&mut self) {
    
            self.apu().clear_audio_buffer()
    
    impl Default for GameBoy {
        fn default() -> Self {
    
            Self::new(GameBoyMode::Dmg)
    
    
    impl Display for GameBoy {
        fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
            write!(f, "{}", self.description(9))
        }
    }