move vbios_dumper into configs

This commit is contained in:
HikariKnight 2023-04-10 02:22:47 +02:00
parent 42a017a58b
commit 86b5ce77e6
3 changed files with 19 additions and 14 deletions

View file

@ -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")

View file

@ -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++

View file

@ -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,
),
),
)