Need help in using gfs library functions

Hello!

Tryed to wrote simple proggy which load files into cd to memory array, but got problems.

here is the cut from it, which crash the ssf emu (and without GFS_Open/Close it works fine - but seems, that it really didn do anything with readme.txt, which i included on cd, fid still always the same even if i use wrong file name - "eadmi.txt" for example):

fid = GFS_NameToId("readme.txt");

gfs = GFS_Open(fid);

GFS_Close(gfs);

while(1){

slSynch();

}

What's wrong? Can somebody provide me with simple example on how to load file (says, file.bin) from cd into any memory array - says, unsigned char VMEM[[0x8000]. (we need to use gfs_nametoid, gfs_open, gfs_fread??)

Thank you.
 
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)
 
Hi!

Thank you for help!

Today will try your code. Btw, i checked your another sample on Stardust board - and it's takes forever with "Loading ROM...." message.
 
About GFS_Init. hehe, seems i forgot to use it.. But, info on GFS_Init from sega_gfs.h is not enough for me :(

Did you ever tryed to use GFS functions?
 
No, never used it. But as I dont have all the saturn PDF's, i guessed you were using more than the .txt file. That file doesn't help mutch, because it makes no mention of the structure he uses to store the CD atributes. As far as the sample from stardust, this one is more contained :) i hope. Don't forget to use ALL CAPS for the name of the file.
 
Back
Top