Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- state("Croc2", "US")
- {
- int CurTribe : 0xA8C44;
- int CurLevel : 0xA8C48;
- int CurMap : 0xA8C4C;
- int CurType : 0xA8C50;
- int InGameState : 0xB7880;
- int IsCheatMenuOpen : 0xB788C;
- bool IsMapLoaded : 0xB78C4;
- int NewMainState : 0xB7930;
- int IsNewMainStateValid : 0xB7934;
- int MainState : 0xB793C;
- uint DFCrystal5PosX : 0x223D30;
- uint DFCrystal5PosY : 0x223D34;
- uint DFCrystal5PosZ : 0x223D38;
- }
- state("Croc2", "EU")
- {
- int CurTribe : 0xA9C44;
- int CurLevel : 0xA9C48;
- int CurMap : 0xA9C4C;
- int CurType : 0xA9C50;
- int InGameState : 0xBEA70;
- int IsCheatMenuOpen : 0xBEA7C;
- bool IsMapLoaded : 0xBEAB4;
- int NewMainState : 0xBEB20;
- int IsNewMainStateValid : 0xBEB24;
- int MainState : 0xBEB2C;
- uint DFCrystal5PosX : 0x22AF20;
- uint DFCrystal5PosY : 0x22AF24;
- uint DFCrystal5PosZ : 0x22AF28;
- }
- startup
- {
- settings.Add("SplitOnMapChange", false,
- "Split on load");
- settings.Add("StartOnFirstLevel", false,
- "IL start");
- settings.Add("StartOnHubCheat", false,
- "IW start");
- settings.Add("StartAfterSaveSlotChosen", false,
- "Save slot start");
- settings.Add("createui", false, "Last IL time");
- // Returns true iff map is "Swap Meet Pete's General Store"
- vars.IsShopMap = new Func<dynamic, bool>(state =>
- state.CurTribe >= 1 && state.CurTribe <= 4 &&
- state.CurLevel == 1 && state.CurMap == 4 && state.CurType == 0);
- vars.SetTextComponent = (Action<string, string, bool>)((id, text, create) => {
- var textSettings = timer.Layout.Components.Where(x => x.GetType().Name == "TextComponent").Select(x => x.GetType().GetProperty("Settings").GetValue(x, null));
- var textSetting = textSettings.FirstOrDefault(x => (x.GetType().GetProperty("Text1").GetValue(x, null) as string) == id);
- if (textSetting == null && create)
- {
- var textComponentAssembly = Assembly.LoadFrom("Components\\LiveSplit.Text.dll");
- var textComponent = Activator.CreateInstance(textComponentAssembly.GetType("LiveSplit.UI.Components.TextComponent"), timer);
- timer.Layout.LayoutComponents.Add(new LiveSplit.UI.Components.LayoutComponent("LiveSplit.Text.dll", textComponent as LiveSplit.UI.Components.IComponent));
- textSetting = textComponent.GetType().GetProperty("Settings", BindingFlags.Instance | BindingFlags.Public).GetValue(textComponent, null);
- textSetting.GetType().GetProperty("Text1").SetValue(textSetting, id);
- }
- if (textSetting != null)
- textSetting.GetType().GetProperty("Text2").SetValue(textSetting, text);
- });
- }
- init
- {
- var firstModule = modules.First();
- var baseAddr = firstModule.BaseAddress;
- switch (firstModule.ModuleMemorySize)
- {
- case 0x23A000:
- version = "US";
- vars.AddrSaveSlots = baseAddr + 0x2040C0;
- vars.AddrCurSaveSlotIdx = baseAddr + 0x2220FC;
- break;
- case 0x242000:
- version = "EU";
- vars.AddrSaveSlots = baseAddr + 0x20B2B0;
- vars.AddrCurSaveSlotIdx = baseAddr + 0x2292EC;
- break;
- }
- vars.TimeAtLoad = new TimeSpan();
- vars.LastILTime = new TimeSpan();
- vars.SetTextComponent( "Last IL time",
- vars.LastILTime.ToString(),
- settings["createui"]);
- }
- update
- {
- if ((old.InGameState == 7) && (current.InGameState != 7))
- {
- vars.TimeAtLoad = timer.CurrentTime.GameTime;
- }
- vars.SetTextComponent( "Last IL time",
- vars.LastILTime.ToString(),
- settings["createui"]);
- return version != "";
- }
- start
- {
- const int MainState_ChooseSaveSlot = 2;
- const int MainState_Running = 11;
- const int MainState_LevelSelect = 18;
- // Start when main state is in transition from
- // "level select" or "save slot selection" to "running"
- if (settings["StartAfterSaveSlotChosen"] && (
- current.MainState == MainState_ChooseSaveSlot ||
- current.MainState == MainState_LevelSelect) &&
- current.IsNewMainStateValid != 0 &&
- current.NewMainState == MainState_Running)
- {
- return true;
- }
- // The following start condition checks assume the game is running
- // and the current map is an ingame tribe and not a cutscene
- if (current.MainState != MainState_Running ||
- current.CurTribe < 1 || current.CurTribe > 5 || current.CurType == 3)
- {
- return false;
- }
- if (settings["StartOnFirstLevel"] && (
- // Current map is a non-village map of Dante's World
- // or a non-village level of the Gobbo tribes
- current.CurTribe == 5 ? current.CurMap > 1 : current.CurLevel > 1))
- {
- return true;
- }
- if (settings["StartOnHubCheat"] &&
- // Cheat menu is open while loading a new map
- current.IsCheatMenuOpen != 0 && current.InGameState == 7)
- {
- return true;
- }
- vars.TimeAtLoad = timer.CurrentTime.GameTime;
- vars.LastILTime = timer.CurrentTime.GameTime;
- vars.SetTextComponent( "Last IL time",
- vars.LastILTime.ToString(),
- settings["createui"]);
- }
- split
- {
- // Cancel if main state is not "running" or
- // current tribe is not an ingame tribe
- const int MainState_Running = 11;
- if (current.MainState != MainState_Running ||
- current.CurTribe < 1 || current.CurTribe > 5)
- {
- ((IDictionary<string, object>)current).Remove("ProgressList");
- return false;
- }
- // Read progress list
- const int SaveSlotSize = 0x2000;
- var addrSaveSlot = vars.AddrSaveSlots +
- memory.ReadValue<int>((IntPtr)vars.AddrCurSaveSlotIdx) * SaveSlotSize;
- current.ProgressList = memory.ReadBytes((IntPtr)addrSaveSlot + 0x2d0, 0xf0);
- // Cancel if old progress list is not available
- if (!((IDictionary<string, object>)old).ContainsKey("ProgressList")) return false;
- // "Dante's Final Fight": Split when last crystal is placed
- if (current.CurTribe == 4 && current.CurLevel == 2 &&
- current.CurMap == 1 && current.CurType == 1 && (
- old.DFCrystal5PosX != current.DFCrystal5PosX ||
- old.DFCrystal5PosY != current.DFCrystal5PosY ||
- old.DFCrystal5PosZ != current.DFCrystal5PosZ) &&
- current.DFCrystal5PosX == 0x00004358 &&
- current.DFCrystal5PosY == 0x0000315b &&
- current.DFCrystal5PosZ == 0x00004d53)
- {
- return true;
- }
- // Check whether progress has changed
- for (int tribe = 1; tribe <= 5; ++tribe)
- {
- // Level completed?
- for (int level = 2; level <= 7; ++level)
- {
- int index = (tribe * 10 + level) * 4;
- if (old.ProgressList[index] != current.ProgressList[index])
- {
- vars.LastILTime = timer.CurrentTime.GameTime - vars.TimeAtLoad;
- return true;
- }
- }
- // Boss defeated?
- for (int boss = 1; boss <= 2; ++boss)
- {
- int index = (tribe * 10 + boss) * 4 + 1;
- if (old.ProgressList[index] != current.ProgressList[index])
- {
- vars.LastILTime = timer.CurrentTime.GameTime - vars.TimeAtLoad;
- return true;
- }
- }
- }
- // Split on map change (except when changing from or to shop map)
- if (settings["SplitOnMapChange"] && (
- old.CurTribe != current.CurTribe ||
- old.CurLevel != current.CurLevel ||
- old.CurMap != current.CurMap ||
- old.CurType != current.CurType) &&
- !vars.IsShopMap(old) && !vars.IsShopMap(current))
- {
- return true;
- }
- }
- isLoading
- {
- return !current.IsMapLoaded;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement