mirror of
https://github.com/libretro/mgba.git
synced 2025-01-21 07:04:50 +00:00
post-merge fixes
This commit is contained in:
parent
31412f00b8
commit
43243c1dc5
@ -318,7 +318,7 @@ else ifeq ($(platform), ctr)
|
||||
CFLAGS += -I$(CTRULIB)/include
|
||||
DEFINES += -std=c99
|
||||
|
||||
PLATFORM_DEFINES += -DUSE_VFS_3DS
|
||||
PLATFORM_DEFINES += -DENABLE_VFS_3DS
|
||||
STATIC_LINKING = 1
|
||||
|
||||
# Xbox 360
|
||||
|
@ -23,7 +23,7 @@ ifneq ($(DEBUG), 1)
|
||||
endif
|
||||
|
||||
ifneq ($(HAVE_VFS_FD),1)
|
||||
RETRODEFS += -DUSE_VFS_FILE
|
||||
RETRODEFS += -DENABLE_VFS_FILE
|
||||
endif
|
||||
|
||||
ifeq (,$(findstring win,$(platform)))
|
||||
@ -91,6 +91,7 @@ SOURCES_C := $(CORE_DIR)/src/arm/arm.c \
|
||||
$(CORE_DIR)/src/gba/gba.c \
|
||||
$(CORE_DIR)/src/gba/cart/gpio.c \
|
||||
$(CORE_DIR)/src/gba/cart/ereader.c \
|
||||
$(CORE_DIR)/src/gba/cart/unlicensed.c \
|
||||
$(CORE_DIR)/src/gba/hle-bios.c \
|
||||
$(CORE_DIR)/src/gba/input.c \
|
||||
$(CORE_DIR)/src/gba/io.c \
|
||||
@ -114,13 +115,16 @@ SOURCES_C := $(CORE_DIR)/src/arm/arm.c \
|
||||
$(CORE_DIR)/src/platform/libretro/libretro.c \
|
||||
$(CORE_DIR)/src/sm83/isa-sm83.c \
|
||||
$(CORE_DIR)/src/sm83/sm83.c \
|
||||
$(CORE_DIR)/src/third-party/blip_buf/blip_buf.c \
|
||||
$(CORE_DIR)/src/third-party/inih/ini.c \
|
||||
$(CORE_DIR)/src/util/audio-buffer.c \
|
||||
$(CORE_DIR)/src/util/circle-buffer.c \
|
||||
$(CORE_DIR)/src/util/configuration.c \
|
||||
$(CORE_DIR)/src/util/formatting.c \
|
||||
$(CORE_DIR)/src/util/gbk-table.c \
|
||||
$(CORE_DIR)/src/util/geometry.c \
|
||||
$(CORE_DIR)/src/util/hash.c \
|
||||
$(CORE_DIR)/src/util/image.c \
|
||||
$(CORE_DIR)/src/util/md5.c \
|
||||
$(CORE_DIR)/src/util/patch.c \
|
||||
$(CORE_DIR)/src/util/patch-ips.c \
|
||||
$(CORE_DIR)/src/util/patch-ups.c \
|
||||
@ -136,6 +140,7 @@ RETRODEFS += -DHAVE_CRC32
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_VFS_FD),1)
|
||||
RETRODEFS += -DENABLE_VFS_FD
|
||||
ifeq ($(platform), vita)
|
||||
SOURCES_C += $(CORE_DIR)/src/platform/psp2/sce-vfs.c
|
||||
else ifeq ($(platform), ctr)
|
||||
|
@ -18,6 +18,7 @@ struct VFile3DS {
|
||||
u64 offset;
|
||||
};
|
||||
|
||||
#ifdef ENABLE_VFS
|
||||
struct VDirEntry3DS {
|
||||
struct VDirEntry d;
|
||||
FS_DirectoryEntry ent[MAX_ENT];
|
||||
@ -33,6 +34,7 @@ struct VDir3DS {
|
||||
Handle handle;
|
||||
struct VDirEntry3DS vde;
|
||||
};
|
||||
#endif
|
||||
|
||||
static bool _vf3dClose(struct VFile* vf);
|
||||
static off_t _vf3dSeek(struct VFile* vf, off_t offset, int whence);
|
||||
@ -44,6 +46,7 @@ static void _vf3dTruncate(struct VFile* vf, size_t size);
|
||||
static ssize_t _vf3dSize(struct VFile* vf);
|
||||
static bool _vf3dSync(struct VFile* vf, void* buffer, size_t size);
|
||||
|
||||
#ifdef ENABLE_VFS
|
||||
static bool _vd3dClose(struct VDir* vd);
|
||||
static void _vd3dRewind(struct VDir* vd);
|
||||
static struct VDirEntry* _vd3dListNext(struct VDir* vd);
|
||||
@ -53,6 +56,7 @@ static bool _vd3dDeleteFile(struct VDir* vd, const char* path);
|
||||
|
||||
static const char* _vd3deName(struct VDirEntry* vde);
|
||||
static enum VFSType _vd3deType(struct VDirEntry* vde);
|
||||
#endif
|
||||
|
||||
struct VFile* VFileOpen3DS(FS_Archive* archive, const char* path, int flags) {
|
||||
struct VFile3DS* vf3d = malloc(sizeof(struct VFile3DS));
|
||||
@ -178,6 +182,7 @@ static bool _vf3dSync(struct VFile* vf, void* buffer, size_t size) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VFS
|
||||
struct VDir* VDirOpen(const char* path) {
|
||||
struct VDir3DS* vd3d = malloc(sizeof(struct VDir3DS));
|
||||
if (!vd3d) {
|
||||
@ -326,3 +331,4 @@ bool VDirCreate(const char* path) {
|
||||
return R_SUCCEEDED(rc) || rc == 0xC82044BE;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -353,7 +353,7 @@ static void _loadAudioLowPassFilterSettings(void) {
|
||||
#define GBA_CC_BG 0.21f
|
||||
#define GBA_CC_GAMMA_ADJ 1.0f
|
||||
|
||||
static color_t* ccLUT = NULL;
|
||||
static mColor* ccLUT = NULL;
|
||||
static unsigned ccType = 0;
|
||||
static bool colorCorrectionEnabled = false;
|
||||
|
||||
@ -456,7 +456,7 @@ static void _initColorCorrection(void) {
|
||||
|
||||
/* Allocate look-up table buffer, if required */
|
||||
if (!ccLUT) {
|
||||
size_t lutSize = 65536 * sizeof(color_t);
|
||||
size_t lutSize = 65536 * sizeof(mColor);
|
||||
ccLUT = malloc(lutSize);
|
||||
if (!ccLUT) {
|
||||
return;
|
||||
@ -553,17 +553,17 @@ enum frame_blend_method
|
||||
|
||||
static enum frame_blend_method frameBlendType = FRAME_BLEND_NONE;
|
||||
static bool frameBlendEnabled = false;
|
||||
static color_t* outputBufferPrev1 = NULL;
|
||||
static color_t* outputBufferPrev2 = NULL;
|
||||
static color_t* outputBufferPrev3 = NULL;
|
||||
static color_t* outputBufferPrev4 = NULL;
|
||||
static mColor* outputBufferPrev1 = NULL;
|
||||
static mColor* outputBufferPrev2 = NULL;
|
||||
static mColor* outputBufferPrev3 = NULL;
|
||||
static mColor* outputBufferPrev4 = NULL;
|
||||
static float* outputBufferAccR = NULL;
|
||||
static float* outputBufferAccG = NULL;
|
||||
static float* outputBufferAccB = NULL;
|
||||
static float frameBlendResponse[4] = {0.0f};
|
||||
static bool frameBlendResponseSet = false;
|
||||
|
||||
static bool _allocateOutputBufferPrev(color_t** buf) {
|
||||
static bool _allocateOutputBufferPrev(mColor** buf) {
|
||||
if (!*buf) {
|
||||
*buf = malloc(VIDEO_BUFF_SIZE);
|
||||
if (!*buf) {
|
||||
@ -721,7 +721,7 @@ static void _loadFrameBlendSettings(void) {
|
||||
}
|
||||
|
||||
/* General post processing buffers/functions */
|
||||
static color_t* ppOutputBuffer = NULL;
|
||||
static mColor* ppOutputBuffer = NULL;
|
||||
|
||||
static void (*videoPostProcess)(unsigned width, unsigned height) = NULL;
|
||||
|
||||
@ -732,8 +732,8 @@ static void (*videoPostProcess)(unsigned width, unsigned height) = NULL;
|
||||
* minimise logic in the inner loops where possible */
|
||||
static void videoPostProcessCc(unsigned width, unsigned height) {
|
||||
|
||||
color_t *src = outputBuffer;
|
||||
color_t *dst = ppOutputBuffer;
|
||||
mColor *src = outputBuffer;
|
||||
mColor *dst = ppOutputBuffer;
|
||||
size_t x, y;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
@ -747,25 +747,25 @@ static void videoPostProcessCc(unsigned width, unsigned height) {
|
||||
|
||||
static void videoPostProcessMix(unsigned width, unsigned height) {
|
||||
|
||||
color_t *srcCurr = outputBuffer;
|
||||
color_t *srcPrev = outputBufferPrev1;
|
||||
color_t *dst = ppOutputBuffer;
|
||||
mColor *srcCurr = outputBuffer;
|
||||
mColor *srcPrev = outputBufferPrev1;
|
||||
mColor *dst = ppOutputBuffer;
|
||||
size_t x, y;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
|
||||
/* Get colours from current + previous frames */
|
||||
color_t rgbCurr = *(srcCurr + x);
|
||||
color_t rgbPrev = *(srcPrev + x);
|
||||
mColor rgbCurr = *(srcCurr + x);
|
||||
mColor rgbPrev = *(srcPrev + x);
|
||||
|
||||
/* Store colours for next frame */
|
||||
*(srcPrev + x) = rgbCurr;
|
||||
*(srcPrev + x) = rgbCurr;
|
||||
|
||||
/* Mix colours
|
||||
* > "Mixing Packed RGB Pixels Efficiently"
|
||||
* http://blargg.8bitalley.com/info/rgb_mixing.html */
|
||||
color_t rgbMix = (rgbCurr + rgbPrev + ((rgbCurr ^ rgbPrev) & 0x821)) >> 1;
|
||||
mColor rgbMix = (rgbCurr + rgbPrev + ((rgbCurr ^ rgbPrev) & 0x821)) >> 1;
|
||||
|
||||
/* Assign colours for current frame */
|
||||
*(dst + x) = colorCorrectionEnabled ?
|
||||
@ -779,21 +779,21 @@ static void videoPostProcessMix(unsigned width, unsigned height) {
|
||||
|
||||
static void videoPostProcessMixSmart(unsigned width, unsigned height) {
|
||||
|
||||
color_t *srcCurr = outputBuffer;
|
||||
color_t *srcPrev1 = outputBufferPrev1;
|
||||
color_t *srcPrev2 = outputBufferPrev2;
|
||||
color_t *srcPrev3 = outputBufferPrev3;
|
||||
color_t *dst = ppOutputBuffer;
|
||||
mColor *srcCurr = outputBuffer;
|
||||
mColor *srcPrev1 = outputBufferPrev1;
|
||||
mColor *srcPrev2 = outputBufferPrev2;
|
||||
mColor *srcPrev3 = outputBufferPrev3;
|
||||
mColor *dst = ppOutputBuffer;
|
||||
size_t x, y;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
|
||||
/* Get colours from current + previous frames */
|
||||
color_t rgbCurr = *(srcCurr + x);
|
||||
color_t rgbPrev1 = *(srcPrev1 + x);
|
||||
color_t rgbPrev2 = *(srcPrev2 + x);
|
||||
color_t rgbPrev3 = *(srcPrev3 + x);
|
||||
mColor rgbCurr = *(srcCurr + x);
|
||||
mColor rgbPrev1 = *(srcPrev1 + x);
|
||||
mColor rgbPrev2 = *(srcPrev2 + x);
|
||||
mColor rgbPrev3 = *(srcPrev3 + x);
|
||||
|
||||
/* Store colours for next frame */
|
||||
*(srcPrev1 + x) = rgbCurr;
|
||||
@ -811,7 +811,7 @@ static void videoPostProcessMixSmart(unsigned width, unsigned height) {
|
||||
/* Mix colours
|
||||
* > "Mixing Packed RGB Pixels Efficiently"
|
||||
* http://blargg.8bitalley.com/info/rgb_mixing.html */
|
||||
color_t rgbMix = (rgbCurr + rgbPrev1 + ((rgbCurr ^ rgbPrev1) & 0x821)) >> 1;
|
||||
mColor rgbMix = (rgbCurr + rgbPrev1 + ((rgbCurr ^ rgbPrev1) & 0x821)) >> 1;
|
||||
|
||||
/* Assign colours for current frame */
|
||||
*(dst + x) = colorCorrectionEnabled ?
|
||||
@ -833,24 +833,24 @@ static void videoPostProcessMixSmart(unsigned width, unsigned height) {
|
||||
|
||||
static void videoPostProcessLcdGhost(unsigned width, unsigned height) {
|
||||
|
||||
color_t *srcCurr = outputBuffer;
|
||||
color_t *srcPrev1 = outputBufferPrev1;
|
||||
color_t *srcPrev2 = outputBufferPrev2;
|
||||
color_t *srcPrev3 = outputBufferPrev3;
|
||||
color_t *srcPrev4 = outputBufferPrev4;
|
||||
color_t *dst = ppOutputBuffer;
|
||||
float *response = frameBlendResponse;
|
||||
mColor *srcCurr = outputBuffer;
|
||||
mColor *srcPrev1 = outputBufferPrev1;
|
||||
mColor *srcPrev2 = outputBufferPrev2;
|
||||
mColor *srcPrev3 = outputBufferPrev3;
|
||||
mColor *srcPrev4 = outputBufferPrev4;
|
||||
mColor *dst = ppOutputBuffer;
|
||||
float *response = frameBlendResponse;
|
||||
size_t x, y;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
|
||||
/* Get colours from current + previous frames */
|
||||
color_t rgbCurr = *(srcCurr + x);
|
||||
color_t rgbPrev1 = *(srcPrev1 + x);
|
||||
color_t rgbPrev2 = *(srcPrev2 + x);
|
||||
color_t rgbPrev3 = *(srcPrev3 + x);
|
||||
color_t rgbPrev4 = *(srcPrev4 + x);
|
||||
mColor rgbCurr = *(srcCurr + x);
|
||||
mColor rgbPrev1 = *(srcPrev1 + x);
|
||||
mColor rgbPrev2 = *(srcPrev2 + x);
|
||||
mColor rgbPrev3 = *(srcPrev3 + x);
|
||||
mColor rgbPrev4 = *(srcPrev4 + x);
|
||||
|
||||
/* Store colours for next frame */
|
||||
*(srcPrev1 + x) = rgbCurr;
|
||||
@ -879,7 +879,7 @@ static void videoPostProcessLcdGhost(unsigned width, unsigned height) {
|
||||
float gPrev4 = (float)(rgbPrev4 >> 6 & 0x1F);
|
||||
float bPrev4 = (float)(rgbPrev4 & 0x1F);
|
||||
|
||||
/* Mix colours for current frame and convert back to color_t
|
||||
/* Mix colours for current frame and convert back to mColor
|
||||
* > Response time effect implemented via an exponential
|
||||
* drop-off algorithm, taken from the 'Gameboy Classic Shader'
|
||||
* by Harlequin:
|
||||
@ -888,19 +888,19 @@ static void videoPostProcessLcdGhost(unsigned width, unsigned height) {
|
||||
rCurr += (rPrev2 - rCurr) * *(response + 1);
|
||||
rCurr += (rPrev3 - rCurr) * *(response + 2);
|
||||
rCurr += (rPrev4 - rCurr) * *(response + 3);
|
||||
color_t rMix = (color_t)(rCurr + 0.5f) & 0x1F;
|
||||
mColor rMix = (mColor)(rCurr + 0.5f) & 0x1F;
|
||||
|
||||
gCurr += (gPrev1 - gCurr) * *response;
|
||||
gCurr += (gPrev2 - gCurr) * *(response + 1);
|
||||
gCurr += (gPrev3 - gCurr) * *(response + 2);
|
||||
gCurr += (gPrev4 - gCurr) * *(response + 3);
|
||||
color_t gMix = (color_t)(gCurr + 0.5f) & 0x1F;
|
||||
mColor gMix = (mColor)(gCurr + 0.5f) & 0x1F;
|
||||
|
||||
bCurr += (bPrev1 - bCurr) * *response;
|
||||
bCurr += (bPrev2 - bCurr) * *(response + 1);
|
||||
bCurr += (bPrev3 - bCurr) * *(response + 2);
|
||||
bCurr += (bPrev4 - bCurr) * *(response + 3);
|
||||
color_t bMix = (color_t)(bCurr + 0.5f) & 0x1F;
|
||||
mColor bMix = (mColor)(bCurr + 0.5f) & 0x1F;
|
||||
|
||||
/* Repack colours for current frame */
|
||||
*(dst + x) = colorCorrectionEnabled ?
|
||||
@ -918,21 +918,21 @@ static void videoPostProcessLcdGhost(unsigned width, unsigned height) {
|
||||
|
||||
static void videoPostProcessLcdGhostFast(unsigned width, unsigned height) {
|
||||
|
||||
color_t *srcCurr = outputBuffer;
|
||||
float *srcPrevR = outputBufferAccR;
|
||||
float *srcPrevG = outputBufferAccG;
|
||||
float *srcPrevB = outputBufferAccB;
|
||||
color_t *dst = ppOutputBuffer;
|
||||
mColor *srcCurr = outputBuffer;
|
||||
float *srcPrevR = outputBufferAccR;
|
||||
float *srcPrevG = outputBufferAccG;
|
||||
float *srcPrevB = outputBufferAccB;
|
||||
mColor *dst = ppOutputBuffer;
|
||||
size_t x, y;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
|
||||
/* Get colours from current + previous frames */
|
||||
color_t rgbCurr = *(srcCurr + x);
|
||||
float rPrev = *(srcPrevR + x);
|
||||
float gPrev = *(srcPrevG + x);
|
||||
float bPrev = *(srcPrevB + x);
|
||||
mColor rgbCurr = *(srcCurr + x);
|
||||
float rPrev = *(srcPrevR + x);
|
||||
float gPrev = *(srcPrevG + x);
|
||||
float bPrev = *(srcPrevB + x);
|
||||
|
||||
/* Unpack current colours and convert to float */
|
||||
float rCurr = (float)(rgbCurr >> 11 & 0x1F);
|
||||
@ -950,9 +950,9 @@ static void videoPostProcessLcdGhostFast(unsigned width, unsigned height) {
|
||||
*(srcPrevB + x) = bMix;
|
||||
|
||||
/* Convert and repack current frame colours */
|
||||
color_t rgbMix = ((color_t)(rMix + 0.5f) & 0x1F) << 11
|
||||
| ((color_t)(gMix + 0.5f) & 0x1F) << 6
|
||||
| ((color_t)(bMix + 0.5f) & 0x1F);
|
||||
mColor rgbMix = ((mColor)(rMix + 0.5f) & 0x1F) << 11
|
||||
| ((mColor)(gMix + 0.5f) & 0x1F) << 6
|
||||
| ((mColor)(bMix + 0.5f) & 0x1F);
|
||||
|
||||
/* Assign colours for current frame */
|
||||
*(dst + x) = colorCorrectionEnabled ?
|
||||
@ -1682,12 +1682,12 @@ void retro_run(void) {
|
||||
#if defined(COLOR_16_BIT) && defined(COLOR_5_6_5)
|
||||
if (videoPostProcess) {
|
||||
videoPostProcess(width, height);
|
||||
videoCallback(ppOutputBuffer, width, height, VIDEO_WIDTH_MAX * sizeof(color_t));
|
||||
videoCallback(ppOutputBuffer, width, height, VIDEO_WIDTH_MAX * sizeof(mColor));
|
||||
} else
|
||||
#endif
|
||||
videoCallback(outputBuffer, width, height, VIDEO_WIDTH_MAX * sizeof(color_t));
|
||||
videoCallback(outputBuffer, width, height, VIDEO_WIDTH_MAX * sizeof(mColor));
|
||||
} else {
|
||||
videoCallback(NULL, width, height, VIDEO_WIDTH_MAX * sizeof(color_t));
|
||||
videoCallback(NULL, width, height, VIDEO_WIDTH_MAX * sizeof(mColor));
|
||||
}
|
||||
|
||||
#ifdef M_CORE_GBA
|
||||
|
@ -21,6 +21,7 @@ struct VFileSce {
|
||||
SceUID fd;
|
||||
};
|
||||
|
||||
#ifdef ENABLE_VFS
|
||||
struct VDirEntrySce {
|
||||
struct VDirEntry d;
|
||||
SceIoDirent ent;
|
||||
@ -32,6 +33,7 @@ struct VDirSce {
|
||||
SceUID fd;
|
||||
char* path;
|
||||
};
|
||||
#endif
|
||||
|
||||
static bool _vfsceClose(struct VFile* vf);
|
||||
static off_t _vfsceSeek(struct VFile* vf, off_t offset, int whence);
|
||||
@ -43,6 +45,7 @@ static void _vfsceTruncate(struct VFile* vf, size_t size);
|
||||
static ssize_t _vfsceSize(struct VFile* vf);
|
||||
static bool _vfsceSync(struct VFile* vf, void* memory, size_t size);
|
||||
|
||||
#ifdef ENABLE_VFS
|
||||
static bool _vdsceClose(struct VDir* vd);
|
||||
static void _vdsceRewind(struct VDir* vd);
|
||||
static struct VDirEntry* _vdsceListNext(struct VDir* vd);
|
||||
@ -62,6 +65,7 @@ static bool _vdlsceDeleteFile(struct VDir* vd, const char* path);
|
||||
|
||||
static const char* _vdlesceName(struct VDirEntry* vde);
|
||||
static enum VFSType _vdlesceType(struct VDirEntry* vde);
|
||||
#endif
|
||||
|
||||
struct VFile* VFileOpenSce(const char* path, int flags, SceMode mode) {
|
||||
struct VFileSce* vfsce = malloc(sizeof(struct VFileSce));
|
||||
@ -161,6 +165,7 @@ bool _vfsceSync(struct VFile* vf, void* buffer, size_t size) {
|
||||
return sceIoSyncByFd(vfsce->fd, 0) >= 0;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VFS
|
||||
struct VDir* VDirOpen(const char* path) {
|
||||
if (!path || !path[0]) {
|
||||
return VDeviceList();
|
||||
@ -370,3 +375,4 @@ bool VDirCreate(const char* path) {
|
||||
sceIoMkdir(path, 0777);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
@ -215,7 +215,7 @@ void separatePath(const char* path, char* dirname, char* basename, char* extensi
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
|
||||
#ifdef ENABLE_VFS
|
||||
bool isAbsolute(const char* path) {
|
||||
// XXX: Is this robust?
|
||||
#ifdef _WIN32
|
||||
@ -250,9 +250,7 @@ void makeAbsolute(const char* path, const char* base, char* out) {
|
||||
#endif
|
||||
strncpy(out, buf, PATH_MAX);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_VFS
|
||||
struct VFile* VDirFindFirst(struct VDir* dir, bool (*filter)(struct VFile*)) {
|
||||
dir->rewind(dir);
|
||||
struct VDirEntry* dirent = dir->listNext(dir);
|
||||
|
Loading…
x
Reference in New Issue
Block a user