|
Hu, I don't use GFS... here's a sample all purpose file loading function I coded, based off SGL.
Code:
| | // Library fileload - Load a file to memory
// by Omoto Takashi 2001
// void LoadFile(char *name, Uint8 *location, Uint32 size)
//
// name = file location
// location = pointer do data you want to assign
// size = size in bytes of file / 2048 = number of CD
//sectors to read.
#include "sgl.h"
#include "sgl_cd.h"
#include "fileload.h"
#defineMAX_FILE128
void LoadFile(char *name, Uint8 *location, Uint32 size){
Sint32dirwork[SLCD_WORK_SIZE(MAX_FILE)];
Sint32ndir;
CDHNcdhn;
CDKEYkey[2];
CDBUFbuf[2];
Sint32stat;
Sint32len[2];
ndir = slCdInit(MAX_FILE, dirwork);
key[0].cn = key[0].sm = key[0].ci = CDKEY_NONE;
key[1].cn = CDKEY_TERM;
cdhn = slCdOpen(name, key);
buf[0].type = CDBUF_COPY;
buf[0].trans.copy.addr = location;
buf[0].trans.copy.unit = CDBUF_FORM1;
buf[0].trans.copy.size = size;
buf[1].type = CDBUF_TERM;
slCdLoadFile(cdhn, buf);
while (1) {
slSynch();
stat = slCdGetStatus(cdhn, len);
if (stat == CDSTAT_COMPLETED)break;
}
} |
As for GFS, i'm only guessing, but how is your GFS_Init function defined?
That piece of code seems deadly spare, all file loading functions i've seen have a cycle that waits for the file to be completely loaded, for example (it's a DMA transfer, so you can use the processor to display graphics or just loop in idle, like mine) |