1use js_sys::{Promise, Uint8Array}; 2use wasm_bindgen::prelude::*; 3 4#[wasm_bindgen] 5extern "C" { 6 pub fn alert(message: &str); 7} 8 9#[wasm_bindgen(module = "/js/ui.js")] 10extern "C" { 11 pub fn showUi(); 12 13 pub fn setFullscreen(fullscreen: bool); 14 15 pub fn focusCanvas(); 16 17 pub fn showSmsGgConfig(input_names: Vec<String>, input_keys: Vec<String>); 18 19 pub fn showGenesisConfig(input_names: Vec<String>, input_keys: Vec<String>); 20 21 pub fn showSnesConfig(input_names: Vec<String>, input_keys: Vec<String>); 22 23 pub fn showGbaConfig(input_names: Vec<String>, input_keys: Vec<String>); 24 25 pub fn setCursorVisible(visible: bool); 26 27 pub fn setRomTitle(rom_title: &str); 28 29 pub fn setSaveUiEnabled(save_ui_enabled: bool); 30 31 pub fn beforeInputConfigure(); 32 33 pub fn afterInputConfigure(name: &str, key: &str); 34 35 pub fn showWebGpuUnsupportedMessage(); 36 37 pub fn localStorageGet(key: &str) -> Option<String>; 38 39 pub fn localStorageSet(key: &str, value: &str); 40} 41 42#[wasm_bindgen(module = "/js/idb.js")] 43extern "C" { 44 // Promise<Object<String, Uint8Array>> 45 pub fn loadSaveFiles(key: &str) -> Promise; 46 47 // Promise<()> 48 pub fn writeSaveFile(key: &str, extension: &str, bytes: Uint8Array) -> Promise; 49 50 // Promise<Uint8Array | null> 51 pub fn loadBios(key: &str) -> Promise; 52 53 // Promise<()> 54 pub fn writeBios(key: &str, bytes: Uint8Array) -> Promise; 55}