diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-01 09:45:55 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-01 09:45:55 -0500 |
commit | e37026ea3b9d7b121aeb1fd38fe81ab82a1e2e33 (patch) | |
tree | 38649502277f73c28c50815209318460b522306f | |
parent | 7b35a18c93511482b644e6a0ed1dbd9de11eff07 (diff) | |
download | tanetane-e37026ea3b9d7b121aeb1fd38fe81ab82a1e2e33.tar.gz tanetane-e37026ea3b9d7b121aeb1fd38fe81ab82a1e2e33.tar.bz2 tanetane-e37026ea3b9d7b121aeb1fd38fe81ab82a1e2e33.zip |
Fixed bug in LZ77 algo
-rw-r--r-- | tools/sprite_dumper/common.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/sprite_dumper/common.h b/tools/sprite_dumper/common.h index 2aca4fa..d9fb5da 100644 --- a/tools/sprite_dumper/common.h +++ b/tools/sprite_dumper/common.h | |||
@@ -78,8 +78,11 @@ public: | |||
78 | int n = ((t >> 12) & 0xF) + 3; // num of bytes to copy | 78 | int n = ((t >> 12) & 0xF) + 3; // num of bytes to copy |
79 | int o = (t & 0xFFF); | 79 | int o = (t & 0xFFF); |
80 | 80 | ||
81 | memcpy(result.data() + bPos, result.data() + bPos - o - 1, n); | 81 | for (int j=0; j<n; j++) { |
82 | bPos += n; | 82 | if (bPos >= length) break; |
83 | result[bPos] = result[bPos - o - 1]; | ||
84 | bPos++; | ||
85 | } | ||
83 | break; | 86 | break; |
84 | } | 87 | } |
85 | default: break; | 88 | default: break; |