Filter out VCV logo from Core files at runtime
This commit is contained in:
parent
802768a77e
commit
383f02ee2b
3 changed files with 108 additions and 1 deletions
|
@ -68,6 +68,9 @@ BUILD_C_FLAGS += -std=gnu11
|
||||||
BUILD_C_FLAGS += -fno-finite-math-only
|
BUILD_C_FLAGS += -fno-finite-math-only
|
||||||
BUILD_CXX_FLAGS += -fno-finite-math-only
|
BUILD_CXX_FLAGS += -fno-finite-math-only
|
||||||
|
|
||||||
|
# use our custom function to filter out VCV trademarks
|
||||||
|
BUILD_CXX_FLAGS += -DnsvgParseFromFile=nsvgParseFromFileCardinal
|
||||||
|
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
# Rack files to build
|
# Rack files to build
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ all: jack lv2 vst2 vst3 resources
|
||||||
|
|
||||||
ifeq ($(NAME),Cardinal)
|
ifeq ($(NAME),Cardinal)
|
||||||
|
|
||||||
CORE_RESOURCES = $(subst ../Rack/res/,,$(wildcard ../Rack/res/*)) template.vcv
|
CORE_RESOURCES = $(filter-out icon.png,$(subst ../Rack/res/,,$(wildcard ../Rack/res/*))) template.vcv
|
||||||
|
|
||||||
PLUGIN_RESOURCES += $(CORE_RESOURCES:%=$(TARGET_DIR)/Cardinal.lv2/resources/%)
|
PLUGIN_RESOURCES += $(CORE_RESOURCES:%=$(TARGET_DIR)/Cardinal.lv2/resources/%)
|
||||||
ifeq ($(MACOS),true)
|
ifeq ($(MACOS),true)
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
// fix blendish build, missing symbol in debug mode
|
// fix blendish build, missing symbol in debug mode
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -39,4 +40,107 @@ float FollowerBase::efGainMaxDecibelsDebug = 12.0f;
|
||||||
// Compile those nice implementation-in-header little libraries
|
// Compile those nice implementation-in-header little libraries
|
||||||
#define NANOSVG_IMPLEMENTATION
|
#define NANOSVG_IMPLEMENTATION
|
||||||
#define NANOSVG_ALL_COLOR_KEYWORDS
|
#define NANOSVG_ALL_COLOR_KEYWORDS
|
||||||
|
#undef nsvgParseFromFile
|
||||||
#include <nanosvg.h>
|
#include <nanosvg.h>
|
||||||
|
|
||||||
|
// Custom Cardinal filtering
|
||||||
|
static const struct {
|
||||||
|
const char* filename;
|
||||||
|
const char* shapes[4];
|
||||||
|
} pathsToFilterOut[] = {
|
||||||
|
{
|
||||||
|
"Core/AudioInterface.svg",
|
||||||
|
{"path39377","path39381","path39383","path39379"}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Core/AudioInterface2.svg",
|
||||||
|
{"path18733","path18737","path18731","path18735"}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Core/AudioInterface16.svg",
|
||||||
|
{"path40283","path40287","path40289","path40285"}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Core/CV-CC.svg",
|
||||||
|
{"path12881","path12885","path12887","path12883"}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Core/CV-Gate.svg",
|
||||||
|
{"path13127","path13131","path13133","path13129"}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Core/CV-MIDI.svg",
|
||||||
|
{"path12747","path12751","path12753","path12749"}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Core/MIDI-CC.svg",
|
||||||
|
{"path9740","path9744","path9746","path9742"}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Core/MIDI-CV.svg",
|
||||||
|
{"path11803","path11807","path11809","path11805"}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Core/MIDI-Gate.svg",
|
||||||
|
{"path11634","path11638","path11640","path11636"}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Core/MIDI-Map.svg",
|
||||||
|
{"path21209","path21213","path21215","path21211"}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Core/Notes.svg",
|
||||||
|
{"path6935","path6939","path6941","path6937"}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static void removeShape(NSVGimage* const handle, const char* const id)
|
||||||
|
{
|
||||||
|
for (NSVGshape *shape = handle->shapes, *old = nullptr; shape; old = shape, shape = shape->next)
|
||||||
|
{
|
||||||
|
if (strcmp(shape->id, id) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (old != nullptr)
|
||||||
|
old->next = shape->next;
|
||||||
|
else
|
||||||
|
handle->shapes = shape->next;
|
||||||
|
|
||||||
|
nsvg__deletePaths(shape->paths);
|
||||||
|
free(shape);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
NSVGimage* nsvgParseFromFileCardinal(const char* filename, const char* units, float dpi);
|
||||||
|
}
|
||||||
|
|
||||||
|
NSVGimage* nsvgParseFromFileCardinal(const char* const filename, const char* const units, const float dpi)
|
||||||
|
{
|
||||||
|
if (NSVGimage* const handle = nsvgParseFromFile(filename, units, dpi))
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < sizeof(pathsToFilterOut)/sizeof(pathsToFilterOut[0]); ++i)
|
||||||
|
{
|
||||||
|
const char* const pathToFilterOut = pathsToFilterOut[i].filename;
|
||||||
|
const size_t filenamelen = std::strlen(filename);
|
||||||
|
const size_t filterlen = std::strlen(pathToFilterOut);
|
||||||
|
|
||||||
|
if (filenamelen < filterlen)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (std::strncmp(filename + (filenamelen-filterlen), pathToFilterOut, filterlen) == 0)
|
||||||
|
{
|
||||||
|
printf("Removing CC-ND deadlock from file...\n");
|
||||||
|
removeShape(handle, pathsToFilterOut[i].shapes[0]);
|
||||||
|
removeShape(handle, pathsToFilterOut[i].shapes[1]);
|
||||||
|
removeShape(handle, pathsToFilterOut[i].shapes[2]);
|
||||||
|
removeShape(handle, pathsToFilterOut[i].shapes[3]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue