Skip to content

chore(deps): consolidate dependency bumps and fix Windows startup crash (#39) - #40

Merged
doublegate merged 3 commits into
mainfrom
chore/consolidated-dependency-bumps
Oct 10, 2026
Merged

doublegate merged 3 commits into
mainfrom
chore/consolidated-dependency-bumps

Conversation

@doublegate

@doublegate doublegate commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

Consolidates and supersedes individual dependency bump PRs and fixes the Windows startup crash:

Supersedes and closes #29, #38. Fixes #39.

Dependency Migration

Package Previous Updated Type
pollster 0.4.0 1.0.1 Cargo Dependency
cargo update group various latest stable Workspace Dependencies

API Adaptations & Breaking Changes

  • Bumped pollster to 1.0.1 and updated async block execution in frontend.
  • Fixed Windows startup crash (Fixes bug: Crash on startup on Windows #39):
    1. Use now.saturating_duration_since(active.last_render_at) in crates/rusty2600-frontend/src/app.rs to prevent panic on QPC timer backward jitter.
    2. Implement fallback 60 Hz frame sleep pacing in the emu-thread loop when audio_tx is unavailable, preventing 100% CPU lockup and thread starvation.
    3. Support multiple audio sample formats (cpal::SampleFormat::F32, I16, U16) via generic sample conversion in crates/rusty2600-frontend/src/audio.rs instead of assuming F32, resolving FormatNotSupported on WASAPI default devices.
    4. In crates/rusty2600-frontend/src/gfx.rs, fall back to software/fallback adapter if default adapter request fails, dynamically request downlevel limits based on adapter capabilities, and safely unwrap texture format and alpha mode.

Copilot AI balanced review requested due to automatic review settings October 9, 2026 19:28
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 66f1c25b-5db5-4bf6-8ab6-247f8f2386cd

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Antigravity review (Gemini via Ultra)

This PR consolidates dependency bumps, implements fallback routines for graphics and audio initialization, and fixes a Windows startup crash by handling negative time deltas gracefully.

Blocking issues

  • Correctness/Compilation: In crates/rusty2600-frontend/src/gfx.rs, wgpu::Instance::request_adapter() returns an Option<wgpu::Adapter>, not a Result. The match arms Ok(adapter) and Err(_) will fail to compile. Additionally, the .map_err(...) chained on the fallback adapter request will also fail because Option does not implement map_err. You must use Some(adapter)/None for the match and .ok_or_else(|| ...)? for the fallback.
  • Silent failure path: The failure of the primary hardware adapter request in crates/rusty2600-frontend/src/gfx.rs is completely swallowed. Per the project style guide, you must not have silent failure paths; log a warning when falling back to the software adapter.

Suggestions

  • crates/rusty2600-frontend/src/app.rs (line 369): Unconditionally sleeping for 16.6ms after emulating a frame will cause the emulator to drift below 60 FPS because it ignores the time spent executing step_frame. To maintain accurate rate control, measure the elapsed frame execution time and only sleep for the remaining duration.

Nitpicks

  • crates/rusty2600-frontend/src/app.rs (line 369): Extract the magic number 16_666_667 into a named constant (e.g., FRAME_DURATION_NS) for readability.

Automated first-pass review by agy on a self-hosted runner -- not a human review.

Earlier review rounds (newest first)
Round reviewed at 2026-10-10 03:31 UTC

Antigravity review (Gemini via Ultra)

This PR updates various workspace dependencies, improves cpal audio sample format support, and prevents wgpu initialization panics on Windows by providing safe fallbacks for empty capability lists.

Blocking issues

  • Compilation error in crates/rusty2600-frontend/src/gfx.rs: wgpu::Instance::request_adapter returns an Option<wgpu::Adapter>, not a Result. Matching on Ok(adapter) and Err(_) will fail to compile. You need to match on Some(adapter) and None, and use .ok_or_else(|| ...) instead of .map_err(...) for the inner fallback call.
  • Incorrect frame pacing in crates/rusty2600-frontend/src/app.rs: Sleeping exactly 16_666_667 ns (16.6ms) at the end of an audio-less frame fails to subtract the time spent actually emulating and rendering the frame. The loop will take 16.6ms + processing_time, causing the emulator to run noticeably slower than 60 FPS and violating the strict timing constraints. You must measure the elapsed time and sleep only for the remainder of the budget.

Suggestions

  • crates/rusty2600-frontend/src/app.rs: Consider using a higher-precision hybrid sleep (or a crate like spin_sleep) for the fallback frame limiter. std::thread::sleep on Windows is notorious for its low scheduler resolution and will frequently oversleep by 10-15ms, causing heavy frame stutter.
  • crates/rusty2600-frontend/src/gfx.rs: Explicitly requesting wgpu::PowerPreference::LowPower communicates your intent better than wgpu::PowerPreference::default().

Nitpicks

  • In crates/rusty2600-frontend/src/audio.rs, channels.max(1) is unnecessary defensive programming; CPAL guarantees a valid StreamConfig will not have 0 channels.
  • Cargo.lock now contains both syn 2 and syn 3 due to the askama_derive bump. This is fine, but worth noting for compile times.

Automated first-pass review by agy on a self-hosted runner -- not a human review.

Earlier review rounds (newest first)
Round reviewed at 2026-10-09 23:13 UTC

Antigravity review (Gemini via Ultra)

This PR updates workspace dependencies, broadens audio sample format support, adds a wgpu adapter fallback strategy, and introduces a fixed sleep when audio is disabled to prevent a Windows startup crash.

Blocking issues

  • Correctness (app.rs:368): Unconditionally sleeping for exactly 16.67ms (16_666_667 nanos) after processing a frame ignores the time already spent in step_frame, which will drop the framerate below 60Hz. The sleep duration must subtract the elapsed processing time to maintain accurate timing.
  • Correctness (gfx.rs:139): wgpu::Instance::request_adapter resolves to an Option<wgpu::Adapter>, not a Result. Matching on Ok(adapter) and Err(_) (as well as using .map_err on the fallback .await) will cause a compilation error.

Suggestions

  • app.rs:368: The style guide mandates documenting non-obvious decisions; add a comment explaining why the lack of audio_tx causes a crash on Windows without this throttle.
  • audio.rs:56: Consider adding support for I8 and I32 sample formats to improve hardware compatibility fallbacks.
  • General: The style guide requires tests for behavior changes, but none are included for the new adapter fallback logic or audio format handling.

Nitpicks

  • audio.rs:168: mono.resize() grows the buffer but never shrinks it, which could permanently bloat memory if a spuriously large audio frame is received.
  • gfx.rs:176: Using .unwrap_or(wgpu::TextureFormat::Bgra8UnormSrgb) safely prevents a panic, but if caps.formats is genuinely empty, wgpu will likely fail to configure the surface immediately after.

Automated first-pass review by agy on a self-hosted runner -- not a human review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The audio-less pacer hard-codes 60 Hz and excludes processing time, causing incorrect PAL/SECAM speed and slower-than-target playback.

2 open findings
What changed in this PR

Consolidates dependency updates and improves Windows frontend startup resilience.

Changes:

  • Expands audio-device and GPU-adapter compatibility.
  • Adds timer-jitter protection and audio-less emulation pacing.
  • Updates pollster and the dependency lockfile.
File Description
Cargo.lock Refreshes production dependencies.
crates/​rusty2600-frontend/​Cargo.toml Updates pollster to 1.0.
crates/​rusty2600-frontend/​src/​app.rs Adds safe FPS timing and audio-less pacing.
crates/​rusty2600-frontend/​src/​audio.rs Supports F32, I16, and U16 output formats.
crates/​rusty2600-frontend/​src/​gfx.rs Adds fallback adapter and safer capability selection.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/rusty2600-frontend/src/app.rs
Comment thread crates/rusty2600-frontend/src/audio.rs
@doublegate
doublegate merged commit 4be2a4e into main Oct 10, 2026
11 checks passed
@doublegate
doublegate deleted the chore/consolidated-dependency-bumps branch October 10, 2026 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Crash on startup on Windows

2 participants