Skip to content

Commit

Permalink
Libretro fixes (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
kivutar authored Jul 12, 2019
1 parent 944d855 commit b102dc4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion libretro/libretro.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,14 @@ func (core *Core) APIVersion() uint {
// Deinit takes care of the library global deinitialization
func (core *Core) Deinit() {
C.bridge_retro_deinit(core.symRetroDeinit)
environment = nil
videoRefresh = nil
audioSample = nil
audioSampleBatch = nil
inputPoll = nil
inputState = nil
log = nil
getTimeUsec = nil
}

// Run runs the game for one video frame.
Expand Down Expand Up @@ -520,16 +528,22 @@ func coreAudioSampleBatch(buf unsafe.Pointer, frames C.size_t) C.size_t {
if audioSampleBatch == nil {
return 0
}
return C.size_t(audioSampleBatch(C.GoBytes(buf, C.int(4096)), int32(frames)))
return C.size_t(audioSampleBatch(C.GoBytes(buf, C.int(4*int(frames))), int32(frames)))
}

//export coreLog
func coreLog(level C.enum_retro_log_level, msg *C.char) {
if log == nil {
return
}
log(uint32(level), C.GoString(msg))
}

//export coreGetTimeUsec
func coreGetTimeUsec() C.uint64_t {
if getTimeUsec == nil {
return 0
}
return C.uint64_t(getTimeUsec())
}

Expand Down

0 comments on commit b102dc4

Please sign in to comment.