src/gba/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/gba/renderers/tile-cache.h>
7
8#include <mgba/core/tile-cache.h>
9#include <mgba/internal/gba/video.h>
10
11void GBAVideoTileCacheInit(struct mTileCache* cache) {
12 mTileCacheInit(cache);
13 mTileCacheConfiguration config = 0;
14 config = mTileCacheSystemInfoSetPalette0BPP(config, 2); // 2^(2^2) = 16 entries
15 config = mTileCacheSystemInfoSetPalette0Count(config, 5); // 32 palettes
16 config = mTileCacheSystemInfoSetPalette1BPP(config, 3); // 2^(2^3) = 256 entries
17 config = mTileCacheSystemInfoSetPalette1Count(config, 1); // 2 palettes
18 config = mTileCacheSystemInfoSetMaxTiles(config, 3072);
19 mTileCacheConfigureSystem(cache, config);
20}
21
22void GBAVideoTileCacheAssociate(struct mTileCache* cache, struct GBAVideo* video) {
23 cache->vram = video->vram;
24 cache->palette = video->palette;
25 video->renderer->cache = cache;
26}