Skip to content

Commit

Permalink
Added changelog + fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
OtaK committed Jul 29, 2023
1 parent a6f3e92 commit 5b9b5a4
Show file tree
Hide file tree
Showing 9 changed files with 200 additions and 49 deletions.
141 changes: 141 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# [v0.7.0] - 29/07/2023 - B0XX r3 & r4 support

## Important note

As I do not belong to the SSBM community anymore, this release is UNTESTED on real hardware

## Software

* Updated dependencies
* Added support for the new B0XX VID/PIDs (cf: <https://github.com/SimpleControllers/b0xx-input-viewer/blob/9f38bb7dc10b186299a0526ae2402d7d3d9b297d/serial.js#L17-L22>)
* **[BREAKING]** The r2 mode (with the 2 extra buttons) is now enabled by default. The `--r2` flag has been removed in favor of a `--r1` flag.
* This is because as there are now 4 revisions of the b0xx, the 1st revision is getting less and less common. This makes sense to default to the more common build.
* **[BREAKING]** The button colors file format has changed. It now uses hex colors instead of the very annoying [r, g, b] notation from before
* See [cfg/gcc.toml](cfg/gcc.toml) for an example
* **[BREAKING]** the `fake_serial` feature has been renamed to `fake_inputs`
* The performance of this mode has been multiplied by 10 as well. This results in accurate performance benchmarks now
* Fixed cross-display DPI handing. The window now updates its internal DPI correctly when moved between monitors of differing scale factors.

## Other

* With the improvement on the `fake_inputs` random inputs generation, we now have accurate performance measurements
* On a system based on a Ryzen 5950X & RTX 3080, the viewer outputs more than 5000 fps (yes).
* This is obviously disabled in a normal environment as VSync is enabled for normal releases.
* If you want to test your system's performance, you can run the code with `cargo run --features benchmark --release`

## Known issues

* Resizing the window between monitors with different scaling factors (DPI) using the title bar is not behaving well
* A fix for this is to use the `--chromeless` argument and use the Alt+Click dragging of the window to ensure moving the window works well.

## Other

* Improved & fixed CI warnings

# [v0.6.0] - 18/12/2021 - Window drag, licensing, edition 2021

## Important note

As I do not belong to the SSBM community anymore, this release is UNTESTED on real hardware

## Software

* Added Alt+Click window dragging to allow chromeless windows to be moved (#32)
* Added documentation for running the program properly on Linux without `sudo` (#30)
* Updated dependencies

## Other

* Changed license to dual Apache 2.0 / MIT (#33)
* Upgraded Rust to edition 2021 (#35)

# [v0.5.1] - 27/01/2021 - High DPI fix

## Software

* Fixed issue with handling high DPI screens
* Updated dependencies

# [v0.5.0] - 28/12/2020 - Button rims

## Software

* Added support for button rims coloring #24
* Updated dependencies

# [v0.4.6] - 17/11/2020 - Dual logger

## Software

* Added dual logger to have a text .log file (in the same folder b0xx-viewer is ran from) to still get logs/diagnostics in case of a crash.

# [v0.4.5] - 01/11/2020 - Button layout fix

## Software

* A long awaited fix to the button layout, making it more accurate as per the official B0XX blueprint.

# [v0.4.4] - 01/11/2020 - Performance and fixes

## Software

* Fixed performance issues by increasing it threefold (3f837eb)
* Changed CLI documentation thanks to feedback (thx Pipsqueak)

# [v0.4.3] - 30/10/2020 - Bugfix in CPU-bound situations

## Software

* Fixed an issue where, in high-CPU pressure situations, the buffer would shift forward and render incorrect button presses.

# [v0.4.2] - 20/10/2020 - Maintenance

## Software

* Update dependencies

# [v0.4.1] - 29/09/2020 - Support for r2 b0xx

## Software

* Fixes for configuration loading issues
* Added support for B0XX r2

# [v0.3.1] - 19/08/2020 - Bug fixes and dependencies updates

## Software

* Fixed a configuration issue where optional values wouldn't be parsed correctly
* Added exponential backoff for reconnection
* Removed `failure` in favor of `thiserror`

# [v0.3.0] - 27/11/2019 - Performance & QoL

## Software

* Fixed general performance, see #12 and #13
* Added a reconnection overlay UI, for the user to see if connection has been lost instead of just freezing
* Fixed Windows-specific buffer alignment bug, see #14 & #15
* Fixed label alignment within buttons in the UI
* Added partial support for B0XX r2
* Documentation improvements

# [v0.2.0] - 24/11/2019 - Support for UI config

## Software

* Added support for configuration files
* Added support for button colors & labels (active/inactive setting). You can find a sample config for colors mimicking a Gamecube Controller in the cfg folder. Other samples will be there.
* Added support for chromeless window. Sometimes having a chrome around the window doesn't play well with some recording/streaming software so I added the option to disable window decorations.
* Added support for relaxed Arduino detection. Useful especially for DIY B0XX devices that rely not only on Arduino Leonardo but other 16MHz MCUs.
* Added support of a custom TTY/COM port directive to force the software to connect to that port, bypassing completely autodetection.
* Small patches/optimizations here and there.

## Other

* Added continuous integration with GitHub actions. Any pull request/commit will be built on all 3 platforms (Windows, macOS, Linux), ensuring that nothing breaks too hard.
* Added automatic binary building and releasing with GitHub Actions for when I create a GitHub release. The following binaries were built with this system.

# [v0.1.0] - 10/06/2019

* Initial Public release
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "b0xx-viewer-rs"
version = "0.6.0"
version = "0.7.0"
authors = ["Mathieu Amiot <amiot.mathieu@gmail.com>"]
description = "GUI Viewer for B0XX controllers; particularly useful for streaming"
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2021 Mathieu Amiot
Copyright 2023 Mathieu Amiot

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
Expand Down
56 changes: 31 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,37 @@ Try launching the executable with `--help` to get all the current options
Note: This will not work on Windows because of platform restrictions

```text
b0xx_viewer 0.6.0
Mathieu Amiot <amiot.mathieu@gmail.com>
GUI Viewer for B0XX controllers; particularly useful for streaming
USAGE:
b0xx_viewer [FLAGS] [OPTIONS]
FLAGS:
--chromeless Makes the window chromeless
--colored_rims Enables an alternative mode of inactive button coloring; Makes inactive button
background neutral in favor of button rims instead.
-h, --help Prints help information
--init_config Intializes an empty configuration in the executable's folder
-l, --labels Enable button labels
--r2 Enables B0XX r2 mode to account for the 2 extra buttons
--relax_arduino_detection Relaxes B0XX detection to allow any 16MHz Arduino-compatible device to connect
-V, --version Prints version information
OPTIONS:
-b, --background <bg_color> Sets a custom background color in hex format, eg. "#00FF00"
-a, --active <btn_active_color> Sets a custom color for pressed/active buttons in hex format, eg. "#00FF00"
-i, --inactive <btn_inactive_color> Sets a custom color for inactive buttons in hex format, eg. "#00FF00"
-c, --config <config> Sets the configuration file path
--tty <tty> Provide a custom COM port (Windows-only) or a /dev/ttyXXX path (Unix).
Bypasses auto-detection, so proceed at your own risk!
Usage: b0xx_viewer.exe [OPTIONS]
Options:
--init-config
Intializes an empty configuration in the executable's folder
-d, --labels
Enable button labels
--chromeless
Makes the window chromeless (i.e. removes window decorations such as titlebar, minimize/close buttons etc)
--r1
Enables B0XX r1 mode to remove the 2 extra buttons
--colored-rims
Enables an alternative mode of inactive button coloring; Makes inactive button background neutral in favor of button rims instead
--relax-arduino-detection
Relaxes B0XX detection to allow any 16MHz Arduino-compatible device to connect
-c, --config <CONFIG_PATH>
Sets the configuration file path
-b, --background <BACKGROUND_COLOR>
Sets a custom background color in hex format, eg. "#00FF00" [default: #131313]
-a, --active <BUTTON_ACTIVE_COLORS>
Sets a custom color for pressed/active buttons in hex format, eg. "#00FF00" [default: #00EBFF]
-i, --inactive <BUTTON_INACTIVE_COLORS>
Sets a custom color for inactive buttons in hex format, eg. "#00FF00" [default: #555753]
--tty <CUSTOM_TTY>
Provide a custom COM port (Windows-only) or a /dev/ttyXXX path (Unix). Bypasses auto-detection, so proceed at your own risk!
-h, --help
Print help
-V, --version
Print version
```

Expand All @@ -82,11 +88,11 @@ Prequisites:

Just `cargo build --release` and you should be good to go

### Fake Serial Mode / Dev mode
### Fake Inputs Mode / Dev mode

There's a special feature that you can activate when building/running like so:

`cargo {run|build} --features fake_serial [--release]`
`cargo {run|build} --features fake_inputs [--release]`

It'll simulate state reports with completely random ones spaced by 170ms.

Expand Down
11 changes: 5 additions & 6 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ pub struct ViewerOptions {
#[arg(long)]
#[serde(default)]
pub chromeless: bool,
/// Enables B0XX r2 mode to account for the 2 extra buttons
#[arg(long = "r2")]
/// Enables B0XX r1 mode to remove the 2 extra buttons
#[arg(long = "r1")]
#[serde(default)]
pub is_r2_b0xx: bool,
pub is_r1_b0xx: bool,
/// Enables an alternative mode of inactive button coloring; Makes inactive button background neutral in favor of button rims instead.
#[arg(long)]
#[serde(default)]
Expand Down Expand Up @@ -66,7 +66,6 @@ pub struct ViewerOptions {
pub custom_tty: Option<String>
}


impl Default for ViewerOptions {
fn default() -> Self {
Self {
Expand All @@ -78,7 +77,7 @@ impl Default for ViewerOptions {
button_inactive_colors: ViewerButtonColors::new_with_color(DEFAULT_INACTIVE_COLOR),
button_active_colors: ViewerButtonColors::new_with_color(DEFAULT_ACTIVE_COLOR),
custom_tty: None,
is_r2_b0xx: false,
is_r1_b0xx: false,
colored_rims: false,
config_path: None,
path: Default::default(),
Expand Down Expand Up @@ -172,7 +171,7 @@ impl ViewerOptions {
pub fn merge(&mut self, other: Self) {
self.display_labels |= other.display_labels;
self.chromeless |= other.chromeless;
self.is_r2_b0xx |= other.is_r2_b0xx;
self.is_r1_b0xx |= other.is_r1_b0xx;
self.colored_rims |= other.colored_rims;
self.relax_arduino_detection |= other.relax_arduino_detection;

Expand Down
15 changes: 7 additions & 8 deletions src/serial_probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,13 @@ pub fn start_serial_probe(
if std::env::var("RELAX_ARDUINO_DETECT").is_ok() {
log::info!("{:#?}", *ARDUINO_WHITELIST)
}
std::thread::spawn(move || {
use rand::SeedableRng as _;
let mut rng = rand::rngs::SmallRng::from_entropy();
loop {
let _ = tx.send(B0xxMessage::State(B0xxState::random(&mut rng)));
#[cfg(not(feature = "benchmark"))]
std::thread::sleep(std::time::Duration::from_micros(16670));
}
use rand::SeedableRng as _;
let mut rng = rand::rngs::SmallRng::from_entropy();
let sleep_dur = std::time::Duration::from_micros(8700);
std::thread::spawn(move || loop {
let _ = tx.send(B0xxMessage::State(B0xxState::random(&mut rng)));
#[cfg(not(feature = "benchmark"))]
std::thread::sleep(sleep_dur);
});

Ok(rx)
Expand Down
2 changes: 1 addition & 1 deletion src/ui/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ pub fn render_gui(
.set(ids.c_down_label, ui);
}

if options.is_r2_b0xx {
if !options.is_r1_b0xx {
let (btn, mut m_text) = make_button(
app.state.mod_ls,
ids.frame,
Expand Down
18 changes: 12 additions & 6 deletions src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ pub fn start_gui(mut rx: crossbeam_channel::Receiver<B0xxMessage>, options: View
let display = glium::Display::new(window, context, &events_loop).unwrap();
let display = GliumDisplayWinitWrapper(display);

let mut scale_factor = display.0.gl_window().window().scale_factor();

// Construct our `Ui`.
let mut ui = conrod_core::UiBuilder::new([WIN_W as f64, WIN_H as f64])
.theme(gui::theme())
Expand Down Expand Up @@ -187,25 +189,29 @@ pub fn start_gui(mut rx: crossbeam_channel::Receiver<B0xxMessage>, options: View
} if app.is_draggable => {
app.is_dragged = state == glium::glutin::event::ElementState::Pressed;
},
glium::glutin::event::WindowEvent::ScaleFactorChanged { scale_factor: new_scale_factor, .. } => {
scale_factor = new_scale_factor;
},
_ => {}
},
glium::glutin::event::Event::DeviceEvent {
event: glium::glutin::event::DeviceEvent::MouseMotion { delta: (dx, dy)},
event: glium::glutin::event::DeviceEvent::MouseMotion { delta: (dx, dy) },
..
} if app.is_dragged => {
let prev_pos = display.0
.gl_window()
.window()
.outer_position()
.unwrap_or_else(|_| glium::glutin::dpi::PhysicalPosition::new(0, 0));
.unwrap_or_else(|_| glium::glutin::dpi::PhysicalPosition::new(0, 0))
.to_logical::<f64>(scale_factor);

display.0
.gl_window()
.window()
.set_outer_position(glium::glutin::dpi::PhysicalPosition::new(
prev_pos.x as f64 + dx,
prev_pos.y as f64 + dy,
));
.set_outer_position(glium::glutin::dpi::LogicalPosition::new(
prev_pos.x + dx,
prev_pos.y + dy,
).to_physical::<f64>(scale_factor));
},
_ => {}
}
Expand Down

0 comments on commit 5b9b5a4

Please sign in to comment.