//! Every tile character (128) in every colour code (64), as the cabinet shows //! it: rendered by the board's video code into screen-oriented 8x8 RGB blocks, //! for tools/mosaic.py. Writes target/glyphs.bin: 64 x 128 x 8 x 8 x 3 bytes. //! Usage: galaga-glyphs (reads rom/galaga) use emu_galaga::galaga::bus::Shared; use emu_galaga::galaga::roms::load_directory; use emu_galaga::galaga::video::Video; fn main() { let roms = load_directory(std::path::Path::new("rom/galaga")).unwrap(); let mut v = Video::new(&roms); let mut out = Vec::with_capacity(64 * 128 * 192); let mut buf = vec![0u8; 224 * 288 * 4]; for colour in 0..64u8 { // One render per colour: 128 codes laid out in screen cells (col, row) = (n % 16, 2 + n / 16). let mut s = Shared::new(); s.videolatch = 0x00; for n in 0..128usize { let (col, row) = (n % 16, 2 + n / 16); let index = (row - 2) + 32 * (27 - col + 2); s.video_ram[index] = n as u8; s.video_ram[0x400 + index] = colour; } v.render(&s, 0); v.screen_rgba(&mut buf); for n in 0..128usize { let (col, row) = (n % 16, 2 + n / 16); for y in 0..8 { for x in 0..8 { let o = ((row * 8 + y) * 224 + col * 8 + x) * 4; out.extend_from_slice(&buf[o..o + 3]); } } } } std::fs::write("target/glyphs.bin", out).unwrap(); }