Util: Rename color_t to avoid namespace conflicts

This commit is contained in:
Vicki Pfau 2024-09-06 22:43:42 -07:00
parent 1c85dba0df
commit a6914b2ddb
48 changed files with 150 additions and 150 deletions

View File

@ -11,10 +11,10 @@
CXX_GUARD_START
#ifdef COLOR_16_BIT
typedef uint16_t color_t;
typedef uint16_t mColor;
#define BYTES_PER_PIXEL 2
#else
typedef uint32_t color_t;
typedef uint32_t mColor;
#define BYTES_PER_PIXEL 4
#endif
@ -210,18 +210,18 @@ static inline bool mColorFormatHasAlpha(enum mColorFormat format) {
return false;
}
static inline color_t mColorFrom555(uint16_t value) {
static inline mColor mColorFrom555(uint16_t value) {
#ifdef COLOR_16_BIT
#ifdef COLOR_5_6_5
color_t color = 0;
mColor color = 0;
color |= (value & 0x001F) << 11;
color |= (value & 0x03E0) << 1;
color |= (value & 0x7C00) >> 10;
#else
color_t color = value;
mColor color = value;
#endif
#else
color_t color = M_RGB5_TO_BGR8(value);
mColor color = M_RGB5_TO_BGR8(value);
color |= (color >> 5) & 0x070707;
#endif
return color;

View File

@ -29,13 +29,13 @@ struct mBitmapCacheEntry {
};
struct mBitmapCache {
color_t* cache;
mColor* cache;
struct mBitmapCacheEntry* status;
uint32_t globalPaletteVersion;
uint8_t* vram;
color_t* palette;
mColor* palette;
uint32_t bitsSize;
uint32_t bitsStart[2];
@ -53,11 +53,11 @@ void mBitmapCacheDeinit(struct mBitmapCache* cache);
void mBitmapCacheConfigure(struct mBitmapCache* cache, mBitmapCacheConfiguration config);
void mBitmapCacheConfigureSystem(struct mBitmapCache* cache, mBitmapCacheSystemInfo config);
void mBitmapCacheWriteVRAM(struct mBitmapCache* cache, uint32_t address);
void mBitmapCacheWritePalette(struct mBitmapCache* cache, uint32_t entry, color_t color);
void mBitmapCacheWritePalette(struct mBitmapCache* cache, uint32_t entry, mColor color);
void mBitmapCacheCleanRow(struct mBitmapCache* cache, struct mBitmapCacheEntry* entry, unsigned y);
bool mBitmapCacheCheckRow(struct mBitmapCache* cache, const struct mBitmapCacheEntry* entry, unsigned y);
const color_t* mBitmapCacheGetRow(struct mBitmapCache* cache, unsigned y);
const mColor* mBitmapCacheGetRow(struct mBitmapCache* cache, unsigned y);
CXX_GUARD_END

View File

@ -31,7 +31,7 @@ void mCacheSetDeinit(struct mCacheSet*);
void mCacheSetAssignVRAM(struct mCacheSet*, void* vram);
void mCacheSetWriteVRAM(struct mCacheSet*, uint32_t address);
void mCacheSetWritePalette(struct mCacheSet*, uint32_t entry, color_t color);
void mCacheSetWritePalette(struct mCacheSet*, uint32_t entry, mColor color);
CXX_GUARD_END

View File

@ -73,7 +73,7 @@ struct mCore {
unsigned (*videoScale)(const struct mCore*);
size_t (*screenRegions)(const struct mCore*, const struct mCoreScreenRegion**);
void (*setVideoBuffer)(struct mCore*, color_t* buffer, size_t stride);
void (*setVideoBuffer)(struct mCore*, mColor* buffer, size_t stride);
void (*setVideoGLTex)(struct mCore*, unsigned texid);
void (*getPixels)(struct mCore*, const void** buffer, size_t* stride);

View File

@ -47,7 +47,7 @@ DECLARE_VECTOR(mCoreCallbacksList, struct mCoreCallbacks);
struct mAVStream {
void (*videoDimensionsChanged)(struct mAVStream*, unsigned width, unsigned height);
void (*audioRateChanged)(struct mAVStream*, unsigned rate);
void (*postVideoFrame)(struct mAVStream*, const color_t* buffer, size_t stride);
void (*postVideoFrame)(struct mAVStream*, const mColor* buffer, size_t stride);
void (*postAudioFrame)(struct mAVStream*, int16_t left, int16_t right);
void (*postAudioBuffer)(struct mAVStream*, struct mAudioBuffer*);
};

View File

@ -44,7 +44,7 @@ struct mMapCacheEntry {
struct mTileCache;
struct mTileCacheEntry;
struct mMapCache {
color_t* cache;
mColor* cache;
struct mTileCache* tileCache;
struct mMapCacheEntry* status;
@ -75,7 +75,7 @@ bool mMapCacheCheckTile(struct mMapCache* cache, const struct mMapCacheEntry* en
void mMapCacheCleanTile(struct mMapCache* cache, struct mMapCacheEntry* entry, unsigned x, unsigned y);
void mMapCacheCleanRow(struct mMapCache* cache, unsigned y);
const color_t* mMapCacheGetRow(struct mMapCache* cache, unsigned y);
const mColor* mMapCacheGetRow(struct mMapCache* cache, unsigned y);
CXX_GUARD_END

View File

@ -29,7 +29,7 @@ struct mTileCacheEntry {
};
struct mTileCache {
color_t* cache;
mColor* cache;
struct mTileCacheEntry* status;
uint32_t* globalPaletteVersion;
@ -39,8 +39,8 @@ struct mTileCache {
unsigned bpp;
uint16_t* vram;
color_t* palette;
color_t temporaryTile[64];
mColor* palette;
mColor temporaryTile[64];
mTileCacheConfiguration config;
mTileCacheSystemInfo sysConfig;
@ -51,11 +51,11 @@ void mTileCacheDeinit(struct mTileCache* cache);
void mTileCacheConfigure(struct mTileCache* cache, mTileCacheConfiguration config);
void mTileCacheConfigureSystem(struct mTileCache* cache, mTileCacheSystemInfo config, uint32_t tileBase, uint32_t paletteBase);
void mTileCacheWriteVRAM(struct mTileCache* cache, uint32_t address);
void mTileCacheWritePalette(struct mTileCache* cache, uint32_t entry, color_t color);
void mTileCacheWritePalette(struct mTileCache* cache, uint32_t entry, mColor color);
const color_t* mTileCacheGetTile(struct mTileCache* cache, unsigned tileId, unsigned paletteId);
const color_t* mTileCacheGetTileIfDirty(struct mTileCache* cache, struct mTileCacheEntry* entry, unsigned tileId, unsigned paletteId);
const color_t* mTileCacheGetPalette(struct mTileCache* cache, unsigned paletteId);
const mColor* mTileCacheGetTile(struct mTileCache* cache, unsigned tileId, unsigned paletteId);
const mColor* mTileCacheGetTileIfDirty(struct mTileCache* cache, struct mTileCacheEntry* entry, unsigned tileId, unsigned paletteId);
const mColor* mTileCacheGetPalette(struct mTileCache* cache, unsigned paletteId);
const uint16_t* mTileCacheGetVRAM(struct mTileCache* cache, unsigned tileId);
CXX_GUARD_END

View File

@ -22,13 +22,13 @@ struct GBVideoRendererSprite {
struct GBVideoSoftwareRenderer {
struct GBVideoRenderer d;
color_t* outputBuffer;
mColor* outputBuffer;
int outputBufferStride;
// TODO: Implement the pixel FIFO
uint16_t row[GB_VIDEO_HORIZONTAL_PIXELS + 8];
color_t palette[192];
mColor palette[192];
uint8_t lookup[192];
uint32_t* temporaryBuffer;

View File

@ -109,7 +109,7 @@ struct GBVideoRenderer {
bool highlightBG;
bool highlightOBJ[GB_VIDEO_MAX_OBJ];
bool highlightWIN;
color_t highlightColor;
mColor highlightColor;
uint8_t highlightAmount;
};

View File

@ -82,7 +82,7 @@ struct Window {
struct GBAVideoSoftwareRenderer {
struct GBAVideoRenderer d;
color_t* outputBuffer;
mColor* outputBuffer;
int outputBufferStride;
uint32_t* temporaryBuffer;
@ -100,10 +100,10 @@ struct GBAVideoSoftwareRenderer {
unsigned target2Bd;
bool blendDirty;
enum GBAVideoBlendEffect blendEffect;
color_t normalPalette[512];
color_t variantPalette[512];
color_t highlightPalette[512];
color_t highlightVariantPalette[512];
mColor normalPalette[512];
mColor variantPalette[512];
mColor highlightPalette[512];
mColor highlightVariantPalette[512];
uint16_t blda;
uint16_t bldb;

View File

@ -208,7 +208,7 @@ struct GBAVideoRenderer {
bool highlightBG[4];
bool highlightOBJ[128];
color_t highlightColor;
mColor highlightColor;
uint8_t highlightAmount;
};

View File

@ -20,7 +20,7 @@ void mBitmapCacheInit(struct mBitmapCache* cache) {
static void _freeCache(struct mBitmapCache* cache) {
size_t size = mBitmapCacheSystemInfoGetHeight(cache->sysConfig) * mBitmapCacheSystemInfoGetBuffers(cache->sysConfig);
if (cache->cache) {
mappedMemoryFree(cache->cache, mBitmapCacheSystemInfoGetWidth(cache->sysConfig) * size * sizeof(color_t));
mappedMemoryFree(cache->cache, mBitmapCacheSystemInfoGetWidth(cache->sysConfig) * size * sizeof(mColor));
cache->cache = NULL;
}
if (cache->status) {
@ -39,10 +39,10 @@ static void _redoCacheSize(struct mBitmapCache* cache) {
}
size_t size = mBitmapCacheSystemInfoGetHeight(cache->sysConfig) * mBitmapCacheSystemInfoGetBuffers(cache->sysConfig);
cache->cache = anonymousMemoryMap(mBitmapCacheSystemInfoGetWidth(cache->sysConfig) * size * sizeof(color_t));
cache->cache = anonymousMemoryMap(mBitmapCacheSystemInfoGetWidth(cache->sysConfig) * size * sizeof(mColor));
cache->status = anonymousMemoryMap(size * sizeof(*cache->status));
if (mBitmapCacheSystemInfoIsUsesPalette(cache->sysConfig)) {
cache->palette = calloc((1 << (1 << mBitmapCacheSystemInfoGetEntryBPP(cache->sysConfig))), sizeof(color_t));
cache->palette = calloc((1 << (1 << mBitmapCacheSystemInfoGetEntryBPP(cache->sysConfig))), sizeof(mColor));
} else {
cache->palette = NULL;
}
@ -101,7 +101,7 @@ void mBitmapCacheWriteVRAM(struct mBitmapCache* cache, uint32_t address) {
}
}
void mBitmapCacheWritePalette(struct mBitmapCache* cache, uint32_t entry, color_t color) {
void mBitmapCacheWritePalette(struct mBitmapCache* cache, uint32_t entry, mColor color) {
if (!mBitmapCacheSystemInfoIsUsesPalette(cache->sysConfig)) {
return;
}
@ -122,7 +122,7 @@ uint32_t _lookupEntry15(void* vram, uint32_t offset) {
}
void mBitmapCacheCleanRow(struct mBitmapCache* cache, struct mBitmapCacheEntry* entry, unsigned y) {
color_t* row = &cache->cache[(cache->buffer * mBitmapCacheSystemInfoGetHeight(cache->sysConfig) + y) * mBitmapCacheSystemInfoGetWidth(cache->sysConfig)];
mColor* row = &cache->cache[(cache->buffer * mBitmapCacheSystemInfoGetHeight(cache->sysConfig) + y) * mBitmapCacheSystemInfoGetWidth(cache->sysConfig)];
size_t location = cache->buffer + mBitmapCacheSystemInfoGetBuffers(cache->sysConfig) * y;
struct mBitmapCacheEntry* status = &cache->status[location];
struct mBitmapCacheEntry desiredStatus = {
@ -181,7 +181,7 @@ bool mBitmapCacheCheckRow(struct mBitmapCache* cache, const struct mBitmapCacheE
return memcmp(&entry[location], &desiredStatus, sizeof(*entry)) == 0;
}
const color_t* mBitmapCacheGetRow(struct mBitmapCache* cache, unsigned y) {
color_t* row = &cache->cache[(cache->buffer * mBitmapCacheSystemInfoGetHeight(cache->sysConfig) + y) * mBitmapCacheSystemInfoGetWidth(cache->sysConfig)];
const mColor* mBitmapCacheGetRow(struct mBitmapCache* cache, unsigned y) {
mColor* row = &cache->cache[(cache->buffer * mBitmapCacheSystemInfoGetHeight(cache->sysConfig) + y) * mBitmapCacheSystemInfoGetWidth(cache->sysConfig)];
return row;
}

View File

@ -72,7 +72,7 @@ void mCacheSetWriteVRAM(struct mCacheSet* cache, uint32_t address) {
}
}
void mCacheSetWritePalette(struct mCacheSet* cache, uint32_t entry, color_t color) {
void mCacheSetWritePalette(struct mCacheSet* cache, uint32_t entry, mColor color) {
size_t i;
for (i = 0; i < mBitmapCacheSetSize(&cache->bitmaps); ++i) {
mBitmapCacheWritePalette(mBitmapCacheSetGetPointer(&cache->bitmaps, i), entry, color);

View File

@ -18,7 +18,7 @@ void mMapCacheInit(struct mMapCache* cache) {
static void _freeCache(struct mMapCache* cache) {
size_t tiles = (1 << mMapCacheSystemInfoGetTilesWide(cache->sysConfig)) * (1 << mMapCacheSystemInfoGetTilesHigh(cache->sysConfig));
if (cache->cache) {
mappedMemoryFree(cache->cache, 8 * 8 * sizeof(color_t) * tiles);
mappedMemoryFree(cache->cache, 8 * 8 * sizeof(mColor) * tiles);
cache->cache = NULL;
}
if (cache->status) {
@ -33,7 +33,7 @@ static void _redoCacheSize(struct mMapCache* cache) {
}
size_t tiles = mMapCacheTileCount(cache);
cache->cache = anonymousMemoryMap(8 * 8 * sizeof(color_t) * tiles);
cache->cache = anonymousMemoryMap(8 * 8 * sizeof(mColor) * tiles);
cache->status = anonymousMemoryMap(tiles * sizeof(*cache->status));
}
@ -87,19 +87,19 @@ void mMapCacheWriteVRAM(struct mMapCache* cache, uint32_t address) {
}
}
static inline void _cleanTile(struct mMapCache* cache, const color_t* tile, color_t* mapOut, const struct mMapCacheEntry* status) {
static inline void _cleanTile(struct mMapCache* cache, const mColor* tile, mColor* mapOut, const struct mMapCacheEntry* status) {
size_t stride = 8 << mMapCacheSystemInfoGetTilesWide(cache->sysConfig);
int x, y;
switch (mMapCacheEntryFlagsGetMirror(status->flags)) {
case 0:
memcpy(mapOut, tile, sizeof(color_t) * 8);
memcpy(&mapOut[stride], &tile[0x08], sizeof(color_t) * 8);
memcpy(&mapOut[stride * 2], &tile[0x10], sizeof(color_t) * 8);
memcpy(&mapOut[stride * 3], &tile[0x18], sizeof(color_t) * 8);
memcpy(&mapOut[stride * 4], &tile[0x20], sizeof(color_t) * 8);
memcpy(&mapOut[stride * 5], &tile[0x28], sizeof(color_t) * 8);
memcpy(&mapOut[stride * 6], &tile[0x30], sizeof(color_t) * 8);
memcpy(&mapOut[stride * 7], &tile[0x38], sizeof(color_t) * 8);
memcpy(mapOut, tile, sizeof(mColor) * 8);
memcpy(&mapOut[stride], &tile[0x08], sizeof(mColor) * 8);
memcpy(&mapOut[stride * 2], &tile[0x10], sizeof(mColor) * 8);
memcpy(&mapOut[stride * 3], &tile[0x18], sizeof(mColor) * 8);
memcpy(&mapOut[stride * 4], &tile[0x20], sizeof(mColor) * 8);
memcpy(&mapOut[stride * 5], &tile[0x28], sizeof(mColor) * 8);
memcpy(&mapOut[stride * 6], &tile[0x30], sizeof(mColor) * 8);
memcpy(&mapOut[stride * 7], &tile[0x38], sizeof(mColor) * 8);
break;
case 1:
for (y = 0; y < 8; ++y) {
@ -109,14 +109,14 @@ static inline void _cleanTile(struct mMapCache* cache, const color_t* tile, colo
}
break;
case 2:
memcpy(&mapOut[stride * 7], tile, sizeof(color_t) * 8);
memcpy(&mapOut[stride * 6], &tile[0x08], sizeof(color_t) * 8);
memcpy(&mapOut[stride * 5], &tile[0x10], sizeof(color_t) * 8);
memcpy(&mapOut[stride * 4], &tile[0x18], sizeof(color_t) * 8);
memcpy(&mapOut[stride * 3], &tile[0x20], sizeof(color_t) * 8);
memcpy(&mapOut[stride * 2], &tile[0x28], sizeof(color_t) * 8);
memcpy(&mapOut[stride], &tile[0x30], sizeof(color_t) * 8);
memcpy(mapOut, &tile[0x38], sizeof(color_t) * 8);
memcpy(&mapOut[stride * 7], tile, sizeof(mColor) * 8);
memcpy(&mapOut[stride * 6], &tile[0x08], sizeof(mColor) * 8);
memcpy(&mapOut[stride * 5], &tile[0x10], sizeof(mColor) * 8);
memcpy(&mapOut[stride * 4], &tile[0x18], sizeof(mColor) * 8);
memcpy(&mapOut[stride * 3], &tile[0x20], sizeof(mColor) * 8);
memcpy(&mapOut[stride * 2], &tile[0x28], sizeof(mColor) * 8);
memcpy(&mapOut[stride], &tile[0x30], sizeof(mColor) * 8);
memcpy(mapOut, &tile[0x38], sizeof(mColor) * 8);
break;
case 3:
for (y = 0; y < 8; ++y) {
@ -146,7 +146,7 @@ uint32_t mMapCacheTileId(struct mMapCache* cache, unsigned x, unsigned y) {
void mMapCacheCleanTile(struct mMapCache* cache, struct mMapCacheEntry* entry, unsigned x, unsigned y) {
size_t location = mMapCacheTileId(cache, x, y);
struct mMapCacheEntry* status = &cache->status[location];
const color_t* tile = NULL;
const mColor* tile = NULL;
if (!mMapCacheEntryFlagsIsVramClean(status->flags)) {
status->flags = mMapCacheEntryFlagsFillVramClean(status->flags);
cache->mapParser(cache, status, &cache->vram[cache->mapStart + (location << mMapCacheSystemInfoGetMapAlign(cache->sysConfig))]);
@ -164,7 +164,7 @@ void mMapCacheCleanTile(struct mMapCache* cache, struct mMapCacheEntry* entry, u
}
size_t stride = 8 << mMapCacheSystemInfoGetTilesWide(cache->sysConfig);
color_t* mapOut = &cache->cache[(y * stride + x) * 8];
mColor* mapOut = &cache->cache[(y * stride + x) * 8];
_cleanTile(cache, tile, mapOut, status);
entry[location] = *status;
}
@ -173,7 +173,7 @@ bool mMapCacheCheckTile(struct mMapCache* cache, const struct mMapCacheEntry* en
size_t location = mMapCacheTileId(cache, x, y);
struct mMapCacheEntry* status = &cache->status[location];
int paletteId = mMapCacheEntryFlagsGetPaletteId(status->flags);
const color_t* tile = NULL;
const mColor* tile = NULL;
if (mMapCacheEntryFlagsIsVramClean(status->flags) && memcmp(status, &entry[location], sizeof(*entry)) == 0) {
unsigned tileId = status->tileId + cache->tileStart;
if (tileId >= mTileCacheSystemInfoGetMaxTiles(cache->tileCache->sysConfig)) {
@ -207,13 +207,13 @@ void mMapCacheCleanRow(struct mMapCache* cache, unsigned y) {
if (tileId >= mTileCacheSystemInfoGetMaxTiles(cache->tileCache->sysConfig)) {
tileId = 0;
}
const color_t* tile = mTileCacheGetTile(cache->tileCache, tileId, mMapCacheEntryFlagsGetPaletteId(status->flags));
color_t* mapOut = &cache->cache[(y * stride + x) * 8];
const mColor* tile = mTileCacheGetTile(cache->tileCache, tileId, mMapCacheEntryFlagsGetPaletteId(status->flags));
mColor* mapOut = &cache->cache[(y * stride + x) * 8];
_cleanTile(cache, tile, mapOut, status);
}
}
const color_t* mMapCacheGetRow(struct mMapCache* cache, unsigned y) {
const mColor* mMapCacheGetRow(struct mMapCache* cache, unsigned y) {
size_t stride = 8 << mMapCacheSystemInfoGetTilesWide(cache->sysConfig);
return &cache->cache[y * stride];
}

View File

@ -312,7 +312,7 @@ M_TEST_DEFINE(logging) {
M_TEST_DEFINE(screenshot) {
SETUP_LUA;
CREATE_CORE;
color_t* buffer = malloc(240 * 160 * sizeof(color_t));
mColor* buffer = malloc(240 * 160 * sizeof(mColor));
core->setVideoBuffer(core, buffer, 240);
core->reset(core);
core->runFrame(core);

View File

@ -20,7 +20,7 @@ static void _freeCache(struct mTileCache* cache) {
unsigned size = 1 << mTileCacheSystemInfoGetPaletteCount(cache->sysConfig);
unsigned tiles = mTileCacheSystemInfoGetMaxTiles(cache->sysConfig);
if (cache->cache) {
mappedMemoryFree(cache->cache, 8 * 8 * sizeof(color_t) * tiles * size);
mappedMemoryFree(cache->cache, 8 * 8 * sizeof(mColor) * tiles * size);
cache->cache = NULL;
}
if (cache->status) {
@ -44,7 +44,7 @@ static void _redoCacheSize(struct mTileCache* cache) {
size = 1 << size;
cache->entriesPerTile = size;
unsigned tiles = mTileCacheSystemInfoGetMaxTiles(cache->sysConfig);
cache->cache = anonymousMemoryMap(8 * 8 * sizeof(color_t) * tiles * size);
cache->cache = anonymousMemoryMap(8 * 8 * sizeof(mColor) * tiles * size);
cache->status = anonymousMemoryMap(tiles * size * sizeof(*cache->status));
cache->globalPaletteVersion = calloc(size, sizeof(*cache->globalPaletteVersion));
cache->palette = calloc(size * bpp, sizeof(*cache->palette));
@ -89,7 +89,7 @@ void mTileCacheWriteVRAM(struct mTileCache* cache, uint32_t address) {
}
}
void mTileCacheWritePalette(struct mTileCache* cache, uint32_t entry, color_t color) {
void mTileCacheWritePalette(struct mTileCache* cache, uint32_t entry, mColor color) {
if (entry < cache->paletteBase) {
return;
}
@ -103,10 +103,10 @@ void mTileCacheWritePalette(struct mTileCache* cache, uint32_t entry, color_t co
++cache->globalPaletteVersion[entry];
}
static void _regenerateTile4(struct mTileCache* cache, color_t* tile, unsigned tileId, unsigned paletteId) {
static void _regenerateTile4(struct mTileCache* cache, mColor* tile, unsigned tileId, unsigned paletteId) {
uint8_t* start = (uint8_t*) &cache->vram[tileId << 3];
paletteId <<= 2;
color_t* palette = &cache->palette[paletteId];
mColor* palette = &cache->palette[paletteId];
int i;
for (i = 0; i < 8; ++i) {
uint8_t tileDataLower = start[0];
@ -133,10 +133,10 @@ static void _regenerateTile4(struct mTileCache* cache, color_t* tile, unsigned t
}
}
static void _regenerateTile16(struct mTileCache* cache, color_t* tile, unsigned tileId, unsigned paletteId) {
static void _regenerateTile16(struct mTileCache* cache, mColor* tile, unsigned tileId, unsigned paletteId) {
uint32_t* start = (uint32_t*) &cache->vram[tileId << 4];
paletteId <<= 4;
color_t* palette = &cache->palette[paletteId];
mColor* palette = &cache->palette[paletteId];
int i;
for (i = 0; i < 8; ++i) {
uint32_t line = *start;
@ -162,10 +162,10 @@ static void _regenerateTile16(struct mTileCache* cache, color_t* tile, unsigned
}
}
static void _regenerateTile256(struct mTileCache* cache, color_t* tile, unsigned tileId, unsigned paletteId) {
static void _regenerateTile256(struct mTileCache* cache, mColor* tile, unsigned tileId, unsigned paletteId) {
uint32_t* start = (uint32_t*) &cache->vram[tileId << 5];
paletteId <<= 8;
color_t* palette = &cache->palette[paletteId];
mColor* palette = &cache->palette[paletteId];
int i;
for (i = 0; i < 8; ++i) {
uint32_t line = *start;
@ -194,7 +194,7 @@ static void _regenerateTile256(struct mTileCache* cache, color_t* tile, unsigned
}
}
static inline color_t* _tileLookup(struct mTileCache* cache, unsigned tileId, unsigned paletteId) {
static inline mColor* _tileLookup(struct mTileCache* cache, unsigned tileId, unsigned paletteId) {
if (mTileCacheConfigurationIsShouldStore(cache->config)) {
unsigned tiles = mTileCacheSystemInfoGetMaxTiles(cache->sysConfig);
mASSERT(tileId < tiles);
@ -205,7 +205,7 @@ static inline color_t* _tileLookup(struct mTileCache* cache, unsigned tileId, un
}
}
const color_t* mTileCacheGetTile(struct mTileCache* cache, unsigned tileId, unsigned paletteId) {
const mColor* mTileCacheGetTile(struct mTileCache* cache, unsigned tileId, unsigned paletteId) {
unsigned count = cache->entriesPerTile;
unsigned bpp = cache->bpp;
struct mTileCacheEntry* status = &cache->status[tileId * count + paletteId];
@ -215,7 +215,7 @@ const color_t* mTileCacheGetTile(struct mTileCache* cache, unsigned tileId, unsi
.vramClean = 1,
.paletteId = paletteId
};
color_t* tile = _tileLookup(cache, tileId, paletteId);
mColor* tile = _tileLookup(cache, tileId, paletteId);
if (!mTileCacheConfigurationIsShouldStore(cache->config) || memcmp(status, &desiredStatus, sizeof(*status))) {
switch (bpp) {
case 0:
@ -235,7 +235,7 @@ const color_t* mTileCacheGetTile(struct mTileCache* cache, unsigned tileId, unsi
return tile;
}
const color_t* mTileCacheGetTileIfDirty(struct mTileCache* cache, struct mTileCacheEntry* entry, unsigned tileId, unsigned paletteId) {
const mColor* mTileCacheGetTileIfDirty(struct mTileCache* cache, struct mTileCacheEntry* entry, unsigned tileId, unsigned paletteId) {
unsigned count = cache->entriesPerTile;
unsigned bpp = cache->bpp;
struct mTileCacheEntry* status = &cache->status[tileId * count + paletteId];
@ -245,7 +245,7 @@ const color_t* mTileCacheGetTileIfDirty(struct mTileCache* cache, struct mTileCa
.vramClean = 1,
.paletteId = paletteId
};
color_t* tile = NULL;
mColor* tile = NULL;
if (memcmp(status, &desiredStatus, sizeof(*status))) {
tile = _tileLookup(cache, tileId, paletteId);
switch (bpp) {
@ -270,7 +270,7 @@ const color_t* mTileCacheGetTileIfDirty(struct mTileCache* cache, struct mTileCa
return tile;
}
const color_t* mTileCacheGetPalette(struct mTileCache* cache, unsigned paletteId) {
const mColor* mTileCacheGetPalette(struct mTileCache* cache, unsigned paletteId) {
return &cache->palette[paletteId << (1 << cache->bpp)];
}

View File

@ -190,7 +190,7 @@ bool FFmpegDecoderRead(struct FFmpegDecoder* decoder) {
}
int stride = decoder->width * BYTES_PER_PIXEL;
sws_scale(decoder->scaleContext, (const uint8_t* const*) decoder->videoFrame->data, decoder->videoFrame->linesize, 0, decoder->videoFrame->height, &decoder->pixels, &stride);
decoder->out->postVideoFrame(decoder->out, (const color_t*) decoder->pixels, decoder->width);
decoder->out->postVideoFrame(decoder->out, (const mColor*) decoder->pixels, decoder->width);
}
}
}

View File

@ -34,7 +34,7 @@
#endif
#include <libswscale/swscale.h>
static void _ffmpegPostVideoFrame(struct mAVStream*, const color_t* pixels, size_t stride);
static void _ffmpegPostVideoFrame(struct mAVStream*, const mColor* pixels, size_t stride);
static void _ffmpegPostAudioFrame(struct mAVStream*, int16_t left, int16_t right);
static void _ffmpegSetVideoDimensions(struct mAVStream*, unsigned width, unsigned height);
static void _ffmpegSetAudioRate(struct mAVStream*, unsigned rate);
@ -784,7 +784,7 @@ bool _ffmpegWriteAudioFrame(struct FFmpegEncoder* encoder, struct AVFrame* audio
return gotData;
}
void _ffmpegPostVideoFrame(struct mAVStream* stream, const color_t* pixels, size_t stride) {
void _ffmpegPostVideoFrame(struct mAVStream* stream, const mColor* pixels, size_t stride) {
struct FFmpegEncoder* encoder = (struct FFmpegEncoder*) stream;
if (!encoder->context || !encoder->videoCodec) {
return;

View File

@ -123,7 +123,7 @@ static void _drawState(struct GUIBackground* background, void* id) {
struct mGUIBackground* gbaBackground = (struct mGUIBackground*) background;
unsigned stateId = ((uint32_t) id) >> 16;
if (gbaBackground->p->drawScreenshot) {
color_t* pixels = gbaBackground->image;
mColor* pixels = gbaBackground->image;
if (pixels && gbaBackground->screenshotId == (stateId | SCREENSHOT_VALID)) {
gbaBackground->p->drawScreenshot(gbaBackground->p, pixels, gbaBackground->w, gbaBackground->h, true);
return;

View File

@ -31,7 +31,7 @@ struct mGUIBackground {
struct GUIBackground d;
struct mGUIRunner* p;
color_t* image;
mColor* image;
size_t imageSize;
uint16_t w;
uint16_t h;
@ -86,7 +86,7 @@ struct mGUIRunner {
void (*gameUnloaded)(struct mGUIRunner*);
void (*prepareForFrame)(struct mGUIRunner*);
void (*drawFrame)(struct mGUIRunner*, bool faded);
void (*drawScreenshot)(struct mGUIRunner*, const color_t* pixels, unsigned width, unsigned height, bool faded);
void (*drawScreenshot)(struct mGUIRunner*, const mColor* pixels, unsigned width, unsigned height, bool faded);
void (*paused)(struct mGUIRunner*);
void (*unpaused)(struct mGUIRunner*);
void (*incrementScreenMode)(struct mGUIRunner*);

View File

@ -407,7 +407,7 @@ static size_t _GBCoreScreenRegions(const struct mCore* core, const struct mCoreS
}
}
static void _GBCoreSetVideoBuffer(struct mCore* core, color_t* buffer, size_t stride) {
static void _GBCoreSetVideoBuffer(struct mCore* core, mColor* buffer, size_t stride) {
struct GBCore* gbcore = (struct GBCore*) core;
gbcore->renderer.outputBuffer = buffer;
gbcore->renderer.outputBufferStride = stride;

View File

@ -1173,7 +1173,7 @@ void GBFrameEnded(struct GB* gb) {
// TODO: Move to common code
if (gb->stream && gb->stream->postVideoFrame) {
const color_t* pixels;
const mColor* pixels;
size_t stride;
gb->video.renderer->getPixels(gb->video.renderer, &stride, (const void**) &pixels);
gb->stream->postVideoFrame(gb->stream, pixels, stride);

View File

@ -44,7 +44,7 @@ static void _clearScreen(struct GBVideoSoftwareRenderer* renderer) {
}
int y;
for (y = 0; y < GB_VIDEO_VERTICAL_PIXELS; ++y) {
color_t* row = &renderer->outputBuffer[renderer->outputBufferStride * y + sgbOffset];
mColor* row = &renderer->outputBuffer[renderer->outputBufferStride * y + sgbOffset];
int x;
for (x = 0; x < GB_VIDEO_HORIZONTAL_PIXELS; x += 4) {
row[x + 0] = renderer->palette[0];
@ -492,7 +492,7 @@ static void GBVideoSoftwareRendererWriteSGBPacket(struct GBVideoRenderer* render
static void GBVideoSoftwareRendererWritePalette(struct GBVideoRenderer* renderer, int index, uint16_t value) {
struct GBVideoSoftwareRenderer* softwareRenderer = (struct GBVideoSoftwareRenderer*) renderer;
color_t color = mColorFrom555(value);
mColor color = mColorFrom555(value);
if (softwareRenderer->model & GB_MODEL_SGB) {
if (index >= PAL_SGB_BORDER && !(index & 0xF)) {
color = softwareRenderer->palette[0];
@ -668,7 +668,7 @@ static void GBVideoSoftwareRendererDrawRange(struct GBVideoRenderer* renderer, i
if (softwareRenderer->model & GB_MODEL_SGB && softwareRenderer->sgbBorders) {
sgbOffset = softwareRenderer->outputBufferStride * 40 + 48;
}
color_t* row = &softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * y + sgbOffset];
mColor* row = &softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * y + sgbOffset];
int x = startX;
int p = 0;
switch (softwareRenderer->d.sgbRenderMode) {
@ -1161,7 +1161,7 @@ static void GBVideoSoftwareRendererPutPixels(struct GBVideoRenderer* renderer, s
struct GBVideoSoftwareRenderer* softwareRenderer = (struct GBVideoSoftwareRenderer*) renderer;
// TODO: Share with GBAVideoSoftwareRendererGetPixels
const color_t* colorPixels = pixels;
const mColor* colorPixels = pixels;
unsigned i;
for (i = 0; i < GB_VIDEO_VERTICAL_PIXELS; ++i) {
memmove(&softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * i], &colorPixels[stride * i], GB_VIDEO_HORIZONTAL_PIXELS * BYTES_PER_PIXEL);

View File

@ -525,7 +525,7 @@ static size_t _GBACoreScreenRegions(const struct mCore* core, const struct mCore
return 1;
}
static void _GBACoreSetVideoBuffer(struct mCore* core, color_t* buffer, size_t stride) {
static void _GBACoreSetVideoBuffer(struct mCore* core, mColor* buffer, size_t stride) {
struct GBACore* gbacore = (struct GBACore*) core;
gbacore->renderer.outputBuffer = buffer;
gbacore->renderer.outputBufferStride = stride;

View File

@ -980,7 +980,7 @@ void GBAFrameEnded(struct GBA* gba) {
}
if (gba->stream && gba->stream->postVideoFrame) {
const color_t* pixels;
const mColor* pixels;
size_t stride;
gba->video.renderer->getPixels(gba->video.renderer, &stride, (const void**) &pixels);
gba->stream->postVideoFrame(gba->stream, pixels, stride);

View File

@ -173,7 +173,7 @@ void GBAVideoSoftwareRendererDrawBackgroundMode4(struct GBAVideoSoftwareRenderer
if (!objwinSlowPath) {
_compositeBlendNoObjwin(renderer, pixel, palette[color] | flags, current);
} else if (background->objwinForceEnable || (!(current & FLAG_OBJWIN)) == background->objwinOnly) {
color_t* currentPalette = (current & FLAG_OBJWIN) ? objwinPalette : palette;
mColor* currentPalette = (current & FLAG_OBJWIN) ? objwinPalette : palette;
unsigned mergedFlags = flags;
if (current & FLAG_OBJWIN) {
mergedFlags = objwinFlags;

View File

@ -512,7 +512,7 @@ void GBAVideoSoftwareRendererDrawBackgroundMode0(struct GBAVideoSoftwareRenderer
uint32_t screenBase;
uint32_t charBase;
color_t* palette = renderer->normalPalette;
mColor* palette = renderer->normalPalette;
if (renderer->d.highlightAmount && background->highlight) {
palette = renderer->highlightPalette;
}

View File

@ -182,11 +182,11 @@ int GBAVideoSoftwareRendererPreprocessSprite(struct GBAVideoSoftwareRenderer* re
}
}
color_t* palette = &renderer->normalPalette[0x100];
mColor* palette = &renderer->normalPalette[0x100];
if (renderer->d.highlightAmount && renderer->d.highlightOBJ[index]) {
palette = &renderer->highlightPalette[0x100];
}
color_t* objwinPalette = palette;
mColor* objwinPalette = palette;
if (variant) {
palette = &renderer->variantPalette[0x100];

View File

@ -155,7 +155,7 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
// TODO: Remove UNUSEDs after implementing OBJWIN for modes 3 - 5
#define PREPARE_OBJWIN \
int objwinSlowPath = GBARegisterDISPCNTIsObjwinEnable(renderer->dispcnt); \
color_t* objwinPalette = renderer->normalPalette; \
mColor* objwinPalette = renderer->normalPalette; \
if (renderer->d.highlightAmount && background->highlight) { \
objwinPalette = renderer->highlightPalette; \
} \
@ -194,7 +194,7 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
uint32_t flags = background->flags; \
uint32_t objwinFlags = background->objwinFlags; \
bool variant = background->variant; \
color_t* palette = renderer->normalPalette; \
mColor* palette = renderer->normalPalette; \
if (renderer->d.highlightAmount && background->highlight) { \
palette = renderer->highlightPalette; \
} \

View File

@ -97,7 +97,7 @@ static void GBAVideoSoftwareRendererInit(struct GBAVideoRenderer* renderer) {
int y;
for (y = 0; y < GBA_VIDEO_VERTICAL_PIXELS; ++y) {
color_t* row = &softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * y];
mColor* row = &softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * y];
int x;
for (x = 0; x < GBA_VIDEO_HORIZONTAL_PIXELS; ++x) {
row[x] = M_COLOR_WHITE;
@ -422,7 +422,7 @@ static void GBAVideoSoftwareRendererWriteOAM(struct GBAVideoRenderer* renderer,
static void GBAVideoSoftwareRendererWritePalette(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value) {
struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer;
color_t color = mColorFrom555(value);
mColor color = mColorFrom555(value);
softwareRenderer->normalPalette[address >> 1] = color;
if (softwareRenderer->blendEffect == BLEND_BRIGHTEN) {
softwareRenderer->variantPalette[address >> 1] = _brighten(color, softwareRenderer->bldy);
@ -610,7 +610,7 @@ static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* render
CLEAN_SCANLINE(softwareRenderer, y);
color_t* row = &softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * y];
mColor* row = &softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * y];
if (GBARegisterDISPCNTIsForcedBlank(softwareRenderer->dispcnt)) {
int x;
for (x = 0; x < GBA_VIDEO_HORIZONTAL_PIXELS; ++x) {
@ -781,7 +781,7 @@ static void GBAVideoSoftwareRendererGetPixels(struct GBAVideoRenderer* renderer,
static void GBAVideoSoftwareRendererPutPixels(struct GBAVideoRenderer* renderer, size_t stride, const void* pixels) {
struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer;
const color_t* colorPixels = pixels;
const mColor* colorPixels = pixels;
unsigned i;
for (i = 0; i < GBA_VIDEO_VERTICAL_PIXELS; ++i) {
memmove(&softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * i], &colorPixels[stride * i], GBA_VIDEO_HORIZONTAL_PIXELS * BYTES_PER_PIXEL);

View File

@ -85,8 +85,8 @@ static enum {
} hasSound;
// TODO: Move into context
static color_t* outputBuffer = NULL;
static color_t* screenshotBuffer = NULL;
static mColor* outputBuffer = NULL;
static mColor* screenshotBuffer = NULL;
static struct mAVStream stream;
static int16_t* audioLeft = 0;
static size_t audioPos = 0;
@ -293,7 +293,7 @@ static void _setup(struct mGUIRunner* runner) {
_map3DSKey(&runner->core->inputMap, KEY_L, GBA_KEY_L);
_map3DSKey(&runner->core->inputMap, KEY_R, GBA_KEY_R);
memset(outputBuffer, 0, 256 * 224 * sizeof(color_t));
memset(outputBuffer, 0, 256 * 224 * sizeof(mColor));
runner->core->setVideoBuffer(runner->core, outputBuffer, 256);
unsigned mode;
@ -615,19 +615,19 @@ static void _drawFrame(struct mGUIRunner* runner, bool faded) {
_drawTex(runner->core, faded, interframeBlending);
}
static void _drawScreenshot(struct mGUIRunner* runner, const color_t* pixels, unsigned width, unsigned height, bool faded) {
static void _drawScreenshot(struct mGUIRunner* runner, const mColor* pixels, unsigned width, unsigned height, bool faded) {
C3D_Tex* tex = &outputTexture[activeOutputTexture];
if (!screenshotBuffer) {
screenshotBuffer = linearMemAlign(256 * 224 * sizeof(color_t), 0x80);
screenshotBuffer = linearMemAlign(256 * 224 * sizeof(mColor), 0x80);
}
unsigned y;
for (y = 0; y < height; ++y) {
memcpy(&screenshotBuffer[y * 256], &pixels[y * width], width * sizeof(color_t));
memset(&screenshotBuffer[y * 256 + width], 0, (256 - width) * sizeof(color_t));
memcpy(&screenshotBuffer[y * 256], &pixels[y * width], width * sizeof(mColor));
memset(&screenshotBuffer[y * 256 + width], 0, (256 - width) * sizeof(mColor));
}
GSPGPU_FlushDataCache(screenshotBuffer, 256 * height * sizeof(color_t));
GSPGPU_FlushDataCache(screenshotBuffer, 256 * height * sizeof(mColor));
C3D_SyncDisplayTransfer(
(u32*) screenshotBuffer, GX_BUFFER_DIM(256, height),
tex->data, GX_BUFFER_DIM(256, 256),
@ -917,7 +917,7 @@ int main(int argc, char* argv[]) {
_cleanup();
return 1;
}
outputBuffer = linearMemAlign(256 * 224 * sizeof(color_t), 0x80);
outputBuffer = linearMemAlign(256 * 224 * sizeof(mColor), 0x80);
struct mGUIRunner runner = {
.params = {

View File

@ -37,7 +37,7 @@
#define VIDEO_WIDTH_MAX 256
#define VIDEO_HEIGHT_MAX 224
#define VIDEO_BUFF_SIZE (VIDEO_WIDTH_MAX * VIDEO_HEIGHT_MAX * sizeof(color_t))
#define VIDEO_BUFF_SIZE (VIDEO_WIDTH_MAX * VIDEO_HEIGHT_MAX * sizeof(mColor))
static retro_environment_t environCallback;
static retro_video_refresh_t videoCallback;
@ -66,7 +66,7 @@ static int32_t _readTiltY(struct mRotationSource* source);
static int32_t _readGyroZ(struct mRotationSource* source);
static struct mCore* core;
static color_t* outputBuffer = NULL;
static mColor* outputBuffer = NULL;
static int16_t *audioSampleBuffer = NULL;
static size_t audioSampleBufferSize;
static float audioSamplesPerFrameAvg;

View File

@ -22,7 +22,7 @@ void mPSP2Paused(struct mGUIRunner* runner);
void mPSP2Unpaused(struct mGUIRunner* runner);
void mPSP2Swap(struct mGUIRunner* runner);
void mPSP2Draw(struct mGUIRunner* runner, bool faded);
void mPSP2DrawScreenshot(struct mGUIRunner* runner, const color_t* pixels, unsigned width, unsigned height, bool faded);
void mPSP2DrawScreenshot(struct mGUIRunner* runner, const mColor* pixels, unsigned width, unsigned height, bool faded);
void mPSP2IncrementScreenMode(struct mGUIRunner* runner);
void mPSP2SetFrameLimiter(struct mGUIRunner* runner, bool limit);
uint16_t mPSP2PollInput(struct mGUIRunner* runner);

View File

@ -23,7 +23,7 @@ class Image:
def constitute(self):
if self.stride <= 0:
self.stride = self.width
self.buffer = ffi.new("color_t[{}]".format(self.stride * self.height))
self.buffer = ffi.new("mColor[{}]".format(self.stride * self.height))
def save_png(self, fileobj):
png_file = png.PNG(fileobj, mode=png.MODE_RGBA if self.alpha else png.MODE_RGB)
@ -65,7 +65,7 @@ def u32_to_u16(color):
return abgr
if ffi.sizeof("color_t") == 2:
if ffi.sizeof("mColor") == 2:
def color_to_u16(color):
return color

View File

@ -18,7 +18,7 @@ class Tile:
def composite(self, i, x, y):
for iy in range(8):
ffi.memmove(ffi.addressof(i.buffer, x + (iy + y) * i.stride), ffi.addressof(self.buffer, iy * 8), 8 * ffi.sizeof("color_t"))
ffi.memmove(ffi.addressof(i.buffer, x + (iy + y) * i.stride), ffi.addressof(self.buffer, iy * 8), 8 * ffi.sizeof("mColor"))
class CacheSet:
@ -55,7 +55,7 @@ class MapView:
if not y & 7:
lib.mMapCacheCleanRow(self.cache, y >> 3)
row = lib.mMapCacheGetRow(self.cache, y)
ffi.memmove(ffi.addressof(i.buffer, i.stride * y), row, self.width * 8 * ffi.sizeof("color_t"))
ffi.memmove(ffi.addressof(i.buffer, i.stride * y), row, self.width * 8 * ffi.sizeof("mColor"))
return i

View File

@ -86,7 +86,7 @@ void AssetTile::selectIndex(int index) {
return;
}
m_index = index;
const color_t* data;
const mColor* data;
mTileCache* tileCache = m_tileCaches[index >= m_boundary];
unsigned bpp = 8 << tileCache->bpp;
@ -130,10 +130,10 @@ void AssetTile::setFlip(bool h, bool v) {
}
void AssetTile::selectColor(int index) {
const color_t* data;
const mColor* data;
mTileCache* tileCache = m_tileCaches[m_index >= m_boundary];
data = mTileCacheGetTile(tileCache, m_index >= m_boundary ? m_index - m_boundary : m_index, m_paletteId);
color_t color = data[index];
mColor color = data[index];
m_ui.color->setColor(0, color);
m_ui.color->update();

View File

@ -135,7 +135,7 @@ QImage AssetView::compositeMap(int map, QVector<mMapCacheEntry>* mapStatus) {
QImage AssetView::compositeObj(const ObjInfo& objInfo) {
mTileCache* tileCache = mTileCacheSetGetPointer(&m_cacheSet->tiles, objInfo.paletteSet);
unsigned maxTiles = mTileCacheSystemInfoGetMaxTiles(tileCache->sysConfig);
const color_t* rawPalette = mTileCacheGetPalette(tileCache, objInfo.paletteId);
const mColor* rawPalette = mTileCacheGetPalette(tileCache, objInfo.paletteId);
unsigned colors = 1 << objInfo.bits;
QVector<QRgb> palette;

View File

@ -97,7 +97,7 @@ CoreController::CoreController(mCore* core, QObject* parent)
controller->m_frameCounter = -1;
if (!controller->m_hwaccel) {
context->core->setVideoBuffer(context->core, reinterpret_cast<color_t*>(controller->m_activeBuffer.data()), controller->screenDimensions().width());
context->core->setVideoBuffer(context->core, reinterpret_cast<mColor*>(controller->m_activeBuffer.data()), controller->screenDimensions().width());
}
QString message(tr("Reset r%1-%2 %3").arg(gitRevision).arg(QLatin1String(gitCommitShort)).arg(controller->m_crc32, 8, 16, QLatin1Char('0')));
@ -236,12 +236,12 @@ void CoreController::setPath(const QString& path, const QString& base) {
m_baseDirectory = base;
}
const color_t* CoreController::drawContext() {
const mColor* CoreController::drawContext() {
if (m_hwaccel) {
return nullptr;
}
QMutexLocker locker(&m_bufferMutex);
return reinterpret_cast<const color_t*>(m_completeBuffer.constData());
return reinterpret_cast<const mColor*>(m_completeBuffer.constData());
}
QImage CoreController::getPixels() {
@ -307,14 +307,14 @@ void CoreController::loadConfig(ConfigController* config) {
m_preload = config->getOption("preload").toInt();
QSize sizeBefore = screenDimensions();
m_activeBuffer.resize(256 * 224 * sizeof(color_t));
m_threadContext.core->setVideoBuffer(m_threadContext.core, reinterpret_cast<color_t*>(m_activeBuffer.data()), sizeBefore.width());
m_activeBuffer.resize(256 * 224 * sizeof(mColor));
m_threadContext.core->setVideoBuffer(m_threadContext.core, reinterpret_cast<mColor*>(m_activeBuffer.data()), sizeBefore.width());
mCoreLoadForeignConfig(m_threadContext.core, config->config());
QSize sizeAfter = screenDimensions();
m_activeBuffer.resize(sizeAfter.width() * sizeAfter.height() * sizeof(color_t));
m_threadContext.core->setVideoBuffer(m_threadContext.core, reinterpret_cast<color_t*>(m_activeBuffer.data()), sizeAfter.width());
m_activeBuffer.resize(sizeAfter.width() * sizeAfter.height() * sizeof(mColor));
m_threadContext.core->setVideoBuffer(m_threadContext.core, reinterpret_cast<mColor*>(m_activeBuffer.data()), sizeAfter.width());
if (hasStarted()) {
updateFastForward();
@ -461,11 +461,11 @@ void CoreController::setLogger(LogController* logger) {
void CoreController::start() {
QSize size(screenDimensions());
m_activeBuffer.resize(size.width() * size.height() * sizeof(color_t));
m_activeBuffer.resize(size.width() * size.height() * sizeof(mColor));
m_activeBuffer.fill(0xFF);
m_completeBuffer = m_activeBuffer;
m_threadContext.core->setVideoBuffer(m_threadContext.core, reinterpret_cast<color_t*>(m_activeBuffer.data()), size.width());
m_threadContext.core->setVideoBuffer(m_threadContext.core, reinterpret_cast<mColor*>(m_activeBuffer.data()), size.width());
if (!m_patched) {
mCoreAutoloadPatch(m_threadContext.core);
@ -1194,7 +1194,7 @@ void CoreController::setFramebufferHandle(int fb) {
if (hasStarted()) {
m_threadContext.core->reloadConfigOption(m_threadContext.core, "hwaccelVideo", NULL);
if (!m_hwaccel) {
m_threadContext.core->setVideoBuffer(m_threadContext.core, reinterpret_cast<color_t*>(m_activeBuffer.data()), screenDimensions().width());
m_threadContext.core->setVideoBuffer(m_threadContext.core, reinterpret_cast<mColor*>(m_activeBuffer.data()), screenDimensions().width());
}
}
}

View File

@ -87,7 +87,7 @@ public:
QString baseDirectory() const { return m_baseDirectory; }
QString savePath() const { return m_savePath; }
const color_t* drawContext();
const mColor* drawContext();
QImage getPixels();
bool isPaused();

View File

@ -78,7 +78,7 @@ void DisplayQt::filter(bool filter) {
void DisplayQt::framePosted() {
update();
const color_t* buffer = m_context->drawContext();
const mColor* buffer = m_context->drawContext();
if (const_cast<const QImage&>(m_layers[VIDEO_LAYER_IMAGE]).bits() == reinterpret_cast<const uchar*>(buffer)) {
return;
}

View File

@ -574,7 +574,7 @@ void FrameView::newVl() {
unsigned width, height;
m_vl->baseVideoSize(m_vl, &width, &height);
m_framebuffer = QImage(width, height, QImage::Format_RGBX8888);
m_vl->setVideoBuffer(m_vl, reinterpret_cast<color_t*>(m_framebuffer.bits()), width);
m_vl->setVideoBuffer(m_vl, reinterpret_cast<mColor*>(m_framebuffer.bits()), width);
m_vl->reset(m_vl);
}

View File

@ -138,7 +138,7 @@ void ObjView::updateTilesGBA(bool force) {
for (unsigned y = 0; y < newInfo.height; ++y) {
for (unsigned x = 0; x < newInfo.width; ++x, ++i, ++tile, ++tileBase) {
if (tile < maxTiles) {
const color_t* data = mTileCacheGetTileIfDirty(tileCache, &m_tileStatus[16 * tileBase], tile, newInfo.paletteId);
const mColor* data = mTileCacheGetTileIfDirty(tileCache, &m_tileStatus[16 * tileBase], tile, newInfo.paletteId);
if (data) {
m_ui.tiles->setTile(i, data);
} else if (force) {
@ -233,7 +233,7 @@ void ObjView::updateTilesGB(bool force) {
m_ui.tile->setPalette(newInfo.paletteId);
for (unsigned y = 0; y < newInfo.height; ++y, ++i) {
unsigned t = tile + i;
const color_t* data = mTileCacheGetTileIfDirty(tileCache, &m_tileStatus[8 * t], t, newInfo.paletteId);
const mColor* data = mTileCacheGetTileIfDirty(tileCache, &m_tileStatus[8 * t], t, newInfo.paletteId);
if (data) {
m_ui.tiles->setTile(i, data);
} else if (force) {

View File

@ -62,7 +62,7 @@ void TilePainter::clearTile(int index) {
update(r);
}
void TilePainter::setTile(int index, const color_t* data) {
void TilePainter::setTile(int index, const mColor* data) {
QPainter painter(&m_backing);
int w = width() / m_size;
int x = index % w;

View File

@ -23,7 +23,7 @@ public:
public slots:
void clearTile(int index);
void setTile(int index, const color_t*);
void setTile(int index, const mColor*);
void setTileCount(int tiles);
void setTileMagnification(int mag);

View File

@ -142,7 +142,7 @@ void TileView::updateTilesGBA(bool force) {
objOffset = 0;
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 1);
for (int i = 0; i < 1024; ++i) {
const color_t* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[16 * i], i, 0);
const mColor* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[16 * i], i, 0);
if (data) {
m_ui.tiles->setTile(i, data);
} else if (force) {
@ -153,7 +153,7 @@ void TileView::updateTilesGBA(bool force) {
if (!m_ui.tilesBg->isChecked()) {
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 3);
for (int i = 1024; i < 1536; ++i) {
const color_t* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[16 * i], i - 1024, 0);
const mColor* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[16 * i], i - 1024, 0);
if (data) {
m_ui.tiles->setTile(i - objOffset, data);
} else if (force) {
@ -175,7 +175,7 @@ void TileView::updateTilesGBA(bool force) {
objOffset = 0;
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 0);
for (int i = 0; i < 2048; ++i) {
const color_t* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[16 * i], i, m_paletteId);
const mColor* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[16 * i], i, m_paletteId);
if (data) {
m_ui.tiles->setTile(i, data);
} else if (force) {
@ -186,7 +186,7 @@ void TileView::updateTilesGBA(bool force) {
if (!m_ui.tilesBg->isChecked()) {
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 2);
for (int i = 2048; i < 3072; ++i) {
const color_t* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[16 * i], i - 2048, m_paletteId);
const mColor* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[16 * i], i - 2048, m_paletteId);
if (data) {
m_ui.tiles->setTile(i - objOffset, data);
} else if (force) {
@ -205,7 +205,7 @@ void TileView::updateTilesGB(bool force) {
m_ui.tiles->setTileCount(count);
mTileCache* cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 0);
for (int i = 0; i < count; ++i) {
const color_t* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[8 * i], i, m_paletteId);
const mColor* data = mTileCacheGetTileIfDirty(cache, &m_tileStatus[8 * i], i, m_paletteId);
if (data) {
m_ui.tiles->setTile(i, data);
} else if (force) {

View File

@ -30,7 +30,7 @@ CXX_GUARD_START
struct mCore;
struct mSDLRenderer {
struct mCore* core;
color_t* outputBuffer;
mColor* outputBuffer;
struct mSDLAudio audio;
struct mSDLEvents events;

View File

@ -79,7 +79,7 @@ static GLuint oldTex;
static GLuint screenshotTex;
static struct GUIFont* font;
static color_t* frameBuffer;
static mColor* frameBuffer;
static struct mAVStream stream;
static struct mSwitchRumble {
struct mRumbleIntegrator d;
@ -517,7 +517,7 @@ static void _drawFrame(struct mGUIRunner* runner, bool faded) {
hidSendVibrationValues(vibrationDeviceHandles, values, 4);
}
static void _drawScreenshot(struct mGUIRunner* runner, const color_t* pixels, unsigned width, unsigned height, bool faded) {
static void _drawScreenshot(struct mGUIRunner* runner, const mColor* pixels, unsigned width, unsigned height, bool faded) {
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, screenshotTex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);

View File

@ -684,7 +684,7 @@ static void _cinemaDimensionsChanged(struct mAVStream* stream, unsigned width, u
}
}
static void _cinemaVideoFrame(struct mAVStream* stream, const color_t* pixels, size_t stride) {
static void _cinemaVideoFrame(struct mAVStream* stream, const mColor* pixels, size_t stride) {
struct CInemaStream* cistream = (struct CInemaStream*) stream;
cistream->image->stride = stride;
size_t bufferSize = cistream->image->stride * cistream->image->height * BYTES_PER_PIXEL;