Add Hyrule Magic Uncompress

This commit is contained in:
scawful
2024-01-29 22:58:53 -05:00
parent 6791fa03e5
commit c90321fa47
2 changed files with 158 additions and 0 deletions

View File

@@ -15,8 +15,29 @@ namespace yaze {
namespace app {
namespace gfx {
const int D_NINTENDO_C_MODE1 = 0;
const int D_NINTENDO_C_MODE2 = 1;
const int D_CMD_COPY = 0;
const int D_CMD_BYTE_REPEAT = 1;
const int D_CMD_WORD_REPEAT = 2;
const int D_CMD_BYTE_INC = 3;
const int D_CMD_COPY_EXISTING = 4;
const int D_MAX_NORMAL_LENGTH = 32;
const int D_MAX_LENGTH = 1024;
const int INITIAL_ALLOC_SIZE = 1024;
namespace lc_lz2 {
absl::StatusOr<Bytes> ZS_Compress(const std::vector<uint8_t>& data,
const int start, const int length,
int mode = 1, bool check = false);
absl::StatusOr<Bytes> ZS_CompressOverworld(const std::vector<uint8_t> data,
const int pos, const int length);
constexpr int kCommandDirectCopy = 0;
constexpr int kCommandByteFill = 1;
constexpr int kCommandWordFill = 2;
@@ -191,9 +212,13 @@ absl::StatusOr<Bytes> CompressV3(const std::vector<uint8_t>& data,
const int start, const int length,
int mode = 1, bool check = false);
// Hyrule Magic
uint8_t* Compress(uint8_t const* const src, int const oldsize, int* const size,
int const flag);
uint8_t* Uncompress(uint8_t const* src, int* const size,
int const p_big_endian);
// Decompression
std::string SetBuffer(const std::vector<uint8_t>& data, int src_pos,