Move the emulator into crates/gba-core, the original demo programs into crates/gba-demos, and the minifb frontend into crates/desktop. The binary is now gameboy-rust. Imports change from gba_rust to gba_core/gba_demos; no behavior changes. gba-core has no dependencies. Its integration tests use gba-demos as a development dependency. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1,023 B
Rust
38 lines
1,023 B
Rust
use gba_core::{
|
|
cpu::Cpu,
|
|
display::{CYCLES_PER_FRAME, CYCLES_PER_LINE, HBLANK_START, VBLANK_START},
|
|
dma::DMA_BASE,
|
|
input::{Button, Buttons},
|
|
io::*,
|
|
machine::{Machine, StepKind},
|
|
memory::{Memory, OAM_START as OAM, PALETTE_START as PAL, ROM_START, VRAM_START as VRAM},
|
|
video::{rgb555_to_rgb888 as rgb, Framebuffer, VideoError, HEIGHT, WIDTH},
|
|
};
|
|
use gba_demos::raster_demo::{RasterDemo, RASTER_STATE, RASTER_TABLE};
|
|
|
|
#[path = "scanlines/capture.rs"]
|
|
mod capture;
|
|
#[path = "scanlines/machine.rs"]
|
|
mod machine;
|
|
#[path = "scanlines/rendering.rs"]
|
|
mod rendering;
|
|
|
|
fn memory() -> Memory {
|
|
let mut m = Memory::new(vec![]).unwrap();
|
|
m.set_scanline_rendering(true);
|
|
m
|
|
}
|
|
|
|
fn present(m: &Memory) -> Framebuffer {
|
|
let mut f = Framebuffer::default();
|
|
assert!(m.present_frame(&mut f).unwrap());
|
|
f
|
|
}
|
|
|
|
fn at(f: &Framebuffer, x: usize, y: usize) -> u32 {
|
|
f.pixels()[y * WIDTH + x]
|
|
}
|
|
|
|
fn word_rom(code: &[u32]) -> Vec<u8> {
|
|
code.iter().flat_map(|v| v.to_le_bytes()).collect()
|
|
}
|