mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-11-16 15:27:46 +00:00
windows/pty: include static [VCRUNTIME140.dll], change PTY size
Bare metal windows was complaining about this DLL, so it is now included statically using [https://docs.rs/static_vcruntime/]. I tried statically linking everything for Windows but: 1. It's not necessary, pretty much all DLLs needed (except this one) are included in Windows 7+ by default 2. It's a pain in the ass to build everything statically, especially since Gupax needs OpenSSL. (building OpenSSL on Windows == hell) Windows/macOS were having console artifacts, escape codes and random newlines would show up in P2Pool/XMRig output. After thinking about it for a while, I realized I left the PTY size to the default [24 rows/80 columns], hence the PTYs prematurely inserting newlines and weird escape codes. It works fine after setting it to [100/1000]. Interestingly, Linux worked completely fine on 24/80, probably resizes internally.
This commit is contained in:
parent
929d80c61d
commit
4da775667b
5 changed files with 16 additions and 7 deletions
|
@ -21,6 +21,7 @@ dirs = "4.0.0"
|
|||
eframe = "0.19.0"
|
||||
egui = "0.19.0"
|
||||
egui_extras = { version = "0.19.0", features = ["image"] }
|
||||
#--------------------------------------------------------------------------------
|
||||
## [external/egui/crates/eframe/src/native/run.rs] line 41: [.with_srgb(true)]
|
||||
## This line causes a [panic!] inside a Windows VM, from a Linux host.
|
||||
## There are many issue threads and PRs to fix it but for now,
|
||||
|
@ -30,6 +31,7 @@ egui_extras = { version = "0.19.0", features = ["image"] }
|
|||
#egui = { path = "external/egui/crates/egui" }
|
||||
#egui_glow = { path = "external/egui/crates/egui_glow"}
|
||||
#egui_extras = { path = "external/egui/crates/egui_extras", features = ["image"] }
|
||||
#--------------------------------------------------------------------------------
|
||||
env_logger = "0.9.1"
|
||||
figment = { version = "0.10.8", features = ["toml"] }
|
||||
hyper = "0.14.20"
|
||||
|
@ -66,6 +68,7 @@ is_elevated = "0.1.2"
|
|||
# For Windows build (icon)
|
||||
[target.'cfg(windows)'.build-dependencies]
|
||||
winres = "0.1.12"
|
||||
static_vcruntime = "2.0"
|
||||
|
||||
# For macOS build (cargo-bundle)
|
||||
[package.metadata.bundle]
|
||||
|
|
5
build.rs
5
build.rs
|
@ -5,8 +5,13 @@
|
|||
// pre-compiled bytes using [include_bytes!()] on the images in [images/].
|
||||
#[cfg(windows)]
|
||||
fn main() -> std::io::Result<()> {
|
||||
static_vcruntime::metabuild();
|
||||
let mut res = winres::WindowsResource::new();
|
||||
// This sets the icon.
|
||||
res.set_icon("images/icons/icon.ico");
|
||||
// This sets the [Run as Administrator] metadata flag for Windows.
|
||||
// Why do I do this?: [https://github.com/hinto-janaiyo/gupax/tree/main/src#why-does-gupax-need-to-be-admin-on-windows]
|
||||
// TL;DR: Because Windows.
|
||||
res.set_manifest(r#"
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
|
|
|
@ -205,4 +205,4 @@ Depending on the privilege used, Gupax will error/panic:
|
|||
- Windows: If not admin, warn the user about potential lower XMRig hashrate
|
||||
- Unix: IF admin, panic! Don't allow anything. As it should be.
|
||||
|
||||
If you're reading this and have a solution (that isn't using Win32) then please, please, teach me.
|
||||
If you're reading this and have a solution (that isn't using Win32), please... please teach me.
|
||||
|
|
|
@ -411,8 +411,8 @@ impl Helper {
|
|||
// 1a. Create PTY
|
||||
let pty = portable_pty::native_pty_system();
|
||||
let pair = pty.openpty(portable_pty::PtySize {
|
||||
rows: 24,
|
||||
cols: 80,
|
||||
rows: 100,
|
||||
cols: 1000,
|
||||
pixel_width: 0,
|
||||
pixel_height: 0,
|
||||
}).unwrap();
|
||||
|
@ -703,8 +703,8 @@ impl Helper {
|
|||
// 1a. Create PTY
|
||||
let pty = portable_pty::native_pty_system();
|
||||
let pair = pty.openpty(portable_pty::PtySize {
|
||||
rows: 24,
|
||||
cols: 80,
|
||||
rows: 100,
|
||||
cols: 1000,
|
||||
pixel_width: 0,
|
||||
pixel_height: 0,
|
||||
}).unwrap();
|
||||
|
|
|
@ -345,8 +345,9 @@ impl App {
|
|||
|
||||
// Check for privilege. Should be Admin on [Windows] and NOT root on Unix.
|
||||
#[cfg(target_os = "windows")]
|
||||
if !is_elevated::is_elevated() {
|
||||
app.admin = false;
|
||||
if is_elevated::is_elevated() {
|
||||
app.admin = true;
|
||||
} else {
|
||||
error!("Windows | Admin user not detected!");
|
||||
app.error_state.set(format!("Gupax was not launched as Administrator!\nBe warned, XMRig might have less hashrate!"), ErrorFerris::Sudo, ErrorButtons::WindowsAdmin);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue