An emulator, assembler, and disassembler for the Sega Game Gear
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

31 lignes
687 B

  1. /* Copyright (C) 2014 Ben Kurtovic <ben.kurtovic@gmail.com>
  2. Released under the terms of the MIT License. See LICENSE for details. */
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include "rom.h"
  6. /* Create and return a ROM object located at the given path. Return NULL if
  7. there was an error; errno will be set appropriately. */
  8. rom_type* open_rom(char *path)
  9. {
  10. rom_type *rom;
  11. FILE* fp;
  12. if (!(fp = fopen(path, "r")))
  13. return NULL;
  14. if (!(rom = malloc(sizeof(rom_type))))
  15. return NULL;
  16. // load data from file into a buffer
  17. return rom;
  18. }
  19. /* Free a ROM object previously created with open_rom(). */
  20. void close_rom(rom_type *rom)
  21. {
  22. free(rom);
  23. }