sqlite3 的問題已解決, 感謝!
在 QEMU 調用 sysinfo::Motherboard::new() 會發生 panic 而結束, 所以把空白的名稱當作是 VM 無法解決問題.
ChatGPT 說可以用 cpuid 判斷, 在 VMware, QEMU, VirtualBox 測試 OK.
不過軟體繪圖有 bug, 自動檢查更新的選單會變成空白:
這裡提供從 ChatGPT 問來的 patch 給您參考, 我沒寫過 Rust, 不確定有沒有問題.
加 -no_vm 參數可以關閉 VM 偵測, 然後用 opengl32.dll 模擬 GL 就沒問題, 速度也快很多.
diff --git a/editor/Cargo.toml b/editor/Cargo.toml
index f4197ac..1913f5c 100644
--- a/editor/Cargo.toml
+++ b/editor/Cargo.toml
@@ -12,6 +12,7 @@ rfd = { version = "0.15.4", default-features = false }
sysinfo = "0.37.0"
win_dbg_logger = "0.1.0"
winit = "0.30.11"
+raw-cpuid = "11"
[dependencies.slint]
version = "1.8.0"
diff --git a/editor/src/
main.rs b/editor/src/
main.rsindex 0142c1e..8acbe23 100644
--- a/editor/src/
main.rs+++ b/editor/src/
main.rs@@ -20,10 +20,19 @@ fn main() -> anyhow::Result<()> {
Ok(())
}
+use raw_cpuid::CpuId;
fn is_vm() -> bool {
- if let Some(mb) = sysinfo::Motherboard::new() {
- let name =
mb.name().unwrap_or_default();
- return matches!(name.as_str(), "Virtual Machine" | "");
+ if std::env::args().any(|arg| arg == "-no_vm") {
+ return false;
+ }
+
+ let cpuid = CpuId::new();
+ if let Some(feat) = cpuid.get_feature_info() {
+ if let Some(hv) = cpuid.get_hypervisor_info() {
+ dbg!(hv.identify());
+ }
+ feat.has_hypervisor()
+ } else {
+ false
}
- true
}
diff --git a/preferences/Cargo.toml b/preferences/Cargo.toml
index 5aa3c11..751b108 100644
--- a/preferences/Cargo.toml
+++ b/preferences/Cargo.toml
@@ -21,6 +21,7 @@ winit = "0.30.11"
sysinfo = "0.37.0"
rfd = { version = "0.15.4", default-features = false }
toml = "0.9.5"
+raw-cpuid = "11"
[dependencies.slint]
version = "1.8.0"
diff --git a/preferences/src/
main.rs b/preferences/src/
main.rsindex 1afdc0f..ff776e4 100644
--- a/preferences/src/
main.rs+++ b/preferences/src/
main.rs@@ -28,10 +28,19 @@ fn main() -> anyhow::Result<()> {
Ok(())
}
+use raw_cpuid::CpuId;
fn is_vm() -> bool {
- if let Some(mb) = sysinfo::Motherboard::new() {
- let name =
mb.name().unwrap_or_default();
- return matches!(name.as_str(), "Virtual Machine" | "");
+ if std::env::args().any(|arg| arg == "-no_vm") {
+ return false;
+ }
+
+ let cpuid = CpuId::new();
+ if let Some(feat) = cpuid.get_feature_info() {
+ if let Some(hv) = cpuid.get_hypervisor_info() {
+ dbg!(hv.identify());
+ }
+ feat.has_hypervisor()
+ } else {
+ false
}
- true
}
Kan-Ru Chen 在 2025年8月31日 星期日晚上11:31:32 [UTC+8] 的信中寫道: