Skip to content

Commit 43243c1

Browse files
committed
post-merge fixes
1 parent 31412f0 commit 43243c1

File tree

6 files changed

+79
-64
lines changed

6 files changed

+79
-64
lines changed

Makefile.libretro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ else ifeq ($(platform), ctr)
318318
CFLAGS += -I$(CTRULIB)/include
319319
DEFINES += -std=c99
320320

321-
PLATFORM_DEFINES += -DUSE_VFS_3DS
321+
PLATFORM_DEFINES += -DENABLE_VFS_3DS
322322
STATIC_LINKING = 1
323323

324324
# Xbox 360

libretro-build/Makefile.common

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ifneq ($(DEBUG), 1)
2323
endif
2424

2525
ifneq ($(HAVE_VFS_FD),1)
26-
RETRODEFS += -DUSE_VFS_FILE
26+
RETRODEFS += -DENABLE_VFS_FILE
2727
endif
2828

2929
ifeq (,$(findstring win,$(platform)))
@@ -91,6 +91,7 @@ SOURCES_C := $(CORE_DIR)/src/arm/arm.c \
9191
$(CORE_DIR)/src/gba/gba.c \
9292
$(CORE_DIR)/src/gba/cart/gpio.c \
9393
$(CORE_DIR)/src/gba/cart/ereader.c \
94+
$(CORE_DIR)/src/gba/cart/unlicensed.c \
9495
$(CORE_DIR)/src/gba/hle-bios.c \
9596
$(CORE_DIR)/src/gba/input.c \
9697
$(CORE_DIR)/src/gba/io.c \
@@ -114,13 +115,16 @@ SOURCES_C := $(CORE_DIR)/src/arm/arm.c \
114115
$(CORE_DIR)/src/platform/libretro/libretro.c \
115116
$(CORE_DIR)/src/sm83/isa-sm83.c \
116117
$(CORE_DIR)/src/sm83/sm83.c \
117-
$(CORE_DIR)/src/third-party/blip_buf/blip_buf.c \
118118
$(CORE_DIR)/src/third-party/inih/ini.c \
119+
$(CORE_DIR)/src/util/audio-buffer.c \
119120
$(CORE_DIR)/src/util/circle-buffer.c \
120121
$(CORE_DIR)/src/util/configuration.c \
121122
$(CORE_DIR)/src/util/formatting.c \
122123
$(CORE_DIR)/src/util/gbk-table.c \
124+
$(CORE_DIR)/src/util/geometry.c \
123125
$(CORE_DIR)/src/util/hash.c \
126+
$(CORE_DIR)/src/util/image.c \
127+
$(CORE_DIR)/src/util/md5.c \
124128
$(CORE_DIR)/src/util/patch.c \
125129
$(CORE_DIR)/src/util/patch-ips.c \
126130
$(CORE_DIR)/src/util/patch-ups.c \
@@ -136,6 +140,7 @@ RETRODEFS += -DHAVE_CRC32
136140
endif
137141

138142
ifeq ($(HAVE_VFS_FD),1)
143+
RETRODEFS += -DENABLE_VFS_FD
139144
ifeq ($(platform), vita)
140145
SOURCES_C += $(CORE_DIR)/src/platform/psp2/sce-vfs.c
141146
else ifeq ($(platform), ctr)

src/platform/3ds/3ds-vfs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ struct VFile3DS {
1818
u64 offset;
1919
};
2020

21+
#ifdef ENABLE_VFS
2122
struct VDirEntry3DS {
2223
struct VDirEntry d;
2324
FS_DirectoryEntry ent[MAX_ENT];
@@ -33,6 +34,7 @@ struct VDir3DS {
3334
Handle handle;
3435
struct VDirEntry3DS vde;
3536
};
37+
#endif
3638

3739
static bool _vf3dClose(struct VFile* vf);
3840
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);
4446
static ssize_t _vf3dSize(struct VFile* vf);
4547
static bool _vf3dSync(struct VFile* vf, void* buffer, size_t size);
4648

49+
#ifdef ENABLE_VFS
4750
static bool _vd3dClose(struct VDir* vd);
4851
static void _vd3dRewind(struct VDir* vd);
4952
static struct VDirEntry* _vd3dListNext(struct VDir* vd);
@@ -53,6 +56,7 @@ static bool _vd3dDeleteFile(struct VDir* vd, const char* path);
5356

5457
static const char* _vd3deName(struct VDirEntry* vde);
5558
static enum VFSType _vd3deType(struct VDirEntry* vde);
59+
#endif
5660

5761
struct VFile* VFileOpen3DS(FS_Archive* archive, const char* path, int flags) {
5862
struct VFile3DS* vf3d = malloc(sizeof(struct VFile3DS));
@@ -178,6 +182,7 @@ static bool _vf3dSync(struct VFile* vf, void* buffer, size_t size) {
178182
return true;
179183
}
180184

185+
#ifdef ENABLE_VFS
181186
struct VDir* VDirOpen(const char* path) {
182187
struct VDir3DS* vd3d = malloc(sizeof(struct VDir3DS));
183188
if (!vd3d) {
@@ -326,3 +331,4 @@ bool VDirCreate(const char* path) {
326331
return R_SUCCEEDED(rc) || rc == 0xC82044BE;
327332
}
328333
#endif
334+
#endif

src/platform/libretro/libretro.c

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ static void _loadAudioLowPassFilterSettings(void) {
353353
#define GBA_CC_BG 0.21f
354354
#define GBA_CC_GAMMA_ADJ 1.0f
355355

356-
static color_t* ccLUT = NULL;
356+
static mColor* ccLUT = NULL;
357357
static unsigned ccType = 0;
358358
static bool colorCorrectionEnabled = false;
359359

@@ -456,7 +456,7 @@ static void _initColorCorrection(void) {
456456

457457
/* Allocate look-up table buffer, if required */
458458
if (!ccLUT) {
459-
size_t lutSize = 65536 * sizeof(color_t);
459+
size_t lutSize = 65536 * sizeof(mColor);
460460
ccLUT = malloc(lutSize);
461461
if (!ccLUT) {
462462
return;
@@ -553,17 +553,17 @@ enum frame_blend_method
553553

554554
static enum frame_blend_method frameBlendType = FRAME_BLEND_NONE;
555555
static bool frameBlendEnabled = false;
556-
static color_t* outputBufferPrev1 = NULL;
557-
static color_t* outputBufferPrev2 = NULL;
558-
static color_t* outputBufferPrev3 = NULL;
559-
static color_t* outputBufferPrev4 = NULL;
556+
static mColor* outputBufferPrev1 = NULL;
557+
static mColor* outputBufferPrev2 = NULL;
558+
static mColor* outputBufferPrev3 = NULL;
559+
static mColor* outputBufferPrev4 = NULL;
560560
static float* outputBufferAccR = NULL;
561561
static float* outputBufferAccG = NULL;
562562
static float* outputBufferAccB = NULL;
563563
static float frameBlendResponse[4] = {0.0f};
564564
static bool frameBlendResponseSet = false;
565565

566-
static bool _allocateOutputBufferPrev(color_t** buf) {
566+
static bool _allocateOutputBufferPrev(mColor** buf) {
567567
if (!*buf) {
568568
*buf = malloc(VIDEO_BUFF_SIZE);
569569
if (!*buf) {
@@ -721,7 +721,7 @@ static void _loadFrameBlendSettings(void) {
721721
}
722722

723723
/* General post processing buffers/functions */
724-
static color_t* ppOutputBuffer = NULL;
724+
static mColor* ppOutputBuffer = NULL;
725725

726726
static void (*videoPostProcess)(unsigned width, unsigned height) = NULL;
727727

@@ -732,8 +732,8 @@ static void (*videoPostProcess)(unsigned width, unsigned height) = NULL;
732732
* minimise logic in the inner loops where possible */
733733
static void videoPostProcessCc(unsigned width, unsigned height) {
734734

735-
color_t *src = outputBuffer;
736-
color_t *dst = ppOutputBuffer;
735+
mColor *src = outputBuffer;
736+
mColor *dst = ppOutputBuffer;
737737
size_t x, y;
738738

739739
for (y = 0; y < height; y++) {
@@ -747,25 +747,25 @@ static void videoPostProcessCc(unsigned width, unsigned height) {
747747

748748
static void videoPostProcessMix(unsigned width, unsigned height) {
749749

750-
color_t *srcCurr = outputBuffer;
751-
color_t *srcPrev = outputBufferPrev1;
752-
color_t *dst = ppOutputBuffer;
750+
mColor *srcCurr = outputBuffer;
751+
mColor *srcPrev = outputBufferPrev1;
752+
mColor *dst = ppOutputBuffer;
753753
size_t x, y;
754754

755755
for (y = 0; y < height; y++) {
756756
for (x = 0; x < width; x++) {
757757

758758
/* Get colours from current + previous frames */
759-
color_t rgbCurr = *(srcCurr + x);
760-
color_t rgbPrev = *(srcPrev + x);
759+
mColor rgbCurr = *(srcCurr + x);
760+
mColor rgbPrev = *(srcPrev + x);
761761

762762
/* Store colours for next frame */
763-
*(srcPrev + x) = rgbCurr;
763+
*(srcPrev + x) = rgbCurr;
764764

765765
/* Mix colours
766766
* > "Mixing Packed RGB Pixels Efficiently"
767767
* http://blargg.8bitalley.com/info/rgb_mixing.html */
768-
color_t rgbMix = (rgbCurr + rgbPrev + ((rgbCurr ^ rgbPrev) & 0x821)) >> 1;
768+
mColor rgbMix = (rgbCurr + rgbPrev + ((rgbCurr ^ rgbPrev) & 0x821)) >> 1;
769769

770770
/* Assign colours for current frame */
771771
*(dst + x) = colorCorrectionEnabled ?
@@ -779,21 +779,21 @@ static void videoPostProcessMix(unsigned width, unsigned height) {
779779

780780
static void videoPostProcessMixSmart(unsigned width, unsigned height) {
781781

782-
color_t *srcCurr = outputBuffer;
783-
color_t *srcPrev1 = outputBufferPrev1;
784-
color_t *srcPrev2 = outputBufferPrev2;
785-
color_t *srcPrev3 = outputBufferPrev3;
786-
color_t *dst = ppOutputBuffer;
782+
mColor *srcCurr = outputBuffer;
783+
mColor *srcPrev1 = outputBufferPrev1;
784+
mColor *srcPrev2 = outputBufferPrev2;
785+
mColor *srcPrev3 = outputBufferPrev3;
786+
mColor *dst = ppOutputBuffer;
787787
size_t x, y;
788788

789789
for (y = 0; y < height; y++) {
790790
for (x = 0; x < width; x++) {
791791

792792
/* Get colours from current + previous frames */
793-
color_t rgbCurr = *(srcCurr + x);
794-
color_t rgbPrev1 = *(srcPrev1 + x);
795-
color_t rgbPrev2 = *(srcPrev2 + x);
796-
color_t rgbPrev3 = *(srcPrev3 + x);
793+
mColor rgbCurr = *(srcCurr + x);
794+
mColor rgbPrev1 = *(srcPrev1 + x);
795+
mColor rgbPrev2 = *(srcPrev2 + x);
796+
mColor rgbPrev3 = *(srcPrev3 + x);
797797

798798
/* Store colours for next frame */
799799
*(srcPrev1 + x) = rgbCurr;
@@ -811,7 +811,7 @@ static void videoPostProcessMixSmart(unsigned width, unsigned height) {
811811
/* Mix colours
812812
* > "Mixing Packed RGB Pixels Efficiently"
813813
* http://blargg.8bitalley.com/info/rgb_mixing.html */
814-
color_t rgbMix = (rgbCurr + rgbPrev1 + ((rgbCurr ^ rgbPrev1) & 0x821)) >> 1;
814+
mColor rgbMix = (rgbCurr + rgbPrev1 + ((rgbCurr ^ rgbPrev1) & 0x821)) >> 1;
815815

816816
/* Assign colours for current frame */
817817
*(dst + x) = colorCorrectionEnabled ?
@@ -833,24 +833,24 @@ static void videoPostProcessMixSmart(unsigned width, unsigned height) {
833833

834834
static void videoPostProcessLcdGhost(unsigned width, unsigned height) {
835835

836-
color_t *srcCurr = outputBuffer;
837-
color_t *srcPrev1 = outputBufferPrev1;
838-
color_t *srcPrev2 = outputBufferPrev2;
839-
color_t *srcPrev3 = outputBufferPrev3;
840-
color_t *srcPrev4 = outputBufferPrev4;
841-
color_t *dst = ppOutputBuffer;
842-
float *response = frameBlendResponse;
836+
mColor *srcCurr = outputBuffer;
837+
mColor *srcPrev1 = outputBufferPrev1;
838+
mColor *srcPrev2 = outputBufferPrev2;
839+
mColor *srcPrev3 = outputBufferPrev3;
840+
mColor *srcPrev4 = outputBufferPrev4;
841+
mColor *dst = ppOutputBuffer;
842+
float *response = frameBlendResponse;
843843
size_t x, y;
844844

845845
for (y = 0; y < height; y++) {
846846
for (x = 0; x < width; x++) {
847847

848848
/* Get colours from current + previous frames */
849-
color_t rgbCurr = *(srcCurr + x);
850-
color_t rgbPrev1 = *(srcPrev1 + x);
851-
color_t rgbPrev2 = *(srcPrev2 + x);
852-
color_t rgbPrev3 = *(srcPrev3 + x);
853-
color_t rgbPrev4 = *(srcPrev4 + x);
849+
mColor rgbCurr = *(srcCurr + x);
850+
mColor rgbPrev1 = *(srcPrev1 + x);
851+
mColor rgbPrev2 = *(srcPrev2 + x);
852+
mColor rgbPrev3 = *(srcPrev3 + x);
853+
mColor rgbPrev4 = *(srcPrev4 + x);
854854

855855
/* Store colours for next frame */
856856
*(srcPrev1 + x) = rgbCurr;
@@ -879,7 +879,7 @@ static void videoPostProcessLcdGhost(unsigned width, unsigned height) {
879879
float gPrev4 = (float)(rgbPrev4 >> 6 & 0x1F);
880880
float bPrev4 = (float)(rgbPrev4 & 0x1F);
881881

882-
/* Mix colours for current frame and convert back to color_t
882+
/* Mix colours for current frame and convert back to mColor
883883
* > Response time effect implemented via an exponential
884884
* drop-off algorithm, taken from the 'Gameboy Classic Shader'
885885
* by Harlequin:
@@ -888,19 +888,19 @@ static void videoPostProcessLcdGhost(unsigned width, unsigned height) {
888888
rCurr += (rPrev2 - rCurr) * *(response + 1);
889889
rCurr += (rPrev3 - rCurr) * *(response + 2);
890890
rCurr += (rPrev4 - rCurr) * *(response + 3);
891-
color_t rMix = (color_t)(rCurr + 0.5f) & 0x1F;
891+
mColor rMix = (mColor)(rCurr + 0.5f) & 0x1F;
892892

893893
gCurr += (gPrev1 - gCurr) * *response;
894894
gCurr += (gPrev2 - gCurr) * *(response + 1);
895895
gCurr += (gPrev3 - gCurr) * *(response + 2);
896896
gCurr += (gPrev4 - gCurr) * *(response + 3);
897-
color_t gMix = (color_t)(gCurr + 0.5f) & 0x1F;
897+
mColor gMix = (mColor)(gCurr + 0.5f) & 0x1F;
898898

899899
bCurr += (bPrev1 - bCurr) * *response;
900900
bCurr += (bPrev2 - bCurr) * *(response + 1);
901901
bCurr += (bPrev3 - bCurr) * *(response + 2);
902902
bCurr += (bPrev4 - bCurr) * *(response + 3);
903-
color_t bMix = (color_t)(bCurr + 0.5f) & 0x1F;
903+
mColor bMix = (mColor)(bCurr + 0.5f) & 0x1F;
904904

905905
/* Repack colours for current frame */
906906
*(dst + x) = colorCorrectionEnabled ?
@@ -918,21 +918,21 @@ static void videoPostProcessLcdGhost(unsigned width, unsigned height) {
918918

919919
static void videoPostProcessLcdGhostFast(unsigned width, unsigned height) {
920920

921-
color_t *srcCurr = outputBuffer;
922-
float *srcPrevR = outputBufferAccR;
923-
float *srcPrevG = outputBufferAccG;
924-
float *srcPrevB = outputBufferAccB;
925-
color_t *dst = ppOutputBuffer;
921+
mColor *srcCurr = outputBuffer;
922+
float *srcPrevR = outputBufferAccR;
923+
float *srcPrevG = outputBufferAccG;
924+
float *srcPrevB = outputBufferAccB;
925+
mColor *dst = ppOutputBuffer;
926926
size_t x, y;
927927

928928
for (y = 0; y < height; y++) {
929929
for (x = 0; x < width; x++) {
930930

931931
/* Get colours from current + previous frames */
932-
color_t rgbCurr = *(srcCurr + x);
933-
float rPrev = *(srcPrevR + x);
934-
float gPrev = *(srcPrevG + x);
935-
float bPrev = *(srcPrevB + x);
932+
mColor rgbCurr = *(srcCurr + x);
933+
float rPrev = *(srcPrevR + x);
934+
float gPrev = *(srcPrevG + x);
935+
float bPrev = *(srcPrevB + x);
936936

937937
/* Unpack current colours and convert to float */
938938
float rCurr = (float)(rgbCurr >> 11 & 0x1F);
@@ -950,9 +950,9 @@ static void videoPostProcessLcdGhostFast(unsigned width, unsigned height) {
950950
*(srcPrevB + x) = bMix;
951951

952952
/* Convert and repack current frame colours */
953-
color_t rgbMix = ((color_t)(rMix + 0.5f) & 0x1F) << 11
954-
| ((color_t)(gMix + 0.5f) & 0x1F) << 6
955-
| ((color_t)(bMix + 0.5f) & 0x1F);
953+
mColor rgbMix = ((mColor)(rMix + 0.5f) & 0x1F) << 11
954+
| ((mColor)(gMix + 0.5f) & 0x1F) << 6
955+
| ((mColor)(bMix + 0.5f) & 0x1F);
956956

957957
/* Assign colours for current frame */
958958
*(dst + x) = colorCorrectionEnabled ?
@@ -1682,12 +1682,12 @@ void retro_run(void) {
16821682
#if defined(COLOR_16_BIT) && defined(COLOR_5_6_5)
16831683
if (videoPostProcess) {
16841684
videoPostProcess(width, height);
1685-
videoCallback(ppOutputBuffer, width, height, VIDEO_WIDTH_MAX * sizeof(color_t));
1685+
videoCallback(ppOutputBuffer, width, height, VIDEO_WIDTH_MAX * sizeof(mColor));
16861686
} else
16871687
#endif
1688-
videoCallback(outputBuffer, width, height, VIDEO_WIDTH_MAX * sizeof(color_t));
1688+
videoCallback(outputBuffer, width, height, VIDEO_WIDTH_MAX * sizeof(mColor));
16891689
} else {
1690-
videoCallback(NULL, width, height, VIDEO_WIDTH_MAX * sizeof(color_t));
1690+
videoCallback(NULL, width, height, VIDEO_WIDTH_MAX * sizeof(mColor));
16911691
}
16921692

16931693
#ifdef M_CORE_GBA

0 commit comments

Comments
 (0)