# 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`,
`noicon`.


## mktbicon -- Toolbar Icon Generator

Generates 16x16 24-bit BMP toolbar button icons.

```
mktbicon <output.bmp> <type>
```

Used to create toolbar button resources for DVX BASIC and other apps.


## Files

| File | Description |
|------|-------------|
| `dvxres.c` | Resource tool implementation |
| `mkicon.c` | 32x32 icon generator |
| `mktbicon.c` | 16x16 toolbar icon generator |
| `Makefile` | Builds `bin/dvxres`, `bin/mkicon`, `bin/mktbicon` (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`).
