-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
59 lines (46 loc) · 1.18 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"fmt"
"log"
"os"
"flag"
"github.com/TheOrnyx/dmg-go/debugger"
_ "github.com/TheOrnyx/dmg-go/debugger"
emu "github.com/TheOrnyx/dmg-go/emulator"
"github.com/TheOrnyx/dmg-go/window"
// "github.com/TheOrnyx/dmg-go/window"
)
var debugMode bool = false
const UsingSDL = true
const WinScalar = 4 //the scalar used to scale up the gbc screen
const WinWidth, WinHeight = 160 * WinScalar, 144 * WinScalar
// enableDebug just for the flag to use
func enableDebug(b string) error {
debugMode = true
return nil
}
func main() {
flag.Usage = func() {
fmt.Fprintf(os.Stderr, "Usage of dmg-go: %s [flags] [rom path]", os.Args[0])
flag.PrintDefaults()
}
flag.BoolFunc("debug", "Use debug mode", enableDebug)
flag.Parse()
romPath := flag.Args()[0]
var win window.Screen
if debugMode {
win = window.CreateDebugWindow(WinWidth, WinHeight, WinScalar)
} else {
win = window.InitSDLWindowSystem(WinWidth, WinHeight, WinScalar)
}
emulator, err := emu.NewEmulator(romPath, win)
if err != nil {
log.Fatal("Error making new emulator:", err)
}
defer emulator.CloseEmulator()
if debugMode {
debugger.DebugEmu(emulator)
} else {
emulator.RunEmulator()
}
}