mirror of
https://github.com/ivanizag/izapple2.git
synced 2024-06-07 16:46:34 +00:00
Replace vfsgen with go embed
This commit is contained in:
parent
cc7f4678a8
commit
f28dbdaa1c
|
@ -4,7 +4,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/ivanizag/iz6502"
|
"github.com/ivanizag/iz6502"
|
||||||
"github.com/ivanizag/izapple2/storage"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func newApple2() *Apple2 {
|
func newApple2() *Apple2 {
|
||||||
|
@ -77,7 +76,7 @@ const (
|
||||||
|
|
||||||
// LoadRom loads a standard Apple2+ or 2e ROM
|
// LoadRom loads a standard Apple2+ or 2e ROM
|
||||||
func (a *Apple2) LoadRom(filename string) error {
|
func (a *Apple2) LoadRom(filename string) error {
|
||||||
data, _, err := storage.LoadResource(filename)
|
data, _, err := LoadResource(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -98,7 +97,7 @@ func (a *Apple2) AddDisk2(slot int, diskImage, diskBImage string) error {
|
||||||
a.insertCard(c, slot)
|
a.insertCard(c, slot)
|
||||||
|
|
||||||
if diskImage != "" {
|
if diskImage != "" {
|
||||||
diskette, err := storage.LoadDiskette(diskImage)
|
diskette, err := LoadDiskette(diskImage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -106,7 +105,7 @@ func (a *Apple2) AddDisk2(slot int, diskImage, diskBImage string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if diskBImage != "" {
|
if diskBImage != "" {
|
||||||
diskette, err := storage.LoadDiskette(diskBImage)
|
diskette, err := LoadDiskette(diskBImage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@ package izapple2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
|
||||||
"github.com/ivanizag/izapple2/storage"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultInternal = "<default>"
|
const defaultInternal = "<default>"
|
||||||
|
@ -162,7 +160,9 @@ func MainApple() *Apple2 {
|
||||||
diskImageFinal := *diskImage
|
diskImageFinal := *diskImage
|
||||||
hardDiskImageFinal := *hardDiskImage
|
hardDiskImageFinal := *hardDiskImage
|
||||||
if filename != "" {
|
if filename != "" {
|
||||||
if storage.IsDiskette(filename) {
|
// Try loading as diskette
|
||||||
|
_, err := LoadDiskette(filename)
|
||||||
|
if err == nil {
|
||||||
diskImageFinal = filename
|
diskImageFinal = filename
|
||||||
} else {
|
} else {
|
||||||
hardDiskImageFinal = filename
|
hardDiskImageFinal = filename
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/ivanizag/iz6502"
|
"github.com/ivanizag/iz6502"
|
||||||
"github.com/ivanizag/izapple2/storage"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -36,7 +35,7 @@ func loadBase64aRom(a *Apple2) error {
|
||||||
|
|
||||||
for i := 0; i < base64aRomChipCount; i++ {
|
for i := 0; i < base64aRomChipCount; i++ {
|
||||||
filename := fmt.Sprintf("<internal>/BASE64A_%X.BIN", 0xd0+i*0x08)
|
filename := fmt.Sprintf("<internal>/BASE64A_%X.BIN", 0xd0+i*0x08)
|
||||||
data, _, err := storage.LoadResource(filename)
|
data, _, err := LoadResource(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@ package izapple2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/ivanizag/izapple2/storage"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Card represents an Apple II card to be inserted in a slot
|
// Card represents an Apple II card to be inserted in a slot
|
||||||
|
@ -43,7 +41,7 @@ func (c *cardBase) reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cardBase) loadRomFromResource(resource string) {
|
func (c *cardBase) loadRomFromResource(resource string) {
|
||||||
data, _, err := storage.LoadResource(resource)
|
data, _, err := LoadResource(resource)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// The resource should be internal and never fail
|
// The resource should be internal and never fail
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
|
@ -2,7 +2,6 @@ package izapple2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ivanizag/izapple2/component"
|
"github.com/ivanizag/izapple2/component"
|
||||||
"github.com/ivanizag/izapple2/storage"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: fast mode
|
// TODO: fast mode
|
||||||
|
@ -54,7 +53,7 @@ func NewCardDisk2Sequencer() *CardDisk2Sequencer {
|
||||||
c.name = "Disk II"
|
c.name = "Disk II"
|
||||||
c.loadRomFromResource("<internal>/DISK2.rom")
|
c.loadRomFromResource("<internal>/DISK2.rom")
|
||||||
|
|
||||||
data, _, err := storage.LoadResource("<internal>/DISK2P6.rom")
|
data, _, err := LoadResource("<internal>/DISK2P6.rom")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// The resource should be internal and never fail
|
// The resource should be internal and never fail
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
|
@ -21,7 +21,7 @@ type cardDisk2SequencerDrive struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *cardDisk2SequencerDrive) insertDiskette(filename string) error {
|
func (d *cardDisk2SequencerDrive) insertDiskette(filename string) error {
|
||||||
data, writeable, err := storage.LoadResource(filename)
|
data, writeable, err := LoadResource(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ivanizag/izapple2/component"
|
"github.com/ivanizag/izapple2/component"
|
||||||
"github.com/ivanizag/izapple2/storage"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -47,7 +46,7 @@ func NewCardVidex() *CardVidex {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CardVidex) loadCharacterMap(filename string) error {
|
func (c *CardVidex) loadCharacterMap(filename string) error {
|
||||||
bytes, _, err := storage.LoadResource(filename)
|
bytes, _, err := LoadResource(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@ package izapple2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/ivanizag/izapple2/storage"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -52,7 +50,7 @@ func newCharacterGenerator(filename string, order charColumnMap, isApple2e bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cg *CharacterGenerator) load(filename string) error {
|
func (cg *CharacterGenerator) load(filename string) error {
|
||||||
bytes, _, err := storage.LoadResource(filename)
|
bytes, _, err := LoadResource(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -7,7 +7,6 @@ require (
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20211213063430-748e38ca8aec
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20211213063430-748e38ca8aec
|
||||||
github.com/ivanizag/iz6502 v1.2.1
|
github.com/ivanizag/iz6502 v1.2.1
|
||||||
github.com/pkg/profile v1.6.0
|
github.com/pkg/profile v1.6.0
|
||||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546
|
|
||||||
github.com/veandco/go-sdl2 v0.4.12
|
github.com/veandco/go-sdl2 v0.4.12
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -19,7 +18,6 @@ require (
|
||||||
github.com/godbus/dbus/v5 v5.0.4 // indirect
|
github.com/godbus/dbus/v5 v5.0.4 // indirect
|
||||||
github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff // indirect
|
github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect
|
|
||||||
github.com/srwiley/oksvg v0.0.0-20200311192757-870daf9aa564 // indirect
|
github.com/srwiley/oksvg v0.0.0-20200311192757-870daf9aa564 // indirect
|
||||||
github.com/srwiley/rasterx v0.0.0-20200120212402-85cb7272f5e9 // indirect
|
github.com/srwiley/rasterx v0.0.0-20200120212402-85cb7272f5e9 // indirect
|
||||||
github.com/stretchr/testify v1.5.1 // indirect
|
github.com/stretchr/testify v1.5.1 // indirect
|
||||||
|
|
5
go.sum
5
go.sum
|
@ -40,11 +40,7 @@ github.com/pkg/profile v1.6.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdL
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06Bs80sCeARAlK8lhwqGyi6UT8ymuGk=
|
|
||||||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
|
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvqWEUH6SjNiu7VhSjuVFTFiTcphaLU=
|
|
||||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
|
|
||||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
github.com/srwiley/oksvg v0.0.0-20200311192757-870daf9aa564 h1:HunZiaEKNGVdhTRQOVpMmj5MQnGnv+e8uZNu3xFLgyM=
|
github.com/srwiley/oksvg v0.0.0-20200311192757-870daf9aa564 h1:HunZiaEKNGVdhTRQOVpMmj5MQnGnv+e8uZNu3xFLgyM=
|
||||||
|
@ -87,7 +83,6 @@ golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
|
|
||||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
|
|
@ -1,24 +1,29 @@
|
||||||
package storage
|
package izapple2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"archive/zip"
|
"archive/zip"
|
||||||
"bytes"
|
"bytes"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
|
"embed"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/ivanizag/izapple2/romdumps"
|
"github.com/ivanizag/izapple2/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
internalPrefix = "<internal>/"
|
internalPrefix = "<internal>/"
|
||||||
|
embedPrefix = "resources/"
|
||||||
httpPrefix = "http://"
|
httpPrefix = "http://"
|
||||||
httpsPrefix = "https://"
|
httpsPrefix = "https://"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:embed resources
|
||||||
|
var internalFiles embed.FS
|
||||||
|
|
||||||
func isInternalResource(filename string) bool {
|
func isInternalResource(filename string) bool {
|
||||||
return strings.HasPrefix(filename, internalPrefix)
|
return strings.HasPrefix(filename, internalPrefix)
|
||||||
}
|
}
|
||||||
|
@ -34,8 +39,8 @@ func LoadResource(filename string) ([]uint8, bool, error) {
|
||||||
var file io.Reader
|
var file io.Reader
|
||||||
if isInternalResource(filename) {
|
if isInternalResource(filename) {
|
||||||
// load from embedded resource
|
// load from embedded resource
|
||||||
resource := strings.TrimPrefix(filename, internalPrefix)
|
resource := embedPrefix + strings.TrimPrefix(filename, internalPrefix)
|
||||||
resourceFile, err := romdumps.Assets.Open(resource)
|
resourceFile, err := internalFiles.Open(resource)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
|
@ -96,7 +101,7 @@ func LoadResource(filename string) ([]uint8, bool, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
if isFileDsk(bytes) || isFileNib(bytes) || isFileWoz(bytes) {
|
if storage.IsDiskette(bytes) {
|
||||||
data = bytes
|
data = bytes
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -105,3 +110,13 @@ func LoadResource(filename string) ([]uint8, bool, error) {
|
||||||
|
|
||||||
return data, writeable, nil
|
return data, writeable, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadDiskette returns a Diskette by detecting the format
|
||||||
|
func LoadDiskette(filename string) (storage.Diskette, error) {
|
||||||
|
data, writeable, err := LoadResource(filename)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return storage.MakeDiskette(data, filename, writeable)
|
||||||
|
}
|
BIN
resources/80ColumnP109.BIN
Normal file
BIN
resources/80ColumnP109.BIN
Normal file
Binary file not shown.
BIN
resources/80ColumnP110.BIN
Normal file
BIN
resources/80ColumnP110.BIN
Normal file
Binary file not shown.
BIN
resources/Apple IIe Video Enhanced - 342-0265-A - 2732.bin
Normal file
BIN
resources/Apple IIe Video Enhanced - 342-0265-A - 2732.bin
Normal file
Binary file not shown.
BIN
resources/Apple IIe Video Unenhanced - 342-0133-A - 2732.bin
Normal file
BIN
resources/Apple IIe Video Unenhanced - 342-0133-A - 2732.bin
Normal file
Binary file not shown.
BIN
resources/Apple2_Plus.rom
Normal file
BIN
resources/Apple2_Plus.rom
Normal file
Binary file not shown.
BIN
resources/Apple2e.rom
Normal file
BIN
resources/Apple2e.rom
Normal file
Binary file not shown.
BIN
resources/Apple2e_Enhanced.rom
Normal file
BIN
resources/Apple2e_Enhanced.rom
Normal file
Binary file not shown.
BIN
resources/Apple2rev7CharGen.rom
Normal file
BIN
resources/Apple2rev7CharGen.rom
Normal file
Binary file not shown.
BIN
resources/BASE64A_D0.BIN
Normal file
BIN
resources/BASE64A_D0.BIN
Normal file
Binary file not shown.
BIN
resources/BASE64A_D8.BIN
Normal file
BIN
resources/BASE64A_D8.BIN
Normal file
Binary file not shown.
BIN
resources/BASE64A_E0.BIN
Normal file
BIN
resources/BASE64A_E0.BIN
Normal file
Binary file not shown.
BIN
resources/BASE64A_E8.BIN
Normal file
BIN
resources/BASE64A_E8.BIN
Normal file
Binary file not shown.
BIN
resources/BASE64A_F0.BIN
Normal file
BIN
resources/BASE64A_F0.BIN
Normal file
Binary file not shown.
BIN
resources/BASE64A_F8.BIN
Normal file
BIN
resources/BASE64A_F8.BIN
Normal file
Binary file not shown.
BIN
resources/BASE64A_ROM7_CharGen.BIN
Normal file
BIN
resources/BASE64A_ROM7_CharGen.BIN
Normal file
Binary file not shown.
BIN
resources/DISK2.rom
Normal file
BIN
resources/DISK2.rom
Normal file
Binary file not shown.
65
resources/DISK2P6.rom
Normal file
65
resources/DISK2P6.rom
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
Ш
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
99;;8(
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
99;;-Ш8H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(H(H(H(H-H8H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(H(H(H(HШШШШ
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
XxXxXxXxXxXx
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
XxXxXxXxШШШШ
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
hh€hh€h€h€
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
hh€hh€ШНШШ
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<EFBFBD>№<EFBFBD>№<EFBFBD>»<EFBFBD>»<EFBFBD>Ѕ<EFBFBD>ё
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<EFBFBD>№<EFBFBD>№<EFBFBD>»<EFBFBD>»ШЩШШ
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ЁИЁИЁИЁИ)YЁИ
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ЁИЁИЁИЁИЩэШш
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ШшШшШшШшЩэ ш
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ШшШшШшШшШЭиа
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
и€ии€иMиа
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
и€ии€и
|
BIN
resources/MemoryExpansionCard-341-0344a.bin
Normal file
BIN
resources/MemoryExpansionCard-341-0344a.bin
Normal file
Binary file not shown.
BIN
resources/ROMXce Production 1Mb Text ROM V5.bin
Normal file
BIN
resources/ROMXce Production 1Mb Text ROM V5.bin
Normal file
Binary file not shown.
BIN
resources/ThunderclockPlusROM.bin
Normal file
BIN
resources/ThunderclockPlusROM.bin
Normal file
Binary file not shown.
BIN
resources/Videx Videoterm ROM 2.4.bin
Normal file
BIN
resources/Videx Videoterm ROM 2.4.bin
Normal file
Binary file not shown.
BIN
resources/dos33.dsk
Normal file
BIN
resources/dos33.dsk
Normal file
Binary file not shown.
1
romdumps/generate/.gitignore
vendored
1
romdumps/generate/.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
files
|
|
|
@ -1,24 +0,0 @@
|
||||||
// To generate the resources put the files on a "files" subdirectory and run "go run generate.go"
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"github.com/shurcooL/vfsgen"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
var cwd, _ = os.Getwd()
|
|
||||||
templates := http.Dir(filepath.Join(cwd, "files"))
|
|
||||||
if err := vfsgen.Generate(templates, vfsgen.Options{
|
|
||||||
Filename: "../romdumps_vfsdata.go",
|
|
||||||
PackageName: "romdumps",
|
|
||||||
VariableName: "Assets",
|
|
||||||
}); err != nil {
|
|
||||||
log.Fatalln(err)
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because one or more lines are too long
|
@ -13,22 +13,12 @@ type Diskette interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsDiskette returns true if the files looks like a 5 1/4 diskette
|
// IsDiskette returns true if the files looks like a 5 1/4 diskette
|
||||||
func IsDiskette(filename string) bool {
|
func IsDiskette(data []byte) bool {
|
||||||
data, _, err := LoadResource(filename)
|
|
||||||
if err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return isFileNib(data) || isFileDsk(data) || isFileWoz(data)
|
return isFileNib(data) || isFileDsk(data) || isFileWoz(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadDiskette returns a Diskette by detecting the format
|
// MakeDiskette returns a Diskette by detecting the format
|
||||||
func LoadDiskette(filename string) (Diskette, error) {
|
func MakeDiskette(data []byte, filename string, writeable bool) (Diskette, error) {
|
||||||
data, writeable, err := LoadResource(filename)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if isFileNib(data) {
|
if isFileNib(data) {
|
||||||
var d diskette16sector
|
var d diskette16sector
|
||||||
d.nib = newFileNib(data)
|
d.nib = newFileNib(data)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user