summaryrefslogtreecommitdiff
path: root/lib/lzss.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lzss.cpp')
-rw-r--r--lib/lzss.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/lzss.cpp b/lib/lzss.cpp
index d21e465..c63a552 100644
--- a/lib/lzss.cpp
+++ b/lib/lzss.cpp
@@ -40,7 +40,10 @@ RRRRRRRR 11110000 VVVVVVVV
*/
const lzss::scheme_t lzss::schemes[] = {
-/* Nom 1 I J O N 16 P F W Lm1 Ls1 Lm2 Ls2 Jm1 Js1 Jm2 Js2 Fm1 Fs1 Fm2 Fs2 Vm1 Vs1 Vm2 Vs2 */
+/* Nom 1 I J O N 16 P F W Lm1 Ls1 Lm2 Ls2 Jm1 Js1 Jm2 Js2 Fm1 Fs1 Fm2 Fs2 Vm1 Vs1 Vm2 Vs2 Flags*/
+#if 0 /* Zelda GC */
+ {"Yaz0", 0, 1, 1, 0, 0, 0, 0, 0, 0, 0xf0, -4, 0x00, 0, 0x0f, 8, 0xff, 0, 0x00, 0, 0x00, 0, 0x00, 0, 0x00, 0},
+#endif
{"Xenogears", 1, 0, 0, 1, 0, 0, 0, 0, 0, 0x00, 0, 0xf0, -4, 0xff, 0, 0x0f, 8, 0x00, 0, 0x00, 0, 0x00, 0, 0x00, 0},
{"DBZ RPG", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0f, 0, 0x00, 0, 0xf0, -4, 0xff, 4, 0x00, 0, 0x00, 0, 0x00, 0, 0x00, 0},
{"FF7", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00, 0, 0x0f, 0, 0xff, 0, 0xf0, 4, 0x00, 0, 0x00, 0, 0x00, 0, 0x00, 0},
@@ -138,10 +141,10 @@ unsigned int lzss::lzss_decomp(Handle * f_source, Handle * f_cible, int true_len
f_source->read(&fbitmap, 1);
printm(M_INFO, "16bits behavior, false bitmap = %02x\n", fbitmap);
}
+ printm(M_INFO, "Begin of block, bitmap = %02x\n", bitmap);
if (scheme.bitmap_inversed) {
bitmap = swap_bits(bitmap);
}
- printm(M_INFO, "Begin of block, bitmap = %02x\n", bitmap);
for (i = 0; i < 8; i++) {
printm(M_INFO, " - Chunk %i (offset cible = %li = 0x%04x, offset source = %li = 0x%04x)\n", i, f_cible->tell(), f_cible->tell(), f_source->tell(), f_source->tell());
if (whole_count >= length)
@@ -170,10 +173,19 @@ unsigned int lzss::lzss_decomp(Handle * f_source, Handle * f_cible, int true_len
shift(val2 & scheme.j_mask_2, scheme.j_shft_2);
valeur = shift(val1 & scheme.v_mask_1, scheme.v_shft_1) |
shift(val2 & scheme.v_mask_2, scheme.v_shft_2);
- decomp_jump &= lzss_maxptr;
+// decomp_jump &= lzss_maxptr; bad, ugly, non working
decomp_jump += scheme.one_jump;
decomp_length = decomp_length + 3 + scheme.sixteen_bits;
decomp_fill = decomp_fill + 3 + scheme.sixteen_bits;
+
+#if 0 /* Zelda GC */
+ decomp_length--;
+ if (decomp_length == 2) {
+ printm(M_INFO, "Big jump\n");
+ decomp_length = f_source->readU8() + 18;
+ }
+#endif
+
if ((decomp_length == lzss_maxsize) && (scheme.filling)) {
if ((decomp_fill == 3) && (scheme.filling == 2)) {
f_source->read(&val3, 1);