diff --git a/internal/gen_vbios_dumper.go b/internal/configs/config_vbios_dumper.go similarity index 78% rename from internal/gen_vbios_dumper.go rename to internal/configs/config_vbios_dumper.go index 942793d..364361c 100644 --- a/internal/gen_vbios_dumper.go +++ b/internal/configs/config_vbios_dumper.go @@ -1,4 +1,4 @@ -package internal +package configs import ( "fmt" @@ -7,15 +7,11 @@ import ( "strings" "github.com/HikariKnight/ls-iommu/pkg/errorcheck" - "github.com/HikariKnight/quickpassthrough/internal/configs" ) -func generateVBIOSDumper(m model) { - // Get the vbios path - m.vbios_path = getIOMMU("-g", "-i", m.gpu_group, "--rom")[0] - +func GenerateVBIOSDumper(vbios_path string) { // Get the config directories - config := configs.GetConfigPaths() + config := GetConfig() // Get the program directory exe, _ := os.Executable() @@ -37,11 +33,11 @@ func generateVBIOSDumper(m model) { vbios_script := fmt.Sprintf( vbios_script_template, - m.vbios_path, - m.vbios_path, + vbios_path, + vbios_path, scriptdir, - config.QUICKEMU, - m.vbios_path, + config.Path.QUICKEMU, + vbios_path, ) scriptfile, err := os.Create("utils/dump_vbios.sh") diff --git a/internal/ui_main_functions.go b/internal/ui_main_functions.go index 4240456..60cc193 100644 --- a/internal/ui_main_functions.go +++ b/internal/ui_main_functions.go @@ -32,8 +32,11 @@ func (m *model) processSelection() bool { m.focused++ case GPU_GROUP: + // Get the vbios path + m.vbios_path = getIOMMU("-g", "-i", m.gpu_group, "--rom")[0] + // Generate the VBIOS dumper script once the user has selected a GPU - generateVBIOSDumper(*m) + configs.GenerateVBIOSDumper(m.vbios_path) // Change focus to the next view m.focused++ diff --git a/internal/ui_main_view.go b/internal/ui_main_view.go index 53de41a..f9a6e0c 100644 --- a/internal/ui_main_view.go +++ b/internal/ui_main_view.go @@ -73,11 +73,17 @@ func (m model) View() string { "Passing a VBIOS rom to the card used for passthrough is required for some cards, but not all.\n", "Some cards also requires you to patch your VBIOS romfile, check online if this is neccessary for your card!\n", "The VBIOS will be read from:\n", - "%s\n\n", + fmt.Sprintf( + "%s\n\n", + m.vbios_path, + ), "The script to extract the vbios has to be run as sudo and without a displaymanager running for proper dumping!\n", "\n", "You can run the script with:\n", - "%s/utils/dump_vbios.sh", + fmt.Sprintf( + "%s/utils/dump_vbios.sh", + scriptdir, + ), ), )