Commit b581c72d authored by fjtrujy's avatar fjtrujy Committed by Francisco Javier Trujillo Mata
Browse files

Add BGR support and add PS2 platform

parent ff6a6e6e
......@@ -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));
......
......@@ -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))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment