mgd.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /*
  2. mgd.h - Multi Game Doctor/Hunter support for uCON64
  3. Copyright (c) 1999 - 2001 NoisyB
  4. Copyright (c) 2002 - 2004 dbjh
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. */
  17. #ifndef MGD_H
  18. #define MGD_H
  19. #include <stdio.h>
  20. #include "misc/getopt2.h" // st_getopt2_t
  21. #define MGD_HEADER_START 0
  22. #define MGD_HEADER_LEN 512
  23. extern const st_getopt2_t mgd_usage[];
  24. /*
  25. The MGD2 only accepts certain filenames, and these filenames
  26. must be specified in an index file, "MULTI-GD", otherwise the
  27. MGD2 will not recognize the file. In the case of multiple games
  28. being stored on a single disk, simply enter its corresponding
  29. MULTI-GD index into the "MULTI-GD" file.
  30. Thanks to acem77 for the (verified) list below.
  31. Super Famicom:
  32. game size # of files names MULTI-GD
  33. ================================================================
  34. 1M 1 SF1XXX#.048 SF1XXX#
  35. 2M 1 SF2XXX#.048 SF2XXX#
  36. 4M 1 SF4XXX#.048 SF4XXX#
  37. 4M 2 SF4XXXxA.078 SF4XXXxA
  38. SF4XXXxB.078 SF4XXXxB
  39. 8M 1 SF8XXX#.058 SF8XXX#
  40. 2 SF8XXXxA.078 SF8XXXxA
  41. SF8XXXxB.078 SF8XXXxB
  42. 10M 1 SF10XXX#.078 SF10XXX#
  43. 2 SF10XXX#.078 SF10XXX#
  44. SF10XXX#.078 SF10XXX#
  45. 12M 1 SF12XXX#.078 SF12XXX#
  46. 2 SF12XXX#A.078 SF12XXX#B
  47. SF12XXX#B.078 SF12XXX#A
  48. 16M 1 SF16XXX#.078 SF16XXX#
  49. 16M 2 SF16XXX#A.078 SF16XXX#A
  50. SF16XXX#B.078 SF16XXX#B
  51. 20M 1 SF20XXX#.078 SF20XXX#
  52. 3 SF20XXX#A.078 SF20XXX#A
  53. SF20XXX#B.078 SF20XXX#B
  54. SF20XXX#C.078 SF20XXX#C
  55. 24M 1 SF24XXX#.078 SF24XXX#
  56. 24M 3 SF24XXX#A.078 SF24XXX#A
  57. SF24XXX#B.078 SF24XXX#B
  58. SF24XXX#C.078 SF24XXX#C
  59. 32M 1 SF32XXX#.078 SF32XXX#
  60. 32M 4 SF32XXX#A.078 SF32XXX#A
  61. SF32XXX#B.078 SF32XXX#B
  62. SF32XXX#C.078 SF32XXX#C
  63. SF32XXX#D.078 SF32XXX#D
  64. Mega Drive:
  65. game size # of files names MULTI-GD
  66. ================================================================
  67. 1M 1 MD1XXX#.000 MD1XXX#
  68. 2M 1 MD2XXX#.000 MD2XXX#
  69. 4M 1 MD4XXX#.000 MD4XXX#
  70. 8M 1 MD8XXX#.008 MD8XXX#
  71. 16M 2 MD16XXX#A.018 MD16XXX#A
  72. MD16XXX#B.018 MD16XXX#B
  73. 20M 3 MD20XXX#A.038 MD20XXX#A
  74. MD20XXX#B.038 MD20XXX#B
  75. MD20XXX#C.038 MD20XXX#C
  76. 24M 3 MD24XXX#A.038 MD24XXX#A
  77. MD24XXX#B.038 MD24XXX#B
  78. MD24XXX#C.038 MD24XXX#C
  79. 32M 4 MD32XXX#A.038 MD32XXX#A
  80. MD32XXX#B.038 MD32XXX#B
  81. MD32XXX#C.038 MD32XXX#C
  82. MD32XXX#D.038 MD32XXX#D
  83. PC-Engine:
  84. game size # of files names MULTI-GD
  85. ================================================================
  86. 1M 1 PC1XXX#.040 PC1XXX#
  87. 2M 1 PC2XXX#.040 PC2XXX#
  88. 3M 1 PC3XXX#.030 PC2XXX#
  89. 4M 1 PC4XXX#.048 PC4XXX#
  90. 6M 1 PC6XXX#.058 PC6XXX#
  91. 8M 1 PC8XXX#.058 PC8XXX#
  92. Sega Master System:
  93. game size # of files names MULTI-GD
  94. ================================================================
  95. less than 1M 1 GG0XXX#.060 GG0XXX#
  96. 1M 1 GG1XXX#.060 GG1XXX#
  97. 2M 1 GG2XXX#.060/70 GG2XXX#
  98. 3M 1 GG3XXX#.078 GG2XXX#
  99. 4M 1 GG4XXX#.078/68 GG4XXX#
  100. 6M 1 GG6XXX#.078 GG6XXX#
  101. 8M 1 GG8XXX#.078 GG8XXX#
  102. Game Gear:
  103. game size # of files names MULTI-GD
  104. ================================================================
  105. less than 1M 1 GG0XXX#.040 GG0XXX#
  106. 1M 1 GG1XXX#.040 GG1XXX#
  107. 2M 1 GG2XXX#.050/40 GG2XXX#
  108. 3M 1 GG3XXX#.048 GG2XXX#
  109. 4M 1 GG4XXX#.058/48 GG4XXX#
  110. 6M 1 GG6XXX#.078 GG6XXX#
  111. 8M 1 GG8XXX#.078 GG8XXX#
  112. Game Boy:
  113. game size # of files names MULTI-GD
  114. ================================================================
  115. less than 1M 1 GB0XXX#.040 GB0XXX#
  116. 1M 1 GB1XXX#.040 GB1XXX#
  117. 2M 1 GB2XXX#.040/60 GB2XXX#
  118. 3M 1 GB3XXX#.030 GB2XXX#
  119. 4M 1 GB4XXX#.048 GB4XXX#
  120. 6M 1 GB6XXX#.058 GB6XXX#
  121. 8M 1 GB8XXX#.058 GB8XXX#
  122. Contrary to popular belief the Game Doctor SF3/SF6/SF7 *does*
  123. use a 512 byte header like the SWC, but it also accepts
  124. headerless files.
  125. A header is necessary when things like SRAM size must be made
  126. known to the Game Doctor. The Game Doctor also uses specially
  127. designed filenames to distinguish between multi files.
  128. Usually, the filename is in the format of: SFXXYYYZ.078
  129. Where SF means Super Famicom, XX refers to the size of the
  130. image in Mbit. If the size is only one character (i.e. 2, 4 or
  131. 8 Mbit) then no leading "0" is inserted.
  132. YYY refers to a catalogue number in Hong Kong shops
  133. identifying the game title. (0 is Super Mario World, 1 is F-
  134. Zero, etc). I was told that the Game Doctor copier produces a
  135. random number when backing up games.
  136. Z indicates a multi file. Like XX, if it isn't used it's
  137. ignored.
  138. A would indicate the first file, B the second, etc. I am told
  139. 078 is not needed, but is placed on the end of the filename by
  140. systems in Asia.
  141. e.g. The first 8 Mbit file of Donkey Kong Country (assuming it
  142. is cat. no. 475) would look like: SF32475A.078
  143. */
  144. // the following four functions are used by non-transfer code in genesis.c
  145. extern void mgd_interleave (unsigned char **buffer, int size);
  146. extern void mgd_deinterleave (unsigned char **buffer, int data_size,
  147. int buffer_size);
  148. extern int fread_mgd (void *buffer, size_t size, size_t number, FILE *fh);
  149. extern int q_fread_mgd (void *buffer, size_t start, size_t len,
  150. const char *filename);
  151. extern void mgd_make_name (const char *filename, int console, int size,
  152. char *name);
  153. extern void mgd_write_index_file (void *ptr, int n_names);
  154. #endif