Squashed 'deps/nostalgia/' changes from 3b874c6e..c501fc04
c501fc04 [nostalgia/core/gba] Fix TileSheetSet loading 531d9309 [ox/event] Comment out error logging for a long ignored error 094d1598 [nostalgia] Replace default make command with build instead of install 0017ac27 [nostalgia] Add gba-dev to README be920e49 [nostalgia] Move to C++23 3c483649 [ox/std] Fix Windows ARM build f1ee645a [buildcore] Windows fixes git-subtree-dir: deps/nostalgia git-subtree-split: c501fc048f8c32f46bcdfdfee9fbaa6eafef1357
This commit is contained in:
		@@ -84,21 +84,23 @@ static ox::Error loadTileSheetSet(
 | 
			
		||||
		uint16_t *tileMapTargetMem,
 | 
			
		||||
		TileSheetSet const&set) noexcept {
 | 
			
		||||
	size_t tileWriteIdx = 0;
 | 
			
		||||
	size_t const bppMod = set.bpp == 4;
 | 
			
		||||
	for (auto const&entry : set.entries) {
 | 
			
		||||
		oxRequire(ts, keel::readObj<CompactTileSheet>(keelCtx(ctx), entry.tilesheet));
 | 
			
		||||
		if (set.bpp != ts->bpp && ts->bpp == 8) {
 | 
			
		||||
			return OxError(1, "cannot load an 8 BPP tilesheet into a 4 BPP CBB");
 | 
			
		||||
		}
 | 
			
		||||
		for (auto const&s : entry.sections) {
 | 
			
		||||
			auto const cnt = (static_cast<size_t>(s.tiles) * PixelsPerTile) / (1 + (set.bpp == 4));
 | 
			
		||||
			auto const cnt = (static_cast<size_t>(s.tiles) * PixelsPerTile) >> bppMod;
 | 
			
		||||
			for (size_t i = 0; i < cnt; ++i) {
 | 
			
		||||
				auto const srcIdx = static_cast<size_t>(s.begin) + i * 2;
 | 
			
		||||
				auto const begin = static_cast<size_t>(s.begin) * (PixelsPerTile >> bppMod);
 | 
			
		||||
				auto const srcIdx = begin + i * 2;
 | 
			
		||||
				auto const v = static_cast<uint16_t>(
 | 
			
		||||
						static_cast<uint16_t>(ts->pixels[srcIdx]) |
 | 
			
		||||
				        (static_cast<uint16_t>(ts->pixels[srcIdx + 1]) << 8));
 | 
			
		||||
				tileMapTargetMem[tileWriteIdx + i] = v;
 | 
			
		||||
			}
 | 
			
		||||
			tileWriteIdx += cnt;
 | 
			
		||||
			tileWriteIdx += cnt >> bppMod;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return {};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user