/*
 * This file is part of "VirtuaMUnstaz Demo Distribution".
 *
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * "VirtuaMUnstaz Demo Distribution" is distributed in the hope that it will be 
 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this software; see the file COPYING.  If not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

/* $Id: vmi.h,v 2.0 2000/02/28 13:55:00 leo Exp $ */

/*
 * most of the information found here has been collected by marcus@idonex.se
 * and may be obtained here: http://marcus.mangakai.com/dc
 */

#ifndef _VMI_H_
#define _VMI_H_

/**
 * vmi offsets in case someone wants to directly read the file.
 * there are holes in the offsets and unless documented the field
 * is one byte long. bigger values are stored as little endian!
 */
#define VMI_OFF_CHECKSUM	0x00	/*  4 bytes */
#define VMI_OFF_TITLE		0x04	/* 32 bytes */
#define VMI_OFF_CREATOR		0x24	/* 32 bytes */
#define VMI_OFF_YEAR		0x44	/*  2 bytes */
#define VMI_OFF_MONTH		0x46
#define VMI_OFF_DAY		0x47
#define VMI_OFF_HOUR		0x48
#define VMI_OFF_MINUTE		0x49
#define VMI_OFF_SECOND		0x4A
#define VMI_OFF_WEEKDAY		0x4B
#define VMI_OFF_VERSION		0x4C	/*  2 bytes */
#define VMI_OFF_FILE_COUNT	0x4E	/*  2 bytes */
#define VMI_OFF_RESOURCE	0x50    /*  8 bytes */
#define VMI_OFF_FILE_NAME	0x58	/* 12 bytes */
#define VMI_OFF_FILE_TYPE	0x64	/*  4 bytes (?) */
#define VMI_OFF_FILE_SIZE	0x68	/*  2 bytes */

/**
 * checksum placeholders used by the create_vmi
 */
#define SEGA			0x01
#define AGES			0x02

/**
 * the known types of files
 */
#define	DATA			0x00
#define GAME			0x03

/**
 * structure of a standard VMI file that is not a compressed VMI/VMS.
 * all integer fields that have more than one byte are stored as
 * little endian values.
 */
struct vmi {
  char checksum[4];		/* checksum: ressource & SEGA or AGES */
  char title[32];		/* title, 32 characters */
  char creator[32];		/* copyright, 32 characters */
  char year[2];			/* date of creation of the .VMS */
  char month;
  char day;
  char hour;
  char minute;
  char second;
  char weekday;
  char version[2];		/* version of the file */
  char count[2];		/* amount of files to be downloaded */
  char resource[8];		/* resource name, the VMS file name */
  char file[12];		/* the actual file name displayed on the VMU*/
  char type;			/* file type: 0x00 DATA, 0x03 GAME */
  char _1[3];
  char size[2];			/* size of the VMS file */
  char _2[2];
};

#endif _VMI_H_
