diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml new file mode 100644 index 0000000..46ee392 --- /dev/null +++ b/.github/workflows/compilation.yml @@ -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 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8b35431..adf426b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 \ No newline at end of file diff --git a/Makefile b/Makefile index b381537..144346e 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/mednafen/lynx/mikie.cpp b/mednafen/lynx/mikie.cpp index 9d40fdc..c6f071d 100644 --- a/mednafen/lynx/mikie.cpp +++ b/mednafen/lynx/mikie.cpp @@ -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: diff --git a/mednafen/lynx/mikie.h b/mednafen/lynx/mikie.h index df1f608..4df02b5 100644 --- a/mednafen/lynx/mikie.h +++ b/mednafen/lynx/mikie.h @@ -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, diff --git a/mednafen/lynx/system.cpp b/mednafen/lynx/system.cpp index 065ca22..8e5e54d 100644 --- a/mednafen/lynx/system.cpp +++ b/mednafen/lynx/system.cpp @@ -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; diff --git a/mednafen/sound/Blip_Buffer.cpp b/mednafen/sound/Blip_Buffer.cpp index 4602c53..9e8327a 100644 --- a/mednafen/sound/Blip_Buffer.cpp +++ b/mednafen/sound/Blip_Buffer.cpp @@ -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; diff --git a/mednafen/video/surface.h b/mednafen/video/surface.h index e1a6beb..a539988 100644 --- a/mednafen/video/surface.h +++ b/mednafen/video/surface.h @@ -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;