Skip to content

Instantly share code, notes, and snippets.

@wRadion
Last active August 2, 2024 08:47
Show Gist options
  • Save wRadion/05c9d5e6ba9cd06f37f3408bd5c74d9c to your computer and use it in GitHub Desktop.
Save wRadion/05c9d5e6ba9cd06f37f3408bd5c74d9c to your computer and use it in GitHub Desktop.
Bzzzt Autosplitter
/*
* Bzzzt Autosplitter
* Made by wRadion
*/
state("Bzzzt") {
string80 Log: "UnityPlayer.dll", 0x01ADE6A8, 0x8, 0xC;
}
startup {
Assembly.Load(File.ReadAllBytes("Components/asl-help")).CreateInstance("Unity");
vars.Helper.GameName = "Bzzzt";
vars.Helper.LoadSceneManager = true;
vars.NextLevelPressed = false;
vars.OldLevel = 0;
vars.IsFading = false;
vars.HasFaded = false;
vars.HasSplit = false;
vars.onNormalDifficulty = false;
settings.Add("levels", true, "Split by Level");
for (int i = 1; i < 52; ++i) {
settings.Add(i.ToString(), i == 13 || i == 26 || i == 39, "Level " + i.ToString(), "levels");
}
}
init {
vars.Helper.TryLoad = (Func<dynamic, bool>) (mono => {
vars.Helper["Level"] = mono.Make<int>("Main", "instance", "ActualLevelId");
vars.Helper["BtnClick"] = mono.Make<bool>("Main", "instance", "ButtonClicked");
vars.Helper["NextLevel"] = mono.Make<bool>("Main", "instance", "ConfirmNextLevelPressed");
vars.Helper["MainMenu"] = mono.Make<bool>("Main", "instance", "IsInMainMenu");
vars.Helper["Pause"] = mono.Make<bool>("Main", "instance", "Pause");
vars.Helper["Time"] = mono.Make<float>("Main", "instance", "IngameBarInstance", "ActualTime");
vars.Helper["FadeScreen"] = mono.Make<bool>("Main", "instance", "FadeScreenInstance", "IsShown");
vars.Helper["Hearts"] = mono.Make<int>("Main", "instance", "IngameBarInstance", "Hearts");
vars.Helper["HeartsTotal"] = mono.Make<int>("Main", "instance", "IngameBarInstance", "HeartsTotal");
return true;
});
}
start {
if (current.MainMenu != old.MainMenu && !current.MainMenu) {
vars.onNormalDifficulty = current.HeartsTotal == 0;
return true;
}
return false;
}
update {
if (!vars.IsFading && current.FadeScreen) {
vars.IsFading = true;
}
if (vars.IsFading && !current.FadeScreen) {
vars.IsFading = false;
vars.HasFaded = true;
}
if (vars.HasFaded && vars.HasSplit) {
vars.HasSplit = false;
if (vars.OldLevel == current.Level) {
--timer.CurrentSplitIndex;
}
}
vars.HasFaded = false;
}
split {
if (current.NextLevel && current.NextLevel != old.NextLevel) {
vars.NextLevelPressed = true;
}
if (((current.FadeScreen && vars.NextLevelPressed && current.FadeScreen != old.FadeScreen)
|| (current.BtnClick && current.BtnClick != old.BtnClick))
&& !current.Pause && (vars.onNormalDifficulty || current.Hearts > 0)
&& (settings[current.Level.ToString()] || current.Level == 52)) {
vars.NextLevelPressed = false;
vars.OldLevel = current.Level;
vars.HasSplit = true;
return true;
}
}
isLoading {
return current.Time == old.Time;
}
reset {
return current.MainMenu != old.MainMenu && current.MainMenu;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment