[sparticle] 2d hud particles (#849)

* wip, taking a break to work on asm stuff first

* the goal code for sparticle

* mips2c the first sparticle asm function

* temp

* particle processing no longer crashing

* temp

* working texture cache for vi1 and hud textures

* sprites

* cleanup 1

* temp

* temp

* add zstd library

* temp

* working

* tests

* include fix

* uncomment

* better decomp of sparticle stuff, part 1

* update references
This commit is contained in:
water111
2021-09-26 11:41:58 -04:00
committed by GitHub
parent d777337095
commit f0ceea8b2e
158 changed files with 19773 additions and 44989 deletions
+11 -3
View File
@@ -6,12 +6,16 @@
#include "common/util/assert.h"
namespace compression {
/*!
* Compress data with zstd. There is an 8-byte header containing the decompressed data's size.
*/
std::vector<u8> compress_zstd(const void* data, size_t size) {
auto max_compressed = ZSTD_compressBound(size);
std::vector<u8> result(sizeof(size_t) + max_compressed);
memcpy(result.data(), &size, sizeof(size_t));
auto compressed_size = ZSTD_compress(result.data() + sizeof(size_t), max_compressed, data, size,
ZSTD_CLEVEL_DEFAULT);
auto compressed_size =
ZSTD_compress(result.data() + sizeof(size_t), max_compressed, data, size, 1);
if (ZSTD_isError(compressed_size)) {
printf("ZSTD error: %s\n", ZSTD_getErrorName(compressed_size));
assert(false);
@@ -20,6 +24,10 @@ std::vector<u8> compress_zstd(const void* data, size_t size) {
return result;
}
/*!
* Decompress data with zstd. The first 8-bytes of the data should be a header containing the
* decompressed data's size.
*/
std::vector<u8> decompress_zstd(const void* data, size_t size) {
assert(size >= sizeof(size_t));
size_t decompressed_size;
@@ -37,4 +45,4 @@ std::vector<u8> decompress_zstd(const void* data, size_t size) {
assert(decomp_size == decompressed_size);
return result;
}
} // namespace compression
} // namespace compression