removed unused/unwanted dependencies

go-wav, statsview and memviz all indirectly used gopkg.in/yaml.v3 which
I do not want to depend upon

WAV functionality is no longer available for wav writing or reading
(supercharger tapes). will try to reintroduce functionality in the
future
This commit is contained in:
JetSetIlly 2022-05-26 12:14:34 +01:00
parent 3d67309adc
commit 7e57bbe46c
12 changed files with 8 additions and 382 deletions

View file

@ -12,7 +12,7 @@ profilingRom = roms/Homebrew/CDF/zookeeper_20200308_demo2_NTSC.bin
# profilingRom = roms/Pitfall.bin
# profilingRom =
.PHONY: all clean tidy generate check_lint lint lint_fix check_glsl glsl_validate check_pandoc readme_spell test race race_debug profile profile_cpu profile_cpu_play profile_cpu_debug profile_mem_play profile_mem_debug profile_trace build_assertions build check_upx release release_statsview chec_rswc windows_manifest cross_windows cross_windows_development cross_windows_statsview cross_windows_dynamic
.PHONY: all clean tidy generate check_lint lint lint_fix check_glsl glsl_validate check_pandoc readme_spell test race race_debug profile profile_cpu profile_cpu_play profile_cpu_debug profile_mem_play profile_mem_debug profile_trace build_assertions build check_upx release chec_rswc windows_manifest cross_windows cross_windows_development cross_windows_dynamic
goBinary = go
# goBinary = ~/Go/dev_github/go/bin/go
@ -126,9 +126,6 @@ build_assertions: generate test
build: generate
$(goBinary) build -gcflags $(compileFlags) -tags="imguifreetype"
build_statsview: generate
$(goBinary) build -gcflags $(compileFlags) -tags="imguifreetype statsview" -o gopher2600_statsview
check_upx:
ifeq (, $(shell which upx))
$(error "upx not installed")
@ -144,16 +141,6 @@ release_upx: check_upx generate
mv gopher2600.upx gopher2600_$(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH)
rm gopher2600
release_statsview: generate
$(goBinary) build -gcflags $(compileFlags) -ldflags="-s -w" -tags="imguifreetype release statsview" -o gopher2600_statsview
mv gopher2600_statsview gopher2600_statsview_$(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH)
release_statsview_upx: check_upx generate
$(goBinary) build -gcflags $(compileFlags) -ldflags="-s -w" -tags="imguifreetype release statsview" -o gopher2600_statsview
upx -o gopher2600_statsview.upx gopher2600_statsview
mv gopher2600_statsview.upx gopher2600_statsview_$(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH)
rm gopher2600_statsview
check_rscr:
ifeq (, $(shell which rsrc))
$(error "rsrc not installed. https://github.com/akavel/rsrc")
@ -170,9 +157,5 @@ cross_windows_development: generate windows_manifest
CGO_ENABLED="1" CC="/usr/bin/x86_64-w64-mingw32-gcc" CXX="/usr/bin/x86_64-w64-mingw32-g++" GOOS="windows" GOARCH="amd64" CGO_LDFLAGS="-static -static-libgcc -static-libstdc++ -L/usr/local/x86_64-w64-mingw32/lib" $(goBinary) build -tags "static imguifreetype release" -gcflags $(compileFlags) -ldflags "-s -w -H=windowsgui" -o gopher2600_windows_amd64_$(shell git rev-parse --short HEAD).exe .
rm rsrc_windows_amd64.syso
cross_windows_statsview: generate windows_manifest
CGO_ENABLED="1" CC="/usr/bin/x86_64-w64-mingw32-gcc" CXX="/usr/bin/x86_64-w64-mingw32-g++" GOOS="windows" GOARCH="amd64" CGO_LDFLAGS="-static -static-libgcc -static-libstdc++" $(goBinary) build -tags "static imguifreetype release statsview" -gcflags $(compileFlags) -ldflags "-s -w -H=windowsgui" -o gopher2600_statsview_windows_amd64.exe .
rm rsrc_windows_amd64.syso
# cross_windows_dynamic: generate windows_manifest
# CGO_ENABLED="1" CC="/usr/bin/x86_64-w64-mingw32-gcc" CXX="/usr/bin/x86_64-w64-mingw32-g++" GOOS="windows" GOARCH="amd64" CGO_LDFLAGS="-lmingw32 -lSDL2" CGO_CFLAGS="-D_REENTRANT" go build -tags "release" -gcflags $(compileFlags) -ldflags="-s -w -H=windowsgui" -o gopher2600_windows_amd64.exe .

View file

@ -202,8 +202,6 @@ The following projects are used in the `Gopher2600` project:
* https://github.com/inkyblackness/imgui-go
* https://github.com/veandco/go-sdl2
* https://github.com/go-gl/gl
* https://github.com/go-audio/audio
* https://github.com/go-audio/wav
* https://github.com/hajimehoshi/go-mp3
* https://github.com/pkg/term
@ -219,14 +217,6 @@ The following projects are used in the `Gopher2600` project:
Bother 6502.ts and Stella were used as reference for the Audio implementation.
Statsview provided by:
* https://github.com/go-echarts/statsview
For testing instrumentation:
* https://github.com/bradleyjkemp/memviz
Some ideas for the fragment shader taken from:
* https://github.com/libretro/glsl-shaders/blob/master/crt/shaders/crt-pi.glsl

View file

@ -57,7 +57,6 @@ import (
"github.com/jetsetilly/gopher2600/setup"
"github.com/jetsetilly/gopher2600/tracker"
"github.com/jetsetilly/gopher2600/userinput"
"github.com/jetsetilly/gopher2600/wavwriter"
)
// Debugger is the basic debugging frontend for the emulation. In order to be
@ -696,7 +695,7 @@ func (dbg *Debugger) insertPeripheralsOnStartup(left string, right string) error
// StartInPlaymode starts the emulation ready for game-play.
func (dbg *Debugger) StartInPlayMode(filename string, mapping string, left string, right string,
record bool, comparisonROM string, comparisonPrefs string,
patchFile string, wav bool) error {
patchFile string) error {
// set running flag as early as possible
dbg.running = true
@ -738,16 +737,6 @@ func (dbg *Debugger) StartInPlayMode(filename string, mapping string, left strin
}
}
// record wav file
if wav {
fn := unique.Filename("audio", cartload.ShortName())
ww, err := wavwriter.NewWavWriter(fn)
if err != nil {
return curated.Errorf("debugger: %v", err)
}
dbg.vcs.TV.AddAudioMixer(ww)
}
// record gameplay
if record {
dbg.startRecording(cartload.ShortName())

View file

@ -16,11 +16,9 @@
package commandline_test
import (
"os"
"strings"
"testing"
"github.com/bradleyjkemp/memviz"
"github.com/jetsetilly/gopher2600/debugger/terminal/commandline"
"github.com/jetsetilly/gopher2600/test"
)
@ -321,18 +319,6 @@ func TestParser_optional(t *testing.T) {
t.Errorf("does not parse: %s", err)
}
f, err := os.Create("memviz.dot")
if err != nil {
t.Fatalf(err.Error())
}
defer func() {
err = f.Close()
if err != nil {
t.Fatalf(err.Error())
}
}()
memviz.Map(f, cmds)
if test.ExpectedSuccess(t, err) {
expectEquivalency(t, cmds)
expectEquality(t, template, cmds)

12
go.mod
View file

@ -3,21 +3,11 @@ module github.com/jetsetilly/gopher2600
go 1.18
require (
github.com/bradleyjkemp/memviz v0.2.3
github.com/go-echarts/statsview v0.3.4
github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6
github.com/hajimehoshi/go-mp3 v0.3.3
github.com/inkyblackness/imgui-go/v4 v4.4.0
github.com/pkg/term v1.1.0
github.com/veandco/go-sdl2 v0.4.21
github.com/youpy/go-wav v0.3.2
golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a
)
require (
github.com/go-echarts/go-echarts/v2 v2.2.3 // indirect
github.com/rs/cors v1.7.0 // indirect
github.com/youpy/go-riff v0.1.0 // indirect
github.com/zaf/g711 v0.0.0-20190814101024-76a4a538f52b // indirect
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 // indirect
)

57
go.sum
View file

@ -1,81 +1,28 @@
github.com/bradleyjkemp/cupaloy/v2 v2.5.0 h1:XI37Pqyl+msFaJDYL3JuPFKGUgnVxyJp+gQZQGiz2nA=
github.com/bradleyjkemp/cupaloy/v2 v2.5.0/go.mod h1:TD5UU0rdYTbu/TtuwFuWrtiRARuN7mtRipvs/bsShSE=
github.com/bradleyjkemp/memviz v0.2.3 h1:8fqKnV1xQz4NQkDy5Gklhm9fGtUK+R3oW0z1unBDFGY=
github.com/bradleyjkemp/memviz v0.2.3/go.mod h1:meU694rvawW7NqtNLtlg+TEU+UqAjrbJayEPZQUSOBs=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-echarts/go-echarts/v2 v2.2.3 h1:H8oPdUpzuiV2K8S4xYZa1JRNjP3U0h7HVqvhPrmCk1A=
github.com/go-echarts/go-echarts/v2 v2.2.3/go.mod h1:6TOomEztzGDVDkOSCFBq3ed7xOYfbOqhaBzD0YV771A=
github.com/go-echarts/statsview v0.3.4 h1:CCuytRAutdnF901NrR4BzSjHXjUp8OyA3/iopgG/1/Y=
github.com/go-echarts/statsview v0.3.4/go.mod h1:AehKjL9cTFMeIo5QdV8sQO43vFmfY65X5GMWa3XMciY=
github.com/go-gl/gl v0.0.0-20210813123233-e4099ee2221f h1:s0O46d8fPwk9kU4k1jj76wBquMVETx7uveQD9MCIQoU=
github.com/go-gl/gl v0.0.0-20210813123233-e4099ee2221f/go.mod h1:wjpnOv6ONl2SuJSxqCPVaPZibGFdSci9HFocT9qtVYM=
github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 h1:zDw5v7qm4yH7N8C8uWd+8Ii9rROdgWxQuGoJ9WDXxfk=
github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6/go.mod h1:9YTyiznxEY1fVinfM7RvRcjRHbw2xLBJ3AAGIT0I4Nw=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/hajimehoshi/go-mp3 v0.3.2 h1:xSYNE2F3lxtOu9BRjCWHHceg7S91IHfXfXp5+LYQI7s=
github.com/hajimehoshi/go-mp3 v0.3.2/go.mod h1:qMJj/CSDxx6CGHiZeCgbiq2DSUkbK0UbtXShQcnfyMM=
github.com/hajimehoshi/go-mp3 v0.3.3 h1:cWnfRdpye2m9ElSoVqneYRcpt/l3ijttgjMeQh+r+FE=
github.com/hajimehoshi/go-mp3 v0.3.3/go.mod h1:qMJj/CSDxx6CGHiZeCgbiq2DSUkbK0UbtXShQcnfyMM=
github.com/hajimehoshi/oto v0.6.1/go.mod h1:0QXGEkbuJRohbJaxr7ZQSxnju7hEhseiPx2hrh6raOI=
github.com/inkyblackness/imgui-go/v4 v4.2.0 h1:5MuhU1tocnrHDZHyHTArzYr1X0+oA3ITleEwgx9juQ4=
github.com/inkyblackness/imgui-go/v4 v4.2.0/go.mod h1:g8SAGtOYUP7rYaOB2AsVKCEHmPMDmJKgt4z6d+flhb0=
github.com/inkyblackness/imgui-go/v4 v4.4.0 h1:jY32Xl18aRwTBXaDfyefCmPDxJOtGM8kGfu/kMNJpbE=
github.com/inkyblackness/imgui-go/v4 v4.4.0/go.mod h1:g8SAGtOYUP7rYaOB2AsVKCEHmPMDmJKgt4z6d+flhb0=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/term v1.1.0 h1:xIAAdCMh3QIAy+5FrE8Ad8XoDhEU4ufwbaSozViP9kk=
github.com/pkg/term v1.1.0/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw=
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/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/veandco/go-sdl2 v0.4.8 h1:A26KeX6R1CGt/BQGEov6oxYmVGMMEWDVqTvK1tXvahE=
github.com/veandco/go-sdl2 v0.4.8/go.mod h1:OROqMhHD43nT4/i9crJukyVecjPNYYuCofep6SNiAjY=
github.com/veandco/go-sdl2 v0.4.21 h1:85AtFYv3vSPZvyOOxkJ03sHoJe8ESjPSZLr0KueQtVY=
github.com/veandco/go-sdl2 v0.4.21/go.mod h1:OROqMhHD43nT4/i9crJukyVecjPNYYuCofep6SNiAjY=
github.com/youpy/go-riff v0.0.0-20131220112943-557d78c11efb h1:RDh7U5Di6o7fblIBe7rVi9KnrcOXUbLwvvLLdP2InSI=
github.com/youpy/go-riff v0.0.0-20131220112943-557d78c11efb/go.mod h1:83nxdDV4Z9RzrTut9losK7ve4hUnxUR8ASSz4BsKXwQ=
github.com/youpy/go-riff v0.1.0 h1:vZO/37nI4tIET8tQI0Qn0Y79qQh99aEpponTPiPut7k=
github.com/youpy/go-riff v0.1.0/go.mod h1:83nxdDV4Z9RzrTut9losK7ve4hUnxUR8ASSz4BsKXwQ=
github.com/youpy/go-wav v0.2.0 h1:D/36lQGTCADRj1lkchtklFcrl+tSvTDZvd7CPPSFiHs=
github.com/youpy/go-wav v0.2.0/go.mod h1:RqzyxsQMqUl31ygGi4W8YIQl5gbTXB4Al6slg/Zn2Ro=
github.com/youpy/go-wav v0.3.2 h1:NLM8L/7yZ0Bntadw/0h95OyUsen+DQIVf9gay+SUsMU=
github.com/youpy/go-wav v0.3.2/go.mod h1:0FCieAXAeSdcxFfwLpRuEo0PFmAoc+8NU34h7TUvk50=
github.com/zaf/g711 v0.0.0-20190814101024-76a4a538f52b h1:QqixIpc5WFIqTLxB3Hq8qs0qImAgBdq0p6rq2Qdl634=
github.com/zaf/g711 v0.0.0-20190814101024-76a4a538f52b/go.mod h1:T2h1zV50R/q0CVYnsQOQ6L7P4a2ZxH47ixWcMXFGyx8=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 h1:hTftEOvwiOq2+O8k2D5/Q7COC7k5Qcrgc2TFURJYnvQ=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 h1:LRtI4W37N+KFebI/qV0OFiLUv4GLOWeEW5hn/KEJvxE=
golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190429190828-d89cdac9e872/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009 h1:W0lCpv29Hv0UaM1LXb9QlBHLNP8UFfcKjblhVCWftOM=
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220405210540-1e041c57c461 h1:kHVeDEnfKn3T238CvrUcz6KeEsFHVaKh4kMTt6Wsysg=
golang.org/x/sys v0.0.0-20220405210540-1e041c57c461/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=

View file

@ -41,7 +41,6 @@ import (
"github.com/jetsetilly/gopher2600/recorder"
"github.com/jetsetilly/gopher2600/regression"
"github.com/jetsetilly/gopher2600/resources"
"github.com/jetsetilly/gopher2600/statsview"
)
// communication between the main goroutine and the launch goroutine.
@ -289,13 +288,11 @@ func emulate(emulationMode emulation.Mode, md *modalflag.Modes, sync *mainSync)
var comparisonPrefs *string
var record *bool
var patchFile *string
var wav *bool
if emulationMode == emulation.ModePlay {
comparisonROM = md.AddString("comparisonROM", "", "ROM to run in parallel for comparison")
comparisonPrefs = md.AddString("comparisonPrefs", "", "preferences for comparison emulation")
record = md.AddBool("record", false, "record user input to a file")
patchFile = md.AddString("patch", "", "patch to apply to main emulation (not playback files)")
wav = md.AddBool("wav", false, "record audio to wav file")
}
// debugger specific arguments
@ -310,12 +307,6 @@ func emulate(emulationMode emulation.Mode, md *modalflag.Modes, sync *mainSync)
termType = &tt
}
// statsview if available
var stats *bool
if statsview.Available() {
stats = md.AddBool("statsview", false, fmt.Sprintf("run stats server (%s)", statsview.Address))
}
// parse arguments
p, err := md.Parse()
if err != nil || p != modalflag.ParseContinue {
@ -334,10 +325,6 @@ func emulate(emulationMode emulation.Mode, md *modalflag.Modes, sync *mainSync)
logger.SetEcho(nil)
}
if stats != nil && *stats {
statsview.Launch(os.Stdout)
}
// turn off fallback ctrl-c handling. this so that the debugger can handle
// quit events more gracefully
//
@ -414,7 +401,7 @@ func emulate(emulationMode emulation.Mode, md *modalflag.Modes, sync *mainSync)
}
case emulation.ModePlay:
err := dbg.StartInPlayMode(md.GetArg(0), *mapping, *left, *right, *record, *comparisonROM, *comparisonPrefs, *patchFile, *wav)
err := dbg.StartInPlayMode(md.GetArg(0), *mapping, *left, *right, *record, *comparisonROM, *comparisonPrefs, *patchFile)
if err != nil {
return err
}

View file

@ -18,7 +18,6 @@ package supercharger
import (
"fmt"
"io"
"math"
"path/filepath"
"strings"
@ -27,8 +26,8 @@ import (
"github.com/hajimehoshi/go-mp3"
"github.com/jetsetilly/gopher2600/cartridgeloader"
"github.com/jetsetilly/gopher2600/curated"
"github.com/jetsetilly/gopher2600/logger"
"github.com/youpy/go-wav"
)
type pcmData struct {
@ -47,42 +46,7 @@ func getPCM(cl cartridgeloader.Loader) (pcmData, error) {
switch strings.ToLower(filepath.Ext(cl.Filename)) {
case ".wav":
dec := wav.NewReader(cl.StreamedData)
format, err := dec.Format()
if err != nil {
return p, fmt.Errorf("soundload: wav file: %v", err)
}
logger.Log(soundloadLogTag, "loading from wav file")
p.sampleRate = float64(format.SampleRate)
// adjust zero value for unsigned data. with wav data we can assume
// that a bit-depth of 8 or less is unsigned. bottom of page 60:
//
// http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Docs/riffmci.pdf
//
// data for higher bit-depths is signed and we do not need to do make
// any adjustments
adjust := 0
if format.BitsPerSample == 8 {
adjust = int(math.Pow(2.0, float64(format.BitsPerSample)/2))
}
logger.Log(soundloadLogTag, "using left channel only")
err = nil
for err != io.EOF {
var samples []wav.Sample
samples, err = dec.ReadSamples()
if err != nil && err != io.EOF {
return p, fmt.Errorf("soundload: wav: %v", err)
}
for _, s := range samples {
p.data = append(p.data, float32(s.Values[0]-adjust))
}
}
return pcmData{}, curated.Errorf("wav files not currently supported (%s)", cl.Filename)
case ".mp3":
dec, err := mp3.NewDecoder(cl.StreamedData)

View file

@ -1,29 +0,0 @@
// This file is part of Gopher2600.
//
// Gopher2600 is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Gopher2600 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Gopher2600. If not, see <https://www.gnu.org/licenses/>.
// Package statsview is an optional package that will built only when the
// +statsview build constraint is present
//
// It provides a HTTP server running locally offering runtime statistics.
// Underlying funcionality provided by "github.com/go-echarts/statsview"
//
// After launch, graphical statistics will be viewable at:
//
// localhost:12600/debug/statsview
//
// And standard Go pprof statistics available at:
//
// localhost:12600/debug/pprof/
package statsview

View file

@ -1,46 +0,0 @@
// This file is part of Gopher2600.
//
// Gopher2600 is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Gopher2600 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Gopher2600. If not, see <https://www.gnu.org/licenses/>.
//go:build statsview
// +build statsview
package statsview
import (
"fmt"
"io"
"github.com/go-echarts/statsview"
"github.com/go-echarts/statsview/viewer"
)
const Address = "localhost:12600"
const url = "/debug/statsview"
// Launch a new goroutine running the statsview.
func Launch(output io.Writer) {
go func() {
viewer.SetConfiguration(viewer.WithAddr(Address))
mgr := statsview.New()
mgr.Start()
}()
output.Write([]byte(fmt.Sprintf("stats server available at %s%s\n", Address, url)))
}
// Available returns true if a statsview is available to launch.
func Available() bool {
return true
}

View file

@ -1,37 +0,0 @@
// This file is part of Gopher2600.
//
// Gopher2600 is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Gopher2600 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Gopher2600. If not, see <https://www.gnu.org/licenses/>.
//go:build !statsview
// +build !statsview
package statsview
// https://github.com/go-echarts/statsview
import (
"io"
)
const Address = "no statsview"
// Launch a new goroutine running the statsview.
func Launch(output io.Writer) {
output.Write([]byte(Address))
}
// Available returns true if a statsview is available to launch.
func Available() bool {
return false
}

View file

@ -1,98 +0,0 @@
// This file is part of Gopher2600.
//
// Gopher2600 is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Gopher2600 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Gopher2600. If not, see <https://www.gnu.org/licenses/>.
// Package wavwriter allows writing of audio data to disk as a WAV file. Note
// that audio data is buffered in memory in its entirity, and written to disk
// on program end. It is therefore probably only suitable for testing purposes.
package wavwriter
import (
"fmt"
"os"
"github.com/jetsetilly/gopher2600/curated"
"github.com/jetsetilly/gopher2600/hardware/television/signal"
"github.com/jetsetilly/gopher2600/hardware/tia/audio"
"github.com/jetsetilly/gopher2600/hardware/tia/audio/mix"
"github.com/jetsetilly/gopher2600/logger"
"github.com/youpy/go-wav"
)
// WavWriter implements the television.AudioMixer interface.
type WavWriter struct {
filename string
buffer []wav.Sample
}
// NewWavWriter is the preferred method of initialisation for the WavWriter type.
func NewWavWriter(filename string) (*WavWriter, error) {
aw := &WavWriter{
filename: fmt.Sprintf("%s.wav", filename),
buffer: make([]wav.Sample, 0),
}
return aw, nil
}
// SetAudio implements the television.AudioMixer interface.
func (aw *WavWriter) SetAudio(sig []signal.SignalAttributes) error {
for _, s := range sig {
if s&signal.AudioUpdate != signal.AudioUpdate {
continue
}
v0 := uint8((s & signal.AudioChannel0) >> signal.AudioChannel0Shift)
v1 := uint8((s & signal.AudioChannel1) >> signal.AudioChannel1Shift)
v := mix.Mono(v0, v1)
w := wav.Sample{}
w.Values[0] = int(v >> 8)
w.Values[1] = int(v)
aw.buffer = append(aw.buffer, w)
}
return nil
}
// EndMixing implements the television.AudioMixer interface.
func (aw *WavWriter) EndMixing() (rerr error) {
f, err := os.Create(aw.filename)
if err != nil {
return curated.Errorf("wavwriter: %v", err)
}
defer func() {
err := f.Close()
if err != nil {
rerr = curated.Errorf("wavwriter: %v", err)
}
}()
// see audio commentary in sdlplay package for thinking around sample rates
enc := wav.NewWriter(f, uint32(len(aw.buffer)), 1, uint32(audio.SampleFreq), 8)
if enc == nil {
return curated.Errorf("wavwriter: %v", "bad parameters for wav encoding")
}
logger.Logf("wavwriter", "writing audio to %s", aw.filename)
enc.WriteSamples(aw.buffer)
return nil
}
// Reset implements the television.AudioMixer interface.
func (aw *WavWriter) Reset() {
}