From 5946464fc98b769ba8fa2a46e668fb4ea2762179 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 10 Jan 2022 10:50:36 +0000 Subject: [PATCH] Some little hacks to ensure proper mingw print format is used Signed-off-by: falkTX --- deps/PawPaw | 2 +- dpf | 2 +- include/common.hpp | 6 ++++++ plugins/Cardinal/src/Ildaeil.cpp | 22 +++++++++++----------- plugins/Makefile | 4 ++++ 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/deps/PawPaw b/deps/PawPaw index 02ff3c6..3ce181e 160000 --- a/deps/PawPaw +++ b/deps/PawPaw @@ -1 +1 @@ -Subproject commit 02ff3c65f53a8997a2c313e17afdc491c6575f61 +Subproject commit 3ce181e48506ef6d14b6e256af98801e58119415 diff --git a/dpf b/dpf index 5d7fd17..ad2b5b3 160000 --- a/dpf +++ b/dpf @@ -1 +1 @@ -Subproject commit 5d7fd17f6a634ccd648a264743319c145928a27c +Subproject commit ad2b5b3d6e604dede370722ab04d89e2acaeb2fa diff --git a/include/common.hpp b/include/common.hpp index 277cb38..8593494 100644 --- a/include/common.hpp +++ b/include/common.hpp @@ -22,6 +22,12 @@ # define PRIVATE_WAS_DEFINED #endif +// use mingw print format +#if defined(ARCH_WIN) && !defined(SKIP_MINGW_FORMAT) +# include +# define format(f,a,b) format(__MINGW_PRINTF_FORMAT,a,b) +#endif + #include_next "common.hpp" // Make binary resources work the same no matter the OS diff --git a/plugins/Cardinal/src/Ildaeil.cpp b/plugins/Cardinal/src/Ildaeil.cpp index 53bf395..376102a 100644 --- a/plugins/Cardinal/src/Ildaeil.cpp +++ b/plugins/Cardinal/src/Ildaeil.cpp @@ -660,13 +660,13 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread { uint parameterCount; struct Parameter { char* name; - char* format; + char* printformat; uint32_t rindex; bool boolean, bvalue, log, readonly; float min, max, power; Parameter() : name(nullptr), - format(nullptr), + printformat(nullptr), rindex(0), boolean(false), bvalue(false), @@ -677,7 +677,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread { ~Parameter() { std::free(name); - std::free(format); + std::free(printformat); } }* parameters; float* values; @@ -901,18 +901,18 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread { const CarlaParameterInfo* const pinfo = carla_get_parameter_info(handle, 0, i); const ::ParameterRanges* const pranges = carla_get_parameter_ranges(handle, 0, i); - String format; + String printformat; if (pdata->hints & PARAMETER_IS_INTEGER) - format = "%.0f "; + printformat = "%.0f "; else - format = "%.3f "; + printformat = "%.3f "; - format += pinfo->unit; + printformat += pinfo->unit; PluginGenericUI::Parameter& param(ui->parameters[j]); param.name = strdup(pinfo->name); - param.format = format.getAndReleaseBuffer(); + param.printformat = printformat.getAndReleaseBuffer(); param.rindex = i; param.boolean = pdata->hints & PARAMETER_IS_BOOLEAN; param.log = pdata->hints & PARAMETER_IS_LOGARITHMIC; @@ -1383,7 +1383,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread { if (param.readonly) { ImGui::BeginDisabled(); - ImGui::SliderFloat(param.name, &ui->values[i], param.min, param.max, param.format, ImGuiSliderFlags_NoInput); + ImGui::SliderFloat(param.name, &ui->values[i], param.min, param.max, param.printformat, ImGuiSliderFlags_NoInput); ImGui::EndDisabled(); continue; } @@ -1406,8 +1406,8 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread { else { const bool ret = param.log - ? ImGui::SliderFloat(param.name, &ui->values[i], param.min, param.max, param.format, 2.0f) - : ImGui::SliderFloat(param.name, &ui->values[i], param.min, param.max, param.format); + ? ImGui::SliderFloat(param.name, &ui->values[i], param.min, param.max, param.printformat, 2.0f) + : ImGui::SliderFloat(param.name, &ui->values[i], param.min, param.max, param.printformat); if (ret) { if (ImGui::IsItemActivated()) diff --git a/plugins/Makefile b/plugins/Makefile index 22cbe05..4017d82 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -973,6 +973,7 @@ $(BUILD_DIR)/Bidoo/%.cpp.o: Bidoo/%.cpp $(foreach m,$(BIDOO_CUSTOM),$(call custom_module_names,$(m),Bidoo)) \ $(foreach m,$(BIDOO_CUSTOM_PER_FILE),$(call custom_per_file_names,$(m),Bidoo_$(shell basename $*))) \ -DpluginInstance=pluginInstance__Bidoo \ + -DSKIP_MINGW_FORMAT \ -IBidoo/src/dep/gverb/include \ -Wno-ignored-qualifiers \ -Wno-sign-compare \ @@ -986,6 +987,7 @@ $(BUILD_DIR)/BogaudioModules/src/follower_base.cpp.o: BogaudioModules/src/follow -DpluginInstance=pluginInstance__BogaudioModules \ -DefGainMaxDecibels=efGainMaxDecibelsDebug \ -DRACK_SIMD=1 \ + -DSKIP_MINGW_FORMAT \ -IBogaudioModules/lib \ -IBogaudioModules/src/dsp @@ -997,6 +999,7 @@ $(BUILD_DIR)/BogaudioModules/%.cpp.o: BogaudioModules/%.cpp $(foreach m,$(BOGAUDIO_CUSTOM_PER_FILE),$(call custom_per_file_names,$(m),Bogaudio_$(shell basename $*))) \ -DpluginInstance=pluginInstance__BogaudioModules \ -DRACK_SIMD=1 \ + -DSKIP_MINGW_FORMAT \ -IBogaudioModules/lib \ -IBogaudioModules/src/dsp @@ -1015,6 +1018,7 @@ $(BUILD_DIR)/ChowDSP/%.cpp.o: ChowDSP/%.cpp $(foreach m,$(CHOWDSP_CUSTOM),$(call custom_module_names,$(m),ChowDSP)) \ -DpluginInstance=pluginInstance__ChowDSP \ -DUSE_EIGEN \ + -DSKIP_MINGW_FORMAT \ -IChowDSP/lib \ -IChowDSP/lib/chowdsp_utils/DSP/WDF \ -Wno-deprecated-copy