package com.lazy.emulate.emulation

import android.view.Surface
import com.lazy.emulate.input.GamepadButton

data class SaveSlotInfo(
    val slot: Int,
    val exists: Boolean,
    val lastModified: Long = 0L,
    val screenshotPath: String? = null
)

interface EmulatorCore {

    val consoleType: ConsoleType

    val isRunning: Boolean

    val saveSlotCount: Int get() = 5

    fun loadRom(path: String): Boolean

    fun start()

    fun pause()

    fun resume()

    fun stop()

    fun reset()

    fun setSurface(surface: Surface)

    fun onButtonPressed(button: GamepadButton)

    fun onButtonReleased(button: GamepadButton)

    fun onAnalogStick(x: Float, y: Float, stickIndex: Int = 0)

    fun saveState(slot: Int): Boolean

    fun loadState(slot: Int): Boolean

    fun deleteState(slot: Int): Boolean = false

    fun getSaveSlotInfo(slot: Int): SaveSlotInfo

    fun getScreenshotPath(slot: Int): String? = null

    fun getAllSaveSlots(): List<SaveSlotInfo> =
        (0 until saveSlotCount).map { getSaveSlotInfo(it) }

    fun setAudioEnabled(enabled: Boolean)

    fun setFrameSkip(skip: Int)

    fun setDisplayMode(mode: DisplayMode)
}
