libretro

package
v0.17.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2024 License: GPL-3.0 Imports: 4 Imported by: 18

Documentation

Overview

Package libretro is a cgo binding for the libretro API.

Libretro is a simple but powerful development interface that allows for the easy creation of emulators, games and multimedia applications that can plug straight into any libretro-compatible frontend. This development interface is open to others so that they can run these pluggable emulator and game cores also in their own programs or devices.

Index

Constants

View Source
const (
	PixelFormat0RGB1555 = uint32(C.RETRO_PIXEL_FORMAT_0RGB1555)
	PixelFormatXRGB8888 = uint32(C.RETRO_PIXEL_FORMAT_XRGB8888)
	PixelFormatRGB565   = uint32(C.RETRO_PIXEL_FORMAT_RGB565)
)

The pixel format the core must use to render into data. This format could differ from the format used in SET_PIXEL_FORMAT. Set by frontend in GET_CURRENT_SOFTWARE_FRAMEBUFFER.

View Source
const (
	// DeviceNone means that input is disabled.
	DeviceNone = uint32(C.RETRO_DEVICE_NONE)

	// DeviceJoypad represents the RetroPad. It is essentially a Super Nintendo
	// controller, but with additional L2/R2/L3/R3 buttons, similar to a
	// PS1 DualShock.
	DeviceJoypad = uint32(C.RETRO_DEVICE_JOYPAD)

	// DeviceMouse is a simple mouse, similar to Super Nintendo's mouse.
	// X and Y coordinates are reported relatively to last poll (poll callback).
	// It is up to the libretro implementation to keep track of where the mouse
	// pointer is supposed to be on the screen.
	// The frontend must make sure not to interfere with its own hardware
	// mouse pointer.
	DeviceMouse = uint32(C.RETRO_DEVICE_MOUSE)

	// DeviceKeyboard lets one poll for raw key pressed.
	// It is poll based, so input callback will return with the current
	// pressed state.
	// For event/text based keyboard input, see
	// RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK.
	DeviceKeyboard = uint32(C.RETRO_DEVICE_KEYBOARD)

	// DeviceLightgun X/Y coordinates are reported relatively to last poll,
	// similar to mouse. */
	DeviceLightgun = uint32(C.RETRO_DEVICE_LIGHTGUN)

	// DeviceAnalog device is an extension to JOYPAD (RetroPad).
	// Similar to DualShock it adds two analog sticks.
	// This is treated as a separate device type as it returns values in the
	// full analog range of [-0x8000, 0x7fff]. Positive X axis is right.
	// Positive Y axis is down.
	// Only use ANALOG type when polling for analog values of the axes.
	DeviceAnalog = uint32(C.RETRO_DEVICE_ANALOG)
)

Libretro's fundamental device abstractions.

Libretro's input system consists of some standardized device types, such as a joypad (with/without analog), mouse, keyboard, lightgun and a pointer.

The functionality of these devices are fixed, and individual cores map their own concept of a controller to libretro's abstractions. This makes it possible for frontends to map the abstract types to a real input device, and not having to worry about binding input correctly to arbitrary controller layouts.

View Source
const (
	DeviceIDJoypadB      = uint32(C.RETRO_DEVICE_ID_JOYPAD_B)
	DeviceIDJoypadY      = uint32(C.RETRO_DEVICE_ID_JOYPAD_Y)
	DeviceIDJoypadSelect = uint32(C.RETRO_DEVICE_ID_JOYPAD_SELECT)
	DeviceIDJoypadStart  = uint32(C.RETRO_DEVICE_ID_JOYPAD_START)
	DeviceIDJoypadUp     = uint32(C.RETRO_DEVICE_ID_JOYPAD_UP)
	DeviceIDJoypadDown   = uint32(C.RETRO_DEVICE_ID_JOYPAD_DOWN)
	DeviceIDJoypadLeft   = uint32(C.RETRO_DEVICE_ID_JOYPAD_LEFT)
	DeviceIDJoypadRight  = uint32(C.RETRO_DEVICE_ID_JOYPAD_RIGHT)
	DeviceIDJoypadA      = uint32(C.RETRO_DEVICE_ID_JOYPAD_A)
	DeviceIDJoypadX      = uint32(C.RETRO_DEVICE_ID_JOYPAD_X)
	DeviceIDJoypadL      = uint32(C.RETRO_DEVICE_ID_JOYPAD_L)
	DeviceIDJoypadR      = uint32(C.RETRO_DEVICE_ID_JOYPAD_R)
	DeviceIDJoypadL2     = uint32(C.RETRO_DEVICE_ID_JOYPAD_L2)
	DeviceIDJoypadR2     = uint32(C.RETRO_DEVICE_ID_JOYPAD_R2)
	DeviceIDJoypadL3     = uint32(C.RETRO_DEVICE_ID_JOYPAD_L3)
	DeviceIDJoypadR3     = uint32(C.RETRO_DEVICE_ID_JOYPAD_R3)
)

Buttons for the RetroPad (JOYPAD). The placement of these is equivalent to placements on the Super Nintendo controller. L2/R2/L3/R3 buttons correspond to the PS1 DualShock.

View Source
const (
	DeviceIndexAnalogLeft   = uint32(C.RETRO_DEVICE_INDEX_ANALOG_LEFT)
	DeviceIndexAnalogRight  = uint32(C.RETRO_DEVICE_INDEX_ANALOG_RIGHT)
	DeviceIndexAnalogButton = uint32(C.RETRO_DEVICE_INDEX_ANALOG_BUTTON)
	DeviceIDAnalogX         = uint32(C.RETRO_DEVICE_ID_ANALOG_X)
	DeviceIDAnalogY         = uint32(C.RETRO_DEVICE_ID_ANALOG_Y)
)

Index / Id values for analog device

View Source
const (
	DeviceIDMouseX              = uint32(C.RETRO_DEVICE_ID_MOUSE_X)
	DeviceIDMouseY              = uint32(C.RETRO_DEVICE_ID_MOUSE_Y)
	DeviceIDMouseLeft           = uint32(C.RETRO_DEVICE_ID_MOUSE_LEFT)
	DeviceIDMouseRight          = uint32(C.RETRO_DEVICE_ID_MOUSE_RIGHT)
	DeviceIDMouseWheelUp        = uint32(C.RETRO_DEVICE_ID_MOUSE_WHEELUP)
	DeviceIDMouseWheelDown      = uint32(C.RETRO_DEVICE_ID_MOUSE_WHEELDOWN)
	DeviceIDMouseMiddle         = uint32(C.RETRO_DEVICE_ID_MOUSE_MIDDLE)
	DeviceIDMouseHorizWheelUp   = uint32(C.RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP)
	DeviceIDMouseHorizWheelDown = uint32(C.RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN)
	DeviceIDMouseButton4        = uint32(C.RETRO_DEVICE_ID_MOUSE_BUTTON_4)
	DeviceIDMouseButton5        = uint32(C.RETRO_DEVICE_ID_MOUSE_BUTTON_5)
)

ID values for the mouse device

View Source
const (
	EnvironmentSetRotation                      = uint32(C.RETRO_ENVIRONMENT_SET_ROTATION)
	EnvironmentGetOverscan                      = uint32(C.RETRO_ENVIRONMENT_GET_OVERSCAN) // Deprecated
	EnvironmentGetCanDupe                       = uint32(C.RETRO_ENVIRONMENT_GET_CAN_DUPE)
	EnvironmentSetMessage                       = uint32(C.RETRO_ENVIRONMENT_SET_MESSAGE)
	EnvironmentShutdown                         = uint32(C.RETRO_ENVIRONMENT_SHUTDOWN)
	EnvironmentSetPerformanceLevel              = uint32(C.RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL)
	EnvironmentGetSystemDirectory               = uint32(C.RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY)
	EnvironmentSetPixelFormat                   = uint32(C.RETRO_ENVIRONMENT_SET_PIXEL_FORMAT)
	EnvironmentSetInputDescriptors              = uint32(C.RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS)
	EnvironmentSetKeyboardCallback              = uint32(C.RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK)
	EnvironmentSetDiskControlInterface          = uint32(C.RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE)
	EnvironmentSetHWRender                      = uint32(C.RETRO_ENVIRONMENT_SET_HW_RENDER)
	EnvironmentGetVariable                      = uint32(C.RETRO_ENVIRONMENT_GET_VARIABLE)
	EnvironmentSetVariables                     = uint32(C.RETRO_ENVIRONMENT_SET_VARIABLES)
	EnvironmentGetVariableUpdate                = uint32(C.RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE)
	EnvironmentSetSupportNoGame                 = uint32(C.RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME)
	EnvironmentGetLibretroPath                  = uint32(C.RETRO_ENVIRONMENT_GET_LIBRETRO_PATH)
	EnvironmentSetFrameTimeCallback             = uint32(C.RETRO_ENVIRONMENT_SET_FRAME_TIME_CALLBACK)
	EnvironmentSetAudioCallback                 = uint32(C.RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK)
	EnvironmentGetRumbleInterface               = uint32(C.RETRO_ENVIRONMENT_GET_RUMBLE_INTERFACE)
	EnvironmentGetInputDeviceCapabilities       = uint32(C.RETRO_ENVIRONMENT_GET_INPUT_DEVICE_CAPABILITIES)
	EnvironmentGetSensorInterface               = uint32(C.RETRO_ENVIRONMENT_GET_SENSOR_INTERFACE)
	EnvironmentGetCameraInterface               = uint32(C.RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE)
	EnvironmentGetLogInterface                  = uint32(C.RETRO_ENVIRONMENT_GET_LOG_INTERFACE)
	EnvironmentGetPerfInterface                 = uint32(C.RETRO_ENVIRONMENT_GET_PERF_INTERFACE)
	EnvironmentGetLocationInterface             = uint32(C.RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE)
	EnvironmentGetCoreAssetDirectory            = uint32(C.RETRO_ENVIRONMENT_GET_CORE_ASSETS_DIRECTORY)
	EnvironmentGetSaveDirectory                 = uint32(C.RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY)
	EnvironmentSetSystemAVInfo                  = uint32(C.RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO)
	EnvironmentSetProcAddressCallback           = uint32(C.RETRO_ENVIRONMENT_SET_PROC_ADDRESS_CALLBACK)
	EnvironmentSetSubsystemInfo                 = uint32(C.RETRO_ENVIRONMENT_SET_SUBSYSTEM_INFO)
	EnvironmentSetControllerInfo                = uint32(C.RETRO_ENVIRONMENT_SET_CONTROLLER_INFO)
	EnvironmentSetMemoryMaps                    = uint32(C.RETRO_ENVIRONMENT_SET_MEMORY_MAPS)
	EnvironmentSetGeometry                      = uint32(C.RETRO_ENVIRONMENT_SET_GEOMETRY)
	EnvironmentGetUsername                      = uint32(C.RETRO_ENVIRONMENT_GET_USERNAME)
	EnvironmentGetLanguage                      = uint32(C.RETRO_ENVIRONMENT_GET_LANGUAGE)
	EnvironmentGetCurrentSoftwareFramebuffer    = uint32(C.RETRO_ENVIRONMENT_GET_CURRENT_SOFTWARE_FRAMEBUFFER)
	EnvironmentGetHWRenderInterface             = uint32(C.RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE)
	EnvironmentSetSupportAchievements           = uint32(C.RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS)
	EnvironmentSetHWContextNegociationInterface = uint32(C.RETRO_ENVIRONMENT_SET_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE)
	EnvironmentSetSerializationQuirks           = uint32(C.RETRO_ENVIRONMENT_SET_SERIALIZATION_QUIRKS)
	EnvironmentSetHWSharedContext               = uint32(C.RETRO_ENVIRONMENT_SET_HW_SHARED_CONTEXT)
	EnvironmentGetVFSInterface                  = uint32(C.RETRO_ENVIRONMENT_GET_VFS_INTERFACE)
	EnvironmentGetLEDInterface                  = uint32(C.RETRO_ENVIRONMENT_GET_LED_INTERFACE)
	EnvironmentGetAudioVideoEnable              = uint32(C.RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE)
	EnvironmentGetMIDIInterface                 = uint32(C.RETRO_ENVIRONMENT_GET_MIDI_INTERFACE)
	EnvironmentGetFastforwarding                = uint32(C.RETRO_ENVIRONMENT_GET_FASTFORWARDING)
	EnvironmentGetTargetRefreshRate             = uint32(C.RETRO_ENVIRONMENT_GET_TARGET_REFRESH_RATE)
	EnvironmentGetInputBitmasks                 = uint32(C.RETRO_ENVIRONMENT_GET_INPUT_BITMASKS)
	EnvironmentGetCoreOptionsVersion            = uint32(C.RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION)
	EnvironmentSetCoreOptions                   = uint32(C.RETRO_ENVIRONMENT_SET_CORE_OPTIONS)
	EnvironmentSetCoreOptionsIntl               = uint32(C.RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL)
	EnvironmentSetCoreOptionsDisplay            = uint32(C.RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY)
	EnvironmentGetPrefferedHWRender             = uint32(C.RETRO_ENVIRONMENT_GET_PREFERRED_HW_RENDER)
	EnvironmentGetDiskControlInterfaceVersion   = uint32(C.RETRO_ENVIRONMENT_GET_DISK_CONTROL_INTERFACE_VERSION)
	EnvironmentGetDiskControlExtInterface       = uint32(C.RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE)
)

Environment callback API. See libretro.h for details

View Source
const (
	LogLevelDebug = uint32(C.RETRO_LOG_DEBUG)
	LogLevelInfo  = uint32(C.RETRO_LOG_INFO)
	LogLevelWarn  = uint32(C.RETRO_LOG_WARN)
	LogLevelError = uint32(C.RETRO_LOG_ERROR)
	LogLevelDummy = uint32(C.RETRO_LOG_DUMMY)
)

Debug levels

View Source
const (
	MemoryMask      = uint32(C.RETRO_MEMORY_MASK)
	MemorySaveRAM   = uint32(C.RETRO_MEMORY_SAVE_RAM)
	MemoryRTC       = uint32(C.RETRO_MEMORY_RTC)
	MemorySystemRAM = uint32(C.RETRO_MEMORY_SYSTEM_RAM)
	MemoryVideoRAM  = uint32(C.RETRO_MEMORY_VIDEO_RAM)
)

Memory constants

View Source
const (
	DeviceIDJoypadMask = uint32(C.RETRO_DEVICE_ID_JOYPAD_MASK)
)

Mask used to identify joypads

Variables

This section is empty.

Functions

func DlClose added in v0.16.11

func DlClose(handle DlHandle) error

DlClose closes a dynamic library

func DlSym added in v0.16.11

func DlSym(handle DlHandle, name string) unsafe.Pointer

DlSym loads a symbol from a dynamic library

func GetPixelFormat

func GetPixelFormat(data unsafe.Pointer) uint32

GetPixelFormat is an environment callback helper that returns the pixel format. Should be used in the case of EnvironmentSetPixelFormat

func SetBool

func SetBool(data unsafe.Pointer, val bool)

SetBool is an environment callback helper to set a boolean

func SetString

func SetString(data unsafe.Pointer, val string)

SetString is an environment callback helper to set a string

func SetUint added in v0.12.3

func SetUint(data unsafe.Pointer, val uint)

SetUint is an environment callback helper to set a string

Types

type AudioCallback

type AudioCallback struct {
	Callback func()
	SetState func(bool)
}

AudioCallback stores the audio callback itself and the SetState callback

type Core

type Core struct {
	AudioCallback       *AudioCallback
	FrameTimeCallback   *FrameTimeCallback
	DiskControlCallback *DiskControlCallback

	MemoryMap []MemoryDescriptor
	// contains filtered or unexported fields
}

Core is an instance of a dynamically loaded libretro core

func Load

func Load(sofile string) (*Core, error)

Load dynamically loads a libretro core at the given path and returns a Core instance

func (*Core) APIVersion

func (core *Core) APIVersion() uint

APIVersion returns the RETRO_API_VERSION. Used to validate ABI compatibility when the API is revised.

func (*Core) BindLogCallback

func (core *Core) BindLogCallback(data unsafe.Pointer, f logFunc)

BindLogCallback binds f to the log callback

func (*Core) BindPerfCallback

func (core *Core) BindPerfCallback(data unsafe.Pointer, f getTimeUsecFunc)

BindPerfCallback binds f to the perf callback get_time_usec

func (*Core) Deinit

func (core *Core) Deinit()

Deinit takes care of the library global deinitialization

func (*Core) GetMemoryData added in v0.2.0

func (core *Core) GetMemoryData(id uint32) unsafe.Pointer

GetMemoryData returns the size of a region of the memory. See memory constants.

func (*Core) GetMemorySize added in v0.2.0

func (core *Core) GetMemorySize(id uint32) uint

GetMemorySize returns the size of a region of the memory. See memory constants.

func (*Core) GetSystemAVInfo

func (core *Core) GetSystemAVInfo() SystemAVInfo

GetSystemAVInfo returns information about system audio/video timings and geometry. Can be called only after retro_load_game() has successfully completed. NOTE: The implementation of this function might not initialize every variable if needed. E.g. geom.aspect_ratio might not be initialized if core doesn't desire a particular aspect ratio.

func (*Core) GetSystemInfo

func (core *Core) GetSystemInfo() SystemInfo

GetSystemInfo returns statically known system info. Pointers provided in *info must be statically allocated. Can be called at any time, even before retro_init().

func (*Core) Init

func (core *Core) Init()

Init takes care of the library global initialization

func (*Core) LoadGame

func (core *Core) LoadGame(gi GameInfo) bool

LoadGame loads a game

func (*Core) Reset

func (core *Core) Reset()

Reset resets the current game.

func (*Core) Run

func (core *Core) Run()

Run runs the game for one video frame. During retro_run(), input_poll callback must be called at least once. If a frame is not rendered for reasons where a game "dropped" a frame, this still counts as a frame, and retro_run() should explicitly dupe a frame if GET_CAN_DUPE returns true. In this case, the video callback can take a NULL argument for data.

func (*Core) Serialize

func (core *Core) Serialize(size uint) ([]byte, error)

Serialize serializes internal state and returns the state as a byte slice.

func (*Core) SerializeSize

func (core *Core) SerializeSize() uint

SerializeSize returns the amount of data the implementation requires to serialize internal state (save states). Between calls to retro_load_game() and retro_unload_game(), the returned size is never allowed to be larger than a previous returned value, to ensure that the frontend can allocate a save state buffer once.

func (*Core) SetAudioCallback added in v0.2.6

func (core *Core) SetAudioCallback(data unsafe.Pointer)

SetAudioCallback is an environment callback helper to set the AudioCallback

func (*Core) SetAudioSample

func (core *Core) SetAudioSample(f audioSampleFunc)

SetAudioSample sets the audio sample callback. Must be set before the first Run call

func (*Core) SetAudioSampleBatch

func (core *Core) SetAudioSampleBatch(f audioSampleBatchFunc)

SetAudioSampleBatch sets the audio sample batch callback. Must be set before the first Run call

func (*Core) SetControllerPortDevice added in v0.2.9

func (core *Core) SetControllerPortDevice(port uint, device uint32)

SetControllerPortDevice sets the device type attached to a controller port

func (*Core) SetDiskControlCallback added in v0.14.0

func (core *Core) SetDiskControlCallback(data unsafe.Pointer)

SetDiskControlCallback sets an interface which frontend can use to eject and insert disk images

func (*Core) SetEnvironment

func (core *Core) SetEnvironment(f environmentFunc)

SetEnvironment sets the environment callback. Must be called before Init

func (*Core) SetFrameTimeCallback added in v0.2.6

func (core *Core) SetFrameTimeCallback(data unsafe.Pointer)

SetFrameTimeCallback is an environment callback helper to set the FrameTimeCallback

func (*Core) SetInputPoll

func (core *Core) SetInputPoll(f inputPollFunc)

SetInputPoll sets the input poll callback. Must be set before the first Run call

func (*Core) SetInputState

func (core *Core) SetInputState(f inputStateFunc)

SetInputState sets the input state callback. Must be set before the first Run call

func (*Core) SetVideoRefresh

func (core *Core) SetVideoRefresh(f videoRefreshFunc)

SetVideoRefresh sets the video refresh callback. Must be set before the first Run call

func (*Core) UnloadGame

func (core *Core) UnloadGame()

UnloadGame unloads a currently loaded game

func (*Core) Unserialize

func (core *Core) Unserialize(bytes []byte, size uint) error

Unserialize unserializes internal state from a byte slice.

type CoreOptionDefinition added in v0.12.3

type CoreOptionDefinition C.struct_retro_core_option_definition

CoreOptionDefinition represents a core option in the version 1 of the core options API

func GetCoreOptionDefinitions added in v0.12.3

func GetCoreOptionDefinitions(data unsafe.Pointer) []CoreOptionDefinition

GetCoreOptionDefinitions is an environment callback helper that returns the list of CoreOptionDefinition needed by a core

func GetCoreOptionsIntl added in v0.12.3

func GetCoreOptionsIntl(data unsafe.Pointer) []CoreOptionDefinition

GetCoreOptionsIntl is an environment callback helper that returns the list of CoreOptionsIntl needed by a core

func (*CoreOptionDefinition) Choices added in v0.12.3

func (cod *CoreOptionDefinition) Choices() []string

Choices returns the CoreOptionDefinition values as a string slice for compatibility with options v0

func (*CoreOptionDefinition) DefaultValue added in v0.12.3

func (cod *CoreOptionDefinition) DefaultValue() string

DefaultValue returns the default value of a CoreOptionDefinition as a string

func (*CoreOptionDefinition) Desc added in v0.12.3

func (cod *CoreOptionDefinition) Desc() string

Desc returns the name of a CoreOptionDefinition as a string

func (*CoreOptionDefinition) Info added in v0.12.3

func (cod *CoreOptionDefinition) Info() string

Info returns the detailed description of a CoreOptionDefinition as a string

func (*CoreOptionDefinition) Key added in v0.12.3

func (cod *CoreOptionDefinition) Key() string

Key returns the key of a CoreOptionDefinition as a string

func (*CoreOptionDefinition) Values added in v0.12.3

func (cod *CoreOptionDefinition) Values() []CoreOptionValue

Values returns the possible values of a CoreOptionDefinition as a string

type CoreOptionValue added in v0.12.3

type CoreOptionValue C.struct_retro_core_option_value

CoreOptionValue represents the value of a core option in the version 1 of the core options API

func (*CoreOptionValue) Label added in v0.12.3

func (cov *CoreOptionValue) Label() string

Label is the human readable value label of the CoreOptionValue. If NULL, value itself will be displayed by the frontend

func (*CoreOptionValue) Value added in v0.12.3

func (cov *CoreOptionValue) Value() string

Value is the expected option value

type DiskControlCallback added in v0.14.0

type DiskControlCallback struct {
	SetEjectState func(bool)
	GetEjectState func() bool
	GetImageIndex func() uint
	SetImageIndex func(uint)
	GetNumImages  func() uint
}

DiskControlCallback is an interface which frontend can use to eject and insert disk images

type DlHandle added in v0.16.11

type DlHandle = unsafe.Pointer

DlHandle is a handle to a dynamic library

func DlOpen

func DlOpen(path string) (DlHandle, error)

DlOpen opens a dynamic library

type FrameTimeCallback

type FrameTimeCallback struct {
	Callback  func(int64)
	Reference int64
}

FrameTimeCallback stores the frame time callback itself and the reference time

type GameGeometry

type GameGeometry struct {
	AspectRatio float64
	BaseWidth   int
	BaseHeight  int
	MaxWidth    int
	MaxHeight   int
}

GameGeometry represents the geometry of a game, with its aspect ratio, with and height

func GetGeometry added in v0.5.2

func GetGeometry(data unsafe.Pointer) GameGeometry

GetGeometry is an environment callback helper that returns the game geometry in EnvironmentSetGeometry.

type GameInfo

type GameInfo struct {
	Path string
	Size int64
	Data unsafe.Pointer
}

GameInfo stores information about a ROM

func (*GameInfo) SetData

func (gi *GameInfo) SetData(bytes []byte)

SetData is a setter for the data of a GameInfo type

type MemoryDescriptor added in v0.16.11

type MemoryDescriptor struct {
	Flags      uint64
	Ptr        unsafe.Pointer
	Offset     uintptr
	Start      uintptr
	Select     uintptr
	Disconnect uintptr
	Len        uintptr
	Addrspace  string
}

MemoryDescriptor stores information about the emulated memory regions

func GetMemoryMap added in v0.16.11

func GetMemoryMap(data unsafe.Pointer) []MemoryDescriptor

GetMemoryMap is an environment callback helper that returns the list of memory regions EnvironmentSetMemoryMap.

type SystemAVInfo

type SystemAVInfo struct {
	Geometry GameGeometry
	Timing   SystemTiming
}

SystemAVInfo stores informations about the emulated system audio and video

func GetSystemAVInfo added in v0.5.2

func GetSystemAVInfo(data unsafe.Pointer) SystemAVInfo

GetSystemAVInfo is an environment callback helper that returns the game geometry in EnvironmentSetGeometry.

type SystemInfo

type SystemInfo struct {
	LibraryName     string
	LibraryVersion  string
	ValidExtensions string
	NeedFullpath    bool
	BlockExtract    bool
}

SystemInfo stores informations about the emulated system

type SystemTiming

type SystemTiming struct {
	FPS        float64
	SampleRate float64
}

SystemTiming stores informations about the timing of the emulated system

type Variable

type Variable C.struct_retro_variable

Variable is a key value pair that represents a core option

func GetVariable

func GetVariable(data unsafe.Pointer) *Variable

GetVariable is an environment callback helper that returns a Variable

func GetVariables

func GetVariables(data unsafe.Pointer) []Variable

GetVariables is an environment callback helper that returns the list of Variable needed by a core

func (*Variable) Choices

func (v *Variable) Choices() []string

Choices returns the list of possible choices for a given Variable

func (*Variable) DefaultValue added in v0.12.3

func (v *Variable) DefaultValue() string

DefaultValue returns the default value of a Variable

func (*Variable) Desc

func (v *Variable) Desc() string

Desc returns the description of a Variable as a string

func (*Variable) Key

func (v *Variable) Key() string

Key returns the key of a Variable as a string

func (*Variable) SetValue

func (v *Variable) SetValue(val string)

SetValue sets the value of a Variable

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL