Skip to content

Commit ad65db5

Browse files
committed
Updated mirror and egui dependencies
1 parent 789c08c commit ad65db5

File tree

9 files changed

+2859
-998
lines changed

9 files changed

+2859
-998
lines changed

Cargo.lock

+2,805-948
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mirror-dto/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ authors = ["ko1N <[email protected]>"]
55
edition = "2018"
66

77
[dependencies]
8-
memflow = { version = "=0.2.0-beta10", features = ["plugins"] }
8+
memflow = { version = "0.2", features = ["plugins"] }

mirror-guest/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ edition = "2018"
88
mirror-dto = { path = "../mirror-dto" }
99
winapi = { version = "0.3.8", features = ["winuser", "libloaderapi", "d3d11", "d3dcommon", "dxgi", "dxgi1_2", "dxgitype", "ntdef", "unknwnbase", "winerror", "windef", "minwindef", "shellapi", "libloaderapi", "commctrl", "basetsd"] }
1010
log = "0.4"
11-
thread-priority = "^0.10"
11+
thread-priority = "0.15"
1212
trayicon = "0.1"
1313
simple-logging = "2.0"
1414
log-panics = "2.0"

mirror/Cargo.toml

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
[package]
22
name = "mirror"
3-
version = "0.2.0-beta10"
3+
version = "0.2.0"
44
authors = ["ko1N <[email protected]>"]
55
edition = "2018"
66

77
[dependencies]
88
# memflow
9-
log = "^0.4"
10-
memflow = { version = "=0.2.0-beta10", features = ["plugins"] }
9+
log = "0.4"
10+
memflow = { version = "0.2", features = ["plugins"] }
1111
mirror-dto = { path = "../mirror-dto" }
1212
parking_lot = { version = "0.12", features = [ "hardware-lock-elision" ] }
1313
frame_counter = "0.1.2"
14-
pelite = "^0.9.0"
14+
pelite = "0.10.0"
1515

1616
# bin
17-
clap = { version = "^4.0", features = ["cargo"], optional = true }
18-
simplelog = { version = "^0.12", optional = true }
19-
thread-priority = { version = "^0.13", optional = true }
17+
clap = { version = "4.4", features = ["cargo"], optional = true }
18+
simplelog = { version = "0.12", optional = true }
19+
thread-priority = { version = "0.16", optional = true }
2020

2121
# gui
22-
egui = "0.20.0"
23-
eframe = { version = "0.20.0", optional = true }
24-
epaint = { version = "0.20.0", optional = true }
25-
egui-notify = { version = "0.5.0", optional = true }
26-
egui_dock = "0.3"
27-
image = { version = "^0.24", optional = true }
22+
egui = "0.26"
23+
eframe = { version = "0.26", optional = true }
24+
epaint = { version = "0.26", optional = true }
25+
egui-notify = { version = "0.14", optional = true }
26+
egui_dock = "0.11"
27+
image = { version = "0.25", optional = true }
2828

2929
# configs
3030
serde = { version = "1.0", features = ["derive"] }
31-
toml = "^0.7"
32-
dirs = "^5.0"
31+
toml = "0.8"
32+
dirs = "5.0"
3333

3434
[dev-dependencies]
35-
log = "^0.4"
36-
clap = { version = "^4.0", features = ["cargo"] }
37-
simplelog = { version = "^0.12" }
38-
memflow = { version = "=0.2.0-beta10", features = ["plugins"] }
35+
log = "0.4"
36+
clap = { version = "4.4", features = ["cargo"] }
37+
simplelog = { version = "0.12" }
38+
memflow = { version = "0.2", features = ["plugins"] }
3939

4040
[features]
41-
default = []
42-
mirror-bin = [ "dep:clap", "dep:simplelog", "dep:thread-priority", "dep:eframe", "dep:epaint", "dep:egui-notify", "dep:image" ]
41+
default = ["mirror-bin"]
42+
mirror-bin = ["dep:clap", "dep:simplelog", "dep:thread-priority", "dep:eframe", "dep:epaint", "dep:egui-notify", "dep:image"]
4343

4444
[[bin]]
4545
name = "mirror"
46-
required-features = [ "mirror-bin" ]
46+
required-features = ["mirror-bin"]

mirror/src/app.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use ::log::warn;
22

3-
use ::egui_dock::{DockArea, StyleBuilder, Tree};
3+
use ::egui_dock::{DockArea, DockState, Style};
44
use ::egui_notify::Toasts;
55

66
mod frame_history;
@@ -14,7 +14,7 @@ use crate::MirrorConfig;
1414
pub struct MirrorApp {
1515
_toasts: Toasts,
1616
frame_history: FrameHistory,
17-
tree: Tree<CaptureTab>,
17+
tree: DockState<CaptureTab>,
1818
tree_len: usize,
1919

2020
config: MirrorConfig,
@@ -41,7 +41,7 @@ impl MirrorApp {
4141
Self {
4242
_toasts: Toasts::default().with_anchor(egui_notify::Anchor::BottomRight),
4343
frame_history: FrameHistory::default(),
44-
tree: Tree::new(vec![capture_tab]),
44+
tree: DockState::new(vec![capture_tab]),
4545
tree_len: 1,
4646

4747
config,
@@ -55,14 +55,14 @@ impl MirrorApp {
5555
impl eframe::App for MirrorApp {
5656
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
5757
self.frame_history
58-
.on_new_frame(ctx.input().time, frame.info().cpu_usage);
58+
.on_new_frame(ctx.input(|i| i.time), frame.info().cpu_usage);
5959

6060
#[cfg(not(target_arch = "wasm32"))] // no File->Quit on web pages!
6161
egui::TopBottomPanel::top("top_panel").show(ctx, |ui| {
6262
egui::menu::bar(ui, |ui| {
6363
ui.menu_button("File", |ui| {
6464
if ui.button("Quit").clicked() {
65-
frame.close();
65+
ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close);
6666
}
6767
});
6868
ui.menu_button("Windows", |ui| {
@@ -84,12 +84,12 @@ impl eframe::App for MirrorApp {
8484

8585
let mut added_nodes = Vec::new();
8686
DockArea::new(&mut self.tree)
87-
.style(
88-
StyleBuilder::from_egui(ctx.style().as_ref())
89-
.show_add_buttons(true)
90-
.expand_tabs(true)
91-
.build(),
92-
)
87+
.show_add_buttons(true)
88+
.style({
89+
let mut style = Style::from_egui(ctx.style().as_ref());
90+
style.tab_bar.fill_tab_bar = true;
91+
style
92+
})
9393
.show(
9494
ctx,
9595
&mut TabViewer {
@@ -98,8 +98,8 @@ impl eframe::App for MirrorApp {
9898
},
9999
);
100100

101-
added_nodes.drain(..).for_each(|node| {
102-
self.tree.set_focused_node(node);
101+
added_nodes.drain(..).for_each(|(surface, node)| {
102+
self.tree.set_focused_node_and_surface((surface, node));
103103
self.tree
104104
.push_to_focused_leaf(CaptureTab::new(self.tree_len, &self.config));
105105
self.tree_len += 1;

mirror/src/app/frame_history.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ impl FrameHistory {
8181
rounding: style.rounding,
8282
fill: ui.visuals().extreme_bg_color,
8383
stroke: ui.style().noninteractive().bg_stroke,
84+
fill_texture_id: TextureId::default(), // ?
85+
uv: Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)),
8486
}));
8587

8688
let rect = rect.shrink(4.0);
@@ -96,7 +98,7 @@ impl FrameHistory {
9698
let cpu_usage = to_screen.inverse().transform_pos(pointer_pos).y;
9799
let text = format!("{:.1} ms", 1e3 * cpu_usage);
98100
shapes.push(Shape::text(
99-
&ui.fonts(),
101+
&ui.fonts(|fonts| fonts.clone()),
100102
pos2(rect.left(), y),
101103
egui::Align2::LEFT_BOTTOM,
102104
text,
@@ -107,7 +109,7 @@ impl FrameHistory {
107109

108110
let circle_color = color;
109111
let radius = 2.0;
110-
let right_side_time = ui.input().time; // Time at right side of screen
112+
let right_side_time = ui.input(|i| i.time); // Time at right side of screen
111113

112114
for (time, cpu_usage) in history.iter() {
113115
let age = (right_side_time - time) as f32;

mirror/src/app/tab_viewer.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use ::std::io::Cursor;
22

3-
use ::egui::pos2;
3+
use ::egui_dock::egui::{self, pos2};
44
use ::egui_dock::NodeIndex;
5+
use ::egui_dock::SurfaceIndex;
56
use ::epaint::{Color32, Rect, TextureHandle};
67

78
use ::memflow::prelude::v1::*;
@@ -12,7 +13,7 @@ use crate::{
1213
};
1314

1415
pub struct TabViewer<'a> {
15-
pub(crate) added_nodes: &'a mut Vec<NodeIndex>,
16+
pub(crate) added_nodes: &'a mut Vec<(SurfaceIndex, NodeIndex)>,
1617
pub(crate) config: &'a mut MirrorConfig,
1718
}
1819

@@ -42,8 +43,8 @@ impl egui_dock::TabViewer for TabViewer<'_> {
4243
}
4344
}
4445

45-
fn on_add(&mut self, node: NodeIndex) {
46-
self.added_nodes.push(node);
46+
fn on_add(&mut self, surface: SurfaceIndex, node: NodeIndex) {
47+
self.added_nodes.push((surface, node));
4748
}
4849
}
4950

@@ -230,10 +231,10 @@ impl CaptureTab {
230231
let desired_width = desired_height * aspect_ratio;
231232

232233
let render_position = ui
233-
.add(egui::Image::new(
234+
.add(egui::Image::new(egui::load::SizedTexture::new(
234235
frame_texture.id(),
235236
[desired_width, desired_height],
236-
))
237+
)))
237238
.rect;
238239

239240
// render cursor on top of frame

mirror/src/capture.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ use ::frame_counter::FrameCounter;
22
use ::log::{info, warn};
33
use ::mirror_dto::{CaptureConfig, Cursor, GlobalBufferHost};
44
use ::parking_lot::RwLock;
5+
use ::pelite::pattern;
6+
use ::pelite::pattern::Atom;
57
use ::std::{
68
convert::TryInto,
79
sync::atomic::{AtomicBool, Ordering},
810
sync::Arc,
911
thread,
1012
thread::JoinHandle,
1113
};
12-
use pelite::pattern;
13-
use pelite::pattern::Atom;
1414

1515
use ::memflow::prelude::v1::*;
1616

@@ -120,7 +120,7 @@ impl Capture for SequentialCapture {
120120
)
121121
};
122122

123-
egui::ImageData::Color(egui::ColorImage { size, pixels })
123+
egui::ImageData::Color(Arc::new(egui::ColorImage { size, pixels }))
124124
}
125125

126126
fn cursor_data(&self) -> Cursor {
@@ -214,7 +214,7 @@ impl Capture for ThreadedCapture {
214214
)
215215
};
216216

217-
egui::ImageData::Color(egui::ColorImage { size, pixels })
217+
egui::ImageData::Color(Arc::new(egui::ColorImage { size, pixels }))
218218
}
219219

220220
fn cursor_data(&self) -> Cursor {

mirror/src/main.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ fn main() -> Result<()> {
7878
"memflow mirror",
7979
native_options,
8080
Box::new(|cc| Box::new(MirrorApp::new(cc))),
81-
);
81+
)
82+
.expect("could not start gui");
8283

8384
Ok(())
8485
}

0 commit comments

Comments
 (0)