Parse ELF exclusively on emulation thread

This commit is contained in:
2025-08-30 13:02:38 -04:00
parent e5abd48337
commit 04c92c1454
9 changed files with 182 additions and 137 deletions
+18 -19
View File
@@ -22,11 +22,13 @@ use crate::{
graphics::TextureSink,
memory::{MemoryRange, MemoryRegion},
};
pub use game_info::GameInfo;
use shrooms_vb_core::{EXPECTED_FRAME_SIZE, Sim, StopReason};
pub use shrooms_vb_core::{SimEvent, VBKey, VBRegister, VBWatchpointType};
mod address_set;
mod cart;
mod game_info;
mod shrooms_vb_core;
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
@@ -221,18 +223,16 @@ impl Emulator {
self.sim_state[index].store(SimState::Ready, Ordering::Release);
}
let mut profiling = false;
if let Some(profiler) = self.profilers[sim_id.to_index()].as_ref() {
if let Some(cart) = self.carts[index].as_ref() {
if profiler
.send(ProfileEvent::Start {
file_path: cart.file_path.clone(),
})
.is_ok()
{
sim.monitor_events(true);
profiling = true;
}
}
if let Some(profiler) = self.profilers[sim_id.to_index()].as_ref()
&& let Some(cart) = self.carts[index].as_ref()
&& profiler
.send(ProfileEvent::Start {
info: cart.info.clone(),
})
.is_ok()
{
sim.monitor_events(true);
profiling = true;
}
if !profiling {
sim.monitor_events(false);
@@ -476,16 +476,15 @@ impl Emulator {
if !running {
continue;
}
if let Some(p) = profiler {
if p.send(ProfileEvent::Update {
if let Some(p) = profiler
&& p.send(ProfileEvent::Update {
cycles,
event: sim.take_sim_event(),
})
.is_err()
{
sim.monitor_events(false);
*profiler = None;
}
{
sim.monitor_events(false);
*profiler = None;
}
}
@@ -838,7 +837,7 @@ pub enum DebugEvent {
pub enum ProfileEvent {
Start {
file_path: PathBuf,
info: Arc<GameInfo>,
},
Update {
cycles: u32,