Skip to content

Commit 0a83bde

Browse files
committed
fix(assets): resolve side view via depot-keyed manifest + regression tests + docs
1 parent 402ae8d commit 0a83bde

4 files changed

Lines changed: 32 additions & 4 deletions

File tree

‎crates/openlogi-assets/src/http.rs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,18 @@ mod tests {
408408
assert_eq!(std::fs::read(&dst).expect("read back"), b"two");
409409
}
410410

411+
#[test]
412+
fn write_replace_creates_nested_parents() {
413+
// Regression: nested asset paths (e.g. `images/device/side_hero.png`)
414+
// must have their parent directories created on write.
415+
let dir = tempfile::tempdir().expect("create temp dir");
416+
let dst = dir.path().join("images/device/side_hero.png");
417+
418+
write_replace(&dst, b"payload").expect("nested write");
419+
420+
assert_eq!(std::fs::read(&dst).expect("read back"), b"payload");
421+
}
422+
411423
#[cfg(unix)]
412424
#[test]
413425
fn write_replace_replaces_a_planted_symlink_instead_of_following_it() {

‎crates/openlogi-cli/src/cmd/assets/sync.rs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,15 @@ mod is_optional_asset_tests {
171171
assert!(is_optional_asset("side.png"));
172172
}
173173

174+
#[test]
175+
fn nested_side_render_is_optional() {
176+
// Regression: depots that store the side render under a nested path
177+
// (e.g. `images/device/side_hero.png`) must still be treated as
178+
// optional side renders, otherwise they are never fetched.
179+
assert!(is_optional_asset("images/device/side_hero.png"));
180+
assert!(is_optional_asset("images/device/side_riot.png"));
181+
}
182+
174183
#[test]
175184
fn colour_variant_names_are_optional() {
176185
assert!(is_optional_asset("front_ext1.png"));

‎crates/openlogi-desktop/src/services/assets.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,8 @@ fn resolve_side_view(
180180
// render uses (which include the depot name), so depots that key their
181181
// manifest variants on the depot name rather than a registry model id
182182
// still resolve.
183-
let variant = manifest.and_then(|m| {
184-
find_variant_in_manifest(m, entry, depot, extended_model_id, side_image_for)
185-
});
183+
let variant = manifest
184+
.and_then(|m| find_variant_in_manifest(m, entry, depot, extended_model_id, side_image_for));
186185
let (image_path, (png_width, png_height)) = variant
187186
.into_iter()
188187
.chain(["side.png".to_string()])
@@ -431,7 +430,8 @@ impl AssetResolver {
431430
debug!(depot, root = %root.display(), "depot ships no hotspot metadata — rendering image without hotspots");
432431
Metadata::default()
433432
};
434-
let side_view = resolve_side_view(&dir, depot, entry, manifest.as_ref(), ext, &metadata);
433+
let side_view =
434+
resolve_side_view(&dir, depot, entry, manifest.as_ref(), ext, &metadata);
435435
let image_path = main_view(image_path, side_view.as_ref(), hero_image_path.as_ref());
436436
let (png_width, png_height) = match read_png_dimensions(&image_path) {
437437
Ok(dims) => dims,

‎docs/CONFIGURATION.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,13 @@ that mouse has no adjustable DPI; DPI presets saved for it are ignored. This
505505
makes the MX Ergo's precision button work with its default binding. On a mouse
506506
with adjustable DPI, `CycleDpiPresets` keeps cycling the DPI presets.
507507

508+
G502 HERO (wired, `046d:c08b`) ships no stock DPI presets in OpenLogi, so
509+
its `PreviousDpiPreset` / `NextDpiPreset` buttons do nothing until you save at
510+
least two DPI presets in `config.toml` (or use `CycleDpiPresets`'s default).
511+
Its remappable buttons (wheel click, back, forward, G6–G9, both wheel tilts)
512+
work in host mode; primary clicks are not reassignable. The G6 (sniper) button
513+
is DPI Shift by default.
514+
508515
A mouse with a DPI LED (HID++ `0x1300`), such as the MX Ergo, shows the mode
509516
on that LED, as in Logi Options+. The LED lights when precision mode starts
510517
and goes dark when it ends. OpenLogi takes control of the LED from the

0 commit comments

Comments
 (0)