unify versions and bootrom options, update deps
This commit is contained in:
parent
e738419d4d
commit
bbe18ec20a
9 changed files with 41 additions and 73 deletions
35
Cargo.lock
generated
35
Cargo.lock
generated
|
@ -70,9 +70,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstream"
|
name = "anstream"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9e579a7752471abc2a8268df8b20005e3eadd975f585398f17efcfd8d4927371"
|
checksum = "6342bd4f5a1205d7f41e94a41a901f5647c938cdfa96036338e8533c9d6c2450"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"anstyle-parse",
|
"anstyle-parse",
|
||||||
|
@ -109,9 +109,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle-wincon"
|
name = "anstyle-wincon"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4bcd8291a340dd8ac70e18878bc4501dd7b4ff970cfa21c207d36ece51ea88fd"
|
checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.48.0",
|
||||||
|
@ -162,9 +162,9 @@ checksum = "62af46d040ba9df09edc6528dae9d8e49f5f3e82f55b7d2ec31a733c38dbc49d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "atomic_refcell"
|
name = "atomic_refcell"
|
||||||
version = "0.1.9"
|
version = "0.1.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "857253367827bd9d0fd973f0ef15506a96e79e41b0ad7aa691203a4e3214f6c8"
|
checksum = "79d6dc922a2792b006573f60b2648076355daeae5ce9cb59507e5908c9625d31"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "atty"
|
name = "atty"
|
||||||
|
@ -382,8 +382,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap-sys"
|
name = "clap-sys"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/robbert-vdh/clap-sys.git?branch=feature/cstr-macro#523a5f8a8dd021ec99e7d6e0c0ebe7741a3da9d4"
|
||||||
checksum = "27f4e06657d33d5d194db1155cef359c359483a4170362bf4e105146dd0109e3"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
|
@ -971,7 +970,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gb-emu"
|
name = "gb-emu"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"cpal",
|
"cpal",
|
||||||
|
@ -1014,9 +1013,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gilrs"
|
name = "gilrs"
|
||||||
version = "0.10.1"
|
version = "0.10.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7d0342acdc7b591d171212e17c9350ca02383b86d5f9af33c6e3598e03a6c57e"
|
checksum = "62fd19844d0eb919aca41d3e4ea0e0b6bf60e1e827558b101c269015b8f5f27a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fnv",
|
"fnv",
|
||||||
"gilrs-core",
|
"gilrs-core",
|
||||||
|
@ -1027,9 +1026,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gilrs-core"
|
name = "gilrs-core"
|
||||||
version = "0.5.4"
|
version = "0.5.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "373b55d596e5a84fff61c559de54351a69f9ff481593ac78c35d9dc625df8d8f"
|
checksum = "fd745b0cb1a207756e8fabacf5623066ad6aa543ea0be4bab34e897e6bbe24f9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"core-foundation",
|
"core-foundation",
|
||||||
"io-kit-sys",
|
"io-kit-sys",
|
||||||
|
@ -1661,9 +1660,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nih_log"
|
name = "nih_log"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f1d8a01d9663de15dbec9eaa9b7c261588e615ec204797b63039a2b0f30680fd"
|
checksum = "d0cdb52ef79af48ae110401c883bdb9c15e0306a99ab6ecf18bc52068b668e54"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atty",
|
"atty",
|
||||||
"log",
|
"log",
|
||||||
|
@ -2281,9 +2280,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustix"
|
||||||
version = "0.37.14"
|
version = "0.37.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d9b864d3c18a5785a05953adeed93e2dca37ed30f18e69bba9f30079d51f363f"
|
checksum = "a0661814f891c57c930a610266415528da53c4933e6dea5fb350cbfe048a9ece"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"errno",
|
"errno",
|
||||||
|
@ -2738,7 +2737,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vst"
|
name = "vst"
|
||||||
version = "0.1.0"
|
version = "0.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-ringbuf",
|
"async-ringbuf",
|
||||||
"baseview",
|
"baseview",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "gb-emu"
|
name = "gb-emu"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
|
@ -55,16 +55,16 @@ struct Args {
|
||||||
mute: bool,
|
mute: bool,
|
||||||
|
|
||||||
/// Run debug console
|
/// Run debug console
|
||||||
#[arg(short, long)]
|
#[arg(long)]
|
||||||
debug: bool,
|
debug: bool,
|
||||||
|
|
||||||
/// Force CGB mode
|
/// Prefer DMG mode
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
cgb: bool,
|
dmg: bool,
|
||||||
|
|
||||||
/// Skip BootROM
|
/// Show BootROM
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
skip: bool,
|
show_bootrom: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -110,10 +110,10 @@ fn main() {
|
||||||
} else {
|
} else {
|
||||||
SerialTarget::None
|
SerialTarget::None
|
||||||
})
|
})
|
||||||
.with_bootrom(args.bootrom.map(RomFile::Path), args.skip)
|
.with_bootrom(args.bootrom.map(RomFile::Path), args.show_bootrom)
|
||||||
.with_no_save(args.no_save)
|
.with_no_save(args.no_save)
|
||||||
.with_tile_window(tile_window)
|
.with_tile_window(tile_window)
|
||||||
.with_cgb_mode(args.cgb);
|
.with_cgb_mode(!args.dmg);
|
||||||
|
|
||||||
let mut core = EmulatorCore::init(receiver, options);
|
let mut core = EmulatorCore::init(receiver, options);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "vst"
|
name = "vst"
|
||||||
version = "0.1.0"
|
version = "0.3.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -71,7 +71,6 @@ const FRAMES_TO_BUFFER: usize = 1;
|
||||||
const DOWNSAMPLE_TYPE: DownsampleType = DownsampleType::ZeroOrderHold;
|
const DOWNSAMPLE_TYPE: DownsampleType = DownsampleType::ZeroOrderHold;
|
||||||
|
|
||||||
const ROM: &[u8; 65536] = include_bytes!("../../test-roms/mGB.gb");
|
const ROM: &[u8; 65536] = include_bytes!("../../test-roms/mGB.gb");
|
||||||
const BOOTROM: Option<&[u8; 2304]> = Some(include_bytes!("../../sameboy-bootroms/cgb_boot.bin"));
|
|
||||||
|
|
||||||
impl Plugin for GameboyEmu {
|
impl Plugin for GameboyEmu {
|
||||||
const NAME: &'static str = "Gameboy";
|
const NAME: &'static str = "Gameboy";
|
||||||
|
@ -203,7 +202,7 @@ impl Plugin for GameboyEmu {
|
||||||
ProcessStatus::KeepAlive
|
ProcessStatus::KeepAlive
|
||||||
}
|
}
|
||||||
|
|
||||||
fn editor(&self, _: AsyncExecutor<Self>) -> Option<Box<dyn Editor>> {
|
fn editor(&mut self, _: AsyncExecutor<Self>) -> Option<Box<dyn Editor>> {
|
||||||
Some(Box::new(Emulator::new(
|
Some(Box::new(Emulator::new(
|
||||||
self.frame_receiver.clone(),
|
self.frame_receiver.clone(),
|
||||||
self.key_handler.clone(),
|
self.key_handler.clone(),
|
||||||
|
@ -227,7 +226,6 @@ impl Plugin for GameboyEmu {
|
||||||
vars.emulator_core.replace_output(output);
|
vars.emulator_core.replace_output(output);
|
||||||
vars.rx = rx;
|
vars.rx = rx;
|
||||||
} else {
|
} else {
|
||||||
let bootrom = BOOTROM.map(|v| RomFile::Raw(v.to_vec()));
|
|
||||||
let rom = RomFile::Raw(ROM.to_vec());
|
let rom = RomFile::Raw(ROM.to_vec());
|
||||||
|
|
||||||
let (sender, receiver) = channel::<EmulatorMessage>();
|
let (sender, receiver) = channel::<EmulatorMessage>();
|
||||||
|
@ -257,7 +255,6 @@ impl Plugin for GameboyEmu {
|
||||||
EmulatorCore::from_save_state(state, rom, receiver, window, output, serial_target)
|
EmulatorCore::from_save_state(state, rom, receiver, window, output, serial_target)
|
||||||
} else {
|
} else {
|
||||||
let options = gb_emu_lib::Options::new(window, rom, output)
|
let options = gb_emu_lib::Options::new(window, rom, output)
|
||||||
.with_bootrom(bootrom)
|
|
||||||
.with_serial_target(serial_target)
|
.with_serial_target(serial_target)
|
||||||
.force_no_save();
|
.force_no_save();
|
||||||
|
|
||||||
|
@ -266,7 +263,6 @@ impl Plugin for GameboyEmu {
|
||||||
#[cfg(not(feature = "savestate"))]
|
#[cfg(not(feature = "savestate"))]
|
||||||
let mut emulator_core = {
|
let mut emulator_core = {
|
||||||
let options = EmulatorOptions::new(window, rom, output)
|
let options = EmulatorOptions::new(window, rom, output)
|
||||||
.with_bootrom(bootrom, true)
|
|
||||||
.with_serial_target(serial_target)
|
.with_serial_target(serial_target)
|
||||||
.force_no_save();
|
.force_no_save();
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ where
|
||||||
pub(crate) camera: C,
|
pub(crate) camera: C,
|
||||||
pub(crate) no_save: bool,
|
pub(crate) no_save: bool,
|
||||||
pub(crate) bootrom: Option<RomFile>,
|
pub(crate) bootrom: Option<RomFile>,
|
||||||
pub(crate) skip_bootrom: bool,
|
pub(crate) show_bootrom: bool,
|
||||||
pub(crate) serial_target: SerialTarget,
|
pub(crate) serial_target: SerialTarget,
|
||||||
pub(crate) cgb_mode: bool,
|
pub(crate) cgb_mode: bool,
|
||||||
spooky: PhantomData<ColourFormat>,
|
spooky: PhantomData<ColourFormat>,
|
||||||
|
@ -181,20 +181,7 @@ where
|
||||||
R: Renderer<ColourFormat>,
|
R: Renderer<ColourFormat>,
|
||||||
{
|
{
|
||||||
pub fn new(window: R, rom: RomFile, output: AudioOutput) -> Self {
|
pub fn new(window: R, rom: RomFile, output: AudioOutput) -> Self {
|
||||||
Self {
|
Self::new_with_camera(window, rom, output, NoCamera::default())
|
||||||
window,
|
|
||||||
tile_window: None,
|
|
||||||
rom,
|
|
||||||
output,
|
|
||||||
save_path: None,
|
|
||||||
camera: NoCamera::default(),
|
|
||||||
no_save: false,
|
|
||||||
bootrom: None,
|
|
||||||
skip_bootrom: false,
|
|
||||||
serial_target: SerialTarget::None,
|
|
||||||
cgb_mode: false,
|
|
||||||
spooky: PhantomData,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,9 +201,9 @@ where
|
||||||
camera,
|
camera,
|
||||||
no_save: false,
|
no_save: false,
|
||||||
bootrom: None,
|
bootrom: None,
|
||||||
skip_bootrom: false,
|
show_bootrom: false,
|
||||||
serial_target: SerialTarget::None,
|
serial_target: SerialTarget::None,
|
||||||
cgb_mode: false,
|
cgb_mode: true,
|
||||||
spooky: PhantomData,
|
spooky: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,9 +223,9 @@ where
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_bootrom(mut self, bootrom: Option<RomFile>, skip_bootrom: bool) -> Self {
|
pub fn with_bootrom(mut self, bootrom: Option<RomFile>, show_bootrom: bool) -> Self {
|
||||||
self.bootrom = bootrom;
|
self.bootrom = bootrom;
|
||||||
self.skip_bootrom = skip_bootrom;
|
self.show_bootrom = show_bootrom;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ use connect::{
|
||||||
};
|
};
|
||||||
use processor::{
|
use processor::{
|
||||||
memory::{mmio::gpu::Colour, rom::CgbRomType, OutputTargets, Rom},
|
memory::{mmio::gpu::Colour, rom::CgbRomType, OutputTargets, Rom},
|
||||||
Cpu, CpuSaveState, RunBootrom,
|
Cpu, CpuSaveState,
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
fs::{self},
|
fs::{self},
|
||||||
|
@ -76,7 +76,7 @@ where
|
||||||
RomFile::Raw(data) => Rom::load(data, None, camera.clone()),
|
RomFile::Raw(data) => Rom::load(data, None, camera.clone()),
|
||||||
};
|
};
|
||||||
|
|
||||||
let (bootrom_enabled, bootrom, cgb) = if let Some(b) = options.bootrom {
|
let (bootrom, cgb) = if let Some(b) = options.bootrom {
|
||||||
let bootrom = match b {
|
let bootrom = match b {
|
||||||
RomFile::Path(path) => match fs::read(path) {
|
RomFile::Path(path) => match fs::read(path) {
|
||||||
Ok(data) => data,
|
Ok(data) => data,
|
||||||
|
@ -89,15 +89,7 @@ where
|
||||||
};
|
};
|
||||||
let cgb =
|
let cgb =
|
||||||
rom.rom_type == CgbRomType::CgbOnly || options.cgb_mode || bootrom.len() > 256;
|
rom.rom_type == CgbRomType::CgbOnly || options.cgb_mode || bootrom.len() > 256;
|
||||||
(
|
(bootrom, cgb)
|
||||||
if options.skip_bootrom {
|
|
||||||
RunBootrom::Skip
|
|
||||||
} else {
|
|
||||||
RunBootrom::Yes
|
|
||||||
},
|
|
||||||
bootrom,
|
|
||||||
cgb,
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
let cgb = rom.rom_type == CgbRomType::CgbOnly || options.cgb_mode;
|
let cgb = rom.rom_type == CgbRomType::CgbOnly || options.cgb_mode;
|
||||||
let bootrom = if cgb {
|
let bootrom = if cgb {
|
||||||
|
@ -105,7 +97,7 @@ where
|
||||||
} else {
|
} else {
|
||||||
include_bytes!("../../sameboy-bootroms/dmg_boot.bin").to_vec()
|
include_bytes!("../../sameboy-bootroms/dmg_boot.bin").to_vec()
|
||||||
};
|
};
|
||||||
(RunBootrom::Skip, bootrom, cgb)
|
(bootrom, cgb)
|
||||||
};
|
};
|
||||||
|
|
||||||
options.window.prepare(WIDTH, HEIGHT);
|
options.window.prepare(WIDTH, HEIGHT);
|
||||||
|
@ -131,7 +123,7 @@ where
|
||||||
camera,
|
camera,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
bootrom_enabled,
|
options.show_bootrom,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,6 @@ pub(crate) enum Direction {
|
||||||
Right,
|
Right,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
|
||||||
pub(crate) enum RunBootrom {
|
|
||||||
Yes,
|
|
||||||
Skip,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Cpu<ColourFormat, R, C>
|
pub struct Cpu<ColourFormat, R, C>
|
||||||
where
|
where
|
||||||
ColourFormat: From<Colour> + Clone,
|
ColourFormat: From<Colour> + Clone,
|
||||||
|
@ -81,7 +75,7 @@ where
|
||||||
R: Renderer<ColourFormat>,
|
R: Renderer<ColourFormat>,
|
||||||
C: PocketCamera + Send + 'static,
|
C: PocketCamera + Send + 'static,
|
||||||
{
|
{
|
||||||
pub(crate) fn new(memory: Memory<ColourFormat, R, C>, run_bootrom: RunBootrom) -> Self {
|
pub(crate) fn new(memory: Memory<ColourFormat, R, C>, run_bootrom: bool) -> Self {
|
||||||
Self {
|
Self {
|
||||||
memory,
|
memory,
|
||||||
reg: Registers::init(),
|
reg: Registers::init(),
|
||||||
|
@ -90,7 +84,7 @@ where
|
||||||
halted: false,
|
halted: false,
|
||||||
should_halt_bug: false,
|
should_halt_bug: false,
|
||||||
cycle_count: 0,
|
cycle_count: 0,
|
||||||
is_skipping: run_bootrom == RunBootrom::Skip,
|
is_skipping: !run_bootrom,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit e6546c1aad139028253ddd4fb586f19463f5c881
|
Subproject commit 33c266b496ec6a1cd87ef9fcc1ca541b5d34eb6e
|
Loading…
Add table
Reference in a new issue