Advertisement
Guest User

Kirikiri FSN crash

a guest
May 29th, 2018
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.37 KB | None | 0 0
  1. // Initialize.tjs - ????????
  2. // Copyright (C)2001-2005, W.Dee and contributors ??·???????
  3.  
  4. // ?????????
  5. var kagVersion = "3.25 beta 10 TYPE-MOON customized";
  6.  
  7. /*
  8. Debug.message ?????????
  9. */
  10.  
  11. var dm = Debug.message; // ??? dm("message"); ??????? message ??????
  12. function dmt(args*)
  13. {
  14. Debug.message(args.join(", ")+": "+Scripts.getTraceString());
  15. }
  16. @if(DEBUG==1)
  17. var _dm = Debug.message;
  18. @endif
  19. @if(DEBUG!=1)
  20. var _dm = function(){};
  21. @endif
  22.  
  23. @if(!DEBUG)
  24. {
  25. System.setArgument("-debugwin", "no");
  26. // System.setArgument("-datapath", "$(personalpath)\savedata");
  27. System.setArgument("-drawthred", "auto");
  28. System.setArgument = function() {}; // ???
  29. }
  30. @endif
  31.  
  32. /*
  33. ????????????????????
  34. */
  35.  
  36. System.exceptionHandler = function (e)
  37. {
  38. // ????????????????????????????????
  39. // ?????e ??????????
  40. if(e instanceof "ConductorException")
  41. {
  42. // ??????????????
  43. Debug.logAsError(); // ????????????????????
  44. var event_disabled = System.eventDisabled;
  45. System.eventDisabled = true;
  46. // ??????????????????????????
  47. // ???????????????????????
  48. System.inform(e.message);
  49. System.eventDisabled = event_disabled;
  50. // ???????????????????
  51. return true; // true ????????????????????
  52. }
  53. else
  54. {
  55. return false; // false ???????????
  56. }
  57. };
  58.  
  59.  
  60. /*
  61. ?????
  62. ?????????????????????
  63. */
  64.  
  65. function useArchiveIfExists(name)
  66. {
  67. // name ??????????????????
  68. var arcname;
  69. if(Storages.isExistentStorage(arcname = System.exePath + name))
  70. Storages.addAutoPath(arcname + ">");
  71. }
  72.  
  73. Storages.addAutoPath(System.exePath + "video/"); // exePath ??? video/
  74. Storages.addAutoPath(RootDirectory+"voice/"); // voice ????
  75. Storages.addAutoPath(RootDirectory+"video/"); // video ????
  76. Storages.addAutoPath(RootDirectory+"etc/"); // ???
  77. Storages.addAutoPath(RootDirectory+"rule/"); // ?????????
  78. Storages.addAutoPath(RootDirectory+"sound/"); // ???????
  79. Storages.addAutoPath(RootDirectory+"bgm/"); // BGM ????
  80. Storages.addAutoPath(RootDirectory+"fgimage/"); // ????????
  81. Storages.addAutoPath(RootDirectory+"bgimage/"); // ????????
  82. Storages.addAutoPath(RootDirectory+"scenario/"); // ????????
  83. Storages.addAutoPath(RootDirectory+"image/"); // ???????????
  84. Storages.addAutoPath(RootDirectory+"system/"); // ????????
  85.  
  86. Storages.addAutoPath(RootDirectory+"plugin/"); // ?????
  87.  
  88. @if(DEBUG)
  89. Plugins.link("dirlist.dll");
  90. var dirs = [ "bgimage/", "fgimage/", "image/", "scenario/", "rule/", "sound/", "etc/", "voice/" ];
  91. for(var i=0; i<dirs.count; i++)
  92. {
  93. var dir = dirs[i];
  94. var files = getDirList(dir);
  95. for(var i=0; i<files.count; i++)
  96. {
  97. var fn = files[i];
  98. if(fn[0] == ".")
  99. continue;
  100. if(fn[fn.length - 1] == "/")
  101. {
  102. dirs.add(dir + fn);
  103. Storages.addAutoPath(RootDirectory+dir+fn);
  104. }
  105. }
  106. }
  107. @endif
  108.  
  109. /*
  110. {// ????????(patch?????)
  111. Debug.message("start \"add auto path\"");
  112. var path = Scripts.evalStorage("searchpath.ksc");
  113. for(var i=path.count-1; i>=0; i--)
  114. {
  115. if(path[i] == void)
  116. continue;
  117. Storages.addAutoPath(RootDirectory+path[i]);
  118. Debug.message("add auto path: "+RootDirectory+path[i]);
  119. }
  120. }
  121. {// Fate_PS2?????
  122. Plugins.link("dirlist.dll");
  123. var base = "d:/Fate_PS2/data/";
  124. var dirs = [ "bgimage/", "fgimage/", "sound/", "bgm/" ];
  125. for(var i=0; i<dirs.count; i++)
  126. {
  127. var dir = dirs[i];
  128. var files = getDirList(base + dir);
  129. for(var i=0; i<files.count; i++)
  130. {
  131. var file = files[i];
  132. if(file[0] != "." && file[file.length-1] == "/")
  133. {
  134. Debug.message("add auto path: "+base + dir+file);
  135. dirs.add(dir+file);
  136. }
  137. }
  138. Storages.addAutoPath(base + dir);
  139. }
  140. }
  141. */
  142.  
  143. // ??????????????
  144. // ???????????????????????????
  145. // ????????????????????
  146. useArchiveIfExists("voice.xp3");
  147. useArchiveIfExists("video.xp3");
  148. useArchiveIfExists("others.xp3");
  149. useArchiveIfExists("rule.xp3");
  150. useArchiveIfExists("sound.xp3");
  151. useArchiveIfExists("bgm.xp3");
  152. useArchiveIfExists("etc.xp3");
  153. useArchiveIfExists("fgimage.xp3");
  154. useArchiveIfExists("bgimage.xp3");
  155. useArchiveIfExists("scenario.xp3");
  156. useArchiveIfExists("image.xp3");
  157. useArchiveIfExists("system.xp3");
  158.  
  159. useArchiveIfExists("patch.xp3");
  160.  
  161. // ???????????????
  162. /*
  163. for(var i = 2; ; i++)
  164. {
  165. // ????????? patch2.xp3, patch3.xp3 ... ??????????
  166. // ???????????
  167. if(Storages.isExistentStorage(System.exePath + "patch" + i + ".xp3"))
  168. Storages.addAutoPath(System.exePath + "patch" + i + ".xp3>");
  169. else
  170. break;
  171. }
  172. */
  173.  
  174. delete useArchiveIfExists; // useArchiveIfExists ????????????????
  175.  
  176. /*
  177. ?????????
  178. */
  179. Debug.notice("OS : " + System.osName + " (" + System.platformName + ")");
  180. Debug.notice("KAG : " + kagVersion);
  181. Debug.notice("Kirikiri : " + System.versionString);
  182.  
  183. /*
  184. ( ???? ) ????
  185. */
  186.  
  187. var parseStartTick = System.getTickCount();
  188.  
  189.  
  190. /*
  191. ?????????????
  192. */
  193.  
  194. function KAGLoadScript(name)
  195. {
  196. var start = System.getTickCount();
  197. Scripts.execStorage(name);
  198. dm(name + " ????????(" + (System.getTickCount() - start) + "ms)");
  199. }
  200.  
  201. var loaded_scripts = %[];
  202.  
  203. function KAGLoadScriptOnce(name)
  204. {
  205. // ??????????????????????????
  206. if(global.loaded_scripts[name] === true) return; // ?????????
  207. global.KAGLoadScript(name);
  208. global.loaded_scripts[name] = true;
  209. }
  210.  
  211. /*
  212. Config.tjs ????
  213. */
  214. if(Storages.isExistentStorage("Config.tjs"))
  215. {
  216. KAGLoadScript("Config.tjs");
  217. }
  218. else if(Storages.isExistentStorage("Config.~new"))
  219. {
  220. System.inform("Config.tjs ?????????\nsystem ??????? "
  221. "Config.~new ????? Config.tjs ??????????");
  222. System.exit();
  223. }
  224. else
  225. {
  226. throw new Exception("Config.tjs ?????????");
  227. }
  228.  
  229. /*
  230. Config.tjs ?????????
  231. */
  232.  
  233. if(typeof global.config_version == "undefined" || config_version != kagVersion)
  234. {
  235. KAGLoadScript("UpdateConfig.tjs");
  236. }
  237.  
  238. // savedata ?????????
  239. @if(!DEBUG)
  240. {
  241. var dir = System.personalPath + "faterealtanua_savedata/";
  242. try
  243. {
  244. Plugins.link("dirlist.dll");
  245. var files = getDirList(dir);
  246. var patches = [];
  247. for(var i=0; i<files.count; i++)
  248. {
  249. var fn = files[i];
  250. if(fn.substr(0, 8) == "rinpatch" && Storages.extractStorageExt(fn) == ".xp3")
  251. patches.add(fn);
  252. }
  253. patches.sort("a");
  254. for(var i=0; i<patches.count; i++)
  255. {
  256. Storages.addAutoPath(dir + patches[i] + ">");
  257. // ???????????????
  258. }
  259. }
  260. catch(e)
  261. dm(dir+" ??????????");
  262. }
  263. @endif
  264.  
  265. /*
  266. ?????????
  267. */
  268.  
  269. // ???????????????????????
  270. if(RootDirectory==void && !System.createAppLock(System.exePath.replace(/[^A-Za-z]/g, '_')))
  271. {
  272. // ?????????
  273. System.inform(System.title + "???????????");
  274. System.exit();
  275. }
  276.  
  277.  
  278. /*
  279. ??·????·??????????????
  280. */
  281.  
  282.  
  283. property askYesNo { getter() { KAGLoadScript("YesNoDialog.tjs"); return global.askYesNo; } }
  284. property CheckBoxLayer { getter() { KAGLoadScript("CheckBoxLayer.tjs"); return global.CheckBoxLayer; } }
  285. property ButtonLayer { getter() { KAGLoadScript("ButtonLayer.tjs"); return global.ButtonLayer; } }
  286. property EditLayer { getter() { KAGLoadScript("EditLayer.tjs"); return global.EditLayer; } }
  287. property KAGPlugin { getter() { KAGLoadScript("Plugin.tjs"); return global.KAGPlugin; } }
  288.  
  289. /*
  290. ?????????
  291. */
  292. dm("KAG System ??????????????...");
  293.  
  294. KAGLoadScript("Utils.tjs");
  295. KAGLoadScript("KAGLayer.tjs");
  296. KAGLoadScript("HistoryLayer.tjs");
  297. KAGLoadScript("BGM.tjs");
  298. KAGLoadScript("SE.tjs");
  299. KAGLoadScript("Movie.tjs");
  300. KAGLoadScript("Conductor.tjs");
  301. KAGLoadScript("AnimationLayer.tjs");
  302. KAGLoadScript("GraphicLayer.tjs");
  303. @set(OLDMESSAGELAYER=1)
  304. @if(OLDMESSAGELAYER==1)
  305. KAGLoadScript("MessageLayer.tjs");
  306. @endif
  307. @if(OLDMESSAGELAYER!=1)
  308. KAGLoadScript("ActingMessageLayer.tjs");
  309. @endif
  310. KAGLoadScript("Menus.tjs");
  311. //KAGLoadScript("DefaultMover.tjs");
  312. KAGLoadScript("MainWindow.tjs");
  313. if(Storages.isExistentStorage("Override.tjs"))
  314. KAGLoadScript("Override.tjs");
  315. /*
  316. if(Storages.isExistentStorage(System.exePath + "Override2.tjs"))
  317. KAGLoadScript(System.exePath + "Override2.tjs");
  318. */
  319.  
  320. /*
  321. ( ???? ) ????
  322. */
  323. dm("??????????? " + (System.getTickCount() - parseStartTick) + "ms ??????");
  324. parseStartTick = System.getTickCount();
  325.  
  326. /*
  327. ( ???? ) VM ???????
  328. */
  329.  
  330. // Scripts.dump();
  331.  
  332. /*
  333. ( ???? ) ????
  334. */
  335.  
  336. parseStartTick = System.getTickCount();
  337.  
  338.  
  339. /*
  340. KAG ???????????
  341. ???????? kag ???????? KAGWindow ????
  342. ??????????????
  343. */
  344.  
  345. global.kag = new KAGWindow();// if typeof global.kag == "undefined"; // ScenarioEditer????
  346.  
  347.  
  348.  
  349.  
  350. /*
  351. ??????????????????????????
  352. ????????
  353. */
  354.  
  355. var f = kag.flags; // ????? (???)
  356. var sf = kag.sflags; // ?????? (????)
  357. var tf = kag.tflags; // ???? (?????)
  358.  
  359. property mp
  360. {
  361. getter { return kag.conductor.macroParams; }
  362. }
  363.  
  364. /*
  365. ( ???? ) ????
  366. */
  367. dm("KAGMainWindow ????????? " + (System.getTickCount() - parseStartTick) + "ms ??????");
  368. delete parseStartTick;
  369.  
  370.  
  371. /*
  372. AfterInit.tjs ????????
  373. */
  374. if(Storages.isExistentStorage("AfterInit.tjs"))
  375. KAGLoadScript("AfterInit.tjs");
  376. /*
  377. if(Storages.isExistentStorage(System.exePath + "AfterInit2.tjs"))
  378. KAGLoadScript(System.exePath + "AfterInit2.tjs");
  379. */
  380.  
  381. /*
  382. ??????????????? -ovr ?????????
  383. ???????? TJS ??????
  384. */
  385. /*
  386. {
  387. var ovr = System.getArgument('-ovr');
  388. if(ovr !== void && ovr != 'yes') Scripts.eval(ovr);
  389. }
  390. */
  391.  
  392. // krkr 2.25 beta 8 ????exe??"imageTagLayerType"???????????????
  393. if(typeof global.imageTagLayerType == "undefined")
  394. {
  395. global.imageTagLayerType = %[
  396. opaque: %[type:ltOpaque],
  397. rect: %[type:ltOpaque],
  398. addalpha: %[type:ltAddAlpha],
  399. add: %[type:ltAdditive],
  400. sub: %[type:ltSubtractive],
  401. mul: %[type:ltMultiplicative],
  402. dodge: %[type:ltDodge],
  403. darken: %[type:ltDarken],
  404. lighten: %[type:ltLighten],
  405. screen: %[type:ltScreen],
  406. ];
  407. }
  408.  
  409. /*
  410. first.ks ???
  411. */
  412.  
  413. kag.process("first.ks");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement