Ejemplo n.º 1
0
        public static void Main()
        {
            var ppu = new PPU(File.ReadAllBytes(memoryDumpPath));

            Console.WriteLine(ppu.Registers.LCDControl + Environment.NewLine);

            var tilesetPixels = ppu.RenderTileSet();
            var bgMapPixels   = ppu.RenderBackgroundMap();
            var windowPixels  = ppu.RenderWindow();
            var spritePixels  = ppu.RenderSprites();
            var screenPixels  = ppu.ForceRenderScreen();

            WritePixelDataFiles(tilesetPixels, bgMapPixels, windowPixels, spritePixels, screenPixels);
        }
Ejemplo n.º 2
0
        public void Generate_Expected_Tileset_Pixels_From_Known_VRAM_Dump()
        {
            var vram   = Memory.FromFile(Path.Combine("PPU", "Input", "tetris.tileset.dump"));
            var regs   = new PPURegisters();
            var memBus = new MemoryBus(regs)
            {
                VideoMemory = vram
            };
            var ppu = new PPU(regs, memBus);

            ppu.TileSet.UpdateFrom(vram);

            var actualPixels   = ppu.RenderTileSet();
            var expectedPixels = ImageHelper.LoadImageAsPaletteIndexedByteArray(Path.Combine("PPU", "Expected", "tetris.tileset.png"));

            AssertPixelsMatch(expectedPixels, actualPixels, width: TileSet.WidthInPixels);
        }