From 0bf9b26b87075448d49482fe4411739af765d872 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Thu, 3 Oct 2024 19:08:44 -0400 Subject: Update codebase Bring up-to-date with my other projects. Wallpaper engine behavior is mostly unchanged. Signed-off-by: Andrew Opalach --- .../packagefiles/janus/compiler_warnings.diff | 40 +++ subprojects/packagefiles/janus/meson.build | 5 + subprojects/packagefiles/janus/wparse.diff | 32 +++ subprojects/packagefiles/lz4/move_meson_build.diff | 26 ++ .../s3tc-dxt-decompression/compiler_warnings.diff | 26 ++ .../explicit_type_sizes.diff | 273 +++++++++++++++++++++ .../s3tc-dxt-decompression/meson.build | 5 + subprojects/packagefiles/stb/meson.build | 2 + 8 files changed, 409 insertions(+) create mode 100644 subprojects/packagefiles/janus/compiler_warnings.diff create mode 100644 subprojects/packagefiles/janus/meson.build create mode 100644 subprojects/packagefiles/janus/wparse.diff create mode 100644 subprojects/packagefiles/lz4/move_meson_build.diff create mode 100644 subprojects/packagefiles/s3tc-dxt-decompression/compiler_warnings.diff create mode 100644 subprojects/packagefiles/s3tc-dxt-decompression/explicit_type_sizes.diff create mode 100644 subprojects/packagefiles/s3tc-dxt-decompression/meson.build create mode 100644 subprojects/packagefiles/stb/meson.build (limited to 'subprojects/packagefiles') diff --git a/subprojects/packagefiles/janus/compiler_warnings.diff b/subprojects/packagefiles/janus/compiler_warnings.diff new file mode 100644 index 0000000..a5f07c1 --- /dev/null +++ b/subprojects/packagefiles/janus/compiler_warnings.diff @@ -0,0 +1,40 @@ +diff --git a/src/janus.cpp b/src/janus.cpp +index d1ee260..d3f4cee 100644 +--- a/src/janus.cpp ++++ b/src/janus.cpp +@@ -21,10 +21,10 @@ using namespace janus; + static int tryStringToInt(string const& arg) { + try { + return stoi(arg); +- } catch (invalid_argument) { ++ } catch (std::invalid_argument const&) { + cerr << "Error: cannot parse '" << arg << "' as an integer.\n"; + exit(1); +- } catch (out_of_range) { ++ } catch (std::out_of_range const&) { + cerr << "Error: " << arg << " is out of range.\n"; + exit(1); + } +@@ -34,11 +34,11 @@ static int tryStringToInt(string const& arg) { + static double tryStringToDouble(string const& arg) { + try { + return stod(arg); +- } catch (invalid_argument) { ++ } catch (std::invalid_argument const&) { + cerr << "Error: cannot parse '" << arg << "' "; + cerr << "as a floating-point value.\n"; + exit(1); +- } catch (out_of_range) { ++ } catch (std::out_of_range const&) { + cerr << "Error: " << arg << " is out of range.\n"; + exit(1); + } +@@ -219,6 +219,8 @@ int ArgParser::lenList(string const& name) { + return options[name]->ints.size(); + case OptionType::Double: + return options[name]->doubles.size(); ++ default: ++ return -1; + } + } + diff --git a/subprojects/packagefiles/janus/meson.build b/subprojects/packagefiles/janus/meson.build new file mode 100644 index 0000000..abbea21 --- /dev/null +++ b/subprojects/packagefiles/janus/meson.build @@ -0,0 +1,5 @@ +project('janus', 'cpp', version: '0.7.0') + +janus_inc = include_directories('./src') +janus_lib = static_library('janus', 'src/janus.cpp', include_directories: janus_inc) +janus = declare_dependency(link_with: janus_lib, include_directories: janus_inc) diff --git a/subprojects/packagefiles/janus/wparse.diff b/subprojects/packagefiles/janus/wparse.diff new file mode 100644 index 0000000..f3034df --- /dev/null +++ b/subprojects/packagefiles/janus/wparse.diff @@ -0,0 +1,32 @@ +diff --git a/src/janus.cpp b/src/janus.cpp +index d1ee260..a303b30 100644 +--- a/src/janus.cpp ++++ b/src/janus.cpp +@@ -534,6 +536,15 @@ void ArgParser::parse(int argc, char **argv) { + parse(stream); + } + ++void ArgParser::wparse(int argc, wchar_t **argv) { ++ ArgStream stream; ++ for (int i = 1; i < argc; i++) { ++ wstring ws(argv[i]); ++ stream.append(string(ws.begin(), ws.end())); ++ } ++ parse(stream); ++} ++ + + // ----------------------------------------------------------------------------- + // ArgParser: utilities. +diff --git a/src/janus.h b/src/janus.h +index 37bd956..a049b72 100644 +--- a/src/janus.h ++++ b/src/janus.h +@@ -46,6 +46,7 @@ namespace janus { + + // Parse command line arguments. + void parse(int argc, char **argv); ++ void wparse(int argc, wchar_t **argv); + + // Returns true if the named option was found while parsing. + bool found(std::string const& name); diff --git a/subprojects/packagefiles/lz4/move_meson_build.diff b/subprojects/packagefiles/lz4/move_meson_build.diff new file mode 100644 index 0000000..9c5841f --- /dev/null +++ b/subprojects/packagefiles/lz4/move_meson_build.diff @@ -0,0 +1,26 @@ +diff --git a/build/meson/meson.build b/meson.build +similarity index 89% +rename from build/meson/meson.build +rename to meson.build +index fc6408a..3d0785a 100644 +--- a/build/meson/meson.build ++++ b/meson.build +@@ -21,11 +21,11 @@ project( + 'warning_level=3' + ], + version: run_command( +- find_program('GetLz4LibraryVersion.py'), +- '../../lib/lz4.h', ++ find_program('build/meson/GetLz4LibraryVersion.py'), ++ 'lib/lz4.h', + check: true + ).stdout().strip(), + meson_version: '>=0.58.0' + ) + +-subdir('meson') ++subdir('build/meson/meson') +diff --git a/build/meson/meson_options.txt b/meson_options.txt +similarity index 100% +rename from build/meson/meson_options.txt +rename to meson_options.txt diff --git a/subprojects/packagefiles/s3tc-dxt-decompression/compiler_warnings.diff b/subprojects/packagefiles/s3tc-dxt-decompression/compiler_warnings.diff new file mode 100644 index 0000000..7d84683 --- /dev/null +++ b/subprojects/packagefiles/s3tc-dxt-decompression/compiler_warnings.diff @@ -0,0 +1,26 @@ +diff --git a/s3tc.cpp b/s3tc.cpp +index f2642fc..66b0029 100644 +--- a/s3tc.cpp ++++ b/s3tc.cpp +@@ -105,8 +105,8 @@ void BlockDecompressImageDXT1(uint32_t width, uint32_t height, const uint8_t *bl + { + uint32_t blockCountX = (width + 3) / 4; + uint32_t blockCountY = (height + 3) / 4; +- uint32_t blockWidth = (width < 4) ? width : 4; +- uint32_t blockHeight = (height < 4) ? height : 4; ++ //uint32_t blockWidth = (width < 4) ? width : 4; ++ //uint32_t blockHeight = (height < 4) ? height : 4; + + for (uint32_t j = 0; j < blockCountY; j++) + { +@@ -236,8 +236,8 @@ void BlockDecompressImageDXT5(uint32_t width, uint32_t height, const uint8_t *bl + { + uint32_t blockCountX = (width + 3) / 4; + uint32_t blockCountY = (height + 3) / 4; +- uint32_t blockWidth = (width < 4) ? width : 4; +- uint32_t blockHeight = (height < 4) ? height : 4; ++ //uint32_t blockWidth = (width < 4) ? width : 4; ++ //uint32_t blockHeight = (height < 4) ? height : 4; + + for (uint32_t j = 0; j < blockCountY; j++) + { diff --git a/subprojects/packagefiles/s3tc-dxt-decompression/explicit_type_sizes.diff b/subprojects/packagefiles/s3tc-dxt-decompression/explicit_type_sizes.diff new file mode 100644 index 0000000..52cdae3 --- /dev/null +++ b/subprojects/packagefiles/s3tc-dxt-decompression/explicit_type_sizes.diff @@ -0,0 +1,273 @@ +diff --git a/s3tc.cpp b/s3tc.cpp +index a5618c0..f2642fc 100644 +--- a/s3tc.cpp ++++ b/s3tc.cpp +@@ -1,53 +1,55 @@ +-// unsigned long PackRGBA(): Helper method that packs RGBA channels into a single 4 byte pixel. ++#include "s3tc.h" ++ ++// uint32_t PackRGBA(): Helper method that packs RGBA channels into a single 4 byte pixel. + // +-// unsigned char r: red channel. +-// unsigned char g: green channel. +-// unsigned char b: blue channel. +-// unsigned char a: alpha channel. ++// uint8_t r: red channel. ++// uint8_t g: green channel. ++// uint8_t b: blue channel. ++// uint8_t a: alpha channel. + +-unsigned long PackRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a) ++uint32_t PackRGBA(uint8_t r, uint8_t g, uint8_t b, uint8_t a) + { + return ((r << 24) | (g << 16) | (b << 8) | a); + } + + // void DecompressBlockDXT1(): Decompresses one block of a DXT1 texture and stores the resulting pixels at the appropriate offset in 'image'. + // +-// unsigned long x: x-coordinate of the first pixel in the block. +-// unsigned long y: y-coordinate of the first pixel in the block. +-// unsigned long width: width of the texture being decompressed. +-// unsigned long height: height of the texture being decompressed. +-// const unsigned char *blockStorage: pointer to the block to decompress. +-// unsigned long *image: pointer to image where the decompressed pixel data should be stored. +- +-void DecompressBlockDXT1(unsigned long x, unsigned long y, unsigned long width, const unsigned char *blockStorage, unsigned long *image) ++// uint32_t x: x-coordinate of the first pixel in the block. ++// uint32_t y: y-coordinate of the first pixel in the block. ++// uint32_t width: width of the texture being decompressed. ++// uint32_t height: height of the texture being decompressed. ++// const uint8_t *blockStorage: pointer to the block to decompress. ++// uint32_t *image: pointer to image where the decompressed pixel data should be stored. ++ ++void DecompressBlockDXT1(uint32_t x, uint32_t y, uint32_t width, const uint8_t *blockStorage, uint32_t *image) + { +- unsigned short color0 = *reinterpret_cast(blockStorage); +- unsigned short color1 = *reinterpret_cast(blockStorage + 2); ++ uint16_t color0 = *reinterpret_cast(blockStorage); ++ uint16_t color1 = *reinterpret_cast(blockStorage + 2); + +- unsigned long temp; ++ uint32_t temp; + + temp = (color0 >> 11) * 255 + 16; +- unsigned char r0 = (unsigned char)((temp/32 + temp)/32); ++ uint8_t r0 = (uint8_t)((temp/32 + temp)/32); + temp = ((color0 & 0x07E0) >> 5) * 255 + 32; +- unsigned char g0 = (unsigned char)((temp/64 + temp)/64); ++ uint8_t g0 = (uint8_t)((temp/64 + temp)/64); + temp = (color0 & 0x001F) * 255 + 16; +- unsigned char b0 = (unsigned char)((temp/32 + temp)/32); ++ uint8_t b0 = (uint8_t)((temp/32 + temp)/32); + + temp = (color1 >> 11) * 255 + 16; +- unsigned char r1 = (unsigned char)((temp/32 + temp)/32); ++ uint8_t r1 = (uint8_t)((temp/32 + temp)/32); + temp = ((color1 & 0x07E0) >> 5) * 255 + 32; +- unsigned char g1 = (unsigned char)((temp/64 + temp)/64); ++ uint8_t g1 = (uint8_t)((temp/64 + temp)/64); + temp = (color1 & 0x001F) * 255 + 16; +- unsigned char b1 = (unsigned char)((temp/32 + temp)/32); ++ uint8_t b1 = (uint8_t)((temp/32 + temp)/32); + +- unsigned long code = *reinterpret_cast(blockStorage + 4); ++ uint32_t code = *reinterpret_cast(blockStorage + 4); + +- for (int j=0; j < 4; j++) ++ for (int32_t j=0; j < 4; j++) + { +- for (int i=0; i < 4; i++) ++ for (int32_t i=0; i < 4; i++) + { +- unsigned long finalColor = 0; +- unsigned char positionCode = (code >> 2*(4*j+i)) & 0x03; ++ uint32_t finalColor = 0; ++ uint8_t positionCode = (code >> 2*(4*j+i)) & 0x03; + + if (color0 > color1) + { +@@ -94,70 +96,70 @@ void DecompressBlockDXT1(unsigned long x, unsigned long y, unsigned long width, + + // void BlockDecompressImageDXT1(): Decompresses all the blocks of a DXT1 compressed texture and stores the resulting pixels in 'image'. + // +-// unsigned long width: Texture width. +-// unsigned long height: Texture height. +-// const unsigned char *blockStorage: pointer to compressed DXT1 blocks. +-// unsigned long *image: pointer to the image where the decompressed pixels will be stored. ++// uint32_t width: Texture width. ++// uint32_t height: Texture height. ++// const uint8_t *blockStorage: pointer to compressed DXT1 blocks. ++// uint32_t *image: pointer to the image where the decompressed pixels will be stored. + +-void BlockDecompressImageDXT1(unsigned long width, unsigned long height, const unsigned char *blockStorage, unsigned long *image) ++void BlockDecompressImageDXT1(uint32_t width, uint32_t height, const uint8_t *blockStorage, uint32_t *image) + { +- unsigned long blockCountX = (width + 3) / 4; +- unsigned long blockCountY = (height + 3) / 4; +- unsigned long blockWidth = (width < 4) ? width : 4; +- unsigned long blockHeight = (height < 4) ? height : 4; ++ uint32_t blockCountX = (width + 3) / 4; ++ uint32_t blockCountY = (height + 3) / 4; ++ uint32_t blockWidth = (width < 4) ? width : 4; ++ uint32_t blockHeight = (height < 4) ? height : 4; + +- for (unsigned long j = 0; j < blockCountY; j++) ++ for (uint32_t j = 0; j < blockCountY; j++) + { +- for (unsigned long i = 0; i < blockCountX; i++) DecompressBlockDXT1(i*4, j*4, width, blockStorage + i * 8, image); ++ for (uint32_t i = 0; i < blockCountX; i++) DecompressBlockDXT1(i*4, j*4, width, blockStorage + i * 8, image); + blockStorage += blockCountX * 8; + } + } + + // void DecompressBlockDXT5(): Decompresses one block of a DXT5 texture and stores the resulting pixels at the appropriate offset in 'image'. + // +-// unsigned long x: x-coordinate of the first pixel in the block. +-// unsigned long y: y-coordinate of the first pixel in the block. +-// unsigned long width: width of the texture being decompressed. +-// unsigned long height: height of the texture being decompressed. +-// const unsigned char *blockStorage: pointer to the block to decompress. +-// unsigned long *image: pointer to image where the decompressed pixel data should be stored. +- +-void DecompressBlockDXT5(unsigned long x, unsigned long y, unsigned long width, const unsigned char *blockStorage, unsigned long *image) ++// uint32_t x: x-coordinate of the first pixel in the block. ++// uint32_t y: y-coordinate of the first pixel in the block. ++// uint32_t width: width of the texture being decompressed. ++// uint32_t height: height of the texture being decompressed. ++// const uint8_t *blockStorage: pointer to the block to decompress. ++// uint32_t *image: pointer to image where the decompressed pixel data should be stored. ++ ++void DecompressBlockDXT5(uint32_t x, uint32_t y, uint32_t width, const uint8_t *blockStorage, uint32_t *image) + { +- unsigned char alpha0 = *reinterpret_cast(blockStorage); +- unsigned char alpha1 = *reinterpret_cast(blockStorage + 1); ++ uint8_t alpha0 = *reinterpret_cast(blockStorage); ++ uint8_t alpha1 = *reinterpret_cast(blockStorage + 1); + +- const unsigned char *bits = blockStorage + 2; +- unsigned long alphaCode1 = bits[2] | (bits[3] << 8) | (bits[4] << 16) | (bits[5] << 24); +- unsigned short alphaCode2 = bits[0] | (bits[1] << 8); ++ const uint8_t *bits = blockStorage + 2; ++ uint32_t alphaCode1 = bits[2] | (bits[3] << 8) | (bits[4] << 16) | (bits[5] << 24); ++ uint16_t alphaCode2 = bits[0] | (bits[1] << 8); + +- unsigned short color0 = *reinterpret_cast(blockStorage + 8); +- unsigned short color1 = *reinterpret_cast(blockStorage + 10); ++ uint16_t color0 = *reinterpret_cast(blockStorage + 8); ++ uint16_t color1 = *reinterpret_cast(blockStorage + 10); + +- unsigned long temp; ++ uint32_t temp; + + temp = (color0 >> 11) * 255 + 16; +- unsigned char r0 = (unsigned char)((temp/32 + temp)/32); ++ uint8_t r0 = (uint8_t)((temp/32 + temp)/32); + temp = ((color0 & 0x07E0) >> 5) * 255 + 32; +- unsigned char g0 = (unsigned char)((temp/64 + temp)/64); ++ uint8_t g0 = (uint8_t)((temp/64 + temp)/64); + temp = (color0 & 0x001F) * 255 + 16; +- unsigned char b0 = (unsigned char)((temp/32 + temp)/32); ++ uint8_t b0 = (uint8_t)((temp/32 + temp)/32); + + temp = (color1 >> 11) * 255 + 16; +- unsigned char r1 = (unsigned char)((temp/32 + temp)/32); ++ uint8_t r1 = (uint8_t)((temp/32 + temp)/32); + temp = ((color1 & 0x07E0) >> 5) * 255 + 32; +- unsigned char g1 = (unsigned char)((temp/64 + temp)/64); ++ uint8_t g1 = (uint8_t)((temp/64 + temp)/64); + temp = (color1 & 0x001F) * 255 + 16; +- unsigned char b1 = (unsigned char)((temp/32 + temp)/32); ++ uint8_t b1 = (uint8_t)((temp/32 + temp)/32); + +- unsigned long code = *reinterpret_cast(blockStorage + 12); ++ uint32_t code = *reinterpret_cast(blockStorage + 12); + +- for (int j=0; j < 4; j++) ++ for (int32_t j=0; j < 4; j++) + { +- for (int i=0; i < 4; i++) ++ for (int32_t i=0; i < 4; i++) + { +- int alphaCodeIndex = 3*(4*j+i); +- int alphaCode; ++ int32_t alphaCodeIndex = 3*(4*j+i); ++ int32_t alphaCode; + + if (alphaCodeIndex <= 12) + { +@@ -172,7 +174,7 @@ void DecompressBlockDXT5(unsigned long x, unsigned long y, unsigned long width, + alphaCode = (alphaCode1 >> (alphaCodeIndex - 16)) & 0x07; + } + +- unsigned char finalAlpha; ++ uint8_t finalAlpha; + if (alphaCode == 0) + { + finalAlpha = alpha0; +@@ -198,9 +200,9 @@ void DecompressBlockDXT5(unsigned long x, unsigned long y, unsigned long width, + } + } + +- unsigned char colorCode = (code >> 2*(4*j+i)) & 0x03; ++ uint8_t colorCode = (code >> 2*(4*j+i)) & 0x03; + +- unsigned long finalColor; ++ uint32_t finalColor; + switch (colorCode) + { + case 0: +@@ -225,21 +227,21 @@ void DecompressBlockDXT5(unsigned long x, unsigned long y, unsigned long width, + + // void BlockDecompressImageDXT5(): Decompresses all the blocks of a DXT5 compressed texture and stores the resulting pixels in 'image'. + // +-// unsigned long width: Texture width. +-// unsigned long height: Texture height. +-// const unsigned char *blockStorage: pointer to compressed DXT5 blocks. +-// unsigned long *image: pointer to the image where the decompressed pixels will be stored. ++// uint32_t width: Texture width. ++// uint32_t height: Texture height. ++// const uint8_t *blockStorage: pointer to compressed DXT5 blocks. ++// uint32_t *image: pointer to the image where the decompressed pixels will be stored. + +-void BlockDecompressImageDXT5(unsigned long width, unsigned long height, const unsigned char *blockStorage, unsigned long *image) ++void BlockDecompressImageDXT5(uint32_t width, uint32_t height, const uint8_t *blockStorage, uint32_t *image) + { +- unsigned long blockCountX = (width + 3) / 4; +- unsigned long blockCountY = (height + 3) / 4; +- unsigned long blockWidth = (width < 4) ? width : 4; +- unsigned long blockHeight = (height < 4) ? height : 4; ++ uint32_t blockCountX = (width + 3) / 4; ++ uint32_t blockCountY = (height + 3) / 4; ++ uint32_t blockWidth = (width < 4) ? width : 4; ++ uint32_t blockHeight = (height < 4) ? height : 4; + +- for (unsigned long j = 0; j < blockCountY; j++) ++ for (uint32_t j = 0; j < blockCountY; j++) + { +- for (unsigned long i = 0; i < blockCountX; i++) DecompressBlockDXT5(i*4, j*4, width, blockStorage + i * 16, image); ++ for (uint32_t i = 0; i < blockCountX; i++) DecompressBlockDXT5(i*4, j*4, width, blockStorage + i * 16, image); + blockStorage += blockCountX * 16; + } + } +diff --git a/s3tc.h b/s3tc.h +index 08a9d05..65d39ba 100644 +--- a/s3tc.h ++++ b/s3tc.h +@@ -1,10 +1,12 @@ + #ifndef S3TC_H + #define S3TC_H + +-unsigned long PackRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); +-void DecompressBlockDXT1(unsigned long x, unsigned long y, unsigned long width, const unsigned char *blockStorage, unsigned long *image); +-void BlockDecompressImageDXT1(unsigned long width, unsigned long height, const unsigned char *blockStorage, unsigned long *image); +-void DecompressBlockDXT5(unsigned long x, unsigned long y, unsigned long width, const unsigned char *blockStorage, unsigned long *image); +-void BlockDecompressImageDXT5(unsigned long width, unsigned long height, const unsigned char *blockStorage, unsigned long *image); ++#include ++ ++uint32_t PackRGBA(uint8_t r, uint8_t g, uint8_t b, uint8_t a); ++void DecompressBlockDXT1(uint32_t x, uint32_t y, uint32_t width, const uint8_t *blockStorage, uint32_t *image); ++void BlockDecompressImageDXT1(uint32_t width, uint32_t height, const uint8_t *blockStorage, uint32_t *image); ++void DecompressBlockDXT5(uint32_t x, uint32_t y, uint32_t width, const uint8_t *blockStorage, uint32_t *image); ++void BlockDecompressImageDXT5(uint32_t width, uint32_t height, const uint8_t *blockStorage, uint32_t *image); + + #endif // S3TC_H diff --git a/subprojects/packagefiles/s3tc-dxt-decompression/meson.build b/subprojects/packagefiles/s3tc-dxt-decompression/meson.build new file mode 100644 index 0000000..cffe15e --- /dev/null +++ b/subprojects/packagefiles/s3tc-dxt-decompression/meson.build @@ -0,0 +1,5 @@ +project('s3tc', 'cpp', version: 'git-17074c2') + +s3tc_inc = include_directories('.') +s3tc_lib = static_library('s3tc', 's3tc.cpp', include_directories: s3tc_inc) +s3tc = declare_dependency(link_with: s3tc_lib, include_directories: s3tc_inc) diff --git a/subprojects/packagefiles/stb/meson.build b/subprojects/packagefiles/stb/meson.build new file mode 100644 index 0000000..e712682 --- /dev/null +++ b/subprojects/packagefiles/stb/meson.build @@ -0,0 +1,2 @@ +project('stb', 'c', version: 'git-31707d1') +stb = declare_dependency(include_directories: include_directories('.')) -- cgit v1.2.3-101-g0448