EXE_Offsets.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. using System.Collections.Generic;
  2. using System.IO;
  3. namespace OpenVIII
  4. {
  5. public class EXE_Offsets
  6. {
  7. public static readonly Dictionary<int, uint[]> STRINGS = new Dictionary<int, uint[]> {
  8. { 2013, new uint[]
  9. {
  10. //Start with Count
  11. 0x875074, // Card Names, Uint16 Count, Uint16[Count] Offsets, FF8String[Count] Null Ending.
  12. 0x875524, // Card Names2, Uint16 Count, Uint16[Count] Offsets, FF8String[Count] Null Ending. Ignore null Offsets.
  13. 0x874B58, // Card Text, Uint16 Count, Uint16[Count] Offsets, FF8String[Count] Null Ending.
  14. //There is no Count at start of section only offsets
  15. 0x7921E4, // Text related to discs and draw points, Count = 9, Uint32[Count] Offsets, FF8String[Count] Null Ending.
  16. 0x14838D4 // Scan Text, Count = 160, Uint16[Count] Offset from start of first string. FF8String[Count] Null Ending.
  17. }
  18. }
  19. };
  20. public static readonly Dictionary<int, uint[]> TIM = new Dictionary<int, uint[]> {
  21. { 2000, new uint[]
  22. {
  23. // The ones commented out weren't real tim files. But were close enough to not set off exceptions.
  24. //4 bpp
  25. 0x795A78, // Card game symbols and numbers.
  26. 0x7A8698, // Random Letters, Numbers, Symbols // 2 palettes differnt characters depending on palette
  27. //8 bpp
  28. 0x7A8AF8, // Card faces
  29. 0x944E8C, // Magic effect
  30. 0xA95AE0, // Cactar?
  31. 0xACC40C, // Magic effect
  32. 0xAF4C30, // Magic effect // failed to load? timviewer says it's valid 11488304
  33. 0xB1E920, // Magic effect
  34. 0xB47340, // Magic effect
  35. 0xB57D60, // Magic effect
  36. 0xB78384, // Magic effect // failed to load? timviewer says it's valid 12026756
  37. 0xBAD4A8, // magic effect // failed to load? timviewer says it's valid 12244136
  38. 0xC05E64, // magic effect
  39. 0xF76698, // Moomba
  40. 0xF7A8B8, // magic effect
  41. 0xF9B8D8, // magic effect
  42. 0xFBBBEC, // magic effect
  43. 0xFED20C, // magic effect
  44. 0x100016C, // magic effect
  45. 0x102938C, // magic effect
  46. 0x103CC90, // magic effect
  47. 0x1070DC4, // magic effect
  48. 0x10AF700, // Angelo
  49. 0x10B7B20, // magic effect
  50. 0x10D8F58, // magic effect
  51. 0x10FA790, // magic effect
  52. 0x124A678, // monster skin or reaper?
  53. 0x1252A98, // bat wings
  54. 0x125BCCC, // chocobo
  55. 0x12704DC, // chocobo dup
  56. 0x1279714, // chocobo dup
  57. 0x1288434, // chocobo dup
  58. 0x12ADE90, // Angelo dup
  59. 0x12B8990, // Angelo dup
  60. 0x12C12C8, // Angelo dup
  61. 0x12CF8B0, // Angelo dup
  62. 0x12F3000, // Angelo dup
  63. 0x12FB420, // umm?
  64. 0x12FDF78, // Angelo dup
  65. 0x130CDCC, // Angelo dup
  66. 0x13243F8, // Angel wings
  67. 0x1338C08, // Cherub
  68. 0x135AC20, // magic effect
  69. 0x1378F3C, // monster skin or reaper? dup
  70. 0x138135C, // bat wings dup
  71. 0x1408FB0, // monster skin or reaper? dup
  72. 0x14113D0, // bat wings dup
  73. 0x141CFAC, // monster skin or reaper? dup
  74. 0x14253CC, // bat wings dup
  75. 0x14295EC, // spell effect
  76. //16 bbp
  77. 0x81F818, // Card game board
  78. 0x849B2C, // Card loading background?
  79. }
  80. },
  81. { 2013, new uint[]
  82. {
  83. // The ones commented out weren't real tim files. But were close enough to not set off exceptions.
  84. //4 bpp
  85. 0x796A90, // Card game symbols and numbers.
  86. 0x7A96B0, // Random Letters, Numbers, Symbols
  87. //8 bpp
  88. 0x7A9B10, // Card faces
  89. 0x945EAC, // Magic effect
  90. 0xA96B00, // Cactar?
  91. 0xACC40C, // Magic effect
  92. 0xAF4C30, // Magic effect // failed to load? timviewer says it's valid 11488304
  93. 0xB1E920, // Magic effect
  94. 0xB47340, // Magic effect
  95. 0xB57D60, // Magic effect
  96. 0xB78384, // Magic effect // failed to load? timviewer says it's valid 12026756
  97. 0xBAD4A8, // magic effect // failed to load? timviewer says it's valid 12244136
  98. 0xC05E64, // magic effect
  99. 0xF76698, // Moomba
  100. 0xF7A8B8, // magic effect
  101. 0xF9B8D8, // magic effect
  102. 0xFBBBEC, // magic effect
  103. 0xFED20C, // magic effect
  104. 0x100016C, // magic effect
  105. 0x102938C, // magic effect
  106. 0x103CC90, // magic effect
  107. 0x1070DC4, // magic effect
  108. 0x10AF700, // Angelo
  109. 0x10B7B20, // magic effect
  110. 0x10D8F58, // magic effect
  111. 0x10FA790, // magic effect
  112. 0x124A678, // monster skin or reaper?
  113. 0x1252A98, // bat wings
  114. 0x125BCCC, // chocobo
  115. 0x12704DC, // chocobo dup
  116. 0x1279714, // chocobo dup
  117. 0x1288434, // chocobo dup
  118. 0x12ADE90, // Angelo dup
  119. 0x12B8990, // Angelo dup
  120. 0x12C12C8, // Angelo dup
  121. 0x12CF8B0, // Angelo dup
  122. 0x12F3000, // Angelo dup
  123. 0x12FB420, // umm?
  124. 0x12FDF78, // Angelo dup
  125. 0x130CDCC, // Angelo dup
  126. 0x13243F8, // Angel wings
  127. 0x1338C08, // Cherub
  128. 0x135AC20, // magic effect
  129. 0x1378F3C, // monster skin or reaper? dup
  130. 0x138135C, // bat wings dup
  131. 0x1408FB0, // monster skin or reaper? dup
  132. 0x14113D0, // bat wings dup
  133. 0x141CFAC, // monster skin or reaper? dup
  134. 0x14253CC, // bat wings dup
  135. 0x14295EC, // spell effect
  136. //16 bbp
  137. 0x820B30, // Card game board
  138. 0x84AB44, // Card loading background?
  139. }
  140. }
  141. };
  142. ///// <summary>
  143. ///// If error occurs the bad offsets are added to list.
  144. ///// Use Debugger to check what is bad.
  145. ///// </summary>
  146. //private List<uint> badoffset;
  147. public static Dictionary<int, string> FileName => new Dictionary<int, string>
  148. {
  149. { 2000, Path.Combine(Memory.FF8Dir, "FF8.exe") },
  150. { 2013, Path.Combine(Memory.FF8Dir, "FF8_EN.exe") },
  151. };
  152. public EXE_Offsets()
  153. {
  154. //badoffset = new List<uint>();
  155. ////try
  156. ////{
  157. // using (BinaryReader br = new BinaryReader(File.OpenRead(FileName)))
  158. // {
  159. // foreach (uint t in TIM)
  160. // {
  161. // try
  162. // {
  163. // TIM2 timdata = new TIM2(br, t);
  164. // Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), "Timages"));
  165. // timdata.Save(Path.Combine(Path.GetTempPath(), "Timages", string.Format("0x{0:X}.tim", t)));
  166. // }
  167. // catch (InvalidDataException e)
  168. // {
  169. // if (e.Message == "Invalid TIM File")
  170. // {
  171. // badoffset.Add(t);
  172. // }
  173. // else e.Rethrow();
  174. // }
  175. // }
  176. // }
  177. ////}
  178. ////catch (IOException e)
  179. ////{
  180. //// //search is locking down the file woot.
  181. ////}
  182. }
  183. }
  184. }