From 4f8db21a9e592f0e082a365349edf7bc8c5a225c Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 17 Oct 2021 23:19:40 +0100 Subject: [PATCH] Tweak init and display name Signed-off-by: falkTX --- src/CardinalPlugin.cpp | 33 +++++------------------ src/Makefile | 3 +-- src/dep.cpp | 59 +++++++++++++++++++++++++++++++++++++++--- 3 files changed, 62 insertions(+), 33 deletions(-) diff --git a/src/CardinalPlugin.cpp b/src/CardinalPlugin.cpp index 6342c00..20f5433 100644 --- a/src/CardinalPlugin.cpp +++ b/src/CardinalPlugin.cpp @@ -70,7 +70,7 @@ struct Initializer { settings::discordUpdateActivity = false; settings::isPlugin = true; settings::skipLoadOnLaunch = true; - settings::showTipsOnLaunch = true; + settings::showTipsOnLaunch = false; settings::threadCount = 1; system::init(); asset::init(); @@ -87,33 +87,12 @@ struct Initializer { INFO("User directory: %s", asset::userDir.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 - 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"); diff --git a/src/Makefile b/src/Makefile index 98caeb6..3c0bdec 100644 --- a/src/Makefile +++ b/src/Makefile @@ -47,7 +47,7 @@ endif 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)) # FOR TESTING @@ -90,7 +90,6 @@ endif # FOR TESTING # BASE_FLAGS += -I../dpf/distrho/src/jackbridge -BASE_FLAGS += -D_APP_VERSION=Cardinal BASE_FLAGS += -I../dpf/dgl/src/nanovg BASE_FLAGS += -I../include BASE_FLAGS += -I../include/neon-compat diff --git a/src/dep.cpp b/src/dep.cpp index 31d99af..0aec454 100644 --- a/src/dep.cpp +++ b/src/dep.cpp @@ -1,14 +1,31 @@ -// This source file compiles those nice implementation-in-header little libraries +/* + * DISTRHO Cardinal Plugin + * Copyright (C) 2021 Filipe Coelho + * + * 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 // for fopen_u8 +#include +#include #ifdef NDEBUG # undef DEBUG #endif + #include "OpenGL.hpp" -#ifdef DEBUG // fix blendish build, missing symbol in debug mode +#ifdef DEBUG extern "C" { float bnd_clamp(float v, float mn, float mx) { return (v > mx)?mx:(v < mn)?mn:v; @@ -16,13 +33,47 @@ float bnd_clamp(float v, float mn, float mx) { } #endif +// fopen_u8 +#ifdef ARCH_WIN +#include +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_ALL_COLOR_KEYWORDS #include +// 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 #include - namespace rack { namespace library { std::string appChangelogUrl;