Cardinal/src/override/diffs/common.cpp.diff
falkTX 1262f318da
Update and adapt to Rack 2.3
Signed-off-by: falkTX <falktx@falktx.com>
2023-05-20 19:38:29 +02:00

98 lines
3.1 KiB
Diff

--- ../Rack/src/common.cpp 2023-05-20 17:03:33.006081772 +0200
+++ common.cpp 2023-05-20 17:51:04.675045244 +0200
@@ -1,12 +1,57 @@
+/*
+ * DISTRHO Cardinal Plugin
+ * Copyright (C) 2021-2023 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.
+ */
+
+/**
+ * This file is an edited version of VCVRack's common.cpp
+ * Copyright (C) 2016-2023 VCV.
+ *
+ * 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 (at your option) any later version.
+ */
+
#include <common.hpp>
#include <string.hpp>
+#ifdef NDEBUG
+# undef DEBUG
+#endif
+
+#include "DistrhoPluginUtils.hpp"
-#if defined ARCH_WIN
+#if defined(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());
+ if (FILE* const f = _wfopen(rack::string::UTF8toUTF16(filename).c_str(), rack::string::UTF8toUTF16(mode).c_str()))
+ return f;
+ if (std::strncmp(filename, "\\\\?\\", 4) == 0 && std::getenv("CARDINAL_UNDER_WINE") != nullptr)
+ return _wfopen(L"Z:\\dev\\null", rack::string::UTF8toUTF16(mode).c_str());
+ return nullptr;
+}
+
+#elif defined(DISTRHO_OS_WASM)
+#include <sys/stat.h>
+#undef fopen
+
+FILE* fopen_wasm(const char* filename, const char* mode) {
+ chmod(filename, 0777);
+ return std::fopen(filename, mode);
}
#endif
@@ -14,12 +59,11 @@
namespace rack {
-
-const std::string APP_NAME = "VCV Rack";
-const std::string APP_EDITION = "Free";
-const std::string APP_EDITION_NAME = "Free";
+const std::string APP_NAME = "Cardinal";
+const std::string APP_EDITION = getPluginFormatName();
+const std::string APP_EDITION_NAME = "Audio Plugin";
const std::string APP_VERSION_MAJOR = "2";
-const std::string APP_VERSION = TOSTRING(_APP_VERSION);
+const std::string APP_VERSION = "2.3.0";
#if defined ARCH_WIN
const std::string APP_OS = "win";
const std::string APP_OS_NAME = "Windows";
@@ -29,15 +73,10 @@
#elif defined ARCH_LIN
const std::string APP_OS = "lin";
const std::string APP_OS_NAME = "Linux";
+#else
+ #error ARCH_LIN undefined
#endif
-#if defined ARCH_X64
- const std::string APP_CPU = "x64";
- const std::string APP_CPU_NAME = "x64";
-#elif defined ARCH_ARM64
- const std::string APP_CPU = "arm64";
- const std::string APP_CPU_NAME = "ARM64";
-#endif
-const std::string API_URL = "https://api.vcvrack.com";
+const std::string API_URL = "";
Exception::Exception(const char* format, ...) {