##### Shinobi Library - Memory Card Function

# buLoadFileEx

Loads a file (specifies initial block)

### FORMAT

`

  buLoadFileEx(drive, *fname, *buf, start, nblock)
  Sint32 drive
  const char *fname
  void *buf
  Uint32 start
  Uint32 nblock

`

### PARAMETER

  `drive` | Extension socket number
  `*fname` | File name
  `*buf` | Load address
  `start` | Load start block
  `nblock` | Number of blocks to be loaded

### RETURN

  BUD_ERR_OK | Processing request was accepted |
  BUD_ERR_BUSY | Processing request was not accepted because processing was in progess |

### DESCRIPTION

  Loads a file.

  The following values can be designated for the argument `drive` which specifies extension sockets.

  BUD_DRIVE_A1 | Extension socket 1 on board A
  BUD_DRIVE_A2 | Extension socket 2 on board A
  BUD_DRIVE_B1 | Extension socket 1 on board B
  BUD_DRIVE_B2 | Extension socket 2 on board B
  BUD_DRIVE_C1 | Extension socket 1 on board C
  BUD_DRIVE_C2 | Extension socket 2 on board C
  BUD_DRIVE_D1 | Extension socket 1 on board D
  BUD_DRIVE_D2 | Extension socket 2 on board D

  If "0" is specified for the load start block, the file is loaded from the beginning. If "0" is specified for the number of blocks to be loaded, the entire file is loaded.

### EXAMPLE

        Sint32 ret;
        Sint32 blocks;
        Sint32 start_block;
        extern char LoadBuffer[];  /* Load buffer */
        /* Partial file load */
        start_block = 0;
        blocks = 1;
        ret = buLoadFileEx(BUD_DRIVE_A1, "SAVEDATA_001", LoadBuffer, start_block, blocks);
        if (ret != BUD_ERR_OK) return NG;
        while (buStat(BUD_DRIVE_A1) == BUD_STAT_BUSY) {
        }
        if (buGetLastError(BUD_DRIVE_A1) != BUD_ERR_OK) return NG;
        return OK;

### NOTE

  The following are the completion statuses for this function that are obtained by `buStat():`

  BUD_ERR_OK | Normal end
  BUD_ERR_NO_DISK | Memory card not found
  BUD_ERR_UNFORMAT | Disk is not formatted
  BUD_ERR_FILE_NOT_FOUND | File not found
  BUD_ERR_CANNOT_OPEN | Cannot open file
  BUD_ERR_FILE_BROKEN | File is damaged

  A load generally requires (number of blocks being loaded x 1 Int). (This time requirement may vary, depending on the status of other drives, etc.) In addition, the address that is specified for `buf` must be on a four-byte boundary.

buLoadFileEx

COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999