Skip to content

Instantly share code, notes, and snippets.

@endrift
Created October 15, 2016 01:22
Show Gist options
  • Save endrift/752230729cbf2e29192dbe2c4a5e86c2 to your computer and use it in GitHub Desktop.
Save endrift/752230729cbf2e29192dbe2c4a5e86c2 to your computer and use it in GitHub Desktop.
mGBA Python bindings example
from mgba import core,image
c=core.loadPath('ruby.gba')
i=image.Image(*c.desiredVideoDimensions())
c.setVideoBuffer(i)
c.reset()
for x in range(800): c.runFrame()
with open("out.png", "w") as f: i.savePNG(f)
import mgba.core
import mgba.image
core = mgba.core.loadPath('ruby.gba')
screen = mgba.image.Image(*core.desiredVideoDimensions())
core.setVideoBuffer(screen)
core.reset()
for i in range(800):
core.runFrame()
with open("out.png", "w") as f:
screen.savePNG(f)
@JoelSjogren
Copy link

JoelSjogren commented Feb 27, 2018

When loading pokemon blue instead of ruby the following error occurs at c.runFrame():

python3: malloc.c:2399: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

edit: This happens in my virtual ubuntu machine too but with the message

Segmentation fault (core dumped)

edit2: pokemon crystal works fine

edit3: also the mgba qt application plays pokemon blue just fine

@Jourdelune
Copy link

Jourdelune commented May 24, 2021

How can I set the width and height of the game ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment