mirror of https://github.com/mgba-emu/mgba.git
Util: Rename color_t to avoid namespace conflicts
This commit is contained in:
parent
1c85dba0df
commit
a6914b2ddb
|
@ -11,10 +11,10 @@
|
||||||
CXX_GUARD_START
|
CXX_GUARD_START
|
||||||
|
|
||||||
#ifdef COLOR_16_BIT
|
#ifdef COLOR_16_BIT
|
||||||
typedef uint16_t color_t;
|
typedef uint16_t mColor;
|
||||||
#define BYTES_PER_PIXEL 2
|
#define BYTES_PER_PIXEL 2
|
||||||
#else
|
#else
|
||||||
typedef uint32_t color_t;
|
typedef uint32_t mColor;
|
||||||
#define BYTES_PER_PIXEL 4
|
#define BYTES_PER_PIXEL 4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -210,18 +210,18 @@ static inline bool mColorFormatHasAlpha(enum mColorFormat format) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline color_t mColorFrom555(uint16_t value) {
|
static inline mColor mColorFrom555(uint16_t value) {
|
||||||
#ifdef COLOR_16_BIT
|
#ifdef COLOR_16_BIT
|
||||||
#ifdef COLOR_5_6_5
|
#ifdef COLOR_5_6_5
|
||||||
color_t color = 0;
|
mColor color = 0;
|
||||||
color |= (value & 0x001F) << 11;
|
color |= (value & 0x001F) << 11;
|
||||||
color |= (value & 0x03E0) << 1;
|
color |= (value & 0x03E0) << 1;
|
||||||
color |= (value & 0x7C00) >> 10;
|
color |= (value & 0x7C00) >> 10;
|
||||||
#else
|
#else
|
||||||
color_t color = value;
|
mColor color = value;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
color_t color = M_RGB5_TO_BGR8(value);
|
mColor color = M_RGB5_TO_BGR8(value);
|
||||||
color |= (color >> 5) & 0x070707;
|
color |= (color >> 5) & 0x070707;
|
||||||
#endif
|
#endif
|
||||||
return color;
|
return color;
|
||||||
|
|
|
@ -29,13 +29,13 @@ struct mBitmapCacheEntry {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mBitmapCache {
|
struct mBitmapCache {
|
||||||
color_t* cache;
|
mColor* cache;
|
||||||
struct mBitmapCacheEntry* status;
|
struct mBitmapCacheEntry* status;
|
||||||
|
|
||||||
uint32_t globalPaletteVersion;
|
uint32_t globalPaletteVersion;
|
||||||
|
|
||||||
uint8_t* vram;
|
uint8_t* vram;
|
||||||
color_t* palette;
|
mColor* palette;
|
||||||
|
|
||||||
uint32_t bitsSize;
|
uint32_t bitsSize;
|
||||||
uint32_t bitsStart[2];
|
uint32_t bitsStart[2];
|
||||||
|
@ -53,11 +53,11 @@ void mBitmapCacheDeinit(struct mBitmapCache* cache);
|
||||||
void mBitmapCacheConfigure(struct mBitmapCache* cache, mBitmapCacheConfiguration config);
|
void mBitmapCacheConfigure(struct mBitmapCache* cache, mBitmapCacheConfiguration config);
|
||||||
void mBitmapCacheConfigureSystem(struct mBitmapCache* cache, mBitmapCacheSystemInfo config);
|
void mBitmapCacheConfigureSystem(struct mBitmapCache* cache, mBitmapCacheSystemInfo config);
|
||||||
void mBitmapCacheWriteVRAM(struct mBitmapCache* cache, uint32_t address);
|
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);
|
void mBitmapCacheCleanRow(struct mBitmapCache* cache, struct mBitmapCacheEntry* entry, unsigned y);
|
||||||
bool mBitmapCacheCheckRow(struct mBitmapCache* cache, const 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
|
CXX_GUARD_END
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ void mCacheSetDeinit(struct mCacheSet*);
|
||||||
void mCacheSetAssignVRAM(struct mCacheSet*, void* vram);
|
void mCacheSetAssignVRAM(struct mCacheSet*, void* vram);
|
||||||
|
|
||||||
void mCacheSetWriteVRAM(struct mCacheSet*, uint32_t address);
|
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
|
CXX_GUARD_END
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ struct mCore {
|
||||||
unsigned (*videoScale)(const struct mCore*);
|
unsigned (*videoScale)(const struct mCore*);
|
||||||
size_t (*screenRegions)(const struct mCore*, const struct mCoreScreenRegion**);
|
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 (*setVideoGLTex)(struct mCore*, unsigned texid);
|
||||||
|
|
||||||
void (*getPixels)(struct mCore*, const void** buffer, size_t* stride);
|
void (*getPixels)(struct mCore*, const void** buffer, size_t* stride);
|
||||||
|
|
|
@ -47,7 +47,7 @@ DECLARE_VECTOR(mCoreCallbacksList, struct mCoreCallbacks);
|
||||||
struct mAVStream {
|
struct mAVStream {
|
||||||
void (*videoDimensionsChanged)(struct mAVStream*, unsigned width, unsigned height);
|
void (*videoDimensionsChanged)(struct mAVStream*, unsigned width, unsigned height);
|
||||||
void (*audioRateChanged)(struct mAVStream*, unsigned rate);
|
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 (*postAudioFrame)(struct mAVStream*, int16_t left, int16_t right);
|
||||||
void (*postAudioBuffer)(struct mAVStream*, struct mAudioBuffer*);
|
void (*postAudioBuffer)(struct mAVStream*, struct mAudioBuffer*);
|
||||||
};
|
};
|
||||||
|
|
|
@ -44,7 +44,7 @@ struct mMapCacheEntry {
|
||||||
struct mTileCache;
|
struct mTileCache;
|
||||||
struct mTileCacheEntry;
|
struct mTileCacheEntry;
|
||||||
struct mMapCache {
|
struct mMapCache {
|
||||||
color_t* cache;
|
mColor* cache;
|
||||||
struct mTileCache* tileCache;
|
struct mTileCache* tileCache;
|
||||||
struct mMapCacheEntry* status;
|
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 mMapCacheCleanTile(struct mMapCache* cache, struct mMapCacheEntry* entry, unsigned x, unsigned y);
|
||||||
|
|
||||||
void mMapCacheCleanRow(struct mMapCache* cache, 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
|
CXX_GUARD_END
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ struct mTileCacheEntry {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mTileCache {
|
struct mTileCache {
|
||||||
color_t* cache;
|
mColor* cache;
|
||||||
struct mTileCacheEntry* status;
|
struct mTileCacheEntry* status;
|
||||||
uint32_t* globalPaletteVersion;
|
uint32_t* globalPaletteVersion;
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@ struct mTileCache {
|
||||||
unsigned bpp;
|
unsigned bpp;
|
||||||
|
|
||||||
uint16_t* vram;
|
uint16_t* vram;
|
||||||
color_t* palette;
|
mColor* palette;
|
||||||
color_t temporaryTile[64];
|
mColor temporaryTile[64];
|
||||||
|
|
||||||
mTileCacheConfiguration config;
|
mTileCacheConfiguration config;
|
||||||
mTileCacheSystemInfo sysConfig;
|
mTileCacheSystemInfo sysConfig;
|
||||||
|
@ -51,11 +51,11 @@ void mTileCacheDeinit(struct mTileCache* cache);
|
||||||
void mTileCacheConfigure(struct mTileCache* cache, mTileCacheConfiguration config);
|
void mTileCacheConfigure(struct mTileCache* cache, mTileCacheConfiguration config);
|
||||||
void mTileCacheConfigureSystem(struct mTileCache* cache, mTileCacheSystemInfo config, uint32_t tileBase, uint32_t paletteBase);
|
void mTileCacheConfigureSystem(struct mTileCache* cache, mTileCacheSystemInfo config, uint32_t tileBase, uint32_t paletteBase);
|
||||||
void mTileCacheWriteVRAM(struct mTileCache* cache, uint32_t address);
|
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 mColor* mTileCacheGetTile(struct mTileCache* cache, unsigned tileId, unsigned paletteId);
|
||||||
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);
|
||||||
const color_t* mTileCacheGetPalette(struct mTileCache* cache, unsigned paletteId);
|
const mColor* mTileCacheGetPalette(struct mTileCache* cache, unsigned paletteId);
|
||||||
const uint16_t* mTileCacheGetVRAM(struct mTileCache* cache, unsigned tileId);
|
const uint16_t* mTileCacheGetVRAM(struct mTileCache* cache, unsigned tileId);
|
||||||
|
|
||||||
CXX_GUARD_END
|
CXX_GUARD_END
|
||||||
|
|
|
@ -22,13 +22,13 @@ struct GBVideoRendererSprite {
|
||||||
struct GBVideoSoftwareRenderer {
|
struct GBVideoSoftwareRenderer {
|
||||||
struct GBVideoRenderer d;
|
struct GBVideoRenderer d;
|
||||||
|
|
||||||
color_t* outputBuffer;
|
mColor* outputBuffer;
|
||||||
int outputBufferStride;
|
int outputBufferStride;
|
||||||
|
|
||||||
// TODO: Implement the pixel FIFO
|
// TODO: Implement the pixel FIFO
|
||||||
uint16_t row[GB_VIDEO_HORIZONTAL_PIXELS + 8];
|
uint16_t row[GB_VIDEO_HORIZONTAL_PIXELS + 8];
|
||||||
|
|
||||||
color_t palette[192];
|
mColor palette[192];
|
||||||
uint8_t lookup[192];
|
uint8_t lookup[192];
|
||||||
|
|
||||||
uint32_t* temporaryBuffer;
|
uint32_t* temporaryBuffer;
|
||||||
|
|
|
@ -109,7 +109,7 @@ struct GBVideoRenderer {
|
||||||
bool highlightBG;
|
bool highlightBG;
|
||||||
bool highlightOBJ[GB_VIDEO_MAX_OBJ];
|
bool highlightOBJ[GB_VIDEO_MAX_OBJ];
|
||||||
bool highlightWIN;
|
bool highlightWIN;
|
||||||
color_t highlightColor;
|
mColor highlightColor;
|
||||||
uint8_t highlightAmount;
|
uint8_t highlightAmount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ struct Window {
|
||||||
struct GBAVideoSoftwareRenderer {
|
struct GBAVideoSoftwareRenderer {
|
||||||
struct GBAVideoRenderer d;
|
struct GBAVideoRenderer d;
|
||||||
|
|
||||||
color_t* outputBuffer;
|
mColor* outputBuffer;
|
||||||
int outputBufferStride;
|
int outputBufferStride;
|
||||||
|
|
||||||
uint32_t* temporaryBuffer;
|
uint32_t* temporaryBuffer;
|
||||||
|
@ -100,10 +100,10 @@ struct GBAVideoSoftwareRenderer {
|
||||||
unsigned target2Bd;
|
unsigned target2Bd;
|
||||||
bool blendDirty;
|
bool blendDirty;
|
||||||
enum GBAVideoBlendEffect blendEffect;
|
enum GBAVideoBlendEffect blendEffect;
|
||||||
color_t normalPalette[512];
|
mColor normalPalette[512];
|
||||||
color_t variantPalette[512];
|
mColor variantPalette[512];
|
||||||
color_t highlightPalette[512];
|
mColor highlightPalette[512];
|
||||||
color_t highlightVariantPalette[512];
|
mColor highlightVariantPalette[512];
|
||||||
|
|
||||||
uint16_t blda;
|
uint16_t blda;
|
||||||
uint16_t bldb;
|
uint16_t bldb;
|
||||||
|
|
|
@ -208,7 +208,7 @@ struct GBAVideoRenderer {
|
||||||
|
|
||||||
bool highlightBG[4];
|
bool highlightBG[4];
|
||||||
bool highlightOBJ[128];
|
bool highlightOBJ[128];
|
||||||
color_t highlightColor;
|
mColor highlightColor;
|
||||||
uint8_t highlightAmount;
|
uint8_t highlightAmount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ void mBitmapCacheInit(struct mBitmapCache* cache) {
|
||||||
static void _freeCache(struct mBitmapCache* cache) {
|
static void _freeCache(struct mBitmapCache* cache) {
|
||||||
size_t size = mBitmapCacheSystemInfoGetHeight(cache->sysConfig) * mBitmapCacheSystemInfoGetBuffers(cache->sysConfig);
|
size_t size = mBitmapCacheSystemInfoGetHeight(cache->sysConfig) * mBitmapCacheSystemInfoGetBuffers(cache->sysConfig);
|
||||||
if (cache->cache) {
|
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;
|
cache->cache = NULL;
|
||||||
}
|
}
|
||||||
if (cache->status) {
|
if (cache->status) {
|
||||||
|
@ -39,10 +39,10 @@ static void _redoCacheSize(struct mBitmapCache* cache) {
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size = mBitmapCacheSystemInfoGetHeight(cache->sysConfig) * mBitmapCacheSystemInfoGetBuffers(cache->sysConfig);
|
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));
|
cache->status = anonymousMemoryMap(size * sizeof(*cache->status));
|
||||||
if (mBitmapCacheSystemInfoIsUsesPalette(cache->sysConfig)) {
|
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 {
|
} else {
|
||||||
cache->palette = NULL;
|
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)) {
|
if (!mBitmapCacheSystemInfoIsUsesPalette(cache->sysConfig)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ uint32_t _lookupEntry15(void* vram, uint32_t offset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void mBitmapCacheCleanRow(struct mBitmapCache* cache, struct mBitmapCacheEntry* entry, unsigned y) {
|
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;
|
size_t location = cache->buffer + mBitmapCacheSystemInfoGetBuffers(cache->sysConfig) * y;
|
||||||
struct mBitmapCacheEntry* status = &cache->status[location];
|
struct mBitmapCacheEntry* status = &cache->status[location];
|
||||||
struct mBitmapCacheEntry desiredStatus = {
|
struct mBitmapCacheEntry desiredStatus = {
|
||||||
|
@ -181,7 +181,7 @@ bool mBitmapCacheCheckRow(struct mBitmapCache* cache, const struct mBitmapCacheE
|
||||||
return memcmp(&entry[location], &desiredStatus, sizeof(*entry)) == 0;
|
return memcmp(&entry[location], &desiredStatus, sizeof(*entry)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const color_t* mBitmapCacheGetRow(struct mBitmapCache* cache, unsigned y) {
|
const mColor* mBitmapCacheGetRow(struct mBitmapCache* cache, 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)];
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
size_t i;
|
||||||
for (i = 0; i < mBitmapCacheSetSize(&cache->bitmaps); ++i) {
|
for (i = 0; i < mBitmapCacheSetSize(&cache->bitmaps); ++i) {
|
||||||
mBitmapCacheWritePalette(mBitmapCacheSetGetPointer(&cache->bitmaps, i), entry, color);
|
mBitmapCacheWritePalette(mBitmapCacheSetGetPointer(&cache->bitmaps, i), entry, color);
|
||||||
|
|
|
@ -18,7 +18,7 @@ void mMapCacheInit(struct mMapCache* cache) {
|
||||||
static void _freeCache(struct mMapCache* cache) {
|
static void _freeCache(struct mMapCache* cache) {
|
||||||
size_t tiles = (1 << mMapCacheSystemInfoGetTilesWide(cache->sysConfig)) * (1 << mMapCacheSystemInfoGetTilesHigh(cache->sysConfig));
|
size_t tiles = (1 << mMapCacheSystemInfoGetTilesWide(cache->sysConfig)) * (1 << mMapCacheSystemInfoGetTilesHigh(cache->sysConfig));
|
||||||
if (cache->cache) {
|
if (cache->cache) {
|
||||||
mappedMemoryFree(cache->cache, 8 * 8 * sizeof(color_t) * tiles);
|
mappedMemoryFree(cache->cache, 8 * 8 * sizeof(mColor) * tiles);
|
||||||
cache->cache = NULL;
|
cache->cache = NULL;
|
||||||
}
|
}
|
||||||
if (cache->status) {
|
if (cache->status) {
|
||||||
|
@ -33,7 +33,7 @@ static void _redoCacheSize(struct mMapCache* cache) {
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t tiles = mMapCacheTileCount(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));
|
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);
|
size_t stride = 8 << mMapCacheSystemInfoGetTilesWide(cache->sysConfig);
|
||||||
int x, y;
|
int x, y;
|
||||||
switch (mMapCacheEntryFlagsGetMirror(status->flags)) {
|
switch (mMapCacheEntryFlagsGetMirror(status->flags)) {
|
||||||
case 0:
|
case 0:
|
||||||
memcpy(mapOut, tile, sizeof(color_t) * 8);
|
memcpy(mapOut, tile, sizeof(mColor) * 8);
|
||||||
memcpy(&mapOut[stride], &tile[0x08], sizeof(color_t) * 8);
|
memcpy(&mapOut[stride], &tile[0x08], sizeof(mColor) * 8);
|
||||||
memcpy(&mapOut[stride * 2], &tile[0x10], sizeof(color_t) * 8);
|
memcpy(&mapOut[stride * 2], &tile[0x10], sizeof(mColor) * 8);
|
||||||
memcpy(&mapOut[stride * 3], &tile[0x18], sizeof(color_t) * 8);
|
memcpy(&mapOut[stride * 3], &tile[0x18], sizeof(mColor) * 8);
|
||||||
memcpy(&mapOut[stride * 4], &tile[0x20], sizeof(color_t) * 8);
|
memcpy(&mapOut[stride * 4], &tile[0x20], sizeof(mColor) * 8);
|
||||||
memcpy(&mapOut[stride * 5], &tile[0x28], sizeof(color_t) * 8);
|
memcpy(&mapOut[stride * 5], &tile[0x28], sizeof(mColor) * 8);
|
||||||
memcpy(&mapOut[stride * 6], &tile[0x30], sizeof(color_t) * 8);
|
memcpy(&mapOut[stride * 6], &tile[0x30], sizeof(mColor) * 8);
|
||||||
memcpy(&mapOut[stride * 7], &tile[0x38], sizeof(color_t) * 8);
|
memcpy(&mapOut[stride * 7], &tile[0x38], sizeof(mColor) * 8);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
for (y = 0; y < 8; ++y) {
|
for (y = 0; y < 8; ++y) {
|
||||||
|
@ -109,14 +109,14 @@ static inline void _cleanTile(struct mMapCache* cache, const color_t* tile, colo
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
memcpy(&mapOut[stride * 7], tile, sizeof(color_t) * 8);
|
memcpy(&mapOut[stride * 7], tile, sizeof(mColor) * 8);
|
||||||
memcpy(&mapOut[stride * 6], &tile[0x08], sizeof(color_t) * 8);
|
memcpy(&mapOut[stride * 6], &tile[0x08], sizeof(mColor) * 8);
|
||||||
memcpy(&mapOut[stride * 5], &tile[0x10], sizeof(color_t) * 8);
|
memcpy(&mapOut[stride * 5], &tile[0x10], sizeof(mColor) * 8);
|
||||||
memcpy(&mapOut[stride * 4], &tile[0x18], sizeof(color_t) * 8);
|
memcpy(&mapOut[stride * 4], &tile[0x18], sizeof(mColor) * 8);
|
||||||
memcpy(&mapOut[stride * 3], &tile[0x20], sizeof(color_t) * 8);
|
memcpy(&mapOut[stride * 3], &tile[0x20], sizeof(mColor) * 8);
|
||||||
memcpy(&mapOut[stride * 2], &tile[0x28], sizeof(color_t) * 8);
|
memcpy(&mapOut[stride * 2], &tile[0x28], sizeof(mColor) * 8);
|
||||||
memcpy(&mapOut[stride], &tile[0x30], sizeof(color_t) * 8);
|
memcpy(&mapOut[stride], &tile[0x30], sizeof(mColor) * 8);
|
||||||
memcpy(mapOut, &tile[0x38], sizeof(color_t) * 8);
|
memcpy(mapOut, &tile[0x38], sizeof(mColor) * 8);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
for (y = 0; y < 8; ++y) {
|
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) {
|
void mMapCacheCleanTile(struct mMapCache* cache, struct mMapCacheEntry* entry, unsigned x, unsigned y) {
|
||||||
size_t location = mMapCacheTileId(cache, x, y);
|
size_t location = mMapCacheTileId(cache, x, y);
|
||||||
struct mMapCacheEntry* status = &cache->status[location];
|
struct mMapCacheEntry* status = &cache->status[location];
|
||||||
const color_t* tile = NULL;
|
const mColor* tile = NULL;
|
||||||
if (!mMapCacheEntryFlagsIsVramClean(status->flags)) {
|
if (!mMapCacheEntryFlagsIsVramClean(status->flags)) {
|
||||||
status->flags = mMapCacheEntryFlagsFillVramClean(status->flags);
|
status->flags = mMapCacheEntryFlagsFillVramClean(status->flags);
|
||||||
cache->mapParser(cache, status, &cache->vram[cache->mapStart + (location << mMapCacheSystemInfoGetMapAlign(cache->sysConfig))]);
|
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);
|
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);
|
_cleanTile(cache, tile, mapOut, status);
|
||||||
entry[location] = *status;
|
entry[location] = *status;
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ bool mMapCacheCheckTile(struct mMapCache* cache, const struct mMapCacheEntry* en
|
||||||
size_t location = mMapCacheTileId(cache, x, y);
|
size_t location = mMapCacheTileId(cache, x, y);
|
||||||
struct mMapCacheEntry* status = &cache->status[location];
|
struct mMapCacheEntry* status = &cache->status[location];
|
||||||
int paletteId = mMapCacheEntryFlagsGetPaletteId(status->flags);
|
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) {
|
if (mMapCacheEntryFlagsIsVramClean(status->flags) && memcmp(status, &entry[location], sizeof(*entry)) == 0) {
|
||||||
unsigned tileId = status->tileId + cache->tileStart;
|
unsigned tileId = status->tileId + cache->tileStart;
|
||||||
if (tileId >= mTileCacheSystemInfoGetMaxTiles(cache->tileCache->sysConfig)) {
|
if (tileId >= mTileCacheSystemInfoGetMaxTiles(cache->tileCache->sysConfig)) {
|
||||||
|
@ -207,13 +207,13 @@ void mMapCacheCleanRow(struct mMapCache* cache, unsigned y) {
|
||||||
if (tileId >= mTileCacheSystemInfoGetMaxTiles(cache->tileCache->sysConfig)) {
|
if (tileId >= mTileCacheSystemInfoGetMaxTiles(cache->tileCache->sysConfig)) {
|
||||||
tileId = 0;
|
tileId = 0;
|
||||||
}
|
}
|
||||||
const color_t* tile = mTileCacheGetTile(cache->tileCache, tileId, mMapCacheEntryFlagsGetPaletteId(status->flags));
|
const mColor* tile = mTileCacheGetTile(cache->tileCache, tileId, mMapCacheEntryFlagsGetPaletteId(status->flags));
|
||||||
color_t* mapOut = &cache->cache[(y * stride + x) * 8];
|
mColor* mapOut = &cache->cache[(y * stride + x) * 8];
|
||||||
_cleanTile(cache, tile, mapOut, status);
|
_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);
|
size_t stride = 8 << mMapCacheSystemInfoGetTilesWide(cache->sysConfig);
|
||||||
return &cache->cache[y * stride];
|
return &cache->cache[y * stride];
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,7 +312,7 @@ M_TEST_DEFINE(logging) {
|
||||||
M_TEST_DEFINE(screenshot) {
|
M_TEST_DEFINE(screenshot) {
|
||||||
SETUP_LUA;
|
SETUP_LUA;
|
||||||
CREATE_CORE;
|
CREATE_CORE;
|
||||||
color_t* buffer = malloc(240 * 160 * sizeof(color_t));
|
mColor* buffer = malloc(240 * 160 * sizeof(mColor));
|
||||||
core->setVideoBuffer(core, buffer, 240);
|
core->setVideoBuffer(core, buffer, 240);
|
||||||
core->reset(core);
|
core->reset(core);
|
||||||
core->runFrame(core);
|
core->runFrame(core);
|
||||||
|
|
|
@ -20,7 +20,7 @@ static void _freeCache(struct mTileCache* cache) {
|
||||||
unsigned size = 1 << mTileCacheSystemInfoGetPaletteCount(cache->sysConfig);
|
unsigned size = 1 << mTileCacheSystemInfoGetPaletteCount(cache->sysConfig);
|
||||||
unsigned tiles = mTileCacheSystemInfoGetMaxTiles(cache->sysConfig);
|
unsigned tiles = mTileCacheSystemInfoGetMaxTiles(cache->sysConfig);
|
||||||
if (cache->cache) {
|
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;
|
cache->cache = NULL;
|
||||||
}
|
}
|
||||||
if (cache->status) {
|
if (cache->status) {
|
||||||
|
@ -44,7 +44,7 @@ static void _redoCacheSize(struct mTileCache* cache) {
|
||||||
size = 1 << size;
|
size = 1 << size;
|
||||||
cache->entriesPerTile = size;
|
cache->entriesPerTile = size;
|
||||||
unsigned tiles = mTileCacheSystemInfoGetMaxTiles(cache->sysConfig);
|
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->status = anonymousMemoryMap(tiles * size * sizeof(*cache->status));
|
||||||
cache->globalPaletteVersion = calloc(size, sizeof(*cache->globalPaletteVersion));
|
cache->globalPaletteVersion = calloc(size, sizeof(*cache->globalPaletteVersion));
|
||||||
cache->palette = calloc(size * bpp, sizeof(*cache->palette));
|
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) {
|
if (entry < cache->paletteBase) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -103,10 +103,10 @@ void mTileCacheWritePalette(struct mTileCache* cache, uint32_t entry, color_t co
|
||||||
++cache->globalPaletteVersion[entry];
|
++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];
|
uint8_t* start = (uint8_t*) &cache->vram[tileId << 3];
|
||||||
paletteId <<= 2;
|
paletteId <<= 2;
|
||||||
color_t* palette = &cache->palette[paletteId];
|
mColor* palette = &cache->palette[paletteId];
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 8; ++i) {
|
for (i = 0; i < 8; ++i) {
|
||||||
uint8_t tileDataLower = start[0];
|
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];
|
uint32_t* start = (uint32_t*) &cache->vram[tileId << 4];
|
||||||
paletteId <<= 4;
|
paletteId <<= 4;
|
||||||
color_t* palette = &cache->palette[paletteId];
|
mColor* palette = &cache->palette[paletteId];
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 8; ++i) {
|
for (i = 0; i < 8; ++i) {
|
||||||
uint32_t line = *start;
|
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];
|
uint32_t* start = (uint32_t*) &cache->vram[tileId << 5];
|
||||||
paletteId <<= 8;
|
paletteId <<= 8;
|
||||||
color_t* palette = &cache->palette[paletteId];
|
mColor* palette = &cache->palette[paletteId];
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 8; ++i) {
|
for (i = 0; i < 8; ++i) {
|
||||||
uint32_t line = *start;
|
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)) {
|
if (mTileCacheConfigurationIsShouldStore(cache->config)) {
|
||||||
unsigned tiles = mTileCacheSystemInfoGetMaxTiles(cache->sysConfig);
|
unsigned tiles = mTileCacheSystemInfoGetMaxTiles(cache->sysConfig);
|
||||||
mASSERT(tileId < tiles);
|
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 count = cache->entriesPerTile;
|
||||||
unsigned bpp = cache->bpp;
|
unsigned bpp = cache->bpp;
|
||||||
struct mTileCacheEntry* status = &cache->status[tileId * count + paletteId];
|
struct mTileCacheEntry* status = &cache->status[tileId * count + paletteId];
|
||||||
|
@ -215,7 +215,7 @@ const color_t* mTileCacheGetTile(struct mTileCache* cache, unsigned tileId, unsi
|
||||||
.vramClean = 1,
|
.vramClean = 1,
|
||||||
.paletteId = paletteId
|
.paletteId = paletteId
|
||||||
};
|
};
|
||||||
color_t* tile = _tileLookup(cache, tileId, paletteId);
|
mColor* tile = _tileLookup(cache, tileId, paletteId);
|
||||||
if (!mTileCacheConfigurationIsShouldStore(cache->config) || memcmp(status, &desiredStatus, sizeof(*status))) {
|
if (!mTileCacheConfigurationIsShouldStore(cache->config) || memcmp(status, &desiredStatus, sizeof(*status))) {
|
||||||
switch (bpp) {
|
switch (bpp) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -235,7 +235,7 @@ const color_t* mTileCacheGetTile(struct mTileCache* cache, unsigned tileId, unsi
|
||||||
return tile;
|
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 count = cache->entriesPerTile;
|
||||||
unsigned bpp = cache->bpp;
|
unsigned bpp = cache->bpp;
|
||||||
struct mTileCacheEntry* status = &cache->status[tileId * count + paletteId];
|
struct mTileCacheEntry* status = &cache->status[tileId * count + paletteId];
|
||||||
|
@ -245,7 +245,7 @@ const color_t* mTileCacheGetTileIfDirty(struct mTileCache* cache, struct mTileCa
|
||||||
.vramClean = 1,
|
.vramClean = 1,
|
||||||
.paletteId = paletteId
|
.paletteId = paletteId
|
||||||
};
|
};
|
||||||
color_t* tile = NULL;
|
mColor* tile = NULL;
|
||||||
if (memcmp(status, &desiredStatus, sizeof(*status))) {
|
if (memcmp(status, &desiredStatus, sizeof(*status))) {
|
||||||
tile = _tileLookup(cache, tileId, paletteId);
|
tile = _tileLookup(cache, tileId, paletteId);
|
||||||
switch (bpp) {
|
switch (bpp) {
|
||||||
|
@ -270,7 +270,7 @@ const color_t* mTileCacheGetTileIfDirty(struct mTileCache* cache, struct mTileCa
|
||||||
return tile;
|
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)];
|
return &cache->palette[paletteId << (1 << cache->bpp)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,7 @@ bool FFmpegDecoderRead(struct FFmpegDecoder* decoder) {
|
||||||
}
|
}
|
||||||
int stride = decoder->width * BYTES_PER_PIXEL;
|
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);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include <libswscale/swscale.h>
|
#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 _ffmpegPostAudioFrame(struct mAVStream*, int16_t left, int16_t right);
|
||||||
static void _ffmpegSetVideoDimensions(struct mAVStream*, unsigned width, unsigned height);
|
static void _ffmpegSetVideoDimensions(struct mAVStream*, unsigned width, unsigned height);
|
||||||
static void _ffmpegSetAudioRate(struct mAVStream*, unsigned rate);
|
static void _ffmpegSetAudioRate(struct mAVStream*, unsigned rate);
|
||||||
|
@ -784,7 +784,7 @@ bool _ffmpegWriteAudioFrame(struct FFmpegEncoder* encoder, struct AVFrame* audio
|
||||||
return gotData;
|
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;
|
struct FFmpegEncoder* encoder = (struct FFmpegEncoder*) stream;
|
||||||
if (!encoder->context || !encoder->videoCodec) {
|
if (!encoder->context || !encoder->videoCodec) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -123,7 +123,7 @@ static void _drawState(struct GUIBackground* background, void* id) {
|
||||||
struct mGUIBackground* gbaBackground = (struct mGUIBackground*) background;
|
struct mGUIBackground* gbaBackground = (struct mGUIBackground*) background;
|
||||||
unsigned stateId = ((uint32_t) id) >> 16;
|
unsigned stateId = ((uint32_t) id) >> 16;
|
||||||
if (gbaBackground->p->drawScreenshot) {
|
if (gbaBackground->p->drawScreenshot) {
|
||||||
color_t* pixels = gbaBackground->image;
|
mColor* pixels = gbaBackground->image;
|
||||||
if (pixels && gbaBackground->screenshotId == (stateId | SCREENSHOT_VALID)) {
|
if (pixels && gbaBackground->screenshotId == (stateId | SCREENSHOT_VALID)) {
|
||||||
gbaBackground->p->drawScreenshot(gbaBackground->p, pixels, gbaBackground->w, gbaBackground->h, true);
|
gbaBackground->p->drawScreenshot(gbaBackground->p, pixels, gbaBackground->w, gbaBackground->h, true);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -31,7 +31,7 @@ struct mGUIBackground {
|
||||||
struct GUIBackground d;
|
struct GUIBackground d;
|
||||||
struct mGUIRunner* p;
|
struct mGUIRunner* p;
|
||||||
|
|
||||||
color_t* image;
|
mColor* image;
|
||||||
size_t imageSize;
|
size_t imageSize;
|
||||||
uint16_t w;
|
uint16_t w;
|
||||||
uint16_t h;
|
uint16_t h;
|
||||||
|
@ -86,7 +86,7 @@ struct mGUIRunner {
|
||||||
void (*gameUnloaded)(struct mGUIRunner*);
|
void (*gameUnloaded)(struct mGUIRunner*);
|
||||||
void (*prepareForFrame)(struct mGUIRunner*);
|
void (*prepareForFrame)(struct mGUIRunner*);
|
||||||
void (*drawFrame)(struct mGUIRunner*, bool faded);
|
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 (*paused)(struct mGUIRunner*);
|
||||||
void (*unpaused)(struct mGUIRunner*);
|
void (*unpaused)(struct mGUIRunner*);
|
||||||
void (*incrementScreenMode)(struct mGUIRunner*);
|
void (*incrementScreenMode)(struct mGUIRunner*);
|
||||||
|
|
|
@ -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;
|
struct GBCore* gbcore = (struct GBCore*) core;
|
||||||
gbcore->renderer.outputBuffer = buffer;
|
gbcore->renderer.outputBuffer = buffer;
|
||||||
gbcore->renderer.outputBufferStride = stride;
|
gbcore->renderer.outputBufferStride = stride;
|
||||||
|
|
|
@ -1173,7 +1173,7 @@ void GBFrameEnded(struct GB* gb) {
|
||||||
|
|
||||||
// TODO: Move to common code
|
// TODO: Move to common code
|
||||||
if (gb->stream && gb->stream->postVideoFrame) {
|
if (gb->stream && gb->stream->postVideoFrame) {
|
||||||
const color_t* pixels;
|
const mColor* pixels;
|
||||||
size_t stride;
|
size_t stride;
|
||||||
gb->video.renderer->getPixels(gb->video.renderer, &stride, (const void**) &pixels);
|
gb->video.renderer->getPixels(gb->video.renderer, &stride, (const void**) &pixels);
|
||||||
gb->stream->postVideoFrame(gb->stream, pixels, stride);
|
gb->stream->postVideoFrame(gb->stream, pixels, stride);
|
||||||
|
|
|
@ -44,7 +44,7 @@ static void _clearScreen(struct GBVideoSoftwareRenderer* renderer) {
|
||||||
}
|
}
|
||||||
int y;
|
int y;
|
||||||
for (y = 0; y < GB_VIDEO_VERTICAL_PIXELS; ++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;
|
int x;
|
||||||
for (x = 0; x < GB_VIDEO_HORIZONTAL_PIXELS; x += 4) {
|
for (x = 0; x < GB_VIDEO_HORIZONTAL_PIXELS; x += 4) {
|
||||||
row[x + 0] = renderer->palette[0];
|
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) {
|
static void GBVideoSoftwareRendererWritePalette(struct GBVideoRenderer* renderer, int index, uint16_t value) {
|
||||||
struct GBVideoSoftwareRenderer* softwareRenderer = (struct GBVideoSoftwareRenderer*) renderer;
|
struct GBVideoSoftwareRenderer* softwareRenderer = (struct GBVideoSoftwareRenderer*) renderer;
|
||||||
color_t color = mColorFrom555(value);
|
mColor color = mColorFrom555(value);
|
||||||
if (softwareRenderer->model & GB_MODEL_SGB) {
|
if (softwareRenderer->model & GB_MODEL_SGB) {
|
||||||
if (index >= PAL_SGB_BORDER && !(index & 0xF)) {
|
if (index >= PAL_SGB_BORDER && !(index & 0xF)) {
|
||||||
color = softwareRenderer->palette[0];
|
color = softwareRenderer->palette[0];
|
||||||
|
@ -668,7 +668,7 @@ static void GBVideoSoftwareRendererDrawRange(struct GBVideoRenderer* renderer, i
|
||||||
if (softwareRenderer->model & GB_MODEL_SGB && softwareRenderer->sgbBorders) {
|
if (softwareRenderer->model & GB_MODEL_SGB && softwareRenderer->sgbBorders) {
|
||||||
sgbOffset = softwareRenderer->outputBufferStride * 40 + 48;
|
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 x = startX;
|
||||||
int p = 0;
|
int p = 0;
|
||||||
switch (softwareRenderer->d.sgbRenderMode) {
|
switch (softwareRenderer->d.sgbRenderMode) {
|
||||||
|
@ -1161,7 +1161,7 @@ static void GBVideoSoftwareRendererPutPixels(struct GBVideoRenderer* renderer, s
|
||||||
struct GBVideoSoftwareRenderer* softwareRenderer = (struct GBVideoSoftwareRenderer*) renderer;
|
struct GBVideoSoftwareRenderer* softwareRenderer = (struct GBVideoSoftwareRenderer*) renderer;
|
||||||
// TODO: Share with GBAVideoSoftwareRendererGetPixels
|
// TODO: Share with GBAVideoSoftwareRendererGetPixels
|
||||||
|
|
||||||
const color_t* colorPixels = pixels;
|
const mColor* colorPixels = pixels;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for (i = 0; i < GB_VIDEO_VERTICAL_PIXELS; ++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);
|
memmove(&softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * i], &colorPixels[stride * i], GB_VIDEO_HORIZONTAL_PIXELS * BYTES_PER_PIXEL);
|
||||||
|
|
|
@ -525,7 +525,7 @@ static size_t _GBACoreScreenRegions(const struct mCore* core, const struct mCore
|
||||||
return 1;
|
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;
|
struct GBACore* gbacore = (struct GBACore*) core;
|
||||||
gbacore->renderer.outputBuffer = buffer;
|
gbacore->renderer.outputBuffer = buffer;
|
||||||
gbacore->renderer.outputBufferStride = stride;
|
gbacore->renderer.outputBufferStride = stride;
|
||||||
|
|
|
@ -980,7 +980,7 @@ void GBAFrameEnded(struct GBA* gba) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gba->stream && gba->stream->postVideoFrame) {
|
if (gba->stream && gba->stream->postVideoFrame) {
|
||||||
const color_t* pixels;
|
const mColor* pixels;
|
||||||
size_t stride;
|
size_t stride;
|
||||||
gba->video.renderer->getPixels(gba->video.renderer, &stride, (const void**) &pixels);
|
gba->video.renderer->getPixels(gba->video.renderer, &stride, (const void**) &pixels);
|
||||||
gba->stream->postVideoFrame(gba->stream, pixels, stride);
|
gba->stream->postVideoFrame(gba->stream, pixels, stride);
|
||||||
|
|
|
@ -173,7 +173,7 @@ void GBAVideoSoftwareRendererDrawBackgroundMode4(struct GBAVideoSoftwareRenderer
|
||||||
if (!objwinSlowPath) {
|
if (!objwinSlowPath) {
|
||||||
_compositeBlendNoObjwin(renderer, pixel, palette[color] | flags, current);
|
_compositeBlendNoObjwin(renderer, pixel, palette[color] | flags, current);
|
||||||
} else if (background->objwinForceEnable || (!(current & FLAG_OBJWIN)) == background->objwinOnly) {
|
} 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;
|
unsigned mergedFlags = flags;
|
||||||
if (current & FLAG_OBJWIN) {
|
if (current & FLAG_OBJWIN) {
|
||||||
mergedFlags = objwinFlags;
|
mergedFlags = objwinFlags;
|
||||||
|
|
|
@ -512,7 +512,7 @@ void GBAVideoSoftwareRendererDrawBackgroundMode0(struct GBAVideoSoftwareRenderer
|
||||||
|
|
||||||
uint32_t screenBase;
|
uint32_t screenBase;
|
||||||
uint32_t charBase;
|
uint32_t charBase;
|
||||||
color_t* palette = renderer->normalPalette;
|
mColor* palette = renderer->normalPalette;
|
||||||
if (renderer->d.highlightAmount && background->highlight) {
|
if (renderer->d.highlightAmount && background->highlight) {
|
||||||
palette = renderer->highlightPalette;
|
palette = renderer->highlightPalette;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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]) {
|
if (renderer->d.highlightAmount && renderer->d.highlightOBJ[index]) {
|
||||||
palette = &renderer->highlightPalette[0x100];
|
palette = &renderer->highlightPalette[0x100];
|
||||||
}
|
}
|
||||||
color_t* objwinPalette = palette;
|
mColor* objwinPalette = palette;
|
||||||
|
|
||||||
if (variant) {
|
if (variant) {
|
||||||
palette = &renderer->variantPalette[0x100];
|
palette = &renderer->variantPalette[0x100];
|
||||||
|
|
|
@ -155,7 +155,7 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
||||||
// TODO: Remove UNUSEDs after implementing OBJWIN for modes 3 - 5
|
// TODO: Remove UNUSEDs after implementing OBJWIN for modes 3 - 5
|
||||||
#define PREPARE_OBJWIN \
|
#define PREPARE_OBJWIN \
|
||||||
int objwinSlowPath = GBARegisterDISPCNTIsObjwinEnable(renderer->dispcnt); \
|
int objwinSlowPath = GBARegisterDISPCNTIsObjwinEnable(renderer->dispcnt); \
|
||||||
color_t* objwinPalette = renderer->normalPalette; \
|
mColor* objwinPalette = renderer->normalPalette; \
|
||||||
if (renderer->d.highlightAmount && background->highlight) { \
|
if (renderer->d.highlightAmount && background->highlight) { \
|
||||||
objwinPalette = renderer->highlightPalette; \
|
objwinPalette = renderer->highlightPalette; \
|
||||||
} \
|
} \
|
||||||
|
@ -194,7 +194,7 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
||||||
uint32_t flags = background->flags; \
|
uint32_t flags = background->flags; \
|
||||||
uint32_t objwinFlags = background->objwinFlags; \
|
uint32_t objwinFlags = background->objwinFlags; \
|
||||||
bool variant = background->variant; \
|
bool variant = background->variant; \
|
||||||
color_t* palette = renderer->normalPalette; \
|
mColor* palette = renderer->normalPalette; \
|
||||||
if (renderer->d.highlightAmount && background->highlight) { \
|
if (renderer->d.highlightAmount && background->highlight) { \
|
||||||
palette = renderer->highlightPalette; \
|
palette = renderer->highlightPalette; \
|
||||||
} \
|
} \
|
||||||
|
|
|
@ -97,7 +97,7 @@ static void GBAVideoSoftwareRendererInit(struct GBAVideoRenderer* renderer) {
|
||||||
|
|
||||||
int y;
|
int y;
|
||||||
for (y = 0; y < GBA_VIDEO_VERTICAL_PIXELS; ++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;
|
int x;
|
||||||
for (x = 0; x < GBA_VIDEO_HORIZONTAL_PIXELS; ++x) {
|
for (x = 0; x < GBA_VIDEO_HORIZONTAL_PIXELS; ++x) {
|
||||||
row[x] = M_COLOR_WHITE;
|
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) {
|
static void GBAVideoSoftwareRendererWritePalette(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value) {
|
||||||
struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer;
|
struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer;
|
||||||
color_t color = mColorFrom555(value);
|
mColor color = mColorFrom555(value);
|
||||||
softwareRenderer->normalPalette[address >> 1] = color;
|
softwareRenderer->normalPalette[address >> 1] = color;
|
||||||
if (softwareRenderer->blendEffect == BLEND_BRIGHTEN) {
|
if (softwareRenderer->blendEffect == BLEND_BRIGHTEN) {
|
||||||
softwareRenderer->variantPalette[address >> 1] = _brighten(color, softwareRenderer->bldy);
|
softwareRenderer->variantPalette[address >> 1] = _brighten(color, softwareRenderer->bldy);
|
||||||
|
@ -610,7 +610,7 @@ static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* render
|
||||||
|
|
||||||
CLEAN_SCANLINE(softwareRenderer, y);
|
CLEAN_SCANLINE(softwareRenderer, y);
|
||||||
|
|
||||||
color_t* row = &softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * y];
|
mColor* row = &softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * y];
|
||||||
if (GBARegisterDISPCNTIsForcedBlank(softwareRenderer->dispcnt)) {
|
if (GBARegisterDISPCNTIsForcedBlank(softwareRenderer->dispcnt)) {
|
||||||
int x;
|
int x;
|
||||||
for (x = 0; x < GBA_VIDEO_HORIZONTAL_PIXELS; ++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) {
|
static void GBAVideoSoftwareRendererPutPixels(struct GBAVideoRenderer* renderer, size_t stride, const void* pixels) {
|
||||||
struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer;
|
struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer;
|
||||||
|
|
||||||
const color_t* colorPixels = pixels;
|
const mColor* colorPixels = pixels;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for (i = 0; i < GBA_VIDEO_VERTICAL_PIXELS; ++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);
|
memmove(&softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * i], &colorPixels[stride * i], GBA_VIDEO_HORIZONTAL_PIXELS * BYTES_PER_PIXEL);
|
||||||
|
|
|
@ -85,8 +85,8 @@ static enum {
|
||||||
} hasSound;
|
} hasSound;
|
||||||
|
|
||||||
// TODO: Move into context
|
// TODO: Move into context
|
||||||
static color_t* outputBuffer = NULL;
|
static mColor* outputBuffer = NULL;
|
||||||
static color_t* screenshotBuffer = NULL;
|
static mColor* screenshotBuffer = NULL;
|
||||||
static struct mAVStream stream;
|
static struct mAVStream stream;
|
||||||
static int16_t* audioLeft = 0;
|
static int16_t* audioLeft = 0;
|
||||||
static size_t audioPos = 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_L, GBA_KEY_L);
|
||||||
_map3DSKey(&runner->core->inputMap, KEY_R, GBA_KEY_R);
|
_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);
|
runner->core->setVideoBuffer(runner->core, outputBuffer, 256);
|
||||||
|
|
||||||
unsigned mode;
|
unsigned mode;
|
||||||
|
@ -615,19 +615,19 @@ static void _drawFrame(struct mGUIRunner* runner, bool faded) {
|
||||||
_drawTex(runner->core, faded, interframeBlending);
|
_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];
|
C3D_Tex* tex = &outputTexture[activeOutputTexture];
|
||||||
|
|
||||||
if (!screenshotBuffer) {
|
if (!screenshotBuffer) {
|
||||||
screenshotBuffer = linearMemAlign(256 * 224 * sizeof(color_t), 0x80);
|
screenshotBuffer = linearMemAlign(256 * 224 * sizeof(mColor), 0x80);
|
||||||
}
|
}
|
||||||
unsigned y;
|
unsigned y;
|
||||||
for (y = 0; y < height; ++y) {
|
for (y = 0; y < height; ++y) {
|
||||||
memcpy(&screenshotBuffer[y * 256], &pixels[y * width], width * sizeof(color_t));
|
memcpy(&screenshotBuffer[y * 256], &pixels[y * width], width * sizeof(mColor));
|
||||||
memset(&screenshotBuffer[y * 256 + width], 0, (256 - width) * sizeof(color_t));
|
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(
|
C3D_SyncDisplayTransfer(
|
||||||
(u32*) screenshotBuffer, GX_BUFFER_DIM(256, height),
|
(u32*) screenshotBuffer, GX_BUFFER_DIM(256, height),
|
||||||
tex->data, GX_BUFFER_DIM(256, 256),
|
tex->data, GX_BUFFER_DIM(256, 256),
|
||||||
|
@ -917,7 +917,7 @@ int main(int argc, char* argv[]) {
|
||||||
_cleanup();
|
_cleanup();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
outputBuffer = linearMemAlign(256 * 224 * sizeof(color_t), 0x80);
|
outputBuffer = linearMemAlign(256 * 224 * sizeof(mColor), 0x80);
|
||||||
|
|
||||||
struct mGUIRunner runner = {
|
struct mGUIRunner runner = {
|
||||||
.params = {
|
.params = {
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#define VIDEO_WIDTH_MAX 256
|
#define VIDEO_WIDTH_MAX 256
|
||||||
#define VIDEO_HEIGHT_MAX 224
|
#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_environment_t environCallback;
|
||||||
static retro_video_refresh_t videoCallback;
|
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 int32_t _readGyroZ(struct mRotationSource* source);
|
||||||
|
|
||||||
static struct mCore* core;
|
static struct mCore* core;
|
||||||
static color_t* outputBuffer = NULL;
|
static mColor* outputBuffer = NULL;
|
||||||
static int16_t *audioSampleBuffer = NULL;
|
static int16_t *audioSampleBuffer = NULL;
|
||||||
static size_t audioSampleBufferSize;
|
static size_t audioSampleBufferSize;
|
||||||
static float audioSamplesPerFrameAvg;
|
static float audioSamplesPerFrameAvg;
|
||||||
|
|
|
@ -22,7 +22,7 @@ void mPSP2Paused(struct mGUIRunner* runner);
|
||||||
void mPSP2Unpaused(struct mGUIRunner* runner);
|
void mPSP2Unpaused(struct mGUIRunner* runner);
|
||||||
void mPSP2Swap(struct mGUIRunner* runner);
|
void mPSP2Swap(struct mGUIRunner* runner);
|
||||||
void mPSP2Draw(struct mGUIRunner* runner, bool faded);
|
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 mPSP2IncrementScreenMode(struct mGUIRunner* runner);
|
||||||
void mPSP2SetFrameLimiter(struct mGUIRunner* runner, bool limit);
|
void mPSP2SetFrameLimiter(struct mGUIRunner* runner, bool limit);
|
||||||
uint16_t mPSP2PollInput(struct mGUIRunner* runner);
|
uint16_t mPSP2PollInput(struct mGUIRunner* runner);
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Image:
|
||||||
def constitute(self):
|
def constitute(self):
|
||||||
if self.stride <= 0:
|
if self.stride <= 0:
|
||||||
self.stride = self.width
|
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):
|
def save_png(self, fileobj):
|
||||||
png_file = png.PNG(fileobj, mode=png.MODE_RGBA if self.alpha else png.MODE_RGB)
|
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
|
return abgr
|
||||||
|
|
||||||
|
|
||||||
if ffi.sizeof("color_t") == 2:
|
if ffi.sizeof("mColor") == 2:
|
||||||
def color_to_u16(color):
|
def color_to_u16(color):
|
||||||
return color
|
return color
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Tile:
|
||||||
|
|
||||||
def composite(self, i, x, y):
|
def composite(self, i, x, y):
|
||||||
for iy in range(8):
|
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:
|
class CacheSet:
|
||||||
|
@ -55,7 +55,7 @@ class MapView:
|
||||||
if not y & 7:
|
if not y & 7:
|
||||||
lib.mMapCacheCleanRow(self.cache, y >> 3)
|
lib.mMapCacheCleanRow(self.cache, y >> 3)
|
||||||
row = lib.mMapCacheGetRow(self.cache, y)
|
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
|
return i
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ void AssetTile::selectIndex(int index) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_index = index;
|
m_index = index;
|
||||||
const color_t* data;
|
const mColor* data;
|
||||||
mTileCache* tileCache = m_tileCaches[index >= m_boundary];
|
mTileCache* tileCache = m_tileCaches[index >= m_boundary];
|
||||||
|
|
||||||
unsigned bpp = 8 << tileCache->bpp;
|
unsigned bpp = 8 << tileCache->bpp;
|
||||||
|
@ -130,10 +130,10 @@ void AssetTile::setFlip(bool h, bool v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssetTile::selectColor(int index) {
|
void AssetTile::selectColor(int index) {
|
||||||
const color_t* data;
|
const mColor* data;
|
||||||
mTileCache* tileCache = m_tileCaches[m_index >= m_boundary];
|
mTileCache* tileCache = m_tileCaches[m_index >= m_boundary];
|
||||||
data = mTileCacheGetTile(tileCache, m_index >= m_boundary ? m_index - m_boundary : m_index, m_paletteId);
|
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->setColor(0, color);
|
||||||
m_ui.color->update();
|
m_ui.color->update();
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ QImage AssetView::compositeMap(int map, QVector<mMapCacheEntry>* mapStatus) {
|
||||||
QImage AssetView::compositeObj(const ObjInfo& objInfo) {
|
QImage AssetView::compositeObj(const ObjInfo& objInfo) {
|
||||||
mTileCache* tileCache = mTileCacheSetGetPointer(&m_cacheSet->tiles, objInfo.paletteSet);
|
mTileCache* tileCache = mTileCacheSetGetPointer(&m_cacheSet->tiles, objInfo.paletteSet);
|
||||||
unsigned maxTiles = mTileCacheSystemInfoGetMaxTiles(tileCache->sysConfig);
|
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;
|
unsigned colors = 1 << objInfo.bits;
|
||||||
QVector<QRgb> palette;
|
QVector<QRgb> palette;
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ CoreController::CoreController(mCore* core, QObject* parent)
|
||||||
controller->m_frameCounter = -1;
|
controller->m_frameCounter = -1;
|
||||||
|
|
||||||
if (!controller->m_hwaccel) {
|
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')));
|
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;
|
m_baseDirectory = base;
|
||||||
}
|
}
|
||||||
|
|
||||||
const color_t* CoreController::drawContext() {
|
const mColor* CoreController::drawContext() {
|
||||||
if (m_hwaccel) {
|
if (m_hwaccel) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
QMutexLocker locker(&m_bufferMutex);
|
QMutexLocker locker(&m_bufferMutex);
|
||||||
return reinterpret_cast<const color_t*>(m_completeBuffer.constData());
|
return reinterpret_cast<const mColor*>(m_completeBuffer.constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage CoreController::getPixels() {
|
QImage CoreController::getPixels() {
|
||||||
|
@ -307,14 +307,14 @@ void CoreController::loadConfig(ConfigController* config) {
|
||||||
m_preload = config->getOption("preload").toInt();
|
m_preload = config->getOption("preload").toInt();
|
||||||
|
|
||||||
QSize sizeBefore = screenDimensions();
|
QSize sizeBefore = screenDimensions();
|
||||||
m_activeBuffer.resize(256 * 224 * sizeof(color_t));
|
m_activeBuffer.resize(256 * 224 * sizeof(mColor));
|
||||||
m_threadContext.core->setVideoBuffer(m_threadContext.core, reinterpret_cast<color_t*>(m_activeBuffer.data()), sizeBefore.width());
|
m_threadContext.core->setVideoBuffer(m_threadContext.core, reinterpret_cast<mColor*>(m_activeBuffer.data()), sizeBefore.width());
|
||||||
|
|
||||||
mCoreLoadForeignConfig(m_threadContext.core, config->config());
|
mCoreLoadForeignConfig(m_threadContext.core, config->config());
|
||||||
|
|
||||||
QSize sizeAfter = screenDimensions();
|
QSize sizeAfter = screenDimensions();
|
||||||
m_activeBuffer.resize(sizeAfter.width() * sizeAfter.height() * sizeof(color_t));
|
m_activeBuffer.resize(sizeAfter.width() * sizeAfter.height() * sizeof(mColor));
|
||||||
m_threadContext.core->setVideoBuffer(m_threadContext.core, reinterpret_cast<color_t*>(m_activeBuffer.data()), sizeAfter.width());
|
m_threadContext.core->setVideoBuffer(m_threadContext.core, reinterpret_cast<mColor*>(m_activeBuffer.data()), sizeAfter.width());
|
||||||
|
|
||||||
if (hasStarted()) {
|
if (hasStarted()) {
|
||||||
updateFastForward();
|
updateFastForward();
|
||||||
|
@ -461,11 +461,11 @@ void CoreController::setLogger(LogController* logger) {
|
||||||
|
|
||||||
void CoreController::start() {
|
void CoreController::start() {
|
||||||
QSize size(screenDimensions());
|
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_activeBuffer.fill(0xFF);
|
||||||
m_completeBuffer = m_activeBuffer;
|
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) {
|
if (!m_patched) {
|
||||||
mCoreAutoloadPatch(m_threadContext.core);
|
mCoreAutoloadPatch(m_threadContext.core);
|
||||||
|
@ -1194,7 +1194,7 @@ void CoreController::setFramebufferHandle(int fb) {
|
||||||
if (hasStarted()) {
|
if (hasStarted()) {
|
||||||
m_threadContext.core->reloadConfigOption(m_threadContext.core, "hwaccelVideo", NULL);
|
m_threadContext.core->reloadConfigOption(m_threadContext.core, "hwaccelVideo", NULL);
|
||||||
if (!m_hwaccel) {
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ public:
|
||||||
QString baseDirectory() const { return m_baseDirectory; }
|
QString baseDirectory() const { return m_baseDirectory; }
|
||||||
QString savePath() const { return m_savePath; }
|
QString savePath() const { return m_savePath; }
|
||||||
|
|
||||||
const color_t* drawContext();
|
const mColor* drawContext();
|
||||||
QImage getPixels();
|
QImage getPixels();
|
||||||
|
|
||||||
bool isPaused();
|
bool isPaused();
|
||||||
|
|
|
@ -78,7 +78,7 @@ void DisplayQt::filter(bool filter) {
|
||||||
|
|
||||||
void DisplayQt::framePosted() {
|
void DisplayQt::framePosted() {
|
||||||
update();
|
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)) {
|
if (const_cast<const QImage&>(m_layers[VIDEO_LAYER_IMAGE]).bits() == reinterpret_cast<const uchar*>(buffer)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -574,7 +574,7 @@ void FrameView::newVl() {
|
||||||
unsigned width, height;
|
unsigned width, height;
|
||||||
m_vl->baseVideoSize(m_vl, &width, &height);
|
m_vl->baseVideoSize(m_vl, &width, &height);
|
||||||
m_framebuffer = QImage(width, height, QImage::Format_RGBX8888);
|
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);
|
m_vl->reset(m_vl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ void ObjView::updateTilesGBA(bool force) {
|
||||||
for (unsigned y = 0; y < newInfo.height; ++y) {
|
for (unsigned y = 0; y < newInfo.height; ++y) {
|
||||||
for (unsigned x = 0; x < newInfo.width; ++x, ++i, ++tile, ++tileBase) {
|
for (unsigned x = 0; x < newInfo.width; ++x, ++i, ++tile, ++tileBase) {
|
||||||
if (tile < maxTiles) {
|
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) {
|
if (data) {
|
||||||
m_ui.tiles->setTile(i, data);
|
m_ui.tiles->setTile(i, data);
|
||||||
} else if (force) {
|
} else if (force) {
|
||||||
|
@ -233,7 +233,7 @@ void ObjView::updateTilesGB(bool force) {
|
||||||
m_ui.tile->setPalette(newInfo.paletteId);
|
m_ui.tile->setPalette(newInfo.paletteId);
|
||||||
for (unsigned y = 0; y < newInfo.height; ++y, ++i) {
|
for (unsigned y = 0; y < newInfo.height; ++y, ++i) {
|
||||||
unsigned t = tile + 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) {
|
if (data) {
|
||||||
m_ui.tiles->setTile(i, data);
|
m_ui.tiles->setTile(i, data);
|
||||||
} else if (force) {
|
} else if (force) {
|
||||||
|
|
|
@ -62,7 +62,7 @@ void TilePainter::clearTile(int index) {
|
||||||
update(r);
|
update(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TilePainter::setTile(int index, const color_t* data) {
|
void TilePainter::setTile(int index, const mColor* data) {
|
||||||
QPainter painter(&m_backing);
|
QPainter painter(&m_backing);
|
||||||
int w = width() / m_size;
|
int w = width() / m_size;
|
||||||
int x = index % w;
|
int x = index % w;
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clearTile(int index);
|
void clearTile(int index);
|
||||||
void setTile(int index, const color_t*);
|
void setTile(int index, const mColor*);
|
||||||
void setTileCount(int tiles);
|
void setTileCount(int tiles);
|
||||||
void setTileMagnification(int mag);
|
void setTileMagnification(int mag);
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ void TileView::updateTilesGBA(bool force) {
|
||||||
objOffset = 0;
|
objOffset = 0;
|
||||||
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 1);
|
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 1);
|
||||||
for (int i = 0; i < 1024; ++i) {
|
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) {
|
if (data) {
|
||||||
m_ui.tiles->setTile(i, data);
|
m_ui.tiles->setTile(i, data);
|
||||||
} else if (force) {
|
} else if (force) {
|
||||||
|
@ -153,7 +153,7 @@ void TileView::updateTilesGBA(bool force) {
|
||||||
if (!m_ui.tilesBg->isChecked()) {
|
if (!m_ui.tilesBg->isChecked()) {
|
||||||
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 3);
|
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 3);
|
||||||
for (int i = 1024; i < 1536; ++i) {
|
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) {
|
if (data) {
|
||||||
m_ui.tiles->setTile(i - objOffset, data);
|
m_ui.tiles->setTile(i - objOffset, data);
|
||||||
} else if (force) {
|
} else if (force) {
|
||||||
|
@ -175,7 +175,7 @@ void TileView::updateTilesGBA(bool force) {
|
||||||
objOffset = 0;
|
objOffset = 0;
|
||||||
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 0);
|
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 0);
|
||||||
for (int i = 0; i < 2048; ++i) {
|
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) {
|
if (data) {
|
||||||
m_ui.tiles->setTile(i, data);
|
m_ui.tiles->setTile(i, data);
|
||||||
} else if (force) {
|
} else if (force) {
|
||||||
|
@ -186,7 +186,7 @@ void TileView::updateTilesGBA(bool force) {
|
||||||
if (!m_ui.tilesBg->isChecked()) {
|
if (!m_ui.tilesBg->isChecked()) {
|
||||||
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 2);
|
cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 2);
|
||||||
for (int i = 2048; i < 3072; ++i) {
|
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) {
|
if (data) {
|
||||||
m_ui.tiles->setTile(i - objOffset, data);
|
m_ui.tiles->setTile(i - objOffset, data);
|
||||||
} else if (force) {
|
} else if (force) {
|
||||||
|
@ -205,7 +205,7 @@ void TileView::updateTilesGB(bool force) {
|
||||||
m_ui.tiles->setTileCount(count);
|
m_ui.tiles->setTileCount(count);
|
||||||
mTileCache* cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 0);
|
mTileCache* cache = mTileCacheSetGetPointer(&m_cacheSet->tiles, 0);
|
||||||
for (int i = 0; i < count; ++i) {
|
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) {
|
if (data) {
|
||||||
m_ui.tiles->setTile(i, data);
|
m_ui.tiles->setTile(i, data);
|
||||||
} else if (force) {
|
} else if (force) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ CXX_GUARD_START
|
||||||
struct mCore;
|
struct mCore;
|
||||||
struct mSDLRenderer {
|
struct mSDLRenderer {
|
||||||
struct mCore* core;
|
struct mCore* core;
|
||||||
color_t* outputBuffer;
|
mColor* outputBuffer;
|
||||||
|
|
||||||
struct mSDLAudio audio;
|
struct mSDLAudio audio;
|
||||||
struct mSDLEvents events;
|
struct mSDLEvents events;
|
||||||
|
|
|
@ -79,7 +79,7 @@ static GLuint oldTex;
|
||||||
static GLuint screenshotTex;
|
static GLuint screenshotTex;
|
||||||
|
|
||||||
static struct GUIFont* font;
|
static struct GUIFont* font;
|
||||||
static color_t* frameBuffer;
|
static mColor* frameBuffer;
|
||||||
static struct mAVStream stream;
|
static struct mAVStream stream;
|
||||||
static struct mSwitchRumble {
|
static struct mSwitchRumble {
|
||||||
struct mRumbleIntegrator d;
|
struct mRumbleIntegrator d;
|
||||||
|
@ -517,7 +517,7 @@ static void _drawFrame(struct mGUIRunner* runner, bool faded) {
|
||||||
hidSendVibrationValues(vibrationDeviceHandles, values, 4);
|
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);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, screenshotTex);
|
glBindTexture(GL_TEXTURE_2D, screenshotTex);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||||
|
|
|
@ -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;
|
struct CInemaStream* cistream = (struct CInemaStream*) stream;
|
||||||
cistream->image->stride = stride;
|
cistream->image->stride = stride;
|
||||||
size_t bufferSize = cistream->image->stride * cistream->image->height * BYTES_PER_PIXEL;
|
size_t bufferSize = cistream->image->stride * cistream->image->height * BYTES_PER_PIXEL;
|
||||||
|
|
Loading…
Reference in New Issue