GFE Plug-in Guide

This document describes how to make your own plug-ins for GFE. The DLLs can be named anyway you like, but they should end with the ".dll" extension. These are the necessary data structures: This color means that part of the system is not ready.

typedef struct image_list_t *ilist_t;
typedef struct image_list_t
{
        unsigned long width;
        unsigned long height;
        unsigned long offset;
        ilist_t nextim;
} image_list_t;

typedef struct entry_list_t *elist_t;
typedef struct entry_list_t {
  char name[256]; //name of the entry
  unsigned long size; //size, must be correct for entry saving, not for images
  unsigned long csize; //compressed size
  unsigned long comptype; //compression type, 0 = none, 1 = Daikatana RLE, 2 = deflate
  unsigned long offset; // offset to file data or image data (past the header and palette)
  unsigned long format; //0 = regular image, 1 = art, 2 = 16-bit, ...
  unsigned long palette_offset; //Offset to palette data (if exists)
  unsigned long palette_type; // 0 = regular 768, 1 = bmp 1024, ...
  unsigned long image_offset; //Offset to raw image data
  unsigned long width; // 0 if not image
  unsigned long height; // 0 if not image
  unsigned long numtex; // 1 = normal image, 0 if not image, > 1 for textures with more than one images
  elist_t next;
  ilist_t nextim; // this is not yet supported and should be NULL
} entry_list_t;

Images

The format for images can be:

char * CALLBACK get_bitmap_data (HWND hwnd, char *fullname, int offset, int number) returns pixels (with padding), number is format - 1000
void CALLBACK delete_bitmap_data (void)  

Palettes

If you specify a palette type, remember also to set the palette offset. The palette type can be:

char * get_palette_data (char *fullname, int size, int offset, int number) returns the palette data (type 0), number is palette_type - 1000

Compression

If you need to specify compression type, these are the existing options:

char * get_uncomp_data (char *fullname, int offset, int number) returns the file/entry uncompressed, number is comptype - 1000

Sound files

There is also a special case of format. If it is >= 500 or < 600, the entry is a sound file that your plug-in can convert to wave (.wav). If you use this, the following function must be in your DLL file:

char * CALLBACK get_wave_data (HWND hwnd, char *fullname, int offset, int number) returns the wave file. Number is format - 500
void CALLBACK delete_wave_data (void)  

Text files

If you have text file, the format should be set to 800. That way GFE knows to display the entry in a textbox.

Other necessary functions

These are the functions that should always be in your DLL file:

short CALLBACK get_ext_count (void) Tells GFE how many different extensions the plug-in supports. If the return value is 0, all files are directed to the plug-in first (not recommended).
char * CALLBACK get_ext (int number) Gives extension number xxx (number starts from 1). If extension count was 0, this function is not used.
char * CALLBACK get_format_desc (int number) Gives a short description of the extension/format (number starts from 1).
elist_t CALLBACK open (HWND hwnd, char *fullname, char *filename, int size, int offset) This is where the plug-in opens the file checks if it can read it, if not, return value is NULL.
char * CALLBACK get_desc (void) Gives a short description of the plug-in. The description is shown in GFE's menu.
void CALLBACK plugin_info (HWND hwnd) Displays plug-in's aboutbox.
void CALLBACK delete_entry (void) Removes the entry from memory.

For more info, see the source codes for the AUD, COL, CPS, JPG, RES and TGA plug-ins.

If you have any problems, questions or something is missing, let me know!