/* :ts=4							c2p_module.c
 *
 *    cp4 - Commodore C+4 emulator
 *    Copyright (C) 1998 Gáti Gergely
 *
 *    This program 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 of the License, or
 *    (at your option) any later version.
 *
 *    This program 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 program; if not, write to the Free Software Foundation,
 *    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 *    e-mail: gatig@dragon.klte.hu
 */
#ifndef C2P_MODULE_C
#define C2P_MODULE_C

#ifndef C2P_MODULE_H
#include "c2p_module.h"
#endif

#include "macros.h"

#define SCRWIDTH	352
#define SCRHEIGHT	283
#define SCRSIZE		(SCRWIDTH*SCRHEIGHT)
#define NUMSCR		3
#define C2P_NOMSG	"\0"
#define C2P_NOMEM	"Not Enough Memory"
#define RET_ERROR	-2
#define RET_NEWWIN	-1
#define RET_OK		0
#define RET_DEBUG	1
#define RET_PREFS	2
#define RET_RESET	3
#define RET_HRESET	4
#define RET_QUIT	5

char *SAVEDS minit(ULONG scrmode, ULONG overscan, unsigned char *linedeltatab);
void SAVEDS mfree(void);
int SAVEDS mdo(unsigned char *chunky,unsigned char *delta,int numscreen);
int SAVEDS mdofull(unsigned char *chunky,int numscreen);
int SAVEDS mdont(void);
void SAVEDS msleep(void);
void SAVEDS mawake(void);

static int SAVEDS idofull(unsigned char *chunky,unsigned char *delta,int numscreen);
static int DummyGetOptionInt(char *name,int defval);
static void DummyAddOptionInt(char *name,int value);
static char *DummyGetOptionStr(char *name,char *defval);
static void DummyAddOptionStr(char *name,char *value);

static struct c2pvec vec;
#define C2P_VERSTAG " $VER: " ## C2P_NAME ## " " ## C2P_VERSION ## "." ## C2P_REVISION ## " " ## __DATE__ ## " (" ## __TIME__ ## ") cp4 VID by " ## C2P_AUTHOR
static char c2p_VERSTAG[]=C2P_VERSTAG;

struct c2pvec SAVEDS *startup(void) {
static char iVer[]=C2P_VERSION;
static char iRev[]=C2P_REVISION;
static char iNam[]=C2P_NAME;
static char iAut[]=C2P_AUTHOR;
static char iInf[]=C2P_INFO;
	vec.c2p_init=minit;
	vec.c2p_free=mfree;
	vec.c2p_do=mdo;
	vec.c2p_dofull=idofull;
	vec.c2p_sleep=msleep;
	vec.c2p_awake=mawake;
	vec.c2p_Info=iInf;
	vec.c2p_Author=iAut;
	vec.c2p_Version=iVer;
	vec.c2p_Revision=iRev;
	vec.c2p_Name=iNam;
	vec.c2p_Scr=NULL;
	vec.c2p_Win=NULL;
	vec.c2p_GetOptionInt=DummyGetOptionInt;
	vec.c2p_AddOptionInt=DummyAddOptionInt;
	vec.c2p_GetOptionStr=DummyGetOptionStr;
	vec.c2p_AddOptionStr=DummyAddOptionStr;
	vec.c2p_MsgList.lh_Head=(struct Node *)&vec.c2p_MsgList.lh_Tail;
	vec.c2p_MsgList.lh_Tail=NULL;
	vec.c2p_MsgList.lh_TailPred=(struct Node *)&vec.c2p_MsgList.lh_Head;
	vec.c2p_MsgList.lh_Type=0;
#ifdef C2P_BUFFERING
	vec.c2p_Buffering=C2P_BUFFERING;
	if(vec.c2p_Buffering<0||vec.c2p_Buffering>3) vec.c2p_Buffering=0;
#else
	vec.c2p_Buffering=0;
#endif
	vec.c2p_Speed=-1;
#ifdef C2P_NOSPEED
	vec.c2p_NoSpeed=1;
#else
	vec.c2p_NoSpeed=0;
#endif
	c2p_VERSTAG[0]='\0';
	vec.c2p_dont=mdont;
	return(&vec);
} // startup

static int SAVEDS idofull(unsigned char *chunky,unsigned char *delta,int numscreen) {
	return(mdofull(chunky,numscreen));
} // idofull()

static int DummyGetOptionInt(char *name,int defval) {
	return(-1);
}

static void DummyAddOptionInt(char *name,int value) {
	return;
}

static char *DummyGetOptionStr(char *name,char *defval) {
	return(NULL);
}

static void DummyAddOptionStr(char *name,char *value) {
	return;
}

#endif
