File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "fmt"
5
+ "io/ioutil"
6
+ "log"
7
+ "os"
8
+ "path"
9
+ "strings"
10
+
11
+ "github.com/fogleman/nes/nes"
12
+ )
13
+
14
+ func testRom (path string ) (err error ) {
15
+ defer func () {
16
+ if r := recover (); r != nil {
17
+ err = r .(error )
18
+ }
19
+ }()
20
+ console , err := nes .NewConsole (path )
21
+ if err != nil {
22
+ return err
23
+ }
24
+ console .StepSeconds (3 )
25
+ return nil
26
+ }
27
+
28
+ func main () {
29
+ args := os .Args [1 :]
30
+ if len (args ) != 1 {
31
+ log .Fatalln ("Usage: go run util/roms.go roms_directory" )
32
+ }
33
+ dir := args [0 ]
34
+ infos , err := ioutil .ReadDir (dir )
35
+ if err != nil {
36
+ panic (err )
37
+ }
38
+ for _ , info := range infos {
39
+ name := info .Name ()
40
+ if ! strings .HasSuffix (name , ".nes" ) {
41
+ continue
42
+ }
43
+ name = path .Join (dir , name )
44
+ err := testRom (name )
45
+ if err == nil {
46
+ fmt .Println ("OK " , name )
47
+ } else {
48
+ fmt .Println ("FAIL" , name )
49
+ fmt .Println (err )
50
+ }
51
+ }
52
+ }
You can’t perform that action at this time.
0 commit comments