Skip to main content

WIP Python library that runs Libretro cores

Project description

pylibretro

⚠️ This library is currently (and probably will remain) in a severe pre-alpha state. At the moment it is however able to load the 2048 core, press buttons and get screen output (as you can see below!). However, many callbacks and functions aren't handled, other cores (such as the PCSX ReARMed core) segfault etc. Use at your peril.

Installation

pip install pylibretro

(the only dependency is Pillow if you wish to install it manually)

Usage

You can create the GIF shown above by using the example file in this repository. However, here's a condensed, minimal usage example:

from pylibretro import Core, buttons

lastframe = None

def on_frame(frame):
    global lastframe
    lastframe = frame

# Load the core
core = Core("./2048_libretro.so")
core.on_video_refresh = on_frame
core.retro_init()
core.retro_load_game(None)

# Start a 2048 game (by pressing the START button for one frame)
core.joystick[buttons.START] = True
core.retro_run()
core.joystick[buttons.START] = False

# Run core for 10 frames
for i in range(10):
    core.retro_run()

# Show the last screen output
lastframe.show()

Licenses

pylibretro is licensed under GPLv3 or later.

Credits to the RetroArch team for the Libretro and also the 2048 core included within this repository as an example. Their corresponding licenses are also included in the license file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pylibretro-0.2.0-py3-none-any.whl (78.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page