Commit 10dd1751 authored by PoroCYon's avatar PoroCYon
Browse files

[v2] C++ backend stuff, enable ronan w/ asm backend

parent f41e000e
# C++ version is more stable, but might be larger # C++ version is more stable, but might be larger
USE_CXX_VERSION ?= 1 USE_CXX_VERSION ?= 0
# v2m-player submodule instead of fr_public
USE_CXX_CLEANUP_VERSION ?= 0
# you most likely want this # you most likely want this
USE_RONAN ?= 1 USE_RONAN ?= 1
...@@ -20,13 +22,17 @@ fr_public/README.md: ...@@ -20,13 +22,17 @@ fr_public/README.md:
@>&2 echo " git submodule update --init --recursive" @>&2 echo " git submodule update --init --recursive"
@false @false
CFLAGS := -m32 CFLAGS := -m32 -DNDEBUG -fno-asynchronous-unwind-tables -fno-stack-protector
ASFLAGS := -felf32 ASFLAGS := -felf32
ifeq ($(USE_CXX_VERSION),0) ifeq ($(USE_CXX_VERSION),0)
CFLAGS += -I libv2/ CFLAGS += -I libv2/
else else
ifeq ($(USE_CXX_CLEANUP_VERSION),0)
CFLAGS += -I libv2/ -DUSE_CXX_VERSION
else
CFLAGS += -I v2m-player/src/ -DUSE_CXX_VERSION CFLAGS += -I v2m-player/src/ -DUSE_CXX_VERSION
endif endif
endif
ifneq ($(USE_RONAN),0) ifneq ($(USE_RONAN),0)
CFLAGS += -DRONAN CFLAGS += -DRONAN
ASFLAGS += -DRONAN ASFLAGS += -DRONAN
...@@ -38,11 +44,20 @@ ASFLAGS += -g ...@@ -38,11 +44,20 @@ ASFLAGS += -g
obj/lplayer.o: src/lplayer.cpp obj/ obj/lplayer.o: src/lplayer.cpp obj/
$(CXX) $(CFLAGS) -o "$@" -c "$<" $(CXX) $(CFLAGS) -o "$@" -c "$<"
obj/v2mplayer.o: libv2/v2mplayer.cpp obj/ fr_public/README.md
$(CXX) $(CFLAGS) -o "$@" -c "$<"
obj/synth.o: libv2/synth.asm obj/ fr_public/README.md obj/synth.o: libv2/synth.asm obj/ fr_public/README.md
$(NASM) $(ASFLAGS) -o "$@" "$<" $(NASM) $(ASFLAGS) -o "$@" "$<"
obj/v2mconv.o: libv2/v2mconv.cpp obj/ fr_public/README.md
$(CXX) $(CFLAGS) -o "$@" -c "$<"
obj/v2mplayer.o: libv2/v2mplayer.cpp obj/ fr_public/README.md
$(CXX) $(CFLAGS) -o "$@" -c "$<"
obj/ronan.o: libv2/ronan.cpp obj/ fr_public/README.md
$(CXX) $(CFLAGS) -o "$@" -c "$<"
obj/synth_core.o: libv2/synth_core.cpp obj/ fr_public/README.md
$(CXX) $(CFLAGS) -o "$@" -c "$<"
obj/sounddef.o: libv2/sounddef.cpp obj/ fr_public/README.md
$(CXX) $(CFLAGS) -o "$@" -c "$<"
obj/pv2mconv.o: v2m-player/src/v2mconv.cpp obj/ v2m-player/README.md obj/pv2mconv.o: v2m-player/src/v2mconv.cpp obj/ v2m-player/README.md
$(CXX) $(CFLAGS) -o "$@" -c "$<" $(CXX) $(CFLAGS) -o "$@" -c "$<"
obj/pv2mplayer.o: v2m-player/src/v2mplayer.cpp obj/ v2m-player/README.md obj/pv2mplayer.o: v2m-player/src/v2mplayer.cpp obj/ v2m-player/README.md
...@@ -64,10 +79,16 @@ obj/v2m-%.o: obj/v2m-%.asm ...@@ -64,10 +79,16 @@ obj/v2m-%.o: obj/v2m-%.asm
$(NASM) -g -f elf32 -o "$@" "$<" $(NASM) -g -f elf32 -o "$@" "$<"
ifeq ($(USE_CXX_VERSION),0) ifeq ($(USE_CXX_VERSION),0)
bin/lplayer-%: obj/lplayer.o obj/synth.o obj/v2mplayer.o obj/v2m-%.o bin/ bin/lplayer-%: obj/lplayer.o obj/synth.o obj/ronan.o obj/v2mconv.o \
obj/v2mplayer.o obj/sounddef.o obj/v2m-%.o bin/
else
ifeq ($(USE_CXX_CLEANUP_VERSION),0)
bin/lplayer-%: obj/lplayer.o obj/synth_core.o obj/v2mconv.o obj/v2mplayer.o \
obj/ronan.o obj/sounddef.o obj/v2m-%.o bin/
else else
bin/lplayer-%: obj/lplayer.o obj/psynth_core.o obj/pv2mconv.o obj/pv2mplayer.o \ bin/lplayer-%: obj/lplayer.o obj/psynth_core.o obj/pv2mconv.o obj/pv2mplayer.o \
obj/pronan.o obj/psounddef.o obj/v2m-%.o bin/ obj/pronan.o obj/psounddef.o obj/v2m-%.o bin/
endif
endif endif
$(CXX) -Wl,--gc-sections $(CFLAGS) -o "$@" $(filter-out bin/,$^) $(CXX) -Wl,--gc-sections $(CFLAGS) -o "$@" $(filter-out bin/,$^)
......
Subproject commit 280b89ad3668d8e65f5b45518da9244bf1e0a630 Subproject commit 5a9bddc43a01d1c17729dadb79910732dd6db371
../fr_public/v2/phonemtab.h
\ No newline at end of file
../fr_public/v2/ronan.cpp
\ No newline at end of file
../fr_public/v2/sounddef.cpp
\ No newline at end of file
../fr_public/v2/sounddef.h
\ No newline at end of file
../fr_public/v2/synth_core.cpp
\ No newline at end of file
../fr_public/v2/types.h
\ No newline at end of file
../fr_public/v2/v2mconv.cpp
\ No newline at end of file
../fr_public/v2/v2mconv.h
\ No newline at end of file
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#define AUTOCONVERT #ifdef USE_CXX_VERSION
//#define AUTOCONVERT
#endif
#include "v2mplayer.h" #include "v2mplayer.h"
#include "synth.h" #include "synth.h"
...@@ -17,7 +19,7 @@ ...@@ -17,7 +19,7 @@
// automatically convert the module to the newest format version // automatically convert the module to the newest format version
extern "C" const uint8_t theTune[]; extern "C" /*const*/ uint8_t theTune[];
extern "C" const size_t theTune_size; extern "C" const size_t theTune_size;
#define BUFFERLEN (8192) /* arbitrary */ #define BUFFERLEN (8192) /* arbitrary */
...@@ -26,12 +28,13 @@ static V2MPlayer player; ...@@ -26,12 +28,13 @@ static V2MPlayer player;
static float output_buffer[BUFFERLEN*8]; static float output_buffer[BUFFERLEN*8];
#ifdef AUTOCONVERT #ifdef AUTOCONVERT
static uint8_t* check_and_convert(const uint8_t* tune, size_t len) { static uint8_t* check_and_convert(/*const*/ uint8_t* tune, size_t len) {
if (tune[2] != 0 || tune[3] != 0) { if (tune[2] != 0 || tune[3] != 0) {
fprintf(stderr, "Invalid input file\n"); fprintf(stderr, "Invalid input file\n");
return NULL; return NULL;
} }
int v = CheckV2MVersion(tune, len); int v = CheckV2MVersion(tune, len);
if (!v) return tune; // version is the latest one
if (v < 0) { if (v < 0) {
fprintf(stderr, "Invalid input file (version not recognised)\n"); fprintf(stderr, "Invalid input file (version not recognised)\n");
return NULL; return NULL;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment