CodeSign tool updated to version 1.0.1 (2022-06-27).
[LameXP.git] / src / Tools.h
blob7518e82350e216ecbe39f32b7987365c4c577a71
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2022 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU GENERAL PUBLIC LICENSE as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version; always including the non-optional
9 // LAMEXP GNU GENERAL PUBLIC LICENSE ADDENDUM. See "License.txt" file!
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this program; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 // http://www.gnu.org/licenses/gpl-2.0.txt
21 ///////////////////////////////////////////////////////////////////////////////
23 #include <stdlib.h>
25 #ifndef LAMEXP_INC_TOOLS
26 #error Please do *not* include TOOLS.H directly!
27 #endif
29 ////////////////////////////////////////////////////////////
30 // CPU FLags
31 ////////////////////////////////////////////////////////////
33 /* CPU_TYPE_<ARCH>_<TYPE> */
34 #define CPU_TYPE_X86_GEN 0x00000001UL //x86, generic
35 #define CPU_TYPE_X86_SSE 0x00000002UL //x86, with SSE and SSE2 support - Intel only!
36 #define CPU_TYPE_X86_AVX 0x00000004UL //x86, with AVX support
37 #define CPU_TYPE_X64_GEN 0x00000008UL //x64, generic
38 #define CPU_TYPE_X64_SSE 0x00000010UL //x64, with SSE and SSE2 support - Intel only!
39 #define CPU_TYPE_X64_AVX 0x00000020UL //x64, with AVX support
41 /* combined CPU types */
42 #define CPU_TYPE_X86_NVX (CPU_TYPE_X86_GEN|CPU_TYPE_X86_SSE)
43 #define CPU_TYPE_X86_SSX (CPU_TYPE_X86_SSE|CPU_TYPE_X86_AVX)
44 #define CPU_TYPE_X86_ALL (CPU_TYPE_X86_GEN|CPU_TYPE_X86_SSX)
45 #define CPU_TYPE_X64_NVX (CPU_TYPE_X64_GEN|CPU_TYPE_X64_SSE)
46 #define CPU_TYPE_X64_SSX (CPU_TYPE_X64_SSE|CPU_TYPE_X64_AVX)
47 #define CPU_TYPE_X64_ALL (CPU_TYPE_X64_GEN|CPU_TYPE_X64_SSX)
48 #define CPU_TYPE_ALL_GEN (CPU_TYPE_X86_GEN|CPU_TYPE_X64_GEN)
49 #define CPU_TYPE_ALL_SSE (CPU_TYPE_X86_SSE|CPU_TYPE_X64_SSE)
50 #define CPU_TYPE_ALL_SSX (CPU_TYPE_X86_SSX|CPU_TYPE_X64_SSX)
51 #define CPU_TYPE_ALL_AVX (CPU_TYPE_X86_AVX|CPU_TYPE_X64_AVX)
52 #define CPU_TYPE_ALL_ALL (CPU_TYPE_X86_ALL|CPU_TYPE_X64_ALL)
54 ////////////////////////////////////////////////////////////
55 // TOOLS
56 ////////////////////////////////////////////////////////////
58 static const struct
60         const char *pcHash;
61         const unsigned int uiCpuType;
62         const char *pcName;
63         const unsigned int uiVersion;
64         const char *pcVersTag;
66 g_lamexp_tools[] =
68         {"4870d7abbc3995dc5ca82147ee33f28c3ee7dc1986fbb0131912effe10c1a209d3f983c5dffd963c31707a5ce39611b4", CPU_TYPE_X86_GEN, "aften.i686.exe", 8, ""},
69         {"fc4e38b11a0f52b68cca79aa2d71c02180b70eb0e592923dee4f0ccf766f1006642369b2178f6a61d1c2506446cc442d", CPU_TYPE_X86_SSX, "aften.sse2.exe", 8, ""},
70         {"b44b1c0e1a8f4633c9bc2e43d0a83ea5edc890e1cccc0054c812d0e64170e5292dc1dfd7430da61b73150831aa16e9c4", CPU_TYPE_X64_ALL, "aften.x64.exe",  8, ""},
71         {"4558728999a05f12fe88566e8308cba0ada200814c2a1bfe2507f49faf8f3994b0d52a829148f5c6321d24faa2718439", CPU_TYPE_ALL_ALL, "avs2wav.exe", 13, ""},
72         {"dfdb768f7520a1b5488f42440efd2d572a758b20acbd08beb9111f147b628ea8c338c96b6307e423ad4b4437b62c2194", CPU_TYPE_ALL_ALL, "curl.exe", 7831, ""},
73         {"c7ffad9dad1bb55cf29fb4d127e57408783a4bac08eec8e74c7d0776ddf52b6ef22d868f14319d84e7ba3975ce4904da", CPU_TYPE_ALL_ALL, "curl.crt", 7831, ""},
74         {"07834b1b8ecac2f3db79ad048005eca3a284cb759e15d399eb1a560a403122e20db5f08e60319759b8463aeef2410d02", CPU_TYPE_ALL_ALL, "dcaenc.exe", 20120419, ""},
75         {"5c4a5cdd708b5857bcb064558be81a2dfb16401e796b296f6eee7c63042acbeae12e1e2f1f3d0fd096eaf73201b54e10", CPU_TYPE_ALL_GEN, "faad.i686.exe", 270, "" },
76         {"72447794cf411e1e4ce71facf5f60023f001d203894cf40185a0ee13e144e93d72ac99f2ed30a9168450ce5bf882f99f", CPU_TYPE_ALL_SSX, "faad.sse2.exe", 270, "" },
77         {"488c59c426ad386ea1e025dcaa8031d07cdc3a07b6c88d965daddb8360c80d5d35c745f245ca805cc78509ad1f05317a", CPU_TYPE_X86_GEN, "flac.x86-i686.exe", 132, ""},
78         {"a51ab90f0a4748d1d1fd738ef168b0ad0a65be5af726fdfecc94392d74bd87185f9340b9643ce59352322c3477e7b9e6", CPU_TYPE_X86_SSX, "flac.x86-sse2.exe", 132, ""},
79         {"dfe577ab7265c4f62c097024ace4a45d1b35ee6a458c68e830a7e63b3020198f161e0deabe2605820f49575bd4724d53", CPU_TYPE_X64_NVX, "flac.x64-sse2.exe", 132, ""},
80         {"84554229476537d06f2aafc0ca8153eb971b7f44c67f0ca9474e557b795f0cd055b9dd9af6a72d0dd37c45d952b0b479", CPU_TYPE_X64_AVX, "flac.x64-avx.exe",  132, ""},
81         {"657320078375a5392e2f9351f2b375b5b3fd9c7ab5e00d0d1f00e58af2405f9f9278078b17959f1d547d4c1b816b0b67", CPU_TYPE_X86_GEN, "lame.x86-i686.exe", 31001, "SVN"},
82         {"d26a917f5cd1b29bb10810d85e4f979e3fd58d9c4957990badd35a57bc6936b02d78c0096094e7906c8288f66b79bb8b", CPU_TYPE_X86_SSX, "lame.x86-sse2.exe", 31001, "SVN"},
83         {"b76d98075dac1a18675d837aea4051a9a71406af4636a41f0a8923beaf0d299de3ad51a6d80275a878849a63de16e90a", CPU_TYPE_X64_NVX, "lame.x64-sse2.exe", 31001, "SVN" },
84         {"31c4374e174bbf25b4429eabf22f570a841ce63796ce8321ea02af9620ce599cf9f92276224acc8f9375cdcaae846c8c", CPU_TYPE_X64_AVX, "lame.x64-avx.exe",  31001, "SVN" },
85         {"a3c47ae29d53ca312a55de1496e01b4c68c49c75383bc33f895075395aec75530b13436cfebbd01b321c08b8ce81eabb", CPU_TYPE_X86_GEN, "mac.x86-i686.exe", 629, ""},
86         {"fb9cb0cb352b3b6032bb1294cb1da0f6bfd08b4fc23140a2507c53ff84772c580c6cc98266bb2ab15cbec1487f9e6714", CPU_TYPE_X86_SSX, "mac.x86-sse2.exe", 629, ""},
87         {"10ca816bdbff8611aed072e9e54fc1caabb283d927d13f781a57c8ee6727ba59d383e3b740abac095b3f77ff8a31e95a", CPU_TYPE_X64_NVX, "mac.x64-sse2.exe", 629, ""},
88         {"6f9ca8c65c3ffd4088b54a430167bea8b094c7991e74fc5cba7e5ccc58512e113b68a179fe13d787b867b3a14f3ee12e", CPU_TYPE_X64_AVX, "mac.x64-avx.exe",  629, ""},
89         {"bb098b3ee16908f75f324a621db052ce875df83cb221a4afd59e620d099099c267cbfc31d8f09b14789a536d9ccc617f", CPU_TYPE_X86_GEN, "mediainfo.i686.exe", 22030, ""},
90         {"8967bf31723fbde20996048bf253844b87870456c670724c5e0b0522a562e550f11ed6c897698282221eb60c7a7a38eb", CPU_TYPE_X86_SSX, "mediainfo.sse2.exe", 22030, ""},
91         {"0e893cda0f6875e1d3da92d777e803e65c756e002c8e045fbdca2ba5bdb7dc6993c391f30fa26d1b25e19219829ea298", CPU_TYPE_X64_ALL, "mediainfo.x64.exe",  22030, ""},
92         {"7e6346a057634ff07b2e1f427035324f7f02100cc996425990f87f71d767fce4c7b101588c7d944ba49cb2d7e51c9bdb", CPU_TYPE_ALL_ALL, "mpcdec.exe", 475, ""},
93         {"c11107e563cf8131da2574cfb93c2661e343d615c17e3cdc95db130052e44fb2e188e1712f74c2eaac7ca42276398aa4", CPU_TYPE_X86_GEN, "mpg123.x86-i686.exe", 12604, ""},
94         {"5847e83260552544c70e693e394dcf1928863350cf4bc6b3752728cda70ebec6f13db6bc8a3914a780bc283207fe4ba7", CPU_TYPE_X86_SSX, "mpg123.x86-sse2.exe", 12604, ""},
95         {"5462b0cbca43cbc35c6ff31abf806397376ba35b2dfd12f3cbad4d7cbf481c9043cf2a0ac01f012d52e6014522e0a18d", CPU_TYPE_X64_NVX, "mpg123.x64-sse2.exe", 12604, ""},
96         {"5572a331a8e0ee173369971c4e89720f631ce8b9beaa8bbb1758f258929074bb021b9ca5a4faa34667b8bb1bad7d07be", CPU_TYPE_X64_AVX, "mpg123.x64-avx.exe",  12604, ""},
97         {"8e9b65f4bee39deceb303e5fdfe6875872fe450e29151ef3546128e7133a8eb3d14daae446e0c17c56ad3b969294367c", CPU_TYPE_ALL_GEN, "oggdec.i686.exe", 1101, ""},
98         {"5fb1d7781de9449eed958a175305a9827b158f69cd83131da6b92cd78ee7ea3dcc47ed6b3ee58e2892fe6cf98a994730", CPU_TYPE_ALL_SSE, "oggdec.sse2.exe", 1101, ""},
99         {"1f1f52553703afc11a428a4d5c9211f91cf9d39019ade3e049478e5a853b9a8c0a0d11304a04feb3a37cac6904244bab", CPU_TYPE_ALL_AVX, "oggdec.avx.exe",  1101, ""},
100         {"5acb313abc310299987734edc9aa2290c24692284a79cdcac3ec85900284c80297c2a0b95c1f8ac01790dd181fb221db", CPU_TYPE_X86_GEN, "oggenc2.i686.exe", 288137603, "2018"},
101         {"e0e91f07a427632a6fe2eed697a50311bf658cb61cb0f26eacf4b64487dac54022ab429587221a0375b6e3486f0e0bd1", CPU_TYPE_X86_SSX, "oggenc2.sse2.exe", 288137603, "2018"},
102         {"3630078654f0ed43579d0eb11dba7752892afc361864d1620bcc49f233384c221827bbe88644f4a5b5aceeac4da7fe6c", CPU_TYPE_X64_ALL, "oggenc2.x64.exe",  288137603, "2018"},
103         {"29494a82b09248e7f3d988c659fc16f0559c35f0ec4e55fd54dda87ffa172da0993cc58a7d112dc91e7feea360693cda", CPU_TYPE_ALL_GEN, "opusdec.i686.exe", 20190421, "v1.3.1"},
104         {"aa5b532b58a0d84221627985edb06ad2dd12926e5514c27ee8bb6f508b5578ad63b08bee546b67199df0581f64f25e48", CPU_TYPE_ALL_SSE, "opusdec.sse2.exe", 20190421, "v1.3.1"},
105         {"a32d191ac43dc0f3e527daf34201bd93a38fa34727d5aae12716ea248fa55a8b6932b33d12b03a68aaa7972950511406", CPU_TYPE_ALL_AVX, "opusdec.avx.exe",  20190421, "v1.3.1"},
106         {"71a913bb3e2a0259f2badcac74447d5839d405ff85e31d0369e7a19119b64743b87c90851fb69d4c740bef478b04ece9", CPU_TYPE_ALL_GEN, "opusenc.i686.exe", 20190421, "v1.3.1"},
107         {"90f9bb8ebbf4a26fb2a9af7640b596253e16cb20013472886347c0ceeb3b7c03ee60781287eb0d496ccad34db77e7d06", CPU_TYPE_ALL_SSE, "opusenc.sse2.exe", 20190421, "v1.3.1"},
108         {"1e7a920786b02431924d6d0e1ae8ee748595a43c83947926d58ed026cc58157a093a6be56932b61c2249796953587995", CPU_TYPE_ALL_AVX, "opusenc.avx.exe",  20190421, "v1.3.1"},
109         {"155b123845f797226d03c44d649de810b13001b70e55e3775559ee78b75c38c9284475d217a86752820cfe1c22f37f69", CPU_TYPE_X86_GEN, "refalac.i686.exe", 164, ""},
110         {"2bdb8a6e4ad05669623173101ccc9287b9d8b6bb5b2062abaadda3e3cceda7040478ef2b404348b52e2232307f8c8f7c", CPU_TYPE_X86_SSX, "refalac.sse2.exe", 164, ""},
111         {"3abae08b7be8d7e054bf48b7a7cbb874955a774dc2db69503490d59daf74db8adfa702401eeace6536810b0ac15dea84", CPU_TYPE_X64_ALL, "refalac.x64.exe",  164, ""},
112         {"d041b60de6c5c6e77cbad84440db57bbeb021af59dd0f7bebd3ede047d9e2ddc2a0c14179472687ba91063743d23e337", CPU_TYPE_ALL_ALL, "shorten.exe", 361, ""},
113         {"3206ebd1b1c6e5db422d7a84117a7ba8256208fc7104a6668d8856c1b6407882f25f1f39e37c8e33affb343300937d2e", CPU_TYPE_ALL_GEN, "sox.i686.exe", 1442, ""},
114         {"16a71940aa5e9b393e83cdfb2a4dda4291ea01858f8ba338510013f25f4d7c53b9b5cffb86404ea49ef28e6795182fd5", CPU_TYPE_ALL_SSE, "sox.sse2.exe", 1442, "" },
115         {"25585ca9e2e025d82d93341a9db8527eb0b4ce451dade607f9784a79ed30e050ced0824835d5467aa0bf0c6b8fe08612", CPU_TYPE_ALL_AVX, "sox.avx.exe",  1442, "" },
116         {"5a4261e1b41a59d1a5bc92e1d2766422a67454d77e06ea29af392811b7b4704e0f3e494ab9cb6375ce9e39257867c5ed", CPU_TYPE_ALL_ALL, "speexdec.exe", 12, ""},
117         {"a83628880da0b7519ec368a74a92da5a5099d8d46aa0583131f92d7321f47c9e16a1841b2a3fb8ffcca7205ef4b1bb0a", CPU_TYPE_ALL_ALL, "tta.exe", 21, ""},
118         {"9e1ade2137ea5cee0ad4657971c314a372df3068594fbe4f77d45b9eb65fa7c69e55027b0df81b6fe072a220e9a8ba8a", CPU_TYPE_ALL_ALL, "valdec.exe", 100, "a"},
119         {"8aed6610e574aaac0673d0801db987b6533a8a4ba468a328d2a3f457e18ac5cff4bd6aef7be40316cf55c6930995babf", CPU_TYPE_ALL_ALL, "verify.exe", 1010, ""},
120         {"572b9448bf4a338ecb9727951fdfcc5a219cc69896695cc96b9f6b083690e339910e41558968264a38992e45f2be152c", CPU_TYPE_ALL_ALL, "wma2wav.exe", 20111001, ""},
121         {"5ef85aa6c6521161e19fc9eadd30bac82c3d0eee2374fd6ac543022181f7846ec2198ebe8bc84667e9b92a4a85d07fbb", CPU_TYPE_ALL_ALL, "wupdate.exe", 20171002, ""},
122         {"6021b938769b09d05617c7e91e0cb6cc5f9e40c50cb470455afc21d466b37183b8675822b8797cbf98950a5262ec07a6", CPU_TYPE_X86_GEN, "wvunpack.x86-i686.exe", 5010, ""},
123         {"fa322e127679ac6b5e833e120b590480b3ffc7ffa875705c04ed698f155dc23b40c8922d2f5f78ad1cc9342306289141", CPU_TYPE_X86_SSX, "wvunpack.x86-sse2.exe", 5010, ""},
124         {"d4ca3085aae70160beab778a46a27643f1415bd803ddfecb2791fe964e4bff49ac5a891ef1852f26e867c42ddd6f8806", CPU_TYPE_X64_NVX, "wvunpack.x64-sse2.exe", 5010, ""},
125         {"e2c32a765cbec41cc6e662447a1d70d8261753f2c93aca666bafddcc420c4eaee550d3c730123a84565cf43fffa26c35", CPU_TYPE_X64_AVX, "wvunpack.x64-avx.exe",  5010, ""},
126         {NULL, NULL, NULL, NULL, NULL}
129 ////////////////////////////////////////////////////////////
130 // AAC ENCODERS
131 ////////////////////////////////////////////////////////////
133 typedef struct
135         const char *const toolName;
136         const char *const fileNames[5];
137         const char *const checkArgs;
138         const quint32     toolMinVersion;
139         const quint32     verDigits;
140         const quint32     verShift;
141         const char *const verStr;
142         const char *const regExpVer;
143         const char *const regExpSig;
144         const char *const regExpLib[3];
146 aac_encoder_t;
148 static const aac_encoder_t g_lamexp_aacenc[] =
150         { 
151                 "NeroAAC",
152                 { "neroAacEnc.exe", "neroAacDec.exe", "neroAacTag.exe", NULL },
153                 "-help",
154                 lamexp_toolver_neroaac(), 4, 10, "v?.?.?.?",
155                 "Package\\s+version:\\s+(\\d)\\.(\\d)\\.(\\d)\\.(\\d)",
156                 "Nero\\s+AAC\\s+Encoder",
157                 { NULL }
158         },
159         {
160                 "FhgAacEnc",
161                 { "fhgaacenc.exe",  "enc_fhgaac.dll", "nsutil.dll", "libmp4v2.dll", NULL },
162                 NULL,
163                 lamexp_toolver_fhgaacenc(), 2, 0, "????-??-??",
164                 "fhgaacenc version (\\d+) by tmkk. Modified by Case (\\d+).",
165                 NULL,
166                 { NULL }
167         },
168         { 
169                 "FdkAacEnc",
170                 { "fdkaac.exe", NULL },
171                 "--help",
172                 lamexp_toolver_fdkaacenc(), 3, 10, "v?.?.?",
173                 "fdkaac\\s+(\\d)\\.(\\d)\\.(\\d)",
174                 NULL,
175                 { NULL }
176         },
177         {
178                 "QAAC",
179                 { "qaac.exe", "libsoxr.dll", "libsoxconvolver.dll", NULL },
180                 "--check",
181                 lamexp_toolver_qaacenc(), 2, 100, "v?.??",
182                 "qaac (\\d)\\.(\\d+)",
183                 NULL,
184                 { "libsoxr-\\d+\\.\\d+\\.\\d+", "libsoxconvolver\\s+\\d+\\.\\d+\\.\\d+" }
185         },
186         {
187                 "QAACx64",
188                 { "qaac64.exe", "libsoxr64.dll", "libsoxconvolver64.dll", NULL },
189                 "--check",
190                 lamexp_toolver_qaacenc(), 2, 100, "v?.??",
191                 "qaac (\\d)\\.(\\d+)",
192                 NULL,
193                 { "libsoxr-\\d+\\.\\d+\\.\\d+", "libsoxconvolver\\s+\\d+\\.\\d+\\.\\d+" }
194         },
195         { NULL, { NULL }, NULL, 0, 0, 0, NULL, NULL, NULL, { NULL } }