Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 38 additions & 18 deletions Cargo.lock

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

10 changes: 9 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
[workspace]
members = ["windows-gaming", "vfio-ubind", "windows-edge-grab"]
members = [
"windows-gaming",
"vfio-ubind",
"windows-edge-grab",
"windows-gaming/config", # FIXME: use this somewhere instead of listing it here
]

[replace]
"enum_derive:0.1.7" = { git = "https://github.com/main--/rust-custom-derive.git", branch = "trait" }
1 change: 0 additions & 1 deletion windows-gaming/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ time = "0.1.37"
clap = "2.26"
common = { path = "common" }
driver = { path = "driver" }
wizard = { path = "wizard" }
2 changes: 2 additions & 0 deletions windows-gaming/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ serde = "1.0"
serde_derive = "1.0"
serde_yaml = "0.7"
libudev = "0.2.0"
enum_derive = "0.1"
macro-attr = "0.2"
17 changes: 14 additions & 3 deletions windows-gaming/common/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,21 @@ impl Default for SoundSettings {
}
}

#[derive(Deserialize, Serialize, Debug, Clone)]
macro_attr! {
#[derive(Deserialize, Serialize, Debug, Clone, EnumDisplay!, EnumFromStr!, IterVariantNames!(SoundFormats))]
pub enum SoundFixedFormat {
U8, S8, U16, S16, U32, S32
}
}

impl Default for SoundFixedFormat {
fn default() -> SoundFixedFormat { SoundFixedFormat::S16 }
}

#[derive(Deserialize, Serialize, Debug, Clone, Default)]
pub struct SoundFixedSettings {
pub frequency: usize,
pub format: String,
pub format: SoundFixedFormat,
pub channels: usize,
}

Expand Down Expand Up @@ -263,7 +274,7 @@ pub struct NetworkConfig {
pub bridges: Vec<String>, // TODO: custom usernet
}

#[derive(Deserialize, Serialize, Debug, Clone)]
#[derive(Deserialize, Serialize, Debug, Clone, Default)]
pub struct SambaConfig {
pub user: String,
pub path: String,
Expand Down
5 changes: 3 additions & 2 deletions windows-gaming/common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
extern crate toml;
extern crate serde;
#[macro_use]
extern crate serde_derive;
#[macro_use] extern crate serde_derive;
extern crate serde_yaml;
extern crate libudev;
#[macro_use] extern crate macro_attr;
#[macro_use] extern crate enum_derive;

pub mod hotkeys;
pub mod config;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "wizard"
name = "config"
version = "0.1.0"
authors = ["main() <[email protected]>"]

[dependencies]
libudev = "0.2.0"
num_cpus = "1.2.0"
common = { path = "../common" }
driver = { path = "../driver" }
enum_derive = "0.1"
7 changes: 7 additions & 0 deletions windows-gaming/config/src/initramfs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use std::process::Command;

pub fn run_mkinitcpio() -> bool {
let status = Command::new("/usr/bin/sudo").arg("/usr/bin/mkinitcpio")
.arg("-p").arg("linux").status().expect("Failed to run mkinitcpio");
status.success()
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,16 @@ use libudev::{Context, Enumerator};

use common::config::{SetupConfig, MachineConfig};
use common::pci_device::PciDevice;
use ask;

pub fn enable(setup: &mut SetupConfig) -> bool {
println!("Step 1: Enable IOMMU");
println!("It's as simple as adding 'intel_iommu=on' or 'amd_iommu=on' to your kernel command line.");
println!("Do this now, then continue here. Don't reboot yet, there's more we need to configure.");
println!();
if is_enabled() {
if ask::yesno("IOMMU is already enabled. Do you want to skip this step?") {
return true;
}
}
if setup.iommu_commanded {
println!("Troubleshooting (since you apparently already did this):");
println!("This is a kernel parameter, so it won't be active before you reboot. But if you already did that, \
the kernel fails to enable it for some reason. IOMMU (aka VT-d) is disabled by default on many \
mainboards, please check your firmware settings to make sure it's enabled. If that doesn't work \
it's possible that your hardware just doesn't support it. If that's the reason, you're out of luck \
though. IOMMU is a critical component of this setup and there's no way it can work without that. Sorry.");
}

if !ask::yesno("Done?") {
println!("Aborted.");
return false;
}
setup.iommu_commanded = true;
println!();
true
}

pub fn is_enabled() -> bool {
fs::read_dir("/sys/devices/virtual/iommu/").ok().and_then(|mut x| x.next()).is_some()
}

// FIXME: rewrite this
pub fn check_grouping(machine: &MachineConfig) -> Result<bool> {
unimplemented!();

/*
let udev = Context::new().expect("Failed to create udev context");
let first_id = machine.pci_devices[0].id; // FIXME
let mut iter = Enumerator::new(&udev)?;
Expand Down Expand Up @@ -92,5 +67,6 @@ pub fn check_grouping(machine: &MachineConfig) -> Result<bool> {

// FIXME assert!(setup.vfio_devs.iter().cloned().eq(related_devices.iter().cloned()));
Ok(true)
*/
}

Loading