Japanese
PROGRAMMER'S GUIDEFile system library
BackForward
file system library

6.Other features


6.1 Development support functions

The file system provides the ability to access memory files and DOS files as a support function during debugging. This function allows you to access files that have not yet been created on the CD-ROM or files that have been modified after the CD-ROM was created, just like files on the CD-ROM. However, this feature cannot be used in conjunction with CDBFS.
The mechanism that allows debug files to be accessed in the same way as files on a CD-ROM lies in the directory information reading process.
When reading directory information from the CD-ROM, it also reads directory information from the debug file. The information in the debug file is processed to replace or add to the information in the CD-ROM file.
After reading directory information from a certain directory on the CD-ROM, the following processing occurs.

(1) Replacement
For a debug file with the same name as a CD-ROM file, directory information is set in the directory information storage area instead of the corresponding CD-ROM file.

(2) Add
Debug files that are not replaced are added to the directory information storage area.
Memory files have higher priority than DOS files when replacing debug files.
The following is an example of how these processes occur. Figure 6.1 shows the file structure.

Figure 6.1 File structure example

Table 6.1 shows the results of obtaining directory information for DIR1 with that file structure, and Table 6.2 shows the results of obtaining directory information for DIR2.

Table 6.1 Directory information for DIR1
 Obtained directory information
 CD-ROM
 DOS
 SIMM
 .
 .
 ..
 ..
 FILE1
 FILE1×
 FILE1×
 FILE1
 FILE2
 FILE2
 FILE3
 FILE3
 FILE4
 FILE4
 DOS_FILE
 DOS_FILE
 SIMMFILE
 SIMMFILE
The × mark indicates that it has been replaced.

Table 6.2 Directory information for DIR2
 Obtained directory information
 CD-ROM
 DOS
 SIMM
 .
 .
 ..
 ..
 FILE4
 FILE4×
 FILE4
 FILE5
 FILE5
 FILE6
 FILE6
 FILE1
 FILE1×
 FILE1
 DOS_FILE
 DOS_FILE
 SIMMFILE
 SIMMFILE
The × mark indicates that it has been replaced.

As shown in the example above, debug files are replaced and added to all directories on the CD-ROM.

6.2 Error handling functions

By registering an error handling function, you can specify that the error handling function be called if an error occurs while executing a library function. In the initial state, no error handling functions are registered.
When an error occurs, the error handling function is executed using the following call format:

void *(func)(void *obj, Sint32 err); /* Error handling function */
void *obj; /* Pointer to registered object */
Sint32 err_code; /* Error code that occurred */
(*func)(obj, err_code); /* Error handling function call */

When the error handling function returns, the library function returns control to the application side with the error code as the function value.

6.3 Multiprocessing

Prohibits multiple processing due to interrupts, etc. When executing in both main processing and interrupt processing, perform exclusive processing on the calling side.

(1) Main processing in progress
Wait until the called function no longer returns GFS_ERR_BUSY, or postpone calling this library function until the next opportunity.

(2) Interrupt processing in progress
Defers calling this library function until the next opportunity.

6.4 CD-DA file processing function

When a CD-DA file is loaded, the music track specified in that file will be played.
However, to output sound, you need to configure SCSP on the application side.

(1) Control over files
The only control the file system has on CD-DA files is playback and playback range control. The playback mode is the default value (no repeat, moving pickup).

(2) How to play
There are the following methods to play CD-DA files.

  1. GFS_Load
  2. GFS_Fread
  3. GFS_NwFread
  4. GFS_NwCdRead

With methods (a) and (b), it will not return until playback is finished.
Methods (c) and (d) require calling a server function. When the CD-DA has finished playing, the server function returns GFS_SVR_COMPLETED.
Use GFS_Seek to play from the middle. CD-DA files and CD-ROM files cannot be accessed at the same time.

(3) Parameters related to file operations
The eject mode, transfer mode, read parameters, and eject parameters cannot be changed for CD-DA files. Calling the following function for a CD-DA file will return an error.

6.5 DDS system compatible

The file system supports functionality for DDS (Direct Dispatch System).
Programs created as a product version can be executed as is as a DDS version.
In order to run the created program as the DDS version, the following restrictions must be taken into consideration when coding.

  1. To play a CD-DA, the track number is converted using the GFS_ConvTno function, and the CDC_CdPlay function is used by specifying the track number of the CD communication interface.
    Do not use immediate track numbers or CD-DA files.
  2. Immediate FADs must not be used when accessing CDs.
  3. The maximum depth of a directory is 7 including the root directory.

BackForward
PROGRAMMER'S GUIDEFile system library
Copyright SEGA ENTERPRISES, LTD., 1997