From cad63d8351168d85ee6d5c6081c9d732e85916bc Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 20 Sep 2023 00:24:55 -0500 Subject: [PATCH] is this faster? --- .github/workflows/build.yml | 5 +++++ CMakeLists.txt | 18 ++++++++++++++++++ extern/imgui_patched/imgui.h | 2 ++ src/audio/pa.cpp | 1 - src/audio/sdlAudio.cpp | 1 - src/audio/taAudio.h | 2 +- src/baseutils.h | 2 +- src/engine/config.h | 2 -- src/engine/dispatch.h | 2 +- src/engine/engine.h | 4 ---- src/engine/export.h | 2 +- src/engine/instrument.h | 2 +- src/engine/pattern.h | 2 +- src/engine/platform/c140.cpp | 1 - src/engine/platform/es5506.cpp | 1 - src/engine/platform/qsound.cpp | 1 - src/engine/platform/ymz280b.cpp | 1 - src/engine/song.h | 2 +- src/gui/fileDialog.h | 2 +- src/gui/gui.h | 4 +--- src/gui/plot_nolerp.h | 2 +- src/main.cpp | 2 +- src/pch.cpp | 20 ++++++++++++++++++++ src/pch.h | 29 +++++++++++++++++++++++++++++ src/ta-log.h | 2 +- src/ta-utils.h | 2 +- 26 files changed, 87 insertions(+), 27 deletions(-) create mode 100644 src/pch.cpp create mode 100644 src/pch.h diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 72e870819..47ba22073 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -296,6 +296,11 @@ jobs: rmdir orig rm Furnace-*-Darwin.dmg + if [ -e new/Furnace.app/Contents/Resources/bin/furnace ]; then + rm -v new/Furnace.app/Contents/Resources/bin/furnace + rmdir new/Furnace.app/Contents/Resources/bin + fi + cp -v ../LICENSE new/LICENSE.txt cp -v ../res/releaseReadme/stable-mac.txt new/README cp -v -r ../demos new/demos diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e0e76f9e..c13711c17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -448,6 +448,9 @@ extern/Nuked-PSG/ympsg.c extern/opm/opm.c extern/Nuked-OPLL/opll.c extern/opl/opl3.c + +src/pch.cpp + src/engine/platform/sound/sn76496.cpp src/engine/platform/sound/ay8910.cpp src/engine/platform/sound/saa1099.cpp @@ -965,6 +968,21 @@ if (PKG_CONFIG_FOUND AND (SYSTEM_FMT OR SYSTEM_LIBSNDFILE OR SYSTEM_ZLIB OR SYST endif() endif() +# why 3.16..... why not 3.0? +if (CMAKE_MAJOR_VERSION GREATER_EQUAL 3 AND CMAKE_MINOR_VERSION GREATER_EQUAL 16) + if (BUILD_GUI) + target_precompile_headers(furnace PUBLIC + $<$:${CMAKE_CURRENT_SOURCE_DIR}/src/pch.h> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/extern/imgui_patched/imgui.h> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/extern/imgui_patched/imgui_internal.h> + ) + else() + target_precompile_headers(furnace PUBLIC + $<$:${CMAKE_CURRENT_SOURCE_DIR}/src/pch.h> + ) + endif() +endif() + if (NOT ANDROID OR TERMUX) if (NOT WIN32 AND NOT APPLE) include(GNUInstallDirs) diff --git a/extern/imgui_patched/imgui.h b/extern/imgui_patched/imgui.h index e7966cab4..97a458696 100644 --- a/extern/imgui_patched/imgui.h +++ b/extern/imgui_patched/imgui.h @@ -2550,6 +2550,8 @@ struct ImGuiListClipper // - It is important that we are keeping those disabled by default so they don't leak in user space. // - This is in order to allow user enabling implicit cast operators between ImVec2/ImVec4 and their own types (using IM_VEC2_CLASS_EXTRA in imconfig.h) // - You can use '#define IMGUI_DEFINE_MATH_OPERATORS' to import our operators, provided as a courtesy. +#define IMGUI_DEFINE_MATH_OPERATORS + #ifdef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS_IMPLEMENTED IM_MSVC_RUNTIME_CHECKS_OFF diff --git a/src/audio/pa.cpp b/src/audio/pa.cpp index e2bdfdd8d..3ae960860 100644 --- a/src/audio/pa.cpp +++ b/src/audio/pa.cpp @@ -18,7 +18,6 @@ */ #include -#include #include "../ta-log.h" #include "pa.h" #ifdef _WIN32 diff --git a/src/audio/sdlAudio.cpp b/src/audio/sdlAudio.cpp index ddbe85947..e01f073c8 100644 --- a/src/audio/sdlAudio.cpp +++ b/src/audio/sdlAudio.cpp @@ -18,7 +18,6 @@ */ #include -#include #include "../ta-log.h" #include "sdlAudio.h" diff --git a/src/audio/taAudio.h b/src/audio/taAudio.h index 12de61e95..0b6f530c6 100644 --- a/src/audio/taAudio.h +++ b/src/audio/taAudio.h @@ -22,7 +22,7 @@ #include "../ta-utils.h" #include #include "../fixedQueue.h" -#include +#include "../pch.h" struct SampleRateChangeEvent { double rate; diff --git a/src/baseutils.h b/src/baseutils.h index 0e1b31911..7e3d8e8eb 100644 --- a/src/baseutils.h +++ b/src/baseutils.h @@ -20,7 +20,7 @@ #ifndef _BASEUTILS_H #define _BASEUTILS_H -#include +#include "pch.h" std::string taEncodeBase64(const std::string& data); std::string taDecodeBase64(const char* str); diff --git a/src/engine/config.h b/src/engine/config.h index 12105d696..b9f5e43e1 100644 --- a/src/engine/config.h +++ b/src/engine/config.h @@ -21,8 +21,6 @@ #define _DIVCONFIG_H #include "../ta-utils.h" -#include -#include #include class DivConfig { diff --git a/src/engine/dispatch.h b/src/engine/dispatch.h index 0ad264e53..ecb2ebc6e 100644 --- a/src/engine/dispatch.h +++ b/src/engine/dispatch.h @@ -22,7 +22,7 @@ #include #include -#include +#include "../pch.h" #include "config.h" #include "chipUtils.h" diff --git a/src/engine/engine.h b/src/engine/engine.h index 46b96ac57..1fd054635 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -30,13 +30,9 @@ #include "cmdStream.h" #include "../audio/taAudio.h" #include "blip_buf.h" -#include #include #include #include -#include -#include -#include #include "../fixedQueue.h" class DivWorkPool; diff --git a/src/engine/export.h b/src/engine/export.h index 07354fdb3..3a51ee236 100644 --- a/src/engine/export.h +++ b/src/engine/export.h @@ -22,7 +22,7 @@ #include "song.h" #include -#include +#include "../pch.h" class DivEngine; diff --git a/src/engine/instrument.h b/src/engine/instrument.h index 20172b7b8..a804f87f2 100644 --- a/src/engine/instrument.h +++ b/src/engine/instrument.h @@ -22,7 +22,7 @@ #include "safeWriter.h" #include "dataErrors.h" #include "../ta-utils.h" -#include +#include "../pch.h" struct DivSong; diff --git a/src/engine/pattern.h b/src/engine/pattern.h index 257ce7eca..8bb8fa21e 100644 --- a/src/engine/pattern.h +++ b/src/engine/pattern.h @@ -18,7 +18,7 @@ */ #include "safeReader.h" -#include +#include "../pch.h" struct DivPattern { String name; diff --git a/src/engine/platform/c140.cpp b/src/engine/platform/c140.cpp index 1e77ad35a..30ec91f0d 100644 --- a/src/engine/platform/c140.cpp +++ b/src/engine/platform/c140.cpp @@ -21,7 +21,6 @@ #include "../engine.h" #include "../../ta-log.h" #include -#include #define CHIP_FREQBASE (is219?74448896:12582912) diff --git a/src/engine/platform/es5506.cpp b/src/engine/platform/es5506.cpp index 227917636..b93f0c163 100644 --- a/src/engine/platform/es5506.cpp +++ b/src/engine/platform/es5506.cpp @@ -21,7 +21,6 @@ #include "../engine.h" #include "../../ta-log.h" #include -#include #define PITCH_OFFSET ((double)(16*2048*(chanMax+1))) #define NOTE_ES5506(c,note) (parent->calcBaseFreq(chipClock,chan[c].pcm.freqOffs,note,false)) diff --git a/src/engine/platform/qsound.cpp b/src/engine/platform/qsound.cpp index 5c98990b4..95a455e3f 100644 --- a/src/engine/platform/qsound.cpp +++ b/src/engine/platform/qsound.cpp @@ -21,7 +21,6 @@ #include "../engine.h" #include "../../ta-log.h" #include -#include #define CHIP_DIVIDER (1248*2) #define QS_NOTE_FREQUENCY(x) parent->calcBaseFreq(440,4096,(x)-3,false) diff --git a/src/engine/platform/ymz280b.cpp b/src/engine/platform/ymz280b.cpp index 12f2251da..9a8b45e9d 100644 --- a/src/engine/platform/ymz280b.cpp +++ b/src/engine/platform/ymz280b.cpp @@ -21,7 +21,6 @@ #include "../engine.h" #include "../../ta-log.h" #include -#include #define CHIP_FREQBASE 25165824 diff --git a/src/engine/song.h b/src/engine/song.h index 78c49b4e1..ec316464c 100644 --- a/src/engine/song.h +++ b/src/engine/song.h @@ -20,7 +20,7 @@ #ifndef _SONG_H #define _SONG_H #include -#include +#include "../pch.h" #include "defines.h" #include "../ta-utils.h" diff --git a/src/gui/fileDialog.h b/src/gui/fileDialog.h index 371fa7c21..1a34ca1bc 100644 --- a/src/gui/fileDialog.h +++ b/src/gui/fileDialog.h @@ -1,7 +1,7 @@ #include "../ta-utils.h" #include "imgui.h" #include -#include +#include "../pch.h" #if defined(_WIN64) || defined(__APPLE__) #define USE_NFD diff --git a/src/gui/gui.h b/src/gui/gui.h index c760354b8..bd6b33ce8 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -28,12 +28,10 @@ #include #include #include -#include #include #include -#include #include -#include +#include "../pch.h" #include "fileDialog.h" diff --git a/src/gui/plot_nolerp.h b/src/gui/plot_nolerp.h index 50334dda6..fbc66c1eb 100644 --- a/src/gui/plot_nolerp.h +++ b/src/gui/plot_nolerp.h @@ -18,7 +18,7 @@ */ #include "imgui.h" -#include +#include "../pch.h" void PlotNoLerp(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float)); void PlotBitfield(const char* label, const int* values, int values_count, int values_offset = 0, const char** overlay_text = NULL, int bits = 8, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float), const bool* values_highlight = NULL, ImVec4 highlightColor = ImVec4(1.0f,1.0f,1.0f,1.0f)); diff --git a/src/main.cpp b/src/main.cpp index 87b36f668..7c7c0dd51 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include "pch.h" #ifdef HAVE_SDL2 #include "SDL_events.h" #endif diff --git a/src/pch.cpp b/src/pch.cpp new file mode 100644 index 000000000..b1cd9d3f5 --- /dev/null +++ b/src/pch.cpp @@ -0,0 +1,20 @@ +/** + * Furnace Tracker - multi-system chiptune tracker + * Copyright (C) 2021-2023 tildearrow and contributors + * + * 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 2 of the License, or + * (at your option) 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "pch.h" \ No newline at end of file diff --git a/src/pch.h b/src/pch.h new file mode 100644 index 000000000..37596e14c --- /dev/null +++ b/src/pch.h @@ -0,0 +1,29 @@ +/** + * Furnace Tracker - multi-system chiptune tracker + * Copyright (C) 2021-2023 tildearrow and contributors + * + * 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 2 of the License, or + * (at your option) 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef FUR_PCH_H +#define FUR_PCH_H + +#include +#include +#include +#include +#include + +#endif diff --git a/src/ta-log.h b/src/ta-log.h index d36f5da7d..de93e24a7 100644 --- a/src/ta-log.h +++ b/src/ta-log.h @@ -23,8 +23,8 @@ #include #include #include -#include #include +#include "pch.h" #define LOGLEVEL_ERROR 0 #define LOGLEVEL_WARN 1 diff --git a/src/ta-utils.h b/src/ta-utils.h index 0b81cc853..6b3c201f5 100644 --- a/src/ta-utils.h +++ b/src/ta-utils.h @@ -21,7 +21,7 @@ #define _TA_UTILS_H #include #include -#include +#include "pch.h" #ifdef _MSC_VER #include