all repos — mgba @ 6d898542c765f4efc4a094c5ebd3f3465c36f417

mGBA Game Boy Advance Emulator

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