From 2882b26a996839f09956fa59617c63f2c3abac72 Mon Sep 17 00:00:00 2001 From: Tom Ross Date: Tue, 6 Feb 2007 21:41:08 +0000 Subject: Major Rockboy update. 1) Adapt Rockboy to smaller screens (H10, X5, and iPod Nano). 2) Add the ability to use a preset palette on color targets. Choose 'Set Palette' from the main menu. 3) Clean up the code to remove any unused code and variables. 4) Changed tabs to spaces. 5) Disable reading and writing sound when sound is disabled. 6) Disbable writing to the RTC since it is not implemented yet. 7) Minor optimizations from WAC gnuboy CE and iBoy. 8) Massive clean up of code to make it appear consistent. 9) Change all C++ style comments to C style. 10) Completely reorganize dynarec. Add fixmes to all unimplemented opcodes. Add debug writes for all opcodes. Attempt to implement a few opcodes myself. 11) Silence some warnings when built using dynarec. 12) Minor reshuffling of IRAM, may or not offer a speed increase. 13) Include fixes found in the short-lived gnuboy CVS. All in all, there's about a 10% improvement on my test roms when sound is disabled and slight improvement with sound. Especially noticable when there are few sprites on screen and less action is occurring. See FS #6567. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12216 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/rockboy/inflate.c | 514 ----------------------------------------- 1 file changed, 514 deletions(-) delete mode 100644 apps/plugins/rockboy/inflate.c (limited to 'apps/plugins/rockboy/inflate.c') diff --git a/apps/plugins/rockboy/inflate.c b/apps/plugins/rockboy/inflate.c deleted file mode 100644 index 6818749187..0000000000 --- a/apps/plugins/rockboy/inflate.c +++ /dev/null @@ -1,514 +0,0 @@ - -/* Slightly modified from its original form so as not to exit the - * program on errors. The resulting file remains in the public - * domain for all to use. */ - -/* --- GZIP file format uncompression routines --- */ - -/* The following routines (notably the unzip()) function below - * uncompress gzipped data. They are terribly slow at the task, but - * it is presumed that they work reasonably well. They don't do any - * error checking, but they're probably not too vulnerable to buggy - * data either. Another important limitation (but it would be pretty - * easy to get around) is that the data must reside in memory, it is - * not read as a stream. They have been very little tested. Anyway, - * whatever these functions are good for, I put them in the public - * domain. -- David Madore 1999/11/21 */ - -#include "rockmacros.h" - -static unsigned int -peek_bits (const unsigned char *data, long p, int q) - /* Read q bits starting from bit p from the data pointed to by - * data. Data is in little-endian format. */ -{ - unsigned int answer; - int cnt; /* Number of bits already placed in answer */ - char ob, lb; /* Offset and length of bit field within current byte */ - - answer = 0; - for ( cnt=0 ; cnt q ) - lb = q-cnt; - answer |= ((unsigned int)((data[(p+cnt)/8]>>ob)&((1U<>(maxbits-size_table[j])) == code_table[j] ) ) - { - *p += size_table[j]; - return j; - } - } - return -1; -} - -/* I don't know what these should be. The rfc1951 doesn't seem to say - * (it only mentions them in the last paragraph of section 3.2.1). 15 - * is almost certainly safe, and it is the largest I can put given the - * constraints on the size of integers in the C standard. */ -#define CLEN_MAXBITS 15 -#define HLIT_MAXBITS 15 -#define HDIST_MAXBITS 15 - -/* The magical table sizes... */ -#define CLEN_TSIZE 19 -#define HLIT_TSIZE 288 -#define HDIST_TSIZE 30 - -static int -get_tables (const unsigned char *data, long *p, - char hlit_size_table[HLIT_TSIZE], - unsigned int hlit_code_table[HLIT_TSIZE], - char hdist_size_table[HDIST_TSIZE], - unsigned int hdist_code_table[HDIST_TSIZE]) - /* Fill the Huffman tables (first the code lengths table, and - * then, using it, the literal/length table and the distance - * table). See section 3.2.7 of rfc1951 for details. */ -{ - char hlit, hdist, hclen; - const int clen_weird_tangle[CLEN_TSIZE] - = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 }; - char clen_size_table[CLEN_TSIZE]; - unsigned int clen_code_table[CLEN_TSIZE]; - int j; - unsigned int b; - int remainder; /* See note at end of section 3.2.7 of rfc1951. */ - char rem_val; - - hlit = read_bits (data, p, 5); - hdist = read_bits (data, p, 5); - hclen = read_bits (data, p, 4); - for ( j=0 ; j<4+hclen ; j++ ) - clen_size_table[clen_weird_tangle[j]] - = read_bits (data, p, 3); - for ( ; j= 257 ) - /* Back reference */ - { - unsigned int bb; - unsigned int length, dist; - unsigned int l; - - switch ( b ) - { - case 257: length = 3; break; - case 258: length = 4; break; - case 259: length = 5; break; - case 260: length = 6; break; - case 261: length = 7; break; - case 262: length = 8; break; - case 263: length = 9; break; - case 264: length = 10; break; - case 265: length = 11 + read_bits (data, p, 1); break; - case 266: length = 13 + read_bits (data, p, 1); break; - case 267: length = 15 + read_bits (data, p, 1); break; - case 268: length = 17 + read_bits (data, p, 1); break; - case 269: length = 19 + read_bits (data, p, 2); break; - case 270: length = 23 + read_bits (data, p, 2); break; - case 271: length = 27 + read_bits (data, p, 2); break; - case 272: length = 31 + read_bits (data, p, 2); break; - case 273: length = 35 + read_bits (data, p, 3); break; - case 274: length = 43 + read_bits (data, p, 3); break; - case 275: length = 51 + read_bits (data, p, 3); break; - case 276: length = 59 + read_bits (data, p, 3); break; - case 277: length = 67 + read_bits (data, p, 4); break; - case 278: length = 83 + read_bits (data, p, 4); break; - case 279: length = 99 + read_bits (data, p, 4); break; - case 280: length = 115 + read_bits (data, p, 4); break; - case 281: length = 131 + read_bits (data, p, 5); break; - case 282: length = 163 + read_bits (data, p, 5); break; - case 283: length = 195 + read_bits (data, p, 5); break; - case 284: length = 227 + read_bits (data, p, 5); break; - case 285: length = 258; break; - default: - return -1; - } - bb = decode_one (data, p, hdist_size_table, HDIST_TSIZE, - hdist_code_table, HDIST_MAXBITS); - switch ( bb ) - { - case 0: dist = 1; break; - case 1: dist = 2; break; - case 2: dist = 3; break; - case 3: dist = 4; break; - case 4: dist = 5 + read_bits (data, p, 1); break; - case 5: dist = 7 + read_bits (data, p, 1); break; - case 6: dist = 9 + read_bits (data, p, 2); break; - case 7: dist = 13 + read_bits (data, p, 2); break; - case 8: dist = 17 + read_bits (data, p, 3); break; - case 9: dist = 25 + read_bits (data, p, 3); break; - case 10: dist = 33 + read_bits (data, p, 4); break; - case 11: dist = 49 + read_bits (data, p, 4); break; - case 12: dist = 65 + read_bits (data, p, 5); break; - case 13: dist = 97 + read_bits (data, p, 5); break; - case 14: dist = 129 + read_bits (data, p, 6); break; - case 15: dist = 193 + read_bits (data, p, 6); break; - case 16: dist = 257 + read_bits (data, p, 7); break; - case 17: dist = 385 + read_bits (data, p, 7); break; - case 18: dist = 513 + read_bits (data, p, 8); break; - case 19: dist = 769 + read_bits (data, p, 8); break; - case 20: dist = 1025 + read_bits (data, p, 9); break; - case 21: dist = 1537 + read_bits (data, p, 9); break; - case 22: dist = 2049 + read_bits (data, p, 10); break; - case 23: dist = 3073 + read_bits (data, p, 10); break; - case 24: dist = 4097 + read_bits (data, p, 11); break; - case 25: dist = 6145 + read_bits (data, p, 11); break; - case 26: dist = 8193 + read_bits (data, p, 12); break; - case 27: dist = 12289 + read_bits (data, p, 12); break; - case 28: dist = 16385 + read_bits (data, p, 13); break; - case 29: dist = 24577 + read_bits (data, p, 13); break; - default: - return -1; - } - for ( l=0 ; l