[rom] Add NoAudio option to export

Added an option to exclude the audio file from the unpacked rom data.
This commit is contained in:
Zorchenhimer 2025-09-06 22:45:33 -04:00
parent 5a001931e7
commit 1ebe698ac4
Signed by: Zorchenhimer
GPG Key ID: 70A1AB767AAB9C20
1 changed files with 6 additions and 4 deletions

View File

@ -6,7 +6,7 @@ import (
"os" "os"
) )
func (sb *StudyBox) Export(directory string) error { func (sb *StudyBox) Export(directory string, includeAudio bool) error {
sbj := StudyBoxJson{ sbj := StudyBoxJson{
Version: 1, Version: 1,
Pages: []jsonPage{}, Pages: []jsonPage{},
@ -133,10 +133,12 @@ func (sb *StudyBox) Export(directory string) error {
return fmt.Errorf("Missing audio!") return fmt.Errorf("Missing audio!")
} }
if includeAudio {
err := sb.Audio.WriteToFile(directory + "/audio") err := sb.Audio.WriteToFile(directory + "/audio")
if err != nil { if err != nil {
return fmt.Errorf("Error writing audio file: %v", err) return fmt.Errorf("Error writing audio file: %v", err)
} }
}
rawJson, err := json.MarshalIndent(sbj, "", " ") rawJson, err := json.MarshalIndent(sbj, "", " ")
if err != nil { if err != nil {