-
-
Save MolaeMaceria/f94b52d74b8530d0a569957223ae2a13 to your computer and use it in GitHub Desktop.
Hacknet Autosplitter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
state("Hacknet"){ | |
} | |
startup | |
{ | |
settings.Add("Start", false, "Start timer on the first black frame after creating a new account"); | |
settings.Add("aggression", false, "Split when the \"Aggression must be Punished\" email is received"); | |
settings.Add("CSEC", false, "Split when the first bit message after CSEC is received"); | |
settings.Add("Start Trials", false, "Split when the Kaguya trials are started"); | |
settings.Add("Finish Trials", false, "Split after the trials are finished,"); | |
settings.Add("Finish DLC", false, "Split when the button at the end of the DLC is clicked"); | |
settings.Add("Finish Game", false, "Split when the interface locks after porthacking Heart"); | |
} | |
update | |
{ | |
vars.currentSong.Update(game); | |
vars.isBooting.Update(game); | |
vars.topbarDisabled.Update(game); | |
vars.dlcMode.Update(game); | |
vars.preDLCNodesCache.Update(game); | |
vars.connectedCompId.Update(game); | |
vars.currentMissionEmailSubject.Update(game); | |
} | |
init | |
{ | |
print("Sleeping 5 seconds to let Hacknet JIT all the main menu junk"); | |
Thread.Sleep(5000); | |
IntPtr OSpointer = IntPtr.Zero; | |
IntPtr currentSongPointer = IntPtr.Zero; | |
IntPtr ptr; | |
foreach(var page in game.MemoryPages()) { | |
var scanner = new SignatureScanner(game, page.BaseAddress, (int)page.RegionSize); | |
ptr = IntPtr.Zero; | |
// Game1::Update | |
{ | |
ptr = scanner.Scan(new SigScanTarget(11, | |
"D9 1C 24", // fstp dword ptr [esp] | |
"FF 15 ????????", // call dword ptr [????????] | |
"8B 0D ????????" // mov ecx,[????????] - the address of OS::currentInstance | |
)); | |
if (ptr != IntPtr.Zero) | |
{ | |
OSpointer = ptr; | |
print("OSpointer: 0x" + OSpointer.ToString("X")); | |
} | |
} | |
// MusicManager::transitionToSong | |
{ | |
ptr = scanner.Scan(new SigScanTarget(10, | |
"8945E88945EC8BD98B0D ????????" | |
)); | |
if (ptr != IntPtr.Zero) | |
{ | |
currentSongPointer = ptr; | |
print("currentSongPointer: 0x" + currentSongPointer.ToString("X")); | |
} | |
} | |
} | |
if (OSpointer == IntPtr.Zero) { | |
throw new Exception("Failed to find the OS instance"); | |
} | |
if (currentSongPointer == IntPtr.Zero) { | |
throw new Exception("Failed to find the currentSong variable"); | |
} | |
vars.currentSong = new StringWatcher(new DeepPointer(currentSongPointer, 0x0, 0x8), ReadStringType.UTF16, 255); | |
vars.currentSong.Update(game); | |
print("Current Song:" + vars.currentSong.Current); | |
vars.isBooting = new MemoryWatcher<bool>(new DeepPointer((IntPtr) OSpointer, 0x0, 0x16c)); | |
vars.dlcMode = new MemoryWatcher<bool>(new DeepPointer((IntPtr) OSpointer, 0x0, 0x17b)); | |
vars.topbarDisabled = new MemoryWatcher<bool>(new DeepPointer((IntPtr) OSpointer, 0x0, 0x176)); | |
vars.preDLCNodesCache = new StringWatcher(new DeepPointer(OSpointer, 0x0, 0x114, 0x8), ReadStringType.UTF16, 255); | |
vars.connectedCompId = new StringWatcher(new DeepPointer(OSpointer, 0x0, 0x9c, 0x8, 0x8), ReadStringType.UTF16, 255); | |
// PlayingHeartbreak is 0x0, 0x9c, 0x34, 0x4, 0x8, 0x11 if this still isn't stable enough | |
vars.currentMissionEmailSubject = new StringWatcher(new DeepPointer(OSpointer, 0x0, 0x78, 0x68, 0x8), ReadStringType.UTF16, 255); | |
} | |
start { | |
return settings["Start"] && vars.isBooting.Current; | |
} | |
split { | |
if (settings["Start Trials"]) { | |
if (vars.currentSong.Changed && vars.currentSong.Current == "DLC\\Music\\snidelyWhiplash" && !vars.dlcMode.Current) { | |
print("Start Trials"); | |
return true; | |
} | |
} | |
if (settings["Finish Trials"]) { | |
if (vars.dlcMode.Current && !vars.dlcMode.Old) { | |
print("Finish Trials"); | |
return true; | |
} | |
} | |
if (settings["Finish DLC"]) { | |
//if (!vars.dlcMode.Current && vars.dlcMode.Old) { | |
if (vars.preDLCNodesCache.Changed && vars.preDLCNodesCache.Current == "") { | |
print("Finish DLC"); | |
return true; | |
} | |
} | |
if (settings["Finish Game"]) { | |
if (vars.topbarDisabled.Current && vars.connectedCompId.Current == "porthackHeart") { | |
print("Finish Game"); | |
return true; | |
} | |
} | |
if (settings["aggression"]) { | |
if (vars.currentMissionEmailSubject.Changed && vars.currentMissionEmailSubject.Current == "Aggression must be Punished") { | |
print("aggression"); | |
return true; | |
} | |
} | |
if (settings["CSEC"]) { | |
if (vars.currentMissionEmailSubject.Changed && vars.currentMissionEmailSubject.Current == "Bit -- Foundation") { | |
print("CSEC"); | |
return true; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment