SHARE
TWEET

Magical Quest starring Micky Mouse autosplitter

Hsilamot May 19th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. state("higan") {}
  2. state("snes9x") {}
  3. state("snes9x-x64") {}
  4. state("emuhawk") {}
  5.  
  6. startup
  7. {
  8.     settings.Add("bosses", true, "Bosses");
  9. }
  10.  
  11. init
  12. {
  13.     var states = new Dictionary<int, long>
  14.     {
  15.         { 10330112, 0x789414 },     //snes9x 1.52-rr
  16.         { 7729152, 0x890EE4 },      //snes9x 1.54-rr
  17.         { 5914624, 0x6EFBA4 },      //snes9x 1.53
  18.         { 6909952, 0x140405EC8 },   //snes9x 1.53 (x64)
  19.         { 6447104, 0x7410D4 },      //snes9x 1.54/1.54.1
  20.         { 7946240, 0x1404DAF18 },   //snes9x 1.54/1.54.1 (x64)
  21.         { 6602752, 0x762874 },      //snes9x 1.55
  22.         { 8355840, 0x1405BFDB8 },   //snes9x 1.55 (x64)
  23.         { 6856704, 0x78528C },      //snes9x 1.56/1.56.2
  24.         { 9003008, 0x1405D8C68 },   //snes9x 1.56 (x64)
  25.         { 6848512, 0x7811B4 },      //snes9x 1.56.1
  26.         { 8945664, 0x1405C80A8 },   //snes9x 1.56.1 (x64)
  27.         { 9015296, 0x1405D9298 },   //snes9x 1.56.2 (x64)
  28.         { 6991872, 0x7A6EE4 },      //snes9x 1.57
  29.         { 9048064, 0x1405ACC58 },   //snes9x 1.57 (x64)
  30.         { 7000064, 0x7A7EE4 },      //snes9x 1.58
  31.         { 9060352, 0x1405AE848 },   //snes9x 1.58 (x64)
  32.         { 8953856, 0x975A54 },      //snes9x 1.59.2
  33.         { 12537856, 0x1408D86F8 },  //snes9x 1.59.2 (x64)
  34.         { 9027584, 0x94DB54 },      //snes9x 1.60
  35.         { 12836864, 0x1408D8BE8 },  //snes9x 1.60 (x64)
  36.         { 12509184, 0x915304 },     //higan v102
  37.         { 13062144, 0x937324 },     //higan v103
  38.         { 15859712, 0x952144 },     //higan v104
  39.         { 16756736, 0x94F144 },     //higan v105tr1
  40.         { 16019456, 0x94D144 },     //higan v106
  41.         { 10096640, 0x72BECC },     //bsnes v107
  42.         { 10338304, 0x762F2C },     //bsnes v107.1
  43.         { 47230976, 0x765F2C },     //bsnes v107.2/107.3
  44.         { 7061504, 0x36F11500240 }, //BizHawk 2.3
  45.         { 7249920, 0x36F11500240 }, //BizHawk 2.3.1
  46.     };
  47.  
  48.     long memoryOffset;
  49.     if (states.TryGetValue(modules.First().ModuleMemorySize, out memoryOffset))
  50.         if (memory.ProcessName.ToLower().Contains("snes9x"))
  51.             memoryOffset = memory.ReadValue<int>((IntPtr)memoryOffset);
  52.  
  53.     if (memoryOffset == 0)
  54.         throw new Exception("Memory not yet initialized.");
  55.  
  56.     vars.watchers = new MemoryWatcherList
  57.     {
  58.         new MemoryWatcher<byte>((IntPtr)memoryOffset + 0x2b1) { Name = "ownlife" },
  59.         new MemoryWatcher<byte>((IntPtr)memoryOffset + 0x7c1) { Name = "enemylife1" },
  60.         new MemoryWatcher<byte>((IntPtr)memoryOffset + 0x811) { Name = "enemylife2" },
  61.         new MemoryWatcher<byte>((IntPtr)memoryOffset + 0x861) { Name = "enemylife3" },
  62.         new MemoryWatcher<byte>((IntPtr)memoryOffset + 0x8b1) { Name = "enemylife4" },
  63.         new MemoryWatcher<byte>((IntPtr)memoryOffset + 0x9f1) { Name = "enemylife5" },
  64.         new MemoryWatcher<byte>((IntPtr)memoryOffset + 0xa41) { Name = "enemylife6" },
  65.         new MemoryWatcher<byte>((IntPtr)memoryOffset + 0xe01) { Name = "enemylife7" },
  66.     };
  67.     vars.couldbefighting = 0;
  68.     vars.isfighting = false;
  69. }
  70.  
  71. update
  72. {
  73.     vars.watchers.UpdateAll(game);
  74. }
  75.  
  76. start
  77. {
  78.     return vars.watchers["ownlife"].Old == 0 && vars.watchers["ownlife"].Current != 0;
  79. }
  80.  
  81. reset
  82. {
  83.  
  84. }
  85.  
  86. split
  87. {
  88.     if (vars.isfighting) {
  89.         var Count255 = 0;
  90.         var Count0 = 0;
  91.         if (vars.watchers["enemylife1"].Current==255) { Count255++; } if (vars.watchers["enemylife1"].Current==0) { Count0++; }
  92.         if (vars.watchers["enemylife2"].Current==255) { Count255++; } if (vars.watchers["enemylife2"].Current==0) { Count0++; }
  93.         if (vars.watchers["enemylife3"].Current==255) { Count255++; } if (vars.watchers["enemylife3"].Current==0) { Count0++; }
  94.         if (vars.watchers["enemylife4"].Current==255) { Count255++; } if (vars.watchers["enemylife4"].Current==0) { Count0++; }
  95.         if (vars.watchers["enemylife5"].Current==255) { Count255++; } if (vars.watchers["enemylife5"].Current==0) { Count0++; }
  96.         if (vars.watchers["enemylife6"].Current==255) { Count255++; } if (vars.watchers["enemylife6"].Current==0) { Count0++; }
  97.         if (vars.watchers["enemylife7"].Current==255) { Count255++; } if (vars.watchers["enemylife7"].Current==0) { Count0++; }
  98.         if (Count255 == 3 && Count0 == 4) {
  99.             vars.isfighting = false;
  100.             print ("Fight with fire boss is Over, Splitting.");
  101.             return true;
  102.         }
  103.         var Enemy1 = settings["bosses"] && vars.watchers["enemylife1"].Current > 230 && vars.watchers["enemylife1"].Old < 20;
  104.         var Enemy2 = settings["bosses"] && vars.watchers["enemylife2"].Current > 230 && vars.watchers["enemylife2"].Old < 20;
  105.         var Enemy3 = settings["bosses"] && vars.watchers["enemylife3"].Current > 230 && vars.watchers["enemylife3"].Old < 20;
  106.         var Enemy4 = settings["bosses"] && vars.watchers["enemylife4"].Current > 230 && vars.watchers["enemylife4"].Old < 20;
  107.         var Enemy5 = settings["bosses"] && vars.watchers["enemylife5"].Current > 230 && vars.watchers["enemylife5"].Old < 20;
  108.         var Enemy6 = settings["bosses"] && vars.watchers["enemylife6"].Current > 230 && vars.watchers["enemylife6"].Old < 20;
  109.         var Enemy7 = settings["bosses"] && vars.watchers["enemylife7"].Current > 230 && vars.watchers["enemylife7"].Old < 20;
  110.         if (Enemy1 || Enemy2 || Enemy3 || Enemy4 || Enemy5 || Enemy6 || Enemy7) {
  111.             vars.isfighting = false;
  112.             print ("Fight is Over, Splitting.");
  113.             return true;
  114.         }
  115.         if (vars.watchers["ownlife"].Current == 0) {
  116.             print ("Fight is over but player died, no split this time.");
  117.             vars.isfighting = false;
  118.             Thread.Sleep(7000);
  119.         }
  120.     } else {
  121.         if (vars.couldbefighting==0) {
  122.             if (vars.watchers["enemylife1"].Current > 32 && vars.watchers["enemylife1"].Current < 53) { vars.couldbefighting = 1; }
  123.             if (vars.watchers["enemylife2"].Current > 32 && vars.watchers["enemylife2"].Current < 53) { vars.couldbefighting = 2; }
  124.             if (vars.watchers["enemylife3"].Current > 32 && vars.watchers["enemylife3"].Current < 53) { vars.couldbefighting = 3; }
  125.             if (vars.watchers["enemylife4"].Current > 32 && vars.watchers["enemylife4"].Current < 53) { vars.couldbefighting = 4; }
  126.             if (vars.watchers["enemylife5"].Current > 32 && vars.watchers["enemylife5"].Current < 53) { vars.couldbefighting = 5; }
  127.             if (vars.watchers["enemylife6"].Current > 32 && vars.watchers["enemylife6"].Current < 53) { vars.couldbefighting = 6; }
  128.             if (vars.watchers["enemylife7"].Current > 32 && vars.watchers["enemylife7"].Current < 53) { vars.couldbefighting = 7; }
  129.             if (vars.couldbefighting>0) {
  130.                 print ("Fight may be going on... watching...");
  131.             }
  132.         } else {
  133.             if (vars.couldbefighting == 1 && vars.watchers["enemylife1"].Current > 15 && vars.watchers["enemylife1"].Current < 32) { vars.isfighting = true; }
  134.             if (vars.couldbefighting == 2 && vars.watchers["enemylife2"].Current > 15 && vars.watchers["enemylife2"].Current < 32) { vars.isfighting = true; }
  135.             if (vars.couldbefighting == 3 && vars.watchers["enemylife3"].Current > 15 && vars.watchers["enemylife3"].Current < 32) { vars.isfighting = true; }
  136.             if (vars.couldbefighting == 4 && vars.watchers["enemylife4"].Current > 15 && vars.watchers["enemylife4"].Current < 32) { vars.isfighting = true; }
  137.             if (vars.couldbefighting == 5 && vars.watchers["enemylife5"].Current > 15 && vars.watchers["enemylife5"].Current < 32) { vars.isfighting = true; }
  138.             if (vars.couldbefighting == 6 && vars.watchers["enemylife6"].Current > 15 && vars.watchers["enemylife6"].Current < 32) { vars.isfighting = true; }
  139.             if (vars.couldbefighting == 7 && vars.watchers["enemylife7"].Current > 15 && vars.watchers["enemylife7"].Current < 32) { vars.isfighting = true; }
  140.             if (vars.isfighting) {
  141.                 print ("Fight is going on... Watching for boss death.");
  142.                 vars.couldbefighting = 0;
  143.                 return false;
  144.             }
  145.             if (vars.couldbefighting == 1 && vars.watchers["enemylife1"].Current == 0) { vars.couldbefighting = 0; }
  146.             if (vars.couldbefighting == 2 && vars.watchers["enemylife2"].Current == 0) { vars.couldbefighting = 0; }
  147.             if (vars.couldbefighting == 3 && vars.watchers["enemylife3"].Current == 0) { vars.couldbefighting = 0; }
  148.             if (vars.couldbefighting == 4 && vars.watchers["enemylife4"].Current == 0) { vars.couldbefighting = 0; }
  149.             if (vars.couldbefighting == 5 && vars.watchers["enemylife5"].Current == 0) { vars.couldbefighting = 0; }
  150.             if (vars.couldbefighting == 6 && vars.watchers["enemylife6"].Current == 0) { vars.couldbefighting = 0; }
  151.             if (vars.couldbefighting == 7 && vars.watchers["enemylife7"].Current == 0) { vars.couldbefighting = 0; }
  152.             if (vars.couldbefighting==0) {
  153.                 print ("Fight was a fake, reverting back."+vars.couldbefighting);
  154.             }
  155.         }
  156.     }
  157.     return false;
  158. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top