MCPcopy Index your code
hub / github.com/fogleman/nes / load

Method load

ui/gameview.go:28–42  ·  view source on GitHub ↗
(snapshot int)

Source from the content-addressed store, hash-verified

26}
27
28func (view *GameView) load(snapshot int) {
29 // load state
30 if err := view.console.LoadState(savePath(view.hash, snapshot)); err == nil {
31 return
32 } else {
33 view.console.Reset()
34 }
35 // load sram
36 cartridge := view.console.Cartridge
37 if cartridge.Battery != 0 {
38 if sram, err := readSRAM(sramPath(view.hash, snapshot)); err == nil {
39 cartridge.SRAM = sram
40 }
41 }
42}
43
44func (view *GameView) save(snapshot int) {
45 // save sram

Callers 2

EnterMethod · 0.95
onKeyMethod · 0.95

Calls 5

savePathFunction · 0.85
readSRAMFunction · 0.85
sramPathFunction · 0.85
LoadStateMethod · 0.80
ResetMethod · 0.45

Tested by

no test coverage detected