#ifndef CHUNKYPPC_PROTOS_H
#define CHUNKYPPC_PROTOS_H

#include <exec/types.h>
#include <graphics/gfx.h>
#include <intuition/intuition.h>
#include <libraries/asl.h>
#include <cybergraphics/cybergraphics.h>

#define BIT16 1
#define BIT16_SWAP 2
#define BIT16_ROT 4
#define BIT16_SWAP_ROT 8
#define BIT24 16
#define BIT24_ROT 32
#define BIT32 64
#define BIT32_SWAP 128
#define BIT32_ROT 256
#define BIT32_SWAP_ROT 512
#define BIT32_ROT_REVERSE 1024
#define BIT32_SWAP_ROT_REVERSE 2048
#define BIT8 4096

struct Soff
{
 int x;
 int y;
};

struct Buffers
{
 UBYTE *address;
 UBYTE *mask;
};

struct Mode_Screen
{
    struct Screen *video_screen;
    struct Window *video_window;
    int bpr;
    int wb_int;
    int pip_int;
    int dbuf_int;
    int oldstyle_int;
    char pubscreenname[512];
    int mode;
    int SCREENWIDTH;
    int SCREENHEIGHT;
    int MAXWIDTH;
    int MAXHEIGHT;
    int MINDEPTH;
    int MAXDEPTH;
    int format;
    int video_depth;
    UWORD *emptypointer;
    struct BitMap *video_tmp_bm;
    int video_is_native_mode;
    int video_is_cyber_mode;
    unsigned char *screen;
    int video_oscan_height;
    int bufnum;
    struct RastPort *video_rastport;
    struct BitMap *bitmapa;
    struct BitMap *bitmapb;
    struct BitMap *bitmapc;
    struct BitMap *thebitmap;
    struct RastPort *video_temprp;
    struct ScreenModeRequester *video_smr;
    int ham_int;
    UBYTE *wbcolors;
    UBYTE *transtable;
    unsigned long *WBColorTable;
    unsigned long *ColorTable;
    int pal_changed;
    int pen_obtained;
    unsigned char *screenb;
    unsigned char *screenc;
    int numbuffers;
    int rtgm_int;
    struct ScreenBuffer *Buf1;
    struct ScreenBuffer *Buf2;
    struct ScreenBuffer *Buf3;
    void * (*algo)(struct Mode_Screen *ms,unsigned char *dest,unsigned char *src, int srcformat,void *(*hook68k)(unsigned char *data),unsigned char *data);
    void (*Internal1)(void);
    void (*Internal2)(void);
    int onlyptr;
    int cgxlike;
};

struct Mode_Screen *OpenGraphics(char *Title, struct Mode_Screen *ms,int override);
void CloseGraphics(struct Mode_Screen *ms, int shutdownlibs);
void LoadColors(struct Mode_Screen *ms, ULONG *Table);
void DoubleBuffer(struct Mode_Screen *ms);
int ChunkyInit68k(struct Mode_Screen *ms, int srcformat);

extern "AmigaLib" ChunkyPPCBase
{
 void ChunkyNoffFast_(struct Library *,UBYTE *, UBYTE *, int, int, int) = -30;
 void ChunkyNoffFastest_(struct Library *,UBYTE *, UBYTE *, int, int, int) = -36;
 void ChunkyNoffNormal_(struct Library *,UBYTE *, UBYTE *, int, int, int) = -42;
 void ChunkyFast_(struct Library *,UBYTE *, UBYTE *, int, int, int, int, int) = -48;
 void ChunkyFastest_(struct Library *,UBYTE *, UBYTE *, int, int, int, int, int) = -54;
 void ChunkyNormal_(struct Library *,UBYTE *, UBYTE *, int, int, int, int, int) = -60;
 void ChunkyFastFull_(struct Library *,UBYTE *, UBYTE *, struct Soff *, struct Soff *, int, struct Soff *, int) = -66;
 void ChunkyFastestFull_(struct Library *,UBYTE *, UBYTE *, struct Soff *, struct Soff *, int, struct Soff *, int) = -72;
 void ChunkyNormalFull_(struct Library *,UBYTE *, UBYTE *, struct Soff *, struct Soff *, int, struct Soff *, int) = -78;
 void c2p_1_(struct Library *,UBYTE *, struct BitMap *, int, int) = -84;
 void c2p_2_(struct Library *,UBYTE *, UBYTE *, UBYTE *, int) = -90;
 void c2p_3_(struct Library *,void *, void *, int , int , struct Soff * , int , int) = -96;
 void c2p_4_(struct Library *,ULONG *,UBYTE *, UBYTE *, struct Soff *,struct Soff *, struct Soff *) = -102;
 void ChunkyNoffFastHT_(struct Library *,UBYTE *,UBYTE *,int,int,int,int) = -108;
 void ChunkyNoffFastestHT_(struct Library *,UBYTE *,UBYTE *,int,int,int,int) = -114;
 void ChunkyNoffNormalHT_(struct Library *,UBYTE *,UBYTE *,int,int,int,int) = -120;
 void ChunkyFastHT_(struct Library *,UBYTE *,UBYTE *,struct Soff *,int,int,int,int) = -126;
 void ChunkyFastestHT_(struct Library *,UBYTE *,UBYTE *,struct Soff *,int,int,int,int) = -132;
 void ChunkyNormalHT_(struct Library *,UBYTE *,UBYTE *,struct Soff *,int,int,int,int) = -138;
 void ChunkyFastFullHT_(struct Library *,UBYTE *,UBYTE *,struct Soff *,struct Soff *,struct Soff *,struct Soff *,int) = -144;
 void ChunkyFastestFullHT_(struct Library *,UBYTE *,UBYTE *,struct Soff *,struct Soff *,struct Soff *, struct Soff *, int) = -150;
 void ChunkyNormalFullHT_(struct Library *,UBYTE *,UBYTE *,struct Soff *,struct Soff *,struct Soff *,struct Soff *, int) = -156;
 void ChunkyNoffMask_(struct Library *,struct Buffers *,UBYTE *,int,int,int,int) = -162;
 void ChunkyMask_(struct Library *,struct Buffers *,UBYTE *,struct Soff *,int,int,int,int) = -168;
 void ChunkyMaskFull_(struct Library *,struct Buffers *,UBYTE *,struct Soff *, struct Soff *,struct Soff *,struct Soff *, int) = -174;
 void c2p_HI_(struct Library *, UBYTE *, int, UBYTE *, UBYTE *, UBYTE *, UBYTE *, UBYTE *) = -180;
 void ham_c2p_(struct Library *, unsigned char *, unsigned char *, int, int, int, int, int) = -186;
 int ChunkyInit_(struct Library *,struct Mode_Screen *ms, int srcformat) = -192;
}

__inline int ChunkyInit(struct Mode_Screen *ms, int srcformat)
{
 extern struct Library *ChunkyPPCBase;
 return ChunkyInit_(ChunkyPPCBase,ms,srcformat);
}

__inline void ham_c2p(unsigned char *chunky, unsigned char *planar, int width, int height, int depth, int qual, int ham_width)
{
 extern struct Library *ChunkyPPCBase;
 ham_c2p_(ChunkyPPCBase,chunky,planar,width,height,depth,qual,ham_width);
}

__inline void c2p_HI(UBYTE *address, int num, UBYTE *bpl0, UBYTE *bpl1, UBYTE *bpl2, UBYTE *bpl3, UBYTE *bpl4)
{
 extern struct Library *ChunkyPPCBase;
 c2p_HI_(ChunkyPPCBase,address,num,bpl0,bpl1,bpl2,bpl3,bpl4);
}

__inline void ChunkyNoffFast(UBYTE *address, UBYTE *data, int w, int h, int bpr)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyNoffFast_(ChunkyPPCBase,address,data,w,h,bpr);
}

__inline void ChunkyNoffFastest(UBYTE *address, UBYTE *data, int w, int h, int bpr)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyNoffFastest_(ChunkyPPCBase,address,data,w,h,bpr);
}

__inline void ChunkyNoffNormal(UBYTE *address, UBYTE *data, int w, int h, int bpr)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyNoffNormal_(ChunkyPPCBase,address,data,w,h,bpr);
}

__inline void ChunkyFast(UBYTE *address, UBYTE *data, int x, int y, int w, int h, int bpr)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyFast_(ChunkyPPCBase,address,data,x,y,w,h,bpr);
}

__inline void ChunkyFastest(UBYTE *address, UBYTE *data, int x, int y, int w, int h, int bpr)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyFastest_(ChunkyPPCBase,address,data,x,y,w,h,bpr);
}

__inline void ChunkyNormal(UBYTE *address, UBYTE *data, int x, int y, int w, int h, int bpr)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyNormal_(ChunkyPPCBase,address,data,x,y,w,h,bpr);
}

__inline void ChunkyFastFull(UBYTE *address, UBYTE *data, struct Soff *dest, struct Soff *size, int bpr, struct Soff *soff, int sbpr)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyFastFull_(ChunkyPPCBase,address,data,dest,size,bpr,soff,sbpr);
}

__inline void ChunkyFastestFull(UBYTE *address, UBYTE *data, struct Soff *dest, struct Soff *size, int bpr, struct Soff *soff, int sbpr)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyFastestFull_(ChunkyPPCBase,address,data,dest,size,bpr,soff,sbpr);
}

__inline void ChunkyNormalFull(UBYTE *address, UBYTE *data, struct Soff *dest, struct Soff *size, int bpr, struct Soff *soff, int sbpr)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyNormalFull_(ChunkyPPCBase,address,data,dest,size,bpr,soff,sbpr);
}

__inline void c2p_1(UBYTE *buffer, struct BitMap *bm, int width, int height)
{
 extern struct Library *ChunkyPPCBase;
 c2p_1_(ChunkyPPCBase,buffer,bm,width,height);
}

__inline void c2p_2(UBYTE *buffer, UBYTE *plane0, UBYTE *helpbfr, int PlaneSize)
{
 extern struct Library *ChunkyPPCBase;
 c2p_2_(ChunkyPPCBase,buffer,plane0,helpbfr,PlaneSize);
}

__inline void c2p_3(void *chunky, void *bitplanes, int chunkyx, int chunkyy, struct Soff *soff, int bitplanesize, int depth)
{
 extern struct Library *ChunkyPPCBase;
 c2p_3_(ChunkyPPCBase,chunky,bitplanes,chunkyx,chunkyy,soff,bitplanesize,depth);
}

__inline void c2p_4(void *chunky, UBYTE *Planar, UBYTE *temp, struct Soff *size, struct Soff *off, struct Soff *screensize)
{
 extern struct Library *ChunkyPPCBase;
 c2p_4_(ChunkyPPCBase,chunky,Planar,temp,size,off,screensize);
}

__inline void ChunkyNoffFastHT(UBYTE *address,UBYTE *data,int w,int h,int bpr,int gfx_type)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyNoffFastHT_(ChunkyPPCBase,address,data,w,h,bpr,gfx_type);
}

__inline void ChunkyNoffFastestHT(UBYTE *address,UBYTE *data,int w,int h,int bpr,int gfx_type)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyNoffFastestHT_(ChunkyPPCBase,address,data,w,h,bpr,gfx_type);
}

__inline void ChunkyNoffNormalHT(UBYTE *address ,UBYTE *data,int w,int h,int bpr,int gfx_type)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyNoffNormalHT_(ChunkyPPCBase,address,data,w,h,bpr,gfx_type);
}

__inline void ChunkyFastHT(UBYTE *address,UBYTE *data,struct Soff *off,int w,int h,int bpr,int gfx_type)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyFastHT_(ChunkyPPCBase,address,data,off,w,h,bpr,gfx_type);
}

__inline void ChunkyFastestHT(UBYTE *address,UBYTE *data,struct Soff *off,int w,int h,int bpr,int gfx_type)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyFastestHT_(ChunkyPPCBase,address,data,off,w,h,bpr,gfx_type);
}

__inline void ChunkyNormalHT(UBYTE *address,UBYTE *data,struct Soff *off,int w,int h,int bpr,int gfx_type)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyNormalHT_(ChunkyPPCBase,address,data,off,w,h,bpr,gfx_type);
}

__inline void ChunkyFastFullHT(UBYTE *address,UBYTE *data,struct Soff *dest,struct Soff *size,struct Soff *bpr,struct Soff *soff,int gfx_type)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyFastFullHT_(ChunkyPPCBase,address,data,dest,size,bpr,soff,gfx_type);
}

__inline void ChunkyFastestFullHT(UBYTE *address,UBYTE *data,struct Soff *dest,struct Soff *size,struct Soff *bpr, struct Soff *soff, int gfx_type)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyFastestFullHT_(ChunkyPPCBase,address,data,dest,size,bpr,soff,gfx_type);
}

__inline void ChunkyNormalFullHT(UBYTE *address,UBYTE *data,struct Soff *dest,struct Soff *size,struct Soff *bpr,struct Soff *soff, int gfx_type)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyNormalFullHT_(ChunkyPPCBase,address,data,dest,size,bpr,soff,gfx_type);
}

__inline void ChunkyNoffMask(struct Buffers *address,UBYTE *data,int w,int h,int bpr,int gfx_type)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyNoffMask_(ChunkyPPCBase,address,data,w,h,bpr,gfx_type);
}

__inline void ChunkyMask(struct Buffers *address,UBYTE *data,struct Soff *dest,int w,int h,int bpr,int gfx_type)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyMask_(ChunkyPPCBase,address,data,dest,w,h,bpr,gfx_type);
}

__inline void ChunkyMaskFull(struct Buffers *address,UBYTE *data,struct Soff *dest, struct Soff *size,struct Soff *bpr,struct Soff *soff, int gfx_type)
{
 extern struct Library *ChunkyPPCBase;
 ChunkyMaskFull_(ChunkyPPCBase,address,data,dest,size,bpr,soff,gfx_type);
}

#endif


