Compare commits

...
8 Commits
Author SHA1 Message Date
meehl ff46a570fc chore: Release rusty-path-of-building version 0.2.13
Release / create-release (push) Successful in 4s
2026-03-09 18:17:47 +01:00
meehl 7db64e337d Update CHANGELOG 2026-03-09 18:17:33 +01:00
meehl 522ab489cd Fix ascendancy flavour text size. 2026-03-09 18:13:58 +01:00
meehl 8217aca6f2 chore: Release rusty-path-of-building version 0.2.12
Release / create-release (push) Successful in 4s
2026-03-09 16:35:19 +01:00
meehl 249116af52 Update CHANGELOG 2026-03-09 16:35:06 +01:00
meehl c47bf48556 Add more fine-grained logging and UI feedback to installer 2026-03-09 16:30:00 +01:00
meehl 1f89e31f30 Set global timeout for ureq requests 2026-03-09 16:30:00 +01:00
AiSatan 913d2127d8 Fix to enable "Save changes" popup 2026-03-09 14:10:30 +01:00
10 changed files with 111 additions and 10 deletions

No files matched your search

+20 -1
View File
@@ -2,6 +2,23 @@
## [Unreleased] - ReleaseDate ## [Unreleased] - ReleaseDate
## [0.2.13] - 2026-03-09
### Fixed
- Fix size of ascendancy flavour texts
## [0.2.12] - 2026-03-09
### Changed
- Add better logging and UI feedback for initial install
- Set global timeout for network requests
### Fixed
- Fix confirmation dialog not showing on close with unsaved changes
## [0.2.11] - 2026-03-05 ## [0.2.11] - 2026-03-05
### Fixed ### Fixed
@@ -150,8 +167,10 @@
- First release - First release
<!-- next-url --> <!-- next-url -->
[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.11...HEAD [Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.13...HEAD
[0.2.13]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.12...v0.2.13
[0.2.12]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.11...v0.2.12
[0.2.11]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.10...v0.2.11 [0.2.11]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.10...v0.2.11
[0.2.10]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.9...v0.2.10 [0.2.10]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.9...v0.2.10
[0.2.9]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.8...v0.2.9 [0.2.9]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.8...v0.2.9
Generated
+1 -1
View File
@@ -2506,7 +2506,7 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]] [[package]]
name = "rusty-path-of-building" name = "rusty-path-of-building"
version = "0.2.11" version = "0.2.13"
dependencies = [ dependencies = [
"ahash", "ahash",
"anyhow", "anyhow",
+1 -1
View File
@@ -4,7 +4,7 @@ authors = ["meehl"]
description = "Cross-platform runtime for Path of Building" description = "Cross-platform runtime for Path of Building"
repository = "https://github.com/meehl/rusty-path-of-building" repository = "https://github.com/meehl/rusty-path-of-building"
license = "MIT" license = "MIT"
version = "0.2.11" version = "0.2.13"
edition = "2024" edition = "2024"
publish = false publish = false
+10
View File
@@ -61,6 +61,7 @@ pub fn register_globals(lua: &Lua) -> LuaResult<()> {
// general // general
globals.set("GetTime", lua.create_function(get_time)?)?; globals.set("GetTime", lua.create_function(get_time)?)?;
globals.set("StripEscapes", lua.create_function(strip_escapes)?)?; globals.set("StripEscapes", lua.create_function(strip_escapes)?)?;
globals.set("Exit", lua.create_function(exit)?)?;
globals.set("Restart", lua.create_function(restart)?)?; globals.set("Restart", lua.create_function(restart)?)?;
globals.set("OpenURL", lua.create_function(open_url)?)?; globals.set("OpenURL", lua.create_function(open_url)?)?;
globals.set("RenderInit", lua.create_function(render_init)?)?; globals.set("RenderInit", lua.create_function(render_init)?)?;
@@ -128,6 +129,15 @@ fn strip_escapes(_: &Lua, text: String) -> LuaResult<String> {
Ok(PoBString(&text).strip_escapes()) Ok(PoBString(&text).strip_escapes())
} }
fn exit(l: &Lua, exit_msg: Option<String>) -> LuaResult<()> {
if let Some(exit_msg) = exit_msg {
println!("{exit_msg}");
}
let ctx = l.app_data_ref::<&'static Context>().unwrap();
*ctx.should_exit() = true;
Ok(())
}
fn restart(l: &Lua, _: ()) -> LuaResult<()> { fn restart(l: &Lua, _: ()) -> LuaResult<()> {
let ctx = l.app_data_ref::<&'static Context>().unwrap(); let ctx = l.app_data_ref::<&'static Context>().unwrap();
*ctx.needs_restart() = true; *ctx.needs_restart() = true;
+9 -2
View File
@@ -484,8 +484,15 @@ fn build_layout_job<'a>(
} }
}; };
// TODO: check how PoB determines font size // NOTE: This is just an approximation and was chosen based on how it looks.
let font_size = (line_height - 2).clamp(11, 32) as f32; //
// PoB uses pre-rendered font atlases of discrete sizes and selects the appropriate
// atlas based on the provided height. Rusty-PoB dynamically renders fonts to a
// cached font atlas to support the selection of arbitrary sizes.
//
// TODO: font size in some dropdowns is too small, e.g. socket group selection in
// 'Calcs' tab
let font_size = (line_height - 2).max(1) as f32;
let mut job = LayoutJob::new( let mut job = LayoutJob::new(
font_family, font_family,
+12 -2
View File
@@ -29,6 +29,7 @@ pub struct AppState {
pub fonts: Fonts, pub fonts: Fonts,
pub texture_manager: WrappedTextureManager, pub texture_manager: WrappedTextureManager,
pub script_dir: PathBuf, pub script_dir: PathBuf,
pub should_exit: bool,
} }
impl AppState { impl AppState {
@@ -59,6 +60,7 @@ impl App {
fonts: Fonts::new(pob_font_definitions()), fonts: Fonts::new(pob_font_definitions()),
texture_manager: WrappedTextureManager::new(), texture_manager: WrappedTextureManager::new(),
script_dir, script_dir,
should_exit: false,
}; };
let current_mode = if uses_custom_script_dir { let current_mode = if uses_custom_script_dir {
@@ -188,8 +190,10 @@ impl ApplicationHandler<GraphicsContext> for App {
) { ) {
match event { match event {
WindowEvent::CloseRequested => { WindowEvent::CloseRequested => {
self.handle_event(AppEvent::Exit); self.state.should_exit = self.current_mode.can_exit(&mut self.state);
event_loop.exit(); if !self.state.should_exit {
self.state.window.request_redraw();
}
} }
WindowEvent::RedrawRequested => { WindowEvent::RedrawRequested => {
profiling::scope!("RedrawRequested"); profiling::scope!("RedrawRequested");
@@ -200,6 +204,12 @@ impl ApplicationHandler<GraphicsContext> for App {
return; return;
} }
if self.state.should_exit {
self.handle_event(AppEvent::Exit);
event_loop.exit();
return;
}
if self.needs_reconfigure { if self.needs_reconfigure {
if let Some(ref mut gfx) = self.gfx_context { if let Some(ref mut gfx) = self.gfx_context {
let size = gfx.window.inner_size(); let size = gfx.window.inner_size();
+29 -3
View File
@@ -19,7 +19,7 @@ use std::{
sync::mpsc::{self, Receiver, TryRecvError}, sync::mpsc::{self, Receiver, TryRecvError},
thread, thread,
}; };
use ureq::http::Response; use ureq::{Agent, http::Response};
const REPO_NAME: &str = "meehl/rusty-pob-manifest"; const REPO_NAME: &str = "meehl/rusty-pob-manifest";
@@ -29,6 +29,7 @@ enum DownloadProgress {
} }
enum Progress { enum Progress {
Status(String),
Download(DownloadProgress), Download(DownloadProgress),
Complete, Complete,
Error(anyhow::Error), Error(anyhow::Error),
@@ -36,6 +37,7 @@ enum Progress {
enum CurrentProgress { enum CurrentProgress {
Starting, Starting,
Status(String),
Download(DownloadProgress), Download(DownloadProgress),
} }
@@ -84,6 +86,9 @@ impl InstallMode {
Ok(Progress::Download(progress)) => { Ok(Progress::Download(progress)) => {
self.current_progress = CurrentProgress::Download(progress); self.current_progress = CurrentProgress::Download(progress);
} }
Ok(Progress::Status(msg)) => {
self.current_progress = CurrentProgress::Status(msg);
}
Ok(Progress::Complete) => { Ok(Progress::Complete) => {
return Ok(Some(ModeTransition::PoB)); return Ok(Some(ModeTransition::PoB));
} }
@@ -126,6 +131,7 @@ impl InstallMode {
let progress_text = match &self.current_progress { let progress_text = match &self.current_progress {
CurrentProgress::Starting => String::from("Starting download..."), CurrentProgress::Starting => String::from("Starting download..."),
CurrentProgress::Status(msg) => msg.clone(),
CurrentProgress::Download(progress) => match progress { CurrentProgress::Download(progress) => match progress {
DownloadProgress::Percentage(progress) => { DownloadProgress::Percentage(progress) => {
let percent = (progress * 100.0) as u32; let percent = (progress * 100.0) as u32;
@@ -175,16 +181,29 @@ fn install<P: AsRef<Path>>(
return Ok(()); return Ok(());
} }
progress_tx.send(Progress::Status("Fetching compatibility info...".into()))?;
log::info!("Fetching compatibility info...");
let compatibility_info = fetch_compatibility_info(game)?; let compatibility_info = fetch_compatibility_info(game)?;
progress_tx.send(Progress::Status("Resolving PoB version...".into()))?;
log::info!("Resolving supported PoB version...");
let needed_pob_version = highest_supported_pob_version(&compatibility_info, current_version) let needed_pob_version = highest_supported_pob_version(&compatibility_info, current_version)
.ok_or_else(|| anyhow::anyhow!("Unable to determine supported PoB version"))?; .ok_or_else(|| anyhow::anyhow!("Unable to determine supported PoB version"))?;
log::info!("Using PoB version: {needed_pob_version}");
progress_tx.send(Progress::Status("Downloading assets...".into()))?;
download_path_of_building(&target_dir, game, needed_pob_version, progress_tx)?; download_path_of_building(&target_dir, game, needed_pob_version, progress_tx)?;
progress_tx.send(Progress::Status("Patching UpdateCheck...".into()))?;
log::info!("Patching UpdateCheck...");
replace_updatecheck(&target_dir)?; replace_updatecheck(&target_dir)?;
progress_tx.send(Progress::Status("Finalizing installation...".into()))?;
log::info!("Finalizing installation...");
set_branch_and_platform(&target_dir)?; set_branch_and_platform(&target_dir)?;
// write version file
fs::write(&version_file_path, env!("CARGO_PKG_VERSION")).unwrap(); fs::write(&version_file_path, env!("CARGO_PKG_VERSION")).unwrap();
log::info!("Installation complete.");
Ok(()) Ok(())
} }
@@ -486,9 +505,16 @@ fn http_get_with_backoff(url: &str) -> anyhow::Result<Response<ureq::Body>> {
let mut attempt = 0; let mut attempt = 0;
let mut backoff_secs: u64 = 2; let mut backoff_secs: u64 = 2;
let config = Agent::config_builder()
.timeout_global(Some(Duration::from_secs(10)))
.build();
let agent: Agent = config.into();
loop { loop {
attempt += 1; attempt += 1;
let resp_result = ureq::get(url) let resp_result = agent
.get(url)
.header("User-Agent", "rusty-path-of-building") .header("User-Agent", "rusty-path-of-building")
.call(); .call();
+17
View File
@@ -52,6 +52,7 @@ pub struct Context {
current_working_dir: Cell<*mut PathBuf>, current_working_dir: Cell<*mut PathBuf>,
layers: Cell<*mut Layers>, layers: Cell<*mut Layers>,
needs_restart: Cell<*mut bool>, needs_restart: Cell<*mut bool>,
should_exit: Cell<*mut bool>,
is_dpi_aware: Cell<*mut bool>, is_dpi_aware: Cell<*mut bool>,
} }
@@ -66,6 +67,7 @@ impl Context {
current_working_dir: Cell::new(std::ptr::null_mut()), current_working_dir: Cell::new(std::ptr::null_mut()),
layers: Cell::new(std::ptr::null_mut()), layers: Cell::new(std::ptr::null_mut()),
needs_restart: Cell::new(std::ptr::null_mut()), needs_restart: Cell::new(std::ptr::null_mut()),
should_exit: Cell::new(std::ptr::null_mut()),
is_dpi_aware: Cell::new(std::ptr::null_mut()), is_dpi_aware: Cell::new(std::ptr::null_mut()),
})) }))
} }
@@ -80,6 +82,7 @@ impl Context {
.set(&mut ctx.pob.current_working_dir); .set(&mut ctx.pob.current_working_dir);
self.layers.set(&mut ctx.pob.layers); self.layers.set(&mut ctx.pob.layers);
self.needs_restart.set(&mut ctx.pob.needs_restart); self.needs_restart.set(&mut ctx.pob.needs_restart);
self.should_exit.set(&mut ctx.app.should_exit);
self.is_dpi_aware.set(&mut ctx.pob.is_dpi_aware); self.is_dpi_aware.set(&mut ctx.pob.is_dpi_aware);
} }
@@ -92,6 +95,7 @@ impl Context {
self.current_working_dir.set(std::ptr::null_mut()); self.current_working_dir.set(std::ptr::null_mut());
self.layers.set(std::ptr::null_mut()); self.layers.set(std::ptr::null_mut());
self.needs_restart.set(std::ptr::null_mut()); self.needs_restart.set(std::ptr::null_mut());
self.should_exit.set(std::ptr::null_mut());
self.is_dpi_aware.set(std::ptr::null_mut()); self.is_dpi_aware.set(std::ptr::null_mut());
} }
@@ -103,6 +107,7 @@ impl Context {
ctx_accessor!(current_working_dir: &mut PathBuf); ctx_accessor!(current_working_dir: &mut PathBuf);
ctx_accessor!(layers: &mut Layers); ctx_accessor!(layers: &mut Layers);
ctx_accessor!(needs_restart: &mut bool); ctx_accessor!(needs_restart: &mut bool);
ctx_accessor!(should_exit: &mut bool);
ctx_accessor!(is_dpi_aware: &mut bool); ctx_accessor!(is_dpi_aware: &mut bool);
} }
@@ -259,6 +264,18 @@ impl LuaInstance {
list_func.call::<Table>(()) list_func.call::<Table>(())
} }
pub fn can_exit(&self, pob_ctx: &mut PoBContext) -> bool {
let ctx = self.lua.app_data_ref::<&'static Context>().unwrap();
ctx.set(pob_ctx);
let can_exit = get_callback(&self.lua, "CanExit")
.and_then(|f| f.call(()))
.unwrap_or(true);
ctx.clear();
can_exit
}
pub fn handle_event(&self, event: PoBEvent, pob_ctx: &mut PoBContext) -> LuaResult<()> { pub fn handle_event(&self, event: PoBEvent, pob_ctx: &mut PoBContext) -> LuaResult<()> {
profiling::scope!("handle_event", format!("{}", event)); profiling::scope!("handle_event", format!("{}", event));
+7
View File
@@ -65,4 +65,11 @@ impl AppMode {
AppMode::PoB(mode) => mode.handle_event(state, event), AppMode::PoB(mode) => mode.handle_event(state, event),
} }
} }
pub fn can_exit(&mut self, state: &mut AppState) -> bool {
match self {
AppMode::Install(_) => true,
AppMode::PoB(mode) => mode.can_exit(state),
}
}
} }
+5
View File
@@ -147,6 +147,11 @@ impl PoBMode {
Ok(()) Ok(())
} }
pub fn can_exit(&mut self, app_state: &mut AppState) -> bool {
let mut ctx = PoBContext::new(app_state, &mut self.state);
self.lua_instance.can_exit(&mut ctx)
}
fn reset_viewport(&mut self, size: LogicalSize<u32>) { fn reset_viewport(&mut self, size: LogicalSize<u32>) {
self.state self.state
.layers .layers