@orkosinha/gb-emu 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/gb_emu.d.ts +425 -0
- package/gb_emu.js +1282 -0
- package/gb_emu_bg.wasm +0 -0
- package/package.json +21 -0
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# gb-emu
|
|
2
|
+
|
|
3
|
+
A cycle accurate Game Boy and Game Boy Color emulator. Targets WebAssembly (via wasm-pack) and native platforms (via C FFI).
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
### WASM
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @orkosinha/gb-emu
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
API: [`src/wasm.rs`](https://github.com/orkosinha/gb-emu/blob/main/src/wasm.rs)
|
|
14
|
+
|
|
15
|
+
### C FFI
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
cargo build --features ios --no-default-features --release
|
|
19
|
+
# outputs: target/release/libgb_emu.a + include/gb_emu.h
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
API: [`include/gb_emu.h`](https://github.com/orkosinha/gb-emu/blob/main/include/gb_emu.h)
|
|
23
|
+
|
|
24
|
+
### Rust
|
|
25
|
+
|
|
26
|
+
```toml
|
|
27
|
+
gb-emu = { git = "https://github.com/orkosinha/gb-emu" }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
API: [`src/core.rs`](https://github.com/orkosinha/gb-emu/blob/main/src/core.rs)
|
|
31
|
+
|
|
32
|
+
## Release
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# add NPM_TOKEN
|
|
36
|
+
mise run setup:secrets # push token to GitHub
|
|
37
|
+
mise run release -- 0.2.0 # tag + push → CI publishes to npm
|
|
38
|
+
```
|
package/gb_emu.d.ts
ADDED
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class GameBoy {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
apu_ch1_dac(): boolean;
|
|
8
|
+
apu_ch1_duty(): number;
|
|
9
|
+
apu_ch1_duty_pos(): number;
|
|
10
|
+
apu_ch1_enabled(): boolean;
|
|
11
|
+
apu_ch1_env_add(): boolean;
|
|
12
|
+
apu_ch1_env_period(): number;
|
|
13
|
+
apu_ch1_freq_hz(): number;
|
|
14
|
+
apu_ch1_freq_reg(): number;
|
|
15
|
+
apu_ch1_len_en(): boolean;
|
|
16
|
+
apu_ch1_length(): number;
|
|
17
|
+
/**
|
|
18
|
+
* MIDI note number for CH1 frequency (255 = unknown/out of range).
|
|
19
|
+
*/
|
|
20
|
+
apu_ch1_midi_note(): number;
|
|
21
|
+
apu_ch1_shadow_freq(): number;
|
|
22
|
+
apu_ch1_sweep_neg(): boolean;
|
|
23
|
+
apu_ch1_sweep_period(): number;
|
|
24
|
+
apu_ch1_sweep_shift(): number;
|
|
25
|
+
apu_ch1_volume(): number;
|
|
26
|
+
apu_ch2_dac(): boolean;
|
|
27
|
+
apu_ch2_duty(): number;
|
|
28
|
+
apu_ch2_duty_pos(): number;
|
|
29
|
+
apu_ch2_enabled(): boolean;
|
|
30
|
+
apu_ch2_env_add(): boolean;
|
|
31
|
+
apu_ch2_env_period(): number;
|
|
32
|
+
apu_ch2_freq_hz(): number;
|
|
33
|
+
apu_ch2_freq_reg(): number;
|
|
34
|
+
apu_ch2_len_en(): boolean;
|
|
35
|
+
apu_ch2_length(): number;
|
|
36
|
+
apu_ch2_midi_note(): number;
|
|
37
|
+
apu_ch2_volume(): number;
|
|
38
|
+
apu_ch3_dac(): boolean;
|
|
39
|
+
apu_ch3_enabled(): boolean;
|
|
40
|
+
apu_ch3_freq_hz(): number;
|
|
41
|
+
apu_ch3_freq_reg(): number;
|
|
42
|
+
apu_ch3_len_en(): boolean;
|
|
43
|
+
apu_ch3_length(): number;
|
|
44
|
+
apu_ch3_midi_note(): number;
|
|
45
|
+
apu_ch3_vol_code(): number;
|
|
46
|
+
apu_ch3_wave_pos(): number;
|
|
47
|
+
/**
|
|
48
|
+
* Raw wave RAM as 16 bytes (32 × 4-bit nibbles).
|
|
49
|
+
*/
|
|
50
|
+
apu_ch3_wave_ram(): Uint8Array;
|
|
51
|
+
apu_ch4_clock_div(): number;
|
|
52
|
+
apu_ch4_clock_shift(): number;
|
|
53
|
+
apu_ch4_dac(): boolean;
|
|
54
|
+
apu_ch4_enabled(): boolean;
|
|
55
|
+
apu_ch4_env_add(): boolean;
|
|
56
|
+
apu_ch4_env_period(): number;
|
|
57
|
+
apu_ch4_freq_hz(): number;
|
|
58
|
+
apu_ch4_len_en(): boolean;
|
|
59
|
+
apu_ch4_length(): number;
|
|
60
|
+
apu_ch4_lfsr(): number;
|
|
61
|
+
apu_ch4_lfsr_short(): boolean;
|
|
62
|
+
apu_ch4_volume(): number;
|
|
63
|
+
/**
|
|
64
|
+
* Current frame sequencer step (0–7). Drives length/sweep/envelope clocks.
|
|
65
|
+
*/
|
|
66
|
+
apu_frame_seq_step(): number;
|
|
67
|
+
apu_nr50(): number;
|
|
68
|
+
apu_nr51(): number;
|
|
69
|
+
apu_nr52(): number;
|
|
70
|
+
apu_powered(): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Clear the sample buffer after the host has consumed it.
|
|
73
|
+
*/
|
|
74
|
+
audio_clear_samples(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Number of f32 values in the sample buffer (pairs of L/R samples).
|
|
77
|
+
*/
|
|
78
|
+
audio_sample_buffer_len(): number;
|
|
79
|
+
/**
|
|
80
|
+
* Pointer to the interleaved stereo f32 sample buffer (L, R, L, R, …).
|
|
81
|
+
* Valid until the next call to `step_frame`.
|
|
82
|
+
*/
|
|
83
|
+
audio_sample_buffer_ptr(): number;
|
|
84
|
+
/**
|
|
85
|
+
* Target sample rate in Hz (44 100).
|
|
86
|
+
*/
|
|
87
|
+
audio_sample_rate(): number;
|
|
88
|
+
/**
|
|
89
|
+
* Derive the contrast level (0-15) from the current dither matrix, or -1 if unknown.
|
|
90
|
+
*/
|
|
91
|
+
camera_contrast(): number;
|
|
92
|
+
/**
|
|
93
|
+
* Length of the camera live view buffer.
|
|
94
|
+
*/
|
|
95
|
+
camera_live_len(): number;
|
|
96
|
+
/**
|
|
97
|
+
* Pointer to the camera live view RGBA buffer (128x112x4 bytes).
|
|
98
|
+
*/
|
|
99
|
+
camera_live_ptr(): number;
|
|
100
|
+
/**
|
|
101
|
+
* Read a camera hardware register (0x00-0x7F, corresponding to A000-A07F).
|
|
102
|
+
*/
|
|
103
|
+
camera_reg(index: number): number;
|
|
104
|
+
/**
|
|
105
|
+
* Clear the serial output buffer.
|
|
106
|
+
*/
|
|
107
|
+
clear_serial_output(): void;
|
|
108
|
+
cpu_a(): number;
|
|
109
|
+
cpu_bc(): number;
|
|
110
|
+
cpu_de(): number;
|
|
111
|
+
cpu_f(): number;
|
|
112
|
+
cpu_halted(): boolean;
|
|
113
|
+
cpu_hl(): number;
|
|
114
|
+
cpu_ime(): boolean;
|
|
115
|
+
cpu_pc(): number;
|
|
116
|
+
cpu_sp(): number;
|
|
117
|
+
/**
|
|
118
|
+
* Decode a GB Camera saved photo slot to RGBA pixel data.
|
|
119
|
+
* Slots 1-30 = saved photos. Returns empty if slot is unoccupied.
|
|
120
|
+
*/
|
|
121
|
+
decode_camera_photo(slot: number): Uint8Array;
|
|
122
|
+
frame_buffer_len(): number;
|
|
123
|
+
frame_buffer_ptr(): number;
|
|
124
|
+
/**
|
|
125
|
+
* Colour of `color` (0–3) in BG `palette` (0–7) as 0xRRGGBB.
|
|
126
|
+
*/
|
|
127
|
+
get_bg_palette_color(palette: number, color: number): number;
|
|
128
|
+
get_cartridge_ram(): Uint8Array;
|
|
129
|
+
/**
|
|
130
|
+
* Get debug info about the emulator state and log to console.
|
|
131
|
+
*/
|
|
132
|
+
get_debug_info(): string;
|
|
133
|
+
/**
|
|
134
|
+
* Get frame count for debugging.
|
|
135
|
+
*/
|
|
136
|
+
get_frame_count(): number;
|
|
137
|
+
/**
|
|
138
|
+
* Get total instruction count for debugging.
|
|
139
|
+
*/
|
|
140
|
+
get_instruction_count(): bigint;
|
|
141
|
+
/**
|
|
142
|
+
* Colour of `color` (0–3) in OBJ `palette` (0–7) as 0xRRGGBB.
|
|
143
|
+
*/
|
|
144
|
+
get_obj_palette_color(palette: number, color: number): number;
|
|
145
|
+
/**
|
|
146
|
+
* Get serial output as a string (for test ROM debugging).
|
|
147
|
+
*/
|
|
148
|
+
get_serial_output(): string;
|
|
149
|
+
/**
|
|
150
|
+
* BCPS: BG palette index register (bit 7 = auto-increment, bits 5–0 = byte address).
|
|
151
|
+
*/
|
|
152
|
+
io_bcps(): number;
|
|
153
|
+
io_bgp(): number;
|
|
154
|
+
io_div(): number;
|
|
155
|
+
/**
|
|
156
|
+
* HDMA5: DMA status — 0xFF = idle; otherwise H-blank DMA active, bits 6–0 = remaining blocks − 1.
|
|
157
|
+
*/
|
|
158
|
+
io_hdma5(): number;
|
|
159
|
+
io_ie(): number;
|
|
160
|
+
io_if(): number;
|
|
161
|
+
io_joypad(): number;
|
|
162
|
+
/**
|
|
163
|
+
* KEY1: speed-switch register (bit 7 = current speed, bit 0 = armed).
|
|
164
|
+
*/
|
|
165
|
+
io_key1(): number;
|
|
166
|
+
io_lcdc(): number;
|
|
167
|
+
io_ly(): number;
|
|
168
|
+
io_lyc(): number;
|
|
169
|
+
io_obp0(): number;
|
|
170
|
+
io_obp1(): number;
|
|
171
|
+
/**
|
|
172
|
+
* OCPS: OBJ palette index register (same layout as BCPS).
|
|
173
|
+
*/
|
|
174
|
+
io_ocps(): number;
|
|
175
|
+
/**
|
|
176
|
+
* OPRI: Object priority mode (bit 0: 0 = CGB coordinate order, 1 = DMG OAM order).
|
|
177
|
+
*/
|
|
178
|
+
io_opri(): number;
|
|
179
|
+
io_scx(): number;
|
|
180
|
+
io_scy(): number;
|
|
181
|
+
io_stat(): number;
|
|
182
|
+
/**
|
|
183
|
+
* SVBK: current WRAM bank (1–7; bank 0 maps to 1).
|
|
184
|
+
*/
|
|
185
|
+
io_svbk(): number;
|
|
186
|
+
io_tac(): number;
|
|
187
|
+
io_tima(): number;
|
|
188
|
+
io_tma(): number;
|
|
189
|
+
/**
|
|
190
|
+
* VBK: current VRAM bank (0 or 1).
|
|
191
|
+
*/
|
|
192
|
+
io_vbk(): number;
|
|
193
|
+
io_wx(): number;
|
|
194
|
+
io_wy(): number;
|
|
195
|
+
/**
|
|
196
|
+
* Check if the loaded ROM is a Game Boy Camera cartridge.
|
|
197
|
+
*/
|
|
198
|
+
is_camera(): boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Check if camera image is ready for capture.
|
|
201
|
+
*/
|
|
202
|
+
is_camera_ready(): boolean;
|
|
203
|
+
is_cgb_mode(): boolean;
|
|
204
|
+
is_mbc7(): boolean;
|
|
205
|
+
load_cartridge_ram(data: Uint8Array): void;
|
|
206
|
+
load_rom(rom_data: Uint8Array, cgb_mode: boolean): void;
|
|
207
|
+
/**
|
|
208
|
+
* Log a message to the browser console.
|
|
209
|
+
*/
|
|
210
|
+
log(msg: string): void;
|
|
211
|
+
/**
|
|
212
|
+
* Log detailed VRAM tile data for debugging.
|
|
213
|
+
*/
|
|
214
|
+
log_vram_info(): void;
|
|
215
|
+
/**
|
|
216
|
+
* Convert a MIDI note number (0–127) to a note name string like "C-4" or "A#3".
|
|
217
|
+
*/
|
|
218
|
+
static midi_to_note_name(note: number): string;
|
|
219
|
+
constructor();
|
|
220
|
+
ppu_cycles(): number;
|
|
221
|
+
ppu_line(): number;
|
|
222
|
+
ppu_mode(): number;
|
|
223
|
+
read_byte(addr: number): number;
|
|
224
|
+
read_range(addr: number, len: number): Uint8Array;
|
|
225
|
+
/**
|
|
226
|
+
* Read bytes from VRAM at address `addr` (0x8000–0x9FFF) from an explicit bank (0 or 1).
|
|
227
|
+
* Does not modify the emulator's VBK register — safe to call at any time.
|
|
228
|
+
*/
|
|
229
|
+
read_vram_bank(bank: number, addr: number, len: number): Uint8Array;
|
|
230
|
+
/**
|
|
231
|
+
* Feed a new tilt reading for MBC7 (Kirby's Tilt 'n' Tumble).
|
|
232
|
+
*
|
|
233
|
+
* `x` and `y` are signed offsets from flat (0 = no tilt).
|
|
234
|
+
* Scale: ±0x1000 ≈ ±1g. The WASM host converts DeviceMotion m/s² to this unit.
|
|
235
|
+
*/
|
|
236
|
+
set_accelerometer(x: number, y: number): void;
|
|
237
|
+
set_button(button: number, pressed: boolean): void;
|
|
238
|
+
/**
|
|
239
|
+
* Set camera image data from webcam.
|
|
240
|
+
* Expects 128x112 pixels as raw 8-bit grayscale (0=black, 255=white).
|
|
241
|
+
*/
|
|
242
|
+
set_camera_image(data: Uint8Array): void;
|
|
243
|
+
step_frame(): void;
|
|
244
|
+
/**
|
|
245
|
+
* Execute a single CPU instruction, return cycles consumed.
|
|
246
|
+
*/
|
|
247
|
+
step_instruction(): number;
|
|
248
|
+
/**
|
|
249
|
+
* Update the camera live view buffer if the capture has changed.
|
|
250
|
+
* Returns true if the buffer was updated.
|
|
251
|
+
*/
|
|
252
|
+
update_camera_live(): boolean;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Initialize panic hook for better error messages in WASM.
|
|
257
|
+
* This is called once when the WASM module is instantiated.
|
|
258
|
+
*/
|
|
259
|
+
export function init_panic_hook(): void;
|
|
260
|
+
|
|
261
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
262
|
+
|
|
263
|
+
export interface InitOutput {
|
|
264
|
+
readonly memory: WebAssembly.Memory;
|
|
265
|
+
readonly __wbg_gameboy_free: (a: number, b: number) => void;
|
|
266
|
+
readonly gameboy_apu_ch1_dac: (a: number) => number;
|
|
267
|
+
readonly gameboy_apu_ch1_duty: (a: number) => number;
|
|
268
|
+
readonly gameboy_apu_ch1_duty_pos: (a: number) => number;
|
|
269
|
+
readonly gameboy_apu_ch1_enabled: (a: number) => number;
|
|
270
|
+
readonly gameboy_apu_ch1_env_add: (a: number) => number;
|
|
271
|
+
readonly gameboy_apu_ch1_env_period: (a: number) => number;
|
|
272
|
+
readonly gameboy_apu_ch1_freq_hz: (a: number) => number;
|
|
273
|
+
readonly gameboy_apu_ch1_freq_reg: (a: number) => number;
|
|
274
|
+
readonly gameboy_apu_ch1_len_en: (a: number) => number;
|
|
275
|
+
readonly gameboy_apu_ch1_length: (a: number) => number;
|
|
276
|
+
readonly gameboy_apu_ch1_midi_note: (a: number) => number;
|
|
277
|
+
readonly gameboy_apu_ch1_shadow_freq: (a: number) => number;
|
|
278
|
+
readonly gameboy_apu_ch1_sweep_neg: (a: number) => number;
|
|
279
|
+
readonly gameboy_apu_ch1_sweep_period: (a: number) => number;
|
|
280
|
+
readonly gameboy_apu_ch1_sweep_shift: (a: number) => number;
|
|
281
|
+
readonly gameboy_apu_ch1_volume: (a: number) => number;
|
|
282
|
+
readonly gameboy_apu_ch2_dac: (a: number) => number;
|
|
283
|
+
readonly gameboy_apu_ch2_duty: (a: number) => number;
|
|
284
|
+
readonly gameboy_apu_ch2_duty_pos: (a: number) => number;
|
|
285
|
+
readonly gameboy_apu_ch2_enabled: (a: number) => number;
|
|
286
|
+
readonly gameboy_apu_ch2_env_add: (a: number) => number;
|
|
287
|
+
readonly gameboy_apu_ch2_env_period: (a: number) => number;
|
|
288
|
+
readonly gameboy_apu_ch2_freq_hz: (a: number) => number;
|
|
289
|
+
readonly gameboy_apu_ch2_freq_reg: (a: number) => number;
|
|
290
|
+
readonly gameboy_apu_ch2_len_en: (a: number) => number;
|
|
291
|
+
readonly gameboy_apu_ch2_length: (a: number) => number;
|
|
292
|
+
readonly gameboy_apu_ch2_midi_note: (a: number) => number;
|
|
293
|
+
readonly gameboy_apu_ch2_volume: (a: number) => number;
|
|
294
|
+
readonly gameboy_apu_ch3_dac: (a: number) => number;
|
|
295
|
+
readonly gameboy_apu_ch3_enabled: (a: number) => number;
|
|
296
|
+
readonly gameboy_apu_ch3_freq_hz: (a: number) => number;
|
|
297
|
+
readonly gameboy_apu_ch3_freq_reg: (a: number) => number;
|
|
298
|
+
readonly gameboy_apu_ch3_len_en: (a: number) => number;
|
|
299
|
+
readonly gameboy_apu_ch3_length: (a: number) => number;
|
|
300
|
+
readonly gameboy_apu_ch3_midi_note: (a: number) => number;
|
|
301
|
+
readonly gameboy_apu_ch3_vol_code: (a: number) => number;
|
|
302
|
+
readonly gameboy_apu_ch3_wave_pos: (a: number) => number;
|
|
303
|
+
readonly gameboy_apu_ch3_wave_ram: (a: number) => [number, number];
|
|
304
|
+
readonly gameboy_apu_ch4_clock_div: (a: number) => number;
|
|
305
|
+
readonly gameboy_apu_ch4_clock_shift: (a: number) => number;
|
|
306
|
+
readonly gameboy_apu_ch4_dac: (a: number) => number;
|
|
307
|
+
readonly gameboy_apu_ch4_enabled: (a: number) => number;
|
|
308
|
+
readonly gameboy_apu_ch4_env_add: (a: number) => number;
|
|
309
|
+
readonly gameboy_apu_ch4_env_period: (a: number) => number;
|
|
310
|
+
readonly gameboy_apu_ch4_freq_hz: (a: number) => number;
|
|
311
|
+
readonly gameboy_apu_ch4_len_en: (a: number) => number;
|
|
312
|
+
readonly gameboy_apu_ch4_length: (a: number) => number;
|
|
313
|
+
readonly gameboy_apu_ch4_lfsr: (a: number) => number;
|
|
314
|
+
readonly gameboy_apu_ch4_lfsr_short: (a: number) => number;
|
|
315
|
+
readonly gameboy_apu_ch4_volume: (a: number) => number;
|
|
316
|
+
readonly gameboy_apu_frame_seq_step: (a: number) => number;
|
|
317
|
+
readonly gameboy_apu_nr50: (a: number) => number;
|
|
318
|
+
readonly gameboy_apu_nr51: (a: number) => number;
|
|
319
|
+
readonly gameboy_apu_nr52: (a: number) => number;
|
|
320
|
+
readonly gameboy_apu_powered: (a: number) => number;
|
|
321
|
+
readonly gameboy_audio_clear_samples: (a: number) => void;
|
|
322
|
+
readonly gameboy_audio_sample_buffer_len: (a: number) => number;
|
|
323
|
+
readonly gameboy_audio_sample_buffer_ptr: (a: number) => number;
|
|
324
|
+
readonly gameboy_audio_sample_rate: (a: number) => number;
|
|
325
|
+
readonly gameboy_camera_contrast: (a: number) => number;
|
|
326
|
+
readonly gameboy_camera_live_len: (a: number) => number;
|
|
327
|
+
readonly gameboy_camera_live_ptr: (a: number) => number;
|
|
328
|
+
readonly gameboy_camera_reg: (a: number, b: number) => number;
|
|
329
|
+
readonly gameboy_clear_serial_output: (a: number) => void;
|
|
330
|
+
readonly gameboy_cpu_a: (a: number) => number;
|
|
331
|
+
readonly gameboy_cpu_bc: (a: number) => number;
|
|
332
|
+
readonly gameboy_cpu_de: (a: number) => number;
|
|
333
|
+
readonly gameboy_cpu_f: (a: number) => number;
|
|
334
|
+
readonly gameboy_cpu_halted: (a: number) => number;
|
|
335
|
+
readonly gameboy_cpu_hl: (a: number) => number;
|
|
336
|
+
readonly gameboy_cpu_ime: (a: number) => number;
|
|
337
|
+
readonly gameboy_cpu_pc: (a: number) => number;
|
|
338
|
+
readonly gameboy_cpu_sp: (a: number) => number;
|
|
339
|
+
readonly gameboy_decode_camera_photo: (a: number, b: number) => [number, number];
|
|
340
|
+
readonly gameboy_frame_buffer_len: (a: number) => number;
|
|
341
|
+
readonly gameboy_frame_buffer_ptr: (a: number) => number;
|
|
342
|
+
readonly gameboy_get_bg_palette_color: (a: number, b: number, c: number) => number;
|
|
343
|
+
readonly gameboy_get_cartridge_ram: (a: number) => [number, number];
|
|
344
|
+
readonly gameboy_get_debug_info: (a: number) => [number, number];
|
|
345
|
+
readonly gameboy_get_frame_count: (a: number) => number;
|
|
346
|
+
readonly gameboy_get_instruction_count: (a: number) => bigint;
|
|
347
|
+
readonly gameboy_get_obj_palette_color: (a: number, b: number, c: number) => number;
|
|
348
|
+
readonly gameboy_get_serial_output: (a: number) => [number, number];
|
|
349
|
+
readonly gameboy_io_bcps: (a: number) => number;
|
|
350
|
+
readonly gameboy_io_bgp: (a: number) => number;
|
|
351
|
+
readonly gameboy_io_div: (a: number) => number;
|
|
352
|
+
readonly gameboy_io_hdma5: (a: number) => number;
|
|
353
|
+
readonly gameboy_io_ie: (a: number) => number;
|
|
354
|
+
readonly gameboy_io_if: (a: number) => number;
|
|
355
|
+
readonly gameboy_io_joypad: (a: number) => number;
|
|
356
|
+
readonly gameboy_io_key1: (a: number) => number;
|
|
357
|
+
readonly gameboy_io_lcdc: (a: number) => number;
|
|
358
|
+
readonly gameboy_io_ly: (a: number) => number;
|
|
359
|
+
readonly gameboy_io_lyc: (a: number) => number;
|
|
360
|
+
readonly gameboy_io_obp0: (a: number) => number;
|
|
361
|
+
readonly gameboy_io_obp1: (a: number) => number;
|
|
362
|
+
readonly gameboy_io_ocps: (a: number) => number;
|
|
363
|
+
readonly gameboy_io_opri: (a: number) => number;
|
|
364
|
+
readonly gameboy_io_scx: (a: number) => number;
|
|
365
|
+
readonly gameboy_io_scy: (a: number) => number;
|
|
366
|
+
readonly gameboy_io_stat: (a: number) => number;
|
|
367
|
+
readonly gameboy_io_svbk: (a: number) => number;
|
|
368
|
+
readonly gameboy_io_tac: (a: number) => number;
|
|
369
|
+
readonly gameboy_io_tima: (a: number) => number;
|
|
370
|
+
readonly gameboy_io_tma: (a: number) => number;
|
|
371
|
+
readonly gameboy_io_vbk: (a: number) => number;
|
|
372
|
+
readonly gameboy_io_wx: (a: number) => number;
|
|
373
|
+
readonly gameboy_io_wy: (a: number) => number;
|
|
374
|
+
readonly gameboy_is_camera: (a: number) => number;
|
|
375
|
+
readonly gameboy_is_camera_ready: (a: number) => number;
|
|
376
|
+
readonly gameboy_is_cgb_mode: (a: number) => number;
|
|
377
|
+
readonly gameboy_is_mbc7: (a: number) => number;
|
|
378
|
+
readonly gameboy_load_cartridge_ram: (a: number, b: number, c: number) => void;
|
|
379
|
+
readonly gameboy_load_rom: (a: number, b: number, c: number, d: number) => [number, number];
|
|
380
|
+
readonly gameboy_log: (a: number, b: number, c: number) => void;
|
|
381
|
+
readonly gameboy_log_vram_info: (a: number) => void;
|
|
382
|
+
readonly gameboy_midi_to_note_name: (a: number) => [number, number];
|
|
383
|
+
readonly gameboy_new: () => number;
|
|
384
|
+
readonly gameboy_ppu_cycles: (a: number) => number;
|
|
385
|
+
readonly gameboy_ppu_line: (a: number) => number;
|
|
386
|
+
readonly gameboy_ppu_mode: (a: number) => number;
|
|
387
|
+
readonly gameboy_read_byte: (a: number, b: number) => number;
|
|
388
|
+
readonly gameboy_read_range: (a: number, b: number, c: number) => [number, number];
|
|
389
|
+
readonly gameboy_read_vram_bank: (a: number, b: number, c: number, d: number) => [number, number];
|
|
390
|
+
readonly gameboy_set_accelerometer: (a: number, b: number, c: number) => void;
|
|
391
|
+
readonly gameboy_set_button: (a: number, b: number, c: number) => void;
|
|
392
|
+
readonly gameboy_set_camera_image: (a: number, b: number, c: number) => void;
|
|
393
|
+
readonly gameboy_step_frame: (a: number) => void;
|
|
394
|
+
readonly gameboy_step_instruction: (a: number) => number;
|
|
395
|
+
readonly gameboy_update_camera_live: (a: number) => number;
|
|
396
|
+
readonly init_panic_hook: () => void;
|
|
397
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
398
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
399
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
400
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
401
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
402
|
+
readonly __wbindgen_start: () => void;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
409
|
+
* a precompiled `WebAssembly.Module`.
|
|
410
|
+
*
|
|
411
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
412
|
+
*
|
|
413
|
+
* @returns {InitOutput}
|
|
414
|
+
*/
|
|
415
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
419
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
420
|
+
*
|
|
421
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
422
|
+
*
|
|
423
|
+
* @returns {Promise<InitOutput>}
|
|
424
|
+
*/
|
|
425
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|