all repos — mgba @ 9a104508acb0ae61d1df9fda576cfe2fdfc3731f

mGBA Game Boy Advance Emulator

src/platform/python/mgba/gb.py (view raw)

 1# Copyright (c) 2013-2016 Jeffrey Pfau
 2#
 3# This Source Code Form is subject to the terms of the Mozilla Public
 4# License, v. 2.0. If a copy of the MPL was not distributed with this
 5# file, You can obtain one at http://mozilla.org/MPL/2.0/.
 6from ._pylib import ffi, lib
 7from . import core, lr35902
 8
 9class GB:
10    def __init__(self, native):
11        super(GB, self).__init__(native)
12        self._native = ffi.cast("struct GB*", native.board)
13        self.cpu = lr35902.LR35902Core(self._core.cpu)
14
15    def _initTileCache(self, cache):
16        lib.GBVideoTileCacheInit(cache)
17        lib.GBVideoTileCacheAssociate(cache, ffi.addressof(self._native.video))
18
19    def _deinitTileCache(self, cache):
20        self._native.video.renderer.cache = ffi.NULL
21        lib.mTileCacheDeinit(cache)