How can I access PyBoy.mb from within a subclass.
This has probably been asked before but I wanted to try to get local link support working in PyBoy
I felt it would be easier to modify if I made it a subclass of PyBoy.
Here is a small snippet of my code:
When data is transmitted I get this error:
Is there any way to get around this withot directly modifying the library, or do i have to do that?
13 Replies
The mb Motherboard is only exposed to cython, you can't access it without editing pyboy's source code. If you want to expose it to python, you need to add
public
before the mb declaration, inside pyboy .pxd file, then compileoh alright then ill go try that
Maybe you need to do the same for cpu, I don't think set_interruptflag is a public method
thanks for helping even if i cant figure it out, also ive never used cython so how do you compile it?
Download pyboy source from git
Cd to the directory, then just run
pip install .
oh alright, i was over thinking it
so this, and then for cpu

Yes
thanks!
ive probably done it wrong im getting this now, i might of added public to the wrong place in cpu.pxd

i set it here

ill uninstall and rebuild it just incase i had the old version cached
nope same issue
wait i think im an idiot, i found smth on stack overflow apparently i should use cpdef so im gonna try that
i fixed it, so for future reference you need to make a wrapper for the function in cpu.py
i added this, and it worked
Yes, cpdef exposes a method to python, while cdef doesn't. I forgot to mention that 😅