Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff46a570fc | ||
|
|
7db64e337d | ||
|
|
522ab489cd | ||
|
|
8217aca6f2 | ||
|
|
249116af52 | ||
|
|
c47bf48556 | ||
|
|
1f89e31f30 | ||
|
|
913d2127d8 |
No files matched your search
+20
-1
@@ -2,6 +2,23 @@
|
||||
|
||||
## [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
|
||||
|
||||
### Fixed
|
||||
@@ -150,8 +167,10 @@
|
||||
- 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.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.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
@@ -2506,7 +2506,7 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
||||
|
||||
[[package]]
|
||||
name = "rusty-path-of-building"
|
||||
version = "0.2.11"
|
||||
version = "0.2.13"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"anyhow",
|
||||
|
||||
+1
-1
@@ -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.13"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
|
||||
+10
@@ -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;
|
||||
|
||||
@@ -484,8 +484,15 @@ fn build_layout_job<'a>(
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: check how PoB determines font size
|
||||
let font_size = (line_height - 2).clamp(11, 32) as f32;
|
||||
// NOTE: This is just an approximation and was chosen based on how it looks.
|
||||
//
|
||||
// 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(
|
||||
font_family,
|
||||
|
||||
+12
-2
@@ -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
@@ -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
@@ -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));
|
||||
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user