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

chore: new WASM code fix

parent 771d1cb4
No related branches found
No related tags found
1 merge request!25Game Genie support
Pipeline #2876 passed
...@@ -3,7 +3,11 @@ use std::{ ...@@ -3,7 +3,11 @@ use std::{
fmt::{self, Display, Formatter}, fmt::{self, Display, Formatter},
}; };
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;
#[derive(Clone)] #[derive(Clone)]
#[cfg_attr(feature = "wasm", wasm_bindgen)]
pub struct GameGenie { pub struct GameGenie {
/// Hash map that contains the complete set of Game Genie /// Hash map that contains the complete set of Game Genie
/// codes that have been registered for the current ROM. /// codes that have been registered for the current ROM.
......
...@@ -564,6 +564,16 @@ impl Cartridge { ...@@ -564,6 +564,16 @@ impl Cartridge {
self.ram_data = ram_data; self.ram_data = ram_data;
} }
pub fn attach_genie(&mut self, game_genie: GameGenie) {
self.game_genie = Some(game_genie);
self.handler = &GAME_GENIE;
}
pub fn detach_genie(&mut self) {
self.game_genie = None;
self.handler = self.mbc;
}
pub fn description(&self, column_length: usize) -> String { pub fn description(&self, column_length: usize) -> String {
let name_l = format!("{:width$}", "Name", width = column_length); let name_l = format!("{:width$}", "Name", width = column_length);
let type_l = format!("{:width$}", "Type", width = column_length); let type_l = format!("{:width$}", "Type", width = column_length);
...@@ -586,18 +596,6 @@ impl Cartridge { ...@@ -586,18 +596,6 @@ impl Cartridge {
} }
} }
impl Cartridge {
pub fn attach_genie(&mut self, game_genie: GameGenie) {
self.game_genie = Some(game_genie);
self.handler = &GAME_GENIE;
}
pub fn detach_genie(&mut self) {
self.game_genie = None;
self.handler = self.mbc;
}
}
impl Default for Cartridge { impl Default for Cartridge {
fn default() -> Self { fn default() -> Self {
Self::new() Self::new()
......
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