added supafaust core

This commit is contained in:
Shaun Inman 2023-02-13 21:11:57 -05:00
parent 3f5f5bfaaf
commit d5cc9f7cef
9 changed files with 155 additions and 48 deletions

View file

@ -1,7 +1,7 @@
# this logic was broken out from picoarch's all-in-one makefile
CORES = fceumm gambatte gpsp pcsx_rearmed picodrive pokemini snes9x2005_plus
CORES+= beetle-vb fake-08
CORES = fceumm gambatte gpsp pcsx_rearmed picodrive snes9x2005_plus
CORES+= beetle-vb fake-08 mednafen_supafaust pokemini # extras
###############################
@ -16,10 +16,16 @@ CORES+= beetle-vb fake-08
beetle-vb_REPO = https://github.com/libretro/beetle-vb-libretro
beetle-vb_CORE = mednafen_vb_libretro.so
fake-08_REPO = https://github.com/jtothebell/fake-08
fake-08_CORE = fake08_libretro.so
fake-08_BUILD_PATH = fake-08/platform/libretro
fceumm_REPO = https://github.com/libretro/libretro-fceumm
gambatte_REPO = https://github.com/libretro/gambatte-libretro
mednafen_supafaust_REPO = https://github.com/libretro/supafaust
pcsx_rearmed_MAKEFILE = Makefile.libretro
picodrive_REPO = https://github.com/irixxxx/picodrive
@ -31,10 +37,6 @@ pokemini_MAKEFILE = Makefile.libretro
snes9x2005_plus_REPO = https://github.com/libretro/snes9x2005
snes9x2005_plus_FLAGS = USE_BLARGG_APU=1
fake-08_REPO = https://github.com/jtothebell/fake-08
fake-08_CORE = fake08_libretro.so
fake-08_BUILD_PATH = fake-08/platform/libretro
###############################
PATCH = git apply

View file

@ -0,0 +1,31 @@
diff --git forkSrcPrefix/Makefile forkDstPrefix/Makefile
index 58120a1a88eab75ca13f2ed062f37d075c05a51b..c60ebf68483aebf7a0dc320e4589f29cf6457013 100644
--- forkSrcPrefix/Makefile
+++ forkDstPrefix/Makefile
@@ -187,6 +187,26 @@ else ifeq ($(platform), wii)
EXTRA_INCLUDES := -I$(DEVKITPRO)/libogc/include
STATIC_LINKING = 1
+else ifeq ($(platform), rg35xx)
+ TARGET := $(TARGET_NAME)_libretro.so
+ CC = $(CROSS_COMPILE)gcc
+ CXX = $(CROSS_COMPILE)g++
+ AR = $(CROSS_COMPILE)ar
+ fpic := -fPIC
+ SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
+ CFLAGS += -Ofast \
+ -flto=4 -fwhole-program -fuse-linker-plugin \
+ -fdata-sections -ffunction-sections -Wl,--gc-sections \
+ -fno-stack-protector -fno-ident -fomit-frame-pointer \
+ -falign-functions=1 -falign-jumps=1 -falign-loops=1 \
+ -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \
+ -fmerge-all-constants -fno-math-errno
+ CFLAGS += -marm -mtune=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=hard -march=armv7-a -fomit-frame-pointer -DRG35XX
+ CXXFLAGS += $(CFLAGS)
+ CFLAGS += -fPIC
+ LDFLAGS += -flto
+ HAVE_NEON = 1
+ ARCH = arm
else ifneq (,$(findstring rpi,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC

View file

View file

@ -0,0 +1,14 @@
#!/bin/sh
EMU_EXE=mednafen_supafaust
CORES_PATH=$(dirname "$0")
###############################
EMU_TAG=$(basename "$(dirname "$0")" .pak)
ROM="$1"
mkdir -p "$BIOS_PATH/$EMU_TAG"
mkdir -p "$SAVES_PATH/$EMU_TAG"
HOME="$USERDATA_PATH"
cd "$HOME"
minarch.elf "$CORES_PATH/${EMU_EXE}_libretro.so" "$ROM" DMG &> "$LOGS_PATH/$EMU_TAG.txt"

View file

View file

View file

@ -28,6 +28,7 @@
#include "overrides/gambatte.h"
#include "overrides/gpsp.h"
#include "overrides/mednafen_vb.h"
#include "overrides/mednafen_supafaust.h"
#include "overrides/pcsx_rearmed.h"
#include "overrides/picodrive.h"
#include "overrides/pokemini.h"
@ -38,6 +39,7 @@ static CoreOverrides* overrides[] = {
&fceumm_overrides,
&gambatte_overrides,
&gpsp_overrides,
&mednafen_supafaust_overrides,
&mednafen_vb_overrides,
&pcsx_rearmed_overrides,
&picodrive_overrides,
@ -560,7 +562,7 @@ static struct Config {
[FE_OPT_SCANLINES] = {
.key = "minarch_scanlines_grid",
.name = "Scanlines/Grid",
.desc = "Simulate scanlines (or a pixel grid at odd scales).\nDarkens the overall image by about 50%. Reduces CPU load.\nOnly applies to native scaling.",
.desc = "Simulate scanlines (or a pixel grid at odd scales).\nOnly applies to native scaling.",
.default_value = 0,
.value = 0,
.count = 2,
@ -1578,6 +1580,24 @@ static double cpu_double = 0;
static double use_double = 0;
static uint32_t sec_start = 0;
//from RGB565
#define cR(A) (((A) & 0xf800) >> 11)
#define cG(A) (((A) & 0x7e0) >> 5)
#define cB(A) ((A) & 0x1f)
//to RGB565
#define Weight1_1(A, B) ((((cR(A) + cR(B)) >> 1) & 0x1f) << 11 | (((cG(A) + cG(B)) >> 1) & 0x3f) << 5 | (((cB(A) + cB(B)) >> 1) & 0x1f))
#define Weight1_2(A, B) ((((cR(A) + (cR(B) << 1)) / 3) & 0x1f) << 11 | (((cG(A) + (cG(B) << 1)) / 3) & 0x3f) << 5 | (((cB(A) + (cB(B) << 1)) / 3) & 0x1f))
#define Weight2_1(A, B) ((((cR(B) + (cR(A) << 1)) / 3) & 0x1f) << 11 | (((cG(B) + (cG(A) << 1)) / 3) & 0x3f) << 5 | (((cB(B) + (cB(A) << 1)) / 3) & 0x1f))
#define Weight1_3(A, B) ((((cR(A) + (cR(B) * 3)) >> 2) & 0x1f) << 11 | (((cG(A) + (cG(B) * 3)) >> 2) & 0x3f) << 5 | (((cB(A) + (cB(B) * 3)) >> 2) & 0x1f))
#define Weight3_1(A, B) ((((cR(B) + (cR(A) * 3)) >> 2) & 0x1f) << 11 | (((cG(B) + (cG(A) * 3)) >> 2) & 0x3f) << 5 | (((cB(B) + (cB(A) * 3)) >> 2) & 0x1f))
#define Weight1_4(A, B) ((((cR(A) + (cR(B) << 2)) / 5) & 0x1f) << 11 | (((cG(A) + (cG(B) << 2)) / 5) & 0x3f) << 5 | (((cB(A) + (cB(B) << 2)) / 5) & 0x1f))
#define Weight4_1(A, B) ((((cR(B) + (cR(A) << 2)) / 5) & 0x1f) << 11 | (((cG(B) + (cG(A) << 2)) / 5) & 0x3f) << 5 | (((cB(B) + (cB(A) << 2)) / 5) & 0x1f))
#define Weight2_3(A, B) (((((cR(A) << 1) + (cR(B) * 3)) / 5) & 0x1f) << 11 | ((((cG(A) << 1) + (cG(B) * 3)) / 5) & 0x3f) << 5 | ((((cB(A) << 1) + (cB(B) * 3)) / 5) & 0x1f))
#define Weight3_2(A, B) (((((cR(B) << 1) + (cR(A) * 3)) / 5) & 0x1f) << 11 | ((((cG(B) << 1) + (cG(A) * 3)) / 5) & 0x3f) << 5 | ((((cB(B) << 1) + (cB(A) * 3)) / 5) & 0x1f))
#define Weight1_1_1_1(A, B, C, D) ((((cR(A) + cR(B) + cR(C) + cR(D)) >> 2) & 0x1f) << 11 | (((cG(A) + cG(B) + cG(C) + cG(D)) >> 2) & 0x3f) << 5 | (((cB(A) + cB(B) + cB(C) + cB(D)) >> 2) & 0x1f))
static void scaleNull(void* __restrict src, void* __restrict dst, uint32_t w, uint32_t h, uint32_t pitch, uint32_t dst_pitch) {}
static void scale1x(void* __restrict src, void* __restrict dst, uint32_t w, uint32_t h, uint32_t pitch, uint32_t dst_pitch) {
// pitch of src image not src buffer!
@ -1608,12 +1628,18 @@ static void scale1x_scanline(void* __restrict src, void* __restrict dst, uint32_
int dst_stride = 2 * dst_pitch / SCREEN_BPP;
int cpy_pitch = MIN(src_pitch, dst_pitch);
uint16_t k = 0x0000;
uint16_t* restrict src_row = (uint16_t*)src;
uint16_t* restrict dst_row = (uint16_t*)dst;
for (int y=0; y<h; y++) {
for (int y=0; y<h; y+=2) {
memcpy(dst_row, src_row, cpy_pitch);
dst_row += dst_stride;
src_row += src_stride;
for (unsigned x = 0; x < w; x++) {
uint16_t s = *(src_row + x);
*(dst_row + x) = Weight3_2(s, k);
}
}
}
@ -1660,14 +1686,19 @@ static void scale2x_lcd(void* __restrict src, void* __restrict dst, uint32_t w,
}
}
static void scale2x_scanline(void* __restrict src, void* __restrict dst, uint32_t w, uint32_t h, uint32_t pitch, uint32_t dst_pitch) {
uint16_t k = 0x0000;
for (unsigned y = 0; y < h; y++) {
uint16_t* restrict src_row = (void*)src + y * pitch;
uint16_t* restrict dst_row = (void*)dst + y * dst_pitch * 2;
for (unsigned x = 0; x < w; x++) {
uint16_t s = *src_row;
uint16_t c1 = *src_row;
uint16_t c2 = Weight3_2( c1, k);
*(dst_row ) = s;
*(dst_row + 1 ) = s;
*(dst_row ) = c1;
*(dst_row + 1 ) = c1;
*(dst_row + SCREEN_WIDTH ) = c2;
*(dst_row + SCREEN_WIDTH + 1) = c2;
src_row += 1;
dst_row += 2;
@ -1766,27 +1797,29 @@ static void scale3x_dmg(void* __restrict src, void* __restrict dst, uint32_t w,
}
}
static void scale3x_scanline(void* __restrict src, void* __restrict dst, uint32_t w, uint32_t h, uint32_t pitch, uint32_t dst_pitch) {
// uint16_t k = 0x0000;
uint16_t k = 0x0000;
for (unsigned y = 0; y < h; y++) {
uint16_t* restrict src_row = (void*)src + y * pitch;
uint16_t* restrict dst_row = (void*)dst + y * dst_pitch * 3;
for (unsigned x = 0; x < w; x++) {
uint16_t s = *src_row;
uint16_t c1 = *src_row;
uint16_t c2 = Weight3_2( c1, k);
uint16_t c3 = Weight2_3( c1, k);
// row 1
*(dst_row ) = s;
*(dst_row + 1) = s;
// *(dst_row + 2) = k;
*(dst_row ) = c2;
*(dst_row + 1) = c1;
*(dst_row + 2) = c1;
// row 2
*(dst_row + SCREEN_WIDTH * 1 ) = s;
*(dst_row + SCREEN_WIDTH * 1 + 1) = s;
// *(dst_row + SCREEN_WIDTH * 1 + 2) = k;
*(dst_row + SCREEN_WIDTH * 1 ) = c2;
*(dst_row + SCREEN_WIDTH * 1 + 1) = c1;
*(dst_row + SCREEN_WIDTH * 1 + 2) = c1;
// row 3
// *(dst_row + SCREEN_WIDTH * 2 ) = k;
// *(dst_row + SCREEN_WIDTH * 2 + 1) = k;
// *(dst_row + SCREEN_WIDTH * 2 + 2) = k;
*(dst_row + SCREEN_WIDTH * 2 ) = c3;
*(dst_row + SCREEN_WIDTH * 2 + 1) = c2;
*(dst_row + SCREEN_WIDTH * 2 + 2) = c2;
src_row += 1;
dst_row += 3;
@ -1833,36 +1866,38 @@ static void scale4x(void* __restrict src, void* __restrict dst, uint32_t w, uint
}
static void scale4x_scanline(void* __restrict src, void* __restrict dst, uint32_t w, uint32_t h, uint32_t pitch, uint32_t dst_pitch) {
int row3 = SCREEN_WIDTH * 2;
// int row4 = SCREEN_WIDTH * 3;
int row4 = SCREEN_WIDTH * 3;
uint16_t k = 0x0000;
for (unsigned y = 0; y < h; y++) {
uint16_t* restrict src_row = (void*)src + y * pitch;
uint16_t* restrict dst_row = (void*)dst + y * dst_pitch * 4;
for (unsigned x = 0; x < w; x++) {
uint16_t s = *src_row;
uint16_t c1 = *src_row;
uint16_t c2 = Weight3_2( c1, k);
// row 1
*(dst_row ) = s;
*(dst_row + 1) = s;
*(dst_row + 2) = s;
*(dst_row + 3) = s;
*(dst_row ) = c1;
*(dst_row + 1) = c1;
*(dst_row + 2) = c1;
*(dst_row + 3) = c1;
// // row 2
// *(dst_row + SCREEN_WIDTH ) = s;
// *(dst_row + SCREEN_WIDTH + 1) = s;
// *(dst_row + SCREEN_WIDTH + 2) = s;
// *(dst_row + SCREEN_WIDTH + 3) = s;
// row 2
*(dst_row + SCREEN_WIDTH ) = c2;
*(dst_row + SCREEN_WIDTH + 1) = c2;
*(dst_row + SCREEN_WIDTH + 2) = c2;
*(dst_row + SCREEN_WIDTH + 3) = c2;
// row 3
*(dst_row + row3 ) = s;
*(dst_row + row3 + 1) = s;
*(dst_row + row3 + 2) = s;
*(dst_row + row3 + 3) = s;
*(dst_row + row3 ) = c1;
*(dst_row + row3 + 1) = c1;
*(dst_row + row3 + 2) = c1;
*(dst_row + row3 + 3) = c1;
// // row 4
// *(dst_row + row4 ) = s;
// *(dst_row + row4 + 1) = s;
// *(dst_row + row4 + 2) = s;
// *(dst_row + row4 + 3) = s;
// row 4
*(dst_row + row4 ) = c2;
*(dst_row + row4 + 1) = c2;
*(dst_row + row4 + 2) = c2;
*(dst_row + row4 + 3) = c2;
src_row += 1;
dst_row += 4;
@ -1924,7 +1959,8 @@ static void scaleNN_scanline(void* __restrict src, void* __restrict dst, uint32_
int col = w;
while(col--) {
while (dx < 0) {
*pdst16++ = *psrc16;
*pdst16 = *(pdst16 + dst_pitch) = *psrc16;
pdst16 += 1;
dx += w;
}
@ -2036,7 +2072,9 @@ static void scaleNN_text_scanline(void* __restrict src, void* __restrict dst, ui
uint16_t s = *psrc16;
while (dx < 0) {
*pdst16++ = d ? l1 : s;
*pdst16 = *(pdst16 + dst_pitch) = d ? l1 : s;
pdst16 += 1;
dx += w;
l2 = l1;
@ -2045,7 +2083,7 @@ static void scaleNN_text_scanline(void* __restrict src, void* __restrict dst, ui
}
dx -= renderer.dst_w;
psrc16++;
psrc16 += 1;
}
}

View file

@ -2,9 +2,6 @@
static CoreOverrides fake08_overrides = {
.core_name = "fake08",
.option_overrides = (OptionOverride[]){
{NULL,NULL},
},
.button_mapping = (ButtonMapping[]){
{"Up", RETRO_DEVICE_ID_JOYPAD_UP, BTN_ID_UP},
{"Down", RETRO_DEVICE_ID_JOYPAD_DOWN, BTN_ID_DOWN},

View file

@ -0,0 +1,25 @@
#include "overrides.h"
static CoreOverrides mednafen_supafaust_overrides = {
.core_name = "mednafen_supafaust",
.option_overrides = (OptionOverride[]){
{"supafaust_pixel_format", "rgb565", 1}, // others unsupported
{NULL,NULL},
},
.button_mapping = (ButtonMapping[]){
{"Up", RETRO_DEVICE_ID_JOYPAD_UP, BTN_ID_UP},
{"Down", RETRO_DEVICE_ID_JOYPAD_DOWN, BTN_ID_DOWN},
{"Left", RETRO_DEVICE_ID_JOYPAD_LEFT, BTN_ID_LEFT},
{"Right", RETRO_DEVICE_ID_JOYPAD_RIGHT, BTN_ID_RIGHT},
{"Select", RETRO_DEVICE_ID_JOYPAD_SELECT, BTN_ID_SELECT},
{"Start", RETRO_DEVICE_ID_JOYPAD_START, BTN_ID_START},
{"Y Button", RETRO_DEVICE_ID_JOYPAD_Y, BTN_ID_Y},
{"X Button", RETRO_DEVICE_ID_JOYPAD_X, BTN_ID_X},
{"B Button", RETRO_DEVICE_ID_JOYPAD_B, BTN_ID_B},
{"A Button", RETRO_DEVICE_ID_JOYPAD_A, BTN_ID_A},
{"L Button", RETRO_DEVICE_ID_JOYPAD_L, BTN_ID_L1},
{"R Button", RETRO_DEVICE_ID_JOYPAD_R, BTN_ID_R1},
{NULL},
},
};