#include "sgl.h" // Required for basic sgl functions
#include "sgl_cd.h" // Required for cd access
#include "stdlib.h" // Don't know why I need this...don't feel like burning another cd to find out
#include "fld_load.h"
#define MAX_FILE 128 // Needed for CD functions
#define READSECT 50 // Needed for CD functions
Sint32 dirwork[SLCD_WORK_SIZE(MAX_FILE)/sizeof(Sint32)]; // Needed for CD function
//Uint8 readbuf[(READSECT*CDBUF_FORM1/sizeof(Uint8))]; // Needed for CD function
void ss_main(void)
{
void (*readbuf)(void);
Sint32 ndir;
CDHN cdhn;
CDKEY key[2];
CDBUF buf[2];
Sint32 stat;
Sint32 len[2];
Sint32 ypos=1;
readbuf = (void*)0x0200000;
slInitSystem(TV_320x224, NULL, 1); // Initializes screen
ndir=slCdInit(MAX_FILE, dirwork); // initializes cd
slPrint("SlCdInit:", slLocate(1, ypos));
slPrintFX(toFIXED(ndir), slLocate(11, ypos));
ypos++;
key[0].cn=key[0].sm=key[0].ci=CDKEY_NONE;
key[1].cn=CDKEY_TERM;
cdhn=slCdOpen("fld_knl.bin", key); // opens cd
slPrint("slCdOpen:", slLocate(1,ypos));
slDispHex((Uint32)cdhn, slLocate(11, ypos));
buf[0].type=CDBUF_COPY;
buf[0].trans.copy.addr=readbuf;
buf[0].trans.copy.unit=CDBUF_FORM1;
buf[0].trans.copy.size=READSECT;
buf[1].type=CDBUF_TERM;
slCdLoadFile(cdhn,buf); // loads file from cd
ypos++;
while(stat=CDSTAT_COMPLETED)
{
slSynch();
stat=slCdGetStatus(cdhn, len);
slPrint("stat:", slLocate(1, ypos));
slDispHex((Uint32)stat, slLocate(7, ypos));
ypos++;
if(ypos>=27) ypos=1;
if(stat==CDSTAT_COMPLETED) break;
if(len[0]==CDBUF_FORM1* READSECT)
{
slCdResetBuf(cdhn, &(key[0]));
}
}
slPrint("Bin final test loaded......................", slLocate(1,ypos));
FLD_ExecGame("GAMEIP.BIN", "DEATH", 1);
//Sint32 FLD_ExecGame(Sint8 *ip_name, Sint8 *dir_name, Sint32 tno);
slPrint("Exit...", slLocate(1,ypos));
while(1)
{
slSynch();
}
}