Shinobi Library - Memory Card Function

buMakeBackupFileImage

Gets file image

FORMAT

Sint32 buMakeBackupFileImage( *buf, *hdr )
void *buf
BUS_BACKUPFILEHEADER *hdr

PARAMETER

 *buf  Address where memory card file format image is to be created (4-byte boundary) 
 *hdr  Memory card file header address 

RETURN

 Positive value  Number of blocks used in the memory card file 
 BUD_ERR_INVALID_PARAM  Invalid header 

DESCRIPTION

Creates a memory card file format image in memory.

EXAMPLE

  extern Uint8 game_name[];     /* Game name (sort item) */
  extern Uint16 icon_palette[]; /* Icon palette data */
  extern Uint8 icon_data[];     /* Icon pixel data */
  extern Uint8 visual_data[];   /* Visual data */
  extern Uint8 save_data[];     /* Application save data */
  Sint32 nblock1, nblock2;
  void* buf;
  BUS_BACKUPFILEHEADER hdr;     /* Memory card file header */
  memset(&hdr, 0, sizeof(hdr));
  strcpy(hdr.vms_comment, "VMS_COMMENT");          /* VM comment setting */
  strcpy(hdr.btr_comment, "BOOT ROM full-character comment"); /* BOOT ROM comment setting */
  memcpy(hdr.game_name,   game_name, 16);          /* Game name (sort item) setting */
  hdr.icon_palette = icon_palette;                 /* Icon palette data setting */
  hdr.icon_data    = icon_data;                    /* Icon pixel data setting */
  hdr.icon_num     = 1;                            /* Number of icons setting */
  hdr.icon_speed   = 1;                            /* Icon speed setting */
  hdr.visual_data  = visual_data;                  /* Visual comment setting */
  hdr.visual_type  = BUD_VISUALTYPE_C;             /* Visual type setting */
  hdr.save_data    = save_data;                    /* Application save data */
  hdr.save_size    = 0x400;                        /* Application save data size */
  nblock = buCalcBackupFileSize(hdr.icon_num, hdr.visual_type, hdr.save_size);
  buf = syMalloc(nblock * 512); /* Allocates (the number of blocks to be used x 512 bytes) */
  if (buf == NULL) {
    /* Memory cannot be allocated */
    return NG;
  }
  nblock = buMakeBackupFileImage(buf, &hdr);
  if (nblock < 0) {
    /* Structure includes an invalid parameter */
    return NG;
  }

buMakeBackupFileImage
COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999