-
Notifications
You must be signed in to change notification settings - Fork 0
/
neotwewy.asl
136 lines (110 loc) · 4.78 KB
/
neotwewy.asl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
state("NEO The World Ends with You", "1.0.0.0") {
int day: "GameAssembly.dll", 0x2506d68, 0x30, 0, 0xb8, 0, 0x28;
}
state("NEO The World Ends with You", "1.0.1.0") {
int day: "GameAssembly.dll", 0x27f38e8, 0x30, 0, 0xb8, 0, 0x28;
}
startup {
Assembly.Load(File.ReadAllBytes("Components/asl-help")).CreateInstance("Unity");
}
init {
version = game.MainModule.FileVersionInfo.ProductVersion;
vars.gameobject = IntPtr.Zero;
vars.loading = null;
vars.Helper.TryLoad = (Func<dynamic, bool>)(mono => {
vars.Helper["UIs"] = mono["UIManager", 1].Make<IntPtr>("msInstance", "mUIs");
// TODO: Consolidate the "end" and "battlestate" pointers.
vars.Helper["end"] = mono["BattleScene", 2].Make<bool>(
"msInstance",
// mSeq
0xb8,
// BattleSceneSequence::mLastBossFinishSeq
0x28,
// BattleSceneLastBossFinishSequence::mRindoAttackGuideUI
0x90,
// LastBattleRindoAttackButtonGuide::IsPush
0x50);
vars.Helper["fieldmanager"] = mono["FieldManager", 1].Make<IntPtr>(
"mInstance");
vars.Helper["fieldmanager"].FailAction = MemoryWatcher.ReadFailAction.SetZeroOrNull;
// vars.Helper["FieldMapDataManager"] = mono["FieldMapDataManager", 1].Make<IntPtr>("msInstance");
// vars.Helper["FieldMapDataManager"].FailAction = MemoryWatcher.ReadFailAction.SetZeroOrNull;
vars.Helper["battlestate"] = mono["BattleScene", 2].Make<byte>(
"msInstance",
// mSeq
0xb8,
// mInnerState
0x10);
vars.Helper["battlestate"].FailAction = MemoryWatcher.ReadFailAction.SetZeroOrNull;
return true;
});
}
isLoading {
if (vars.gameobject == IntPtr.Zero) {
// Iterate through the entries of a `Dictionary<int, GameObject>`.
// number of entries
int count = memory.ReadValue<int>((IntPtr)current.UIs + 0x20);
// Each entry is 0x20 bytes.
int max = count * 0x20;
IntPtr entries = memory.ReadPointer((IntPtr)current.UIs + 0x18);
// TODO: Just read the whole list of entries at once.
for (int offset = 0x28; offset < max; offset += 0x20) {
int key = memory.ReadValue<int>(entries + offset);
if (key == 0x102) {
vars.gameobject = memory.ReadPointer(entries + offset + 8);
print("gameobject found at " + vars.gameobject.ToString("X"));
break;
}
}
} else if (vars.loading == null) {
// We need to get the LoadingUI component from the game object that we have.
// Unity::GameObject.m_cachedPtr
// This is the il2cpp GameObject, not Unity::GameObject.
IntPtr rawGameObject = memory.ReadPointer((IntPtr)vars.gameobject + 0x10);
// GameObject.m_Component.m_size
int size = memory.ReadValue<int>(rawGameObject + 0x40);
// GameObject.m_Component.m_ptr (ComponentPair[size])
IntPtr m_ptr = memory.ReadPointer(rawGameObject + 0x30);
int max = size * 0x10;
for (int offset = 8; offset < max; offset += 0x10 ) {
// GameObject.m_Component.m_ptr[n].component
IntPtr component = memory.ReadPointer(m_ptr + offset);
// This is a hack.
string name = new DeepPointer(component + 0x28, 0, 0x10, 0).DerefString(game, 255);
if (name.Equals("LoadingUI")) {
// Component.m_GameObject.m_ptr->m_IsActive
vars.loading = new DeepPointer(component + 0x30, 0x56);
print("LoadingUI found at " + component.ToString("X"));
break;
}
}
} else {
//IntPtr controller = memory.ReadPointer((IntPtr)current.mapload + 0x38);
//IntPtr isLoad = memory.ReadPointer(controller + 0x18);
if (current.battlestate == 3) {
print("next battle round loading");
return true;
}
//FieldManager::m_FieldState
if (current.fieldmanager != IntPtr.Zero && memory.ReadValue<int>((IntPtr)current.fieldmanager + 0x18) == 0) {
// FieldManager::m_FieldMapDataManager
IntPtr FieldMapDataManager = memory.ReadValue<IntPtr>((IntPtr)current.fieldmanager + 0x58);
// FieldMapDataManager::m_IsLoadFieldMapScene
if (FieldMapDataManager != IntPtr.Zero && memory.ReadValue<bool>(FieldMapDataManager + 0x30)) {
print("map changing");
return true;
}
}
if (vars.loading.Deref<bool>(game)) {
print("loading");
return true;
}
return false;
}
}
split {
return current.day > old.day || (current.end && !old.end);
}
exit {
vars.gameobject = IntPtr.Zero;
}