simplified cli, made tests run headless again

This commit is contained in:
Matthew Berry 2021-05-13 22:49:21 -07:00
parent 9e2f742d1d
commit a8ed1e7f6b
6 changed files with 30 additions and 166 deletions

View file

@ -74,7 +74,7 @@ unless mealybug_dir == ""
print "\n"
end
system "shards build --release -Dprint_serial > /dev/null"
system "shards build -Dprint_serial > /dev/null"
unless mooneye_dir == ""
test_results << {suite: "Mooneye", results: [] of TestResult}

View file

@ -1,149 +0,0 @@
# Test Results
## Acid Fifo Tests
| Result | Test Name |
|--------|-----------|
| 👌 | cgb-acid2 |
| 👌 | dmg-acid2 |
## Acid Tests
| Result | Test Name |
|--------|-----------|
| 👌 | cgb-acid2 |
| 👌 | dmg-acid2 |
## Mealybug Fifo Tests
| Result | Test Name |
|--------|-----------|
| 👀 | m2_win_en_toggle |
| 👀 | m3_bgp_change |
| 👀 | m3_bgp_change_sprites |
| 👀 | m3_lcdc_bg_en_change |
| 👀 | m3_lcdc_bg_en_change2 |
| 👀 | m3_lcdc_bg_map_change |
| 👀 | m3_lcdc_bg_map_change2 |
| 👀 | m3_lcdc_obj_en_change |
| 👀 | m3_lcdc_obj_en_change_variant |
| 👀 | m3_lcdc_obj_size_change |
| 👀 | m3_lcdc_obj_size_change_scx |
| 👀 | m3_lcdc_tile_sel_change |
| 👀 | m3_lcdc_tile_sel_change2 |
| 👀 | m3_lcdc_tile_sel_win_change |
| 👀 | m3_lcdc_tile_sel_win_change2 |
| 👀 | m3_lcdc_win_en_change_multiple |
| 👀 | m3_lcdc_win_en_change_multiple_wx |
| 👀 | m3_lcdc_win_map_change |
| 👀 | m3_lcdc_win_map_change2 |
| 👀 | m3_obp0_change |
| 👀 | m3_scx_high_5_bits |
| 👀 | m3_scx_high_5_bits_change2 |
| 👌 | m3_scx_low_3_bits |
| 👀 | m3_scy_change |
| 👀 | m3_scy_change2 |
| 👀 | m3_window_timing |
| 👀 | m3_window_timing_wx_0 |
| 👀 | m3_wx_4_change |
| 👀 | m3_wx_4_change_sprites |
| 👀 | m3_wx_5_change |
| 👀 | m3_wx_6_change |
## Mooneye Tests
| Result | Test Name |
|--------|-----------|
| 👌 | acceptance/add_sp_e_timing |
| 👌 | acceptance/bits/mem_oam |
| 👌 | acceptance/bits/reg_f |
| 👀 | acceptance/bits/unused_hwio-GS |
| 👀 | acceptance/boot_div-S |
| 👀 | acceptance/boot_div2-S |
| 👀 | acceptance/boot_hwio-S |
| 👌 | acceptance/call_cc_timing |
| 👌 | acceptance/call_cc_timing2 |
| 👌 | acceptance/call_timing |
| 👌 | acceptance/call_timing2 |
| 👌 | acceptance/di_timing-GS |
| 👌 | acceptance/div_timing |
| 👌 | acceptance/ei_sequence |
| 👌 | acceptance/ei_timing |
| 👌 | acceptance/halt_ime0_ei |
| 👌 | acceptance/halt_ime0_nointr_timing |
| 👌 | acceptance/halt_ime1_timing |
| 👌 | acceptance/halt_ime1_timing2-GS |
| 👌 | acceptance/if_ie_registers |
| 👌 | acceptance/instr/daa |
| 👌 | acceptance/interrupts/ie_push |
| 👌 | acceptance/intr_timing |
| 👌 | acceptance/jp_cc_timing |
| 👌 | acceptance/jp_timing |
| 👌 | acceptance/ld_hl_sp_e_timing |
| 👌 | acceptance/oam_dma/basic |
| 👌 | acceptance/oam_dma/reg_read |
| 👀 | acceptance/oam_dma/sources-GS |
| 👌 | acceptance/oam_dma_restart |
| 👌 | acceptance/oam_dma_start |
| 👌 | acceptance/oam_dma_timing |
| 👌 | acceptance/pop_timing |
| 👀 | acceptance/ppu/hblank_ly_scx_timing-GS |
| 👌 | acceptance/ppu/intr_1_2_timing-GS |
| 👌 | acceptance/ppu/intr_2_0_timing |
| 👀 | acceptance/ppu/intr_2_mode0_timing |
| 👀 | acceptance/ppu/intr_2_mode0_timing_sprites |
| 👀 | acceptance/ppu/intr_2_mode3_timing |
| 👀 | acceptance/ppu/intr_2_oam_ok_timing |
| 👀 | acceptance/ppu/lcdon_timing-GS |
| 👀 | acceptance/ppu/lcdon_write_timing-GS |
| 👌 | acceptance/ppu/stat_irq_blocking |
| 👀 | acceptance/ppu/stat_lyc_onoff |
| 👀 | acceptance/ppu/vblank_stat_intr-GS |
| 👌 | acceptance/push_timing |
| 👌 | acceptance/rapid_di_ei |
| 👌 | acceptance/ret_cc_timing |
| 👌 | acceptance/ret_timing |
| 👌 | acceptance/reti_intr_timing |
| 👌 | acceptance/reti_timing |
| 👌 | acceptance/rst_timing |
| 👌 | acceptance/timer/div_write |
| 👌 | acceptance/timer/rapid_toggle |
| 👌 | acceptance/timer/tim00 |
| 👌 | acceptance/timer/tim00_div_trigger |
| 👌 | acceptance/timer/tim01 |
| 👌 | acceptance/timer/tim01_div_trigger |
| 👌 | acceptance/timer/tim10 |
| 👌 | acceptance/timer/tim10_div_trigger |
| 👌 | acceptance/timer/tim11 |
| 👌 | acceptance/timer/tim11_div_trigger |
| 👌 | acceptance/timer/tima_reload |
| 👌 | acceptance/timer/tima_write_reloading |
| 👌 | acceptance/timer/tma_write_reloading |
| 👌 | emulator-only/mbc1/bits_bank1 |
| 👌 | emulator-only/mbc1/bits_bank2 |
| 👌 | emulator-only/mbc1/bits_mode |
| 👌 | emulator-only/mbc1/bits_ramg |
| 👀 | emulator-only/mbc1/multicart_rom_8Mb |
| 👌 | emulator-only/mbc1/ram_256kb |
| 👌 | emulator-only/mbc1/ram_64kb |
| 👌 | emulator-only/mbc1/rom_16Mb |
| 👌 | emulator-only/mbc1/rom_1Mb |
| 👌 | emulator-only/mbc1/rom_2Mb |
| 👌 | emulator-only/mbc1/rom_4Mb |
| 👌 | emulator-only/mbc1/rom_512kb |
| 👌 | emulator-only/mbc1/rom_8Mb |
| 👌 | emulator-only/mbc2/bits_ramg |
| 👌 | emulator-only/mbc2/bits_romb |
| 👌 | emulator-only/mbc2/bits_unused |
| 👌 | emulator-only/mbc2/ram |
| 👌 | emulator-only/mbc2/rom_1Mb |
| 👌 | emulator-only/mbc2/rom_2Mb |
| 👌 | emulator-only/mbc2/rom_512kb |
| 👌 | emulator-only/mbc5/rom_16Mb |
| 👌 | emulator-only/mbc5/rom_1Mb |
| 👌 | emulator-only/mbc5/rom_2Mb |
| 👌 | emulator-only/mbc5/rom_32Mb |
| 👌 | emulator-only/mbc5/rom_4Mb |
| 👌 | emulator-only/mbc5/rom_512kb |
| 👌 | emulator-only/mbc5/rom_64Mb |
| 👌 | emulator-only/mbc5/rom_8Mb |
| 👌 | misc/bits/unused_hwio-C |
| 👀 | misc/boot_div-A |
| 👀 | misc/boot_div-cgb0 |
| 👌 | misc/boot_div-cgbABCDE |
| 👀 | misc/boot_hwio-C |
| 👀 | misc/boot_regs-A |
| 👌 | misc/boot_regs-cgb |
| 👀 | misc/ppu/vblank_stat_intr-C |

View file

@ -19,8 +19,6 @@ module Crab
rom = nil
bios = nil
fifo = false
pink = false
sync = true
headless = false
OptionParser.parse do |parser|
@ -33,8 +31,6 @@ module Crab
exit
end
parser.on("--fifo", "Enable FIFO rendering") { fifo = true }
parser.on("--pink", "Set the 2-bit DMG color theme to pink") { pink = true }
parser.on("--no-sync", "Disable audio syncing") { sync = false }
parser.on("--headless", "Don't open window or play audio") { headless = true }
parser.unknown_args do |args|
case args.size
@ -49,7 +45,7 @@ module Crab
if rom.not_nil!.ends_with?(".gba")
emu = GBA::GBA.new bios.not_nil!, rom.not_nil!
else
emu = GB::GB.new bios, rom.not_nil!, fifo, sync, headless
emu = GB::GB.new bios, rom.not_nil!, fifo, headless
end
emu.post_init
emu.run

View file

@ -1,6 +1,6 @@
require "lib_gl"
class Display
abstract class Display
enum Console
GB
GBA
@ -27,6 +27,25 @@ class Display
end
end
def self.new(console : Console, headless = false)
if headless
NoOpDisplay.new
else
DisplayImpl.new(console)
end
end
def draw(framebuffer : Slice(UInt16)) : Nil
end
def toggle_blending : Nil
end
end
private class NoOpDisplay < Display
end
private class DisplayImpl < Display
SCALE = 4
SHADERS = "src/crab/common/shaders"
@ -37,7 +56,7 @@ class Display
@blend : Bool = false
def initialize(@console : Console)
def initialize(@console : Display::Console)
@window = SDL::Window.new(window_title(59.7), console.width * SCALE, console.height * SCALE, flags: SDL::Window::Flags::OPENGL)
setup_gl
end
@ -105,7 +124,7 @@ class Display
# todo: proper debug messages for mac
LibGL.enable(LibGL::DEBUG_OUTPUT)
LibGL.enable(LibGL::DEBUG_OUTPUT_SYNCHRONOUS)
LibGL.debug_message_callback(->Display.callback, nil)
LibGL.debug_message_callback(->DisplayImpl.callback, nil)
{% end %}
LibSDL.gl_create_context @window

View file

@ -29,10 +29,10 @@ module GB
@audiospec : LibSDL::AudioSpec
@obtained_spec : LibSDL::AudioSpec
@sync : Bool = true
@sync : Bool
def initialize(@gb : GB, headless : Bool, @sync : Bool)
@sync = false if headless
def initialize(@gb : GB, headless : Bool)
@sync = !headless
@audiospec = LibSDL::AudioSpec.new
@audiospec.freq = SAMPLE_RATE

View file

@ -12,8 +12,6 @@ require "./scanline_ppu"
require "./fifo_ppu"
require "./timer"
DISPLAY_SCALE = {% unless flag? :graphics_test %} 4 {% else %} 1 {% end %}
module GB
class GB < Emu
getter bootrom : String?
@ -30,7 +28,7 @@ module GB
getter! scheduler : Scheduler
getter! timer : Timer
def initialize(@bootrom : String?, rom_path : String, @fifo : Bool, @sync : Bool, @headless : Bool)
def initialize(@bootrom : String?, rom_path : String, @fifo : Bool, @headless : Bool)
@cartridge = Cartridge.new rom_path
@cgb_enabled = !(bootrom.nil? && @cartridge.cgb == Cartridge::CGB::NONE)
@ -42,8 +40,8 @@ module GB
def post_init : Nil
@scheduler = Scheduler.new
@interrupts = Interrupts.new
@apu = APU.new self, @headless, @sync
@display = Display.new Display::Console::GB
@apu = APU.new self, @headless
@display = Display.new Display::Console::GB, @headless
@joypad = Joypad.new self
@ppu = @fifo ? FifoPPU.new self : ScanlinePPU.new self
@timer = Timer.new self