smc.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. #define DSPFW_1 ((const uint8_t*)"/sd2snes/dsp1.bin")
  23. #define DSPFW_2 ((const uint8_t*)"/sd2snes/dsp2.bin")
  24. #define DSPFW_3 ((const uint8_t*)"/sd2snes/dsp3.bin")
  25. #define DSPFW_4 ((const uint8_t*)"/sd2snes/dsp4.bin")
  26. #define DSPFW_1B ((const uint8_t*)"/sd2snes/dsp1b.bin")
  27. #define DSPFW_ST0010 ((const uint8_t*)"/sd2snes/st0010.bin")
  28. typedef struct _snes_header {
  29. uint8_t maker[2]; /* 0xB0 */
  30. uint8_t gamecode[4]; /* 0xB2 */
  31. uint8_t fixed_00[7]; /* 0xB6 */
  32. uint8_t expramsize; /* 0xBD */
  33. uint8_t specver; /* 0xBE */
  34. uint8_t carttype2; /* 0xBF */
  35. uint8_t name[21]; /* 0xC0 */
  36. uint8_t map; /* 0xD5 */
  37. uint8_t carttype; /* 0xD6 */
  38. uint8_t romsize; /* 0xD7 */
  39. uint8_t ramsize; /* 0xD8 */
  40. uint8_t destcode; /* 0xD9 */
  41. uint8_t licensee; /* 0xDA */
  42. uint8_t ver; /* 0xDB */
  43. uint16_t cchk; /* 0xDC */
  44. uint16_t chk; /* 0xDE */
  45. } snes_header_t;
  46. typedef struct _snes_romprops {
  47. uint16_t offset; /* start of actual ROM image */
  48. uint8_t mapper_id; /* FPGA mapper */
  49. uint8_t pad1; /* for alignment */
  50. uint32_t expramsize_bytes; /* ExpRAM size in bytes */
  51. uint32_t ramsize_bytes; /* CartRAM size in bytes */
  52. uint32_t romsize_bytes; /* ROM size in bytes (rounded up) */
  53. const uint8_t* necdsp_fw; /* NEC DSP ROM filename */
  54. uint8_t has_dspx; /* DSP[1-4] presence flag */
  55. uint8_t has_st0010; /* st0010 presence flag (additional to dspx)*/
  56. uint8_t has_msu1; /* MSU1 presence flag */
  57. uint8_t fpga_features; /* feature/peripheral enable bits*/
  58. snes_header_t header; /* original header from ROM image */
  59. } snes_romprops_t;
  60. void smc_id(snes_romprops_t*);
  61. uint8_t smc_headerscore(snes_header_t*);
  62. #endif