diff options
author | Autechre | 2021-02-06 14:24:20 +0100 |
---|---|---|
committer | GitHub | 2021-02-06 14:24:20 +0100 |
commit | 56aa9b3cca12180b7ebad56b97286c1a93b59e16 (patch) | |
tree | 40bfaddbd74d41bfa69bc1a672360c64af2c0cea | |
parent | ff6a6e6e6482ac1a773b192f87916688ebd86abd (diff) | |
parent | b144a9f9398fc4fd3de0188b8a0808b179993d94 (diff) | |
download | snes9x2002-56aa9b3cca12180b7ebad56b97286c1a93b59e16.tar.gz snes9x2002-56aa9b3cca12180b7ebad56b97286c1a93b59e16.tar.bz2 snes9x2002-56aa9b3cca12180b7ebad56b97286c1a93b59e16.zip |
Merge pull request #44 from fjtrujy/ps2-support
Add Ps2 support and solve BGR555 issues
-rw-r--r-- | .gitlab-ci.yml | 10 | ||||
-rw-r--r-- | Makefile | 12 | ||||
-rw-r--r-- | src/gfx.h | 2 | ||||
-rw-r--r-- | src/pixform.h | 27 | ||||
-rw-r--r-- | src/port.h | 4 |
5 files changed, 53 insertions, 2 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4a26418..415dcfb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -50,6 +50,10 @@ include: # PlayStation Vita - project: 'libretro-infrastructure/ci-templates' file: '/vita-static.yml' + + # PlayStation PS2 + - project: 'libretro-infrastructure/ci-templates' + file: '/ps2-static.yml' # Nintendo 3DS - project: 'libretro-infrastructure/ci-templates' @@ -157,6 +161,12 @@ libretro-build-vita: - .libretro-vita-static-retroarch-master - .core-defs +# PlayStation 2 +libretro-build-ps2: + extends: + - .libretro-ps2-static-retroarch-master + - .core-defs + # Nintendo 3DS libretro-build-ctr: extends: @@ -170,6 +170,16 @@ else ifeq ($(platform), classic_armv7_a7) endif ####################################### +else ifeq ($(platform), ps2) + TARGET := $(TARGET_NAME)_libretro_$(platform).a + CC = mips64r5900el-ps2-elf-gcc$(EXE_EXT) + CXX = mips64r5900el-ps2-elf-g++$(EXE_EXT) + AR = mips64r5900el-ps2-elf-ar$(EXE_EXT) + STATIC_LINKING = 1 + LOAD_FROM_MEMORY_TEST = 0 + CFLAGS += -DPS2 -G0 -DFRAME_SKIP -fomit-frame-pointer -ffast-math + STATIC_LINKING := 1 + else ifeq ($(platform), psp1) TARGET := $(TARGET_NAME)_libretro_$(platform).a CC = psp-gcc$(EXE_EXT) @@ -335,7 +345,7 @@ LIBRETRO_DIR := ./libretro ifeq ($(DEBUG), 1) DEFINES += -O0 -g else -DEFINES += -O2 -DNDEBUG=1 +DEFINES += -O3 -DNDEBUG=1 endif LDFLAGS += $(LIBM) @@ -224,7 +224,7 @@ static INLINE uint16_t COLOR_ADD(uint16_t C1, uint16_t C2) { const int RED_MASK = 0x1F << RED_SHIFT_BITS; const int GREEN_MASK = 0x1F << GREEN_SHIFT_BITS; - const int BLUE_MASK = 0x1F; + const int BLUE_MASK = 0x1F << BLUE_SHIFT_BITS; int rb = (C1 & (RED_MASK | BLUE_MASK)) + (C2 & (RED_MASK | BLUE_MASK)); int rbcarry = rb & ((0x20 << RED_SHIFT_BITS) | (0x20 << 0)); diff --git a/src/pixform.h b/src/pixform.h index 1edd9c5..8f22825 100644 --- a/src/pixform.h +++ b/src/pixform.h @@ -88,6 +88,7 @@ extern uint32 HIGH_BITS_SHIFTED_TWO_MASK; #define MAX_BLUE_RGB565 31 #define RED_SHIFT_BITS_RGB565 11 #define GREEN_SHIFT_BITS_RGB565 6 +#define BLUE_SHIFT_BITS_RGB565 0 #define RED_LOW_BIT_MASK_RGB565 0x0800 #define GREEN_LOW_BIT_MASK_RGB565 0x0020 #define BLUE_LOW_BIT_MASK_RGB565 0x0001 @@ -99,6 +100,29 @@ extern uint32 HIGH_BITS_SHIFTED_TWO_MASK; #define THIRD_COLOR_MASK_RGB565 0x001F #define ALPHA_BITS_MASK_RGB565 0x0000 +// BGR555 format +#define BUILD_PIXEL_BGR555(R,G,B) (((int) (B) << 10) | ((int) (G) << 5) | (int) (R)) +#define BUILD_PIXEL2_BGR555(R,G,B) (((int) (B) << 10) | ((int) (G) << 5) | (int) (R)) +#define DECOMPOSE_PIXEL_BGR555(PIX,R,G,B) {(B) = (PIX) >> 10; (G) = ((PIX) >> 5) & 0x1f; (R) = (PIX) & 0x1f; } +#define SPARE_RGB_BIT_MASK_BGR555 (1 << 5) + +#define MAX_RED_BGR555 31 +#define MAX_GREEN_BGR555 31 +#define MAX_BLUE_BGR555 31 +#define RED_SHIFT_BITS_BGR555 0 +#define GREEN_SHIFT_BITS_BGR555 5 +#define BLUE_SHIFT_BITS_BGR555 10 +#define RED_LOW_BIT_MASK_BGR555 0x0001 +#define GREEN_LOW_BIT_MASK_BGR555 0x0020 +#define BLUE_LOW_BIT_MASK_BGR555 0x0400 +#define RED_HI_BIT_MASK_BGR555 0x0010 +#define GREEN_HI_BIT_MASK_BGR555 0x0200 +#define BLUE_HI_BIT_MASK_BGR555 0x4000 +#define FIRST_COLOR_MASK_BGR555 0x7C00 +#define SECOND_COLOR_MASK_BGR555 0x03E0 +#define THIRD_COLOR_MASK_BGR555 0x001F +#define ALPHA_BITS_MASK_BGR555 0x0000 + // RGB555 format #define BUILD_PIXEL_RGB555(R,G,B) (((int) (R) << 10) | ((int) (G) << 5) | (int) (B)) #define BUILD_PIXEL2_RGB555(R,G,B) (((int) (R) << 10) | ((int) (G) << 5) | (int) (B)) @@ -110,6 +134,7 @@ extern uint32 HIGH_BITS_SHIFTED_TWO_MASK; #define MAX_BLUE_RGB555 31 #define RED_SHIFT_BITS_RGB555 10 #define GREEN_SHIFT_BITS_RGB555 5 +#define BLUE_SHIFT_BITS_RGB555 0 #define RED_LOW_BIT_MASK_RGB555 0x0400 #define GREEN_LOW_BIT_MASK_RGB555 0x0020 #define BLUE_LOW_BIT_MASK_RGB555 0x0001 @@ -139,6 +164,7 @@ extern uint32 HIGH_BITS_SHIFTED_TWO_MASK; #define MAX_GREEN_D(F) CONCAT(MAX_GREEN_,F) #define RED_SHIFT_BITS_D(F) CONCAT(RED_SHIFT_BITS_, F) #define GREEN_SHIFT_BITS_D(F) CONCAT(GREEN_SHIFT_BITS_, F) +#define BLUE_SHIFT_BITS_D(F) CONCAT(BLUE_SHIFT_BITS_, F) #define RED_LOW_BIT_MASK_D(F) CONCAT(RED_LOW_BIT_MASK_,F) #define BLUE_LOW_BIT_MASK_D(F) CONCAT(BLUE_LOW_BIT_MASK_,F) #define GREEN_LOW_BIT_MASK_D(F) CONCAT(GREEN_LOW_BIT_MASK_,F) @@ -155,6 +181,7 @@ extern uint32 HIGH_BITS_SHIFTED_TWO_MASK; #define MAX_GREEN MAX_GREEN_D(PIXEL_FORMAT) #define RED_SHIFT_BITS RED_SHIFT_BITS_D(PIXEL_FORMAT) #define GREEN_SHIFT_BITS GREEN_SHIFT_BITS_D(PIXEL_FORMAT) +#define BLUE_SHIFT_BITS BLUE_SHIFT_BITS_D(PIXEL_FORMAT) #define RED_LOW_BIT_MASK RED_LOW_BIT_MASK_D(PIXEL_FORMAT) #define BLUE_LOW_BIT_MASK BLUE_LOW_BIT_MASK_D(PIXEL_FORMAT) #define GREEN_LOW_BIT_MASK GREEN_LOW_BIT_MASK_D(PIXEL_FORMAT) @@ -110,7 +110,11 @@ typedef short int16_32; #define VAR_CYCLES //#define SPC700_SHUTDOWN #define FASTCALL +#if defined(PS2) +#define PIXEL_FORMAT BGR555 +#else #define PIXEL_FORMAT RGB565 +#endif #define CPU_SHUTDOWN #define PACKING __attribute__ ((packed)) #define ALIGN_BY_ONE __attribute__ ((aligned (1), packed)) |