fallback rom for vst... AND IT WORKS EVERYWHERE!! 0.5.0 BABY!!

This commit is contained in:
Alex Janka 2023-10-29 11:18:26 +11:00
parent 7b2090cbad
commit 24697ee7ea
4 changed files with 7 additions and 10 deletions

2
Cargo.lock generated
View file

@ -3433,7 +3433,7 @@ checksum = "49d64318d8311fc2668e48b63969f4343e0a85c4a109aa8460d6672e364b8bd1"
[[package]]
name = "twinc_emu_vst"
version = "0.4.1"
version = "0.5.0"
dependencies = [
"async-ringbuf",
"baseview",

View file

@ -1,6 +1,6 @@
[package]
name = "twinc_emu_vst"
version = "0.4.1"
version = "0.5.0"
edition = "2021"
[lib]

BIN
gb-vst/error.gb Normal file

Binary file not shown.

View file

@ -94,10 +94,6 @@ fn access_config<'a>() -> &'a Configs {
let emu_config = config_manager.load_or_create_base_config();
let vst_config = config_manager.load_or_create_config::<VstConfig>("vst");
if vst_config.rom.is_empty() {
panic!("no rom provided!!");
}
Configs {
vst_config,
emu_config,
@ -298,13 +294,14 @@ impl Plugin for GameboyEmu {
} else {
let configs = access_config();
let rom_path = configs.config_dir.join(configs.vst_config.rom.clone());
if !rom_path.is_file() {
panic!("{rom_path:?} is not a file!");
}
let (rom, camera) = RomFile::Path(rom_path)
.load(gb_emu_lib::connect::SramType::None, NoCamera::default())
.expect("failed to load rom");
.unwrap_or_else(|_v| {
RomFile::Raw(include_bytes!("../error.gb").to_vec())
.load(gb_emu_lib::connect::SramType::None, NoCamera::default())
.expect("Couldn't load built-in fallback rom")
});
let _ =
IS_CGB.set(rom.rom_type == CgbRomType::CgbOnly || configs.emu_config.prefer_cgb);