PoppyPlaytimeChapter2.asl 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. /* Pretty much a very straight forward ASL; I wish the int CurCheckpoint was consistent throughout the game. It somewhat dies towards checkpoint 10 and there is no other memory address I found.
  2. However; through the save file is pretty much the most "Won't break with update," thing I've made thus far so I can't complain.
  3. Made by: Kuno Demetries
  4. Discord: Kuno Demetries#6969
  5. Linktree: https://linktr.ee/KunoDemetries
  6. */
  7. state("Playtime_Prototype4-Win64-Shipping", "Steam Version 1.2")
  8. {
  9. int CurCheckpoint : 0x04D2EEE0, 0x118, 0x2E4; // Can be found by searching for .PersistentLevel.Chapter2_Gamemode_C and adding 0x2e4
  10. int GameLoaded : 0x04D2EEE0, 0x118, 0x2F8; // Can be found by searching for .PersistentLevel.Chapter2_Gamemode_C and adding 0x2F8
  11. int IsPaused : 0x04D2B5C8, 0x8A8; // search for a byte 1 paused/ 0 not
  12. float X : 0x04D2B580, 0x8, 0x8, 0x190, 0x22C; // cheat engine dumper -> player controller -> lastupdatedxvalue
  13. float StopLeverPulled : 0x04D2EEE0, 0x88, 0x98, 0x128, 0x98, 0x70, 0x2A0; // TrainStopLever_C TrainBlueprints.TrainBlueprints.PersistentLevel.TrainStopLever2
  14. float GoLeverPulled : 0x04D2EEE0, 0x250, 0xDA0, 0x20, 0x28C; // TrainGoLever_C
  15. }
  16. state("Playtime_Prototype4-Win64-Shipping", "Steam Version 1.3")
  17. {
  18. int CurCheckpoint : 0x04D2DEE0, 0x118, 0x2E4; // Can be found by searching for .PersistentLevel.Chapter2_Gamemode_C and adding 0x2e4
  19. int GameLoaded : 0x04D2DEE0, 0x118, 0x2F8; // Can be found by searching for .PersistentLevel.Chapter2_Gamemode_C and adding 0x2F8
  20. int IsPaused : 0x04D2A5C8, 0x8A8; // search for a byte 1 paused/ 0 not
  21. float X : 0x04D2A580, 0x8, 0x8, 0x190, 0x22C; // cheat engine dumper -> player controller -> lastupdatedxvalue
  22. float StopLeverPulled : 0x04D2DEE0, 0x88, 0x98, 0x128, 0x98, 0x70, 0x2A0; // TrainStopLever_C TrainBlueprints.TrainBlueprints.PersistentLevel.TrainStopLever2
  23. float GoLeverPulled : 0x04D2DEE0, 0x250, 0xDA0, 0x20, 0x28C; // TrainGoLever_C
  24. }
  25. init
  26. {
  27. vars.CurCheckpoint = null;
  28. vars.doneMaps = new List<string>();
  29. vars.Combination = "1423";
  30. vars.TrainStarted = 0;
  31. switch (modules.First().ModuleMemorySize)
  32. {
  33. case 85676032: version = "Steam Version 1.2";
  34. break;
  35. case 85671936: version = "Steam Version 1.3";
  36. break;
  37. default: version = "Steam Version 1.2";
  38. break;
  39. }
  40. }
  41. startup
  42. {
  43. settings.Add("chap", true, "Poppy Playtime: Chapter 2");
  44. vars.Chapters = new Dictionary<string,string>
  45. {
  46. {"01", "Fixed power, and Opened B/R Door"},
  47. {"02", "After sliding down the blue slide"},
  48. {"03", "Fixed power section 2"},
  49. {"04", "Mommy's Monologue Finished"},
  50. {"05", "Entering Molding Room"},
  51. {"06", "Green Hand Fixed"},
  52. {"07", "Entering Musical Memory"},
  53. {"08", "End of introuction to Musical Memory, starting game"},
  54. {"09", "End of round 1 of Musical Memory"},
  55. {"0A", "End of round 2 of Musical Memory"},
  56. {"0B", "End of round 3 of Musical Memory"},
  57. {"0C", "End of round 4 of Musical Memory"},
  58. {"0D", "Entering Product Storage"},
  59. {"0E", "Leaving Product Storage"},
  60. {"0F", "Return to Train Section"},
  61. {"10", "Entering Wack-A-Wuggy"},
  62. {"11", "End of introuction to Wack-A-Wuggy, starting game"},
  63. {"12", "End of Wack-A-Wuggy"},
  64. {"13", "Entering Cart Corridors"},
  65. {"14", "Pushing Barry The Cart down the trackway (Returning to Hub)"},
  66. {"15", "Entering Statues"},
  67. {"16", "Fixed electricty to statues"},
  68. {"17", "Start of statues"},
  69. {"18", "Leaving statues"},
  70. {"1A", "Water Treatment"},
  71. {"1B", "Leaving Water Treatment"},
  72. {"1C", "Fixed electricty in the underground"},
  73. {"1D", "Hide and Seek with Mommy"},
  74. {"1E", "Power lever section"},
  75. {"1F", "Finished Power lever section"},
  76. {"20", "Hide from mommy"},
  77. {"22", "Chase scene through tunnels with mommy"},
  78. {"23", "Entering hallway, past the tunnel section"},
  79. };
  80. foreach (var Tag in vars.Chapters)
  81. {
  82. settings.Add(Tag.Key, true, Tag.Value, "chap");
  83. };
  84. if (timer.CurrentTimingMethod == TimingMethod.RealTime) // stolen from dude simulator 3, basically asks the runner to set their livesplit to game time
  85. {
  86. var timingMessage = MessageBox.Show (
  87. "This game uses Time without Loads (Game Time) as the main timing method.\n"+
  88. "LiveSplit is currently set to show Real Time (RTA).\n"+
  89. "Would you like to set the timing method to Game Time? This will make verification easier",
  90. "LiveSplit | POPPY PLAYTIME: CHAPTER 2",
  91. MessageBoxButtons.YesNo,MessageBoxIcon.Question
  92. );
  93. if (timingMessage == DialogResult.Yes)
  94. {
  95. timer.CurrentTimingMethod = TimingMethod.GameTime;
  96. }
  97. }
  98. vars.SetTextComponent = (Action<string, string>)((id, text) =>
  99. {
  100. var textSettings = timer.Layout.Components.Where(x => x.GetType().Name == "TextComponent").Select(x => x.GetType().GetProperty("Settings").GetValue(x, null));
  101. var textSetting = textSettings.FirstOrDefault(x => (x.GetType().GetProperty("Text1").GetValue(x, null) as string) == id);
  102. if (textSetting == null)
  103. {
  104. var textComponentAssembly = Assembly.LoadFrom("Components\\LiveSplit.Text.dll");
  105. var textComponent = Activator.CreateInstance(textComponentAssembly.GetType("LiveSplit.UI.Components.TextComponent"), timer);
  106. timer.Layout.LayoutComponents.Add(new LiveSplit.UI.Components.LayoutComponent("LiveSplit.Text.dll", textComponent as LiveSplit.UI.Components.IComponent));
  107. textSetting = textComponent.GetType().GetProperty("Settings", BindingFlags.Instance | BindingFlags.Public).GetValue(textComponent, null);
  108. textSetting.GetType().GetProperty("Text1").SetValue(textSetting, id);
  109. }
  110. if (textSetting != null)
  111. textSetting.GetType().GetProperty("Text2").SetValue(textSetting, text);
  112. });
  113. settings.Add("Combo_Setting", true, "Current Combination");
  114. }
  115. update
  116. {
  117. string CurTrain = null;
  118. string CurTrainHex = "00-54-72-61-69-6E-43-6F-64-65-56-61-72-69-61-74-69-6F-6E-49-6E-55-73-65-00-0C-00-00-00-49-6E-74-50-72-6F-70-65-72-74-79-00-04-00-00-00-00-00-00-00-00-";
  119. string CurCheckpointHex = "43-68-65-63-6B-70-6F-69-6E-74-00-0C-00-00-00-49-6E-74-50-72-6F-70-65-72-74-79-00-04-00-00-00-00-00-00-00-00-";
  120. if ((current.GameLoaded == 1))
  121. {
  122. string logPath = Environment.GetEnvironmentVariable("AppData")+"\\..\\local\\Playtime_Prototype4\\Saved\\SaveGames\\Chap2Checkpoint.sav";
  123. byte[] data = File.ReadAllBytes(logPath);
  124. string hex = BitConverter.ToString(data);
  125. int traincode = hex.IndexOf(CurTrainHex);
  126. int checkpoint = hex.IndexOf(CurCheckpointHex);
  127. if ((traincode != -1) || (checkpoint != -1))
  128. {
  129. CurTrain = hex.Substring(traincode + CurTrainHex.Length, 2);
  130. vars.CurCheckpoint = hex.Substring(checkpoint + CurCheckpointHex.Length, 2);
  131. }
  132. if (settings["Combo_Setting"])
  133. {
  134. switch (CurTrain)
  135. {
  136. case "00" : vars.Combination = "1423";
  137. break;
  138. case "01" : vars.Combination = "2431";
  139. break;
  140. case "02" : vars.Combination = "1324";
  141. break;
  142. case "03" : vars.Combination = "4312";
  143. break;
  144. case "04" : vars.Combination = "3241";
  145. break;
  146. case "05" : vars.Combination = "4213";
  147. break;
  148. case "06" : vars.Combination = "3124";
  149. break;
  150. case "07" : vars.Combination = "2314";
  151. break;
  152. case "08" : vars.Combination = "4231";
  153. break;
  154. case "09" : vars.Combination = "1243";
  155. break;
  156. default: vars.Combination = "1423";
  157. break;
  158. }
  159. vars.SetTextComponent("Current Combination:", (vars.Combination.ToString()));
  160. }
  161. }
  162. //print(traincode.ToString());
  163. if ((current.GoLeverPulled > .01) && (Int32.Parse(vars.CurCheckpoint) >= 1))
  164. {
  165. vars.TrainStarted = 1;
  166. }
  167. }
  168. start
  169. {
  170. return ((current.CurCheckpoint == 0) && (current.GameLoaded == 1) && (current.X != 0)); //bad as it'll start everywhere but you know
  171. }
  172. onStart
  173. {
  174. vars.doneMaps.Add(vars.CurCheckpoint.ToString());
  175. vars.TrainStarted = 0;
  176. }
  177. onReset
  178. {
  179. vars.doneMaps.Clear();
  180. vars.TrainStarted = 0;
  181. }
  182. split
  183. {
  184. if ((settings[vars.CurCheckpoint.ToString()]) && (!vars.doneMaps.Contains(vars.CurCheckpoint.ToString())))
  185. {
  186. vars.doneMaps.Add(vars.CurCheckpoint.ToString());
  187. return true;
  188. }
  189. if ((current.StopLeverPulled == 1) && (vars.TrainStarted == 1))
  190. {
  191. vars.TrainStarted = 0;
  192. return true;
  193. }
  194. }
  195. isLoading
  196. {
  197. return ((current.GameLoaded == null) || (current.GameLoaded == 0) || (current.IsPaused == 1));
  198. }