117 lines
3.4 KiB
Markdown
117 lines
3.4 KiB
Markdown
# DVX Tools
|
|
|
|
Host-native utilities that run on the development machine (Linux or
|
|
DOS). These are not DXE modules and do not cross-compile with DJGPP --
|
|
they build with the system GCC.
|
|
|
|
|
|
## dvxres -- Resource Tool
|
|
|
|
Command-line tool for managing resource blocks appended to DXE3 files
|
|
(`.app`, `.wgt`, `.lib`). Resources are invisible to `dlopen` because
|
|
they are appended after the DXE3 content.
|
|
|
|
### Commands
|
|
|
|
```
|
|
dvxres add <file> <name> <type> <data|@file>
|
|
dvxres build <file> <manifest.res>
|
|
dvxres list <file>
|
|
dvxres get <file> <name> [outfile]
|
|
dvxres strip <file>
|
|
```
|
|
|
|
| Command | Description |
|
|
|---------|-------------|
|
|
| `add` | Add or replace a single resource in a DXE file |
|
|
| `build` | Add all resources listed in a manifest file (replaces any existing resources) |
|
|
| `list` | List all resources in a DXE file |
|
|
| `get` | Extract a resource to a file or stdout |
|
|
| `strip` | Remove all appended resources, leaving only the DXE content |
|
|
|
|
### Resource Types
|
|
|
|
| Type | Keyword | Description |
|
|
|------|---------|-------------|
|
|
| `DVX_RES_ICON` | `icon` or `image` | Image data (BMP icons, etc.) |
|
|
| `DVX_RES_TEXT` | `text` | Null-terminated string (author, copyright) |
|
|
| `DVX_RES_BINARY` | `binary` | Arbitrary binary data (app-specific) |
|
|
|
|
For `add` with type `text`, the data argument is the string value
|
|
directly. For `icon` or `binary`, the data argument is a file path.
|
|
|
|
### Resource File Format
|
|
|
|
Resources are appended after the normal DXE3 content:
|
|
|
|
```
|
|
[DXE3 content] -- untouched, loaded by dlopen
|
|
[resource data entries] -- sequential, variable length
|
|
[resource directory] -- fixed-size 48-byte entries
|
|
[footer] -- 16 bytes: magic + dir offset + count
|
|
```
|
|
|
|
The footer is at the very end of the file. Reading starts from
|
|
`EOF - 16` bytes. The magic value is `0x52585644` ("DVXR" in
|
|
little-endian). The directory offset points to the start of the
|
|
directory entries, and the entry count gives the number of resources.
|
|
|
|
Each directory entry (48 bytes) contains:
|
|
- `name[32]` -- resource name (null-terminated)
|
|
- `type` (uint32) -- DVX_RES_ICON, DVX_RES_TEXT, or DVX_RES_BINARY
|
|
- `offset` (uint32) -- absolute file offset of data
|
|
- `size` (uint32) -- data size in bytes
|
|
- `reserved` (uint32) -- padding
|
|
|
|
### Manifest File Format (.res)
|
|
|
|
Plain text, one resource per line:
|
|
|
|
```
|
|
# Comment lines start with #
|
|
name type data
|
|
|
|
# Examples:
|
|
icon32 icon icons/myapp32.bmp
|
|
icon16 icon icons/myapp16.bmp
|
|
author text "John Doe"
|
|
appdata binary data/config.bin
|
|
```
|
|
|
|
Each line has three fields: name, type, and data. Text data can be
|
|
quoted. Empty lines and lines starting with `#` are ignored.
|
|
|
|
|
|
## mkicon -- Icon Generator
|
|
|
|
Generates simple 32x32 24-bit BMP pixel-art icons for DVX apps.
|
|
|
|
```
|
|
mkicon <output.bmp> <type>
|
|
```
|
|
|
|
Available icon types: `clock`, `notepad`, `cpanel`, `dvxdemo`, `imgview`.
|
|
|
|
Note: mkicon is defined in `mkicon.c` but is not currently built by the
|
|
Makefile (it was used during initial development).
|
|
|
|
|
|
## Files
|
|
|
|
| File | Description |
|
|
|------|-------------|
|
|
| `dvxres.c` | Resource tool implementation |
|
|
| `mkicon.c` | Icon generator (not built by default) |
|
|
| `Makefile` | Builds `bin/dvxres` (host native) |
|
|
|
|
|
|
## Build
|
|
|
|
```
|
|
make # builds bin/dvxres
|
|
make clean # removes bin/dvxres
|
|
```
|
|
|
|
Uses the system GCC, not the DJGPP cross-compiler. Links against
|
|
`core/dvxResource.c` for the runtime resource API (`dvxResOpen`,
|
|
`dvxResRead`, `dvxResClose`).
|