Created
October 15, 2016 01:22
-
-
Save endrift/752230729cbf2e29192dbe2c4a5e86c2 to your computer and use it in GitHub Desktop.
mGBA Python bindings example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
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
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
needs
open("out.png", "wb")
to avoid segfault