Skip to content

Commit

Permalink
Fix encoding in recalls
Browse files Browse the repository at this point in the history
  • Loading branch information
RinatNamazov committed Feb 10, 2024
1 parent 81d204d commit 543b2b1
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 37 deletions.
200 changes: 165 additions & 35 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ LegalCopyright = "Copyright © 2023-2024 RINWARES, Rinat Namazov"
vmt-hook = "0.2.0"
egui = "0.25.0"
egui-d3d9 = { version = "0.3.7", git = "https://github.com/RinatNamazov/egui-d3d9" }
local-encoding = "0.2.0"

[dependencies.windows]
version = "0.52.0"
Expand Down
1 change: 0 additions & 1 deletion rustfmt.toml

This file was deleted.

3 changes: 2 additions & 1 deletion src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use egui::{
RichText, Rounding, Sense, TextStyle,
};
use std::ffi::CStr;
use local_encoding::{Encoder, Encoding};

pub struct Ui {
cmds_height: f32,
Expand Down Expand Up @@ -261,7 +262,7 @@ impl Ui {
ui.indent(ui.id(), |ui| {
for i in 0..input.total_recall as usize {
if let Ok(recall) = CStr::from_bytes_until_nul(&input.recall_buffer[i]) {
if let Ok(text) = recall.to_str() {
if let Ok(text) = Encoding::ANSI.to_string(recall.to_bytes_with_nul()) {
let text =
if input.current_recall == -1 || i == input.current_recall as usize {
RichText::new(text)
Expand Down

0 comments on commit 543b2b1

Please sign in to comment.