Skip to content

Commit

Permalink
Fix: halt cycle bug
Browse files Browse the repository at this point in the history
  • Loading branch information
akatsuki105 committed May 12, 2021
1 parent 367d4ae commit be767aa
Show file tree
Hide file tree
Showing 12 changed files with 236 additions and 354 deletions.
3 changes: 2 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ type Emulator struct {
}

func (e *Emulator) Update() error {
defer e.gba.PanicHandler(true)
defer e.gba.PanicHandler("core", true)
e.gba.Update()
if e.gba.DoSav && e.gba.Frame%60 == 0 {
e.writeSav()
Expand All @@ -129,6 +129,7 @@ func (e *Emulator) Update() error {
}

func (e *Emulator) Draw(screen *ebiten.Image) {
defer e.gba.PanicHandler("gpu", true)
screen.ReplacePixels(e.gba.Draw().Pix)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/gba/apu.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func newAPU() *APU {
return &APU{
context: context,
player: player,
chans: [4]*SoundChan{&SoundChan{}, &SoundChan{}, &SoundChan{}, &SoundChan{}},
chans: [4]*SoundChan{{}, {}, {}, {}},
}
}

Expand Down Expand Up @@ -491,7 +491,7 @@ func clip(val int32) int16 {
}

func (g *GBA) soundClock(cycles uint32) {
defer g.PanicHandler(true)
defer g.PanicHandler("apu", true)
sndCycles += cycles

sampPcmL, sampPcmR := int16(0), int16(0)
Expand Down
Loading

0 comments on commit be767aa

Please sign in to comment.