|
JubeatPlus 3.9.11
|
KUnzip's own minizip I/O callback sets. More...
#include "ioapi.h"
Go to the source code of this file.
Functions | |
| voidpf | KUnzip_fopen_filehandle_func (voidpf opaque, const char *filename, int mode) |
| Opens the file-handle-backed archive for reading. | |
| uLong | KUnzip_fread_filehandle_func (voidpf opaque, voidpf stream, void *buf, uLong size) |
Reads size bytes from the file-handle-backed archive into buf. | |
| uLong | KUnzip_fwrite_filehandle_func (voidpf opaque, voidpf stream, const void *buf, uLong size) |
| Write stub for the file-handle-backed archive; always fails. | |
| long | KUnzip_ftell_filehandle_func (voidpf opaque, voidpf stream) |
| Reports the file-handle-backed archive's current position. | |
| long | KUnzip_fseek_filehandle_func (voidpf opaque, voidpf stream, uLong offset, int origin) |
| Seeks the file-handle-backed archive. | |
| int | KUnzip_fclose_filehandle_func (voidpf opaque, voidpf stream) |
| Closes the file-handle-backed archive. | |
| int | KUnzip_ferror_filehandle_func (voidpf opaque, voidpf stream) |
| Reports the error state of the file-handle-backed archive. | |
| voidpf | KUnzip_fopen_mem_func (voidpf opaque, const char *filename, int mode) |
| Opens the memory-backed archive by rewinding the cursor. | |
| uLong | KUnzip_fread_mem_func (voidpf opaque, voidpf stream, void *buf, uLong size) |
Reads size bytes from the memory-backed archive into buf. | |
| uLong | KUnzip_fwrite_mem_func (voidpf opaque, voidpf stream, const void *buf, uLong size) |
| Write stub for the memory-backed archive; always fails. | |
| long | KUnzip_ftell_mem_func (voidpf opaque, voidpf stream) |
| Reports the memory-backed archive's current position, relative to the range start. | |
| long | KUnzip_fseek_mem_func (voidpf opaque, voidpf stream, uLong offset, int origin) |
| Seeks the memory-backed archive. | |
| int | KUnzip_fclose_mem_func (voidpf opaque, voidpf stream) |
| Closes the memory-backed archive. | |
| int | KUnzip_ferror_mem_func (voidpf opaque, voidpf stream) |
| Reports the error state of the memory-backed archive. | |
KUnzip's own minizip I/O callback sets.
Reconstructed from Ghidra program Jubeat (image base 0x100000000). All
Two zlib_filefunc_def implementations back KUnzip's archive reading. Both take the KUnzip itself as the opaque cookie and ignore the stream argument: the file-handle set reads through the object's fileHandle (installed by -initWithPath:tail:), and the memory set reads out of its data over dataRange with a dataCurrentPos cursor (installed by -initWithData:range:). They are declared extern "C" so KUnzip can install them into a zlib_filefunc_def table, and implemented in kunzip_filefunc.mm because they message Objective-C objects.
Closes the file-handle-backed archive.
| opaque | The KUnzip that owns the handle. |
| stream | The minizip stream cookie; ignored. |
Closes the memory-backed archive.
| opaque | The KUnzip; ignored. |
| stream | The minizip stream cookie; ignored. |
Reports the error state of the file-handle-backed archive.
| opaque | The KUnzip; ignored. |
| stream | The minizip stream cookie; ignored. |
Reports the error state of the memory-backed archive.
| opaque | The KUnzip; ignored. |
| stream | The minizip stream cookie; ignored. |
Opens the file-handle-backed archive for reading.
Wraps filename in an NSString, opens it with +[NSFileHandle fileHandleForReadingAtPath:], stores the handle on the KUnzip via -setFileHandle: when non-nil, and returns it. mode is ignored, so this backend can never satisfy a write-mode open.
| opaque | The KUnzip that receives the handle. |
| filename | The UTF-8 path to open. |
| mode | A ZLIB_FILEFUNC_MODE_* bitmask; ignored. |
NSFileHandle as a voidpf, or nullptr when the file cannot be opened. Opens the memory-backed archive by rewinding the cursor.
Sends -setDataCurrentPos: with dataRange.location and returns the KUnzip itself as the stream cookie. filename and mode are ignored.
| opaque | The KUnzip that holds the data, range, and cursor. |
| filename | The path; ignored. |
| mode | A ZLIB_FILEFUNC_MODE_* bitmask; ignored. |
opaque, or nullptr when opaque is nullptr. Reads size bytes from the file-handle-backed archive into buf.
Reads at the handle's current offsetInFile through -readDataOfLength:, clamped so a read can never cross dataRange.length, which this backend treats as an absolute end offset.
| opaque | The KUnzip that owns the handle and the range. |
| stream | The minizip stream cookie; ignored. |
| buf | The destination buffer. |
| size | The requested byte count; may be clamped down. |
Reads size bytes from the memory-backed archive into buf.
Copies out of data starting at the absolute cursor dataCurrentPos through -getBytes:range:, clamped to dataRange.location + dataRange.length, then advances the cursor.
| opaque | The KUnzip that owns the data, cursor, and range. |
| stream | The minizip stream cookie; ignored. |
| buf | The destination buffer. |
| size | The requested byte count; may be clamped down. |
Seeks the file-handle-backed archive.
The base is 0 for ZLIB_FILEFUNC_SEEK_SET, the handle's offsetInFile for ZLIB_FILEFUNC_SEEK_CUR, and dataRange.length (an absolute end offset) for ZLIB_FILEFUNC_SEEK_END. The target is rejected when it passes dataRange.length.
| opaque | The KUnzip that owns the handle and the range. |
| stream | The minizip stream cookie; ignored. |
| offset | The displacement from the origin. |
| origin | A ZLIB_FILEFUNC_SEEK_* value. |
Seeks the memory-backed archive.
The base is dataRange.location for ZLIB_FILEFUNC_SEEK_SET, dataCurrentPos for ZLIB_FILEFUNC_SEEK_CUR, and dataRange.location + dataRange.length for ZLIB_FILEFUNC_SEEK_END. The target is rejected when it passes the end of the range.
| opaque | The KUnzip that owns the cursor and range. |
| stream | The minizip stream cookie; ignored. |
| offset | The displacement from the origin. |
| origin | A ZLIB_FILEFUNC_SEEK_* value. |
Reports the file-handle-backed archive's current position.
| opaque | The KUnzip that owns the handle. |
| stream | The minizip stream cookie; ignored. |
offsetInFile. Reports the memory-backed archive's current position, relative to the range start.
| opaque | The KUnzip that owns the cursor and range. |
| stream | The minizip stream cookie; ignored. |
dataCurrentPos - dataRange.location. Write stub for the file-handle-backed archive; always fails.
| opaque | The KUnzip; ignored. |
| stream | The minizip stream cookie; ignored. |
| buf | The source buffer; ignored. |
| size | The requested byte count; ignored. |
Write stub for the memory-backed archive; always fails.
| opaque | The KUnzip; ignored. |
| stream | The minizip stream cookie; ignored. |
| buf | The source buffer; ignored. |
| size | The requested byte count; ignored. |