Use sub-frame emulation precision

This commit is contained in:
sergystepanov 2026-06-27 14:56:50 +03:00
parent 6c0f13c3a2
commit 04240aa855
2 changed files with 4 additions and 4 deletions

View file

@ -24,7 +24,7 @@ type Emulator interface {
SetDataCb(func([]byte))
LoadCore(name string)
LoadGame(path string) error
FPS() int
FPS() float64
Flipped() bool
Rotation() uint
PixFormat() uint32
@ -309,7 +309,7 @@ func (f *Frontend) Start() {
// The main loop of Libretro
// calculate the exact duration required for a frame (e.g., 16.666ms = 60 FPS)
targetFrameTime := time.Second / time.Duration(f.nano.VideoFramerate())
targetFrameTime := time.Duration(float64(time.Second) / f.nano.VideoFramerate())
// stop sleeping and start spinning in the remaining 1ms
const spinThreshold = 1 * time.Millisecond
@ -380,7 +380,7 @@ func (f *Frontend) LoadGame(path string) error {
func (f *Frontend) AspectRatio() float32 { return f.nano.AspectRatio() }
func (f *Frontend) AudioSampleRate() int { return f.nano.AudioSampleRate() }
func (f *Frontend) FPS() int { return f.nano.VideoFramerate() }
func (f *Frontend) FPS() float64 { return f.nano.VideoFramerate() }
func (f *Frontend) Flipped() bool { return f.nano.IsGL() }
func (f *Frontend) FrameSize() (int, int) { return f.nano.BaseWidth(), f.nano.BaseHeight() }
func (f *Frontend) HasSave() bool { return os.Exists(f.HashPath()) }

View file

@ -147,7 +147,7 @@ func NewNano(localPath string) *Nanoarch {
func (n *Nanoarch) AspectRatio() float32 { return float32(n.sys.av.geometry.aspect_ratio) }
func (n *Nanoarch) AudioSampleRate() int { return int(n.sys.av.timing.sample_rate) }
func (n *Nanoarch) VideoFramerate() int { return int(n.sys.av.timing.fps) }
func (n *Nanoarch) VideoFramerate() float64 { return float64(n.sys.av.timing.fps) }
func (n *Nanoarch) IsPortrait() bool { return 90 == n.Rot%180 }
func (n *Nanoarch) KbMouseSupport() bool { return n.meta.KbMouseSupport }
func (n *Nanoarch) BaseWidth() int { return int(n.sys.av.geometry.base_width) }