Compare commits

...
5 Commits
Author SHA1 Message Date
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
9 changed files with 95 additions and 8 deletions

No files matched your search

+13 -1
View File
@@ -2,6 +2,17 @@
## [Unreleased] - ReleaseDate
## [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
### Fixed
@@ -150,8 +161,9 @@
- First release
<!-- 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.12...HEAD
[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.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
Generated
+1 -1
View File
@@ -2506,7 +2506,7 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]]
name = "rusty-path-of-building"
version = "0.2.11"
version = "0.2.12"
dependencies = [
"ahash",
"anyhow",
+1 -1
View File
@@ -4,7 +4,7 @@ authors = ["meehl"]
description = "Cross-platform runtime for Path of Building"
repository = "https://github.com/meehl/rusty-path-of-building"
license = "MIT"
version = "0.2.11"
version = "0.2.12"
edition = "2024"
publish = false
+10
View File
@@ -61,6 +61,7 @@ pub fn register_globals(lua: &Lua) -> LuaResult<()> {
// general
globals.set("GetTime", lua.create_function(get_time)?)?;
globals.set("StripEscapes", lua.create_function(strip_escapes)?)?;
globals.set("Exit", lua.create_function(exit)?)?;
globals.set("Restart", lua.create_function(restart)?)?;
globals.set("OpenURL", lua.create_function(open_url)?)?;
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())
}
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<()> {
let ctx = l.app_data_ref::<&'static Context>().unwrap();
*ctx.needs_restart() = true;
+12 -2
View File
@@ -29,6 +29,7 @@ pub struct AppState {
pub fonts: Fonts,
pub texture_manager: WrappedTextureManager,
pub script_dir: PathBuf,
pub should_exit: bool,
}
impl AppState {
@@ -59,6 +60,7 @@ impl App {
fonts: Fonts::new(pob_font_definitions()),
texture_manager: WrappedTextureManager::new(),
script_dir,
should_exit: false,
};
let current_mode = if uses_custom_script_dir {
@@ -188,8 +190,10 @@ impl ApplicationHandler<GraphicsContext> for App {
) {
match event {
WindowEvent::CloseRequested => {
self.handle_event(AppEvent::Exit);
event_loop.exit();
self.state.should_exit = self.current_mode.can_exit(&mut self.state);
if !self.state.should_exit {
self.state.window.request_redraw();
}
}
WindowEvent::RedrawRequested => {
profiling::scope!("RedrawRequested");
@@ -200,6 +204,12 @@ impl ApplicationHandler<GraphicsContext> for App {
return;
}
if self.state.should_exit {
self.handle_event(AppEvent::Exit);
event_loop.exit();
return;
}
if self.needs_reconfigure {
if let Some(ref mut gfx) = self.gfx_context {
let size = gfx.window.inner_size();
+29 -3
View File
@@ -19,7 +19,7 @@ use std::{
sync::mpsc::{self, Receiver, TryRecvError},
thread,
};
use ureq::http::Response;
use ureq::{Agent, http::Response};
const REPO_NAME: &str = "meehl/rusty-pob-manifest";
@@ -29,6 +29,7 @@ enum DownloadProgress {
}
enum Progress {
Status(String),
Download(DownloadProgress),
Complete,
Error(anyhow::Error),
@@ -36,6 +37,7 @@ enum Progress {
enum CurrentProgress {
Starting,
Status(String),
Download(DownloadProgress),
}
@@ -84,6 +86,9 @@ impl InstallMode {
Ok(Progress::Download(progress)) => {
self.current_progress = CurrentProgress::Download(progress);
}
Ok(Progress::Status(msg)) => {
self.current_progress = CurrentProgress::Status(msg);
}
Ok(Progress::Complete) => {
return Ok(Some(ModeTransition::PoB));
}
@@ -126,6 +131,7 @@ impl InstallMode {
let progress_text = match &self.current_progress {
CurrentProgress::Starting => String::from("Starting download..."),
CurrentProgress::Status(msg) => msg.clone(),
CurrentProgress::Download(progress) => match progress {
DownloadProgress::Percentage(progress) => {
let percent = (progress * 100.0) as u32;
@@ -175,16 +181,29 @@ fn install<P: AsRef<Path>>(
return Ok(());
}
progress_tx.send(Progress::Status("Fetching compatibility info...".into()))?;
log::info!("Fetching compatibility info...");
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)
.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)?;
progress_tx.send(Progress::Status("Patching UpdateCheck...".into()))?;
log::info!("Patching UpdateCheck...");
replace_updatecheck(&target_dir)?;
progress_tx.send(Progress::Status("Finalizing installation...".into()))?;
log::info!("Finalizing installation...");
set_branch_and_platform(&target_dir)?;
// write version file
fs::write(&version_file_path, env!("CARGO_PKG_VERSION")).unwrap();
log::info!("Installation complete.");
Ok(())
}
@@ -486,9 +505,16 @@ fn http_get_with_backoff(url: &str) -> anyhow::Result<Response<ureq::Body>> {
let mut attempt = 0;
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 {
attempt += 1;
let resp_result = ureq::get(url)
let resp_result = agent
.get(url)
.header("User-Agent", "rusty-path-of-building")
.call();
+17
View File
@@ -52,6 +52,7 @@ pub struct Context {
current_working_dir: Cell<*mut PathBuf>,
layers: Cell<*mut Layers>,
needs_restart: Cell<*mut bool>,
should_exit: Cell<*mut bool>,
is_dpi_aware: Cell<*mut bool>,
}
@@ -66,6 +67,7 @@ impl Context {
current_working_dir: Cell::new(std::ptr::null_mut()),
layers: 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()),
}))
}
@@ -80,6 +82,7 @@ impl Context {
.set(&mut ctx.pob.current_working_dir);
self.layers.set(&mut ctx.pob.layers);
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);
}
@@ -92,6 +95,7 @@ impl Context {
self.current_working_dir.set(std::ptr::null_mut());
self.layers.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());
}
@@ -103,6 +107,7 @@ impl Context {
ctx_accessor!(current_working_dir: &mut PathBuf);
ctx_accessor!(layers: &mut Layers);
ctx_accessor!(needs_restart: &mut bool);
ctx_accessor!(should_exit: &mut bool);
ctx_accessor!(is_dpi_aware: &mut bool);
}
@@ -259,6 +264,18 @@ impl LuaInstance {
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<()> {
profiling::scope!("handle_event", format!("{}", event));
+7
View File
@@ -65,4 +65,11 @@ impl AppMode {
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(())
}
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>) {
self.state
.layers