Skip to content

Cerwym/keeperfx-devtools

Repository files navigation

KeeperFX Developer Tools

Development tools extension for KeeperFX modding.

Features

Raw Image Viewer

  • View .raw files: Opens 256×256 8-bit indexed .raw image files used by KeeperFX
  • Game palette: Automatically loads data/palette.dat from your workspace to display images with correct colors
  • Transparency support: Shows color index 0 as transparent with a checkerboard background
  • Zoom controls: Fit, 100%, 200%, 400%, and 800% zoom levels
  • Pixel-perfect rendering: Uses nearest-neighbor scaling to preserve sharp pixels

Requirements

  • A KeeperFX workspace containing data/palette.dat (768 bytes: 256 colors × RGB with 6-bit values)
  • .raw files must be exactly 65536 bytes (256×256 pixels)

Usage

  1. Open a KeeperFX workspace in VS Code
  2. Open any .raw file (e.g., config/mods/your-mod/data/overlay_test.raw)
  3. The custom viewer will automatically open showing the image with the correct palette
  4. Use the toolbar buttons to zoom in/out

How It Works

  1. Reads the 256×256 indexed pixel data from the .raw file
  2. Loads the palette from data/palette.dat in your workspace
  3. Converts 6-bit RGB palette values (0-63) to 8-bit (0-255) by multiplying by 4
  4. Maps each pixel's color index to RGB using the palette
  5. Renders transparency (color 0) with checkerboard background
  6. Displays the result in a webview canvas with zoom controls

Testing

To test the extension:

  1. Press F5 to launch the Extension Development Host
  2. In the new window, open a KeeperFX workspace
  3. Open a .raw file to see the viewer in action

Known Limitations

  • Only supports 256×256 .raw files (the standard size for KeeperFX lens overlays and mists)
  • Requires data/palette.dat in the workspace (falls back to grayscale if not found)
  • Read-only viewer (no editing capabilities)

Extension Structure

  • src/extension.ts: Extension entry point, registers the custom editor
  • src/rawImageEditor.ts: Custom editor provider implementing the viewer logic
  • package.json: Declares the custom editor contribution for *.raw files

Release Notes

0.0.1

Initial release:

  • Basic .raw file viewing
  • Palette loading from workspace
  • Zoom controls
  • Transparency support

About

Development tools to help with keeperfx

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published