|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
#include "blitzlib.h"#include "blitzexec.h"#include <dos/dos.h>#include <proto/dos.h>#include "optidec.h"Data Structures | |
| struct | s404hdr |
Macros | |
| #define | __NOLIBBASE__ |
| #define | DOS_BASE_NAME dos |
| #define | S404 0x53343034UL |
| #define | HDR(p) |
| #define | FIBSIZE 264 /* AllocMem'd for Examine: a little more than the FIB */ |
Functions | |
| void | _stclength (void) |
| void | _stcstart (void) |
| void | _stcsafelen (void) |
| void | _stcload (void) |
| void | ristonecrackerlib_codeinit (void) |
| void | ristonecrackerlib_codefinit (void) |
| void | optidec (void) |
| static int | stcdecrunch (UBYTE *a) |
| static void | codeinit_c (void) |
| init (codeinit): opens dos.library, any version (finit closes it). | |
| static void | codefinit_c (void) |
| finit: closes dos.library if init opened it. | |
| static ULONG | stclength_c (const UBYTE *a) |
| STCLength(address): the unpacked size of an S404 file in memory. | |
| static ULONG | stcstart_c (const UBYTE *a) |
| STCStart(address): where the data of an S404 file unpacked in place begin (address + security offset). | |
| static ULONG | stcsafelen_c (const UBYTE *a) |
| STCSafeLen(address): the buffer size an S404 file needs to be unpacked in place (unpacked length + security offset). | |
| static ULONG | stcload_c (CONST_STRPTR name, UBYTE *ad) |
| STCLoad filename$,address: reads an S404 file to address (its whole length) and unpacks it in place. | |
Variables | |
| static struct Library * | dosbase |
| static const char | dosname [] = "dos.library" |
| #define __NOLIBBASE__ |
| #define DOS_BASE_NAME dos |
| #define S404 0x53343034UL |
| void _stclength | ( | void | ) |
| void _stcload | ( | void | ) |
| void _stcsafelen | ( | void | ) |
| void _stcstart | ( | void | ) |
|
static |
finit: closes dos.library if init opened it.
Fixed (#834): the original's finit is 0, dos.library was never closed.
|
static |
init (codeinit): opens dos.library, any version (finit closes it).
| void optidec | ( | void | ) |
| void ristonecrackerlib_codefinit | ( | void | ) |
| void ristonecrackerlib_codeinit | ( | void | ) |
|
static |
|
static |
STCLength(address): the unpacked size of an S404 file in memory.
| a | d0: the file |
|
static |
STCLoad filename$,address: reads an S404 file to address (its whole length) and unpacks it in place.
The file is opened by its name while the lock is held, and the lock is unlocked after that (fixed #1147: the original opened it with OpenFromLock, a dos V36 function, and crashed on Kickstart 1.x; it also unlocked the lock OpenFromLock had taken over again after Close, fixed #835). Unpacked only if Examine succeeded, Read read the whole file and it is an S404 file whose packed data and trailer lie within it (fixed #836: the original checked none of it). The whole file is read whatever the buffer's size (the command has no size argument). Corrupt data give 0 and are not written below the buffer (fixed #833).
| name | d0: filename$ |
| ad | d1: the buffer (STCSafeLen bytes, at least the file's size) |
|
static |
STCSafeLen(address): the buffer size an S404 file needs to be unpacked in place (unpacked length + security offset).
The header check is only in the binary (not in the source).
| a | d0: the file |
|
static |
STCStart(address): where the data of an S404 file unpacked in place begin (address + security offset).
The header check is only in the binary (not in the source).
| a | d0: the file |
|
static |
|
static |