Advertisement
Guest User

Mario Mender 64 V0.1 (11H2)

a guest
Sep 23rd, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 62.73 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <!-- saved from url=(0014)about:internet -->
  4. <!-- The above line must be followed by a WINDOWS FORMAT line break (so use notepad, not gedit) -->
  5. <!-- Source: https://stackoverflow.com/questions/8146926/why-does-ie-restrict-the-javascript-files-of-local-html-pages -->
  6. <html>
  7. <head>
  8. <meta charset="UTF-8"> <!--Makes "character encoding of the HTML document was not declared" message go away-->
  9. <!-- Source: https://stackoverflow.com/questions/11996257/the-character-encoding-of-the-html-document-was-not-declared#12819926 -->
  10. <style>
  11.    
  12. /*====================================================================*/
  13. /*============================= Styling ==============================*/
  14. /*====================================================================*/
  15.  
  16.  
  17. * {
  18.     box-sizing: border-box;
  19. }
  20. body {
  21.     background-color: #2d3134; /*Dark Grey*/
  22.     width:350px; /*set width narrow to force floating elements to form as a column*/
  23.     font-family: verdana
  24. }
  25. .MM64 { /*testing inbuilt splashscreen*/
  26.     /*width: -webkit-max-content;*/
  27.     /*width: -moz-max-content;*/
  28.     /*background-color: #1a1146; Dark blue*/
  29.     background-color: black;
  30.     font-family: sans-serif;
  31.     padding-left: 10px;
  32.     /*padding-right: 15px;*/
  33.     padding-right: 38px;
  34.     padding-bottom: 2px;
  35.     /*overflow: scroll;*/
  36.     /*display: inline-flex;*/
  37.     float: left;
  38.     /*position: absolute;*/
  39.    
  40.     /*FONTS HERE ARE A RED HERING - look below at h1 and h64 instead*/
  41.    
  42.     /*font-family: verdana; /*-- used in G-5*/
  43.     /*font-family: Impact;*/
  44.     /*font-family: font-family: Franklin Gothic Medium,Franklin Gothic,ITC Franklin Gothic,Arial,sans-serif; */
  45.  
  46. }
  47. h1 { /*"Mario Mender" Splash Text*/
  48.     /*color: #345eb2; Light Blue*/
  49.     color: blue;
  50.     margin-top: 0px;
  51.     margin-left: 0%;
  52.     margin-bottom: 0px;
  53.     width: auto;
  54.     /*background-color: pink;*/
  55.     font-family: sans-serif;
  56.    
  57.     /*Stetching code https://stackoverflow.com/questions/6351013/css-can-i-stretch-text#12065925*/
  58.     transform-origin: left; /*Really awesome bit of code, hang on to this one*/
  59.     display:inline-block;
  60.     /*letter-spacing: -1.8px;*/
  61.     letter-spacing: -0.07em;
  62.     -webkit-transform:scale(1.1,1); /* Safari and Chrome */
  63.     -moz-transform:scale(1.1,1); /* Firefox */
  64.     -ms-transform:scale(1.1,1); /* IE 9 */
  65.     -o-transform:scale(1.1,1); /* Opera */
  66.     transform:scale(1.1,1); /* W3C */
  67. }
  68.  
  69. h1 .h64 {
  70.     color: red;
  71.     letter-spacing: 0px;
  72.     font-size: x-large;
  73.     vertical-align: super;
  74.     font-family: sans-serif;
  75. }
  76. #splash {
  77.         float: left;
  78.         width: 800px;
  79.         background-color: #cccccc;
  80.         /*background-color: #345eb2; */
  81.         font-family: sans-serif;
  82.         padding-left: 10px;
  83.         padding-right: 10px;
  84.         /*border: 2px solid black;*/
  85. }
  86. table, td, th {
  87.     border: 1px solid black;
  88.     margin-top: 0px;
  89.     margin-bottom:0px
  90. }
  91.  
  92. /*.maincontainer { Contains everything that isn't the debug display to the right*/
  93. #maincontainer { /*Contains everything that isn't the debug display to the right*/
  94.     width: 500px;
  95.     float: left; /*added*/
  96.     display: none; /*Hide by default*/
  97. }
  98. .header { /*Where the debug button lives*/
  99.     background-color: pink;
  100.     color: white;
  101.     padding: 15px;
  102.     width: 100%; /*was 100%*/
  103.     float: left;
  104.     display: none; /*Set to invisible, remove this to make visible again*/
  105. }
  106. .footer { /*To be used for printer (header part obsolete)*/
  107.     background-color: black;
  108.     color: white;
  109.     padding: 15px;
  110.     width: 100%; /*was 100%*/
  111.     float: left;
  112.     font-family: monospace;
  113. }
  114. #videobox { /*instruction box, was blue but isn't anymore*/
  115.     /*background-color: grey;*/
  116.     color: white;
  117.     padding: 15px;
  118.     width: 100%; /*was 100%*/
  119.     height: 230px;
  120.     float: left;
  121.     text-align: center;
  122.     /*background-image: url("a.gif"); Works fine, but disabling for now*/
  123.     /*background-color: #597ce3;  (blue)*/
  124.     background-color: #cccccc;
  125.     font-family: Franklin Gothic Medium,Franklin Gothic,ITC Franklin Gothic,Arial,sans-serif;
  126.     background-repeat: no-repeat;
  127.     background-size: 100% 100%; /*fill div width 100%, same for height*/
  128. }
  129.  
  130. .vidoverlay { /*For printing text instructions over the videos*/
  131.     /*color: pink; was pink*/
  132.     color: black;
  133.     text-align: center;
  134.     position: relative;
  135.     /*font-family: sans-serif;*/
  136.     font-size: large;
  137.     /*font-weight: bold;*/
  138.     /*bottom: 80px;*/ /*Move up 80px relative to normal location*/
  139. }
  140. .leftrightboxcontainer { /*The container for the input and instruction windows*/
  141.     content: "";
  142.     clear: both;
  143.     display: table; /*Really important! and completely glossed over!*/
  144.     height: 100%;
  145.     width: 100%; /*New addition as of 9(A)*/
  146.     background-color: green;
  147. }
  148. .column { /*Instruction window, below video to the right*/
  149.     float: left;
  150.     padding: 10px;
  151.     /*background-color: yellow;*/
  152.     background-color: #f7c50e; /*SM64 yellow*/
  153.     font-family: Franklin Gothic Medium,Franklin Gothic,ITC Franklin Gothic,Arial,sans-serif;
  154. }
  155. .leftinput { /*The Input Window*/
  156.     width: 50%; /*was 33%*/
  157.     background-color: red;
  158.     height: 50%; /*added*/
  159. }
  160. .rightinstruction { /*The Instruction Window... again?*/
  161.     /*width: 50%;*/ /*was 33%*/
  162.     width: 100%;
  163.     height: 50%; /*added*/
  164.     overflow: auto;
  165. }
  166.  
  167. #debugbox { /*The debug display box*/
  168.     background-color: #6efffd;
  169.     float: left;
  170.     color: black;
  171.     padding: 15px;
  172.     width: 18%;
  173.     display: none; /* Change if you want debug display to be invisible by default*/
  174.     /*
  175.     display: block; basically means the element will exist
  176.     display: none; means the element will not exist
  177.     */
  178. }
  179. #FFooter {
  180.     display: none; /* Footer invisible by default*/
  181. }
  182. button {
  183.     font-family: Franklin Gothic Medium,Franklin Gothic,ITC Franklin Gothic,Arial,sans-serif;*/
  184.     /*font-family: impact;*/
  185.     /*font-weight: bold;*/
  186. }
  187. select {
  188.     font-family: Franklin Gothic Medium,Franklin Gothic,ITC Franklin Gothic,Arial,sans-serif;*/
  189. }
  190. table {
  191.     border-radius: 15px;
  192.     border-spacing: 0;
  193. }
  194. td, tr {
  195.     border: 0px;
  196.     padding: 8px;
  197.     text-align: left;
  198. }
  199. tr:nth-child(even) { /*table row stripes*/
  200.     /*background-color: #f2f2f2;*/
  201.     background-color: #c0c0c0;
  202. }
  203. a {
  204.     color: #000077; /*Change link colour to a darker blue*/
  205. }
  206.  
  207. </style>
  208.  
  209. <!--=================================================================-->
  210. <!--========================= End Styling ===========================-->
  211. <!--=================================================================-->
  212.  
  213.  
  214. <!--=================================================================-->
  215. <!--=========================== Script ==============================-->
  216. <!--=================================================================-->
  217.  
  218. <!-- activex script bother source: https://stackoverflow.com/questions/8146926/why-does-ie-restrict-the-javascript-files-of-local-html-pages#8146943 -->
  219. <script>
  220.  
  221. // These are pretty much just test variables at this point
  222. var debugdisplay= 0; // 0 for invisible, 1 for visible
  223. var testvar= 12; // Just for debugging
  224. var testvar2= 12; // Just for debugging
  225. var userno= 19; // doesn't seem to do anything? Just for debugging?
  226. var hexstring= 0; // temporary holding var, contents copied to enteredvalue, used for fog detecting
  227.  
  228. var alpha48= 0; // quick hack used to decide if the alpha texture fix for older hacks is to be used
  229.  
  230. //When dealing with arrays, VERY important to declare using square brakets
  231. var lvlswithfog= []; // Array for storing the levels which have fog ()
  232. var lvlstartadd1= []; // Array holds the start address of each level in decimal (48 or 64MB)
  233. var lvlstartaddhex= []; // Array holds the start address of each level in hex (48 or 64MB), used for printing instructions
  234.  
  235. var lvlendaddDEC= []; // Array holds the end address of each level in decimal (48 or 64MB)
  236. var lvlendaddhex= []; // Array holds the end address of each level in hex (48 or 64MB), used for printing instructions
  237.  
  238. var gotoadd= 0; // stores the "goto address" to be shown to the user
  239. var lvlswithfogSTARTADD= []; //the start address in decimal of lvls with fog
  240. var lvlswithfogENDADD= []; //the end address in decimal of lvls with fog
  241. var lvlswithfogSTARThex= []; //the start address in hex of lvls with fog
  242. var lvlswithfogENDhex= []; //the end address in hex of lvls with fog
  243.  
  244. //               Start -=- End
  245. //------------------------------------------
  246. //        lvlstartadd1 -=- lvlendaddDEC
  247. //      lvlstartaddhex -=- lvlendaddhex
  248. // lvlswithfogSTARTADD -=- lvlswithfogENDADD
  249. // lvlswithfogSTARThex -=- lvlswithfogENDhex
  250.  
  251. var FCvalve= 0; // Thing for dealing with finding FCs in the last level slot
  252.  
  253.  
  254. var FCholdingarray= [];
  255. // FC Command 'banks', one for each level
  256. var FClvl00= [];
  257. var FClvl01= [];
  258. var FClvl02= [];
  259. var FClvl03= [];
  260. var FClvl04= [];
  261. var FClvl05= [];
  262. var FClvl06= [];
  263. var FClvl07= [];
  264. var FClvl08= [];
  265. var FClvl09= [];
  266. var FClvl10= [];
  267. var FClvl11= [];
  268. var FClvl12= [];
  269. var FClvl13= [];
  270. var FClvl14= [];
  271. var FClvl15= [];
  272. var FClvl16= [];
  273. var FClvl17= [];
  274. var FClvl18= [];
  275. var FClvl19= [];
  276. var FClvl20= [];
  277. var FClvl21= [];
  278. var FClvl22= [];
  279. var FClvl23= [];
  280. var FClvl24= [];
  281. var FClvl25= [];
  282. var FClvl26= [];
  283. var FClvl27= [];
  284. var FClvl28= [];
  285. var FClvl29= [];
  286. var FClvl30= [];
  287. //var FClvl31= []; // Pointless!
  288.  
  289.  
  290. var foglvlmarker= 0; //To keep track of level we're currently looking at
  291. var FClvlmarker= 0;
  292.  
  293. var selectTitle= 0; // Stores options the user selects
  294. var selectHead= 0;
  295. var selectPeach= 0;
  296. var selectPipe= 0;
  297. var selectCam= 0;
  298. var selectMCam= 0;
  299.  
  300. var sledgeFrom= "1200000"; //Replace all FCs from this location onwards (can be set to A00000 via options)
  301.  
  302. var theDate= 0;
  303. var dateStamp= 0;
  304. var dateStampDest= [];
  305. var testscript= "I'ma script, see?";
  306. var standardScript= "", alphaScript= "", titleScript= "", headScript= "", peachScript= "", pipeScript= "", camScript= "", mcamScript= "", fogScript= "", stampScript= "";
  307.  
  308. /*========================== GUI script ==============================*/
  309. function clearsplash() { // Clears splash screen and reveals main GUI emelments
  310.      document.getElementById('splash').style.display = "none"; // Hides splash
  311.      document.getElementById('maincontainer').style.display = "block"; // Reveals maincontainer
  312.      document.body.scrollTop = 0; // For Safari
  313.      document.documentElement.scrollTop = 0; // For others
  314. }
  315.  
  316. function cleargui() {
  317.     document.getElementById('gui').innerHTML="";
  318. }
  319. function printromsize() {
  320.     document.getElementById('gui').innerHTML='<p></p>Which of these options best describes your rom hack?</p><button onclick="THE48MBbutton()">Rom Size is 48MB / was made prior to 2013</button><br/><button onclick="THE64MBbutton()">Rom Size is 64MB / was made in 2013 or later</button><br/><br/>Rom size is a better guide than the release date - if the there&#39s a clash, go with that. If your rom size is something other than 48MB or 64MB, you are unlikely to get good results.';
  321. }
  322. function printoptions() {
  323.     document.getElementById('gui').innerHTML='<h3>Options</h3>If in doubt, stick with the recomended defaults<br/><br/>Title Screen<br/><select id="OptTitle"><option>Do Nothing (recomended)</option><option>Skip</option><option>Restore</option><option>Attempt Repair of Custom Title Screen (experimental)</option></select><br/><br/>Mario Head Screen<br/><select id="OptHead"><option>Restore, then skip using alternative method (recomended)</option><option>Restore</option><option>Skip (WARNING: results in no picture on console!)</option><option>Do Nothing</option></select><br/><br/>Peach Intro<br/><select id="OptPeach"><option>Skip (recomended)</option><option>Do Nothing</option></select><br/><br/>Warp Pipe Behaviour<br/><select id="OptPipe"><option>Change to normal warp behaviour (recomended)</option><option>Do Nothing</option></select><br/><br/>Parallel lakitu patch by aglab2 (up to date?)<br/><a href="http://origami64.net/showthread.php?tid=838" target="_new">(http://origami64.net/showthread.php?tid=838)</a><select id="OptCam"><option>Apply Patch (recomended)</option><option>Do Nothing</option></select><br/><br/>Star Road style Mario Cam (Code by Skelux)<br/><a href="https://smwc.me/991239" target="_new">(https://smwc.me/991239)</a><br/><select id="OptMCam"><option>Apply (recomended)</option><option>Do Nothing</option></select><br/><br/><button onclick="grabOptions()">Next</button>';
  324.  
  325. // var x = (document.getElementById("OptTitle")).selectedIndex;
  326.  
  327. /*
  328. <h3>Options</h3>
  329. <br/>
  330. <br/>
  331. Title Screen<br/>
  332. <select id="OptTitle">
  333.     <option>Do Nothing (recomended)</option> //0
  334.     <option>Skip</option> //1
  335.     <option>Restore</option> //2
  336.     <option>Attempt Repair of Custom Title Screen (experimental)</option> //3
  337. </select>
  338. <br/>
  339. <br/>
  340. Mario Head Screen<br/>
  341. <select id="OptHead">
  342.     <option>Restore, then skip using alternative method (recomended)</option> //0
  343.     <option>Restore</option> //1
  344.     <option>Skip (WARNING: results in no picture on console!)</option> //2
  345.     <option>Do Nothing</option> //3
  346. </select>
  347. <br/>
  348. <br/>
  349. Peach Intro<br/>
  350. <select id="OptPeach">
  351.     <option>Skip (recomended)</option> //0
  352.     <option>Do Nothing</option> //1
  353. </select>
  354. <br/>
  355. <br/>
  356. Warp Pipe Behaviour<br/>
  357. <select id="OptPipe">
  358.     <option>Change to normal wrap behaviour (recomended)</option> //0
  359.     <option>Do Nothing</option> //1
  360. </select>
  361. <br/>
  362. <br/>
  363. Parallel lakitu patch by aglab2 (Up2date?)<br/>
  364. <a href="http://origami64.net/showthread.php?tid=838">(http://origami64.net/showthread.php?tid=838)</a>
  365. <select id="OptCam">
  366.     <option>Apply Patch (recomended)</option> //0
  367.     <option>Do Nothing</option> //1
  368. </select>
  369. <br/>
  370. <br/>
  371. Star Road style Mario Cam (Code by Skelux)<br/>
  372. <a href="https://www.smwcentral.net/?p=viewthread&t=60812">(https://www.smwcentral.net/?p=viewthread&t=60812)</a>
  373. <select id="OptMCam">
  374.     <option>Apply (recomended)</option> //0
  375.     <option>Do Nothing</option> //1
  376. </select>
  377. <br/>
  378. <br/>
  379. <button onclick="initialisefindfog()">Next</button>';
  380. */
  381.  
  382. } // End printOptions()
  383.  
  384. function grabOptions() {
  385.     //var x = (document.getElementById("OptTitle")).selectedIndex;
  386.     //initialisefindfog();
  387.     selectTitle= (document.getElementById("OptTitle")).selectedIndex;
  388.     selectHead= (document.getElementById("OptHead")).selectedIndex;
  389.     selectPeach= (document.getElementById("OptPeach")).selectedIndex;
  390.     selectPipe= (document.getElementById("OptPipe")).selectedIndex;
  391.     selectCam= (document.getElementById("OptCam")).selectedIndex;
  392.     selectMCam= (document.getElementById("OptMCam")).selectedIndex;
  393.     initialisefindfog();
  394.    
  395. }
  396.  
  397. function initialisefindfog() {
  398.     gotoadd= lvlstartaddhex[0];
  399.     //printgoto();
  400.     FIRSTprintgoto();
  401. }
  402. function initialisefindFC() {
  403.     foglvlmarker= 0; //reusingfoglvlmarker,maybe a bad idea, easy enough to make a new one.
  404.     //gotoadd= lvlstartaddhex[0]; // I don't like this, generate new array listing only start addresses (decimal) of lvls with fog.
  405.     for (foglvlmarker= 0; foglvlmarker < lvlswithfog.length; foglvlmarker++) {
  406.         var temphold= 0;
  407.         temphold=lvlstartadd1[lvlswithfog[foglvlmarker]]; // temphold= startaddress(decimal) of a level containing fog
  408.         lvlswithfogSTARTADD.push(temphold);
  409.        
  410.         temphold= 0;
  411.         temphold=lvlstartaddhex[lvlswithfog[foglvlmarker]]; // temphold= startaddress(hex) of a level containing fog
  412.         lvlswithfogSTARThex.push(temphold);
  413.     }
  414.    
  415.     foglvlmarker= 0;
  416.    
  417.     for (foglvlmarker= 0; foglvlmarker < lvlswithfog.length; foglvlmarker++) {
  418.         var temphold= 0;
  419.         temphold=lvlendaddDEC[lvlswithfog[foglvlmarker]];
  420.         lvlswithfogENDADD.push(temphold);
  421.        
  422.         temphold= 0;
  423.         temphold=lvlendaddhex[lvlswithfog[foglvlmarker]]; // temphold= startaddress(hex) of a level containing fog
  424.         lvlswithfogENDhex.push(temphold);
  425.     }
  426.    
  427.     foglvlmarker= 0;
  428.     gotoadd= lvlswithfogSTARThex[0];
  429.    
  430.     printgotoFC();
  431.     debugprint();
  432. }
  433. function printfindfog() { // maybe should also be a findNEXTfog like with FC - none found first time round sends you straight to script printing
  434.     document.getElementById('gui').innerHTML='Now I want you to search for "B7 00 00 00 00 01 00 00"<br/>(Search > Find...)<br/>(<a href="images/find.png" target="_new">help!</a>)<br/><br/>(Deja vu? Yeah, you&#39ll get alot of that here. Don&#39t worry about being asked to repeat steps, it&#39s supposed to work that way. &#58&#41<br/><br/><button onclick="printfindfoginput()">Ok, Ive done that</button><br/><button onclick="initialisefindFC()">String not found</button>'; //none found button should do initialise FC cataloging
  435. }
  436. function printfindFC() {
  437.     document.getElementById('gui').innerHTML='Now I want you to search for "FC 12 7F FF FF FF F8 38"<br/>(Search > Find...)<br/>(<a href="images/find.png" target="_new">help!</a>)<br/><br/>Then enter the address at which you find it (<a href="images/address2.png" target="_new">how?</a>)<br/><br/><input id="userinput2" maxlength="7" placeholder="e.g. 120AC00 or 120ac00"><br/><button onclick="submitFCaddress()">Submit (to FC array)</button><br/><button onclick="FCLooseEnds()">String not found</button>';//
  438. }
  439. function printfindnextFC() {
  440.     document.getElementById('gui').innerHTML='Now choose "Find again down".<br/>(<a href="images/findagain.png" target="_new">help!</a>)<br/><br/><button onclick="printfindnextFCpt2()">Ok, done that</button><br/><button onclick="FCLooseEnds()">String not found</button>';//
  441. }
  442. function printfindnextFCpt2() {
  443.     document.getElementById('gui').innerHTML='Enter the address you&#39ve arrived at: (<a href="images/address2.png" target="_new">how?</a>)<br/><br/><input id="userinput2" maxlength="7" placeholder="e.g. 120AC00 or 120ac00"><br/><button onclick="submitFCaddress()">Submit (to FC array)</button><br/><button onclick="FCLooseEnds()">String not found</button>';//
  444. }
  445. function printgoto() {
  446.     //document.getElementById('searchfor').innerHTML='Search for ' + gotoadd;  <- I've nerfed this for the "sort-of release"
  447.     document.getElementById('gui').innerHTML='Go to: $' + gotoadd + '<br/>(Address > Goto...)<br/>(<a href="images/goto2.png" target="_new">help!</a>)<br/><br/><button onclick="printfindfog()">Ok, I&#39ve done that</button><br/><button onclick="FCLooseEnds()">String not found</button>';
  448. }
  449. function FIRSTprintgoto() {
  450.     //document.getElementById('searchfor').innerHTML='Search for ' + gotoadd;  <- I've nerfed this for the "sort-of release"
  451.     document.getElementById('searchfor').innerHTML='';
  452.     document.getElementById('gui').innerHTML='Open XVI32 if you&#39ve not aready done so.<br/>(Don&#39t have it? Get it <a href="http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm#download" target="_new">here</a>)<br/><br/>Then open your rom hack in XVI32.<br/>(File > Open...)<br/>(<a href="images/fileopen.png" target="_new">help!</a>)<br/><br/>From then on, follow the instructions below.' + '<br/><br/><br/>' + 'Go to: $' + gotoadd + '<br/>(Address > Goto...)<br/>(<a href="images/goto2.png" target="_new">help!</a>)<br/><br/><button onclick="FIRSTprintfindfog()">Ok, I&#39ve done that</button><br/><button onclick="FCLooseEnds()">String not found</button><br/><button onclick="FCLooseEnds()">Skip fog level texture fixing (skip to end)</button>';
  453. }
  454. function FIRSTprintfindfog() {
  455.     document.getElementById('gui').innerHTML='Now I want you to search for "B7 00 00 00 00 01 00 00"<br/>(Search > Find...)<br/>(<a href="images/find.png" target="_new">help!</a>)<br/><br/><button onclick="printfindfoginput()">Ok, I&#39ve done that</button>';//none found button should do initialise FC cataloging
  456. }
  457. function printfindfoginput() {
  458.     document.getElementById('gui').innerHTML='Enter the address you&#39ve arrived at: (<a href="images/address2.png" target="_new">how?</a>)<br/><br/><input id="userinput2" maxlength="7" placeholder="e.g. 120AC00 or 120ac00"><br/><button onclick="submitfogaddress()">Submit (to lvlswithfog array)</button><br/><button onclick="initialisefindFC()">String not found</button>';//none found button should do initialise FC cataloging
  459. }
  460. function printgotoFC() {
  461.     //document.getElementById('searchfor').innerHTML='Search for ' + gotoadd;   (Nerfed for the 'sort-of' release)
  462.     document.getElementById('gui').innerHTML='Go to: $' + gotoadd + '<br/>(Address > Goto...)<br/>(<a href="images/goto2.png" target="_new">help!</a>)<br/><br/><button onclick="printfindFC()">Ok, I&#39ve done that</button><br/><button onclick="FCLooseEnds()">Erm, it says &#34Go to: $undefined&#34? Help?</button>';
  463. }
  464. function printScript() {
  465.     document.getElementById('videobox').style.display = "none"; // hide blue box again
  466.     document.getElementById('gui').innerHTML='The script has now been printed in the black box below.<br/><br/>1. Copy the whole script (i.e. the contents of the black box below), paste it into notepad and save it for future reference. (<a href="images/Step1.gif" target="_new">help!</a>)<br/><br/>2. In XVI32, click XVIscript, then Editor. This opens up the script interpreter window. (<a href="images/Step2.gif" target="_new">help!</a>)<br/><br/>3. Paste the script into the text box, click Execute and wait for the changes to be made. (<a href="images/Step3.gif" target="_new">help!</a>)<br/><br/>4. Once the script has finished executing, close the interpeter window. You&#39ll get a pop up saying &#34Script modified. Save now to file?&#34 - just click No here. (<a href="images/Step4.gif" target="_new">help!</a>)<br/><br/>5. Now click File, then Save As, and save the changed ROM. (<a href="images/Step5.gif" target="_new">help!</a>)<br/><br/>6. Drag and drop your saved ROM onto sm64compress v0.2a (<a href="https://github.com/queueRAM/sm64tools/releases/tag/sm64compressv0.2a" target="_new">get it here</a>). A new file called [ROMname].out.z64 will be created. (<a href="images/Step6.gif" target="_new">help!</a>)<br/><br/>7. Copy the new [ROMname].out.z64 file onto an SD card and try it out on your Nintendo 64. (<a href="images/Step7.gif" target="_new">help!</a>)';//
  467.     document.getElementById('FFooter').innerHTML=testscript;//
  468.     document.getElementById('FFooter').style.display = "block"; //Reveal Footer
  469.  
  470.  
  471.  
  472. }
  473.  
  474. /*========================== GUI script ==============================*/
  475.  
  476. /*========================= Debug script =============================*/
  477. function debugtoggle() {
  478.   debugdisplay = debugdisplay +1;
  479.   if (debugdisplay > 1){
  480.     debugdisplay =0;
  481.   }
  482.   if (debugdisplay == 1) {
  483.     document.getElementById('debugbox').style.display = "none";
  484.   }
  485.   if (debugdisplay == 0) {
  486.     document.getElementById('debugbox').style.display = "block";
  487.   }
  488.   debugprint()
  489. }
  490.  
  491. function debugprint() {
  492.   document.getElementById('debugbox').innerHTML=
  493.   //
  494.   "debugdisplay = " + debugdisplay + "<br/>" +
  495.   "testvar = " + testvar + "<br/>" +
  496.   "userno = " + userno + "<br/>" +
  497.   "hexstring = " + hexstring + "<br/>" +
  498.   "lvlswithfog = " + lvlswithfog + "<br/>" + //remove later, for testing atm
  499.   "lvlstartadd1 = " + lvlstartadd1  + "<br/>" + //"actual" lvlstartadd list (placeholder)
  500.   "lvlstartaddhex = " + lvlstartaddhex  + "<br/>" +
  501.   "foglvlmarker = " + foglvlmarker  + "<br/>" +
  502.   "lvlswithfog = " + lvlswithfog + "<br/>" +
  503.   "lvlswithfogSTARTADD = " + lvlswithfogSTARTADD + "<br/>" +
  504.   "lvlswithfogENDADD = " + lvlswithfogENDADD + "<br/>" +
  505.   "FCholdingarray = " + FCholdingarray + "<br/>" +
  506.   "lvlswithfogSTARThex = " + lvlswithfogSTARThex + "<br/>" +
  507.   "lvlswithfogENDhex = " + lvlswithfogENDhex + "<br/>" +
  508.   "FClvl03 = " + FClvl03 + "<br/>" +
  509.   "gotoadd = " + gotoadd + "<br/>" +
  510.   "FClvlmarker = " + FClvlmarker + "<br/>" +
  511.   "lvlswithfogSTARThex.length = " + lvlswithfogSTARThex.length + "<br/>" +
  512.   "testvar2 = " + testvar2;
  513. }
  514. /*========================= Debug script =============================*/
  515.  
  516. /*====================== Hex Convert Scripts ==========================*/
  517. function converttohex() {
  518.   // Get the value of the input field with id="numb"
  519.   x = parseInt(document.getElementById("userinput").value); // Very important to parse the string into an integer
  520.   var n = x.toString(16);
  521.   userno= x; // for testing
  522.   hexstring= n;
  523.   debugprint();
  524. }
  525. // Seems you can't pass a text variable into a function...
  526. function converttodecimal3() { //just a copy at the moment, want to refine it, maybe break down into 2 functions
  527.   userno= 0; // testing
  528.   var x, text; // just a temporary holding variable
  529.   x = document.getElementById("userinput2").value;
  530.   userno= x; //testing
  531.   var a = parseInt(x, 16); // Changes hex number into decimal!! Magic!  
  532.   hexstring = a;
  533.   debugprint();
  534.   //return a; // a itself is just a temp holding var, but it carries the output
  535. }
  536. /*====================== Hex Convert Scripts ==========================*/
  537.  
  538. /*====================== Early Array Scripts ==========================*/
  539. function THE48MBbutton() { //Functions can't start with numbers :(
  540.     //Remember, when math is involved, we're working in decimal!
  541.     lvlstartadd1= [18874368, 19791872, 20709376, 21626880, 22544384, 23461888, 24379392, 25296896, 26214400, 27131904, 28049408, 28966912, 29884416, 30801920, 31719424, 32636928, 33554432, 34471936, 35389440, 36306944, 37224448, 38141952, 39059456, 39976960, 40894464, 41811968, 42729472, 43646976, 44564480, 45481984, 46399488];
  542.     lvlendaddDEC= [19791872, 20709376, 21626880, 22544384, 23461888, 24379392, 25296896, 26214400, 27131904, 28049408, 28966912, 29884416, 30801920, 31719424, 32636928, 33554432, 34471936, 35389440, 36306944, 37224448, 38141952, 39059456, 39976960, 40894464, 41811968, 41811968, 43646976, 44564480, 45481984, 46399488, 47316992];
  543.     lvlstartaddhex= ["1200000", "12E0000", "13C0000", "14A0000", "1580000", "1660000", "1740000", "1820000", "1900000", "19E0000", "1AC0000", "1BA0000", "1C80000", "1D60000", "1E40000", "1F20000", "2000000", "20E0000", "21C0000", "22A0000", "2380000", "2460000", "2540000", "2620000", "2700000", "27E0000", "28C0000", "29A0000", "2A80000", "2B60000", "2C40000"];
  544.     lvlendaddhex= ["12E0000", "13C0000", "14A0000", "1580000", "1660000", "1740000", "1820000", "1900000", "19E0000", "1AC0000", "1BA0000", "1C80000", "1D60000", "1E40000", "1F20000", "2000000", "20E0000", "21C0000", "22A0000", "2380000", "2460000", "2540000", "2620000", "2700000", "27E0000", "28C0000", "29A0000", "2A80000", "2B60000", "2C40000", "2D20000"];
  545.     dateStampDest= ["2FFFFC8", "2FFFFF8"]; //quick hack to avoid "write beyond end of file" error (actually obsolete now...)
  546.     document.getElementById('videobox').style.display = "none"; // Hide blue textbox
  547.     alpha48= 1;
  548.     debugprint();
  549.     printoptions();
  550. }
  551. function THE64MBbutton() {
  552.     lvlstartadd1= [18874368, 20316160, 21757952, 23199744, 24641536, 26083328, 27525120, 28966912, 30408704, 31850496, 33292288, 34734080, 36175872, 37617664, 39059456, 40501248, 41943040, 43384832, 44826624, 46268416, 47710208, 49152000, 50593792, 52035584, 53477376, 54919168, 56360960, 57802752, 59244544, 60686336, 62128128];
  553.     lvlendaddDEC= [20316160, 21757952, 23199744, 24641536, 26083328, 27525120, 28966912, 30408704, 31850496, 33292288, 34734080, 36175872, 37617664, 39059456, 40501248, 41943040, 43384832, 44826624, 46268416, 47710208, 49152000, 50593792, 52035584, 53477376, 54919168, 56360960, 57802752, 59244544, 60686336, 62128128, 63569920];
  554.     lvlstartaddhex= ["1200000", "1360000", "14C0000", "1620000", "1780000", "18E0000", "1A40000", "1BA0000", "1D00000", "1E60000", "1FC0000", "2120000", "2280000", "23E0000", "2540000", "26A0000", "2800000", "2960000", "2AC0000", "2C20000", "2D80000", "2EE0000", "3040000", "31A0000", "3300000", "3460000", "35C0000", "3720000", "3880000", "39E0000", "3B40000"];
  555.     lvlendaddhex= ["1360000", "14C0000", "1620000", "1780000", "18E0000", "1A40000", "1BA0000", "1D00000", "1E60000", "1FC0000", "2120000", "2280000", "23E0000", "2540000", "26A0000", "2800000", "2960000", "2AC0000", "2C20000", "2D80000", "2EE0000", "3040000", "31A0000", "3300000", "3460000", "35C0000", "3720000", "3880000", "39E0000", "3B40000", "3CA0000"];
  556.     dateStampDest= ["3FFFFC8", "3FFFFF8"]; //quick hack to avoid "write beyond end of file" error (actually obsolete now...)
  557.     document.getElementById('videobox').style.display = "none"; // Hide blue textbox
  558.     debugprint();
  559.     printoptions();
  560. }
  561. function submittoarray() { //test thing
  562.     converttodecimal2();
  563.     lvlswithfog.push(hexstring);
  564.    
  565.     debugprint();
  566. }
  567. /*====================== Early Array Scripts ==========================*/
  568.  
  569. /*====================== Fog Detecting Script =========================*/
  570. function submitfogaddress() {
  571.     //converttodecimal2(); //hexstring takes on decimalised value of entered data
  572.     converttodecimal3(); //hexstring takes on decimalised value of entered data
  573.     //Reminder, at the outset, foglvlmarker= 0;
  574.     var enteredvalue= hexstring;
  575.     //as long as foglvlmarker is less than *#NO. OF ITEMS* in lvlstartadd,
  576.     //loop, incrementing foglvlmarker each time
  577.     //i.e., do the following for each level, one at a time, till end
  578.     for (foglvlmarker= 0; foglvlmarker < lvlstartadd1.length; foglvlmarker++) {
  579.         //lvlswithfog.push(foglvlmarker); //for testing, just add foglvlmarker value to this array (seems to work)
  580.        
  581.         if ((enteredvalue >= lvlstartadd1[foglvlmarker]) && (enteredvalue < lvlendaddDEC[foglvlmarker])) {
  582.             lvlswithfog.push(foglvlmarker);
  583.             gotoadd= lvlstartaddhex[foglvlmarker + 1]; // now goto address is the start address of the NEXT level
  584.             if (enteredvalue > lvlstartadd1[30]) { // If entered value is within the last level range (i.e. no follow up level)
  585.                 gotoadd= "NOPE";
  586.                 testvar= 5093;
  587.             }
  588.         }
  589.        
  590.         debugprint();
  591.     } //end loop
  592.     //this loop goes through (I think) 32 cycles for each button press
  593.     //(i.e. to check that single text entry)
  594.     //Then user, should be asked to repeat the previous step
  595.    
  596.     //now needs to call a function issueing next lot of instructions/video update
  597.     //Maybe instructions can be more detailed while still testing,
  598.     //then simplified for release (if it gets to that stage)
  599.    
  600.     //"Ok, you have entered: <number>
  601.     //Again, please (chose find next case of FC and enter the relevant address
  602.     //User should also have a button for "no more cases found", which jumps to next step
  603.    
  604.     debugprint();
  605.    
  606.     //Maybe: If goto="", we assume at last level and therefore no following level, in which case, do the "None were found" routine 
  607.     if (gotoadd=="NOPE") {
  608.         //gotoadd= "I shouldn't say this";
  609.         initialisefindFC();
  610.     }
  611.     else {
  612.         //gotoadd= "test";
  613.         printgoto();
  614.     }
  615.     debugprint();
  616. }
  617. /*====================== Fog Detecting Script =========================*/
  618.  
  619. /*====================== FC Cataloging Script =========================*/
  620. /* Just doodling atm
  621.  
  622. ***REALY SHOULD TIDY NAMES OF lvlstartadd 0 + 1, VERY CONFUSING ATM*** - DONE
  623. ***Have a go at improving convert to hex/decimal, make it so you can pass - DONEish
  624. a value to them, then they return it back out***
  625.  
  626.  
  627.     *The below should maybe happen AFTER previous step completes...*
  628.     *...but before user gets to enter any FC address (so, setup)*
  629.    
  630.     lets assume lvlswithfog = [3,4,16,21] (these levels have fog)
  631.     (lvlstartadd1 is levels start addresses as dictated by rom size
  632.     holdingarray= [];
  633.    
  634.     *Might be best to create 31/32 empty arrays, one for each level to store FC commands*
  635.     *I don't know how to generate new variables/arrays on the fly...*
  636.     *maybe use the one functional array when gathering data,
  637.     *then just copy the completed array into the relevant level "bank" array to store them,
  638.     *then clear the functional array, ready to start fresh for the next level?
  639.     *User should have a button for "Reached the end of the file", just incase fixing very least level*
  640.        
  641.     (foglvlmarker2 starts as zero, declared at begining)
  642.    
  643.     function FCSetup() {
  644.         if (foglvlmarker2 =< lvlswithfog.length) {
  645.             lvlno= lvlswithfog[foglvlmarker2]
  646.             lowerlimit= lvlstartadd1[lvlno]
  647.             upperlimit= lvlstartadd1[lvlno + 1]
  648.             lowerlimitdec= converttodecimal2(lowerlimit);
  649.             upperlimitdec= converttodecimal2(upperlimit);
  650.             ^^ Daft, just have 2 lvlstart arrays, 1 in hex, 1 in decimal, no need for converting!
  651.             ...
  652.         }
  653.         if (foglvlmarker2 > lvlswithfog.length) {
  654.             Call function to move onto the ending steps, printing etc
  655.         }
  656.     }
  657.        
  658.    
  659.     USER SUBMITS ADDRESS {
  660.         userinputdec= converttodecimal2(userinput); ***(convertodecimal2 needs an overhaul)***
  661.         if ((userinputdec => lowerlimitdec) && (userinputdec =< upperlimitdec)) {
  662.             holdingarray.push(userinput);
  663.             call function to clear input window
  664.             call function to repopulate input window
  665.             print "received [userinput]" message
  666.             print Again, please (find next case of FC and enter the relevant address)
  667.         }
  668.         if (userinputdec > upperlimitdec) { //This is a really complicated step, brace yourself!
  669.             *1 - find relevant level array (function -> switch)*
  670.             *2 - copy contents of holding array to relevant level array*
  671.             findlevelarray(lvlno);
  672.             *clear/wipe holdingarray (holdingarray= blankarray;?)*
  673.            
  674.             ***
  675.             ...or...
  676.             we could just acknowledge that the entered address has exceeded the range, then send them back around the loop again with lowerlimit= lvlstartadd1[lvlno + 1]?
  677.             In other words, more or less ignore what they've entered
  678.             So:
  679.             1. copy contents of holding array to relevant FClvl bank (use foglvlmarker2 and a javascript switch - see below)
  680.             2. foglvlmarker2= foglvlmarker2++;
  681.             3. gottoadd= lvlstartaddhex[lvlswithfog[foglvlmarker2]];
  682.             4. print gotoV2
  683.             (that's pretty simple, right?) ;)
  684.             ***
  685.            
  686.             print "received [userinput]" message
  687.             foglvlmarker2++;
  688.             FCSetup; //setup variables for the next level
  689.             call function to clear input window
  690.             call function to repopulate input window
  691.             print "received [userinput]" message
  692.             print "please go to [lowerlimit]"
  693.         }
  694.     }
  695.    
  696.     function gonetoaddress() {
  697.         call function to clear input window
  698.         call function to repopulate input window
  699.         print "please (find next case of FC and enter the relevant address)"
  700.         (not much happens here, simple step so as not to overwhelm the user with instruc)
  701.     }
  702.    
  703.    
  704.     function findlevelarray() {
  705.         case 0;
  706.             lvl0array= holdingarray; (could it be that simple? I doubt it)
  707.             break;
  708.         case 1;
  709.             lvl1array= holdingarray; (could it be that simple? I doubt it)
  710.             break;
  711.             etc
  712.     }
  713.     lvlstartadd1[foglvlmarker]
  714. */
  715.  
  716. function submitFCaddress() {
  717.     var inputhex, text;
  718.     inputhex = document.getElementById("userinput2").value;
  719.    
  720.     converttodecimal3(); //hexstring takes on decimalised value of entered data
  721.     //Reminder, at the outset, foglvlmarker= 0;
  722.     var enteredvalue= hexstring;
  723.    
  724.     //i.e., do the following for each level WITH FOG, one at a time, till end
  725.     // lvlswithfog
  726.     //for (foglvlmarker= 0; foglvlmarker < lvlswithfog.length; foglvlmarker++) {
  727.         //lvlswithfog.push(foglvlmarker); //for testing, just add foglvlmarker value to this array (seems to work)
  728.        
  729.        
  730.         //
  731.         //
  732.         //
  733.        
  734.         //lvlswithfogSTARTADD, lvlswithfogENDADD
  735.        
  736.         // if ((enteredvalue >= lvlstartadd1[lvlswithfog[foglvlmarker]]) && (enteredvalue < lvlstartadd1[lvlswithfog[foglvlmarker + 1]])) {
  737.         // if ((enteredvalue >= lvlstartadd1[foglvlmarker]) && (enteredvalue < lvlstartadd1[foglvlmarker + 1])) {
  738.         if ((enteredvalue >= lvlswithfogSTARTADD[FClvlmarker]) && (enteredvalue < lvlswithfogENDADD[FClvlmarker])) {
  739.            
  740.             testvar= 111; //FC found - for testing
  741.             FCvalve= 1;
  742.             //FCholdingarray.push(hexstring); // push entered address into the holding array
  743.             FCholdingarray.push(inputhex);
  744.             //Really just need to print out "ok,now choose find next and enter next address"
  745.             //gotoadd= lvlstartaddhex[FClvlmarker + 1]; // now goto address is the start address of the NEXT level
  746.            
  747.             //Maybe valve=1; i.e. needs to be closed (add if statement to the function of the none found button
  748.             printfindnextFC();
  749.         }
  750.        
  751. /// A PRETTY BIG PROBLEM
  752. /// LIVES RIGHT HERE
  753. ///
  754.         if (enteredvalue > lvlswithfogENDADD[FClvlmarker]) { // PRETTY BIG PROBLEM - what if no FCs beyond the level, holdingarray is not transfered!!
  755.             testvar= 000; //FC found - for testing
  756.             FCvalve= 0;
  757.             debugprint();
  758.             // Do many things.
  759.             // COPY FCholdingarray CONTENTS TO RELEVANT LEVEL ARRAY (AND CLEAR HOLDING ARRAY)
  760.             //lvlswithfog[FClvlmarker]
  761.             holdingarraytransfer();
  762.             FClvlmarker++;
  763.             gotoadd= lvlswithfogSTARThex[FClvlmarker];
  764.             if (FClvlmarker >= lvlswithfogSTARThex.length) { // But... if limit of lvlswithfogSARThex exceeded, should jump to FCLooseEnds.
  765.                 FCLooseEnds();
  766.                 testvar2= 555;
  767.             }
  768.             else {
  769.                 printgotoFC();
  770.                 testvar2= 666;
  771.             }
  772.         }
  773.        
  774.         debugprint();
  775. }
  776.  
  777. function FCLooseEnds() { // if no FCs beyond final level, holdingarray transfered here instead
  778.     if (FCvalve==1) {
  779.         holdingarraytransfer();
  780.         FCvalve= 0;
  781.         gotoadd= "FC was 1, now 0 again";
  782.         debugprint();
  783.     }
  784.     initialiseScript();
  785. }
  786. /*====================== FC Cataloging Script =========================*/
  787.  
  788. /*===================== Holding Array Transfer ========================*/
  789. function holdingarraytransfer() {
  790.     switch(lvlswithfog[FClvlmarker]) {
  791.         case 0:
  792.             testvar= 00000;
  793.             FClvl00= FCholdingarray;
  794.             break;
  795.         case 1:
  796.             testvar= 11111;
  797.             FClvl01= FCholdingarray;
  798.             break;
  799.         case 2:
  800.             testvar= 22222;
  801.             FClvl02= FCholdingarray;
  802.             break;
  803.         case 3:
  804.             testvar= 33333;
  805.             FClvl03= FCholdingarray;
  806.             break;
  807.         case 4:
  808.             testvar= 44444;
  809.             FClvl04= FCholdingarray;
  810.             break;
  811.         case 5:
  812.             testvar= 55555;
  813.             FClvl05= FCholdingarray;
  814.             break;
  815.         case 6:
  816.             testvar= 66666;
  817.             FClvl06= FCholdingarray;
  818.             break;
  819.         case 7:
  820.             testvar= 77777;
  821.             FClvl07= FCholdingarray;
  822.             break;
  823.         case 8:
  824.             testvar= 88888;
  825.             FClvl08= FCholdingarray;
  826.             break;
  827.         case 9:
  828.             testvar= 99999;
  829.             FClvl09= FCholdingarray;
  830.             break;
  831.         case 10:
  832.             testvar= 10;
  833.             FClvl10= FCholdingarray;
  834.             break;
  835.         case 11:
  836.             testvar= 11
  837.             FClvl11= FCholdingarray;
  838.             break;
  839.         case 12:
  840.             testvar= 12;
  841.             FClvl12= FCholdingarray;
  842.             break;
  843.         case 13:
  844.             testvar= 13;
  845.             FClvl13= FCholdingarray;
  846.             break;
  847.         case 14:
  848.             testvar= 14;
  849.             FClvl14= FCholdingarray;
  850.             break;
  851.         case 15:
  852.             testvar= 15;
  853.             FClvl15= FCholdingarray;
  854.             break;
  855.         case 16:
  856.             testvar= 16;
  857.             FClvl16= FCholdingarray;
  858.             break;
  859.         case 17:
  860.             testvar= 17;
  861.             FClvl17= FCholdingarray;
  862.             break;
  863.         case 18:
  864.             testvar= 18;
  865.             FClvl18= FCholdingarray;
  866.             break;
  867.         case 19:
  868.             testvar= 19;
  869.             FClvl19= FCholdingarray;
  870.             break;
  871.         case 20:
  872.             testvar= 20;
  873.             FClvl20= FCholdingarray;
  874.             break;
  875.         case 21:
  876.             testvar= 21
  877.             FClvl21= FCholdingarray;
  878.             break;
  879.         case 22:
  880.             testvar= 22;
  881.             FClvl22= FCholdingarray;
  882.             break;
  883.         case 23:
  884.             testvar= 23;
  885.             FClvl23= FCholdingarray;
  886.             break;
  887.         case 24:
  888.             testvar= 24;
  889.             FClvl24= FCholdingarray;
  890.             break;
  891.         case 25:
  892.             testvar= 25;
  893.             FClvl25= FCholdingarray;
  894.             break;
  895.         case 26:
  896.             testvar= 26;
  897.             FClvl26= FCholdingarray;
  898.             break;
  899.         case 27:
  900.             testvar= 27;
  901.             FClvl27= FCholdingarray;
  902.             break;
  903.         case 28:
  904.             testvar= 28;
  905.             FClvl28= FCholdingarray;
  906.             break;
  907.         case 29:
  908.             testvar= 29;
  909.             FClvl29= FCholdingarray;
  910.             break;
  911.         case 30:
  912.             testvar= 30;
  913.             FClvl30= FCholdingarray;
  914.             break;
  915.         /*case 31:
  916.             testvar= 31;
  917.             FClvl31= FCholdingarray;
  918.             break;*/
  919.         default:
  920.             testvar= 123456789;
  921.     }
  922.     FCholdingarray= [];
  923.     debugprint();
  924. }
  925. /*===================== Holding Array Transfer ========================*/
  926.  
  927. /*========================= Script Printing ===========================*/
  928. function initialiseScript() {
  929.     // Variable below are now global to allow easy passing between functions.
  930.     //var standardScript= "", titleScript= "", headScript= "", peachScript= "", pipeScript= "", camScript= "", fogScript= "";
  931.     var endMessage= "MSG This script has made it's changes. But you're not quite done yet.&#92;nYou now need to save the changes (File > Save or File > Save As)&#92;n(you might also want to save a copy of the script for future use)<br/>" + "MSG After saving the changes to the rom, drag and drop the rom onto&#92;nsm64compress.exe - a file called [ROMname].out.z64 will be created.&#92;nFinally, copy [ROMname].out.z64 on to your memory card and try it&#92;nout on your Nintendo 64.";
  932.     var cutHere= "REM CUT HERE<br/>REM -----------------------------------<br/><br/><br/>";
  933.    
  934.     getDate();
  935.     standardScript= "REM Included As Standard (No Obvious Side Effects):<br/>REM ---<br/>REM Reverse Any RCVI Changes<br/>ADR $F00C2<br/>OVERWRITE 02 0D<br/>REM ---<br/>REM Set Far Camera Value Back to 7F FF<br/>ADR $0<br/>REPLACEALL 0A 01 00 2D 00 64 96 96 80 29 AA 3C BY 0A 01 00 2D 00 64 7F FF 80 29 AA 3C<br/>REM --<br/>REM Fix for Billboarded objects in foggy levels which use alpha textures<br/>REPLACEALL BA 00 14 02 00 00 00 00 B9 00 03 1D C8 11 30 78 B6 00 00 00 00 01 00 00 BY BA 00 14 02 00 00 00 00 B9 00 03 1D 00 44 30 78 B6 00 00 00 00 01 00 00<br/><br/><br/>";
  936.     if (alpha48== 1) { // 15 06 = bad, 15 04 = best in most cases but breaks Retroland torchglow, 15 05 gives slight transparencey to alpha textures and torchglow works. 15 05 is the best compromise IMO.
  937.         alphaScript= "REM Fix Alpha Textures in Older (48MB) Hacks<br/>ADR $0<br/>REPLACEALL 15 06 00 00 0E BY 15 05 00 00 0E<br/><br/><br/>";
  938.     }
  939.     prepTitleScript();
  940.     prepHeadScript();
  941.     if (selectPeach== 0) {
  942.             peachScript= "REM Peach Skip<br/>ADR $6BD4<br/>OVERWRITE 24 00<br/><br/><br/>";
  943.     }
  944.     if (selectPipe== 0) {
  945.             pipeScript= "REM Replace Warp Pipe Behaviours with Normal Warp Behaviours<br/>ADR $1200000<br/>REPLACEALL 00 00 13 00 07 A0 BY 00 00 13 00 07 80<br/><br/><br/>";
  946.     }
  947.     if (selectCam==0) {
  948.         camScript= "REM Attempt to apply the Parallel Lakitu Camera Patch by aglab2<br/>ADR $3DC3C<br/>OVERWRITE 3C 08 80 28 <br/>OVERWRITE 21 08 6C B4 03 28 40 22 <br/>OVERWRITE 19 00 00 03 00 00 00 00 <br/>OVERWRITE 3C 19 80 28 23 39 6C C4 <br/>OVERWRITE 3C 01 80 34 84 28 AF A2 <br/>OVERWRITE 31 08 00 20 11 00 00 07 <br/>OVERWRITE 00 00 00 00 3C 01 80 28 <br/>OVERWRITE 8C 28 6D 24 20 01 00 01 <br/>OVERWRITE 00 28 40 22 3C 01 80 28 <br/>OVERWRITE AC 28 6D 24 3C 01 80 28 <br/>OVERWRITE 8C 28 6D 24 11 00 00 0F <br/>OVERWRITE 00 00 00 00 3C 08 80 28 <br/>OVERWRITE 21 08 6C 84 03 28 40 22 <br/>OVERWRITE 11 00 00 08 00 00 00 00 <br/>OVERWRITE 3C 08 80 28 21 08 6C A4 <br/>OVERWRITE 03 28 40 22 11 00 00 03 <br/>OVERWRITE 00 00 00 00 10 00 00 03 <br/>OVERWRITE 00 00 00 00 3C 19 80 28 <br/>OVERWRITE 23 39 6C C4 3C 01 80 34 <br/>OVERWRITE 84 28 AF A0 3C 01 80 34 <br/>OVERWRITE 84 24 C7 78 31 01 02 00 <br/>OVERWRITE 10 20 00 03 00 00 00 00 <br/>OVERWRITE 20 84 FF D0 10 00 00 0C <br/>OVERWRITE 31 01 01 00 10 20 00 03 <br/>OVERWRITE 00 00 00 00 20 84 00 30 <br/>OVERWRITE 10 00 00 07 3C 01 80 34 <br/>OVERWRITE 84 28 AF A2 31 01 0C 00 <br/>OVERWRITE 10 20 00 03 00 00 00 00 <br/>OVERWRITE 20 84 10 00 30 84 E0 00 <br/>OVERWRITE 3C 01 80 34 A4 24 C7 78 <br/>OVERWRITE 3C 01 80 28 8C 28 6D 20 <br/>OVERWRITE 11 19 00 0A 00 00 00 00 <br/>OVERWRITE 3C 01 80 33 8C 28 DF 60 <br/>OVERWRITE 85 08 00 12 21 08 90 00 <br/>OVERWRITE 31 08 E0 00 3C 01 80 34 <br/>OVERWRITE A4 28 C7 78 3C 01 80 28 <br/>OVERWRITE AC 39 6D 20 03 20 00 08 <br/>OVERWRITE 00 00 00 00 00 00 00 00 <br/>REM --<br/>ADR $41BBC<br/>OVERWRITE 10 00 00 45<br/>REM --<br/>ADR $41C7C<br/>OVERWRITE 10 00 EF EF<br/>REM --<br/>ADR $41CD4<br/>OVERWRITE 11 A0 FF DF<br/>OVERWRITE 00 00 00 00 3C 01 80 28 <br/>OVERWRITE 8C 28 6D 24 11 00 00 03 <br/>OVERWRITE 00 00 00 00 10 00 00 03 <br/>OVERWRITE 00 00 00 00 3C 01 80 28 <br/>OVERWRITE AC 20 6D 20 10 00 FF B1 <br/>OVERWRITE 00 00 00 00 0C 0A 13 3F <br/>OVERWRITE 8F A4 00 40 10 00 00 15 <br/>OVERWRITE 00 00 00 00 0C 0A 0B 0F <br/>OVERWRITE 8F A4 00 40 10 00 00 11 <br/>OVERWRITE 00 00 00 00 00 00 00 00<br/><br/><br/>";
  949.     }
  950.     if (selectMCam==0) {
  951.         mcamScript= "REM Star Road style Mario Cam (code by Skelux)<br/>ADR $3F330<br/>OVERWRITE 34 06 00 00<br/>REM --<br/>ADR $46F16<br/>OVERWRITE 00 01<br/>REM --<br/>ADR $46F24<br/>OVERWRITE 85 F8 00 10<br/>REM --<br/>ADR $46F88<br/>OVERWRITE 00 00 00 00<br/>REM --<br/>ADR $46FA8<br/>OVERWRITE 87 28 00 10<br/>REM --<br/>ADR $4700C<br/>OVERWRITE 00 00 00 00<br/><br/><br/><br/>";
  952.     }
  953.    
  954.    
  955.     if (!(FClvl00=="")) {
  956.         var i= 0; //just for looping
  957.         var firstline= "REM ---<br/>REM Haunted House (Course 5)<br/>";
  958.         var x= "", y= "";
  959.         for (i= 0; i < FClvl00.length; i++) {
  960.             x = "ADR $" + FClvl00[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  961.             y= y + x;
  962.         }
  963.         FClvl00= firstline + y;
  964.     }
  965.     if (!(FClvl01=="")) {
  966.         var i= 0; //just for looping
  967.         var firstline= "REM ---<br/>REM Cool Cool Mountain (Course 4)<br/>";
  968.         var x= "", y= "";
  969.         for (i= 0; i < FClvl01.length; i++) {
  970.             x = "ADR $" + FClvl01[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  971.             y= y + x;
  972.         }
  973.         FClvl01= firstline + y;
  974.     }
  975.     if (!(FClvl02=="")) {
  976.         var i= 0; //just for looping
  977.         var firstline= "REM ---<br/>REM Inside Castle<br/>";
  978.         var x= "", y= "";
  979.         for (i= 0; i < FClvl02.length; i++) {
  980.             x = "ADR $" + FClvl02[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  981.             y= y + x;
  982.         }
  983.         FClvl02= firstline + y;
  984.     }
  985.     if (!(FClvl03=="")) {
  986.         var i= 0; //just for looping
  987.         var firstline= "REM ---<br/>REM Hazy Maze Cave (Course 6)<br/>";
  988.         var x= "", y= "";
  989.         for (i= 0; i < FClvl03.length; i++) {
  990.             x = "ADR $" + FClvl03[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  991.             y= y + x;
  992.         }
  993.         FClvl03= firstline + y;
  994.     }
  995.     if (!(FClvl04=="")) {
  996.         var i= 0; //just for looping
  997.         var firstline= "REM ---<br/>REM Shifting Sand Land (Course 8)<br/>";
  998.         var x= "", y= "";
  999.         for (i= 0; i < FClvl04.length; i++) {
  1000.             x = "ADR $" + FClvl04[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1001.             y= y + x;
  1002.         }
  1003.         FClvl04= firstline + y;
  1004.     }
  1005.     if (!(FClvl05=="")) {
  1006.         var i= 0; //just for looping
  1007.         var firstline= "REM ---<br/>REM Bob-Omb's Battlefield (Course 1)<br/>";
  1008.         var x= "", y= "";
  1009.         for (i= 0; i < FClvl05.length; i++) {
  1010.             x = "ADR $" + FClvl05[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1011.             y= y + x;
  1012.         }
  1013.         FClvl05= firstline + y;
  1014.     }
  1015.     if (!(FClvl06=="")) {
  1016.         var i= 0; //just for looping
  1017.         var firstline= "REM ---<br/>REM Snow Man's Land (Course 10)<br/>";
  1018.         var x= "", y= "";
  1019.         for (i= 0; i < FClvl06.length; i++) {
  1020.             x = "ADR $" + FClvl06[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1021.             y= y + x;
  1022.         }
  1023.         FClvl06= firstline + y;
  1024.     }
  1025.     if (!(FClvl07=="")) {
  1026.         var i= 0; //just for looping
  1027.         var firstline= "REM ---<br/>REM Wet Dry World (Course 11)<br/>";
  1028.         var x= "", y= "";
  1029.         for (i= 0; i < FClvl07.length; i++) {
  1030.             x = "ADR $" + FClvl07[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1031.             y= y + x;
  1032.         }
  1033.         FClvl07= firstline + y;
  1034.     }
  1035.     if (!(FClvl08=="")) {
  1036.         var i= 0; //just for looping
  1037.         var firstline= "REM ---<br/>REM Jolly Roger Bay (Course 3)<br/>";
  1038.         var x= "", y= "";
  1039.         for (i= 0; i < FClvl08.length; i++) {
  1040.             x = "ADR $" + FClvl08[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1041.             y= y + x;
  1042.         }
  1043.         FClvl08= firstline + y;
  1044.     }
  1045.     if (!(FClvl09=="")) {
  1046.         var i= 0; //just for looping
  1047.         var firstline= "REM ---<br/>REM Tiny Huge Island (Course 13)<br/>";
  1048.         var x= "", y= "";
  1049.         for (i= 0; i < FClvl09.length; i++) {
  1050.             x = "ADR $" + FClvl09[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1051.             y= y + x;
  1052.         }
  1053.         FClvl09= firstline + y;
  1054.     }
  1055.     if (!(FClvl10=="")) {
  1056.         var i= 0; //just for looping
  1057.         var firstline= "REM ---<br/>REM Tick Tock Clokc (Course 14)<br/>";
  1058.         var x= "", y= "";
  1059.         for (i= 0; i < FClvl10.length; i++) {
  1060.             x = "ADR $" + FClvl10[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1061.             y= y + x;
  1062.         }
  1063.         FClvl10= firstline + y;
  1064.     }
  1065.     if (!(FClvl11=="")) {
  1066.         var i= 0; //just for looping
  1067.         var firstline= "REM ---<br/>REM Rainbow Ride (Course 15)<br/>";
  1068.         var x= "", y= "";
  1069.         for (i= 0; i < FClvl11.length; i++) {
  1070.             x = "ADR $" + FClvl11[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1071.             y= y + x;
  1072.         }
  1073.         FClvl11= firstline + y;
  1074.     }
  1075.     if (!(FClvl12=="")) {
  1076.         var i= 0; //just for looping
  1077.         var firstline= "REM ---<br/>REM Castle Grounds<br/>";
  1078.         var x= "", y= "";
  1079.         for (i= 0; i < FClvl12.length; i++) {
  1080.             x = "ADR $" + FClvl12[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1081.             y= y + x;
  1082.         }
  1083.         FClvl12= firstline + y;
  1084.     }
  1085.     if (!(FClvl13=="")) {
  1086.         var i= 0; //just for looping
  1087.         var firstline= "REM ---<br/>REM Bowser 1 Course<br/>";
  1088.         var x= "", y= "";
  1089.         for (i= 0; i < FClvl13.length; i++) {
  1090.             x = "ADR $" + FClvl13[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1091.             y= y + x;
  1092.         }
  1093.         FClvl13= firstline + y;
  1094.     }
  1095.     if (!(FClvl14=="")) {
  1096.         var i= 0; //just for looping
  1097.         var firstline= "REM ---<br/>REM Vanish Cap<br/>";
  1098.         var x= "", y= "";
  1099.         for (i= 0; i < FClvl14.length; i++) {
  1100.             x = "ADR $" + FClvl14[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1101.             y= y + x;
  1102.         }
  1103.         FClvl14= firstline + y;
  1104.     }
  1105.     if (!(FClvl15=="")) {
  1106.         var i= 0; //just for looping
  1107.         var firstline= "REM ---<br/>REM Bowser 2 Course<br/>";
  1108.         var x= "", y= "";
  1109.         for (i= 0; i < FClvl15.length; i++) {
  1110.             x = "ADR $" + FClvl15[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1111.             y= y + x;
  1112.         }
  1113.         FClvl15= firstline + y;
  1114.     }
  1115.     if (!(FClvl16=="")) {
  1116.         var i= 0; //just for looping
  1117.         var firstline= "REM ---<br/>REM Secret Aquarium<br/>";
  1118.         var x= "", y= "";
  1119.         for (i= 0; i < FClvl16.length; i++) {
  1120.             x = "ADR $" + FClvl16[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1121.             y= y + x;
  1122.         }
  1123.         FClvl16= firstline + y;
  1124.     }
  1125.     if (!(FClvl17=="")) {
  1126.         var i= 0; //just for looping
  1127.         var firstline= "REM ---<br/>REM Bowser 3 Course<br/>";
  1128.         var x= "", y= "";
  1129.         for (i= 0; i < FClvl17.length; i++) {
  1130.             x = "ADR $" + FClvl17[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1131.             y= y + x;
  1132.         }
  1133.         FClvl17= firstline + y;
  1134.     }
  1135.     if (!(FClvl18=="")) {
  1136.         var i= 0; //just for looping
  1137.         var firstline= "REM ---<br/>REM Lethal Lava Land (Course 7)<br/>";
  1138.         var x= "", y= "";
  1139.         for (i= 0; i < FClvl18.length; i++) {
  1140.             x = "ADR $" + FClvl18[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1141.             y= y + x;
  1142.         }
  1143.         FClvl18= firstline + y;
  1144.     }
  1145.     if (!(FClvl19=="")) {
  1146.         var i= 0; //just for looping
  1147.         var firstline= "REM ---<br/>REM Dire Dire Docks (Course 9)<br/>";
  1148.         var x= "", y= "";
  1149.         for (i= 0; i < FClvl19.length; i++) {
  1150.             x = "ADR $" + FClvl19[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1151.             y= y + x;
  1152.         }
  1153.         FClvl19= firstline + y;
  1154.     }
  1155.     if (!(FClvl20=="")) {
  1156.         var i= 0; //just for looping
  1157.         var firstline= "REM ---<br/>REM Whomp's Fortress (Course 2)<br/>";
  1158.         var x= "", y= "";
  1159.         for (i= 0; i < FClvl20.length; i++) {
  1160.             x = "ADR $" + FClvl20[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1161.             y= y + x;
  1162.         }
  1163.         FClvl20= firstline + y;
  1164.     }
  1165.     if (!(FClvl21=="")) {
  1166.         var i= 0; //just for looping
  1167.         var firstline= "REM ---<br/>REM End Cake Picture<br/>";
  1168.         var x= "", y= "";
  1169.         for (i= 0; i < FClvl21.length; i++) {
  1170.             x = "ADR $" + FClvl21[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1171.             y= y + x;
  1172.         }
  1173.         FClvl21= firstline + y;
  1174.     }
  1175.     if (!(FClvl22=="")) {
  1176.         var i= 0; //just for looping
  1177.         var firstline= "REM ---<br/>REM Castle Courtyard<br/>";
  1178.         var x= "", y= "";
  1179.         for (i= 0; i < FClvl22.length; i++) {
  1180.             x = "ADR $" + FClvl22[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1181.             y= y + x;
  1182.         }
  1183.         FClvl22= firstline + y;
  1184.     }
  1185.     if (!(FClvl23=="")) {
  1186.         var i= 0; //just for looping
  1187.         var firstline= "REM ---<br/>REM Peach's Secret Slide<br/>";
  1188.         var x= "", y= "";
  1189.         for (i= 0; i < FClvl23.length; i++) {
  1190.             x = "ADR $" + FClvl23[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1191.             y= y + x;
  1192.         }
  1193.         FClvl23= firstline + y;
  1194.     }
  1195.     if (!(FClvl24=="")) {
  1196.         var i= 0; //just for looping
  1197.         var firstline= "REM ---<br/>REM Metal Cap<br/>";
  1198.         var x= "", y= "";
  1199.         for (i= 0; i < FClvl24.length; i++) {
  1200.             x = "ADR $" + FClvl24[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1201.             y= y + x;
  1202.         }
  1203.         FClvl24= firstline + y;
  1204.     }
  1205.     if (!(FClvl25=="")) {
  1206.         var i= 0; //just for looping
  1207.         var firstline= "REM ---<br/>REM Wing Cap<br/>";
  1208.         var x= "", y= "";
  1209.         for (i= 0; i < FClvl25.length; i++) {
  1210.             x = "ADR $" + FClvl25[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1211.             y= y + x;
  1212.         }
  1213.         FClvl25= firstline + y;
  1214.     }
  1215.     if (!(FClvl26=="")) {
  1216.         var i= 0; //just for looping
  1217.         var firstline= "REM ---<br/>REM Bowser 1 Battle<br/>";
  1218.         var x= "", y= "";
  1219.         for (i= 0; i < FClvl26.length; i++) {
  1220.             x = "ADR $" + FClvl26[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1221.             y= y + x;
  1222.         }
  1223.         FClvl26= firstline + y;
  1224.     }
  1225.     if (!(FClvl27=="")) {
  1226.         var i= 0; //just for looping
  1227.         var firstline= "REM ---<br/>REM Rainbow Clouds<br/>";
  1228.         var x= "", y= "";
  1229.         for (i= 0; i < FClvl27.length; i++) {
  1230.             x = "ADR $" + FClvl27[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1231.             y= y + x;
  1232.         }
  1233.         FClvl27= firstline + y;
  1234.     }
  1235.     if (!(FClvl28=="")) {
  1236.         var i= 0; //just for looping
  1237.         var firstline= "REM ---<br/>REM Bowser 2 Battle<br/>";
  1238.         var x= "", y= "";
  1239.         for (i= 0; i < FClvl28.length; i++) {
  1240.             x = "ADR $" + FClvl28[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1241.             y= y + x;
  1242.         }
  1243.         FClvl28= firstline + y;
  1244.     }
  1245.     if (!(FClvl29=="")) {
  1246.         var i= 0; //just for looping
  1247.         var firstline= "REM ---<br/>REM Bowser 3 Battle<br/>";
  1248.         var x= "", y= "";
  1249.         for (i= 0; i < FClvl29.length; i++) {
  1250.             x = "ADR $" + FClvl29[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1251.             y= y + x;
  1252.         }
  1253.         FClvl29= firstline + y;
  1254.     }
  1255.     if (!(FClvl30=="")) {
  1256.         var i= 0; //just for looping
  1257.         var firstline= "REM ---<br/>REM Tall Tall Mountain (Course 12)<br/>";
  1258.         var x= "", y= "";
  1259.         for (i= 0; i < FClvl30.length; i++) {
  1260.             x = "ADR $" + FClvl30[i] + "<br/>OVERWRITE FC 12 7F FF FF FF F8 38<br/>"
  1261.             y= y + x;
  1262.         }
  1263.         FClvl30= firstline + y;
  1264.     }
  1265.     //=======================
  1266.    
  1267.     fogScript= FClvl00 + FClvl01 + FClvl02 + FClvl03 + FClvl04 + FClvl05 + FClvl06 + FClvl07 + FClvl08 + FClvl09;
  1268.     fogScript= fogScript + FClvl10 + FClvl11 + FClvl12 + FClvl13 + FClvl14 + FClvl15 + FClvl16 + FClvl17 + FClvl18 + FClvl19;
  1269.     fogScript= fogScript + FClvl20 + FClvl21 + FClvl22 + FClvl23 + FClvl24 + FClvl25 + FClvl26 + FClvl27 + FClvl28 + FClvl29;
  1270.     //fogScript= fogScript + FClvl30 + FClvl31;
  1271.     //fogScript= fogScript + FClvl30;
  1272.     fogScript= "REM Restoring Levels With Fog:<br/>" + fogScript + "<br/><br/>";
  1273.    
  1274.    
  1275.     testscript= stampScript + standardScript + alphaScript + titleScript + headScript + peachScript + pipeScript + camScript + mcamScript + cutHere + fogScript + endMessage;
  1276.     debugprint();
  1277.    
  1278.     printScript(); //atm, prints testcript
  1279.    
  1280. }
  1281.  
  1282. function getDate () {
  1283.     var today=new Date();
  1284.    
  1285.     // Fetching and preparing Date Stamp
  1286.     var dsDate= 0, dsMonth= 0, dsFullYear= 0, dsHours= 0, dsMins= 0, dsSeconds= 0;
  1287.     dsDate= today.getDate();
  1288.     dsMonth= today.getMonth();
  1289.     dsFullYear= today.getFullYear();
  1290.     dsHours= today.getHours();
  1291.     dsMins= today.getMinutes();
  1292.     dsSeconds= today.getSeconds();
  1293.    
  1294.     dsDate= checkTime(dsDate);
  1295.     dsMonth= checkTime(dsMonth+1); // Seemingly need to add +1 here, assuming it starts counting from 0
  1296.     dsFullYear= dsFullYear - 2000; // 2017-2000=17, add the 20 back in later, need to split 4 into two 2s for hex
  1297.     dsHours= checkTime(dsHours);
  1298.     dsMins= checkTime(dsMins);
  1299.     dsSeconds= checkTime(dsSeconds);
  1300.    
  1301.     dateStamp= dsDate + " " + dsMonth + " " + "20" + " " + dsFullYear + " " + dsHours + " " + dsMins + " " + dsSeconds;
  1302.    
  1303.    
  1304.     today=new Date(today).toUTCString();
  1305.     today=today.split(' ').slice(1, 6).join(' ');
  1306.     theDate= today;
  1307.     //stampScript= "REM Script generated on: " + theDate + "<br/><br/><br/>" + "REM Identification Stamp<br/>ADR $" + dateStampDest[0] + "<br/>OVERWRITE 20 22 46 69 78 65 64 22"/* "Fixed"*/+"<br/>OVERWRITE 77 69 74 68 20"/*with */+"<br/>OVERWRITE 4D 61 72 69 6F 4D 65"/*MarioMe*/+"<br/>OVERWRITE 6E 64 65 72 36 34 20"/*nder64 */+"<br/>OVERWRITE 56 30 2E 30 2E 30 2E 31"/*V0.0.0.1*/+"<br/>OVERWRITE 28 31 31 47 30"/*(11G)*/+"<br/>OVERWRITE 20 20 20 20 20 20 20 20"/*        */+"<br/>ADR $" + dateStampDest[1] + "<br/>OVERWRITE 20 " + dateStamp + "<br/><br/><br/>";
  1308.     stampScript= "REM Script generated on: " + theDate + "<br/><br/><br/>" + "REM Identification Stamp<br/>ADREOF<br/>ADR- 55<br/>OVERWRITE 20 22 46 69 78 65 64 22"/* "Fixed"*/+"<br/>OVERWRITE 77 69 74 68 20"/*with */+"<br/>OVERWRITE 4D 61 72 69 6F 4D 65"/*MarioMe*/+"<br/>OVERWRITE 6E 64 65 72 36 34 20"/*nder64 */+"<br/>OVERWRITE 56 30 2E 31 20 20"/*V0.0.1*/+"<br/>OVERWRITE 20 31 31 48 32"/* 11H1*/+"<br/>OVERWRITE 20 20 20 20 20 20 20 20"/*        */+"<br/>ADREOF<br/>ADR- 7<br/>OVERWRITE 00 " + dateStamp + "<br/><br/><br/>";
  1309. }
  1310. function checkTime(i){
  1311. if (i<10)
  1312.  {
  1313.  i="0" + i;
  1314.  }
  1315. return i;
  1316. }
  1317.  
  1318.  
  1319. function prepTitleScript() {
  1320.     var x= "";
  1321.     switch(selectTitle) {
  1322.         case 1: //Skip
  1323.             x= "REM Skip Title Screen<br/>ADR $269ECC<br/>OVERWRITE 01 10 00 14 00 26 9E A0 00 26 A3 A0 14 00 00 78<br/>REM --<br/>";
  1324.             //Skip- 269ECC: 01 10 00 14 00 26 9E A0 00 26 A3 A0 14 00 00 78
  1325.             break;
  1326.         case 2: // Restore
  1327.             x= "REM Restore Title Screen<br/>ADR $269ECC<br/>OVERWRITE 1D 04 00 00 1F 08 01 00 14 00 02 D0 20 04 00 00<br/>REM --<br/>";
  1328.             //Rstr- 269ECC: 1D 04 00 00 1F 08 01 00 14 00 02 D0 20 04 00 00
  1329.             break;
  1330.         case 3: // Attempt Repair of Custom Title Screen (experimental)
  1331.             sledgeFrom= "A00000"; //Replace all FCs from this location onwards (think it takes in custom title screens)
  1332.             break;
  1333.         default:
  1334.     }
  1335.     titleScript= x + "REM Replace all cases of FC 12 7F FF FF FF F8 38 with FC 12 7E 24 FF FF F9 FC from " + sledgeFrom + " onwards.<br/>REM This restores textures to levels without fog, but breaks textures in levels with fog.<br/>REM Normally done from 1200000 onwards (to leave the original SM64 levels alone).<br/>REM Can be set to replace from A00000 instead to try and restore textures to custom title screens.<br/>ADR $" + sledgeFrom + "<br/>REPLACEALL FC 12 7F FF FF FF F8 38 BY FC 12 7E 24 FF FF F9 FC<br/><br/><br/>";
  1336.     testvar= 1108;
  1337.    
  1338. }
  1339.  
  1340. function prepHeadScript() {
  1341.     switch(selectHead) {
  1342.         case 0: //Restore, then Skip using alt method
  1343.             // Good skip: Mario Head skip (Good): 269F68: 05 08 00 00 14 00 02 0C, 269FF4: 05 08 00 00 14 00 02 0C
  1344.             headScript= "REM Restore Mario Head Screen<br/>ADR $269F4C<br/>OVERWRITE 1D 04 00 00 1F 08 01 00 14 00 03 5C 20 04 00 00<br/>REM --<br/>REM Skip Mario Head Screen using an alternative method which works on console<br/>ADR $269F68<br/>OVERWRITE 05 08 00 00 14 00 02 0C<br/>ADR $269FF4<br/>OVERWRITE 05 08 00 00 14 00 02 0C<br/><br/><br/>";
  1345.             break;
  1346.         case 1: // Restore: ADR $269F4C, OVERWRITE 1D 04 00 00 1F 08 01 00 14 00 03 5C 20 04 00 00
  1347.             headScript= "REM Restore Mario Head Screen<br/>ADR $269F4C<br/>OVERWRITE 1D 04 00 00 1F 08 01 00 14 00 03 5C 20 04 00 00<br/><br/><br/>";
  1348.             break;
  1349.         case 2: // Bad Skip: 269F4C: 01 10 00 14 00 26 9E A0 00 26 A3 A0 14 00 02 0C, 269FD8: 01 10 00 14 00 26 9E A0 00 26 A3 A0 14 00 02 0C      
  1350.             headScript= "REM Skip Mario Head Screen (causes black screen on console)<br/>ADR $269F4C<br/>OVERWRITE 01 10 00 14 00 26 9E A0 00 26 A3 A0 14 00 02 0C<br/>ADR $269FD8<br/>OVERWRITE 01 10 00 14 00 26 9E A0 00 26 A3 A0 14 00 02 0C<br/><br/><br/>";
  1351.             break;
  1352.         default:
  1353.     }
  1354. }
  1355. /*========================= Script Printing ===========================*/
  1356.  
  1357. </script>
  1358. <!--=================================================================-->
  1359. <!--========================= End Script ============================-->
  1360. <!--=================================================================-->
  1361.  
  1362.  
  1363. <Title>Mario Mender 64 V0.1 (11H2)</Title>
  1364. <!--IMPORTANT!! Remember to adjust the version number in the script-->
  1365. <!-- Search for: [REM Script generated on:] -->
  1366.  
  1367. </head>
  1368. <body onload="printromsize()">
  1369.  
  1370. <div class="MM64">
  1371.     <h1>Mario Mender<span class="h64"> 64</span></h1>
  1372. </div>
  1373.  
  1374.  
  1375. <div id="splash"> <!-- Splash Screen ////////////////////////////////////////////// -->
  1376.     <h3>Welcome to Mario Mender 64!</h5>
  1377.     <p>As you probably know, most Super Mario 64 hacks are plauged with problems which stop them playing well on real Nintendo 64 consoles. Fortunately, we now have <a href="https://hack64.net/wiki/doku.php?id=super_mario_64:console_compatibility" target="_new">fixes and work arounds</a> for some of these problems.</p>
  1378.     <p>Mario Mender 64 is my attempt at making it easier to apply some of the fixes and work arounds for more common problems. It's an unfinished but somewhat functional Javascript based tutorial/wizard that runs in your web browser. It is designed to be used together with the XVI32 hex editor and queueRAM's sm64compress v0.2a. Based on your input, it generates a script for you to run in the XVI32 hex editor. After the script has been executed, save the rom and run it through sm64compress.<br/><br/><u>This will not fix every hack</u>, it just attempts to fix many of the common problems.</p>
  1379.  
  1380.     The code on display here is very amaturish. This is the most complex thing I have yet attempted to program, and I'm sure it shows!
  1381.  
  1382.  
  1383.     <br/><br/><h3>Required Programs (download these first before starting)</h3>
  1384.  
  1385.     XVI32:<br/>
  1386.     <a href="http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm#download" target="_new">http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm#download</a>
  1387.     <br/><br/>
  1388.     sm64compress v0.2a by queueRAM:<br/>
  1389.     <a href="https://github.com/queueRAM/sm64tools/releases/tag/sm64compressv0.2a" target="_new">https://github.com/queueRAM/sm64tools/releases/tag/sm64compressv0.2a</a>
  1390.  
  1391.     <br/><br/><h3>Credits/Thanks</h3>
  1392.  
  1393.     <table>
  1394.     <tr><td>AwesomelukeyProject/Vertrex and Dudaw12</td><td>Pioneers. Solved the MIO0 data align issues, started the console compatibility ball rolling</td></tr>
  1395.     <tr><td>Kyle</td><td>Created the first fixing tool (ED64.exe), brought XVI32 and hex editing to my attention</td></tr>
  1396.     <tr><td>queueRAM</td><td>Awesome, in depth work on console compatibility, such as "Additional Music Settings and Sequences" patch fix. Created the brilliant sm64compress, helped me a lot, just very helpful overall!</td></tr>
  1397.     <tr><td>David/Davideesk</td><td>Awesome, in depth work on console compatibility, finding levels with fog, alpha textures fixing, camera far value fixing, helped me a lot, just very helpful overall!</td></tr>
  1398.     <tr><td>Kaze</td><td>His video tutorial series and Google site were crucial for this! Helped a great deal with the mario screen skip, "Additional Music Settings and Sequences" patch fix, chipped in on water boxes, 0xFC commands, drawing layers... Helped me a lot, just very helpful overall!</td></tr>
  1399.     <tr><td>cpuHacka101</td><td>Wiki contributions, on "0xFC G_SETCOMBINE" commands, specifically</td></tr>
  1400.     <tr><td>Skelux</td><td>Star Road Mario Cam code. Helped me with the VI change wayback when, various tweaks in the level editor also helped. Also helped me find some legacy Level Importer versions.</td></tr>
  1401.     <tr><td>aglab2</td><td>Parallel Lakitu Camera Patch</td></tr>
  1402.     <tr><td>aterraformer</td><td>For his patience/persistance!</td></tr>
  1403.     </table>
  1404.  
  1405.     <h4 style="text-align:center;">This is for all the Nintendo 64 fans and flashcart users out there - Keepin' it real!</h4>
  1406.  
  1407.     <p style="text-align:center;">
  1408.         <button onclick="clearsplash()" style="width:400px;height:60px;font-size:large;margin: auto:">Click here to Begin</button>
  1409.     </p>
  1410.  
  1411. </div> <!-- Splash Screen //////////////////////////////////////////////////////////// -->
  1412.  
  1413.  
  1414.  
  1415. <div id="maincontainer">
  1416.  
  1417.    
  1418.     <div id="videobox">
  1419.         <div id="searchfor" class="vidoverlay">
  1420.             I <u><i>highly</i></u> recommend you start with a simple mini hack, to familiarise youself with the process.
  1421.             <br/>Try one of these:
  1422.             <br/>- SM64 Christmas Carnival Special
  1423.             <br/>- Return to Retroland
  1424.             <br/>- SM64: It's A Crash!
  1425.             <br/>- Super Mario 64 Sapphire
  1426.             <br/><br/>
  1427.             Follow the instructions in the yellow box below to continue.
  1428.         </div>
  1429.     </div>
  1430.    
  1431.     <div class="header">
  1432.         <button onclick="debugtoggle()">Debug Toggle</button>
  1433.        
  1434.     </div>
  1435.  
  1436.     <div id="gui" class="column rightinstruction">
  1437.         <h1>Pointless Sample Text</h1>
  1438.     </div><!--close column rightinstruction-->
  1439.     <!--</div>close leftrightboxcontainer-->
  1440.  
  1441.     <div id="FFooter" class="footer">
  1442.         <p>This is where the script will be printed</p>
  1443.         <p></p>
  1444.     </div>
  1445.  
  1446. </div><!--close maincontainer div-->
  1447.  
  1448. <div id="debugbox">
  1449.   <h1>Debug Display</h1>
  1450.   <p>Text.</p>
  1451.  
  1452.  
  1453. </div>
  1454.  
  1455. </body>
  1456. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement