Fix N64 overlapping frame draw

This commit is contained in:
Sergey Stepanov 2023-04-03 20:39:49 +03:00
parent 583e4659ad
commit 9178dab7dd
No known key found for this signature in database
GPG key ID: A56B4929BAA8556B

View file

@ -131,7 +131,7 @@ func coreVideoRefresh(data unsafe.Pointer, width, height uint, packed uint) {
// calculate real frame width in pixels from packed data (realWidth >= width)
// some cores or games output zero pitch, i.e. N64 Mupen
if packed == 0 {
packed = width
packed = width * nano.v.bpp
}
// calculate space for the video frame
bytes := packed * height
@ -152,6 +152,8 @@ func coreVideoRefresh(data unsafe.Pointer, width, height uint, packed uint) {
if fr == nil {
fr = &emulator.GameFrame{}
}
// !to fix possible nil pointer dereference
// when the internal pool can be nil during first Get???
fr.Data = frontend.canvas.
Draw(nano.v.pixFmt, nano.rot, int(width), int(height), int(packed), int(nano.v.bpp), data_, frontend.th)
fr.Duration = time.Duration(dt)