You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.0KB

  1. /*
  2. * DISTRHO Cardinal Plugin
  3. * Copyright (C) 2021 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 3 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the LICENSE file.
  16. */
  17. #include <common.hpp>
  18. #include <string.hpp>
  19. #ifdef NDEBUG
  20. # undef DEBUG
  21. #endif
  22. #include "OpenGL.hpp"
  23. // fix blendish build, missing symbol in debug mode
  24. #ifdef DEBUG
  25. extern "C" {
  26. float bnd_clamp(float v, float mn, float mx) {
  27. return (v > mx)?mx:(v < mn)?mn:v;
  28. }
  29. }
  30. #endif
  31. // fopen_u8
  32. #ifdef ARCH_WIN
  33. #include <windows.h>
  34. FILE* fopen_u8(const char* filename, const char* mode)
  35. {
  36. return _wfopen(rack::string::UTF8toUTF16(filename).c_str(), rack::string::UTF8toUTF16(mode).c_str());
  37. }
  38. #endif
  39. // Compile those nice implementation-in-header little libraries
  40. #define NANOSVG_IMPLEMENTATION
  41. #define NANOSVG_ALL_COLOR_KEYWORDS
  42. #include <nanosvg.h>
  43. // Define the global names to indicate this is Cardinal and not VCVRack
  44. namespace rack {
  45. const std::string APP_NAME = "";
  46. const std::string APP_EDITION = "";
  47. const std::string APP_EDITION_NAME = "Cardinal Audio Plugin";
  48. const std::string APP_VERSION_MAJOR = "2";
  49. const std::string APP_VERSION = "v0.0.1";
  50. #if defined(ARCH_WIN)
  51. const std::string APP_ARCH = "win";
  52. #elif defined(ARCH_MAC)
  53. const std::string APP_ARCH = "mac";
  54. #else
  55. const std::string APP_ARCH = "lin";
  56. #endif
  57. const std::string API_URL = "";
  58. Exception::Exception(const char* format, ...)
  59. {
  60. va_list args;
  61. va_start(args, format);
  62. msg = string::fV(format, args);
  63. va_end(args);
  64. }
  65. }
  66. // Define the stuff needed for VCVRack but unused for Cardinal
  67. #include <library.hpp>
  68. #include <network.hpp>
  69. namespace rack {
  70. namespace library {
  71. std::string appChangelogUrl;
  72. std::string appDownloadUrl;
  73. std::string appVersion;
  74. std::string loginStatus;
  75. std::map<std::string, UpdateInfo> updateInfos;
  76. std::string updateStatus;
  77. std::string updateSlug;
  78. float updateProgress = 0.f;
  79. bool isSyncing = false;
  80. bool restartRequested = false;
  81. void checkAppUpdate() {}
  82. void checkUpdates() {}
  83. bool hasUpdates() { return false; }
  84. bool isAppUpdateAvailable() { return false; }
  85. bool isLoggedIn() { return false; }
  86. void logIn(const std::string&, const std::string&) {}
  87. void logOut() {}
  88. void syncUpdate(const std::string&) {}
  89. void syncUpdates() {}
  90. }
  91. namespace network {
  92. std::string encodeUrl(const std::string&) { return {}; }
  93. json_t* requestJson(Method, const std::string&, json_t*, const CookieMap&) { return nullptr; }
  94. bool requestDownload(const std::string&, const std::string&, float*, const CookieMap&) { return false; }
  95. }
  96. }