Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Here is the "mcard.h" file.
- /* This file contains the declarations for mcard.c. */
- /* The maximum number of blocks in a memory card. */
- #define MCARD_MAX_BLOCKS 8192
- /* The size of a block in a memory card. */
- #define MCARD_BLOCK_SIZE 512
- /* The format of a memory card. */
- typedef enum
- {
- MCR, /* Memory Card Reader format */
- GME /* Game Shark Memory Manager format */
- } mcard_format_t;
- /* The data for a memory card. */
- typedef struct
- {
- mcard_format_t format; /* The format of the memory card */
- int blocks; /* The number of blocks in the memory card */
- uint8_t *data; /* The data for the memory card */
- } mcard_t;
- /* This function creates a new memory card. */
- mcard_t *mcard_new(mcard_format_t format, int blocks);
- /* This function frees a memory card. */
- void mcard_free(mcard_t *mc);
- /* This function reads a memory card from a file. */
- mcard_t *mcard_read(const char *filename);
- /* This function writes a memory card to a file. */
- int mcard_write(mcard_t *mc, const char *filename);
- /* This function formats a memory card. */
- int mcard_format(mcard_t *mc);
- /* This function gets a block of data from a memory card. */
- int mcard_get_block(mcard_t *mc, int block, uint8_t *data);
- /* This function sets a block of data in a memory card. */
- int mcard_set_block(mcard_t *mc, int block, uint8_t *data);
- /* This function gets the size of a file in a memory card. */
- int mcard_get_file_size(mcard_t *mc, const char *filename);
- /* This function reads a file from a memory card. */
- int mcard_
- /* This function reads a file from a memory card. */
- int mcard_read_file(mcard_t *mc, const char *filename, uint8_t *data);
- /* This function writes a file to a memory card. */
- int mcard_write_file(mcard_t *mc, const char *filename, uint8_t *data, int size);
- /* This function deletes a file from a memory card. */
- int mcard_delete_file(mcard_t *mc, const char *filename);
- /* This function prints the contents of a memory card. */
- void mcard_print(mcard_t *mc);
Advertisement
Add Comment
Please, Sign In to add comment