-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
263 lines (119 loc) · 4.45 KB
/
main.py
File metadata and controls
263 lines (119 loc) · 4.45 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
import win32api
import datetime
import time
import os
os.system('cls')
os.makedirs("Backup/logs", exist_ok=True)
if not os.path.exists(r'Backup\\logs\\log.txt'):
log_file = open(os.path.join("Backup","logs","log.txt"), "w", encoding="utf-8")
log_file.write(f"log.txt was created: {datetime.datetime.now()}\n ")
log_file.close()
def log(text):
log_file = open(os.path.join("Backup","logs","log.txt"), "a+", encoding="utf-8")
log_file.write(f"{text}\n")
log_file.close()
print(text)
def exit():
os.system('pause')
os._exit(0)
path = os.path.join(os.getcwd())
offset = 0x00725D8C
data_missing = not os.path.exists(r'data.win')
UNDERTALE_missing = not os.path.exists(r'UNDERTALE.exe')
log_file = open(os.path.join("Backup","logs","log.txt"), "a+", encoding="utf-8")
log_file.write(f"###############################################################################################\n")
log_file.close()
log("""===============================
UNDERTALE DEBUG TOOL v1.0""")
log_file = open(os.path.join("Backup","logs","log.txt"), "a+", encoding="utf-8")
log_file.write(f" {datetime.datetime.now()}\n")
log_file.close()
log("""===============================""")
log("""Initialization
""")
if UNDERTALE_missing:
log("❌ UNDERTALE.exe is missing !")
log("🤣 Are you sure you put this .exe in your undertale folder ??????")
exit()
else:
log("- ✅ Undertale.exe found")
exe_info = win32api.GetFileVersionInfo(path + r"\UNDERTALE.exe", "\\")
version = f"{exe_info['FileVersionMS'] >> 16}.{exe_info['FileVersionMS'] & 0xFFFF}.{exe_info['FileVersionLS'] >> 16}.{exe_info['FileVersionLS'] & 0xFFFF}"
if data_missing:
log("❌ data.win is missing !")
log("🤣 Are you sure you put this .exe in your undertale folder ??????")
exit()
else:
log("- ✅ data.win found")
log("===============================")
log("""Backup
""")
if os.path.exists(r'Backup\\data'):
log("- ✅ Backup folder found")
else:
log("- ❌ Backup missing!")
log('- ⏳ Creation the folder Backup')
os.system('mkdir Backup\\data')
os.system('attrib +h Backup')
log("- ⏳ Verification")
time.sleep(1)
if os.path.exists(r'Backup\\data'):
log("- ✅ Backup was created")
else:
log("❌ Error !")
exit()
if os.path.exists(r'Backup\\data\\data.win'):
log("- ✅ Backup data.win found")
else:
log("- ⚠️ Backup data.win missing!")
log('- ⏳ Creation the data.win Backup')
os.system(f"copy \"{os.path.join(path, 'data.win')}\" \"{os.path.join(path, 'Backup', 'data', 'data.win')}\" >nul")
log("- ⏳ Verification")
time.sleep(1)
if os.path.exists(r'Backup\\data\\data.win'):
log("- ✅ Backup data.win was created")
else:
log("❌ Error !")
exit()
log("===============================")
log("""Information
""")
log("- 📁 Undertale from : " + path)
if version == "0.9.9.5":
offset = 0x00725D8C
log("- ✅ UNDERTALE.exe <= v1.001")
else:
log("❌ Your Undertale is not in 1.001")
exit()
log("===============================")
log("""DebugMode
""")
with open(path + r"\data.win", "rb+") as data:
data.seek(offset)
debug_bit = data.read(1)
data.seek(offset)
if debug_bit == b'\x00':
log("- 🔴 Debug Mode is Off")
choixOff = input("Do you want to enable the DebugMode ? (y/n)")
elif debug_bit == b'\x01':
log("- 🟢 Debug Mode is On")
choixOff = input("- ❓ Do you want to disable the DebugMode ? (y/n)")
else:
log("- ❌ Error version")
if choixOff.lower() == "y":
log("- ⏳ Applying changes to the game")
if debug_bit == b'\x01':
data.write(b'\x00')
else:
data.write(b'\x01')
log("- ⏳ Verification")
time.sleep(1)
data.seek(offset)
debug_bit_modified = data.read(1)
if not debug_bit == debug_bit_modified:
log("- ✅ The game has been successfully modified.")
else:
log("- ❌ Ur game is Dead 💀")
else:
log("- 👋 Exiting from the user")
exit()