diff options
author | pixel <pixel> | 2003-10-20 16:27:54 +0000 |
---|---|---|
committer | pixel <pixel> | 2003-10-20 16:27:54 +0000 |
commit | 100de0d7a830ad1567ff2b4867490961bdb4b384 (patch) | |
tree | 734861178fe2791460e98320177cb315374b9e18 /lib | |
parent | 9f4bc95bd406adecf8803b455cb20e79f3cccadb (diff) |
Commit of the month
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cdreader.cpp | 12 | ||||
-rw-r--r-- | lib/lzss.cpp | 18 |
2 files changed, 26 insertions, 4 deletions
diff --git a/lib/cdreader.cpp b/lib/cdreader.cpp index bb785cf..33ba1b2 100644 --- a/lib/cdreader.cpp +++ b/lib/cdreader.cpp @@ -175,7 +175,17 @@ void cdreader::getsector(void *buf, int sec) throw (GeneralException) { }
}
if (dwErrCode != ERROR_IO_PENDING) {
- throw GeneralException("Gave up on reading CD");
+ LPVOID lpMsgBuf;
+ if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR) &lpMsgBuf, 0, NULL ))
+ throw GeneralException("Gave up on reading CD: unknown error");
+ String errmsg = (LPCTSTR) lpMsgBuf;
+ LocalFree(lpMsgBuf);
+ throw GeneralException("Gave up on reading CD: " + errmsg);
}
} else {
done = true;
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); |