-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GZ support deprecate SQLite; implement custom DB file format integrate ZXDB: year, genre, brand, score, authors, inlays, screen$, instructions, maps, cheats, new resizable image loader new ui overlay layer console logo redo ZXDB import scripts implement download() fixed bug that prevented loading very small .pok files fixed tigr under virtualbox/osx replaced fdc motor sound add fdc sounds to betadisk interface may drag folders into window now added button to scan games when no library is found
- Loading branch information
Showing
79 changed files
with
77,318 additions
and
265,276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// gunzip unpacker | ||
// - rlyeh, public domain | ||
|
||
char *gunzip(const void *data_, unsigned len, unsigned *outlen_) { | ||
const unsigned char *data = (const unsigned char *)data_; | ||
if( data && !memcmp(data, "\x1f\x8b\x08", 3) ) { | ||
int flags = data[3]; | ||
|
||
const unsigned char *ptr = data + 3+1 + 4 + 1 + 1; // header+flags + timestamp + extra flags + os | ||
|
||
// https://www.rfc-editor.org/rfc/rfc1952 | ||
if( flags & 4 ) ptr += ptr[0] << 0 | ptr[1] << 8; // FEXTRA | ||
if( flags & 8 ) ptr += strlen(ptr) + 1; // FNAME | ||
if( flags & 16 ) ptr += strlen(ptr) + 1; // FCOMMENT | ||
if( flags & 2 ) ptr += 2; // FHCRC | ||
// if( flags & 1 ) ptr += strlen(ptr) + 1; // FTEXT | ||
|
||
const unsigned outlen = *(unsigned *)&data[ len - 4 ]; | ||
|
||
unsigned char *out = 0; | ||
out = realloc(out, outlen); | ||
|
||
mz_stream z = {0}; | ||
z.avail_in = (len - 4 /*crc*/ - 4 /*outlen*/) - (ptr - data); | ||
z.next_in = ptr; | ||
z.avail_out = outlen; | ||
z.next_out = out; | ||
|
||
mz_inflateInit2(&z, -MZ_DEFAULT_WINDOW_BITS); | ||
int ret = mz_inflate(&z, MZ_SYNC_FLUSH); | ||
mz_inflateEnd(&z); | ||
|
||
if( ret >= 0 ) { | ||
if( outlen_ ) *outlen_ = outlen; | ||
return out; | ||
} | ||
|
||
// alert("error: cant decompress .gz file (gzip)"); | ||
out = realloc(out, 0); | ||
} | ||
return NULL; | ||
} |
Oops, something went wrong.