all repos — mgba @ a9ccb0fdd723cfa45a226925e2a059c05057389c

mGBA Game Boy Advance Emulator

src/platform/python/mgba/gba.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, arm
 8
 9class GBA(core.Core):
10    def __init__(self, native):
11        super(GBA, self).__init__(native)
12        self._native = ffi.cast("struct GBA*", native.board)
13        self.cpu = arm.ARMCore(self._core.cpu)
14
15    def _initTileCache(self, cache):
16        lib.GBAVideoTileCacheInit(cache)
17        lib.GBAVideoTileCacheAssociate(cache, ffi.addressof(self._native.video))
18
19    def _deinitTileCache(self, cache):
20        self._native.video.renderer.cache = ffi.NULL
21        lib.mTileCacheDeinit(cache)