Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cfec6e51bf | ||
|
|
88721236e7 | ||
|
|
9824e8f475 |
Generated
+1
-1
@@ -2029,7 +2029,7 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lemur"
|
name = "lemur"
|
||||||
version = "0.13.0"
|
version = "0.13.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"atoi",
|
"atoi",
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ description = "An emulator for the Virtual Boy."
|
|||||||
repository = "https://git.virtual-boy.com/PVB/lemur"
|
repository = "https://git.virtual-boy.com/PVB/lemur"
|
||||||
publish = false
|
publish = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
version = "0.13.0"
|
version = "0.13.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
+2
-1
@@ -265,7 +265,8 @@ impl Emulator {
|
|||||||
} else if let Some(cart) = self.carts[index].as_mut()
|
} else if let Some(cart) = self.carts[index].as_mut()
|
||||||
&& cart.is_watching()
|
&& cart.is_watching()
|
||||||
{
|
{
|
||||||
cart.restart_watching();
|
cart.reload()?;
|
||||||
|
sim.load_cart(cart.rom.clone(), cart.sram.clone())?;
|
||||||
}
|
}
|
||||||
let mut profiling = false;
|
let mut profiling = false;
|
||||||
if let Some(profiler) = self.profilers[sim_id.to_index()].as_ref()
|
if let Some(profiler) = self.profilers[sim_id.to_index()].as_ref()
|
||||||
|
|||||||
+19
-4
@@ -22,10 +22,7 @@ pub struct Cart {
|
|||||||
|
|
||||||
impl Cart {
|
impl Cart {
|
||||||
pub fn load(file_path: &Path, sim_id: SimId, watch: bool) -> Result<Self> {
|
pub fn load(file_path: &Path, sim_id: SimId, watch: bool) -> Result<Self> {
|
||||||
let rom = fs::read(file_path)?;
|
let (rom, info) = Self::read_rom(file_path)?;
|
||||||
let (rom, info) = try_parse_isx(file_path, &rom)
|
|
||||||
.or_else(|| try_parse_elf(file_path, &rom))
|
|
||||||
.unwrap_or_else(|| (rom, GameInfo::empty(file_path)));
|
|
||||||
|
|
||||||
let mut sram_file = File::options()
|
let mut sram_file = File::options()
|
||||||
.read(true)
|
.read(true)
|
||||||
@@ -66,6 +63,16 @@ impl Cart {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn reload(&mut self) -> Result<()> {
|
||||||
|
let (rom, info) = Self::read_rom(&self.file_path)?;
|
||||||
|
self.rom = rom;
|
||||||
|
self.info = Arc::new(info);
|
||||||
|
if self.is_watching() {
|
||||||
|
self.restart_watching();
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn save_sram(&mut self) -> Result<()> {
|
pub fn save_sram(&mut self) -> Result<()> {
|
||||||
self.sram_file.seek(SeekFrom::Start(0))?;
|
self.sram_file.seek(SeekFrom::Start(0))?;
|
||||||
self.sram_file.write_all(&self.sram)?;
|
self.sram_file.write_all(&self.sram)?;
|
||||||
@@ -92,6 +99,14 @@ impl Cart {
|
|||||||
self.changed = Arc::new(AtomicBool::new(false));
|
self.changed = Arc::new(AtomicBool::new(false));
|
||||||
self.watcher = None;
|
self.watcher = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn read_rom(file_path: &Path) -> Result<(Vec<u8>, GameInfo)> {
|
||||||
|
let rom = fs::read(file_path)?;
|
||||||
|
let (rom, info) = try_parse_isx(file_path, &rom)
|
||||||
|
.or_else(|| try_parse_elf(file_path, &rom))
|
||||||
|
.unwrap_or_else(|| (rom, GameInfo::empty(file_path)));
|
||||||
|
Ok((rom, info))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_watcher(file_path: &Path, changed: Arc<AtomicBool>) -> Option<notify::RecommendedWatcher> {
|
fn build_watcher(file_path: &Path, changed: Arc<AtomicBool>) -> Option<notify::RecommendedWatcher> {
|
||||||
|
|||||||
@@ -180,6 +180,9 @@ impl GameWindow {
|
|||||||
let mut viewport = child.initial_viewport();
|
let mut viewport = child.initial_viewport();
|
||||||
let title = viewport.title.clone().unwrap();
|
let title = viewport.title.clone().unwrap();
|
||||||
let sim_id = child.sim_id();
|
let sim_id = child.sim_id();
|
||||||
|
if let Some(sim_id) = sim_id && self.show_player_name {
|
||||||
|
viewport.title = Some(format!("{title} ({sim_id})"));
|
||||||
|
}
|
||||||
if let Some(state) = self.child_states.get(&viewport_id) {
|
if let Some(state) = self.child_states.get(&viewport_id) {
|
||||||
viewport.position = Some(state.position);
|
viewport.position = Some(state.position);
|
||||||
viewport.inner_size = Some(state.size);
|
viewport.inner_size = Some(state.size);
|
||||||
|
|||||||
Reference in New Issue
Block a user