Compare commits
5
Commits
8f9922473e
...
v0.8.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cab6524a4 | ||
|
|
cd8ebab4bf | ||
|
|
4f681d883e | ||
|
|
a00d89bc36 | ||
|
|
6e89a0c988 |
Generated
+1
-1
@@ -2165,7 +2165,7 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "lemur"
|
||||
version = "0.7.3"
|
||||
version = "0.8.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"atoi",
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ description = "An emulator for the Virtual Boy."
|
||||
repository = "https://git.virtual-boy.com/PVB/lemur"
|
||||
publish = false
|
||||
license = "MIT"
|
||||
version = "0.7.3"
|
||||
version = "0.8.1"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -86,12 +86,13 @@ fn parse_elf_program<Elf: object::read::elf::FileHeader<Endian = object::Endiann
|
||||
let mut bytes = vec![];
|
||||
let mut pstart = None;
|
||||
for phdr in header.program_headers(endian, data).ok()? {
|
||||
if phdr.p_filesz(endian).into() == 0 {
|
||||
let pma = phdr.p_paddr(endian).into();
|
||||
if pma < 0x07000000 || phdr.p_filesz(endian).into() == 0 {
|
||||
continue;
|
||||
}
|
||||
let start = pstart.unwrap_or(phdr.p_paddr(endian).into());
|
||||
let start = pstart.unwrap_or(pma);
|
||||
pstart = Some(start);
|
||||
bytes.resize((phdr.p_paddr(endian).into() - start) as usize, 0);
|
||||
bytes.resize((pma - start) as usize, 0);
|
||||
let data = phdr.data(endian, data).ok()?;
|
||||
bytes.extend_from_slice(data);
|
||||
}
|
||||
|
||||
+40
-4
@@ -1,17 +1,18 @@
|
||||
use std::{fs, time::Duration};
|
||||
|
||||
use anyhow::Result;
|
||||
use egui::{Button, CentralPanel, Checkbox, ViewportBuilder, ViewportId};
|
||||
use egui::{Button, CentralPanel, Checkbox, Label, ViewportBuilder, ViewportId};
|
||||
use egui_notify::{Anchor, Toast, Toasts};
|
||||
|
||||
use crate::{
|
||||
emulator::{EmulatorClient, SimId},
|
||||
emulator::{EmulatorClient, EmulatorCommand, EmulatorState, SimId},
|
||||
profiler::{Profiler, ProfilerStatus},
|
||||
window::AppWindow,
|
||||
};
|
||||
|
||||
pub struct ProfileWindow {
|
||||
sim_id: SimId,
|
||||
client: EmulatorClient,
|
||||
profiler: Profiler,
|
||||
toasts: Toasts,
|
||||
}
|
||||
@@ -20,6 +21,7 @@ impl ProfileWindow {
|
||||
pub fn new(sim_id: SimId, client: EmulatorClient) -> Self {
|
||||
Self {
|
||||
sim_id,
|
||||
client: client.clone(),
|
||||
profiler: Profiler::new(sim_id, client),
|
||||
toasts: Toasts::new()
|
||||
.with_anchor(Anchor::BottomLeft)
|
||||
@@ -33,6 +35,10 @@ impl ProfileWindow {
|
||||
}
|
||||
|
||||
fn finish_recording(&mut self) {
|
||||
let pause = matches!(self.client.emulator_state(), EmulatorState::Running);
|
||||
if pause {
|
||||
self.client.send_command(EmulatorCommand::Pause);
|
||||
}
|
||||
match self.try_finish_recording() {
|
||||
Ok(Some(path)) => {
|
||||
let mut toast = Toast::info(format!("Saved to {path}"));
|
||||
@@ -46,6 +52,9 @@ impl ProfileWindow {
|
||||
self.toasts.add(toast);
|
||||
}
|
||||
}
|
||||
if pause {
|
||||
self.client.send_command(EmulatorCommand::Resume);
|
||||
}
|
||||
}
|
||||
|
||||
fn try_finish_recording(&mut self) -> Result<Option<String>> {
|
||||
@@ -84,8 +93,32 @@ impl AppWindow for ProfileWindow {
|
||||
let status = self.profiler.status();
|
||||
let recording = matches!(status, ProfilerStatus::Recording);
|
||||
CentralPanel::default().show(ctx, |ui| {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.spacing_mut().item_spacing.x = 0.0;
|
||||
ui.add(
|
||||
Label::new(
|
||||
"Use this tool to record performance profiles of your game, for use in ",
|
||||
)
|
||||
.wrap_mode(egui::TextWrapMode::Wrap),
|
||||
);
|
||||
ui.hyperlink("https://profiler.firefox.com");
|
||||
ui.label(".");
|
||||
});
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.spacing_mut().item_spacing.x = 0.0;
|
||||
ui.add(
|
||||
Label::new("For more instructions, see ").wrap_mode(egui::TextWrapMode::Wrap),
|
||||
);
|
||||
ui.hyperlink_to(
|
||||
"the Lemur wiki",
|
||||
"https://git.virtual-boy.com/PVB/lemur/wiki/Profiling-with-Lemur",
|
||||
);
|
||||
ui.label(".");
|
||||
});
|
||||
ui.separator();
|
||||
|
||||
let mut enabled = status.enabled();
|
||||
let enabled_checkbox = Checkbox::new(&mut enabled, "Profiling enabled?");
|
||||
let enabled_checkbox = Checkbox::new(&mut enabled, "Enable profiling");
|
||||
if ui.add_enabled(!recording, enabled_checkbox).changed() {
|
||||
if enabled {
|
||||
self.profiler.enable();
|
||||
@@ -93,7 +126,9 @@ impl AppWindow for ProfileWindow {
|
||||
self.profiler.disable();
|
||||
}
|
||||
}
|
||||
|
||||
if !enabled {
|
||||
ui.label("Enabling profiling will restart your current game.");
|
||||
} else {
|
||||
ui.horizontal(|ui| {
|
||||
if !recording {
|
||||
let record_button = Button::new("Record");
|
||||
@@ -110,6 +145,7 @@ impl AppWindow for ProfileWindow {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
match &status {
|
||||
ProfilerStatus::Recording => {
|
||||
|
||||
Reference in New Issue
Block a user