Add PS2 platform

This commit is contained in:
Francisco Javier Trujillo Mata 2020-10-19 20:27:39 +02:00
parent 9de8846ee6
commit 8a917d78b3
8 changed files with 86 additions and 9 deletions

33
.github/workflows/compilation.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: CI
on:
push:
pull_request:
repository_dispatch:
types: [run_build]
jobs:
build-ps2:
runs-on: ubuntu-latest
container: ps2dev/ps2dev:latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
apk add build-base git bash
- name: Compile project
run: |
make platform=ps2 -j$(nproc) clean && make platform=ps2 -j$(nproc)
- name: Get short SHA
id: slug
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
- name: Upload artifacts
if: ${{ success() }}
uses: actions/upload-artifact@v2
with:
name: mednafen_lynx_libretro_ps2-${{ steps.slug.outputs.sha8 }}
path: mednafen_lynx_libretro_ps2.a

View File

@ -9,6 +9,10 @@ include:
file: '/libnx-static.yml'
- project: 'libretro-infrastructure/ci-templates'
file: '/vita-static.yml'
- project: 'libretro-infrastructure/ci-templates'
file: '/psp-static.yml'
- project: 'libretro-infrastructure/ci-templates'
file: '/ps2-static.yml'
- project: 'libretro-infrastructure/ci-templates'
file: '/linux-x64.yml'
- project: 'libretro-infrastructure/ci-templates'
@ -64,3 +68,13 @@ libretro-build-vita:
extends:
- .core-defs
- .libretro-vita-static-retroarch-master
libretro-build-psp:
extends:
- .core-defs
- .libretro-psp-static-retroarch-master
libretro-build-ps2:
extends:
- .core-defs
- .libretro-ps2-static-retroarch-master

View File

@ -168,13 +168,23 @@ else ifeq ($(platform), psl1ght)
FLAGS += -DHAVE_MKDIR
STATIC_LINKING = 1
# PS2
else ifeq ($(platform), ps2)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = ee-gcc$(EXE_EXT)
CXX = ee-g++$(EXE_EXT)
AR = ee-ar$(EXE_EXT)
FLAGS += -DPS2 -G0 -DABGR1555 -O3
FLAGS += -DHAVE_MKDIR
STATIC_LINKING = 1
# PSP
else ifeq ($(platform), psp1)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = psp-gcc$(EXE_EXT)
CXX = psp-g++$(EXE_EXT)
AR = psp-ar$(EXE_EXT)
FLAGS += -DPSP -G0
FLAGS += -DPSP -G0 -O3
FLAGS += -DHAVE_MKDIR
STATIC_LINKING = 1
@ -566,13 +576,16 @@ endif
include Makefile.common
ifeq (,$(findstring msvc,$(platform)))
ifeq ($(NEW_GCC),1)
NEW_GCC_WARNING_FLAGS := -Wno-strict-aliasing $(NEW_GCC_WARNING_FLAGS)
endif
WARNINGS := -Wall \
-Wno-sign-compare \
-Wno-unused-variable \
-Wno-unused-function \
-Wno-uninitialized \
$(NEW_GCC_WARNING_FLAGS) \
-Wno-strict-aliasing
$(NEW_GCC_WARNING_FLAGS)
EXTRA_GCC_FLAGS := -funroll-loops
endif

View File

@ -397,7 +397,11 @@ void CMikie::DisplaySetAttributes(int32 bpp)
switch (bpp)
{
case 16:
#if defined(ABGR1555)
mColourMap[Spot.Index] = MAKECOLOR_15_1(r, g, b, 0);
#else
mColourMap[Spot.Index] = MAKECOLOR_16(r, g, b, 0);
#endif
break;
case 32:

View File

@ -166,6 +166,7 @@ enum
enum
{
MIKIE_PIXEL_FORMAT_8BPP=0,
MIKIE_PIXEL_FORMAT_16BPP_BGR555,
MIKIE_PIXEL_FORMAT_16BPP_555,
MIKIE_PIXEL_FORMAT_16BPP_565,
MIKIE_PIXEL_FORMAT_24BPP,

View File

@ -290,7 +290,11 @@ void Emulate(EmulateSpecStruct *espec)
uint32 color_black;
if (espec->surface->bpp == 16)
{
#if defined(ABGR1555)
color_black = MAKECOLOR_15_1(30, 30, 30, 0);
#else
color_black = MAKECOLOR_16(30, 30, 30, 0);
#endif
for (int y = 0; y < 102; y++)
{
uint16 *row = espec->surface->pixels + y * espec->surface->pitch;

View File

@ -23,6 +23,11 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
#include BLARGG_ENABLE_OPTIMIZER
#endif
#if defined(PS2)
#define __LONG_LONG_MAX__ 9223372036854775807LL
#define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1)
#endif
Blip_Buffer::Blip_Buffer()
{
factor_ = (blip_u64)ULLONG_MAX;

View File

@ -11,9 +11,6 @@
#define MAKECOLOR_32(r, g, b, a) ((r << RED_SHIFT_32) | (g << GREEN_SHIFT_32) | (b << BLUE_SHIFT_32) | (a << ALPHA_SHIFT_32))
/* 16bit color - RGB565 */
#define RED_MASK_16 0xf800
#define GREEN_MASK_16 0x7e0
#define BLUE_MASK_16 0x1f
#define RED_EXPAND_16 3
#define GREEN_EXPAND_16 2
#define BLUE_EXPAND_16 3
@ -23,9 +20,6 @@
#define MAKECOLOR_16(r, g, b, a) (((r >> RED_EXPAND_16) << RED_SHIFT_16) | ((g >> GREEN_EXPAND_16) << GREEN_SHIFT_16) | ((b >> BLUE_EXPAND_16) << BLUE_SHIFT_16))
/* 16bit color - RGB555 */
#define RED_MASK_15 0x7c00
#define GREEN_MASK_15 0x3e0
#define BLUE_MASK_15 0x1f
#define RED_EXPAND_15 3
#define GREEN_EXPAND_15 3
#define BLUE_EXPAND_15 3
@ -34,6 +28,15 @@
#define BLUE_SHIFT_15 0
#define MAKECOLOR_15(r, g, b, a) (((r >> RED_EXPAND_15) << RED_SHIFT_15) | ((g >> GREEN_EXPAND_15) << GREEN_SHIFT_15) | ((b >> BLUE_EXPAND_15) << BLUE_SHIFT_15))
/* 16bit color - BGR555 */
#define BLUE_EXPAND_15_1 3
#define GREEN_EXPAND_15_1 3
#define RED_EXPAND_15_1 3
#define BLUE_SHIFT_15_1 10
#define GREEN_SHIFT_15_1 5
#define RED_SHIFT_15_1 0
#define MAKECOLOR_15_1(r, g, b, a) (((r >> RED_EXPAND_15_1) << RED_SHIFT_15_1) | ((g >> GREEN_EXPAND_15_1) << GREEN_SHIFT_15_1) | ((b >> BLUE_EXPAND_15_1) << BLUE_SHIFT_15_1))
typedef struct
{
int32 x, y, w, h;