add vbios extration page
This commit is contained in:
parent
9dc81bd568
commit
b033a787b8
4 changed files with 68 additions and 1 deletions
|
@ -86,6 +86,7 @@ func viewGPU(id string, ext ...int) {
|
||||||
|
|
||||||
case "y":
|
case "y":
|
||||||
// Go to the select a usb controller
|
// Go to the select a usb controller
|
||||||
selectUSB()
|
//selectUSB()
|
||||||
|
genVBIOS_dumper(id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
50
internal/pages/03_vbios_extract.go
Normal file
50
internal/pages/03_vbios_extract.go
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
package pages
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/HikariKnight/quickpassthrough/pkg/command"
|
||||||
|
"github.com/HikariKnight/quickpassthrough/pkg/menu"
|
||||||
|
)
|
||||||
|
|
||||||
|
func genVBIOS_dumper(id string) {
|
||||||
|
// Clear the scren
|
||||||
|
command.Clear()
|
||||||
|
|
||||||
|
// Get the program directory
|
||||||
|
exe, _ := os.Executable()
|
||||||
|
scriptdir := filepath.Dir(exe)
|
||||||
|
|
||||||
|
// If we are using go run use the working directory instead
|
||||||
|
if strings.Contains(scriptdir, "/tmp/go-build") {
|
||||||
|
scriptdir, _ = os.Getwd()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the vbios path
|
||||||
|
//vbios_path := lsiommu.GetIOMMU("-g", "-i", id, "--rom")[0]
|
||||||
|
|
||||||
|
// Tell users about the VBIOS dumper script
|
||||||
|
fmt.Print(
|
||||||
|
"For some GPUs, you will need to dump the VBIOS and pass the\n",
|
||||||
|
"rom to the VM along with the card in order to get a functional passthrough.\n",
|
||||||
|
"In many cases you can find your vbios at https://www.techpowerup.com/vgabios/\n",
|
||||||
|
"\n",
|
||||||
|
"You can also attempt to dump your own vbios using the script in\n",
|
||||||
|
fmt.Sprintf("%s/utils/dump_vbios.sh\n", scriptdir),
|
||||||
|
"\n",
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get the OK press
|
||||||
|
choice := menu.Ok("Make sure you run the script with the display-manager stopped using ssh or tty!")
|
||||||
|
|
||||||
|
// If OK is pressed
|
||||||
|
if choice == "next" {
|
||||||
|
selectUSB()
|
||||||
|
} else {
|
||||||
|
fmt.Println("")
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
}
|
16
pkg/menu/ok.go
Normal file
16
pkg/menu/ok.go
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
package menu
|
||||||
|
|
||||||
|
import "github.com/nexidian/gocliselect"
|
||||||
|
|
||||||
|
// Make a YesNo menu
|
||||||
|
func Ok(msg string) string {
|
||||||
|
// Make the menu
|
||||||
|
menu := gocliselect.NewMenu(msg)
|
||||||
|
menu.AddItem("OK", "next")
|
||||||
|
|
||||||
|
// Display the menu
|
||||||
|
choice := menu.Display()
|
||||||
|
|
||||||
|
// Return the value selected
|
||||||
|
return choice
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue