Compare commits

..

18 Commits

Author SHA1 Message Date
Simon Gellis 0debae0678 Support hypothetical big-endian users 2025-02-15 16:14:03 -05:00
Simon Gellis c715d4ddc8 Make properties editable 2025-02-15 12:56:58 -05:00
Simon Gellis f64cab8f5c Finish object view 2025-02-15 00:28:46 -05:00
Simon Gellis 67c332c446 Support signed numbers in number picker 2025-02-15 00:28:46 -05:00
Simon Gellis 1f74593410 Fix keyboard navigation for numberedit 2025-02-15 00:28:46 -05:00
Simon Gellis 73fde4dc58 Start drawing objects 2025-02-15 00:28:46 -05:00
Simon Gellis c62698c0e9 Optimize image updates 2025-02-15 00:28:46 -05:00
Simon Gellis 706a1bb697 Move about into a button 2025-02-15 00:28:46 -05:00
Simon Gellis bd983880b5 Add a number editor widget 2025-02-15 00:28:46 -05:00
Simon Gellis e2821898ec When the UI consumes an input, don't send it to the game 2025-02-15 00:28:46 -05:00
Simon Gellis e052d592cf Sync memory between emulator thread and UI 2025-02-15 00:28:46 -05:00
Simon Gellis bad93bb82e Render images on background thread to keep UI responsive 2025-02-15 00:28:46 -05:00
Simon Gellis d674cd2e00 Avoid unnecessary computation/cloning in renderer 2025-02-15 00:28:46 -05:00
Simon Gellis 857ee04e51 Rerender VRAM graphics every frame (slow in debug) 2025-02-15 00:28:46 -05:00
Simon Gellis 655557b84a Flesh out bgmap viewer 2025-02-15 00:28:46 -05:00
Simon Gellis 1af312cc4f New implementation for reading/showing vram 2025-02-15 00:28:46 -05:00
Simon Gellis a6f379fb3f Dummy second window 2025-02-15 00:28:46 -05:00
Simon Gellis 6bded6d330 First pass of character data viewer 2025-02-15 00:28:46 -05:00
3 changed files with 14 additions and 66 deletions

2
Cargo.lock generated
View File

@ -1763,7 +1763,7 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "lemur"
version = "0.3.2"
version = "0.3.1"
dependencies = [
"anyhow",
"atoi",

View File

@ -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.3.2"
version = "0.3.1"
edition = "2021"
[dependencies]

View File

@ -40,7 +40,6 @@ fn load_icon() -> anyhow::Result<IconData> {
pub struct Application {
icon: Option<Arc<IconData>>,
wgpu: WgpuState,
client: EmulatorClient,
proxy: EventLoopProxy<UserEvent>,
mappings: MappingProvider,
@ -59,7 +58,6 @@ impl Application {
proxy: EventLoopProxy<UserEvent>,
debug_port: Option<u16>,
) -> Self {
let wgpu = WgpuState::new();
let icon = load_icon().ok().map(Arc::new);
let persistence = Persistence::new();
let mappings = MappingProvider::new(persistence.clone());
@ -73,7 +71,6 @@ impl Application {
}
Self {
icon,
wgpu,
client,
proxy,
mappings,
@ -94,7 +91,7 @@ impl Application {
}
self.viewports.insert(
viewport_id,
Viewport::new(event_loop, &self.wgpu, self.icon.clone(), window),
Viewport::new(event_loop, self.icon.clone(), window),
);
}
}
@ -269,58 +266,6 @@ impl ApplicationHandler<UserEvent> for Application {
}
}
struct WgpuState {
instance: Arc<wgpu::Instance>,
adapter: Arc<wgpu::Adapter>,
device: Arc<wgpu::Device>,
queue: Arc<wgpu::Queue>,
}
impl WgpuState {
fn new() -> Self {
#[allow(unused_variables)]
let egui_wgpu::WgpuConfiguration {
wgpu_setup:
egui_wgpu::WgpuSetup::CreateNew {
supported_backends,
device_descriptor,
..
},
..
} = egui_wgpu::WgpuConfiguration::default()
else {
panic!("required fields not found")
};
#[cfg(windows)]
let supported_backends = wgpu::util::backend_bits_from_env()
.unwrap_or((wgpu::Backends::PRIMARY | wgpu::Backends::GL) - wgpu::Backends::VULKAN);
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: supported_backends,
..wgpu::InstanceDescriptor::default()
});
let adapter = pollster::block_on(instance.request_adapter(&wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::HighPerformance,
compatible_surface: None,
force_fallback_adapter: false,
}))
.expect("could not create adapter");
let trace_path = std::env::var("WGPU_TRACE");
let (device, queue) = pollster::block_on(adapter.request_device(
&(*device_descriptor)(&adapter),
trace_path.ok().as_ref().map(std::path::Path::new),
))
.expect("could not request device");
Self {
instance: Arc::new(instance),
adapter: Arc::new(adapter),
device: Arc::new(device),
queue: Arc::new(queue),
}
}
}
struct Viewport {
painter: egui_wgpu::winit::Painter,
ctx: Context,
@ -334,7 +279,6 @@ struct Viewport {
impl Viewport {
pub fn new(
event_loop: &ActiveEventLoop,
wgpu: &WgpuState,
icon: Option<Arc<IconData>>,
mut app: Box<dyn AppWindow>,
) -> Self {
@ -358,16 +302,20 @@ impl Viewport {
});
egui_extras::install_image_loaders(&ctx);
let wgpu_config = egui_wgpu::WgpuConfiguration {
#[allow(unused_mut)]
let mut wgpu_config = egui_wgpu::WgpuConfiguration {
present_mode: wgpu::PresentMode::AutoNoVsync,
wgpu_setup: egui_wgpu::WgpuSetup::Existing {
instance: wgpu.instance.clone(),
adapter: wgpu.adapter.clone(),
device: wgpu.device.clone(),
queue: wgpu.queue.clone(),
},
..egui_wgpu::WgpuConfiguration::default()
};
#[cfg(windows)]
{
if let egui_wgpu::WgpuSetup::CreateNew {
supported_backends, ..
} = &mut wgpu_config.wgpu_setup
{
*supported_backends -= wgpu::Backends::VULKAN;
}
}
let mut painter =
egui_wgpu::winit::Painter::new(ctx.clone(), wgpu_config, 1, None, false, true);