X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=cochran.c;h=360f2eb7c9d836a1f77688821f6ad33872442b51;hb=2cada118eb515e369ba23b85c8f3fb8c4d100aaa;hp=650a479b126be47c672aa410e3509a6e54c2223b;hpb=1a66a74e8a35c1fd85060060ba61bb1b67d6eb44;p=ext%2Fsubsurface.git diff --git a/cochran.c b/cochran.c index 650a479..360f2eb 100644 --- a/cochran.c +++ b/cochran.c @@ -8,6 +8,8 @@ #include "dive.h" #include "file.h" +#define DON + /* * The Cochran file format is designed to be annoying to read. It's roughly: * @@ -135,11 +137,7 @@ static void parse_cochran_header(const char *filename, * The header scrambling is different form the dive * scrambling. Oh yay! */ -#if 0 // Alex - partial_decode(0x058c, 0x0b14, decode, 0, mod, in, size, buf); -#else // Don - partial_decode(0x05a0, 0x0b14, decode, 0, mod, in, size, buf); -#endif + partial_decode(0x010e, 0x0b14, decode, 0, mod, in, size, buf); partial_decode(0x0b14, 0x1b14, decode, 0, mod, in, size, buf); partial_decode(0x1b14, 0x2b14, decode, 0, mod, in, size, buf); partial_decode(0x2b14, 0x3b14, decode, 0, mod, in, size, buf); @@ -157,6 +155,11 @@ static void parse_cochran_dive(const char *filename, int dive, const unsigned char *in, unsigned size) { char *buf = malloc(size); +#ifdef DON + unsigned int offset = 0x4a14; +#else + unsigned int offset = 0x4b14; +#endif /* * The scrambling has odd boundaries. I think the boundaries @@ -179,9 +182,8 @@ static void parse_cochran_dive(const char *filename, int dive, * scrambled, but there seems to be size differences in the data, * so this just descrambles part of it: */ - partial_decode(0x48ff, 0x4a14, decode, 0, mod, in, size, buf); - partial_decode(0x4a14, 0xc9bd, decode, 0, mod, in, size, buf); - partial_decode(0xc9bd, size, decode, 0, mod, in, size, buf); + partial_decode(0x48ff, offset, decode, 0, mod, in, size, buf); + partial_decode(offset, size, decode, 0, mod, in, size, buf); printf("\n%s, dive %d\n\n", filename, dive); cochran_debug_write(filename, buf, size);