smc.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* sd2snes - SD card based universal cartridge for the SNES
  2. Copyright (C) 2009-2010 Maximilian Rehkopf <otakon@gmx.net>
  3. AVR firmware portion
  4. Inspired by and based on code from sd2iec, written by Ingo Korb et al.
  5. See sdcard.c|h, config.h.
  6. FAT file system access based on code by ChaN, Jim Brain, Ingo Korb,
  7. see ff.c|h.
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; version 2 of the License only.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. smc.h: SMC file structures
  19. */
  20. #ifndef SMC_H
  21. #define SMC_H
  22. typedef struct _snes_header {
  23. uint8_t maker[2]; // 0xB0
  24. uint8_t gamecode[4]; // 0xB2
  25. uint8_t fixed_00[7]; // 0xB6
  26. uint8_t expramsize; // 0xBD
  27. uint8_t specver; // 0xBE
  28. uint8_t carttype2; // 0xBF
  29. uint8_t name[21]; // 0xC0
  30. uint8_t map; // 0xD5
  31. uint8_t carttype; // 0xD6
  32. uint8_t romsize; // 0xD7
  33. uint8_t ramsize; // 0xD8
  34. uint8_t destcode; // 0xD9
  35. uint8_t fixed_33; // 0xDA
  36. uint8_t ver; // 0xDB
  37. uint16_t cchk; // 0xDC
  38. uint16_t chk; // 0xDE
  39. } snes_header_t;
  40. typedef struct _snes_romprops {
  41. uint16_t offset; // start of actual ROM image
  42. uint8_t mapper_id; // FPGA mapper
  43. uint8_t pad1; // for alignment
  44. uint32_t expramsize_bytes; // ExpRAM size in bytes
  45. uint32_t ramsize_bytes; // CartRAM size in bytes
  46. uint32_t romsize_bytes; // ROM size in bytes (rounded up)
  47. snes_header_t header; // original header from ROM image
  48. } snes_romprops_t;
  49. void smc_id(snes_romprops_t*);
  50. uint8_t smc_headerscore(snes_header_t*);
  51. #endif