Commit 17b94ae6 authored by jdgleaver's avatar jdgleaver
Browse files

Restore libretro port (WIP, no save state support)

parent b1e88a94
*.o
*.so
*.dll
# DESCRIPTION: GitLab CI/CD for libRetro (NOT FOR GitLab-proper)
##############################################################################
################################# BOILERPLATE ################################
##############################################################################
# Core definitions
.core-defs:
variables:
JNI_PATH: platform/libretro
MAKEFILE_PATH: platform/libretro
CORENAME: potator
# Inclusion templates, required for the build to work
include:
################################## DESKTOPS ################################
# Windows 64-bit
- project: 'libretro-infrastructure/ci-templates'
file: '/windows-x64-mingw.yml'
# Windows 32-bit
- project: 'libretro-infrastructure/ci-templates'
file: '/windows-i686-mingw.yml'
# Linux 64-bit
- project: 'libretro-infrastructure/ci-templates'
file: '/linux-x64.yml'
# Linux 32-bit
- project: 'libretro-infrastructure/ci-templates'
file: '/linux-i686.yml'
# MacOS 64-bit
- project: 'libretro-infrastructure/ci-templates'
file: '/osx-x64.yml'
# MacOS ARM 64-bit
- project: 'libretro-infrastructure/ci-templates'
file: '/osx-arm64.yml'
################################## CELLULAR ################################
# Android
- project: 'libretro-infrastructure/ci-templates'
file: '/android-jni.yml'
# iOS
- project: 'libretro-infrastructure/ci-templates'
file: '/ios-arm64.yml'
# iOS (armv7)
- project: 'libretro-infrastructure/ci-templates'
file: '/ios9.yml'
################################## CONSOLES ################################
# PlayStation Vita
- project: 'libretro-infrastructure/ci-templates'
file: '/vita-static.yml'
# Nintendo 3DS
- project: 'libretro-infrastructure/ci-templates'
file: '/ctr-static.yml'
# Nintendo Switch
- project: 'libretro-infrastructure/ci-templates'
file: '/libnx-static.yml'
# OpenDingux
- project: 'libretro-infrastructure/ci-templates'
file: '/dingux-mips32.yml'
# tvOS (AppleTV)
- project: 'libretro-infrastructure/ci-templates'
file: '/tvos-arm64.yml'
#################################### MISC ##################################
# Stages for building
stages:
- build-prepare
- build-shared
- build-static
##############################################################################
#################################### STAGES ##################################
##############################################################################
#
################################### DESKTOPS #################################
# Windows 64-bit
libretro-build-windows-x64:
extends:
- .libretro-windows-x64-mingw-make-default
- .core-defs
# Windows 32-bit
libretro-build-windows-i686:
extends:
- .libretro-windows-i686-mingw-make-default
- .core-defs
# Linux 64-bit
libretro-build-linux-x64:
extends:
- .libretro-linux-x64-make-default
- .core-defs
# Linux 32-bit
libretro-build-linux-i686:
extends:
- .libretro-linux-i686-make-default
- .core-defs
# MacOS 64-bit
libretro-build-osx-x64:
extends:
- .libretro-osx-x64-make-default
- .core-defs
# MacOS ARM 64-bit
libretro-build-osx-arm64:
extends:
- .libretro-osx-arm64-make-default
- .core-defs
################################### CELLULAR #################################
# Android ARMv7a
android-armeabi-v7a:
extends:
- .libretro-android-jni-armeabi-v7a
- .core-defs
# Android ARMv8a
android-arm64-v8a:
extends:
- .libretro-android-jni-arm64-v8a
- .core-defs
# Android 64-bit x86
android-x86_64:
extends:
- .libretro-android-jni-x86_64
- .core-defs
# Android 32-bit x86
android-x86:
extends:
- .libretro-android-jni-x86
- .core-defs
# iOS
libretro-build-ios-arm64:
extends:
- .libretro-ios-arm64-make-default
- .core-defs
# iOS (armv7) [iOS 9 and up]
libretro-build-ios9:
extends:
- .libretro-ios9-make-default
- .core-defs
# tvOS
libretro-build-tvos-arm64:
extends:
- .libretro-tvos-arm64-make-default
- .core-defs
################################### CONSOLES #################################
# PlayStation Vita
libretro-build-vita:
extends:
- .libretro-vita-static-retroarch-master
- .core-defs
# Nintendo 3DS
libretro-build-ctr:
extends:
- .libretro-ctr-static-retroarch-master
- .core-defs
# Nintendo Switch
libretro-build-libnx-aarch64:
extends:
- .libretro-libnx-static-retroarch-master
- .core-defs
# OpenDingux
libretro-build-dingux-mips32:
extends:
- .libretro-dingux-mips32-make-default
- .core-defs
......@@ -16,42 +16,180 @@ static uint16 rgb555(uint8 r, uint8 g, uint8 b)
static SV_MapRGBFunc mapRGB = rgb555;
static const uint8 palettes[SV_COLOR_SCHEME_COUNT][12] = {
{
{ /* SV_COLOR_SCHEME_DEFAULT */
252, 252, 252,
168, 168, 168,
84, 84, 84,
0, 0, 0,
},
{
{ /* SV_COLOR_SCHEME_AMBER */
252, 154, 0,
168, 102, 0,
84, 51, 0,
0, 0, 0,
},
{
{ /* SV_COLOR_SCHEME_GREEN */
50, 227, 50,
34, 151, 34,
17, 76, 17,
0, 0, 0,
},
{
{ /* SV_COLOR_SCHEME_BLUE */
0, 154, 252,
0, 102, 168,
0, 51, 84,
0, 0, 0,
},
{
{ /* SV_COLOR_SCHEME_BGB */
224, 248, 208,
136, 192, 112,
52, 104, 86,
8, 24, 32,
},
{
{ /* SV_COLOR_SCHEME_WATAROO */
0x7b, 0xc7, 0x7b,
0x52, 0xa6, 0x8c,
0x2e, 0x62, 0x60,
0x0d, 0x32, 0x2e,
},
{ /* SV_COLOR_SCHEME_GB_DMG */
0x57, 0x82, 0x00,
0x31, 0x74, 0x00,
0x00, 0x51, 0x21,
0x00, 0x42, 0x0C,
},
{ /* SV_COLOR_SCHEME_GB_POCKET */
0xA7, 0xB1, 0x9A,
0x86, 0x92, 0x7C,
0x53, 0x5f, 0x49,
0x2A, 0x33, 0x25,
},
{ /* SV_COLOR_SCHEME_GB_LIGHT */
0x01, 0xCB, 0xDF,
0x01, 0xB6, 0xD5,
0x26, 0x9B, 0xAD,
0x00, 0x77, 0x8D,
},
{ /* SV_COLOR_SCHEME_BLOSSOM_PINK */
0xF0, 0x98, 0x98,
0xA8, 0x6A, 0x6A,
0x60, 0x3C, 0x3C,
0x18, 0x0F, 0x0F,
},
{ /* SV_COLOR_SCHEME_BUBBLES_BLUE */
0x88, 0xD0, 0xF0,
0x5F, 0x91, 0xA8,
0x36, 0x53, 0x60,
0x0D, 0x14, 0x18,
},
{ /* SV_COLOR_SCHEME_BUTTERCUP_GREEN */
0xB8, 0xE0, 0x88,
0x80, 0x9C, 0x5F,
0x49, 0x59, 0x36,
0x12, 0x16, 0x0D,
},
{ /* SV_COLOR_SCHEME_DIGIVICE */
0x8C, 0x8C, 0x73,
0x64, 0x64, 0x53,
0x38, 0x38, 0x2E,
0x00, 0x00, 0x00,
},
{ /* SV_COLOR_SCHEME_GAME_COM */
0xA7, 0xBF, 0x6B,
0x6F, 0x8F, 0x4F,
0x0F, 0x4F, 0x2F,
0x00, 0x00, 0x00,
},
{ /* SV_COLOR_SCHEME_GAMEKING */
0x8C, 0xCE, 0x94,
0x6B, 0x9C, 0x63,
0x50, 0x65, 0x41,
0x18, 0x42, 0x21,
},
{ /* SV_COLOR_SCHEME_GAME_MASTER */
0x82, 0x9F, 0xA6,
0x5A, 0x78, 0x7E,
0x38, 0x4A, 0x50,
0x2D, 0x2D, 0x2B,
},
{ /* SV_COLOR_SCHEME_GOLDEN_WILD */
0xB9, 0x9F, 0x65,
0x81, 0x6F, 0x46,
0x4A, 0x3F, 0x28,
0x12, 0x0F, 0x0A,
},
{ /* SV_COLOR_SCHEME_GREENSCALE */
0x9C, 0xBE, 0x0C,
0x6E, 0x87, 0x0A,
0x2C, 0x62, 0x34,
0x0C, 0x36, 0x0C,
},
{ /* SV_COLOR_SCHEME_HOKAGE_ORANGE */
0xEA, 0x83, 0x52,
0xA3, 0x5B, 0x39,
0x5D, 0x34, 0x20,
0x17, 0x0D, 0x08,
},
{ /* SV_COLOR_SCHEME_LABO_FAWN */
0xD7, 0xAA, 0x73,
0x96, 0x76, 0x50,
0x56, 0x44, 0x2E,
0x15, 0x11, 0x0B,
},
{ /* SV_COLOR_SCHEME_LEGENDARY_SUPER_SAIYAN */
0xA5, 0xDB, 0x5A,
0x73, 0x99, 0x3E,
0x42, 0x57, 0x24,
0x10, 0x15, 0x09,
},
{ /* SV_COLOR_SCHEME_MICROVISION */
0xA0, 0xA0, 0xA0,
0x78, 0x78, 0x78,
0x50, 0x50, 0x50,
0x30, 0x30, 0x30,
},
{ /* SV_COLOR_SCHEME_MILLION_LIVE_GOLD */
0xCD, 0xB2, 0x61,
0x8F, 0x7C, 0x43,
0x52, 0x47, 0x26,
0x14, 0x11, 0x09,
},
{ /* SV_COLOR_SCHEME_ODYSSEY_GOLD */
0xC2, 0xA0, 0x00,
0x87, 0x70, 0x00,
0x4D, 0x40, 0x00,
0x13, 0x10, 0x00,
},
{ /* SV_COLOR_SCHEME_SHINY_SKY_BLUE */
0x8C, 0xB6, 0xDF,
0x62, 0x7F, 0x9C,
0x38, 0x48, 0x59,
0x0E, 0x12, 0x16,
},
{ /* SV_COLOR_SCHEME_SLIME_BLUE */
0x2F, 0x8C, 0xCC,
0x20, 0x62, 0x8E,
0x12, 0x38, 0x51,
0x04, 0x0E, 0x14,
},
{ /* SV_COLOR_SCHEME_TI_83 */
0x9C, 0xA6, 0x84,
0x72, 0x7C, 0x5A,
0x46, 0x4A, 0x35,
0x18, 0x18, 0x10,
},
{ /* SV_COLOR_SCHEME_TRAVEL_WOOD */
0xF8, 0xD8, 0xB0,
0xA0, 0x80, 0x58,
0x70, 0x50, 0x30,
0x48, 0x28, 0x10,
},
{ /* SV_COLOR_SCHEME_VIRTUAL_BOY */
0xE3, 0x00, 0x00,
0x95, 0x00, 0x00,
0x56, 0x00, 0x00,
0x00, 0x00, 0x00,
},
};
static uint16 *palette;
......
......@@ -28,15 +28,39 @@ typedef uint16 (*SV_MapRGBFunc)(uint8 r, uint8 g, uint8 b);
* \sa supervision_set_color_scheme()
*/
enum SV_COLOR {
SV_COLOR_SCHEME_DEFAULT
SV_COLOR_SCHEME_DEFAULT = 0
, SV_COLOR_SCHEME_AMBER
, SV_COLOR_SCHEME_GREEN
, SV_COLOR_SCHEME_BLUE
, SV_COLOR_SCHEME_BGB
, SV_COLOR_SCHEME_WATAROO
, SV_COLOR_SCHEME_GB_DMG
, SV_COLOR_SCHEME_GB_POCKET
, SV_COLOR_SCHEME_GB_LIGHT
, SV_COLOR_SCHEME_BLOSSOM_PINK
, SV_COLOR_SCHEME_BUBBLES_BLUE
, SV_COLOR_SCHEME_BUTTERCUP_GREEN
, SV_COLOR_SCHEME_DIGIVICE
, SV_COLOR_SCHEME_GAME_COM
, SV_COLOR_SCHEME_GAMEKING
, SV_COLOR_SCHEME_GAME_MASTER
, SV_COLOR_SCHEME_GOLDEN_WILD
, SV_COLOR_SCHEME_GREENSCALE
, SV_COLOR_SCHEME_HOKAGE_ORANGE
, SV_COLOR_SCHEME_LABO_FAWN
, SV_COLOR_SCHEME_LEGENDARY_SUPER_SAIYAN
, SV_COLOR_SCHEME_MICROVISION
, SV_COLOR_SCHEME_MILLION_LIVE_GOLD
, SV_COLOR_SCHEME_ODYSSEY_GOLD
, SV_COLOR_SCHEME_SHINY_SKY_BLUE
, SV_COLOR_SCHEME_SLIME_BLUE
, SV_COLOR_SCHEME_TI_83
, SV_COLOR_SCHEME_TRAVEL_WOOD
, SV_COLOR_SCHEME_VIRTUAL_BOY
, SV_COLOR_SCHEME_COUNT
};
/*!
* \sa supervision_set_ghosting()
*/
......
This diff is collapsed.
LIBRETRO_DIR := $(CORE_DIR)/platform/libretro
LIBRETRO_COMM_DIR := $(LIBRETRO_DIR)/libretro-common
CORE_SRC_DIR := $(CORE_DIR)/common
INCFLAGS := -I$(CORE_SRC_DIR) -I$(CORE_SRC_DIR)/m6502 -I$(LIBRETRO_DIR) -I$(LIBRETRO_COMM_DIR)/include
ifneq (,$(findstring msvc2003,$(platform)))
INCFLAGS += -I$(LIBRETRO_COMM_DIR)/include/compat/msvc
endif
SOURCES_C := \
$(LIBRETRO_DIR)/libretro.c \
$(CORE_SRC_DIR)/controls.c \
$(CORE_SRC_DIR)/gpu.c \
$(CORE_SRC_DIR)/memorymap.c \
$(CORE_SRC_DIR)/sound.c \
$(CORE_SRC_DIR)/timer.c \
$(CORE_SRC_DIR)/watara.c \
$(CORE_SRC_DIR)/m6502/m6502.c
LOCAL_PATH := $(call my-dir)
DEBUG := 0
FLAGS :=
CORE_DIR := $(LOCAL_PATH)/../../..
include $(LOCAL_PATH)/../Makefile.common
COREFLAGS := $(INCFLAGS) $(FLAGS)
COREFLAGS += -D__LIBRETRO__
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
ifneq ($(GIT_VERSION)," unknown")
COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif
include $(CLEAR_VARS)
LOCAL_MODULE := retro
LOCAL_SRC_FILES := $(SOURCES_C)
LOCAL_CFLAGS := $(COREFLAGS)
LOCAL_CXXFLAGS := $(COREFLAGS)
LOCAL_LDFLAGS := -Wl,-version-script=$(CORE_DIR)/platform/libretro/link.T
LOCAL_CPP_FEATURES := exceptions
include $(BUILD_SHARED_LIBRARY)
/* Copyright (C) 2010-2020 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (msvc.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __LIBRETRO_SDK_COMPAT_MSVC_H
#define __LIBRETRO_SDK_COMPAT_MSVC_H
#ifdef _MSC_VER
#ifdef __cplusplus
extern "C" {
#endif
/* Pre-MSVC 2015 compilers don't implement snprintf, vsnprintf in a cross-platform manner. */
#if _MSC_VER < 1900
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#ifndef snprintf
#define snprintf c99_snprintf_retro__
#endif
int c99_snprintf_retro__(char *outBuf, size_t size, const char *format, ...);
#ifndef vsnprintf
#define vsnprintf c99_vsnprintf_retro__
#endif
int c99_vsnprintf_retro__(char *outBuf, size_t size, const char *format, va_list ap);
#endif
#ifdef __cplusplus
}
#endif
#undef UNICODE /* Do not bother with UNICODE at this time. */
#include <direct.h>
#include <stddef.h>
#define _USE_MATH_DEFINES
#include <math.h>
/* Python headers defines ssize_t and sets HAVE_SSIZE_T.
* Cannot duplicate these efforts.
*/
#ifndef HAVE_SSIZE_T
#if defined(_WIN64)
typedef __int64 ssize_t;
#elif defined(_WIN32)
typedef int ssize_t;
#endif
#endif
#define mkdir(dirname, unused) _mkdir(dirname)
#define strtoull _strtoui64
#undef strcasecmp
#define strcasecmp _stricmp
#undef strncasecmp
#define strncasecmp _strnicmp
/* Disable some of the annoying warnings. */
#pragma warning(disable : 4800)
#pragma warning(disable : 4805)
#pragma warning(disable : 4244)
#pragma warning(disable : 4305)
#pragma warning(disable : 4146)
#pragma warning(disable : 4267)
#pragma warning(disable : 4723)
#pragma warning(disable : 4996)
/* roundf and va_copy is available since MSVC 2013 */
#if _MSC_VER < 1800
#define roundf(in) (in >= 0.0f ? floorf(in + 0.5f) : ceilf(in - 0.5f))
#define va_copy(x, y) ((x) = (y))
#endif
#if _MSC_VER <= 1310
#ifndef __cplusplus
/* VC6 math.h doesn't define some functions when in C mode.
* Trying to define a prototype gives "undefined reference".
* But providing an implementation then gives "function already has body".
* So the equivalent of the implementations from math.h are used as
* defines here instead, and it seems to work.
*/
#define cosf(x) ((float)cos((double)x))
#define powf(x, y) ((float)pow((double)x, (double)y))
#define sinf(x) ((float)sin((double)x))
#define ceilf(x) ((float)ceil((double)x))
#define floorf(x) ((float)floor((double)x))
#define sqrtf(x) ((float)sqrt((double)x))
#define fabsf(x) ((float)fabs((double)(x)))
#endif
#ifndef _strtoui64
#define _strtoui64(x, y, z) (_atoi64(x))
#endif
#endif
#ifndef PATH_MAX
#define PATH_MAX _MAX_PATH
#endif
#ifndef SIZE_MAX
#define SIZE_MAX _UI32_MAX
#endif
#endif
#endif
/* ISO C9x compliant stdint.h for Microsoft Visual Studio
* Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
*
* Copyright (c) 2006-2008 Alexander Chemeris
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. The name of the author may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,