src/gb/renderers/tile-cache.c (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/. */
6#include <mgba/internal/gb/renderers/tile-cache.h>
7
8#include <mgba/core/tile-cache.h>
9#include <mgba/internal/gb/video.h>
10#include <mgba/internal/gb/renderers/tile-cache.h>
11
12void GBVideoTileCacheInit(struct mTileCache* cache) {
13 mTileCacheInit(cache);
14 mTileCacheConfiguration config = 0;
15 config = mTileCacheSystemInfoSetPalette0BPP(config, 1); // 2^(2^2) = 4 entries
16 config = mTileCacheSystemInfoSetPalette0Count(config, 4); // 16 palettes
17 config = mTileCacheSystemInfoSetPalette1BPP(config, 0); // Disable
18 config = mTileCacheSystemInfoSetPalette1Count(config, 0); // Disable
19 config = mTileCacheSystemInfoSetMaxTiles(config, 1024);
20 mTileCacheConfigureSystem(cache, config);
21}
22
23void GBVideoTileCacheAssociate(struct mTileCache* cache, struct GBVideo* video) {
24 cache->vram = (uint16_t*) video->vram;
25 cache->palette = video->palette;
26 video->renderer->cache = cache;
27}