GameUty.cs 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. using I2.Loc;
  7. using UnityEngine;
  8. using wf;
  9. public class GameUty
  10. {
  11. public static AFileSystemBase FileSystem
  12. {
  13. get
  14. {
  15. return GameUty.m_FileSystem;
  16. }
  17. }
  18. public static AFileSystemBase FileSystemOld
  19. {
  20. get
  21. {
  22. return GameUty.m_FileSystemOld;
  23. }
  24. }
  25. public static AFileSystemBase FileSystemMod
  26. {
  27. get
  28. {
  29. return GameUty.m_ModFileSystem;
  30. }
  31. }
  32. public static bool IsEnabledCompatibilityMode
  33. {
  34. get
  35. {
  36. return 0 < GameUty.PathListOld.Count && Product.type == Product.Type.JpAdult;
  37. }
  38. }
  39. public static HashSet<string> loadArchiveList { get; private set; }
  40. public static string[] MenuFiles
  41. {
  42. get
  43. {
  44. return GameUty.m_aryMenuFiles;
  45. }
  46. }
  47. public static string[] ModOnlysMenuFiles
  48. {
  49. get
  50. {
  51. return GameUty.m_aryModOnlysMenuFiles;
  52. }
  53. }
  54. public static Dictionary<int, string> RidMenuDic
  55. {
  56. get
  57. {
  58. return GameUty.rid_menu_dic_;
  59. }
  60. }
  61. public static Dictionary<string, AFileSystemBase> BgFiles { get; private set; }
  62. public static float MillisecondToSecond(int millisecond)
  63. {
  64. return (float)millisecond / 1000f;
  65. }
  66. public static Material GetSystemMaterial(GameUty.SystemMaterial f_mat)
  67. {
  68. Material material = GameUty.m_matSystem[(int)f_mat];
  69. if (material == null)
  70. {
  71. UnityEngine.Object original = Resources.Load(GameUty.m_strSystemMaterialName[(int)f_mat]);
  72. material = (UnityEngine.Object.Instantiate(original) as Material);
  73. GameUty.m_matSystem[(int)f_mat] = material;
  74. }
  75. return material;
  76. }
  77. public static GameObject LoadAssetBundle(string file_name)
  78. {
  79. if (GameUty.FileSystem == null || !GameUty.FileSystem.IsExistentFile(file_name))
  80. {
  81. return null;
  82. }
  83. UnityEngine.Object original = null;
  84. if (!GameUty.asset_bundle_dic.ContainsKey(file_name))
  85. {
  86. using (AFileBase afileBase = GameUty.FileSystem.FileOpen(file_name))
  87. {
  88. AssetBundle assetBundle = AssetBundle.LoadFromMemory(afileBase.ReadAll());
  89. if (assetBundle.mainAsset != null)
  90. {
  91. original = assetBundle.mainAsset;
  92. }
  93. else
  94. {
  95. original = assetBundle.LoadAllAssets<GameObject>()[0];
  96. }
  97. GameUty.asset_bundle_dic.Add(file_name, assetBundle);
  98. }
  99. }
  100. else
  101. {
  102. original = GameUty.asset_bundle_dic[file_name].mainAsset;
  103. }
  104. GameObject gameObject = UnityEngine.Object.Instantiate(original) as GameObject;
  105. gameObject.name = gameObject.name.Replace("(Clone)", string.Empty);
  106. return gameObject;
  107. }
  108. public static void DeviceInitialize()
  109. {
  110. }
  111. public static void Init()
  112. {
  113. GameUty.m_FileSystem = new FileSystemArchive();
  114. GameUty.m_FileSystemOld = new FileSystemArchive();
  115. GameUty.loadArchiveList = new HashSet<string>();
  116. GameUty.PathListOld = new List<string>();
  117. if (!string.IsNullOrEmpty(GameMain.Instance.CMSystem.CM3D2Path))
  118. {
  119. GameUty.PathListOld = GameUty.ReadAutoPathFile("[2.0]", GameMain.Instance.CMSystem.CM3D2Path + "\\GameData\\paths.dat");
  120. if (GameUty.PathListOld == null)
  121. {
  122. GameUty.PathListOld = new List<string>();
  123. }
  124. }
  125. GameUty.UpdateFileSystemPath();
  126. GameUty.UpdateFileSystemPathOld();
  127. PluginData.CreateData(GameUty.m_FileSystem, (!GameUty.IsEnabledCompatibilityMode) ? null : GameUty.m_FileSystemOld);
  128. Debug.Log("■■■■■■■■ Plugin Check ■■■■■■■■");
  129. foreach (string text in PluginData.GetAllUniqueNames())
  130. {
  131. Debug.Log(string.Concat(new string[]
  132. {
  133. "[",
  134. PluginData.uniqueNameToId(text).ToString(),
  135. "]",
  136. text,
  137. " : ",
  138. (!PluginData.IsEnabled(text)) ? "×" : "○"
  139. }));
  140. }
  141. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  142. string windowTitel = Product.windowTitel;
  143. if (!string.IsNullOrEmpty(windowTitel))
  144. {
  145. DllBase.Win32.SetWindowText(DllBase.Win32.GetActiveWindow(), windowTitel);
  146. }
  147. }
  148. public static void Finish()
  149. {
  150. foreach (KeyValuePair<string, AssetBundle> keyValuePair in GameUty.asset_bundle_dic)
  151. {
  152. keyValuePair.Value.Unload(true);
  153. }
  154. GameUty.asset_bundle_dic.Clear();
  155. GameUty.m_FileSystem.Dispose();
  156. GameUty.m_FileSystem = null;
  157. if (GameUty.m_FileSystemOld != null)
  158. {
  159. GameUty.m_FileSystemOld.Dispose();
  160. GameUty.m_FileSystemOld = null;
  161. }
  162. if (GameUty.m_ModFileSystem != null)
  163. {
  164. GameUty.m_ModFileSystem.Dispose();
  165. GameUty.m_ModFileSystem = null;
  166. }
  167. if (GameUty.m_CrcFileSystem != null)
  168. {
  169. GameUty.m_CrcFileSystem.Dispose();
  170. GameUty.m_CrcFileSystem = null;
  171. }
  172. }
  173. public static Dictionary<string, HashSet<string>> GetGameDataResourceList(string gameDataPath)
  174. {
  175. string[] array = new string[]
  176. {
  177. "script_cbl",
  178. "motion_cbl",
  179. "voice_cbl"
  180. };
  181. int length = (gameDataPath + "\\").Length;
  182. string[] directories = Directory.GetDirectories(gameDataPath);
  183. Dictionary<string, HashSet<string>> dictionary = new Dictionary<string, HashSet<string>>();
  184. for (int i = 0; i < directories.Length; i++)
  185. {
  186. string text = directories[i].Substring(length, directories[i].Length - length).ToLower();
  187. int startIndex = 0;
  188. foreach (string text2 in array)
  189. {
  190. if (text.IndexOf(text2) == 0)
  191. {
  192. startIndex = text2.Length;
  193. break;
  194. }
  195. }
  196. int num = text.IndexOf('_', startIndex);
  197. if (0 <= num)
  198. {
  199. string text3 = text.Substring(0, num);
  200. if (!string.IsNullOrEmpty(text3))
  201. {
  202. string text4 = text.Substring(text3.Length + 1, text.Length - (text3.Length + 1));
  203. if (!string.IsNullOrEmpty(text4))
  204. {
  205. if (!dictionary.ContainsKey(text3))
  206. {
  207. dictionary.Add(text3, new HashSet<string>());
  208. }
  209. if (!dictionary[text3].Contains(text4))
  210. {
  211. dictionary[text3].Add(text4);
  212. }
  213. else
  214. {
  215. Debug.LogWarning(text3 + "_" + text4 + "は既にリストに存在します");
  216. }
  217. }
  218. }
  219. }
  220. else if (!dictionary.ContainsKey(text))
  221. {
  222. dictionary.Add(text, new HashSet<string>());
  223. }
  224. else
  225. {
  226. Debug.LogWarning(text + "は既にリストに存在します");
  227. }
  228. }
  229. return dictionary;
  230. }
  231. public static List<string> ReadAutoPathFile(string uniqueName, string filePath)
  232. {
  233. if (!File.Exists(filePath))
  234. {
  235. return null;
  236. }
  237. List<string> list = new List<string>();
  238. using (FileStream fileStream = File.OpenRead(filePath))
  239. {
  240. using (BinaryReader binaryReader = new BinaryReader(fileStream))
  241. {
  242. string a = binaryReader.ReadString();
  243. NDebug.Assert(a == "CM3D2_PATHS", "パスファイルのヘッダーが不正です。");
  244. int num = binaryReader.ReadInt32();
  245. int num2 = binaryReader.ReadInt32();
  246. for (int i = 0; i < num2; i++)
  247. {
  248. string text = binaryReader.ReadString();
  249. if (!(text == "cas"))
  250. {
  251. list.Add(text);
  252. }
  253. }
  254. }
  255. }
  256. return list;
  257. }
  258. public static void UpdateFileSystemPath()
  259. {
  260. string text = UTY.gameProjectPath + "\\";
  261. string gameDataPath = "GameData";
  262. int check_ver_no = 3;
  263. Func<string, bool> AddFolderOrArchive = delegate(string name)
  264. {
  265. NDebug.Assert(name != "parts_cas", "CC危険。" + name);
  266. bool flag5 = GameUty.m_FileSystem.AddArchive(gameDataPath + "\\" + name + ".arc");
  267. if (flag5)
  268. {
  269. Debug.Log(string.Concat(new string[]
  270. {
  271. "[",
  272. gameDataPath,
  273. "\\",
  274. name,
  275. ".arc]を読み込みました"
  276. }));
  277. }
  278. if (flag5)
  279. {
  280. GameUty.loadArchiveList.Add(name.ToLower());
  281. }
  282. return flag5;
  283. };
  284. HashSet<string> addedLegacyArchives = new HashSet<string>();
  285. Action<string> action = delegate(string name)
  286. {
  287. foreach (string text32 in GameUty.PathList)
  288. {
  289. string text33 = name + "_" + text32;
  290. bool flag5 = AddFolderOrArchive(text33);
  291. if (flag5 && !addedLegacyArchives.Contains(text33))
  292. {
  293. addedLegacyArchives.Add(text33);
  294. }
  295. if (flag5)
  296. {
  297. if (name == "csv")
  298. {
  299. GameUty.ExistCsvPathList.Add(text32);
  300. }
  301. for (int num15 = 2; num15 <= check_ver_no; num15++)
  302. {
  303. AddFolderOrArchive(text33 + "_" + num15);
  304. }
  305. }
  306. }
  307. };
  308. Action<string> action2 = delegate(string name)
  309. {
  310. foreach (string text32 in GameUty.PathList)
  311. {
  312. string text33 = name + "_" + text32;
  313. bool flag5 = AddFolderOrArchive(text33);
  314. if (!flag5 && addedLegacyArchives.Contains(text33))
  315. {
  316. flag5 = true;
  317. }
  318. if (flag5)
  319. {
  320. if (name == "csv")
  321. {
  322. GameUty.ExistCsvPathList.Add(text32);
  323. }
  324. for (int num15 = 2; num15 <= check_ver_no; num15++)
  325. {
  326. AddFolderOrArchive(string.Concat(new object[]
  327. {
  328. name,
  329. "_",
  330. text32,
  331. "_",
  332. num15
  333. }));
  334. }
  335. }
  336. }
  337. };
  338. Action<string> action3 = delegate(string name)
  339. {
  340. foreach (string text32 in GameUty.PathList)
  341. {
  342. if (AddFolderOrArchive(name + "_" + text32))
  343. {
  344. if (name == "csv")
  345. {
  346. GameUty.ExistCsvPathList.Add(text32);
  347. }
  348. for (int num15 = 2; num15 <= check_ver_no; num15++)
  349. {
  350. AddFolderOrArchive(string.Concat(new object[]
  351. {
  352. name,
  353. "_",
  354. text32,
  355. "_",
  356. num15
  357. }));
  358. }
  359. }
  360. }
  361. };
  362. string str = string.Empty;
  363. str = "必用アーカイブがありません。GameData\\";
  364. GameUty.m_FileSystem.SetBaseDirectory(text);
  365. AddFolderOrArchive("product");
  366. Product.Initialize(GameUty.m_FileSystem);
  367. Debug.Log("IsEnabledCompatibilityMode:" + GameUty.IsEnabledCompatibilityMode.ToString());
  368. string gameTitle = Product.gameTitle;
  369. string str2 = "カスタムメイド3D 2";
  370. Debug.Log(string.Concat(new string[]
  371. {
  372. gameTitle,
  373. " GameVersion ",
  374. GameUty.GetGameVersionText(),
  375. "(BuildVersion : ",
  376. GameUty.GetBuildVersionText(),
  377. ")"
  378. }));
  379. if (!string.IsNullOrEmpty(GameMain.Instance.CMSystem.CM3D2Path))
  380. {
  381. Debug.Log(str2 + " GameVersion " + GameUty.GetLegacyGameVersionText());
  382. }
  383. if (Product.type != Product.Type.JpAdult)
  384. {
  385. GameUty.UpdateFileSystemPathToNewProduct();
  386. }
  387. else
  388. {
  389. StopWatch stopWatch = new StopWatch();
  390. if (GameUty.IsEnabledCompatibilityMode)
  391. {
  392. Debug.Log("■■■■■■■■ Archive Log[2.0] (CM3D2 GameData) ■■■■■■■■");
  393. GameUty.m_FileSystem.SetBaseDirectory(GameMain.Instance.CMSystem.CM3D2Path);
  394. GameUty.PathList = GameUty.PathListOld;
  395. AddFolderOrArchive("material");
  396. foreach (string text2 in GameUty.PathListOld)
  397. {
  398. string str3 = "material";
  399. if (text2 == "denkigai2015wTowelR")
  400. {
  401. AddFolderOrArchive(str3 + "_denkigai2015wTowel");
  402. }
  403. string text3 = str3 + "_" + text2;
  404. bool flag = AddFolderOrArchive(text3);
  405. if (flag && !addedLegacyArchives.Contains(text3))
  406. {
  407. addedLegacyArchives.Add(text3);
  408. }
  409. if (flag)
  410. {
  411. for (int i2 = 2; i2 <= check_ver_no; i2++)
  412. {
  413. AddFolderOrArchive(text3 + "_" + i2);
  414. }
  415. }
  416. }
  417. AddFolderOrArchive("material2");
  418. AddFolderOrArchive("menu");
  419. action("menu");
  420. AddFolderOrArchive("menu2");
  421. AddFolderOrArchive("model");
  422. action("model");
  423. AddFolderOrArchive("model2");
  424. AddFolderOrArchive("texture");
  425. action("texture");
  426. AddFolderOrArchive("texture2");
  427. AddFolderOrArchive("texture3");
  428. AddFolderOrArchive("prioritymaterial");
  429. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  430. }
  431. Debug.Log("■■■■■■■■ Archive Log[2.1 Compatibility] (GameData_20) ■■■■■■■■");
  432. gameDataPath = "GameData_20";
  433. GameUty.m_FileSystem.SetBaseDirectory(text);
  434. if (GameUty.IsEnabledCompatibilityMode)
  435. {
  436. GameUty.m_FileSystem.AddPatchDecryptPreferredSearchDirectory(GameMain.Instance.CMSystem.CM3D2Path + "\\GameData");
  437. }
  438. GameUty.PathList = GameUty.ReadAutoPathFile("[2.1Compatibility]", text + gameDataPath + "\\paths.dat");
  439. if (GameUty.PathList != null && 0 < GameUty.PathList.Count)
  440. {
  441. foreach (string text4 in GameUty.PathList)
  442. {
  443. string text5 = "material";
  444. if (text4 == "denkigai2015wTowelR")
  445. {
  446. AddFolderOrArchive(text5 + "_denkigai2015wTowel");
  447. }
  448. string text6 = text5 + "_" + text4;
  449. bool flag2 = AddFolderOrArchive(text6);
  450. if (!flag2 && addedLegacyArchives.Contains(text6))
  451. {
  452. flag2 = true;
  453. }
  454. if (flag2)
  455. {
  456. for (int j = 2; j <= check_ver_no; j++)
  457. {
  458. AddFolderOrArchive(string.Concat(new object[]
  459. {
  460. text5,
  461. "_",
  462. text4,
  463. "_",
  464. j
  465. }));
  466. }
  467. }
  468. }
  469. action2("menu");
  470. action2("model");
  471. action2("texture");
  472. AddFolderOrArchive("prioritymaterial");
  473. List<string> pathList = GameUty.PathList;
  474. GameUty.PathList = new List<string>();
  475. GameUty.PathList.Add("vp001");
  476. action2("bg");
  477. action2("motion");
  478. GameUty.PathList = pathList;
  479. }
  480. GameUty.m_FileSystem.ClearPatchDecryptPreferredSearchDirectory();
  481. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  482. Debug.Log("■■■■■■■■ Archive Log[2.1] (GameData) ■■■■■■■■");
  483. gameDataPath = "GameData";
  484. GameUty.PathList = GameUty.ReadAutoPathFile("[2.1]", text + gameDataPath + "\\paths.dat");
  485. if (GameUty.PathList == null)
  486. {
  487. GameUty.PathList = new List<string>();
  488. NDebug.Assert("paths.datを読み込めませんでした", false);
  489. }
  490. GameUty.PathList.Add("jp");
  491. bool flag3 = !string.IsNullOrEmpty(GameUty.PathList.Find((string x) => string.Equals(x, "gp003", StringComparison.CurrentCultureIgnoreCase)));
  492. AddFolderOrArchive("csv");
  493. foreach (string text7 in GameUty.PathList)
  494. {
  495. string text8 = "csv";
  496. if (AddFolderOrArchive(text8 + "_" + text7))
  497. {
  498. for (int k = 2; k <= check_ver_no; k++)
  499. {
  500. AddFolderOrArchive(string.Concat(new object[]
  501. {
  502. text8,
  503. "_",
  504. text7,
  505. "_",
  506. k
  507. }));
  508. }
  509. }
  510. }
  511. AddFolderOrArchive("prioritymaterial");
  512. NDebug.Assert(AddFolderOrArchive("motion"), str + "motion");
  513. foreach (string text9 in GameUty.PathList)
  514. {
  515. string text10 = "motion";
  516. if (AddFolderOrArchive(text10 + "_" + text9))
  517. {
  518. if (flag3)
  519. {
  520. AddFolderOrArchive(text10 + "_" + text9 + "_gp003");
  521. }
  522. for (int l = 2; l <= check_ver_no; l++)
  523. {
  524. AddFolderOrArchive(string.Concat(new object[]
  525. {
  526. text10,
  527. "_",
  528. text9,
  529. "_",
  530. l
  531. }));
  532. }
  533. }
  534. }
  535. AddFolderOrArchive("motion2");
  536. NDebug.Assert(AddFolderOrArchive("script"), str + "script");
  537. foreach (string text11 in GameUty.PathList)
  538. {
  539. string text12 = "script";
  540. if (AddFolderOrArchive(text12 + "_" + text11))
  541. {
  542. for (int m = 2; m <= check_ver_no; m++)
  543. {
  544. AddFolderOrArchive(string.Concat(new object[]
  545. {
  546. text12,
  547. "_",
  548. text11,
  549. "_",
  550. m
  551. }));
  552. }
  553. }
  554. }
  555. AddFolderOrArchive("script_share");
  556. foreach (string text13 in GameUty.PathList)
  557. {
  558. string text14 = "script_share";
  559. if (AddFolderOrArchive(text14 + "_" + text13))
  560. {
  561. for (int n = 2; n <= check_ver_no; n++)
  562. {
  563. AddFolderOrArchive(string.Concat(new object[]
  564. {
  565. text14,
  566. "_",
  567. text13,
  568. "_",
  569. n
  570. }));
  571. }
  572. }
  573. }
  574. AddFolderOrArchive("script_share2");
  575. NDebug.Assert(AddFolderOrArchive("sound"), str + "sound");
  576. foreach (string text15 in GameUty.PathList)
  577. {
  578. string text16 = "sound";
  579. if (AddFolderOrArchive(text16 + "_" + text15))
  580. {
  581. for (int num = 2; num <= check_ver_no; num++)
  582. {
  583. AddFolderOrArchive(string.Concat(new object[]
  584. {
  585. text16,
  586. "_",
  587. text15,
  588. "_",
  589. num
  590. }));
  591. }
  592. }
  593. }
  594. AddFolderOrArchive("sound2");
  595. NDebug.Assert(AddFolderOrArchive("system"), str + "system");
  596. foreach (string text17 in GameUty.PathList)
  597. {
  598. string text18 = "system";
  599. if (AddFolderOrArchive(text18 + "_" + text17))
  600. {
  601. for (int num2 = 2; num2 <= check_ver_no; num2++)
  602. {
  603. AddFolderOrArchive(string.Concat(new object[]
  604. {
  605. text18,
  606. "_",
  607. text17,
  608. "_",
  609. num2
  610. }));
  611. }
  612. }
  613. }
  614. AddFolderOrArchive("system2");
  615. AddFolderOrArchive("language");
  616. foreach (string text19 in GameUty.PathList)
  617. {
  618. string text20 = "language";
  619. if (AddFolderOrArchive(text20 + "_" + text19))
  620. {
  621. for (int num3 = 2; num3 <= check_ver_no; num3++)
  622. {
  623. AddFolderOrArchive(string.Concat(new object[]
  624. {
  625. text20,
  626. "_",
  627. text19,
  628. "_",
  629. num3
  630. }));
  631. }
  632. }
  633. }
  634. foreach (string text21 in GameUty.PathList)
  635. {
  636. string text22 = "bg";
  637. if (AddFolderOrArchive(text22 + "_" + text21))
  638. {
  639. for (int num4 = 2; num4 <= check_ver_no; num4++)
  640. {
  641. AddFolderOrArchive(string.Concat(new object[]
  642. {
  643. text22,
  644. "_",
  645. text21,
  646. "_",
  647. num4
  648. }));
  649. }
  650. }
  651. }
  652. if (Product.isEnglish && !Product.isPublic)
  653. {
  654. string text23 = "bg-en";
  655. NDebug.Assert(AddFolderOrArchive(text23), str + text23);
  656. foreach (string text24 in GameUty.PathList)
  657. {
  658. if (AddFolderOrArchive(text23 + "_" + text24))
  659. {
  660. for (int num5 = 2; num5 <= check_ver_no; num5++)
  661. {
  662. AddFolderOrArchive(string.Concat(new object[]
  663. {
  664. text23,
  665. "_",
  666. text24,
  667. "_",
  668. num5
  669. }));
  670. }
  671. }
  672. }
  673. AddFolderOrArchive("bg-en2");
  674. }
  675. AddFolderOrArchive("voice");
  676. for (int num6 = 0; num6 < 25; num6++)
  677. {
  678. string arg = "voice";
  679. string arg2 = arg + "_" + (char)(97 + num6);
  680. AddFolderOrArchive(arg2);
  681. }
  682. foreach (string text25 in GameUty.PathList)
  683. {
  684. string text26 = "voice";
  685. if (AddFolderOrArchive(text26 + "_" + text25))
  686. {
  687. for (int num7 = 2; num7 <= check_ver_no; num7++)
  688. {
  689. AddFolderOrArchive(string.Concat(new object[]
  690. {
  691. text26,
  692. "_",
  693. text25,
  694. "_",
  695. num7
  696. }));
  697. }
  698. }
  699. }
  700. for (int num8 = 2; num8 <= check_ver_no; num8++)
  701. {
  702. string arg3 = "voice";
  703. AddFolderOrArchive(arg3 + num8);
  704. }
  705. string text27 = "parts";
  706. NDebug.Assert(AddFolderOrArchive(text27), str + text27);
  707. foreach (string text28 in GameUty.PathList)
  708. {
  709. if (Product.isJapan && !Product.isPublic)
  710. {
  711. string text29 = "parts_cw005cloth4.arc";
  712. string path = "parts_cw005cloth4_2.arc";
  713. if (string.Equals(text27 + "_" + text28, Path.GetFileNameWithoutExtension(text29), StringComparison.OrdinalIgnoreCase))
  714. {
  715. string text30 = Path.Combine(UTY.gameDataPath, text29);
  716. if (File.Exists(text30) && File.Exists(Path.Combine(UTY.gameDataPath, path)))
  717. {
  718. byte[] bytes = Resources.Load<TextAsset>(Path.Combine("System", text29)).bytes;
  719. if (new FileInfo(text30).Length > (long)bytes.Length)
  720. {
  721. FileSystemArchive fileSystemArchive = new FileSystemArchive();
  722. fileSystemArchive.SetBaseDirectory(text);
  723. fileSystemArchive.AddArchive(Path.Combine(gameDataPath, text29));
  724. fileSystemArchive.AddArchive(Path.Combine(gameDataPath, path));
  725. fileSystemArchive.Dispose();
  726. bool flag4 = true;
  727. using (FileStream fileStream = File.OpenRead(Path.Combine(UTY.gameDataPath, path)))
  728. {
  729. using (BinaryReader binaryReader = new BinaryReader(fileStream))
  730. {
  731. foreach (int num10 in new int[]
  732. {
  733. 119,
  734. 97,
  735. 114,
  736. 99
  737. })
  738. {
  739. byte b = binaryReader.ReadByte();
  740. if ((int)b != num10)
  741. {
  742. flag4 = false;
  743. break;
  744. }
  745. }
  746. }
  747. }
  748. if (flag4)
  749. {
  750. File.Delete(text30);
  751. File.WriteAllBytes(text30, bytes);
  752. }
  753. }
  754. }
  755. }
  756. }
  757. if (AddFolderOrArchive(text27 + "_" + text28))
  758. {
  759. if (flag3)
  760. {
  761. AddFolderOrArchive(text27 + "_" + text28 + "_gp003");
  762. }
  763. for (int num11 = 2; num11 <= check_ver_no; num11++)
  764. {
  765. AddFolderOrArchive(string.Concat(new object[]
  766. {
  767. text27,
  768. "_",
  769. text28,
  770. "_",
  771. num11
  772. }));
  773. }
  774. }
  775. }
  776. AddFolderOrArchive("parts2");
  777. Debug.Log("■■■■■■■■■■■■■■■■■■■■" + stopWatch.Stop().ToString() + " ms");
  778. }
  779. GameUty.m_FileSystem.AddAutoPathForAllFolder(true);
  780. while (!GameUty.m_FileSystem.IsFinishedAddAutoPathJob(true))
  781. {
  782. }
  783. GameUty.m_FileSystem.ReleaseAddAutoPathJob();
  784. if (Product.isPublic && !GameUty.m_FileSystem.IsExistentFile("21C399027026.dat"))
  785. {
  786. NDebug.MessageBox("Error", Product.type.ToString() + " : 21C399027026.dat");
  787. Application.Quit();
  788. return;
  789. }
  790. GameUty.BgFiles = new Dictionary<string, AFileSystemBase>();
  791. string[] list = GameUty.m_FileSystem.GetList("bg", AFileSystemBase.ListType.AllFile);
  792. if (list != null && 0 < list.Length)
  793. {
  794. foreach (string path2 in list)
  795. {
  796. string fileName = Path.GetFileName(path2);
  797. if (!(Path.GetExtension(fileName) != ".asset_bg") && !GameUty.BgFiles.ContainsKey(fileName))
  798. {
  799. GameUty.BgFiles.Add(fileName, GameUty.m_FileSystem);
  800. }
  801. }
  802. }
  803. if (Product.supportMultiLanguage)
  804. {
  805. list = GameUty.m_FileSystem.GetList("language", AFileSystemBase.ListType.AllFile);
  806. if (list != null && 0 < list.Length)
  807. {
  808. foreach (string path3 in list)
  809. {
  810. string fileName2 = Path.GetFileName(path3);
  811. if (!(Path.GetExtension(fileName2) != ".asset_language"))
  812. {
  813. using (AFileBase afileBase = GameUty.m_FileSystem.FileOpen(fileName2))
  814. {
  815. AssetBundle assetBundle = AssetBundle.LoadFromMemory(afileBase.ReadAll());
  816. LanguageSource languageSource = UnityEngine.Object.Instantiate<LanguageSource>(assetBundle.LoadAllAssets<GameObject>()[0].GetComponent<LanguageSource>());
  817. if (GameMain.Instance.transform.Find("Language") == null)
  818. {
  819. new GameObject("Language").transform.SetParent(GameMain.Instance.transform);
  820. }
  821. languageSource.transform.SetParent(GameMain.Instance.transform.Find("Language"));
  822. assetBundle.Unload(true);
  823. }
  824. }
  825. }
  826. }
  827. foreach (LanguageSource languageSource2 in LocalizationManager.Sources)
  828. {
  829. languageSource2.LoadAllLanguages(false);
  830. }
  831. }
  832. if (Directory.Exists(text + "Mod"))
  833. {
  834. GameUty.m_ModFileSystem = new FileSystemWindows();
  835. GameUty.m_ModFileSystem.SetBaseDirectory(text);
  836. GameUty.m_ModFileSystem.AddFolder("Mod");
  837. string[] list2 = GameUty.m_ModFileSystem.GetList(string.Empty, AFileSystemBase.ListType.AllFolder);
  838. foreach (string text31 in list2)
  839. {
  840. if (!GameUty.m_ModFileSystem.AddAutoPath(text31))
  841. {
  842. Debug.Log("m_ModFileSystemのAddAutoPathには既に " + text31 + " がありました。");
  843. }
  844. }
  845. }
  846. Directory.CreateDirectory(text + "SaveData\\_gp03_import");
  847. GameUty.ReloadCrcImportPath();
  848. if (GameUty.m_ModFileSystem != null)
  849. {
  850. string[] list3 = GameUty.m_ModFileSystem.GetList(string.Empty, AFileSystemBase.ListType.AllFile);
  851. GameUty.m_aryModOnlysMenuFiles = Array.FindAll<string>(list3, (string i) => new Regex(".*\\.menu$").IsMatch(i));
  852. }
  853. if (GameUty.m_aryModOnlysMenuFiles != null && GameUty.m_aryModOnlysMenuFiles.Length != 0)
  854. {
  855. GameUty.ModPriorityToModFolderInfo = string.Empty;
  856. Debug.Log(GameUty.ModPriorityToModFolderInfo + "■MOD有り。MODフォルダ優先モード" + GameUty.ModPriorityToModFolder.ToString());
  857. }
  858. }
  859. public static void UpdateFileSystemPathToNewProduct()
  860. {
  861. string text = UTY.gameProjectPath + "\\";
  862. string gameDataPath = "GameData";
  863. string str = string.Empty;
  864. str = "必用アーカイブがありません。GameData" + Product.gameDataPath + "\\";
  865. int check_ver_no = 3;
  866. Func<string, bool> AddFolderOrArchive = delegate(string name)
  867. {
  868. string gameDataPath = gameDataPath;
  869. bool flag2 = GameUty.m_FileSystem.AddArchive(gameDataPath + "\\" + name + ".arc");
  870. if (flag2)
  871. {
  872. Debug.Log(string.Concat(new string[]
  873. {
  874. "[",
  875. gameDataPath,
  876. "\\",
  877. name,
  878. ".arc]を読み込みました"
  879. }));
  880. }
  881. if (flag2)
  882. {
  883. GameUty.loadArchiveList.Add(name.ToLower());
  884. }
  885. return flag2;
  886. };
  887. Action<string> action = delegate(string name)
  888. {
  889. foreach (string text28 in GameUty.PathList)
  890. {
  891. string arg5 = name + "_" + text28;
  892. bool flag2 = AddFolderOrArchive(arg5);
  893. if (flag2)
  894. {
  895. if (name == "csv")
  896. {
  897. GameUty.ExistCsvPathList.Add(text28);
  898. }
  899. for (int num10 = 2; num10 <= check_ver_no; num10++)
  900. {
  901. AddFolderOrArchive(string.Concat(new object[]
  902. {
  903. name,
  904. "_",
  905. text28,
  906. "_",
  907. num10
  908. }));
  909. }
  910. }
  911. }
  912. };
  913. Action<string> action2 = delegate(string name)
  914. {
  915. foreach (string text28 in GameUty.PathList)
  916. {
  917. if (AddFolderOrArchive(name + "_" + text28))
  918. {
  919. if (name == "csv")
  920. {
  921. GameUty.ExistCsvPathList.Add(text28);
  922. }
  923. for (int num10 = 2; num10 <= check_ver_no; num10++)
  924. {
  925. AddFolderOrArchive(string.Concat(new object[]
  926. {
  927. name,
  928. "_",
  929. text28,
  930. "_",
  931. num10
  932. }));
  933. }
  934. }
  935. }
  936. };
  937. StopWatch stopWatch = new StopWatch();
  938. Debug.Log("■■■■■■■■ Archive Log[2.1 Compatibility] (GameData_20) ■■■■■■■■");
  939. gameDataPath = "GameData_20";
  940. GameUty.m_FileSystem.SetBaseDirectory(text);
  941. GameUty.PathList = GameUty.ReadAutoPathFile("[2.1Compatibility]", text + gameDataPath + "\\paths.dat");
  942. if (GameUty.PathList != null && 0 < GameUty.PathList.Count)
  943. {
  944. foreach (string text2 in GameUty.PathList)
  945. {
  946. string text3 = "material";
  947. if (text2 == "denkigai2015wTowelR")
  948. {
  949. AddFolderOrArchive(text3 + "_denkigai2015wTowel");
  950. }
  951. string arg = text3 + "_" + text2;
  952. bool flag = AddFolderOrArchive(arg);
  953. if (flag)
  954. {
  955. for (int i = 2; i <= check_ver_no; i++)
  956. {
  957. AddFolderOrArchive(string.Concat(new object[]
  958. {
  959. text3,
  960. "_",
  961. text2,
  962. "_",
  963. i
  964. }));
  965. }
  966. }
  967. }
  968. action("menu");
  969. action("model");
  970. action("texture");
  971. AddFolderOrArchive("prioritymaterial");
  972. List<string> pathList = GameUty.PathList;
  973. GameUty.PathList = new List<string>();
  974. GameUty.PathList.Add("vp001");
  975. action("bg");
  976. action("motion");
  977. GameUty.PathList = pathList;
  978. }
  979. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  980. Debug.Log("■■■■■■■■ Archive Log[2.1] (GameData) ■■■■■■■■");
  981. gameDataPath = "GameData";
  982. GameUty.PathList = GameUty.ReadAutoPathFile("[2.1]", text + gameDataPath + "\\paths.dat");
  983. if (GameUty.PathList == null)
  984. {
  985. GameUty.PathList = new List<string>();
  986. NDebug.Assert("paths.datを読み込めませんでした", false);
  987. }
  988. GameUty.PathList.Add(Product.gameDataPath.Replace("_", string.Empty));
  989. AddFolderOrArchive("csv");
  990. foreach (string text4 in GameUty.PathList)
  991. {
  992. string text5 = "csv";
  993. if (AddFolderOrArchive(text5 + "_" + text4))
  994. {
  995. for (int j = 2; j <= check_ver_no; j++)
  996. {
  997. AddFolderOrArchive(string.Concat(new object[]
  998. {
  999. text5,
  1000. "_",
  1001. text4,
  1002. "_",
  1003. j
  1004. }));
  1005. }
  1006. }
  1007. }
  1008. AddFolderOrArchive("prioritymaterial");
  1009. NDebug.Assert(AddFolderOrArchive("motion"), str + "motion");
  1010. foreach (string text6 in GameUty.PathList)
  1011. {
  1012. string text7 = "motion";
  1013. if (AddFolderOrArchive(text7 + "_" + text6))
  1014. {
  1015. AddFolderOrArchive(text7 + "_" + text6 + "_gp003");
  1016. for (int k = 2; k <= check_ver_no; k++)
  1017. {
  1018. AddFolderOrArchive(string.Concat(new object[]
  1019. {
  1020. text7,
  1021. "_",
  1022. text6,
  1023. "_",
  1024. k
  1025. }));
  1026. }
  1027. }
  1028. }
  1029. AddFolderOrArchive("motion2");
  1030. NDebug.Assert(AddFolderOrArchive("script"), str + "script");
  1031. foreach (string text8 in GameUty.PathList)
  1032. {
  1033. string text9 = "script";
  1034. if (AddFolderOrArchive(text9 + "_" + text8))
  1035. {
  1036. for (int l = 2; l <= check_ver_no; l++)
  1037. {
  1038. AddFolderOrArchive(string.Concat(new object[]
  1039. {
  1040. text9,
  1041. "_",
  1042. text8,
  1043. "_",
  1044. l
  1045. }));
  1046. }
  1047. }
  1048. }
  1049. AddFolderOrArchive("script_share");
  1050. foreach (string text10 in GameUty.PathList)
  1051. {
  1052. string text11 = "script_share";
  1053. if (AddFolderOrArchive(text11 + "_" + text10))
  1054. {
  1055. for (int m = 2; m <= check_ver_no; m++)
  1056. {
  1057. AddFolderOrArchive(string.Concat(new object[]
  1058. {
  1059. text11,
  1060. "_",
  1061. text10,
  1062. "_",
  1063. m
  1064. }));
  1065. }
  1066. }
  1067. }
  1068. AddFolderOrArchive("script_share2");
  1069. NDebug.Assert(AddFolderOrArchive("sound"), str + "sound");
  1070. foreach (string text12 in GameUty.PathList)
  1071. {
  1072. string text13 = "sound";
  1073. if (AddFolderOrArchive(text13 + "_" + text12))
  1074. {
  1075. for (int n = 2; n <= check_ver_no; n++)
  1076. {
  1077. AddFolderOrArchive(string.Concat(new object[]
  1078. {
  1079. text13,
  1080. "_",
  1081. text12,
  1082. "_",
  1083. n
  1084. }));
  1085. }
  1086. }
  1087. }
  1088. AddFolderOrArchive("sound2");
  1089. NDebug.Assert(AddFolderOrArchive("system"), str + "system");
  1090. foreach (string text14 in GameUty.PathList)
  1091. {
  1092. string text15 = "system";
  1093. if (AddFolderOrArchive(text15 + "_" + text14))
  1094. {
  1095. for (int num = 2; num <= check_ver_no; num++)
  1096. {
  1097. AddFolderOrArchive(string.Concat(new object[]
  1098. {
  1099. text15,
  1100. "_",
  1101. text14,
  1102. "_",
  1103. num
  1104. }));
  1105. }
  1106. }
  1107. }
  1108. AddFolderOrArchive("system2");
  1109. AddFolderOrArchive("language");
  1110. foreach (string text16 in GameUty.PathList)
  1111. {
  1112. string text17 = "language";
  1113. if (AddFolderOrArchive(text17 + "_" + text16))
  1114. {
  1115. for (int num2 = 2; num2 <= check_ver_no; num2++)
  1116. {
  1117. AddFolderOrArchive(string.Concat(new object[]
  1118. {
  1119. text17,
  1120. "_",
  1121. text16,
  1122. "_",
  1123. num2
  1124. }));
  1125. }
  1126. }
  1127. }
  1128. foreach (string text18 in GameUty.PathList)
  1129. {
  1130. string text19 = "bg";
  1131. if (AddFolderOrArchive(text19 + "_" + text18))
  1132. {
  1133. for (int num3 = 2; num3 <= check_ver_no; num3++)
  1134. {
  1135. AddFolderOrArchive(string.Concat(new object[]
  1136. {
  1137. text19,
  1138. "_",
  1139. text18,
  1140. "_",
  1141. num3
  1142. }));
  1143. }
  1144. }
  1145. }
  1146. if (Product.isEnglish && !Product.isPublic)
  1147. {
  1148. string text20 = "bg-en";
  1149. NDebug.Assert(AddFolderOrArchive(text20), str + text20);
  1150. foreach (string text21 in GameUty.PathList)
  1151. {
  1152. if (AddFolderOrArchive(text20 + "_" + text21))
  1153. {
  1154. for (int num4 = 2; num4 <= check_ver_no; num4++)
  1155. {
  1156. AddFolderOrArchive(string.Concat(new object[]
  1157. {
  1158. text20,
  1159. "_",
  1160. text21,
  1161. "_",
  1162. num4
  1163. }));
  1164. }
  1165. }
  1166. }
  1167. AddFolderOrArchive("bg-en2");
  1168. }
  1169. AddFolderOrArchive("voice");
  1170. for (int num5 = 0; num5 < 25; num5++)
  1171. {
  1172. string arg2 = "voice";
  1173. string arg3 = arg2 + "_" + (char)(97 + num5);
  1174. AddFolderOrArchive(arg3);
  1175. }
  1176. foreach (string text22 in GameUty.PathList)
  1177. {
  1178. string text23 = "voice";
  1179. if (AddFolderOrArchive(text23 + "_" + text22))
  1180. {
  1181. for (int num6 = 2; num6 <= check_ver_no; num6++)
  1182. {
  1183. AddFolderOrArchive(string.Concat(new object[]
  1184. {
  1185. text23,
  1186. "_",
  1187. text22,
  1188. "_",
  1189. num6
  1190. }));
  1191. }
  1192. }
  1193. }
  1194. for (int num7 = 2; num7 <= check_ver_no; num7++)
  1195. {
  1196. string arg4 = "voice";
  1197. AddFolderOrArchive(arg4 + num7);
  1198. }
  1199. string text24 = "parts";
  1200. NDebug.Assert(AddFolderOrArchive(text24), str + text24);
  1201. foreach (string text25 in GameUty.PathList)
  1202. {
  1203. if (AddFolderOrArchive(text24 + "_" + text25))
  1204. {
  1205. for (int num8 = 2; num8 <= check_ver_no; num8++)
  1206. {
  1207. AddFolderOrArchive(string.Concat(new object[]
  1208. {
  1209. text24,
  1210. "_",
  1211. text25,
  1212. "_",
  1213. num8
  1214. }));
  1215. }
  1216. }
  1217. }
  1218. AddFolderOrArchive("parts2");
  1219. if (Product.isEnglish && !Product.isPublic)
  1220. {
  1221. string text26 = "parts-en";
  1222. NDebug.Assert(AddFolderOrArchive(text26), str + text26);
  1223. foreach (string text27 in GameUty.PathList)
  1224. {
  1225. if (AddFolderOrArchive(text26 + "_" + text27))
  1226. {
  1227. for (int num9 = 2; num9 <= check_ver_no; num9++)
  1228. {
  1229. AddFolderOrArchive(string.Concat(new object[]
  1230. {
  1231. text26,
  1232. "_",
  1233. text27,
  1234. "_",
  1235. num9
  1236. }));
  1237. }
  1238. }
  1239. }
  1240. AddFolderOrArchive("parts-en2");
  1241. }
  1242. Debug.Log("■■■■■■■■■■■■■■■■■■■■" + stopWatch.Stop().ToString() + " ms");
  1243. }
  1244. public static void UpdateFileSystemPathOld()
  1245. {
  1246. if (!GameUty.IsEnabledCompatibilityMode)
  1247. {
  1248. return;
  1249. }
  1250. FileSystemArchive fileSystem = GameUty.m_FileSystemOld;
  1251. Debug.Log("■■■■■■■■ Archive Log[Legacy]■■■■■■■■");
  1252. Func<string, bool> AddFolderOrArchive = delegate(string name)
  1253. {
  1254. bool flag = fileSystem.AddArchive("GameData\\" + name + ".arc");
  1255. if (flag)
  1256. {
  1257. Debug.Log("[GameData\\" + name + ".arc]を読み込みました");
  1258. }
  1259. return flag;
  1260. };
  1261. int check_ver_no = 3;
  1262. Action<string> action = delegate(string name)
  1263. {
  1264. foreach (string text2 in GameUty.PathListOld)
  1265. {
  1266. if (AddFolderOrArchive(name + "_" + text2))
  1267. {
  1268. if (name == "csv")
  1269. {
  1270. GameUty.ExistCsvPathListOld.Add(text2);
  1271. }
  1272. for (int m = 2; m <= check_ver_no; m++)
  1273. {
  1274. AddFolderOrArchive(string.Concat(new object[]
  1275. {
  1276. name,
  1277. "_",
  1278. text2,
  1279. "_",
  1280. m
  1281. }));
  1282. }
  1283. }
  1284. }
  1285. };
  1286. fileSystem.SetBaseDirectory(GameMain.Instance.CMSystem.CM3D2Path);
  1287. AddFolderOrArchive("csv");
  1288. action("csv");
  1289. AddFolderOrArchive("motion");
  1290. action("motion");
  1291. AddFolderOrArchive("motion2");
  1292. AddFolderOrArchive("script");
  1293. action("script");
  1294. action("script_share");
  1295. AddFolderOrArchive("script_share2");
  1296. AddFolderOrArchive("sound");
  1297. action("sound");
  1298. AddFolderOrArchive("sound2");
  1299. AddFolderOrArchive("texture");
  1300. action("texture");
  1301. AddFolderOrArchive("texture2");
  1302. AddFolderOrArchive("texture3");
  1303. AddFolderOrArchive("system");
  1304. action("system");
  1305. action("bg");
  1306. AddFolderOrArchive("voice");
  1307. AddFolderOrArchive("voice_a");
  1308. AddFolderOrArchive("voice_b");
  1309. AddFolderOrArchive("voice_c");
  1310. foreach (string str in GameUty.PathListOld)
  1311. {
  1312. string str2 = "voice";
  1313. string text = str2 + "_" + str;
  1314. if (AddFolderOrArchive(text))
  1315. {
  1316. for (int i = 2; i <= check_ver_no; i++)
  1317. {
  1318. AddFolderOrArchive(text + "_" + i);
  1319. }
  1320. }
  1321. text = str2 + "_" + str + "a";
  1322. if (AddFolderOrArchive(text))
  1323. {
  1324. for (int j = 2; j <= check_ver_no; j++)
  1325. {
  1326. AddFolderOrArchive(text + "_" + j);
  1327. }
  1328. }
  1329. text = str2 + "_" + str + "b";
  1330. if (AddFolderOrArchive(text))
  1331. {
  1332. for (int k = 2; k <= check_ver_no; k++)
  1333. {
  1334. AddFolderOrArchive(text + "_" + k);
  1335. }
  1336. }
  1337. }
  1338. AddFolderOrArchive("voice2");
  1339. AddFolderOrArchive("voice3");
  1340. fileSystem.AddAutoPathForAllFolder(true);
  1341. while (!fileSystem.IsFinishedAddAutoPathJob(true))
  1342. {
  1343. }
  1344. fileSystem.ReleaseAddAutoPathJob();
  1345. string[] list = fileSystem.GetList("bg", AFileSystemBase.ListType.AllFile);
  1346. if (list != null && 0 < list.Length)
  1347. {
  1348. foreach (string path in list)
  1349. {
  1350. string fileName = Path.GetFileName(path);
  1351. if (!(Path.GetExtension(fileName) != ".asset_bg") && !GameUty.BgFiles.ContainsKey(fileName))
  1352. {
  1353. GameUty.BgFiles.Add(fileName, fileSystem);
  1354. }
  1355. }
  1356. }
  1357. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  1358. }
  1359. public static void ReloadCrcImportPath()
  1360. {
  1361. string text = UTY.gameProjectPath + "\\";
  1362. if (GameUty.m_CrcFileSystem != null)
  1363. {
  1364. GameUty.m_CrcFileSystem.Dispose();
  1365. GameUty.m_CrcFileSystem = null;
  1366. }
  1367. if (Directory.Exists(text + "SaveData\\_gp03_import"))
  1368. {
  1369. GameUty.m_CrcFileSystem = new FileSystemWindows();
  1370. GameUty.m_CrcFileSystem.SetBaseDirectory(text);
  1371. GameUty.m_CrcFileSystem.AddFolder("SaveData\\_gp03_import");
  1372. string[] list = GameUty.m_CrcFileSystem.GetList(string.Empty, AFileSystemBase.ListType.AllFolder);
  1373. foreach (string text2 in list)
  1374. {
  1375. if (!GameUty.m_CrcFileSystem.AddAutoPath(text2))
  1376. {
  1377. Debug.Log("m_CrcFileSystemのAddAutoPathには既に " + text2 + " がありました。");
  1378. }
  1379. }
  1380. }
  1381. }
  1382. public static AFileBase FileOpen(string fileName, AFileSystemBase priorityFileSystem = null)
  1383. {
  1384. if (priorityFileSystem == null)
  1385. {
  1386. priorityFileSystem = GameUty.m_FileSystem;
  1387. }
  1388. AFileSystemBase[] array;
  1389. if (GameUty.ModPriorityToModFolder)
  1390. {
  1391. array = new AFileSystemBase[]
  1392. {
  1393. GameUty.m_ModFileSystem,
  1394. priorityFileSystem,
  1395. GameUty.m_CrcFileSystem
  1396. };
  1397. }
  1398. else
  1399. {
  1400. array = new AFileSystemBase[]
  1401. {
  1402. priorityFileSystem,
  1403. GameUty.m_CrcFileSystem,
  1404. GameUty.m_ModFileSystem
  1405. };
  1406. }
  1407. AFileBase result = null;
  1408. foreach (AFileSystemBase afileSystemBase in array)
  1409. {
  1410. if (afileSystemBase != null && afileSystemBase.IsExistentFile(fileName))
  1411. {
  1412. result = afileSystemBase.FileOpen(fileName);
  1413. break;
  1414. }
  1415. }
  1416. return result;
  1417. }
  1418. public static bool IsExistFile(string fileName, AFileSystemBase priorityFileSystem = null)
  1419. {
  1420. if (priorityFileSystem == null)
  1421. {
  1422. priorityFileSystem = GameUty.m_FileSystem;
  1423. }
  1424. AFileSystemBase[] array;
  1425. if (GameUty.ModPriorityToModFolder)
  1426. {
  1427. array = new AFileSystemBase[]
  1428. {
  1429. GameUty.m_ModFileSystem,
  1430. priorityFileSystem,
  1431. GameUty.m_CrcFileSystem
  1432. };
  1433. }
  1434. else
  1435. {
  1436. array = new AFileSystemBase[]
  1437. {
  1438. priorityFileSystem,
  1439. GameUty.m_CrcFileSystem,
  1440. GameUty.m_ModFileSystem
  1441. };
  1442. }
  1443. foreach (AFileSystemBase afileSystemBase in array)
  1444. {
  1445. if (afileSystemBase != null && afileSystemBase.IsExistentFile(fileName))
  1446. {
  1447. return true;
  1448. }
  1449. }
  1450. return false;
  1451. }
  1452. public static string GetBuildVersionText()
  1453. {
  1454. int num = 1570;
  1455. return (num >= 1000) ? ((float)num / 1000f).ToString("F2") : ((float)num / 100f).ToString("F2");
  1456. }
  1457. public static string GetGameVersionText()
  1458. {
  1459. string text = "COM3D2x64.exe";
  1460. int num = 1570;
  1461. string path = UTY.gameProjectPath + "\\update.lst";
  1462. string[] array = new string[0];
  1463. if (File.Exists(path))
  1464. {
  1465. try
  1466. {
  1467. array = File.ReadAllLines(path, Encoding.GetEncoding("utf-8"));
  1468. }
  1469. catch (Exception ex)
  1470. {
  1471. Debug.LogError(ex.Message);
  1472. array = new string[0];
  1473. }
  1474. }
  1475. foreach (string text2 in array)
  1476. {
  1477. if (!string.IsNullOrEmpty(text2))
  1478. {
  1479. string[] array3 = text2.Split(new char[]
  1480. {
  1481. ','
  1482. });
  1483. if (array3 != null && array3.Length == 2 && array3[0].Trim().ToLower() == text.ToLower())
  1484. {
  1485. int.TryParse(array3[1].Trim(), out num);
  1486. break;
  1487. }
  1488. }
  1489. }
  1490. string text3 = (num >= 1000) ? ((float)num / 1000f).ToString("F3") : ((float)num / 100f).ToString("F3");
  1491. if (text3.Length == 5)
  1492. {
  1493. text3 = text3.Insert(4, ".");
  1494. }
  1495. return text3;
  1496. }
  1497. public static string GetLegacyGameVersionText()
  1498. {
  1499. if (!GameUty.IsEnabledCompatibilityMode)
  1500. {
  1501. return "0.0";
  1502. }
  1503. string text = "CM3D2x64.exe";
  1504. string path = GameMain.Instance.CMSystem.CM3D2Path + "\\update.lst";
  1505. string[] array = new string[0];
  1506. if (File.Exists(path))
  1507. {
  1508. try
  1509. {
  1510. array = File.ReadAllLines(path, Encoding.GetEncoding("utf-8"));
  1511. }
  1512. catch (Exception ex)
  1513. {
  1514. Debug.LogError(ex.Message);
  1515. array = new string[0];
  1516. }
  1517. }
  1518. int num = 0;
  1519. foreach (string text2 in array)
  1520. {
  1521. if (!string.IsNullOrEmpty(text2))
  1522. {
  1523. string[] array3 = text2.Split(new char[]
  1524. {
  1525. ','
  1526. });
  1527. if (array3 != null && array3.Length == 2 && array3 != null && array3.Length == 2 && array3[0].Trim().ToLower() == text.ToLower())
  1528. {
  1529. int.TryParse(array3[1].Trim(), out num);
  1530. break;
  1531. }
  1532. }
  1533. }
  1534. string text3 = (num >= 1000) ? ((float)num / 1000f).ToString("F3") : ((float)num / 100f).ToString("F3");
  1535. if (text3.Length == 5)
  1536. {
  1537. text3 = text3.Insert(4, ".");
  1538. }
  1539. return text3;
  1540. }
  1541. private static FileSystemArchive m_FileSystem = null;
  1542. private static FileSystemArchive m_FileSystemOld = null;
  1543. private static FileSystemWindows m_ModFileSystem = null;
  1544. private static FileSystemWindows m_CrcFileSystem = null;
  1545. public static List<string> PathList = new List<string>();
  1546. public static List<string> ExistCsvPathList = new List<string>();
  1547. public static List<string> PathListOld = new List<string>();
  1548. public static List<string> ExistCsvPathListOld = new List<string>();
  1549. private static string[] m_aryMenuFiles = null;
  1550. private static string[] m_aryModOnlysMenuFiles = new string[0];
  1551. private static Dictionary<int, string> rid_menu_dic_ = new Dictionary<int, string>();
  1552. private static Dictionary<string, AssetBundle> asset_bundle_dic = new Dictionary<string, AssetBundle>();
  1553. private static string ModPriorityToModFolderInfo = "以下のフラグをtrueにするとMODフォルダのファイルが優先されるが、モザイクも安易に外すことが可能になる為に現在はオミット。";
  1554. public static bool ModPriorityToModFolder = false;
  1555. private static string[] m_strSystemMaterialName = new string[]
  1556. {
  1557. "System/Material/2dAlpha",
  1558. "System/Material/2dMultiply",
  1559. "System/Material/InfinityColor",
  1560. "System/Material/TexTo8bitTex"
  1561. };
  1562. private static Material[] m_matSystem = new Material[4];
  1563. public enum SystemMaterial
  1564. {
  1565. Alpha,
  1566. Multiply,
  1567. InfinityColor,
  1568. TexTo8bitTex,
  1569. Max
  1570. }
  1571. }