Skip to content

Commit

Permalink
add alternate libretro implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
r-type committed May 22, 2017
1 parent 762589f commit bd0e209
Show file tree
Hide file tree
Showing 80 changed files with 14,480 additions and 434 deletions.
872 changes: 439 additions & 433 deletions embed/menu/filesel.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion fdd/fdd_mtr.c
Expand Up @@ -26,7 +26,7 @@ void fddmtrsnd_initialize(UINT rate) {
mtrsnd.snd.hdr.enable = 3;
pcmmix_regist(&mtrsnd.snd.trk[0].data,
(void *)fddseek, sizeof(fddseek), rate);
mtrsnd.snd.trk[0].flag = PMIXFLAG_L | PMIXFLAG_R | PMIXFLAG_LOOP;
mtrsnd.snd.trk[0].flag = PMIXFLAG_L | PMIXFLAG_R /*| PMIXFLAG_LOOP*/;
mtrsnd.snd.trk[0].volume = (np2cfg.MOTORVOL << 12) / 100;
pcmmix_regist(&mtrsnd.snd.trk[1].data,
(void *)fddseek1, sizeof(fddseek1), rate);
Expand Down
1 change: 1 addition & 0 deletions libretro-alt/Makefile
@@ -0,0 +1 @@
include Makefile.libretro
56 changes: 56 additions & 0 deletions libretro-alt/Makefile.common
@@ -0,0 +1,56 @@
NP2_PATH := ..

INCFLAGS := -I$(NP2_PATH) \
-I$(NP2_PATH)/libretro-alt \
-I$(NP2_PATH)/cbus \
-I$(NP2_PATH)/codecnv \
-I$(NP2_PATH)/common \
-I$(NP2_PATH)/embed \
-I$(NP2_PATH)/embed/menu \
-I$(NP2_PATH)/embed/menubase \
-I$(NP2_PATH)/fdd \
-I$(NP2_PATH)/font \
-I$(NP2_PATH)/generic \
-I$(NP2_PATH)/i386c \
-I$(NP2_PATH)/i386c/ia32 \
-I$(NP2_PATH)/i386c/ia32/instructions \
-I$(NP2_PATH)/i386c/ia32/instructions/fpu \
-I$(NP2_PATH)/io \
-I$(NP2_PATH)/mem \
-I$(NP2_PATH)/sound \
-I$(NP2_PATH)/trap \
-I$(NP2_PATH)/vram

SOURCES_C := \
$(NP2_PATH)/calendar.c \
$(NP2_PATH)/debugsub386.c \
$(NP2_PATH)/keystat.c \
$(NP2_PATH)/nevent.c \
$(NP2_PATH)/pccore.c \
$(NP2_PATH)/statsave.c \
$(NP2_PATH)/timing.c \
$(wildcard $(NP2_PATH)/bios/*.c) \
$(wildcard $(NP2_PATH)/cbus/*.c) \
$(wildcard $(NP2_PATH)/codecnv/*.c) \
$(wildcard $(NP2_PATH)/common/*.c) \
$(wildcard $(NP2_PATH)/embed/*.c) \
$(wildcard $(NP2_PATH)/embed/menu/*.c) \
$(wildcard $(NP2_PATH)/embed/menubase/*.c) \
$(wildcard $(NP2_PATH)/fdd/*.c) \
$(wildcard $(NP2_PATH)/font/*.c) \
$(wildcard $(NP2_PATH)/generic/*.c) \
$(wildcard $(NP2_PATH)/i386c/*.c) \
$(wildcard $(NP2_PATH)/i386c/ia32/*.c) \
$(wildcard $(NP2_PATH)/i386c/ia32/instructions/*.c) \
$(NP2_PATH)/i386c/ia32/instructions/fpu/fpemul.c \
$(wildcard $(NP2_PATH)/io/*.c) \
$(wildcard $(NP2_PATH)/lio/*.c) \
$(wildcard $(NP2_PATH)/libretro-alt/*.c) \
$(wildcard $(NP2_PATH)/mem/*.c) \
$(wildcard $(NP2_PATH)/sound/*.c) \
$(wildcard $(NP2_PATH)/sound/getsnd/*.c) \
$(wildcard $(NP2_PATH)/sound/vermouth/*.c) \
$(wildcard $(NP2_PATH)/trap/*.c) \
$(wildcard $(NP2_PATH)/vram/*.c)


156 changes: 156 additions & 0 deletions libretro-alt/Makefile.libretro
@@ -0,0 +1,156 @@

DEBUG = 0
GIT_VERSION := " $(shell git rev-parse --short HEAD)"

ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -a),)
platform = win
else ifneq ($(findstring MINGW,$(shell uname -a)),)
platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
platform = osx
else ifneq ($(findstring win,$(shell uname -a)),)
platform = win
endif
endif

# system platform
system_platform = unix
ifeq ($(shell uname -a),)
EXE_EXT = .exe
system_platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
system_platform = osx
arch = intel
ifeq ($(shell uname -p),powerpc)
arch = ppc
endif
else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win
endif

ifeq ($(platform), win)
INCLUDES += -I Windows
endif

TARGET_NAME := nekop21
ENDIANNESS_DEFINES :=
CORE_DIR := .

ifeq ($(platform), unix)
CFLAGS = -g -O2
CXXFLAGS = -g -O2 -fno-merge-constants
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
FLAGS += -D__LINUX__
else ifneq (,$(findstring osx,$(platform)))
TARGET := $(TARGET_NAME)_libretro.dylib
fpic = -fPIC
SHARED := -dynamiclib

else ifneq (,$(findstring ios,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ios.dylib
fpic = -fPIC
SHARED := -dynamiclib

ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
endif

DEFINES := -DIOS
CC = cc -arch armv7 -isysroot $(IOSSDK)
CXX = c++ -arch armv7 -isysroot $(IOSSDK)
ifeq ($(platform),ios9)
CC += -miphoneos-version-min=8.0
CXXFLAGS += -miphoneos-version-min=8.0
else
CC += -miphoneos-version-min=5.0
CXXFLAGS += -miphoneos-version-min=5.0
endif

# android arm
else ifneq (,$(findstring android,$(platform)))
TARGET := $(TARGET_NAME)_libretro_android.so
fpic = -fPIC
SHARED := -lstdc++ -llog -shared -Wl,--version-script=link.T -Wl,--no-undefined
CFLAGS += -g -O2
CXXFLAGS = -g -O2 -fno-merge-constants
CC = arm-linux-androideabi-gcc
CXX = arm-linux-androideabi-g++
FLAGS += -D__LINUX__ -DARM -marm
# crosspi arm
else ifneq (,$(findstring crosspi,$(platform)))
CC = arm-linux-gnueabihf-gcc
CXX = arm-linux-gnueabihf-g++
CC_AS = arm-linux-gnueabihf-as
CPU_FLAGS += -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard
CFLAGS += -g -O2
CXXFLAGS += -g -O2 -fno-merge-constants
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
FLAGS += -D__LINUX__ -DARM -marm
# cross Windows
else ifeq ($(platform), wincross64)
TARGET := $(TARGET_NAME)_libretro.dll
AR = x86_64-w64-mingw32-ar
CC = x86_64-w64-mingw32-gcc
CXX = x86_64-w64-mingw32-g++
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
LDFLAGS += -static-libgcc -static-libstdc++
EXTRA_LDF := -lwinmm -Wl,--export-all-symbols
else
TARGET := $(TARGET_NAME)_libretro.dll
CC = gcc
CXX = g++
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
LDFLAGS += -static-libgcc -static-libstdc++
EXTRA_LDF = -lwinmm -Wl,--export-all-symbols
endif

CDEBUGFLAGS+=
CDEBUGFLAGS+=
FLAGS += $(CDEBUGFLAGS)

include $(CORE_DIR)/Makefile.common

OBJECTS := $(SOURCES_CXX:.cpp=.o) $(SOURCES_C:.c=.o) $(SOURCES_S:.s=.o)

all: $(TARGET)

ifeq ($(DEBUG), 0)
FLAGS += -O3 -ffast-math -fomit-frame-pointer -DNDEBUG -DGIT_VERSION=\"$(GIT_VERSION)\"
else
FLAGS += -O0 -g
endif

LDFLAGS += $(fpic) $(SHARED) $(EXTRA_LDF) -lm
FLAGS += $(INCFLAGS)
FLAGS +=

WARNINGS :=

FLAGS += -D__LIBRETRO__ $(ENDIANNESS_DEFINES) $(WARNINGS) $(fpic)

CXXFLAGS += $(FLAGS) -fpermissive $(CPU_FLAGS)
CFLAGS += $(FLAGS) -std=gnu99 $(CPU_FLAGS)


$(TARGET): $(OBJECTS)
$(CC) -o $@ $^ $(LDFLAGS)

%.o: %.cpp
$(CXX) -c -o $@ $< $(CXXFLAGS)

%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)

%.o: %.s
$(CXX) $(CFLAGS) -c $^ -o $@

clean:
rm -f $(TARGET) $(OBJECTS)

.PHONY: clean
83 changes: 83 additions & 0 deletions libretro-alt/ank10.res
@@ -0,0 +1,83 @@
#define ANKFONTSIZE 10
static const unsigned char ankfont[960] = {
0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,
0x80,0x80,0x80,0x80,0x80,0x00,0x80,0x00,0x03,0x00,0xa0,0xa0,
0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x50,0x50,0xf8,0x50,
0xf8,0x50,0x50,0x00,0x05,0x00,0x20,0x70,0xa8,0x60,0x30,0xa8,
0x70,0x00,0x05,0x00,0xc0,0xc8,0x10,0x20,0x40,0x98,0x18,0x00,
0x05,0x00,0x40,0xa0,0xa0,0x48,0xb0,0x90,0x68,0x00,0x01,0x00,
0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x40,0x80,
0x80,0x80,0x80,0x80,0x40,0x00,0x02,0x00,0x80,0x40,0x40,0x40,
0x40,0x40,0x80,0x00,0x03,0x40,0xe0,0x40,0xe0,0x40,0x00,0x00,
0x00,0x00,0x03,0x00,0x00,0x00,0x40,0xe0,0x40,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02,0x00,
0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0x00,0x03,0x00,0x20,0x20,0x40,0x40,
0x40,0x80,0x80,0x00,0x04,0x00,0x60,0x90,0x90,0x90,0x90,0x90,
0x60,0x00,0x02,0x00,0x40,0xc0,0x40,0x40,0x40,0x40,0x40,0x00,
0x04,0x00,0x60,0x90,0x10,0x20,0x40,0x80,0xf0,0x00,0x04,0x00,
0xf0,0x20,0x40,0x20,0x10,0x90,0x60,0x00,0x04,0x00,0x20,0x60,
0xa0,0xa0,0xf0,0x20,0x20,0x00,0x04,0x00,0xf0,0x80,0xe0,0x90,
0x10,0x90,0x60,0x00,0x04,0x00,0x20,0x40,0x80,0xe0,0x90,0x90,
0x60,0x00,0x04,0x00,0xf0,0x10,0x20,0x20,0x40,0x40,0x40,0x00,
0x04,0x00,0x60,0x90,0x90,0x60,0x90,0x90,0x60,0x00,0x04,0x00,
0x60,0x90,0x90,0x70,0x10,0x20,0x40,0x00,0x01,0x00,0x00,0x00,
0x80,0x00,0x00,0x80,0x00,0x00,0x01,0x00,0x00,0x00,0x80,0x00,
0x00,0x80,0x80,0x00,0x03,0x00,0x00,0x00,0x20,0x40,0x80,0x40,
0x20,0x00,0x03,0x00,0x00,0x00,0x00,0xe0,0x00,0xe0,0x00,0x00,
0x03,0x00,0x00,0x00,0x80,0x40,0x20,0x40,0x80,0x00,0x04,0x00,
0x60,0x90,0x10,0x20,0x40,0x00,0x40,0x00,0x07,0x00,0x38,0x44,
0x9a,0xaa,0x94,0x40,0x3c,0x00,0x05,0x00,0x20,0x20,0x50,0x50,
0x70,0x88,0x88,0x00,0x05,0x00,0xf0,0x88,0x88,0xf0,0x88,0x88,
0xf0,0x00,0x05,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00,
0x05,0x00,0xf0,0x88,0x88,0x88,0x88,0x88,0xf0,0x00,0x04,0x00,
0xf0,0x80,0x80,0xe0,0x80,0x80,0xf0,0x00,0x04,0x00,0xf0,0x80,
0x80,0xe0,0x80,0x80,0x80,0x00,0x05,0x00,0x70,0x88,0x80,0xb8,
0x88,0x98,0x68,0x00,0x05,0x00,0x88,0x88,0x88,0xf8,0x88,0x88,
0x88,0x00,0x01,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,
0x04,0x00,0x10,0x10,0x10,0x10,0x10,0x90,0x60,0x00,0x05,0x00,
0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x00,0x04,0x00,0x80,0x80,
0x80,0x80,0x80,0x80,0xf0,0x00,0x07,0x00,0xc6,0xc6,0xaa,0xaa,
0x92,0x92,0x82,0x00,0x05,0x00,0xc8,0xc8,0xa8,0xa8,0xa8,0x98,
0x98,0x00,0x05,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,
0x05,0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x80,0x00,0x05,0x00,
0x70,0x88,0x88,0x88,0xa8,0x98,0x70,0x08,0x05,0x00,0xf0,0x88,
0x88,0xf0,0x88,0x88,0x88,0x00,0x05,0x00,0x70,0x88,0x80,0x70,
0x08,0x88,0x70,0x00,0x05,0x00,0xf8,0x20,0x20,0x20,0x20,0x20,
0x20,0x00,0x05,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,
0x05,0x00,0x88,0x88,0x88,0x50,0x50,0x50,0x20,0x00,0x07,0x00,
0x82,0x82,0x82,0x54,0x54,0x54,0x28,0x00,0x05,0x00,0x88,0x88,
0x50,0x20,0x50,0x88,0x88,0x00,0x05,0x00,0x88,0x88,0x50,0x50,
0x20,0x20,0x20,0x00,0x05,0x00,0xf8,0x08,0x10,0x20,0x40,0x80,
0xf8,0x00,0x02,0x00,0xc0,0x80,0x80,0x80,0x80,0x80,0xc0,0x00,
0x03,0x00,0x80,0x80,0x40,0x40,0x40,0x20,0x20,0x00,0x02,0x00,
0xc0,0x40,0x40,0x40,0x40,0x40,0xc0,0x00,0x03,0x40,0xa0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xf0,0x00,0x02,0x80,0x40,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x04,0x00,0x00,0x00,0x60,0x10,0x70,0x90,0x70,0x00,
0x04,0x00,0x80,0x80,0xe0,0x90,0x90,0x90,0xe0,0x00,0x04,0x00,
0x00,0x00,0x60,0x90,0x80,0x90,0x60,0x00,0x04,0x00,0x10,0x10,
0x70,0x90,0x90,0x90,0x70,0x00,0x04,0x00,0x00,0x00,0x60,0x90,
0xf0,0x80,0x60,0x00,0x03,0x00,0x20,0x40,0x40,0xe0,0x40,0x40,
0x40,0x00,0x04,0x00,0x00,0x20,0x60,0x90,0xa0,0x60,0x90,0xe0,
0x04,0x00,0x80,0x80,0xa0,0xd0,0x90,0x90,0x90,0x00,0x01,0x00,
0x80,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x02,0x00,0x40,0x00,
0x40,0x40,0x40,0x40,0x40,0xc0,0x04,0x00,0x80,0x80,0xa0,0xc0,
0xc0,0xa0,0x90,0x00,0x01,0x00,0x80,0x80,0x80,0x80,0x80,0x80,
0x80,0x00,0x05,0x00,0x00,0x00,0xf0,0xa8,0xa8,0xa8,0xa8,0x00,
0x04,0x00,0x00,0x00,0xe0,0x90,0x90,0x90,0x90,0x00,0x04,0x00,
0x00,0x00,0x60,0x90,0x90,0x90,0x60,0x00,0x04,0x00,0x00,0x00,
0xe0,0x90,0x90,0xe0,0x80,0x80,0x04,0x00,0x00,0x00,0x70,0x90,
0x90,0x70,0x10,0x10,0x03,0x00,0x00,0x00,0xa0,0xc0,0x80,0x80,
0x80,0x00,0x03,0x00,0x00,0x00,0x60,0x80,0x40,0x20,0xc0,0x00,
0x03,0x00,0x00,0x40,0xe0,0x40,0x40,0x40,0x60,0x00,0x04,0x00,
0x00,0x00,0x90,0x90,0x90,0x90,0x70,0x00,0x03,0x00,0x00,0x00,
0xa0,0xa0,0xa0,0x40,0x40,0x00,0x05,0x00,0x00,0x00,0x88,0xa8,
0xa8,0x50,0x50,0x00,0x04,0x00,0x00,0x00,0x90,0x90,0x60,0x90,
0x90,0x00,0x04,0x00,0x00,0x00,0x90,0x90,0x90,0x50,0x20,0xc0,
0x04,0x00,0x00,0x00,0xf0,0x10,0x60,0x80,0xf0,0x00,0x03,0x00,
0x20,0x40,0x40,0x80,0x40,0x40,0x20,0x00,0x01,0x00,0x80,0x80,
0x80,0x00,0x80,0x80,0x80,0x00,0x03,0x00,0x80,0x40,0x40,0x20,
0x40,0x40,0x80,0x00,0x04,0x00,0x50,0xa0,0x00,0x00,0x00,0x00,
0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};

0 comments on commit bd0e209

Please sign in to comment.