@@ -70,7 +70,7 @@ struct Initializer { | |||||
settings::discordUpdateActivity = false; | settings::discordUpdateActivity = false; | ||||
settings::isPlugin = true; | settings::isPlugin = true; | ||||
settings::skipLoadOnLaunch = true; | settings::skipLoadOnLaunch = true; | ||||
settings::showTipsOnLaunch = true; | |||||
settings::showTipsOnLaunch = false; | |||||
settings::threadCount = 1; | settings::threadCount = 1; | ||||
system::init(); | system::init(); | ||||
asset::init(); | asset::init(); | ||||
@@ -87,33 +87,12 @@ struct Initializer { | |||||
INFO("User directory: %s", asset::userDir.c_str()); | INFO("User directory: %s", asset::userDir.c_str()); | ||||
INFO("System time: %s", string::formatTimeISO(system::getUnixTime()).c_str()); | INFO("System time: %s", string::formatTimeISO(system::getUnixTime()).c_str()); | ||||
// Load settings | |||||
settings::init(); | |||||
#if 0 | |||||
try { | |||||
settings::load(); | |||||
} | |||||
catch (Exception& e) { | |||||
std::string message = e.what(); | |||||
message += "\n\nResetting settings to default"; | |||||
d_stdout(message.c_str()); | |||||
/* | |||||
if (!osdialog_message(OSDIALOG_WARNING, OSDIALOG_OK_CANCEL, msg.c_str())) { | |||||
exit(1); | |||||
} | |||||
*/ | |||||
} | |||||
#endif | |||||
// Check existence of the system res/ directory | // Check existence of the system res/ directory | ||||
std::string resDir = asset::system("res"); | |||||
if (!system::isDirectory(resDir)) { | |||||
std::string message = string::f("Rack's resource directory \"%s\" does not exist. Make sure Rack is correctly installed and launched.", resDir.c_str()); | |||||
d_stderr2(message.c_str()); | |||||
/* | |||||
osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, message.c_str()); | |||||
*/ | |||||
// exit(1); | |||||
const std::string resDir = asset::system("res"); | |||||
if (! system::isDirectory(resDir)) | |||||
{ | |||||
d_stderr2("Resource directory \"%s\" does not exist.\n" | |||||
"Make sure Cardinal was downloaded and installed correctly.", resDir.c_str()); | |||||
} | } | ||||
INFO("Initializing environment"); | INFO("Initializing environment"); | ||||
@@ -47,7 +47,7 @@ endif | |||||
FILES_DSP += $(wildcard Rack/src/*.c) | FILES_DSP += $(wildcard Rack/src/*.c) | ||||
FILES_DSP += $(wildcard Rack/src/*/*.c) | FILES_DSP += $(wildcard Rack/src/*/*.c) | ||||
FILES_DSP += $(filter-out Rack/src/dep.cpp Rack/src/discord.cpp Rack/src/gamepad.cpp Rack/src/keyboard.cpp Rack/src/library.cpp Rack/src/network.cpp Rack/src/rtaudio.cpp Rack/src/rtmidi.cpp, $(wildcard Rack/src/*.cpp)) | |||||
FILES_DSP += $(filter-out Rack/src/common.cpp Rack/src/dep.cpp Rack/src/discord.cpp Rack/src/gamepad.cpp Rack/src/keyboard.cpp Rack/src/library.cpp Rack/src/network.cpp Rack/src/rtaudio.cpp Rack/src/rtmidi.cpp, $(wildcard Rack/src/*.cpp)) | |||||
FILES_DSP += $(filter-out Rack/src/window/Window.cpp, $(wildcard Rack/src/*/*.cpp)) | FILES_DSP += $(filter-out Rack/src/window/Window.cpp, $(wildcard Rack/src/*/*.cpp)) | ||||
# FOR TESTING | # FOR TESTING | ||||
@@ -90,7 +90,6 @@ endif | |||||
# FOR TESTING | # FOR TESTING | ||||
# BASE_FLAGS += -I../dpf/distrho/src/jackbridge | # BASE_FLAGS += -I../dpf/distrho/src/jackbridge | ||||
BASE_FLAGS += -D_APP_VERSION=Cardinal | |||||
BASE_FLAGS += -I../dpf/dgl/src/nanovg | BASE_FLAGS += -I../dpf/dgl/src/nanovg | ||||
BASE_FLAGS += -I../include | BASE_FLAGS += -I../include | ||||
BASE_FLAGS += -I../include/neon-compat | BASE_FLAGS += -I../include/neon-compat | ||||
@@ -1,14 +1,31 @@ | |||||
// This source file compiles those nice implementation-in-header little libraries | |||||
/* | |||||
* DISTRHO Cardinal Plugin | |||||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU General Public License as | |||||
* published by the Free Software Foundation; either version 3 of | |||||
* the License, or any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* For a full copy of the GNU General Public License see the LICENSE file. | |||||
*/ | |||||
#include <common.hpp> // for fopen_u8 | |||||
#include <common.hpp> | |||||
#include <string.hpp> | |||||
#ifdef NDEBUG | #ifdef NDEBUG | ||||
# undef DEBUG | # undef DEBUG | ||||
#endif | #endif | ||||
#include "OpenGL.hpp" | #include "OpenGL.hpp" | ||||
#ifdef DEBUG | |||||
// fix blendish build, missing symbol in debug mode | // fix blendish build, missing symbol in debug mode | ||||
#ifdef DEBUG | |||||
extern "C" { | extern "C" { | ||||
float bnd_clamp(float v, float mn, float mx) { | float bnd_clamp(float v, float mn, float mx) { | ||||
return (v > mx)?mx:(v < mn)?mn:v; | return (v > mx)?mx:(v < mn)?mn:v; | ||||
@@ -16,13 +33,47 @@ float bnd_clamp(float v, float mn, float mx) { | |||||
} | } | ||||
#endif | #endif | ||||
// fopen_u8 | |||||
#ifdef ARCH_WIN | |||||
#include <windows.h> | |||||
FILE* fopen_u8(const char* filename, const char* mode) | |||||
{ | |||||
return _wfopen(rack::string::UTF8toUTF16(filename).c_str(), rack::string::UTF8toUTF16(mode).c_str()); | |||||
} | |||||
#endif | |||||
// Compile those nice implementation-in-header little libraries | |||||
#define NANOSVG_IMPLEMENTATION | #define NANOSVG_IMPLEMENTATION | ||||
#define NANOSVG_ALL_COLOR_KEYWORDS | #define NANOSVG_ALL_COLOR_KEYWORDS | ||||
#include <nanosvg.h> | #include <nanosvg.h> | ||||
// Define the global names to indicate this is Cardinal and not VCVRack | |||||
namespace rack { | |||||
const std::string APP_NAME = ""; | |||||
const std::string APP_EDITION = ""; | |||||
const std::string APP_EDITION_NAME = "Cardinal Audio Plugin"; | |||||
const std::string APP_VERSION_MAJOR = "2"; | |||||
const std::string APP_VERSION = "v0.0.1"; | |||||
#if defined(ARCH_WIN) | |||||
const std::string APP_ARCH = "win"; | |||||
#elif defined(ARCH_MAC) | |||||
const std::string APP_ARCH = "mac"; | |||||
#else | |||||
const std::string APP_ARCH = "lin"; | |||||
#endif | |||||
const std::string API_URL = ""; | |||||
Exception::Exception(const char* format, ...) | |||||
{ | |||||
va_list args; | |||||
va_start(args, format); | |||||
msg = string::fV(format, args); | |||||
va_end(args); | |||||
} | |||||
} | |||||
// Define the stuff needed for VCVRack but unused for Cardinal | |||||
#include <library.hpp> | #include <library.hpp> | ||||
#include <network.hpp> | #include <network.hpp> | ||||
namespace rack { | namespace rack { | ||||
namespace library { | namespace library { | ||||
std::string appChangelogUrl; | std::string appChangelogUrl; | ||||