Move the .fds check to ReadRomFile()

The filename is already beeing passed into ReadRomFile(), so just check
it in there instead of requiring IsFds to be passed separately.
This commit is contained in:
Zorchenhimer 2025-12-07 20:52:57 -05:00
parent e1b9e195cb
commit ccdb696c2d
Signed by: Zorchenhimer
GPG Key ID: 70A1AB767AAB9C20
2 changed files with 4 additions and 3 deletions

View File

@ -32,7 +32,7 @@ func main() {
}
func run(args *Arguments) error {
rom, err := fds.ReadRomFile(args.Input, filepath.Ext(args.Input) == ".fds")
rom, err := fds.ReadRomFile(args.Input)
if err != nil {
return err
}

View File

@ -7,18 +7,19 @@ import (
"bufio"
"bytes"
"encoding/binary"
"path/filepath"
"github.com/sigurn/crc16"
)
func ReadRomFile(filename string, IsFds bool) (*Rom, error) {
func ReadRomFile(filename string) (*Rom, error) {
file, err := os.Open(filename)
if err != nil {
return nil, err
}
defer file.Close()
blocks, err := ReadRomBlocks(file, IsFds)
blocks, err := ReadRomBlocks(file, filepath.Ext(filename) == ".fds")
if err != nil {
return nil, err
}