34 #ifndef __JO_SGL_PROTOTYPES_H__
35 # define __JO_SGL_PROTOTYPES_H__
37 #if !JO_COMPILE_USING_SGL
48 #define VDP2_VRAM_A0 0x25e00000
49 #define VDP2_VRAM_A1 0x25e20000
50 #define VDP2_VRAM_B0 0x25e40000
51 #define VDP2_VRAM_B1 0x25e60000
53 #define VDP2_COLRAM 0x25f00000
54 #define CHAR_SIZE_1x1 0
56 #define COL_TYPE_256 0x10
58 #define KTBL0_RAM VDP2_VRAM_A1
59 #define BACK_CRAM (KTBL0_RAM + 0x1fffe)
65 #define PER_ID_NotConnect 0xff
66 #define PER_ID_StnPad 0x02
67 #define PER_ID_StnMouse 0x23
68 #define PER_ID_ShuttleMouse 0xe3
69 #define PER_ID_ExtKeyBoard 0x30
70 #define PER_ID_StnKeyBoard 0x34
72 #define toFIXED(a) ((FIXED)(65536.0 * (a)))
73 #define POStoFIXED(x,y,z) {toFIXED(x),toFIXED(y),toFIXED(z)}
74 #define NORMAL(x,y,z) {POStoFIXED(x,y,z)
75 #define VERTICES(v0,v1,v2,v3) {v0 , v1 , v2 , v3}}
76 #define C_RGB(r,g,b) (((b)&0x1f)<<10|((g)&0x1f)<<5|((r)&0x1f)|0x8000)
78 #define No_Window (0 << 9)
79 #define Window_In (2 << 9)
80 #define Window_Out (3 << 9)
81 #define ECdis (1 << 7)
83 #define SPdis (1 << 6)
85 #define sprPolygon (FUNC_Polygon | ((ECdis | SPdis) << 24))
87 #define FUNC_Texture 2
88 #define FUNC_Polygon 4
89 #define FUNC_PolyLine 5
91 #define MESHon (1 << 8)
92 #define CL32KRGB (5 << 3)
94 #define UseTexture (1 << 2)
95 #define UseLight (1 << 3)
96 #define UsePalette (1 << 5)
103 #define sprNoflip ((0) | FUNC_Texture | (UseTexture << 16))
105 typedef unsigned char Uint8 ;
106 typedef signed char Sint8 ;
107 typedef unsigned short Uint16 ;
108 typedef signed short Sint16 ;
109 typedef unsigned long Uint32 ;
110 typedef signed long Sint32 ;
112 typedef float Float32 ;
114 enum ps {X, Y, Z, XYZ, XYZS, XYZSS, XY = Z, S = XYZ, Sh = S, Sv = XYZS} ;
129 typedef Sint16 ANGLE ;
130 typedef Sint32 FIXED ;
131 typedef FIXED MATRIX[4][3] ;
132 typedef FIXED VECTOR[XYZ] ;
133 typedef FIXED POINT[XYZ] ;
138 #define _PCM16Bit 0x00
139 #define _PCM8Bit 0x10
270 TV_320x224, TV_320x240, TV_320x256, TV_dummy1,
271 TV_352x224, TV_352x240, TV_352x256, TV_dummy2,
272 TV_640x224, TV_640x240, TV_640x256, TV_dummy3,
273 TV_704x224, TV_704x240, TV_704x256, TV_dummy4,
275 TV_320x448, TV_320x480, TV_320x512, TV_dummy5,
276 TV_352x448, TV_352x480, TV_352x512, TV_dummy6,
277 TV_640x448, TV_640x480, TV_640x512, TV_dummy7,
278 TV_704x448, TV_704x480, TV_704x512, TV_dummy8
282 #define PNB_1WORD 0x8000
284 #define CN_12BIT 0x4000
285 #define COL_TYPE_32768 0x30
287 #define PL_SIZE_1x1 0
288 #define PL_SIZE_2x1 1
289 #define PL_SIZE_2x2 3
291 #define NBG0ON (1<<0)
292 #define NBG1ON (1<<1)
294 #define BM_512x256 0x02
295 #define BM_512x512 0x06
296 #define BM_1024x256 0x0a
297 #define BM_1024x512 0x0e
299 extern void slCurColor(Uint16) ;
300 extern PerDigital* Smpc_Peripheral;
301 extern Uint8 Per_Connect1, Per_Connect2;
302 extern void slPlaneNbg1(Uint16) ;
303 extern void slUnitMatrix(MATRIX) ;
304 extern Bool slDispSprite(FIXED *, SPR_ATTR *attr, ANGLE) ;
305 extern void slScrPosNbg1(FIXED x,FIXED y) ;
306 extern void slZoomNbg1(FIXED x,FIXED y) ;
307 extern void slDMACopy(
void *,
void *, Uint32) ;
308 extern void slBack1ColSet(
void *, Uint16) ;
309 extern void slCharNbg0(Uint16 type,Uint16 size) ;
310 extern void slCharNbg1(Uint16 type,Uint16 size) ;
311 extern void slTVOn(
void) ;
312 extern void slPageNbg1(
void *,
void *,Uint16) ;
313 extern void slMapNbg1(
void *,
void *,
void *,
void *) ;
314 extern void slPrint(
char *,
void *) ;
315 extern void slBitMapNbg1(Uint16, Uint16,
void *) ;
316 extern void slTVOff(
void) ;
317 extern Bool slScrAutoDisp(Uint32) ;
318 extern void slInitSystem(Uint16, TEXTURE *, Sint8) ;
319 extern void slSynch(
void) ;
320 extern void slPriority(Sint16, Uint16) ;
321 extern void *slLocate(Uint16, Uint16) ;
325 extern void slLookAt(FIXED *camera, FIXED *target, ANGLE) ;
326 extern void slLight(VECTOR) ;
327 extern Bool slPushMatrix(
void) ;
328 extern Bool slPopMatrix(
void) ;
329 extern void slRotX(ANGLE) ;
330 extern void slRotY(ANGLE) ;
331 extern void slRotZ(ANGLE) ;
332 extern void slScale(FIXED, FIXED, FIXED) ;
333 extern Bool slPutPolygon(PDATA *) ;
334 extern Bool slWindow(Sint16, Sint16, Sint16, Sint16, Sint16, Sint16, Sint16) ;
335 extern void slPerspective(ANGLE) ;
336 extern void slTranslate(FIXED, FIXED, FIXED) ;
337 extern void slZdspLevel(Uint16) ;
339 extern Bool slRequestCommand(Uint8, Uint8);
341 #define CDC_POS_PTYPE(pos) ((pos)->ptype)
342 #define CDC_POS_FAD(pos) ((pos)->pbody.fad)
343 #define CDC_POS_TNO(pos) ((pos)->pbody.trkidx.tno)
344 #define CDC_POS_IDX(pos) ((pos)->pbody.trkidx.idx)
346 #define CDC_PLY_START(ply) ((ply)->start)
347 #define CDC_PLY_END(ply) ((ply)->end)
348 #define CDC_PLY_PMODE(ply) ((ply)->pmode)
350 #define CDC_PLY_STYPE(ply) CDC_POS_PTYPE(&CDC_PLY_START(ply))
351 #define CDC_PLY_SFAD(ply) CDC_POS_FAD(&CDC_PLY_START(ply))
352 #define CDC_PLY_STNO(ply) CDC_POS_TNO(&CDC_PLY_START(ply))
353 #define CDC_PLY_SIDX(ply) CDC_POS_IDX(&CDC_PLY_START(ply))
355 #define CDC_PLY_ETYPE(ply) CDC_POS_PTYPE(&CDC_PLY_END(ply))
356 #define CDC_PLY_EFAS(ply) CDC_POS_FAD(&CDC_PLY_END(ply))
357 #define CDC_PLY_ETNO(ply) CDC_POS_TNO(&CDC_PLY_END(ply))
358 #define CDC_PLY_EIDX(ply) CDC_POS_IDX(&CDC_PLY_END(ply))
360 #define CDC_SM_EOR 0x01
361 #define CDC_SM_VIDEO 0x02
362 #define CDC_SM_AUDIO 0x04
363 #define CDC_SM_DATA 0x08
364 #define CDC_SM_TRIG 0x10
365 #define CDC_SM_FORM 0x20
366 #define CDC_SM_RT 0x40
367 #define CDC_SM_EOF 0x80
369 #define CDC_PM_DFL 0x00
373 #define GFS_ERR_CDRD (-1)
374 #define GFS_ERR_CDNODISC (-2)
375 #define GFS_ERR_CDROM (-3)
376 #define GFS_ERR_DIRTBL (-4)
377 #define GFS_ERR_OPENMAX (-5)
378 #define GFS_ERR_DIR (-6)
379 #define GFS_ERR_CDBFS (-7)
381 #define GFS_ERR_NONAME (-8)
382 #define GFS_ERR_NEXIST (-9)
383 #define GFS_ERR_FID (-10)
384 #define GFS_ERR_HNDL (-11)
385 #define GFS_ERR_SEEK (-12)
386 #define GFS_ERR_ORG (-13)
387 #define GFS_ERR_NUM (-14)
388 #define GFS_ERR_OFS (-15)
389 #define GFS_ERR_FBUSY (-16)
390 #define GFS_ERR_PARA (-17)
391 #define GFS_ERR_BUSY (-18)
392 #define GFS_ERR_NOHNDL (-19)
393 #define GFS_ERR_PUINUSE (-20)
394 #define GFS_ERR_ALIGN (-21)
395 #define GFS_ERR_TMOUT (-22)
396 #define GFS_ERR_CDOPEN (-23)
397 #define GFS_ERR_BFUL (-24)
398 #define GFS_ERR_FATAL (-25)
407 CDC_ST_STANDBY = 0x02,
412 CDC_ST_NODISC = 0x07,
471 extern void slInitSound(Uint8 *, Uint32, Uint8 *, Uint32) ;
472 extern Bool slCDDAOn(Uint8, Uint8, Sint8, Sint8) ;
473 extern Sint8 slPCMOn(PCM *,
void *, Uint32) ;
474 extern Bool slPCMOff(PCM *) ;
475 extern Sint8 slSndPCMNum() ;
476 extern void slSndFlush() ;
477 extern Bool slPCMStat(PCM *) ;
478 extern Bool slSndVolume(Uint8) ;
480 Sint32 CDC_CdPlay(CdcPly *ply);
481 Sint32 CDC_CdSeek(CdcPos *pos);
482 Sint32 CDC_CdInit(Sint32 iflag, Sint32 stnby, Sint32 ecc, Sint32 retry);
513 typedef Sint32 (*GfsTransFunc)(
void *obj, Sint32 nsct);
604 typedef GfsDataPack *GfdpHn;
630 typedef GfsTrans *GftrHn;
643 #define GFS_FNAME_LEN 12
658 Sint8 fname[GFS_FNAME_LEN];
676 typedef GfsFile *GfsHn;
678 #define GFS_FTYPE_NR 3
679 #define GFS_SCTBUF_SIZ 2048
680 #define GFS_OPEN_MAX 24
681 #define GFS_FCONQ_MAX 24
684 typedef void (*GfsErrFunc)(
void *obj, Sint32 ec);
694 #define GFS_CDBBUF_NR 24
695 #define GFS_SELQ_MAX 24
706 GFS_SVR_COMPLETED = 0,
752 Sint8 use_buf[GFS_CDBBUF_NR];
753 Sint8 use_filt[GFS_CDBBUF_NR];
759 void (*func)(
void *);
766 GfcdSelQu selq[GFS_SELQ_MAX];
773 GfcdFconQu fconq[GFS_FCONQ_MAX];
832 GfsHn access_file[GFS_OPEN_MAX];
846 Sint32 (*flowin)(GfsFlow *);
847 void (*stopin)(GfsFlow *, Bool);
848 Sint32 (*seek)(GfsFlow *, Sint32);
849 Sint32 (*tell)(GfsFlow *);
857 GfsFileFunc functbl[GFS_FTYPE_NR];
870 Uint8 sect_buf[GFS_SCTBUF_SIZ];
874 #define GFS_WORK_SIZE(open_max) \
875 (sizeof(GfsMng) + ((open_max) - 1) * sizeof(GfsFile))
876 #define GFS_DIRTBL_TYPE(dirtbl) ((dirtbl)->type)
877 #define GFS_DIRTBL_DIRNAME(dirtbl) ((dirtbl)->dir.dir_n)
878 #define GFS_DIRTBL_NDIR(dirtbl) ((dirtbl)->ndir)
881 Sint32 GFS_Init(Sint32 open_max,
void *work, GfsDirTbl *dirtbl);
883 Sint32 GFS_NwFread(GfsHn gfs, Sint32 nsct,
void *buf, Sint32 bsize);
885 Sint32 GFS_NwExecOne(GfsHn gfs);
887 Sint32 GFS_Fread(GfsHn gfs, Sint32 nsct,
void *buf, Sint32 bsize);
889 void GFS_NwGetStat(GfsHn gfs, Sint32 *amode, Sint32 *ndata);
891 GfsHn GFS_Open(Sint32 fid);
893 void GFS_Close(GfsHn gfs);
894 void GFS_GetFileSize(GfsHn gfs, Sint32 *sctsz, Sint32 *nsct, Sint32 *lstsz);
895 Sint32 GFS_NwCdRead(GfsHn gfs, Sint32 nsct);
896 Sint32 GFS_SetTransPara(GfsHn gfs, Sint32 tsize);
897 Sint32 GFS_SetReadPara(GfsHn gfs, Sint32 nsct);
898 Sint32 GFS_SetTmode(GfsHn gfs, Sint32 tmode);
900 Sint32 GFS_LoadDir(Sint32 fid, GfsDirTbl *dirtbl);
901 Sint32 GFS_SetDir(GfsDirTbl *dirtbl);
902 Sint32 GFS_NameToId(Sint8 *fname);
903 Sint32 GFS_Load(Sint32 fid, Sint32 ofs,
void *buf, Sint32 bsize);
904 Sint32 GFS_Seek(GfsHn gfs, Sint32 ofs, Sint32 org);
940 extern void slIntFunction(
void (*func)()) ;
941 extern Uint8 slGetLanguage(
void);
943 extern SmpcStatus* Smpc_Status;
944 #define slGetStatus() slRequestCommand(SMPC_GETSTS, SMPC_NO_WAIT)
947 #define COL_256 (2+0)
948 #define COL_32K (2-1)
950 #define SPR_ATTRIBUTE(t,c,g,a,d) {t,(a)|(((d)>>24)&0xc0),c,g,(d)&0x0f3f}
951 #define FUNC_Sprite 1
952 #define CL256Bnk (4 << 3)
954 #define SpriteVRAM 0x25c00000
956 #define CGADDRESS 0x10000
957 #define AdjCG(cga,hs,vs,col) ((cga) + (((((hs)*(vs)*4)>>(col))+0x1f) &0x7ffe0))
958 #define TEXTBL(hs,vs,cga) {hs , vs , (cga)>>3 , ((hs)&0x1f8)<<5|(vs)}
959 #define PICTBL(texno,cmode,pcsrc) {(Uint16)(texno),(Uint16)(cmode),(void *)(pcsrc)}
969 #include <SEGA_CDC.H>
970 #include <SEGA_GFS.H>